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

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Mar 14 08:42:41 UTC 2024



Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC


Commits:
10e28083 by Steve Lhomme at 2024-03-11T07:43:23+01: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

(cherry picked from commit dba5d5969af029cc475e6cd124a2d4845339fb19) (edited)

edited:
- in 3.0 the tag loading is different

Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -


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();
@@ -225,7 +225,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;
@@ -286,7 +286,7 @@ bool matroska_segment_c::ParseSimpleTags( SimpleTag* pout_simple, KaxTagSimple *
         {
             if( unlikely( !el->ValidateSize() ) )
             {
-                msg_Err( &sys.demuxer, "Error %s too big ignoring the tag", typeid(*el).name() );
+                msg_Err( &sys.demuxer, "Error %s too big ignoring the tag", EBML_NAME(el) );
                 return false;
             }
             if( MKV_CHECKED_PTR_DECL ( ktn_ptr, KaxTagName, el ) )
@@ -423,7 +423,7 @@ void matroska_segment_c::LoadTags( KaxTags *tags )
                             }
                             else
                             {
-                                msg_Dbg( &sys.demuxer, "|   |   + LoadTag Unknown (%s)", typeid( *el ).name() );
+                                msg_Dbg( &sys.demuxer, "|   |   + LoadTag Unknown (%s)", EBML_NAME( el ) );
                             }
                         }
                         catch(...)
@@ -444,7 +444,7 @@ void matroska_segment_c::LoadTags( KaxTags *tags )
                 }
                 else
                 {
-                    msg_Dbg( &sys.demuxer, "|   + LoadTag Unknown (%s)", typeid( *el ).name() );
+                    msg_Dbg( &sys.demuxer, "|   + Unknown (%s)", EBML_NAME(el) );
                 }
             }
             eparser.Up();
@@ -452,7 +452,7 @@ void matroska_segment_c::LoadTags( KaxTags *tags )
         }
         else
         {
-            msg_Dbg( &sys.demuxer, "+ Unknown (%s)", typeid( *el ).name() );
+            msg_Dbg( &sys.demuxer, "+ LoadTag Unknown (%s)", EBML_NAME(el) );
         }
     }
 
@@ -691,7 +691,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();
@@ -795,7 +795,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;
 
@@ -1224,7 +1224,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) );
         }
     };
 
@@ -1338,7 +1338,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 ) );
         }
     };
 
@@ -1427,7 +1427,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 )
@@ -1457,7 +1457,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
=====================================
@@ -114,7 +114,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 ) )
@@ -132,13 +132,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();
 
@@ -191,7 +191,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) );
     }
 }
 
@@ -873,7 +873,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) );
         }
     };
 
@@ -960,7 +960,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) );
         }
     };
 
@@ -1141,7 +1141,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) );
         }
     };
 
@@ -1430,7 +1430,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 );
@@ -1443,7 +1443,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/10e2808347d49a1862cd7a76d629c2b5d65909e8

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/10e2808347d49a1862cd7a76d629c2b5d65909e8
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