diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-10-04 15:11:45 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-10-04 15:11:45 +0400 |
commit | 0f1446a4d010a1210c8b13562e83c9b157553764 (patch) | |
tree | d774ba3ebddf721dfac6357d8d958ce757a63fa3 /libavfilter | |
parent | 741f5b021a0494676de0dab543f8a9591ec2e01e (diff) | |
parent | ab35ec29a4071871934856c00da7d6ebcc0c095b (diff) |
Merge commit 'ab35ec29a4071871934856c00da7d6ebcc0c095b'
* commit 'ab35ec29a4071871934856c00da7d6ebcc0c095b':
vf_overlay: get rid of pointless messing with timebase.
samplefmt: make av_samples_alloc() initialize the data to silence.
libspeexdec: handle NULL return value from speex_packet_to_header()
h264probe: Don't error out on bits that no longer are reserved
mpegvideo: set extended_data in ff_update_duplicate_context()
libspeexdec: properly handle DTX for multiple frames-per-packet
libspeexdec: move the SpeexHeader from LibSpeexContext to where it is used
libspeexdec: simplify setting of frame_size
libspeexdec: set channel_layout
Conflicts:
libavfilter/vf_overlay.c
libavformat/h264dec.c
libavutil/version.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/vf_overlay.c | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c index 7e5e6d0b6f..c4bdcb78a6 100644 --- a/libavfilter/vf_overlay.c +++ b/libavfilter/vf_overlay.c @@ -276,24 +276,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; } @@ -448,7 +434,8 @@ static int try_start_frame(AVFilterContext *ctx, AVFilterBufferRef *mainpic) * before the main frame, we can drop the current overlay. */ while (1) { next_overpic = ff_bufqueue_peek(&over->queue_over, 0); - if (!next_overpic || next_overpic->pts > mainpic->pts) + if (!next_overpic || av_compare_ts(next_overpic->pts, ctx->inputs[OVERLAY]->time_base, + mainpic->pts , ctx->inputs[MAIN]->time_base) > 0) break; ff_bufqueue_get(&over->queue_over); avfilter_unref_buffer(over->overpicref); @@ -457,7 +444,8 @@ static int try_start_frame(AVFilterContext *ctx, AVFilterBufferRef *mainpic) /* If there is no next frame and no EOF and the overlay frame is before * the main frame, we can not know yet if it will be superseded. */ if (!over->queue_over.available && !over->overlay_eof && - (!over->overpicref || over->overpicref->pts < mainpic->pts)) + (!over->overpicref || av_compare_ts(over->overpicref->pts, ctx->inputs[OVERLAY]->time_base, + mainpic->pts , ctx->inputs[MAIN]->time_base) < 0)) return AVERROR(EAGAIN); /* At this point, we know that the current overlay frame extends to the * time of the main frame. */ @@ -525,8 +513,6 @@ static int start_frame_main(AVFilterLink *inlink, AVFilterBufferRef *inpicref) if ((ret = flush_frames(ctx)) < 0) return ret; - inpicref->pts = av_rescale_q(inpicref->pts, ctx->inputs[MAIN]->time_base, - ctx->outputs[0]->time_base); if ((ret = try_start_frame(ctx, inpicref)) < 0) { if (ret != AVERROR(EAGAIN)) return ret; @@ -583,8 +569,6 @@ static int end_frame_over(AVFilterLink *inlink) if ((ret = flush_frames(ctx)) < 0) return ret; - inpicref->pts = av_rescale_q(inpicref->pts, ctx->inputs[OVERLAY]->time_base, - ctx->outputs[0]->time_base); ff_bufqueue_add(ctx, &over->queue_over, inpicref); ret = try_push_frame(ctx); return ret == AVERROR(EAGAIN) ? 0 : ret; |