Commit d7c9404f authored by François Cartegnie's avatar François Cartegnie 🤞

demux: mp4: parse 3GPP ID3

Untested
parent a270a72f
......@@ -4504,6 +4504,7 @@ static const struct
/* iTunes/Quicktime meta info */
{ ATOM_meta, MP4_ReadBox_meta, 0 },
{ ATOM_ID32, MP4_ReadBox_Binary, ATOM_meta }, /* ID3v2 in 3GPP / ETSI TS 126 244 8.3 */
{ ATOM_data, MP4_ReadBox_data, 0 }, /* ilst/@too and others, ITUN/data */
{ ATOM_mean, MP4_ReadBox_Binary, ATOM_ITUN },
{ ATOM_name, MP4_ReadBox_Binary, ATOM_ITUN },
......
......@@ -354,6 +354,7 @@ typedef int64_t stime_t;
#define ATOM_chpl VLC_FOURCC( 'c', 'h', 'p', 'l' )
#define ATOM_HMMT VLC_FOURCC( 'H', 'M', 'M', 'T' )
#define ATOM_disk VLC_FOURCC( 'd', 'i', 's', 'k' )
#define ATOM_ID32 VLC_FOURCC( 'I', 'D', '3', '2' )
#define ATOM_WLOC VLC_FOURCC( 'W', 'L', 'O', 'C' )
#define ATOM_ITUN VLC_FOURCC( '-', '-', '-', '-' )
......@@ -383,6 +384,7 @@ typedef int64_t stime_t;
#define HANDLER_mdta VLC_FOURCC('m', 'd', 't', 'a')
#define HANDLER_mdir VLC_FOURCC('m', 'd', 'i', 'r')
#define HANDLER_ID32 ATOM_ID32
#define SAMPLEGROUP_rap VLC_FOURCC('r', 'a', 'p', ' ')
......
......@@ -28,6 +28,9 @@
#include <vlc_meta.h>
#include <vlc_charset.h>
#include "../meta_engine/ID3Tag.h"
#include "../meta_engine/ID3Meta.h"
#include <assert.h>
static const struct
......@@ -487,6 +490,27 @@ static void SetupmdtaMeta( vlc_meta_t *p_meta, MP4_Box_t *p_box, MP4_Box_t *p_ke
}
}
static int ID3TAG_Parse_Handler( uint32_t i_tag, const uint8_t *p_payload,
size_t i_payload, void *p_priv )
{
vlc_meta_t *p_meta = (vlc_meta_t *) p_priv;
(void) ID3HandleTag( p_payload, i_payload, i_tag, p_meta, NULL );
return VLC_SUCCESS;
}
static void SetupID3v2Meta( vlc_meta_t *p_meta, MP4_Box_t *p_box )
{
const MP4_Box_t *p_binary = MP4_BoxGet( p_box, "ID32" );
if( p_binary == NULL || !BOXDATA(p_binary) || BOXDATA(p_binary)->i_blob < 6 + 20 + 1 )
return;
/* ID3v2 in 3GPP / ETSI TS 126 244 8.3, Header size 4 + 2 */
ID3TAG_Parse( &((uint8_t *)BOXDATA(p_binary)->p_blob)[6], BOXDATA(p_binary)->i_blob - 6,
ID3TAG_Parse_Handler, p_meta );
}
void SetupMeta( vlc_meta_t *p_meta, MP4_Box_t *p_udta )
{
uint32_t i_handler = 0;
......@@ -504,6 +528,10 @@ void SetupMeta( vlc_meta_t *p_meta, MP4_Box_t *p_udta )
break;
}
case HANDLER_ID32:
SetupID3v2Meta( p_meta, p_box );
break;
case HANDLER_mdir:
default:
SetupmdirMeta( p_meta, p_box );
......
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