[PATCH 3/5] Set timebase in the ffplay input and output filters.

Stefano Sabatini stefano.sabatini-lala
Tue Jun 8 23:31:04 CEST 2010


---
 ffplay.c |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/ffplay.c b/ffplay.c
index 4f254df..dd948d5 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -1700,6 +1700,7 @@ static int input_config_props(AVFilterLink *link)
     FilterPriv *priv  = link->src->priv;
     AVCodecContext *c = priv->is->video_st->codec;
 
+    link->src->output_pads[link->srcpad].time_base = priv->is->video_st->time_base;
     link->w = c->width;
     link->h = c->height;
 
@@ -1725,6 +1726,15 @@ static AVFilter input_filter =
                                   { .name = NULL }},
 };
 
+static int output_init(AVFilterContext *ctx, const char *args, void *opaque)
+{
+    FilterPriv *priv = ctx->priv;
+    if (!opaque) return AVERROR(EINVAL);
+
+    priv->is = opaque;
+    return 0;
+}
+
 static void output_end_frame(AVFilterLink *link)
 {
 }
@@ -1758,14 +1768,25 @@ static int get_filtered_video_frame(AVFilterContext *ctx, AVFrame *frame,
     return 1;
 }
 
+static int output_config_props(AVFilterLink *inlink)
+{
+    FilterPriv *priv  = inlink->dst->priv;
+    inlink->dst->input_pads[inlink->dstpad].time_base = priv->is->video_st->time_base;
+
+    return 0;
+}
+
 static AVFilter output_filter =
 {
     .name      = "ffplay_output",
+    .priv_size = sizeof(FilterPriv),
 
+    .init      = output_init,
     .query_formats = output_query_formats,
 
     .inputs    = (AVFilterPad[]) {{ .name          = "default",
                                     .type          = AVMEDIA_TYPE_VIDEO,
+                                    .config_props  = output_config_props,
                                     .end_frame     = output_end_frame,
                                     .min_perms     = AV_PERM_READ, },
                                   { .name = NULL }},
@@ -1793,7 +1814,7 @@ static int video_thread(void *arg)
     if(!(filt_out = avfilter_open(&output_filter, "out")))   goto the_end;
 
     if(avfilter_init_filter(filt_src, NULL, is))             goto the_end;
-    if(avfilter_init_filter(filt_out, NULL, frame))          goto the_end;
+    if(avfilter_init_filter(filt_out, NULL, is))             goto the_end;
 
 
     if(vfilters) {
-- 
1.6.0.4


--Dxnq1zWXvFF0Q93v--



More information about the ffmpeg-devel mailing list