+/* Here we try to load elements that were found in Seek Heads, but not yet parsed */
+bool matroska_segment_c::LoadSeekHeadItem( const EbmlCallbacks & ClassInfos, int64_t i_element_position )
+{
+ int64_t i_sav_position = (int64_t)es.I_O().getFilePointer();
+ EbmlElement *el;
+
+ es.I_O().setFilePointer( i_element_position, seek_beginning );
+ el = es.FindNextID( ClassInfos, 0xFFFFFFFFL);
+
+ if( el == NULL )
+ {
+ msg_Err( &sys.demuxer, "cannot load some cues/chapters/tags etc. (broken seekhead or file)" );
+ es.I_O().setFilePointer( i_sav_position, seek_beginning );
+ return false;
+ }
+
+ if( MKV_IS_ID( el, KaxSeekHead ) )
+ {
+ /* Multiple allowed */
+ msg_Dbg( &sys.demuxer, "| + Seek head" );
+ if( i_seekhead_count < 10 )
+ {
+ i_seekhead_position = i_element_position;
+ ParseSeekHead( static_cast<KaxSeekHead*>( el ) );
+ }
+ }
+ else if( MKV_IS_ID( el, KaxInfo ) ) // FIXME
+ {
+ /* Multiple allowed, mandatory */
+ msg_Dbg( &sys.demuxer, "| + Information" );
+ if( i_info_position < 0 )
+ ParseInfo( static_cast<KaxInfo*>( el ) );
+ i_info_position = i_element_position;
+ }
+ else if( MKV_IS_ID( el, KaxTracks ) ) // FIXME
+ {
+ /* Multiple allowed */
+ msg_Dbg( &sys.demuxer, "| + Tracks" );
+ if( i_tracks_position < 0 )
+ ParseTracks( static_cast<KaxTracks*>( el ) );
+ if ( tracks.size() == 0 )
+ {
+ msg_Err( &sys.demuxer, "No tracks supported" );
+ delete el;
+ es.I_O().setFilePointer( i_sav_position, seek_beginning );
+ return false;
+ }
+ i_tracks_position = i_element_position;
+ }
+ else if( MKV_IS_ID( el, KaxCues ) )
+ {
+ msg_Dbg( &sys.demuxer, "| + Cues" );
+ if( i_cues_position < 0 )
+ LoadCues( static_cast<KaxCues*>( el ) );
+ i_cues_position = i_element_position;
+ }
+ else if( MKV_IS_ID( el, KaxAttachments ) )
+ {
+ msg_Dbg( &sys.demuxer, "| + Attachments" );
+ if( i_attachments_position < 0 )
+ ParseAttachments( static_cast<KaxAttachments*>( el ) );
+ i_attachments_position = i_element_position;
+ }
+ else if( MKV_IS_ID( el, KaxChapters ) )
+ {
+ msg_Dbg( &sys.demuxer, "| + Chapters" );
+ if( i_chapters_position < 0 )
+ ParseChapters( static_cast<KaxChapters*>( el ) );
+ i_chapters_position = i_element_position;
+ }
+ else if( MKV_IS_ID( el, KaxTag ) ) // FIXME
+ {
+ msg_Dbg( &sys.demuxer, "| + Tags" );
+ if( i_tags_position < 0 )
+ ;//LoadTags( static_cast<KaxTags*>( el ) );
+ i_tags_position = i_element_position;
+ }
+ else
+ {
+ msg_Dbg( &sys.demuxer, "| + LoadSeekHeadItem Unknown (%s)", typeid(*el).name() );
+ }
+ delete el;
+
+ es.I_O().setFilePointer( i_sav_position, seek_beginning );
+ return true;
+}
+