summaryrefslogtreecommitdiff
path: root/libavutil/mastering_display_metadata.c
diff options
context:
space:
mode:
authorNeil Birkbeck <neil.birkbeck@gmail.com>2016-01-16 16:19:38 -0800
committerMichael Niedermayer <michael@niedermayer.cc>2016-01-19 16:43:31 +0100
commitd91718107c33960ad295950d7419e6dba292d723 (patch)
tree7491c55faf2a1e675dd88d4ee61c87ecc474955e /libavutil/mastering_display_metadata.c
parent22f64c23244f4b83f59b866387ebeb8edca21b0d (diff)
libavutil: add mastering display metadata sidedata
Adding mastering display metadata struct to avutil. The mastering display metadata contains information about the mastering display color volume (SMPTE 2086:2014). This info comes from HEVC in the SEI_TYPE_MASTERING_DISPLAY_INFO and is soon to be included in MKV: https://mailarchive.ietf.org/arch/search/?email_list=cellar&gbt=1&index=sZyfPTM-QY69P-0omfOIiTN622o so it is similar to SEI FPA / stereo_mode in MKV and as such this patch follows how AVStereo3D is implemented. I'll add support to HEVC in a follow-up (and MKV when spec is approved). Signed-off-by: Neil Birkbeck <neil.birkbeck@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavutil/mastering_display_metadata.c')
-rw-r--r--libavutil/mastering_display_metadata.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/libavutil/mastering_display_metadata.c b/libavutil/mastering_display_metadata.c
new file mode 100644
index 0000000000..e1683e55c7
--- /dev/null
+++ b/libavutil/mastering_display_metadata.c
@@ -0,0 +1,43 @@
+/**
+ * Copyright (c) 2016 Neil Birkbeck <neil.birkbeck@gmail.com>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stdint.h>
+#include <string.h>
+
+#include "mastering_display_metadata.h"
+#include "mem.h"
+
+AVMasteringDisplayMetadata *av_mastering_display_metadata_alloc(void)
+{
+ return av_mallocz(sizeof(AVMasteringDisplayMetadata));
+}
+
+AVMasteringDisplayMetadata *av_mastering_display_metadata_create_side_data(AVFrame *frame)
+{
+ AVFrameSideData *side_data = av_frame_new_side_data(frame,
+ AV_FRAME_DATA_MASTERING_DISPLAY_METADATA,
+ sizeof(AVMasteringDisplayMetadata));
+ if (!side_data)
+ return NULL;
+
+ memset(side_data->data, 0, sizeof(AVMasteringDisplayMetadata));
+
+ return (AVMasteringDisplayMetadata *)side_data->data;
+}