summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2010-10-12 18:40:16 +0000
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2010-10-12 18:40:16 +0000
commit387b4ac993528d6e25b3d6fe49d5d360b8e62e98 (patch)
tree03a8dac378bbf3b4790e0fd63c1a339c4ae4b5ea
parent610312e904edaad31d91e7799ff6f7f8ee69a119 (diff)
Fix timebase handling at the begin and at the end of the ffplay video
filterchain. Set timebase in the ffplay input, and make get_filtered_video_frame() rescale the output frames PTSes according to their timebase. Originally committed as revision 25450 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--ffplay.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/ffplay.c b/ffplay.c
index 6b3df467e7..dc031a3bb5 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;
}
@@ -1791,7 +1792,7 @@ static int output_query_formats(AVFilterContext *ctx)
}
static int get_filtered_video_frame(AVFilterContext *ctx, AVFrame *frame,
- int64_t *pts, int64_t *pos)
+ int64_t *pts, AVRational *tb, int64_t *pos)
{
AVFilterBufferRef *pic;
@@ -1804,6 +1805,7 @@ static int get_filtered_video_frame(AVFilterContext *ctx, AVFrame *frame,
frame->opaque = pic;
*pts = pic->pts;
*pos = pic->pos;
+ *tb = ctx->inputs[0]->time_base;
memcpy(frame->data, pic->data, sizeof(frame->data));
memcpy(frame->linesize, pic->linesize, sizeof(frame->linesize));
@@ -1882,11 +1884,22 @@ static int video_thread(void *arg)
for(;;) {
#if !CONFIG_AVFILTER
AVPacket pkt;
+#else
+ AVRational tb;
#endif
while (is->paused && !is->videoq.abort_request)
SDL_Delay(10);
#if CONFIG_AVFILTER
- ret = get_filtered_video_frame(filt_out, frame, &pts_int, &pos);
+ ret = get_filtered_video_frame(filt_out, frame, &pts_int, &tb, &pos);
+
+ if (av_cmp_q(tb, is->video_st->time_base)) {
+ int64_t pts1 = pts_int;
+ pts_int = av_rescale_q(pts_int, tb, is->video_st->time_base);
+ av_log(NULL, AV_LOG_DEBUG, "video_thread(): "
+ "tb:%d/%d pts:%"PRId64" -> tb:%d/%d pts:%"PRId64"\n",
+ tb.num, tb.den, pts1,
+ is->video_st->time_base.num, is->video_st->time_base.den, pts_int);
+ }
#else
ret = get_video_frame(is, frame, &pts_int, &pkt);
#endif