]> git.sesse.net Git - vlc/commitdiff
demux: libmp4: simplify dump code
authorFrancois Cartegnie <fcvlcdev@free.fr>
Wed, 15 Oct 2014 14:40:01 +0000 (16:40 +0200)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Thu, 16 Oct 2014 18:05:01 +0000 (20:05 +0200)
modules/demux/mp4/libmp4.c

index c21e1f62a1d1788bc6a9c9dde850b59619a331e6..45b800b0ced98b4f3c5fcb08bcea95f2e013cb56 100644 (file)
@@ -4098,15 +4098,13 @@ static void MP4_BoxDumpStructure_Internal( stream_t *s,
                                     MP4_Box_t *p_box, unsigned int i_level )
 {
     MP4_Box_t *p_child;
+    uint32_t i_displayedtype = p_box->i_type;
+    if( ! MP4_BOX_TYPE_ASCII() ) ((char*)&i_displayedtype)[0] = 'c';
 
     if( !i_level )
     {
-        if MP4_BOX_TYPE_ASCII()
-            msg_Dbg( s, "dumping root Box \"%4.4s\"",
-                              (char*)&p_box->i_type );
-        else
-            msg_Dbg( s, "dumping root Box \"c%3.3s\"",
-                              (char*)&p_box->i_type+1 );
+        msg_Dbg( s, "dumping root Box \"%4.4s\"",
+                          (char*)&i_displayedtype );
     }
     else
     {
@@ -4119,18 +4117,12 @@ static void MP4_BoxDumpStructure_Internal( stream_t *s,
         {
             str[i*4] = '|';
         }
-        if( MP4_BOX_TYPE_ASCII() )
-            snprintf( &str[i_level * 4], sizeof(str) - 4*i_level,
-                      "+ %4.4s size %"PRIu64" offset %ju%s",
-                      (char*)&p_box->i_type, p_box->i_size,
-                      (uintmax_t)p_box->i_pos,
-                    p_box->e_flags & BOX_FLAG_INCOMPLETE ? " (\?\?\?\?)" : "" );
-        else
-            snprintf( &str[i_level * 4], sizeof(str) - 4*i_level,
-                      "+ c%3.3s size %"PRIu64" offset %ju%s",
-                        (char*)&p_box->i_type+1, p_box->i_size,
-                      (uintmax_t)p_box->i_pos,
-                    p_box->e_flags & BOX_FLAG_INCOMPLETE ? " (\?\?\?\?)" : "" );
+
+        snprintf( &str[i_level * 4], sizeof(str) - 4*i_level,
+                  "+ %4.4s size %"PRIu64" offset %ju%s",
+                    (char*)&i_displayedtype, p_box->i_size,
+                  (uintmax_t)p_box->i_pos,
+                p_box->e_flags & BOX_FLAG_INCOMPLETE ? " (\?\?\?\?)" : "" );
         msg_Dbg( s, "%s", str );
     }
     p_child = p_box->p_first;