diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-05-12 03:40:21 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-05-12 03:40:21 +0200 |
commit | 4ea216e761e02d3f6973b316feaf3484be91a14f (patch) | |
tree | 5cb6f83dacd2396e2c64b10657f138dab9ea21fd | |
parent | b8a4b0152a3a697e03fd28458098a514fcdee5d3 (diff) | |
download | ffmpeg-4ea216e761e02d3f6973b316feaf3484be91a14f.tar.gz |
libavformat/utils: Only consider dvb teletext timestamps for start time when they are consistent with the rest.
This fixes Ticket51.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/utils.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 7624cb4f67..b6368edcd1 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1797,18 +1797,23 @@ static int av_has_duration(AVFormatContext *ic) */ static void av_update_stream_timings(AVFormatContext *ic) { - int64_t start_time, start_time1, end_time, end_time1; + int64_t start_time, start_time1, start_time_text, end_time, end_time1; int64_t duration, duration1; int i; AVStream *st; start_time = INT64_MAX; + start_time_text = INT64_MAX; end_time = INT64_MIN; duration = INT64_MIN; for(i = 0;i < ic->nb_streams; i++) { st = ic->streams[i]; if (st->start_time != AV_NOPTS_VALUE && st->time_base.den) { start_time1= av_rescale_q(st->start_time, st->time_base, AV_TIME_BASE_Q); + if (st->codec->codec_id == CODEC_ID_DVB_TELETEXT) { + if (start_time1 < start_time_text) + start_time_text = start_time1; + } else if (start_time1 < start_time) start_time = start_time1; if (st->duration != AV_NOPTS_VALUE) { @@ -1824,6 +1829,8 @@ static void av_update_stream_timings(AVFormatContext *ic) duration = duration1; } } + if (start_time == INT64_MAX || (start_time > start_time_text && start_time - start_time_text < AV_TIME_BASE)) + start_time = start_time_text; if (start_time != INT64_MAX) { ic->start_time = start_time; if (end_time != INT64_MIN) { |