[FFmpeg-devel] [PATCH 3/7] Set timebase in the ffplay input and output filters.

Michael Niedermayer michaelni
Mon Oct 11 15:47:01 CEST 2010


On Mon, Oct 11, 2010 at 02:04:02PM +0200, Stefano Sabatini wrote:
> ---
>  ffplay.c |   28 ++++++++++++++++++++++++++--
>  1 files changed, 26 insertions(+), 2 deletions(-)
> 
> diff --git a/ffplay.c b/ffplay.c
> index 9927006..5d6e2d1 100644
> --- a/ffplay.c
> +++ b/ffplay.c
> @@ -1755,6 +1755,7 @@ static int input_config_props(AVFilterLink *link)
>  
>      link->w = c->width;
>      link->h = c->height;
> +    link->time_base = priv->is->video_st->time_base;
>  
>      return 0;
>  }
> @@ -1778,8 +1779,29 @@ static AVFilter input_filter =
>                                    { .name = NULL }},
>  };
>  
> -static void output_end_frame(AVFilterLink *link)
> +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 *inlink)
> +{
> +    AVFilterContext *ctx = inlink->dst;
> +    FilterPriv *priv = ctx->priv;
> +    AVRational dst_time_base = priv->is->video_st->time_base;
> +
> +    if (av_cmp_q(inlink->time_base, dst_time_base)) {
> +        int64_t pts1 = inlink->cur_buf->pts;
> +        inlink->cur_buf->pts = av_rescale_q(pts1, inlink->time_base, dst_time_base);
> +        av_log(ctx, AV_LOG_DEBUG,
> +               "tb:%d/%d pts:%"PRId64" -> tb:%d/%d pts:%"PRId64"\n",
> +               inlink->time_base.num, inlink->time_base.den, pts1,
> +               dst_time_base.num, dst_time_base.den, inlink->cur_buf->pts);
> +    }
>  }

isnt it simpler to let get_filtered_video_frame()
return the tb and do the rescaling outside?

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 1
"Used only once"    - "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101011/6dffe594/attachment.pgp>



More information about the ffmpeg-devel mailing list