Commit e7228cea authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

MKV: code factorization on Tag parsing

parent a11cf154
...@@ -196,13 +196,22 @@ void matroska_segment_c::LoadCues( KaxCues *cues ) ...@@ -196,13 +196,22 @@ void matroska_segment_c::LoadCues( KaxCues *cues )
msg_Dbg( &sys.demuxer, "| - loading cues done." ); msg_Dbg( &sys.demuxer, "| - loading cues done." );
} }
#define PARSE_TAG( type ) \
do { \
msg_Dbg( &sys.demuxer, "| + " type ); \
ep->Down(); \
while( ( el = ep->Get() ) != NULL ) \
{ \
msg_Dbg( &sys.demuxer, "| | + Unknown (%s)", typeid( *el ).name() ); \
} \
ep->Up(); } while( 0 )
void matroska_segment_c::LoadTags( KaxTags *tags ) void matroska_segment_c::LoadTags( KaxTags *tags )
{ {
EbmlParser *ep;
EbmlElement *el;
/* Master elements */ /* Master elements */
ep = new EbmlParser( &es, tags, &sys.demuxer ); EbmlParser *ep = new EbmlParser( &es, tags, &sys.demuxer );
EbmlElement *el;
while( ( el = ep->Get() ) != NULL ) while( ( el = ep->Get() ) != NULL )
{ {
...@@ -213,55 +222,15 @@ void matroska_segment_c::LoadTags( KaxTags *tags ) ...@@ -213,55 +222,15 @@ void matroska_segment_c::LoadTags( KaxTags *tags )
while( ( el = ep->Get() ) != NULL ) while( ( el = ep->Get() ) != NULL )
{ {
if( MKV_IS_ID( el, KaxTagTargets ) ) if( MKV_IS_ID( el, KaxTagTargets ) )
{ PARSE_TAG( "Targets" );
msg_Dbg( &sys.demuxer, "| + Targets" );
ep->Down();
while( ( el = ep->Get() ) != NULL )
{
msg_Dbg( &sys.demuxer, "| | + Unknown (%s)", typeid( *el ).name() );
}
ep->Up();
}
else if( MKV_IS_ID( el, KaxTagGeneral ) ) else if( MKV_IS_ID( el, KaxTagGeneral ) )
{ PARSE_TAG( "General" );
msg_Dbg( &sys.demuxer, "| + General" );
ep->Down();
while( ( el = ep->Get() ) != NULL )
{
msg_Dbg( &sys.demuxer, "| | + Unknown (%s)", typeid( *el ).name() );
}
ep->Up();
}
else if( MKV_IS_ID( el, KaxTagGenres ) ) else if( MKV_IS_ID( el, KaxTagGenres ) )
{ PARSE_TAG( "Genres" );
msg_Dbg( &sys.demuxer, "| + Genres" );
ep->Down();
while( ( el = ep->Get() ) != NULL )
{
msg_Dbg( &sys.demuxer, "| | + Unknown (%s)", typeid( *el ).name() );
}
ep->Up();
}
else if( MKV_IS_ID( el, KaxTagAudioSpecific ) ) else if( MKV_IS_ID( el, KaxTagAudioSpecific ) )
{ PARSE_TAG( "Audio Specific" );
msg_Dbg( &sys.demuxer, "| + Audio Specific" );
ep->Down();
while( ( el = ep->Get() ) != NULL )
{
msg_Dbg( &sys.demuxer, "| | + Unknown (%s)", typeid( *el ).name() );
}
ep->Up();
}
else if( MKV_IS_ID( el, KaxTagImageSpecific ) ) else if( MKV_IS_ID( el, KaxTagImageSpecific ) )
{ PARSE_TAG( "Images Specific" );
msg_Dbg( &sys.demuxer, "| + Images Specific" );
ep->Down();
while( ( el = ep->Get() ) != NULL )
{
msg_Dbg( &sys.demuxer, "| | + Unknown (%s)", typeid( *el ).name() );
}
ep->Up();
}
else if( MKV_IS_ID( el, KaxTagMultiComment ) ) else if( MKV_IS_ID( el, KaxTagMultiComment ) )
{ {
msg_Dbg( &sys.demuxer, "| + Multi Comment" ); msg_Dbg( &sys.demuxer, "| + Multi Comment" );
...@@ -306,6 +275,7 @@ void matroska_segment_c::LoadTags( KaxTags *tags ) ...@@ -306,6 +275,7 @@ void matroska_segment_c::LoadTags( KaxTags *tags )
msg_Dbg( &sys.demuxer, "loading tags done." ); msg_Dbg( &sys.demuxer, "loading tags done." );
} }
#undef PARSE_TAG
/***************************************************************************** /*****************************************************************************
* InformationCreate: * InformationCreate:
......
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