Re: [FFmpeg-devel] [PATCH 1/4] avutil: add ambient viewing environment metadata side data

2022-03-27 Thread lance . lmwang
On Sun, Mar 27, 2022 at 08:30:30PM -0300, James Almer wrote:
> 
> 
> On 3/27/2022 8:25 PM, lance.lmw...@gmail.com wrote:
> > From: Limin Wang 
> > 
> > Signed-off-by: Limin Wang 
> > ---
> >   libavutil/Makefile   |  2 +
> >   libavutil/ambient_viewing_env_metadata.c | 47 +
> >   libavutil/ambient_viewing_env_metadata.h | 72 
> > 
> >   libavutil/frame.c|  1 +
> >   libavutil/frame.h|  6 +++
> >   5 files changed, 128 insertions(+)
> >   create mode 100644 libavutil/ambient_viewing_env_metadata.c
> >   create mode 100644 libavutil/ambient_viewing_env_metadata.h
> > 
> > diff --git a/libavutil/Makefile b/libavutil/Makefile
> > index 81df3b0..e388d33 100644
> > --- a/libavutil/Makefile
> > +++ b/libavutil/Makefile
> > @@ -26,6 +26,7 @@ HEADERS = adler32.h   
> >   \
> > display.h \
> > dovi_meta.h   \
> > downmix_info.h\
> > +  ambient_viewing_env_metadata.h\
> > encryption_info.h \
> > error.h   \
> > eval.h\
> > @@ -119,6 +120,7 @@ OBJS = adler32.o
> > \
> >  display.o\
> >  dovi_meta.o  \
> >  downmix_info.o   \
> > +   ambient_viewing_env_metadata.o   \
> >  encryption_info.o\
> >  error.o  \
> >  eval.o   \
> > diff --git a/libavutil/ambient_viewing_env_metadata.c 
> > b/libavutil/ambient_viewing_env_metadata.c
> > new file mode 100644
> > index 000..7006b64
> > --- /dev/null
> > +++ b/libavutil/ambient_viewing_env_metadata.c
> > @@ -0,0 +1,47 @@
> > +/**
> > + * Copyright (c) 2022 Limin Wang 
> > + *
> > + * 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 
> > +#include 
> > +#include "ambient_viewing_env_metadata.h"
> > +#include "mem.h"
> > +
> > +AVAmbientViewingEnvMetadata *av_ambient_viewing_env_metadata_alloc(size_t 
> > *size)
> > +{
> > +AVAmbientViewingEnvMetadata *metadata = av_mallocz(sizeof(*metadata));
> > +
> > +if (size)
> > +*size = sizeof(*metadata);
> > +
> > +return metadata;
> > +}
> > +
> > +AVAmbientViewingEnvMetadata 
> > *av_ambient_viewing_env_metadata_create_side_data(AVFrame *frame)
> > +{
> > +AVFrameSideData *side_data = av_frame_new_side_data(frame,
> > +AV_FRAME_DATA_AMBIENT_VIEWING_ENV,
> > +sizeof(AVAmbientViewingEnvMetadata));
> > +if (!side_data)
> > +return NULL;
> > +
> > +memset(side_data->data, 0, sizeof(AVAmbientViewingEnvMetadata));
> > +
> > +return (AVAmbientViewingEnvMetadata *)side_data->data;
> > +}
> > diff --git a/libavutil/ambient_viewing_env_metadata.h 
> > b/libavutil/ambient_viewing_env_metadata.h
> > new file mode 100644
> > index 000..b0fbcd0
> > --- /dev/null
> > +++ b/libavutil/ambient_viewing_env_metadata.h
> > @@ -0,0 +1,72 @@
> > +/*
> > + * Copyright (c) 2022 Limin Wang 
> > + *
> > + * 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 o

Re: [FFmpeg-devel] [PATCH 1/4] avutil: add ambient viewing environment metadata side data

2022-03-27 Thread James Almer




On 3/27/2022 8:25 PM, lance.lmw...@gmail.com wrote:

From: Limin Wang 

Signed-off-by: Limin Wang 
---
  libavutil/Makefile   |  2 +
  libavutil/ambient_viewing_env_metadata.c | 47 +
  libavutil/ambient_viewing_env_metadata.h | 72 
  libavutil/frame.c|  1 +
  libavutil/frame.h|  6 +++
  5 files changed, 128 insertions(+)
  create mode 100644 libavutil/ambient_viewing_env_metadata.c
  create mode 100644 libavutil/ambient_viewing_env_metadata.h

diff --git a/libavutil/Makefile b/libavutil/Makefile
index 81df3b0..e388d33 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -26,6 +26,7 @@ HEADERS = adler32.h   
  \
display.h \
dovi_meta.h   \
downmix_info.h\
+  ambient_viewing_env_metadata.h\
encryption_info.h \
error.h   \
eval.h\
@@ -119,6 +120,7 @@ OBJS = adler32.o
\
 display.o\
 dovi_meta.o  \
 downmix_info.o   \
+   ambient_viewing_env_metadata.o   \
 encryption_info.o\
 error.o  \
 eval.o   \
diff --git a/libavutil/ambient_viewing_env_metadata.c 
b/libavutil/ambient_viewing_env_metadata.c
new file mode 100644
index 000..7006b64
--- /dev/null
+++ b/libavutil/ambient_viewing_env_metadata.c
@@ -0,0 +1,47 @@
+/**
+ * Copyright (c) 2022 Limin Wang 
+ *
+ * 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 
+#include 
+#include "ambient_viewing_env_metadata.h"
+#include "mem.h"
+
+AVAmbientViewingEnvMetadata *av_ambient_viewing_env_metadata_alloc(size_t 
*size)
+{
+AVAmbientViewingEnvMetadata *metadata = av_mallocz(sizeof(*metadata));
+
+if (size)
+*size = sizeof(*metadata);
+
+return metadata;
+}
+
+AVAmbientViewingEnvMetadata 
*av_ambient_viewing_env_metadata_create_side_data(AVFrame *frame)
+{
+AVFrameSideData *side_data = av_frame_new_side_data(frame,
+AV_FRAME_DATA_AMBIENT_VIEWING_ENV,
+sizeof(AVAmbientViewingEnvMetadata));
+if (!side_data)
+return NULL;
+
+memset(side_data->data, 0, sizeof(AVAmbientViewingEnvMetadata));
+
+return (AVAmbientViewingEnvMetadata *)side_data->data;
+}
diff --git a/libavutil/ambient_viewing_env_metadata.h 
b/libavutil/ambient_viewing_env_metadata.h
new file mode 100644
index 000..b0fbcd0
--- /dev/null
+++ b/libavutil/ambient_viewing_env_metadata.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2022 Limin Wang 
+ *
+ * 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
+ */
+
+#ifndef AVUTIL_AMBIENT_VIEWING_ENV_METADATA_H
+#define AVUTIL_AMBIENT_VIEWING_ENV_METADATA_H
+
+#include "frame.h"
+
+
+/**
+ * The characteristics of the nominal ambient viewing environmen

[FFmpeg-devel] [PATCH 1/4] avutil: add ambient viewing environment metadata side data

2022-03-27 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavutil/Makefile   |  2 +
 libavutil/ambient_viewing_env_metadata.c | 47 +
 libavutil/ambient_viewing_env_metadata.h | 72 
 libavutil/frame.c|  1 +
 libavutil/frame.h|  6 +++
 5 files changed, 128 insertions(+)
 create mode 100644 libavutil/ambient_viewing_env_metadata.c
 create mode 100644 libavutil/ambient_viewing_env_metadata.h

diff --git a/libavutil/Makefile b/libavutil/Makefile
index 81df3b0..e388d33 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -26,6 +26,7 @@ HEADERS = adler32.h   
  \
   display.h \
   dovi_meta.h   \
   downmix_info.h\
+  ambient_viewing_env_metadata.h\
   encryption_info.h \
   error.h   \
   eval.h\
@@ -119,6 +120,7 @@ OBJS = adler32.o
\
display.o\
dovi_meta.o  \
downmix_info.o   \
+   ambient_viewing_env_metadata.o   \
encryption_info.o\
error.o  \
eval.o   \
diff --git a/libavutil/ambient_viewing_env_metadata.c 
b/libavutil/ambient_viewing_env_metadata.c
new file mode 100644
index 000..7006b64
--- /dev/null
+++ b/libavutil/ambient_viewing_env_metadata.c
@@ -0,0 +1,47 @@
+/**
+ * Copyright (c) 2022 Limin Wang 
+ *
+ * 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 
+#include 
+#include "ambient_viewing_env_metadata.h"
+#include "mem.h"
+
+AVAmbientViewingEnvMetadata *av_ambient_viewing_env_metadata_alloc(size_t 
*size)
+{
+AVAmbientViewingEnvMetadata *metadata = av_mallocz(sizeof(*metadata));
+
+if (size)
+*size = sizeof(*metadata);
+
+return metadata;
+}
+
+AVAmbientViewingEnvMetadata 
*av_ambient_viewing_env_metadata_create_side_data(AVFrame *frame)
+{
+AVFrameSideData *side_data = av_frame_new_side_data(frame,
+AV_FRAME_DATA_AMBIENT_VIEWING_ENV,
+sizeof(AVAmbientViewingEnvMetadata));
+if (!side_data)
+return NULL;
+
+memset(side_data->data, 0, sizeof(AVAmbientViewingEnvMetadata));
+
+return (AVAmbientViewingEnvMetadata *)side_data->data;
+}
diff --git a/libavutil/ambient_viewing_env_metadata.h 
b/libavutil/ambient_viewing_env_metadata.h
new file mode 100644
index 000..b0fbcd0
--- /dev/null
+++ b/libavutil/ambient_viewing_env_metadata.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2022 Limin Wang 
+ *
+ * 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
+ */
+
+#ifndef AVUTIL_AMBIENT_VIEWING_ENV_METADATA_H
+#define AVUTIL_AMBIENT_VIEWING_ENV_METADATA_H
+
+#include "frame.h"
+
+
+/**
+ * The characteristics of the nominal ambient viewing environment for
+ * the display of the associated video content.
+ * To be used as payl