[vlc-commits] demux: libmp4: add support for vpcC atom
Francois Cartegnie
git at videolan.org
Mon Sep 5 15:31:30 CEST 2016
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Sep 5 11:13:32 2016 +0200| [d65d8e4240f12128794f1af7ff84109bc61fcbb5] | committer: Francois Cartegnie
demux: libmp4: add support for vpcC atom
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d65d8e4240f12128794f1af7ff84109bc61fcbb5
---
modules/demux/mp4/libmp4.c | 38 ++++++++++++++++++++++++++++++++++++++
modules/demux/mp4/libmp4.h | 18 ++++++++++++++++++
2 files changed, 56 insertions(+)
diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index ad8fdfe..6a36b7f 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -1620,6 +1620,41 @@ error:
MP4_READBOX_EXIT( 0 );
}
+static void MP4_FreeBox_vpcC( MP4_Box_t *p_box )
+{
+ free( p_box->data.p_vpcC->p_codec_init_data );
+}
+
+static int MP4_ReadBox_vpcC( stream_t *p_stream, MP4_Box_t *p_box )
+{
+ MP4_READBOX_ENTER( MP4_Box_data_vpcC_t, MP4_FreeBox_vpcC );
+ MP4_Box_data_vpcC_t *p_vpcC = p_box->data.p_vpcC;
+
+ if( p_box->i_size < 6 )
+ MP4_READBOX_EXIT( 0 );
+
+ uint8_t i_version;
+ MP4_GET1BYTE( i_version );
+ if( i_version != 0 )
+ MP4_READBOX_EXIT( 0 );
+
+ MP4_GET1BYTE( p_vpcC->i_profile );
+ MP4_GET1BYTE( p_vpcC->i_level );
+ MP4_GET1BYTE( p_vpcC->i_bit_depth );
+ p_vpcC->i_color_space = p_vpcC->i_bit_depth & 0x0F;
+ p_vpcC->i_bit_depth >>= 4;
+ MP4_GET1BYTE( p_vpcC->i_chroma_subsampling );
+ p_vpcC->i_xfer_function = ( p_vpcC->i_chroma_subsampling & 0x0F ) >> 1;
+ p_vpcC->i_fullrange = p_vpcC->i_chroma_subsampling & 0x01;
+ p_vpcC->i_chroma_subsampling >>= 4;
+ MP4_GET2BYTES( p_vpcC->i_codec_init_datasize );
+ if( p_vpcC->i_codec_init_datasize > i_read )
+ p_vpcC->i_codec_init_datasize = i_read;
+ memcpy( p_vpcC->p_codec_init_data, p_peek, i_read );
+
+ MP4_READBOX_EXIT( 1 );
+}
+
static void MP4_FreeBox_WMA2( MP4_Box_t *p_box )
{
FREENULL( p_box->data.p_WMA2->p_extra );
@@ -4057,6 +4092,9 @@ static const struct
{ ATOM_avcC, MP4_ReadBox_avcC, ATOM_avc1 },
{ ATOM_avcC, MP4_ReadBox_avcC, ATOM_avc3 },
{ ATOM_hvcC, MP4_ReadBox_Binary, 0 },
+ { ATOM_vpcC, MP4_ReadBox_vpcC, ATOM_vp08 },
+ { ATOM_vpcC, MP4_ReadBox_vpcC, ATOM_vp09 },
+ { ATOM_vpcC, MP4_ReadBox_vpcC, ATOM_vp10 },
{ ATOM_dac3, MP4_ReadBox_dac3, 0 },
{ ATOM_dec3, MP4_ReadBox_dec3, 0 },
{ ATOM_dvc1, MP4_ReadBox_dvc1, ATOM_vc1 },
diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h
index 58b711e..b2ba084 100644
--- a/modules/demux/mp4/libmp4.h
+++ b/modules/demux/mp4/libmp4.h
@@ -218,11 +218,15 @@ typedef int64_t stime_t;
#define ATOM_vp31 VLC_FOURCC( 'v', 'p', '3', '1' )
#define ATOM_h264 VLC_FOURCC( 'h', '2', '6', '4' )
#define ATOM_qdrw VLC_FOURCC( 'q', 'd', 'r', 'w' )
+#define ATOM_vp08 VLC_FOURCC( 'v', 'p', '0', '8' )
+#define ATOM_vp09 VLC_FOURCC( 'v', 'p', '0', '9' )
+#define ATOM_vp10 VLC_FOURCC( 'v', 'p', '1', '0' )
#define ATOM_WMV3 VLC_FOURCC( 'W', 'M', 'V', '3' )
#define ATOM_avc1 VLC_FOURCC( 'a', 'v', 'c', '1' )
#define ATOM_avc3 VLC_FOURCC( 'a', 'v', 'c', '3' )
#define ATOM_avcC VLC_FOURCC( 'a', 'v', 'c', 'C' )
+#define ATOM_vpcC VLC_FOURCC( 'v', 'p', 'c', 'C' )
#define ATOM_m4ds VLC_FOURCC( 'm', '4', 'd', 's' )
#define ATOM_fiel VLC_FOURCC( 'f', 'i', 'e', 'l' )
@@ -1235,6 +1239,19 @@ typedef struct
typedef struct
{
+ uint8_t i_profile;
+ uint8_t i_level;
+ uint8_t i_bit_depth;
+ uint8_t i_color_space;
+ uint8_t i_chroma_subsampling;
+ uint8_t i_xfer_function;
+ uint8_t i_fullrange;
+ uint16_t i_codec_init_datasize;
+ uint8_t *p_codec_init_data;
+} MP4_Box_data_vpcC_t;
+
+typedef struct
+{
WAVEFORMATEX Format;
uint32_t i_extra;
char *p_extra;
@@ -1579,6 +1596,7 @@ typedef union MP4_Box_data_s
MP4_Box_data_sdtp_t *p_sdtp;
MP4_Box_data_tsel_t *p_tsel;
MP4_Box_data_load_t *p_load;
+ MP4_Box_data_vpcC_t *p_vpcC;
MP4_Box_data_tfra_t *p_tfra;
MP4_Box_data_mfro_t *p_mfro;
More information about the vlc-commits
mailing list