[FFmpeg-devel] [PATCH] avfilter/vf_telecine: Add ts_mode option for using the first input timestamp

Paul B Mahol onemda at gmail.com
Wed Mar 25 19:38:08 CET 2015


Dana 25. 3. 2015. 19:07 osoba "Himangi Saraogi" <himangi774 at gmail.com>
napisala je:
>
> ---
>  libavfilter/vf_telecine.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/libavfilter/vf_telecine.c b/libavfilter/vf_telecine.c
> index a0f28d4..aaad2b5 100644
> --- a/libavfilter/vf_telecine.c
> +++ b/libavfilter/vf_telecine.c
> @@ -38,6 +38,8 @@ typedef struct {
>      int first_field;
>      char *pattern;
>      unsigned int pattern_pos;
> +    int ts_mode;
> +    int64_t start_time;
>
>      AVRational pts;
>      double ts_unit;
> @@ -62,6 +64,7 @@ static const AVOption telecine_options[] = {
>          {"bottom", "select bottom field first",             0,
AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "field"},
>          {"b",      "select bottom field first",             0,
AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "field"},
>      {"pattern", "pattern that describe for how many fields a frame is to
be displayed", OFFSET(pattern), AV_OPT_TYPE_STRING, {.str="23"}, 0, 0,
FLAGS},
> +    {"ts_mode", "set to choose timestamp handling as being with respect
to the input", OFFSET(ts_mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS},
>      {NULL}

Why ts_mode is not by default 1?

>  };
>
> @@ -89,6 +92,10 @@ static av_cold int init(AVFilterContext *ctx)
>          s->pts.den += *p - '0';
>      }
>
> +    s->start_time = 0;
> +    if (s->ts_mode)
> +         s->start_time = -1;
> +
>      s->out_cnt = (max + 1) / 2;
>      av_log(ctx, AV_LOG_INFO, "Telecine pattern %s yields up to %d frames
per frame, pts advance factor: %d/%d\n",
>             s->pattern, s->out_cnt, s->pts.num, s->pts.den);
> @@ -173,6 +180,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame
*inpicref)
>      TelecineContext *s = ctx->priv;
>      int i, len, ret = 0, nout = 0;
>
> +    if (s->start_time < 0)
> +        s->start_time = inpicref->pts;
> +
>      len = s->pattern[s->pattern_pos] - '0';
>
>      s->pattern_pos++;
> @@ -235,7 +245,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame
*inpicref)
>              return AVERROR(ENOMEM);
>          }
>
> -        frame->pts = outlink->frame_count * s->ts_unit;
> +        frame->pts = s->start_time + outlink->frame_count * s->ts_unit;
>          ret = ff_filter_frame(outlink, frame);
>      }
>      av_frame_free(&inpicref);
> --
> 1.9.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


More information about the ffmpeg-devel mailing list