[FFmpeg-cvslog] libavformat/utils: Only consider dvb teletext timestamps for start time when they are consistent with the rest .
Michael Niedermayer
git at videolan.org
Thu May 12 04:03:25 CEST 2011
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu May 12 03:40:21 2011 +0200| [4ea216e761e02d3f6973b316feaf3484be91a14f] | committer: Michael Niedermayer
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 at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4ea216e761e02d3f6973b316feaf3484be91a14f
---
libavformat/utils.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 7624cb4..b6368ed 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) {
More information about the ffmpeg-cvslog
mailing list