[vlc-commits] demux: mp4: read vp8/9/10 content light level
Francois Cartegnie
git at videolan.org
Tue Mar 6 11:40:40 CET 2018
vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Mar 5 17:10:30 2018 +0100| [b9a9971d3ca96af0eaddd7007ae9e618209b5ff7] | committer: Francois Cartegnie
demux: mp4: read vp8/9/10 content light level
(cherry picked from commit a238a38812ae83df5a855434d3860c47e11875a2)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=b9a9971d3ca96af0eaddd7007ae9e618209b5ff7
---
modules/demux/mp4/essetup.c | 7 +++++++
modules/demux/mp4/libmp4.c | 10 ++++++++++
modules/demux/mp4/libmp4.h | 8 ++++++++
3 files changed, 25 insertions(+)
diff --git a/modules/demux/mp4/essetup.c b/modules/demux/mp4/essetup.c
index c6dff52d81..3377373874 100644
--- a/modules/demux/mp4/essetup.c
+++ b/modules/demux/mp4/essetup.c
@@ -727,6 +727,13 @@ int SetupVideoES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample )
p_track->fmt.video.mastering.max_luminance = BOXDATA(p_SmDm)->i_luminanceMax;
p_track->fmt.video.mastering.min_luminance = BOXDATA(p_SmDm)->i_luminanceMin;
}
+
+ const MP4_Box_t *p_CoLL = MP4_BoxGet( p_sample, "CoLL" );
+ if( p_CoLL && BOXDATA(p_CoLL) )
+ {
+ p_track->fmt.video.lighting.MaxCLL = BOXDATA(p_CoLL)->i_maxCLL;
+ p_track->fmt.video.lighting.MaxFALL = BOXDATA(p_CoLL)->i_maxFALL;
+ }
}
}
break;
diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index eacbf420b9..ff1178c1ea 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -2008,6 +2008,15 @@ static int MP4_ReadBox_SmDm( stream_t *p_stream, MP4_Box_t *p_box )
MP4_READBOX_EXIT( 1 );
}
+static int MP4_ReadBox_CoLL( stream_t *p_stream, MP4_Box_t *p_box )
+{
+ MP4_READBOX_ENTER( MP4_Box_data_CoLL_t, NULL );
+ MP4_Box_data_CoLL_t *p_CoLL = p_box->data.p_CoLL;
+ MP4_GET2BYTES( p_CoLL->i_maxCLL );
+ MP4_GET2BYTES( p_CoLL->i_maxFALL );
+ MP4_READBOX_EXIT( 1 );
+}
+
static void MP4_FreeBox_WMA2( MP4_Box_t *p_box )
{
FREENULL( p_box->data.p_WMA2->p_extra );
@@ -4441,6 +4450,7 @@ static const struct
{ 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_CoLL, MP4_ReadBox_CoLL, ATOM_vpcC }, /* vpx light level */
{ 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 dd65e8da1d..7f2988ba14 100644
--- a/modules/demux/mp4/libmp4.h
+++ b/modules/demux/mp4/libmp4.h
@@ -385,6 +385,7 @@ typedef int64_t stime_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_CoLL VLC_FOURCC( 'C', 'o', 'L', 'L' )
#define ATOM_0x40PRM VLC_FOURCC( '@', 'P', 'R', 'M' )
#define ATOM_0x40PRQ VLC_FOURCC( '@', 'P', 'R', 'Q' )
@@ -1294,6 +1295,12 @@ typedef struct
typedef struct
{
+ uint16_t i_maxCLL;
+ uint16_t i_maxFALL;
+} MP4_Box_data_CoLL_t;
+
+typedef struct
+{
WAVEFORMATEX Format;
uint32_t i_extra;
char *p_extra;
@@ -1692,6 +1699,7 @@ typedef union MP4_Box_data_s
MP4_Box_data_load_t *p_load;
MP4_Box_data_vpcC_t *p_vpcC;
MP4_Box_data_SmDm_t *p_SmDm;
+ MP4_Box_data_CoLL_t *p_CoLL;
MP4_Box_data_tfra_t *p_tfra;
MP4_Box_data_mfro_t *p_mfro;
More information about the vlc-commits
mailing list