diff options
author | Joakim Plate <elupus@ecce.se> | 2011-09-13 01:02:48 +0200 |
---|---|---|
committer | Joakim Plate <elupus@ecce.se> | 2011-09-14 20:08:43 +0200 |
commit | cdced09ef6e40212bc69486c6d314a7f48e5647d (patch) | |
tree | b94781bdbfadaee791628334152a0026da60e314 /libavformat | |
parent | 5d7053680479a75562258c010715761c4285fd7f (diff) | |
download | ffmpeg-cdced09ef6e40212bc69486c6d314a7f48e5647d.tar.gz |
Don't override duration from file header with bitrate duration
This is most noticable on matroska files which has duration
as part of it's header.
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/utils.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 36107c3f98..8138069bfd 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1856,6 +1856,8 @@ static int has_duration(AVFormatContext *ic) { int i; AVStream *st; + if(ic->duration != AV_NOPTS_VALUE) + return 1; for(i = 0;i < ic->nb_streams; i++) { st = ic->streams[i]; @@ -1913,14 +1915,14 @@ static void update_stream_timings(AVFormatContext *ic) duration = end_time - start_time; } } - if (duration != INT64_MIN) { + if (duration != INT64_MIN && ic->duration == AV_NOPTS_VALUE) { ic->duration = duration; - if (ic->file_size > 0) { + } + if (ic->file_size > 0 && ic->duration != AV_NOPTS_VALUE) { /* compute the bitrate */ ic->bit_rate = (double)ic->file_size * 8.0 * AV_TIME_BASE / (double)ic->duration; } - } } static void fill_all_stream_timings(AVFormatContext *ic) |