Skip to content

Commit

Permalink
demux: mp4: add some const to box refs
Browse files Browse the repository at this point in the history
  • Loading branch information
fcartegnie committed Jun 13, 2015
1 parent b79c2d5 commit ae78856
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 42 deletions.
43 changes: 10 additions & 33 deletions modules/demux/mp4/mp4.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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;
Expand All @@ -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 ) )
{
Expand All @@ -2695,15 +2682,15 @@ 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;
}
p_track->fmt.i_cat = AUDIO_ES;
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;
}
Expand All @@ -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" ) ) )
Expand Down Expand Up @@ -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 )
{
Expand Down Expand Up @@ -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 )
Expand Down
18 changes: 9 additions & 9 deletions modules/demux/mp4/mp4.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit ae78856

Please sign in to comment.