[FFmpeg-devel] [PATCH] mov: Support mdcv and clli boxes for mastering display an color light level
Michael Niedermayer
michael at niedermayer.cc
Tue Nov 28 21:33:31 EET 2017
On Mon, Nov 27, 2017 at 03:20:10PM -0500, Vittorio Giovara wrote:
> Signed-off-by: Vittorio Giovara <vittorio.giovara at gmail.com>
> ---
> libavformat/mov.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 71 insertions(+)
>
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 79023ef369..bb463017a3 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -5072,6 +5072,51 @@ static int mov_read_smdm(MOVContext *c, AVIOContext *pb, MOVAtom atom)
> return 0;
> }
>
> +static int mov_read_mdcv(MOVContext *c, AVIOContext *pb, MOVAtom atom)
> +{
> + MOVStreamContext *sc;
> + const int mapping[3] = {1, 2, 0};
> + const int chroma_den = 50000;
> + const int luma_den = 10000;
> + int i;
> +
> + if (c->fc->nb_streams < 1)
> + return AVERROR_INVALIDDATA;
> +
> + sc = c->fc->streams[c->fc->nb_streams - 1]->priv_data;
> +
> + if (atom.size < 24) {
> + av_log(c->fc, AV_LOG_ERROR, "Invalid Mastering Display Color Volume box\n");
> + return AVERROR_INVALIDDATA;
> + }
> +
> + sc->mastering = av_mastering_display_metadata_alloc();
> + if (!sc->mastering)
> + return AVERROR(ENOMEM);
> +
> + for (i = 0; i < 3; i++) {
> + const int j = mapping[i];
rather minor suggestion but you could use:
((int[]){ 1, 2, 0 })[i];
as mapping is not used anywhere else
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
It is what and why we do it that matters, not just one of them.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20171128/a60318df/attachment.sig>
More information about the ffmpeg-devel
mailing list