Browse code

FFplay : Implement custom reget_buffer for the input filter.

Originally committed as revision 23287 to svn://svn.ffmpeg.org/ffmpeg/trunk

Jai Menon authored on 2010/05/24 23:19:44
Showing 1 changed files
... ...
@@ -1609,6 +1609,25 @@ static void input_release_buffer(AVCodecContext *codec, AVFrame *pic)
1609 1609
     avfilter_unref_pic(pic->opaque);
1610 1610
 }
1611 1611
 
1612
+static int input_reget_buffer(AVCodecContext *codec, AVFrame *pic)
1613
+{
1614
+    AVFilterPicRef *ref = pic->opaque;
1615
+
1616
+    if (pic->data[0] == NULL) {
1617
+        pic->buffer_hints |= FF_BUFFER_HINTS_READABLE;
1618
+        return codec->get_buffer(codec, pic);
1619
+    }
1620
+
1621
+    if ((codec->width != ref->w) || (codec->height != ref->h) ||
1622
+        (codec->pix_fmt != ref->pic->format)) {
1623
+        av_log(codec, AV_LOG_ERROR, "Picture properties changed.\n");
1624
+        return -1;
1625
+    }
1626
+
1627
+    pic->reordered_opaque = codec->reordered_opaque;
1628
+    return 0;
1629
+}
1630
+
1612 1631
 static int input_init(AVFilterContext *ctx, const char *args, void *opaque)
1613 1632
 {
1614 1633
     FilterPriv *priv = ctx->priv;
... ...
@@ -1622,6 +1641,7 @@ static int input_init(AVFilterContext *ctx, const char *args, void *opaque)
1622 1622
         priv->use_dr1 = 1;
1623 1623
         codec->get_buffer     = input_get_buffer;
1624 1624
         codec->release_buffer = input_release_buffer;
1625
+        codec->reget_buffer   = input_reget_buffer;
1625 1626
     }
1626 1627
 
1627 1628
     priv->frame = avcodec_alloc_frame();