Commit 2b768994 authored by Francois Cartegnie's avatar Francois Cartegnie

demux: mp4: remove special handler for trkn atom

parent c5e6327a
......@@ -1805,43 +1805,6 @@ static int MP4_ReadBox_gnre( stream_t *p_stream, MP4_Box_t *p_box )
MP4_READBOX_EXIT( 1 );
}
static int MP4_ReadBox_trkn( stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_Box_data_trkn_t *p_trkn;
MP4_READBOX_ENTER( MP4_Box_data_trkn_t );
p_trkn = p_box->data.p_trkn;
uint32_t i_data_len;
uint32_t i_data_tag;
MP4_GET4BYTES( i_data_len );
MP4_GETFOURCC( i_data_tag );
if( i_data_len < 12 || i_data_tag != ATOM_data )
MP4_READBOX_EXIT( 0 );
uint32_t i_version;
VLC_UNUSED(i_version);
uint32_t i_reserved;
VLC_UNUSED(i_reserved);
MP4_GET4BYTES( i_version );
MP4_GET4BYTES( i_reserved );
MP4_GET2BYTES( i_reserved );
MP4_GET2BYTES( p_trkn->i_track_number );
#ifdef MP4_VERBOSE
msg_Dbg( p_stream, "read box: \"trkn\" number=%i", p_trkn->i_track_number );
#endif
if( i_data_len > 15 )
{
MP4_GET2BYTES( p_trkn->i_track_total );
#ifdef MP4_VERBOSE
msg_Dbg( p_stream, "read box: \"trkn\" total=%i", p_trkn->i_track_total );
#endif
}
MP4_READBOX_EXIT( 1 );
}
static int MP4_ReadBox_sample_soun( stream_t *p_stream, MP4_Box_t *p_box )
{
p_box->i_handler = ATOM_soun;
......@@ -3781,7 +3744,7 @@ static const struct
{ ATOM_chpl, MP4_ReadBox_chpl, MP4_FreeBox_chpl, ATOM_ilst },
{ ATOM_covr, MP4_ReadBoxContainer, MP4_FreeBox_Common, ATOM_ilst },
{ ATOM_gnre, MP4_ReadBox_gnre, MP4_FreeBox_Common, ATOM_ilst },
{ ATOM_trkn, MP4_ReadBox_trkn, MP4_FreeBox_Common, ATOM_ilst },
{ ATOM_trkn, MP4_ReadBox_Metadata, MP4_FreeBox_Common, ATOM_ilst },
/* udta */
{ ATOM_0xa9ART, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
......
......@@ -1205,13 +1205,6 @@ typedef struct
} *p_entries;
} MP4_Box_data_keys_t;
typedef struct
{
uint32_t i_track_number;
uint32_t i_track_total;
} MP4_Box_data_trkn_t;
typedef struct
{
uint8_t i_version;
......@@ -1385,7 +1378,6 @@ typedef union MP4_Box_data_s
MP4_Box_data_enda_t *p_enda;
MP4_Box_data_keys_t *p_keys;
MP4_Box_data_gnre_t *p_gnre;
MP4_Box_data_trkn_t *p_trkn;
MP4_Box_data_iods_t *p_iods;
MP4_Box_data_pasp_t *p_pasp;
MP4_Box_data_trex_t *p_trex;
......
......@@ -248,16 +248,16 @@ static void SetupmdirMeta( vlc_meta_t *p_meta, MP4_Box_t *p_box )
break;
case ATOM_trkn:
{
if ( p_box->data.p_trkn )
const MP4_Box_t *p_data = MP4_BoxGet( p_box, "data" );
if ( p_data && BOXDATA(p_data) && BOXDATA(p_data)->i_blob >= 4 &&
BOXDATA(p_data)->e_wellknowntype == DATA_WKT_RESERVED )
{
char psz_trck[11];
snprintf( psz_trck, sizeof( psz_trck ), "%i",
p_box->data.p_trkn->i_track_number );
char psz_trck[6];
snprintf( psz_trck, sizeof( psz_trck ), "%"PRIu16, GetWBE(&BOXDATA(p_data)->p_blob[2]) );
vlc_meta_SetTrackNum( p_meta, psz_trck );
if( p_box->data.p_trkn->i_track_total > 0 )
if( BOXDATA(p_data)->i_blob >= 8 )
{
snprintf( psz_trck, sizeof( psz_trck ), "%i",
p_box->data.p_trkn->i_track_total );
snprintf( psz_trck, sizeof( psz_trck ), "%"PRIu16, GetWBE(&BOXDATA(p_data)->p_blob[4]) );
vlc_meta_Set( p_meta, vlc_meta_TrackTotal, psz_trck );
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment