Commit afd07036 authored by Denis Charmet's avatar Denis Charmet

Add HEVC support in MP4

parent cdb1a7b6
......@@ -1303,6 +1303,29 @@ static int MP4_ReadBox_esds( stream_t *p_stream, MP4_Box_t *p_box )
#undef es_descriptor
}
static void MP4_FreeBox_hvcC(MP4_Box_t *p_box )
{
MP4_Box_data_hvcC_t *p_hvcC = p_box->data.p_hvcC;
if( p_hvcC->i_hvcC > 0 ) FREENULL( p_hvcC->p_hvcC) ;
}
static int MP4_ReadBox_hvcC( stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_Box_data_hvcC_t *p_hvcC;
MP4_READBOX_ENTER( MP4_Box_data_hvcC_t );
p_hvcC = p_box->data.p_hvcC;
p_hvcC->i_hvcC = i_read;
if( p_hvcC->i_hvcC > 0 )
{
uint8_t * p = p_hvcC->p_hvcC = malloc( p_hvcC->i_hvcC );
if( p )
memcpy( p, p_peek, i_read );
}
MP4_READBOX_EXIT( 1 );
}
static void MP4_FreeBox_avcC( MP4_Box_t *p_box )
{
MP4_Box_data_avcC_t *p_avcC = p_box->data.p_avcC;
......@@ -3180,6 +3203,7 @@ static const struct
{ ATOM_dcom, MP4_ReadBox_dcom, MP4_FreeBox_Common },
{ ATOM_cmvd, MP4_ReadBox_cmvd, MP4_FreeBox_cmvd },
{ ATOM_avcC, MP4_ReadBox_avcC, MP4_FreeBox_avcC },
{ ATOM_hvcC, MP4_ReadBox_hvcC, MP4_FreeBox_hvcC },
{ ATOM_dac3, MP4_ReadBox_dac3, MP4_FreeBox_Common },
{ ATOM_dvc1, MP4_ReadBox_dvc1, MP4_FreeBox_Common },
{ ATOM_enda, MP4_ReadBox_enda, MP4_FreeBox_Common },
......
......@@ -167,6 +167,8 @@
#define ATOM_avcC VLC_FOURCC( 'a', 'v', 'c', 'C' )
#define ATOM_m4ds VLC_FOURCC( 'm', '4', 'd', 's' )
#define ATOM_hvcC VLC_FOURCC( 'h', 'v', 'c', 'C' )
#define ATOM_dvc VLC_FOURCC( 'd', 'v', 'c', ' ' )
#define ATOM_dvp VLC_FOURCC( 'd', 'v', 'p', ' ' )
#define ATOM_dv5n VLC_FOURCC( 'd', 'v', '5', 'n' )
......@@ -1149,6 +1151,12 @@ typedef struct
uint8_t *CodecPrivateData;
} MP4_Box_data_stra_t;
typedef struct
{
uint32_t i_hvcC;
uint8_t *p_hvcC;
} MP4_Box_data_hvcC_t;
/*
typedef struct MP4_Box_data__s
{
......@@ -1233,6 +1241,7 @@ typedef union MP4_Box_data_s
MP4_Box_data_tfrf_t *p_tfrf;
MP4_Box_data_tfxd_t *p_tfxd;
MP4_Box_data_hvcC_t *p_hvcC;
void *p_data; /* for unknow type */
} MP4_Box_data_t;
......
......@@ -2217,6 +2217,28 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
}
break;
}
case VLC_FOURCC( 'h', 'v', 'c', '1' ):
{
MP4_Box_t *p_hvcC = MP4_BoxGet( p_sample, "hvcC" );
if( p_hvcC )
{
p_track->fmt.i_extra = p_hvcC->data.p_hvcC->i_hvcC;
if( p_track->fmt.i_extra > 0 )
{
p_track->fmt.p_extra = malloc( p_hvcC->data.p_hvcC->i_hvcC );
memcpy( p_track->fmt.p_extra, p_hvcC->data.p_hvcC->p_hvcC,
p_track->fmt.i_extra );
}
p_track->fmt.i_codec = VLC_CODEC_HEVC;
}
else
{
msg_Err( p_demux, "missing hvcC" );
}
break;
}
case VLC_CODEC_ADPCM_MS:
case VLC_CODEC_ADPCM_IMA_WAV:
......
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