[vlc-commits] demux: mp4: move fragmented duration computation
Francois Cartegnie
git at videolan.org
Thu Jun 11 16:52:20 CEST 2015
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Jun 11 16:32:38 2015 +0200| [f3590c78f4434bf0a443382c7c76a8df60a63373] | committer: Francois Cartegnie
demux: mp4: move fragmented duration computation
tracks aren't init yet, so we can't compute duration
when falling back from missing mehd
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f3590c78f4434bf0a443382c7c76a8df60a63373
---
modules/demux/mp4/mp4.c | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index 8554e65..2c1a72b 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -833,23 +833,6 @@ static int Open( vlc_object_t * p_this )
}
}
- if ( p_sys->i_overall_duration == 0 )
- {
- /* Try in mehd if fragmented */
- MP4_Box_t *p_mehd = MP4_BoxGet( p_demux->p_sys->p_root, "moov/mvex/mehd");
- if ( p_mehd && p_mehd->data.p_mehd )
- p_sys->i_overall_duration = p_mehd->data.p_mehd->i_fragment_duration;
- else
- {
- for( i = 0; i < p_sys->i_tracks; i++ )
- {
- mtime_t i_duration = GetTrackDurationInFragment( &p_sys->moovfragment,
- p_sys->track[i].i_track_ID );
- p_sys->i_overall_duration = __MAX( p_sys->i_overall_duration, (uint64_t)i_duration );
- }
- }
- }
-
const unsigned i_tracks = MP4_BoxCount( p_sys->p_root, "/moov/trak" );
if( i_tracks < 1 )
{
@@ -926,6 +909,23 @@ static int Open( vlc_object_t * p_this )
}
}
+ if ( p_sys->i_overall_duration == 0 )
+ {
+ /* Try in mehd if fragmented */
+ MP4_Box_t *p_mehd = MP4_BoxGet( p_demux->p_sys->p_root, "moov/mvex/mehd");
+ if ( p_mehd && p_mehd->data.p_mehd )
+ p_sys->i_overall_duration = p_mehd->data.p_mehd->i_fragment_duration;
+ else
+ {
+ for( i = 0; i < p_sys->i_tracks; i++ )
+ {
+ mtime_t i_duration = GetTrackDurationInFragment( &p_sys->moovfragment,
+ p_sys->track[i].i_track_ID );
+ p_sys->i_overall_duration = __MAX( p_sys->i_overall_duration, (uint64_t)i_duration );
+ }
+ }
+ }
+
#ifdef MP4_VERBOSE
mtime_t i_total_duration = 0;
mp4_fragment_t *p_fragment = &p_sys->moovfragment;
More information about the vlc-commits
mailing list