Commit 5dacc81c authored by François Cartegnie's avatar François Cartegnie 🤞
Browse files

demux: mp4: remove special handler for atom gnre

parent 2b768994
......@@ -1774,37 +1774,6 @@ static int MP4_ReadBox_enda( stream_t *p_stream, MP4_Box_t *p_box )
MP4_READBOX_EXIT( 1 );
}
static int MP4_ReadBox_gnre( stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_Box_data_gnre_t *p_gnre;
MP4_READBOX_ENTER( MP4_Box_data_gnre_t );
p_gnre = p_box->data.p_gnre;
uint32_t i_data_len;
uint32_t i_data_tag;
MP4_GET4BYTES( i_data_len );
MP4_GETFOURCC( i_data_tag );
if( i_data_len < 10 || 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( p_gnre->i_genre );
if( p_gnre->i_genre == 0 )
MP4_READBOX_EXIT( 0 );
#ifdef MP4_VERBOSE
msg_Dbg( p_stream, "read box: \"gnre\" genre=%i", p_gnre->i_genre );
#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;
......@@ -3743,7 +3712,7 @@ static const struct
{ ATOM_0xa9wrt, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
{ 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_gnre, MP4_ReadBox_Metadata, MP4_FreeBox_Common, ATOM_ilst },
{ ATOM_trkn, MP4_ReadBox_Metadata, MP4_FreeBox_Common, ATOM_ilst },
/* udta */
......
......@@ -1189,12 +1189,6 @@ typedef struct
} MP4_Box_data_enda_t;
typedef struct
{
uint16_t i_genre;
} MP4_Box_data_gnre_t;
typedef struct
{
uint32_t i_entry_count;
......@@ -1377,7 +1371,6 @@ typedef union MP4_Box_data_s
MP4_Box_data_chan_t *p_chan;
MP4_Box_data_enda_t *p_enda;
MP4_Box_data_keys_t *p_keys;
MP4_Box_data_gnre_t *p_gnre;
MP4_Box_data_iods_t *p_iods;
MP4_Box_data_pasp_t *p_pasp;
MP4_Box_data_trex_t *p_trex;
......
......@@ -243,9 +243,17 @@ static void SetupmdirMeta( vlc_meta_t *p_meta, MP4_Box_t *p_box )
switch( p_box->i_type )
{
case ATOM_gnre:
if( p_box->data.p_gnre && p_box->data.p_gnre->i_genre <= NUM_GENRES )
vlc_meta_SetGenre( p_meta, ppsz_genres[p_box->data.p_gnre->i_genre - 1] );
{
const MP4_Box_t *p_data = MP4_BoxGet( p_box, "data" );
if ( p_data && BOXDATA(p_data) && BOXDATA(p_data)->i_blob >= 2 &&
BOXDATA(p_data)->e_wellknowntype == DATA_WKT_RESERVED )
{
const uint16_t i_genre = GetWBE(BOXDATA(p_data)->p_blob);
if( i_genre && i_genre <= NUM_GENRES )
vlc_meta_SetGenre( p_meta, ppsz_genres[i_genre - 1] );
}
break;
}
case ATOM_trkn:
{
const MP4_Box_t *p_data = MP4_BoxGet( p_box, "data" );
......
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