[vlc-commits] demux: mp4: add some const to box refs

Francois Cartegnie git at videolan.org
Sat Jun 13 18:11:47 CEST 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Jun 13 13:19:10 2015 +0200| [ae78856f6dd5acb091919cac982369ae138ff6e7] | committer: Francois Cartegnie

demux: mp4: add some const to box refs

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ae78856f6dd5acb091919cac982369ae138ff6e7
---

 modules/demux/mp4/mp4.c |   43 ++++++++++---------------------------------
 modules/demux/mp4/mp4.h |   18 +++++++++---------
 2 files changed, 19 insertions(+), 42 deletions(-)

diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index 18de00a..e1096a7 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -2631,17 +2631,6 @@ static void MP4_TrackCreate( demux_t *p_demux, mp4_track_t *p_track,
 
     p_track->p_track = p_box_trak;
 
-    MP4_Box_t *p_tkhd = MP4_BoxGet( p_box_trak, "tkhd" );
-    MP4_Box_t *p_tref = MP4_BoxGet( p_box_trak, "tref" );
-    MP4_Box_t *p_elst;
-
-    MP4_Box_t *p_mdhd;
-    MP4_Box_t *p_udta;
-    MP4_Box_t *p_hdlr;
-
-    MP4_Box_t *p_vmhd;
-    MP4_Box_t *p_smhd;
-
     char language[4] = { '\0' };
 
     /* hint track unsupported */
@@ -2655,6 +2644,7 @@ static void MP4_TrackCreate( demux_t *p_demux, mp4_track_t *p_track,
 
     es_format_Init( &p_track->fmt, UNKNOWN_ES, 0 );
 
+    const MP4_Box_t *p_tkhd = MP4_BoxGet( p_box_trak, "tkhd" );
     if( !p_tkhd )
     {
         return;
@@ -2672,13 +2662,10 @@ static void MP4_TrackCreate( demux_t *p_demux, mp4_track_t *p_track,
     p_track->i_height = BOXDATA(p_tkhd)->i_height / BLOCK16x16;
     p_track->f_rotation = BOXDATA(p_tkhd)->f_rotation;
 
-    if( p_tref )
-    {
-/*        msg_Warn( p_demux, "unhandled box: tref --> FIXME" ); */
-    }
+    /* FIXME: unhandled box: tref */
 
-    p_mdhd = MP4_BoxGet( p_box_trak, "mdia/mdhd" );
-    p_hdlr = MP4_BoxGet( p_box_trak, "mdia/hdlr" );
+    const MP4_Box_t *p_mdhd = MP4_BoxGet( p_box_trak, "mdia/mdhd" );
+    const MP4_Box_t *p_hdlr = MP4_BoxGet( p_box_trak, "mdia/hdlr" );
 
     if( ( !p_mdhd )||( !p_hdlr ) )
     {
@@ -2695,7 +2682,7 @@ static void MP4_TrackCreate( demux_t *p_demux, mp4_track_t *p_track,
     switch( p_hdlr->data.p_hdlr->i_handler_type )
     {
         case( ATOM_soun ):
-            if( !( p_smhd = MP4_BoxGet( p_box_trak, "mdia/minf/smhd" ) ) )
+            if( !MP4_BoxGet( p_box_trak, "mdia/minf/smhd" ) )
             {
                 return;
             }
@@ -2703,7 +2690,7 @@ static void MP4_TrackCreate( demux_t *p_demux, mp4_track_t *p_track,
             break;
 
         case( ATOM_vide ):
-            if( !( p_vmhd = MP4_BoxGet( p_box_trak, "mdia/minf/vmhd" ) ) )
+            if( !MP4_BoxGet( p_box_trak, "mdia/minf/vmhd") )
             {
                 return;
             }
@@ -2726,6 +2713,7 @@ static void MP4_TrackCreate( demux_t *p_demux, mp4_track_t *p_track,
             return;
     }
 
+    const MP4_Box_t *p_elst;
     p_track->i_elst = 0;
     p_track->i_elst_time = 0;
     if( ( p_track->p_elst = p_elst = MP4_BoxGet( p_box_trak, "edts/elst" ) ) )
@@ -2764,10 +2752,10 @@ static void MP4_TrackCreate( demux_t *p_demux, mp4_track_t *p_track,
         p_track->fmt.psz_language = strdup( language );
     }
 
-    p_udta = MP4_BoxGet( p_box_trak, "udta" );
+    const MP4_Box_t *p_udta = MP4_BoxGet( p_box_trak, "udta" );
     if( p_udta )
     {
-        MP4_Box_t *p_box_iter;
+        const MP4_Box_t *p_box_iter;
         for( p_box_iter = p_udta->p_first; p_box_iter != NULL;
                  p_box_iter = p_box_iter->p_next )
         {
@@ -2871,19 +2859,8 @@ static void MP4_TrackCreate( demux_t *p_demux, mp4_track_t *p_track,
                  p_track->i_track_ID );
         return;
     }
-    p_track->b_ok = true;
-#if 0
-    {
-        int i;
-        for( i = 0; i < p_track->i_chunk_count; i++ )
-        {
-            fprintf( stderr, "%-5d sample_count=%d pts=%lld\n",
-                     i, p_track->chunk[i].i_sample_count,
-                     p_track->chunk[i].i_first_dts );
 
-        }
-    }
-#endif
+    p_track->b_ok = p_track->b_chapter || !!p_track->p_es;
 }
 
 static void FreeAndResetChunk( mp4_chunk_t *ck )
diff --git a/modules/demux/mp4/mp4.h b/modules/demux/mp4/mp4.h
index 02a2ead..5f9ce35 100644
--- a/modules/demux/mp4/mp4.h
+++ b/modules/demux/mp4/mp4.h
@@ -94,7 +94,7 @@ typedef struct
     /* elst */
     int             i_elst;         /* current elst */
     int64_t         i_elst_time;    /* current elst start time (in movie time scale)*/
-    MP4_Box_t       *p_elst;        /* elst (could be NULL) */
+    const MP4_Box_t *p_elst;        /* elst (could be NULL) */
 
     /* give the next sample to read, i_chunk is to find quickly where
       the sample is located */
@@ -118,10 +118,10 @@ typedef struct
     uint64_t     i_first_dts;    /* i_first_dts value
                                                    of the next chunk */
 
-    MP4_Box_t *p_track;
-    MP4_Box_t *p_stbl;  /* will contain all timing information */
-    MP4_Box_t *p_stsd;  /* will contain all data to initialize decoder */
-    MP4_Box_t *p_sample;/* point on actual sdsd */
+    const MP4_Box_t *p_track;
+    const MP4_Box_t *p_stbl;  /* will contain all timing information */
+    const MP4_Box_t *p_stsd;  /* will contain all data to initialize decoder */
+    const MP4_Box_t *p_sample;/* point on actual sdsd */
 
     bool b_has_non_empty_cchunk;
     bool b_codec_need_restart;
@@ -131,14 +131,14 @@ typedef struct
     struct
     {
         /* for moof parsing */
-        MP4_Box_t *p_traf;
-        MP4_Box_t *p_tfhd;
-        MP4_Box_t *p_trun;
+        const MP4_Box_t *p_traf;
+        const MP4_Box_t *p_tfhd;
+        const MP4_Box_t *p_trun;
         uint64_t   i_traf_base_offset;
     } context;
 
     /* ASF packets handling */
-    MP4_Box_t       *p_asf;
+    const MP4_Box_t *p_asf;
     mtime_t          i_dts_backup;
     mtime_t          i_pts_backup;
     asf_track_info_t asfinfo;



More information about the vlc-commits mailing list