diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-09-30 11:49:53 +0400 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2012-10-04 12:21:58 +0400 |
commit | ab35ec29a4071871934856c00da7d6ebcc0c095b (patch) | |
tree | 17604051dbade30a1176f16545cd2f08eba92001 /libavfilter | |
parent | cd15b7c03d8df29d4c69b0620cf27d4a8c9dfb65 (diff) |
vf_overlay: get rid of pointless messing with timebase.
Output frames correspond 1:1 to input frames on the main input.
So use the main input timebase for output.
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/vf_overlay.c | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c index 6dd9be4975..74c356e215 100644 --- a/libavfilter/vf_overlay.c +++ b/libavfilter/vf_overlay.c @@ -181,24 +181,10 @@ fail: static int config_output(AVFilterLink *outlink) { AVFilterContext *ctx = outlink->src; - int exact; - // common timebase computation: - AVRational tb1 = ctx->inputs[MAIN ]->time_base; - AVRational tb2 = ctx->inputs[OVERLAY]->time_base; - AVRational *tb = &ctx->outputs[0]->time_base; - exact = av_reduce(&tb->num, &tb->den, - av_gcd((int64_t)tb1.num * tb2.den, - (int64_t)tb2.num * tb1.den), - (int64_t)tb1.den * tb2.den, INT_MAX); - av_log(ctx, AV_LOG_VERBOSE, - "main_tb:%d/%d overlay_tb:%d/%d -> tb:%d/%d exact:%d\n", - tb1.num, tb1.den, tb2.num, tb2.den, tb->num, tb->den, exact); - if (!exact) - av_log(ctx, AV_LOG_WARNING, - "Timestamp conversion inexact, timestamp information loss may occurr\n"); outlink->w = ctx->inputs[MAIN]->w; outlink->h = ctx->inputs[MAIN]->h; + outlink->time_base = ctx->inputs[MAIN]->time_base; return 0; } @@ -217,10 +203,9 @@ static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref) if (!outpicref) return AVERROR(ENOMEM); - outpicref->pts = av_rescale_q(outpicref->pts, ctx->inputs[MAIN]->time_base, - ctx->outputs[0]->time_base); - - if (!over->overpicref || over->overpicref->pts < outpicref->pts) { + if (!over->overpicref || + av_compare_ts(over->overpicref->pts, inlink->time_base, + outpicref->pts, ctx->inputs[OVERLAY]->time_base) < 0) { AVFilterBufferRef *old = over->overpicref; over->overpicref = NULL; ff_request_frame(ctx->inputs[OVERLAY]); @@ -242,8 +227,6 @@ static int start_frame_overlay(AVFilterLink *inlink, AVFilterBufferRef *inpicref inlink->cur_buf = NULL; avfilter_unref_bufferp(&over->overpicref); over->overpicref = inpicref; - over->overpicref->pts = av_rescale_q(inpicref->pts, ctx->inputs[OVERLAY]->time_base, - ctx->outputs[0]->time_base); return 0; } |