[FFmpeg-devel] [PATCH] lavfi/tinterlace: set output framerate

Stefano Sabatini stefasab at gmail.com
Thu Apr 25 15:44:09 CEST 2013


---
 libavfilter/vf_tinterlace.c |   21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_tinterlace.c b/libavfilter/vf_tinterlace.c
index 13b8ce2..93f0aac 100644
--- a/libavfilter/vf_tinterlace.c
+++ b/libavfilter/vf_tinterlace.c
@@ -113,12 +113,24 @@ static int config_out_props(AVFilterLink *outlink)
     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(outlink->format);
     TInterlaceContext *tinterlace = ctx->priv;
 
+    outlink->frame_rate = inlink->frame_rate;
+
     tinterlace->vsub = desc->log2_chroma_h;
     outlink->w = inlink->w;
     outlink->h = tinterlace->mode == MODE_MERGE || tinterlace->mode == MODE_PAD ?
         inlink->h*2 : inlink->h;
 
-    if (tinterlace->mode == MODE_PAD) {
+    switch (tinterlace->mode) {
+    case MODE_MERGE:
+    case MODE_DROP_EVEN:
+    case MODE_DROP_ODD:
+    case MODE_INTERLEAVE_TOP:
+    case MODE_INTERLEAVE_BOTTOM:
+        outlink->frame_rate.den *= 2;
+        break;
+
+    case MODE_PAD:
+    {
         uint8_t black[4] = { 16, 128, 128, 16 };
         int i, ret;
         if (ff_fmt_is_in(outlink->format, full_scale_yuvj_pix_fmts))
@@ -135,6 +147,13 @@ static int config_out_props(AVFilterLink *outlink)
                    tinterlace->black_linesize[i] * h);
         }
     }
+    break;
+
+    case MODE_INTERLACEX2:
+        outlink->frame_rate.num *= 2;
+        break;
+    }
+
     if ((tinterlace->flags & TINTERLACE_FLAG_VLPF)
             && !(tinterlace->mode == MODE_INTERLEAVE_TOP
               || tinterlace->mode == MODE_INTERLEAVE_BOTTOM)) {
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list