summaryrefslogtreecommitdiff
path: root/ffplay.c
diff options
context:
space:
mode:
authorJai Menon <jmenon86@gmail.com>2010-05-24 14:19:44 +0000
committerJai Menon <jmenon86@gmail.com>2010-05-24 14:19:44 +0000
commit12bd3c1f99f11ea21b32e5720908f258d0c5097a (patch)
treebb65a7d52452e57ae61264f2b90aaf8301ff1aec /ffplay.c
parent612dc0238aa2583905aba35601a0160d0f841dd8 (diff)
FFplay : Implement custom reget_buffer for the input filter.
Originally committed as revision 23287 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffplay.c')
-rw-r--r--ffplay.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/ffplay.c b/ffplay.c
index 2e2149e9a2..86040bec3f 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -1609,6 +1609,25 @@ static void input_release_buffer(AVCodecContext *codec, AVFrame *pic)
avfilter_unref_pic(pic->opaque);
}
+static int input_reget_buffer(AVCodecContext *codec, AVFrame *pic)
+{
+ AVFilterPicRef *ref = pic->opaque;
+
+ if (pic->data[0] == NULL) {
+ pic->buffer_hints |= FF_BUFFER_HINTS_READABLE;
+ return codec->get_buffer(codec, pic);
+ }
+
+ if ((codec->width != ref->w) || (codec->height != ref->h) ||
+ (codec->pix_fmt != ref->pic->format)) {
+ av_log(codec, AV_LOG_ERROR, "Picture properties changed.\n");
+ return -1;
+ }
+
+ pic->reordered_opaque = codec->reordered_opaque;
+ return 0;
+}
+
static int input_init(AVFilterContext *ctx, const char *args, void *opaque)
{
FilterPriv *priv = ctx->priv;
@@ -1622,6 +1641,7 @@ static int input_init(AVFilterContext *ctx, const char *args, void *opaque)
priv->use_dr1 = 1;
codec->get_buffer = input_get_buffer;
codec->release_buffer = input_release_buffer;
+ codec->reget_buffer = input_reget_buffer;
}
priv->frame = avcodec_alloc_frame();