aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2013-10-04 10:12:07 +0300
committerMartin Storsjö <martin@martin.st>2013-10-05 00:01:18 +0300
commit583a287f6f48f263859df142e6f90993e4217c72 (patch)
tree23c181138a5fe58b0cd401448db255b36ae9b282
parentd347a7b248d4ffdc278373fecf033b0ade030343 (diff)
downloadffmpeg-583a287f6f48f263859df142e6f90993e4217c72.tar.gz
ismindex: Calculate the file duration among the included tracks
If the input file contains other tracks (non video/audio) that aren't included in ismindex, the global file duration as returned by libavformat might not be equal to the maximum of the duration of the actual included tracks. Signed-off-by: Martin Storsjö <martin@martin.st>
-rw-r--r--tools/ismindex.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/ismindex.c b/tools/ismindex.c
index 64fa7e80c0..d5cf1382f8 100644
--- a/tools/ismindex.c
+++ b/tools/ismindex.c
@@ -292,8 +292,6 @@ static int handle_file(struct Tracks *tracks, const char *file, int split)
fprintf(stderr, "No streams found in %s\n", file);
goto fail;
}
- if (!tracks->duration)
- tracks->duration = ctx->duration;
for (i = 0; i < ctx->nb_streams; i++) {
struct Track **temp;
@@ -332,6 +330,10 @@ static int handle_file(struct Tracks *tracks, const char *file, int split)
continue;
}
+ tracks->duration = FFMAX(tracks->duration,
+ av_rescale_rnd(track->duration, AV_TIME_BASE,
+ track->timescale, AV_ROUND_UP));
+
if (track->is_audio) {
if (tracks->audio_track < 0)
tracks->audio_track = tracks->nb_tracks;