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

demux: mp4: read vp8/9/10 mastering display

parent 2e6a72d2
......@@ -717,6 +717,17 @@ int SetupVideoES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample )
p_data->i_codec_init_datasize );
}
}
const MP4_Box_t *p_SmDm = MP4_BoxGet( p_sample, "SmDm" );
if( p_SmDm && BOXDATA(p_SmDm) )
{
memcpy( p_track->fmt.video.mastering.primaries,
BOXDATA(p_SmDm)->primaries, sizeof(uint16_t) * 6 );
memcpy( p_track->fmt.video.mastering.white_point,
BOXDATA(p_SmDm)->white_point, sizeof(uint16_t) * 2 );
p_track->fmt.video.mastering.max_luminance = BOXDATA(p_SmDm)->i_luminanceMax;
p_track->fmt.video.mastering.min_luminance = BOXDATA(p_SmDm)->i_luminanceMin;
}
}
}
break;
......
......@@ -2025,6 +2025,21 @@ static int MP4_ReadBox_vpcC( stream_t *p_stream, MP4_Box_t *p_box )
MP4_READBOX_EXIT( 1 );
}
static int MP4_ReadBox_SmDm( stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_SmDm_t, NULL );
MP4_Box_data_SmDm_t *p_SmDm = p_box->data.p_SmDm;
for(int i=0; i<6; i++)
MP4_GET2BYTES( p_SmDm->primaries[i] );
for(int i=0; i<2; i++)
MP4_GET2BYTES( p_SmDm->white_point[i] );
MP4_GET4BYTES( p_SmDm->i_luminanceMax );
MP4_GET4BYTES( p_SmDm->i_luminanceMin );
MP4_READBOX_EXIT( 1 );
}
static void MP4_FreeBox_WMA2( MP4_Box_t *p_box )
{
free( p_box->data.p_WMA2->p_extra );
......@@ -4385,6 +4400,7 @@ static const struct
{ ATOM_vpcC, MP4_ReadBox_vpcC, ATOM_vp08 },
{ ATOM_vpcC, MP4_ReadBox_vpcC, ATOM_vp09 },
{ ATOM_vpcC, MP4_ReadBox_vpcC, ATOM_vp10 },
{ ATOM_SmDm, MP4_ReadBox_SmDm, ATOM_vpcC }, /* vpx mastering display */
{ ATOM_dac3, MP4_ReadBox_dac3, 0 },
{ ATOM_dec3, MP4_ReadBox_dec3, 0 },
{ ATOM_dvc1, MP4_ReadBox_dvc1, ATOM_vc1 },
......
......@@ -384,6 +384,7 @@ typedef int64_t stime_t;
#define ATOM_gsst VLC_FOURCC( 'g', 's', 's', 't' )
#define ATOM_gstd VLC_FOURCC( 'g', 's', 't', 'd' )
#define ATOM_colr VLC_FOURCC( 'c', 'o', 'l', 'r' )
#define ATOM_SmDm VLC_FOURCC( 'S', 'm', 'D', 'm' )
#define ATOM_0x40PRM VLC_FOURCC( '@', 'P', 'R', 'M' )
#define ATOM_0x40PRQ VLC_FOURCC( '@', 'P', 'R', 'Q' )
......@@ -1266,6 +1267,14 @@ typedef struct
uint8_t *p_codec_init_data;
} MP4_Box_data_vpcC_t;
typedef struct
{
uint16_t primaries[3*2]; /* G,B,R / x,y */
uint16_t white_point[2]; /* x,y */
uint32_t i_luminanceMax;
uint32_t i_luminanceMin;
} MP4_Box_data_SmDm_t;
typedef struct
{
WAVEFORMATEX Format;
......@@ -1665,6 +1674,7 @@ typedef union MP4_Box_data_s
MP4_Box_data_tsel_t *p_tsel;
MP4_Box_data_load_t *p_load;
MP4_Box_data_vpcC_t *p_vpcC;
MP4_Box_data_SmDm_t *p_SmDm;
MP4_Box_data_tfra_t *p_tfra;
MP4_Box_data_mfro_t *p_mfro;
......
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