Commit 3f2542bc authored by Steve Lhomme's avatar Steve Lhomme Committed by Jean-Baptiste Kempf

MKV: make sure the position we keep for reference is the one we read

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 988d3773
...@@ -673,7 +673,7 @@ bool matroska_segment_c::Preload( ) ...@@ -673,7 +673,7 @@ bool matroska_segment_c::Preload( )
msg_Dbg( &sys.demuxer, "| + Seek head" ); msg_Dbg( &sys.demuxer, "| + Seek head" );
if( i_seekhead_count < 10 ) if( i_seekhead_count < 10 )
{ {
i_seekhead_position = (int64_t) es.I_O().getFilePointer(); i_seekhead_position = el->GetElementPosition();
ParseSeekHead( static_cast<KaxSeekHead*>( el ) ); ParseSeekHead( static_cast<KaxSeekHead*>( el ) );
} }
} }
...@@ -681,29 +681,35 @@ bool matroska_segment_c::Preload( ) ...@@ -681,29 +681,35 @@ bool matroska_segment_c::Preload( )
{ {
/* Multiple allowed, mandatory */ /* Multiple allowed, mandatory */
msg_Dbg( &sys.demuxer, "| + Information" ); msg_Dbg( &sys.demuxer, "| + Information" );
if( i_info_position < 0 ) // FIXME if( i_info_position < 0 )
{
ParseInfo( static_cast<KaxInfo*>( el ) ); ParseInfo( static_cast<KaxInfo*>( el ) );
i_info_position = (int64_t) es.I_O().getFilePointer(); i_info_position = el->GetElementPosition();
}
} }
else if( MKV_IS_ID( el, KaxTracks ) ) else if( MKV_IS_ID( el, KaxTracks ) )
{ {
/* Multiple allowed */ /* Multiple allowed */
msg_Dbg( &sys.demuxer, "| + Tracks" ); msg_Dbg( &sys.demuxer, "| + Tracks" );
if( i_tracks_position < 0 ) // FIXME if( i_tracks_position < 0 )
{
ParseTracks( static_cast<KaxTracks*>( el ) ); ParseTracks( static_cast<KaxTracks*>( el ) );
}
if ( tracks.size() == 0 ) if ( tracks.size() == 0 )
{ {
msg_Err( &sys.demuxer, "No tracks supported" ); msg_Err( &sys.demuxer, "No tracks supported" );
return false; return false;
} }
i_tracks_position = (int64_t) es.I_O().getFilePointer(); i_tracks_position = el->GetElementPosition();
} }
else if( MKV_IS_ID( el, KaxCues ) ) else if( MKV_IS_ID( el, KaxCues ) )
{ {
msg_Dbg( &sys.demuxer, "| + Cues" ); msg_Dbg( &sys.demuxer, "| + Cues" );
if( i_cues_position < 0 ) if( i_cues_position < 0 )
{
LoadCues( static_cast<KaxCues*>( el ) ); LoadCues( static_cast<KaxCues*>( el ) );
i_cues_position = (int64_t) es.I_O().getFilePointer(); i_cues_position = el->GetElementPosition();
}
} }
else if( MKV_IS_ID( el, KaxCluster ) ) else if( MKV_IS_ID( el, KaxCluster ) )
{ {
...@@ -722,22 +728,28 @@ bool matroska_segment_c::Preload( ) ...@@ -722,22 +728,28 @@ bool matroska_segment_c::Preload( )
{ {
msg_Dbg( &sys.demuxer, "| + Attachments" ); msg_Dbg( &sys.demuxer, "| + Attachments" );
if( i_attachments_position < 0 ) if( i_attachments_position < 0 )
{
ParseAttachments( static_cast<KaxAttachments*>( el ) ); ParseAttachments( static_cast<KaxAttachments*>( el ) );
i_attachments_position = (int64_t) es.I_O().getFilePointer(); i_attachments_position = el->GetElementPosition();
}
} }
else if( MKV_IS_ID( el, KaxChapters ) ) else if( MKV_IS_ID( el, KaxChapters ) )
{ {
msg_Dbg( &sys.demuxer, "| + Chapters" ); msg_Dbg( &sys.demuxer, "| + Chapters" );
if( i_chapters_position < 0 ) if( i_chapters_position < 0 )
{
ParseChapters( static_cast<KaxChapters*>( el ) ); ParseChapters( static_cast<KaxChapters*>( el ) );
i_chapters_position = (int64_t) es.I_O().getFilePointer(); i_chapters_position = el->GetElementPosition();
}
} }
else if( MKV_IS_ID( el, KaxTags ) ) else if( MKV_IS_ID( el, KaxTags ) )
{ {
msg_Dbg( &sys.demuxer, "| + Tags" ); msg_Dbg( &sys.demuxer, "| + Tags" );
if( i_tags_position < 0) if( i_tags_position < 0)
{
LoadTags( static_cast<KaxTags*>( el ) ); LoadTags( static_cast<KaxTags*>( el ) );
i_tags_position = (int64_t) es.I_O().getFilePointer(); i_tags_position = el->GetElementPosition();
}
} }
else if( MKV_IS_ID( el, EbmlVoid ) ) else if( MKV_IS_ID( el, EbmlVoid ) )
msg_Dbg( &sys.demuxer, "| + Void" ); msg_Dbg( &sys.demuxer, "| + Void" );
...@@ -788,8 +800,10 @@ bool matroska_segment_c::LoadSeekHeadItem( const EbmlCallbacks & ClassInfos, int ...@@ -788,8 +800,10 @@ bool matroska_segment_c::LoadSeekHeadItem( const EbmlCallbacks & ClassInfos, int
/* Multiple allowed, mandatory */ /* Multiple allowed, mandatory */
msg_Dbg( &sys.demuxer, "| + Information" ); msg_Dbg( &sys.demuxer, "| + Information" );
if( i_info_position < 0 ) if( i_info_position < 0 )
{
ParseInfo( static_cast<KaxInfo*>( el ) ); ParseInfo( static_cast<KaxInfo*>( el ) );
i_info_position = i_element_position; i_info_position = i_element_position;
}
} }
else if( MKV_IS_ID( el, KaxTracks ) ) // FIXME else if( MKV_IS_ID( el, KaxTracks ) ) // FIXME
{ {
...@@ -810,29 +824,37 @@ bool matroska_segment_c::LoadSeekHeadItem( const EbmlCallbacks & ClassInfos, int ...@@ -810,29 +824,37 @@ bool matroska_segment_c::LoadSeekHeadItem( const EbmlCallbacks & ClassInfos, int
{ {
msg_Dbg( &sys.demuxer, "| + Cues" ); msg_Dbg( &sys.demuxer, "| + Cues" );
if( i_cues_position < 0 ) if( i_cues_position < 0 )
{
LoadCues( static_cast<KaxCues*>( el ) ); LoadCues( static_cast<KaxCues*>( el ) );
i_cues_position = i_element_position; i_cues_position = i_element_position;
}
} }
else if( MKV_IS_ID( el, KaxAttachments ) ) else if( MKV_IS_ID( el, KaxAttachments ) )
{ {
msg_Dbg( &sys.demuxer, "| + Attachments" ); msg_Dbg( &sys.demuxer, "| + Attachments" );
if( i_attachments_position < 0 ) if( i_attachments_position < 0 )
{
ParseAttachments( static_cast<KaxAttachments*>( el ) ); ParseAttachments( static_cast<KaxAttachments*>( el ) );
i_attachments_position = i_element_position; i_attachments_position = i_element_position;
}
} }
else if( MKV_IS_ID( el, KaxChapters ) ) else if( MKV_IS_ID( el, KaxChapters ) )
{ {
msg_Dbg( &sys.demuxer, "| + Chapters" ); msg_Dbg( &sys.demuxer, "| + Chapters" );
if( i_chapters_position < 0 ) if( i_chapters_position < 0 )
{
ParseChapters( static_cast<KaxChapters*>( el ) ); ParseChapters( static_cast<KaxChapters*>( el ) );
i_chapters_position = i_element_position; i_chapters_position = i_element_position;
}
} }
else if( MKV_IS_ID( el, KaxTags ) ) else if( MKV_IS_ID( el, KaxTags ) )
{ {
msg_Dbg( &sys.demuxer, "| + Tags" ); msg_Dbg( &sys.demuxer, "| + Tags" );
if( i_tags_position < 0 ) if( i_tags_position < 0 )
{
LoadTags( static_cast<KaxTags*>( el ) ); LoadTags( static_cast<KaxTags*>( el ) );
i_tags_position = i_element_position; i_tags_position = i_element_position;
}
} }
else else
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment