[vlc-commits] [Git][videolan/vlc][master] demux/mkv: use a better name for unused elements

Steve Lhomme (@robUx4) gitlab at videolan.org
Sun Mar 10 06:18:20 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
dba5d596 by Steve Lhomme at 2024-03-10T05:51:35+00:00
demux/mkv: use a better name for unused elements

Unless it's an EbmlDummy the element is not unknown if it has a known class.

Rather than displaying a decorated C++ class name, show the actual element name in libmatroska.
No need for Runtime Type Indentification (RTTI) for that.

The EBML_NAME() has been around since at least libebml 0.8: https://github.com/Matroska-Org/libebml/commit/cd378f23ff5c8bd477fe066fccca532bf00f974b

- - - - -


2 changed files:

- modules/demux/mkv/matroska_segment.cpp
- modules/demux/mkv/matroska_segment_parse.cpp


Changes:

=====================================
modules/demux/mkv/matroska_segment.cpp
=====================================
@@ -145,7 +145,7 @@ void matroska_segment_c::LoadCues( KaxCues *cues )
                             if( unlikely( !el->ValidateSize() ) )
                             {
                                 eparser.Up();
-                                msg_Err( &sys.demuxer, "Error %s too big, aborting", typeid(*el).name() );
+                                msg_Err( &sys.demuxer, "Error %s too big, aborting", EBML_NAME(el) );
                                 b_invalid_cue = true;
                                 break;
                             }
@@ -190,14 +190,14 @@ void matroska_segment_c::LoadCues( KaxCues *cues )
 #endif
                             else
                             {
-                                msg_Dbg( &sys.demuxer, "         * Unknown (%s)", typeid(*el).name() );
+                                msg_Dbg( &sys.demuxer, "         * Unknown (%s)", EBML_NAME(el) );
                             }
                         }
                     }
                     catch(...)
                     {
                         eparser.Up();
-                        msg_Err( &sys.demuxer, "Error while reading %s", typeid(*el).name() );
+                        msg_Err( &sys.demuxer, "Error while reading %s", EBML_NAME(el) );
                         b_invalid_cue = true;
                         break;
                     }
@@ -205,7 +205,7 @@ void matroska_segment_c::LoadCues( KaxCues *cues )
                 }
                 else
                 {
-                    msg_Dbg( &sys.demuxer, "     * Unknown (%s)", typeid(*el).name() );
+                    msg_Dbg( &sys.demuxer, "     * Unknown (%s)", EBML_NAME(el) );
                 }
             }
             eparser.Up();
@@ -227,7 +227,7 @@ void matroska_segment_c::LoadCues( KaxCues *cues )
         }
         else
         {
-            msg_Dbg( &sys.demuxer, " * Unknown (%s)", typeid(*el).name() );
+            msg_Dbg( &sys.demuxer, " * Unknown (%s)", EBML_NAME(el) );
         }
     }
     b_cues = true;
@@ -423,7 +423,7 @@ void matroska_segment_c::LoadTags( KaxTags *tags_ )
                         }
                         E_CASE_DEFAULT( el )
                         {
-                            msg_Dbg( &vars.sys.demuxer, "|   |   + Unknown (%s)", typeid(el).name() );
+                            msg_Dbg( &vars.sys.demuxer, "|   |   + Unknown (%s)", EBML_NAME(&el) );
                         }
                     };
 
@@ -438,7 +438,7 @@ void matroska_segment_c::LoadTags( KaxTags *tags_ )
                 }
                 E_CASE_DEFAULT( el )
                 {
-                    msg_Dbg( &vars.sys.demuxer, "|   |   + Unknown (%s)", typeid(el).name() );
+                    msg_Dbg( &vars.sys.demuxer, "|   |   + Unknown (%s)", EBML_NAME(&el) );
                 }
             };
 
@@ -447,7 +447,7 @@ void matroska_segment_c::LoadTags( KaxTags *tags_ )
         }
         E_CASE_DEFAULT( el )
         {
-            msg_Dbg( &vars.sys.demuxer, "|   + LoadTag Unknown (%s)", typeid(el).name() );
+            msg_Dbg( &vars.sys.demuxer, "|   + LoadTag Unknown (%s)", EBML_NAME(&el) );
         }
     };
 
@@ -679,7 +679,7 @@ bool matroska_segment_c::Preload( )
         else if( MKV_IS_ID ( el, EbmlVoid ) )
             msg_Dbg( &sys.demuxer, "|   + Void" );
         else
-            msg_Dbg( &sys.demuxer, "|   + Preload Unknown (%s)", typeid(*el).name() );
+            msg_Dbg( &sys.demuxer, "|   + Preload Unknown (%s)", EBML_NAME(el) );
     }
 
     ComputeTrackPriority();
@@ -783,7 +783,7 @@ bool matroska_segment_c::LoadSeekHeadItem( const EbmlCallbacks & ClassInfos, int
     }
     else
     {
-        msg_Dbg( &sys.demuxer, "|   + LoadSeekHeadItem Unknown (%s)", typeid(*el).name() );
+        msg_Dbg( &sys.demuxer, "|   + LoadSeekHeadItem Unknown (%s)", EBML_NAME(el) );
     }
     delete el;
 
@@ -1220,7 +1220,7 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, KaxSimpleBlock * & pp_s
         }
         E_CASE_DEFAULT(element)
         {
-            msg_Dbg( vars.p_demuxer, "Unknown (%s)", typeid (element).name () );
+            msg_Dbg( vars.p_demuxer, "Unknown (%s)", EBML_NAME(&element) );
         }
     };
 
@@ -1334,7 +1334,7 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, KaxSimpleBlock * & pp_s
             VLC_UNUSED(element);
 
             msg_Warn( vars.p_demuxer, "unknown element at { fpos: %" PRId64 ", '%s' }",
-              element.GetElementPosition(), typeid( element ).name() );
+              element.GetElementPosition(), EBML_NAME( &element ) );
         }
     };
 
@@ -1424,7 +1424,7 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, KaxSimpleBlock * & pp_s
                 case 3:
                     if( unlikely( !el->ValidateSize() || ( el->IsFiniteSize() && el->GetSize() >= SIZE_MAX ) ) )
                     {
-                        msg_Err( &sys.demuxer, "Error while reading %s... upping level", typeid(*el).name());
+                        msg_Err( &sys.demuxer, "Error while reading %s... upping level", EBML_NAME(el));
                         ep.Up();
 
                         if ( i_level == 2 )
@@ -1455,7 +1455,7 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, KaxSimpleBlock * & pp_s
         }
         catch (...)
         {
-            msg_Err( &sys.demuxer, "Error while reading %s... upping level", typeid(*el).name());
+            msg_Err( &sys.demuxer, "Error while reading %s... upping level", EBML_NAME(el));
             ep.Up();
             ep.Unkeep();
             pp_simpleblock = NULL;


=====================================
modules/demux/mkv/matroska_segment_parse.cpp
=====================================
@@ -115,7 +115,7 @@ void matroska_segment_c::ParseSeekHead( KaxSeekHead *seekhead )
                 {
                     if( unlikely( !l->ValidateSize() ) )
                     {
-                        msg_Err( &sys.demuxer,"%s too big... skipping it",  typeid(*l).name() );
+                        msg_Err( &sys.demuxer,"%s too big... skipping it",  EBML_NAME(l) );
                         continue;
                     }
                     if( MKV_IS_ID( l, KaxSeekID ) )
@@ -133,13 +133,13 @@ void matroska_segment_c::ParseSeekHead( KaxSeekHead *seekhead )
                     else if ( !MKV_IS_ID( l, EbmlVoid ) && !MKV_IS_ID( l, EbmlCrc32 ))
                     {
                         /* Many mkvmerge files hit this case. It seems to be a broken SeekHead */
-                        msg_Dbg( &sys.demuxer, "|   |   + Unknown (%s)", typeid(*l).name() );
+                        msg_Dbg( &sys.demuxer, "|   |   + Unknown (%s)", EBML_NAME(l) );
                     }
                 }
             }
             catch(...)
             {
-                msg_Err( &sys.demuxer,"Error while reading %s",  typeid(*l).name() );
+                msg_Err( &sys.demuxer,"Error while reading %s",  EBML_NAME(l) );
             }
             eparser.Up();
 
@@ -192,7 +192,7 @@ void matroska_segment_c::ParseSeekHead( KaxSeekHead *seekhead )
             }
         }
         else if ( !MKV_IS_ID( l, EbmlVoid ) && !MKV_IS_ID( l, EbmlCrc32 ))
-            msg_Dbg( &sys.demuxer, "|   |   + ParseSeekHead Unknown (%s)", typeid(*l).name() );
+            msg_Dbg( &sys.demuxer, "|   |   + ParseSeekHead Unknown (%s)", EBML_NAME(l) );
     }
 }
 
@@ -1050,7 +1050,7 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
           VLC_UNUSED( vars );
         }
         E_CASE_DEFAULT(element) {
-            debug( vars, "Unknown (%s)", typeid(element).name() );
+            debug( vars, "Unknown (%s)", EBML_NAME(&element) );
         }
     };
 
@@ -1137,7 +1137,7 @@ void matroska_segment_c::ParseTracks( KaxTracks *tracks )
             VLC_UNUSED( vars );
         }
         E_CASE_DEFAULT(element) {
-            MkvTree( *vars.p_demuxer, 2, "Unknown (%s)", typeid(element).name() );
+            MkvTree( *vars.p_demuxer, 2, "Unknown (%s)", EBML_NAME(&element) );
         }
     };
 
@@ -1318,7 +1318,7 @@ void matroska_segment_c::ParseInfo( KaxInfo *info )
         }
         E_CASE_DEFAULT(element)
         {
-            debug( vars, "Unknown (%s)", typeid(element).name() );
+            debug( vars, "Unknown (%s)", EBML_NAME(&element) );
         }
     };
 
@@ -1600,7 +1600,7 @@ void matroska_segment_c::ParseChapters( KaxChapters *chapters )
                 }
                 E_CASE_DEFAULT( el )
                 {
-                    msg_Dbg( vars.p_demuxer, "|   |   |   + Unknown (%s)", typeid(el).name() );
+                    msg_Dbg( vars.p_demuxer, "|   |   |   + Unknown (%s)", EBML_NAME(&el) );
                 }
             };
             KaxEditionHandler::Dispatcher().iterate( entry.begin(), entry.end(), &data );
@@ -1613,7 +1613,7 @@ void matroska_segment_c::ParseChapters( KaxChapters *chapters )
         }
         E_CASE_DEFAULT( el )
         {
-            msg_Dbg( &vars.sys.demuxer, "|   |   + Unknown (%s)", typeid(el).name() );
+            msg_Dbg( &vars.sys.demuxer, "|   |   + Unknown (%s)", EBML_NAME(&el) );
         }
     };
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/dba5d5969af029cc475e6cd124a2d4845339fb19

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/dba5d5969af029cc475e6cd124a2d4845339fb19
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list