Commit 0beed024 authored by François Cartegnie's avatar François Cartegnie 🤞
Browse files

demux: libmp4: add itunes special atoms

parent af3ab245
......@@ -3710,7 +3710,10 @@ static const struct
{ ATOM_0xa9too, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
{ ATOM_0xa9trk, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
{ ATOM_0xa9wrt, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
{ ATOM_aART, MP4_ReadBox_Metadata, MP4_FreeBox_Common, ATOM_ilst },
{ ATOM_atID, MP4_ReadBox_Metadata, MP4_FreeBox_Common, ATOM_ilst }, /* iTunes */
{ ATOM_chpl, MP4_ReadBox_chpl, MP4_FreeBox_chpl, ATOM_ilst },
{ ATOM_cnID, MP4_ReadBox_Metadata, MP4_FreeBox_Common, ATOM_ilst }, /* iTunes */
{ ATOM_covr, MP4_ReadBoxContainer, MP4_FreeBox_Common, ATOM_ilst },
{ ATOM_disk, MP4_ReadBox_Metadata, MP4_FreeBox_Common, ATOM_ilst },
{ ATOM_gnre, MP4_ReadBox_Metadata, MP4_FreeBox_Common, ATOM_ilst },
......
......@@ -278,12 +278,15 @@
#define ATOM_0xa9thx VLC_FOURCC( 0xa9, 't', 'h', 'x' )
#define ATOM_0xa9xpd VLC_FOURCC( 0xa9, 'x', 'p', 'd' )
#define ATOM_0xa9xyz VLC_FOURCC( 0xa9, 'x', 'y', 'z' )
#define ATOM_aART VLC_FOURCC( 'a', 'A', 'R', 'T' )
#define ATOM_chpl VLC_FOURCC( 'c', 'h', 'p', 'l' )
#define ATOM_disk VLC_FOURCC( 'd', 'i', 's', 'k' )
#define ATOM_WLOC VLC_FOURCC( 'W', 'L', 'O', 'C' )
#define ATOM_meta VLC_FOURCC( 'm', 'e', 't', 'a' )
#define ATOM_atID VLC_FOURCC( 'a', 't', 'I', 'D' )
#define ATOM_ilst VLC_FOURCC( 'i', 'l', 's', 't' )
#define ATOM_cnID VLC_FOURCC( 'c', 'n', 'I', 'D' )
#define ATOM_covr VLC_FOURCC( 'c', 'o', 'v', 'r' )
#define ATOM_chap VLC_FOURCC( 'c', 'h', 'a', 'p' )
......
......@@ -88,6 +88,7 @@ static const struct
{ ATOM_0xa9sol, N_("Soloist") },
{ ATOM_0xa9thx, N_("Thanks") },
{ ATOM_0xa9xpd, N_("Executive Producer") },
{ ATOM_aART, N_("Album Artist") },
{ ATOM_vndr, N_("Vendor") },
{ 0, "" },
};
......@@ -239,12 +240,36 @@ static bool Matchcom_apple_quicktime( vlc_meta_t *p_meta, const char *psz_naming
static void SetupmdirMeta( vlc_meta_t *p_meta, MP4_Box_t *p_box )
{
bool b_matched = true;
const MP4_Box_t *p_data = MP4_BoxGet( p_box, "data" );
/* XXX Becarefull p_udta can have box that are not 0xa9xx */
switch( p_box->i_type )
{
case ATOM_atID:
{
if ( p_data && BOXDATA(p_data) && BOXDATA(p_data)->i_blob >= 4 &&
BOXDATA(p_data)->e_wellknowntype == DATA_WKT_BE_SIGNED )
{
char psz_utf[11];
snprintf( psz_utf, sizeof( psz_utf ), "%"PRId32,
GetDWBE(BOXDATA(p_data)->p_blob) );
vlc_meta_AddExtra( p_meta, N_("iTunes Account ID"), psz_utf );
}
break;
}
case ATOM_cnID:
{
if ( p_data && BOXDATA(p_data) && BOXDATA(p_data)->i_blob >= 4 &&
BOXDATA(p_data)->e_wellknowntype == DATA_WKT_BE_SIGNED )
{
char psz_utf[11];
snprintf( psz_utf, sizeof( psz_utf ), "%"PRId32,
GetDWBE(BOXDATA(p_data)->p_blob) );
vlc_meta_AddExtra( p_meta, N_("iTunes Catalog ID"), psz_utf );
}
break;
}
case ATOM_disk:
{
const MP4_Box_t *p_data = MP4_BoxGet( p_box, "data" );
if ( p_data && BOXDATA(p_data) && BOXDATA(p_data)->i_blob >= 6 &&
BOXDATA(p_data)->e_wellknowntype == DATA_WKT_RESERVED )
{
......@@ -258,7 +283,6 @@ static void SetupmdirMeta( vlc_meta_t *p_meta, MP4_Box_t *p_box )
}
case ATOM_gnre:
{
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 )
{
......@@ -270,7 +294,6 @@ static void SetupmdirMeta( vlc_meta_t *p_meta, MP4_Box_t *p_box )
}
case ATOM_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 )
{
......
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