diff mbox series

[FFmpeg-devel,v3,3/5] avfilter/vf_showinfo: add support for ambient viewing environment metadata

Message ID 1649166427-9667-3-git-send-email-lance.lmwang@gmail.com
State New
Headers show
Series [FFmpeg-devel,v3,1/5] avutil: add ambient viewing environment metadata side data | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Limin Wang April 5, 2022, 1:47 p.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavfilter/vf_showinfo.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff mbox series

Patch

diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index 12d3931..1e81d26 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -651,6 +651,15 @@  static void dump_color_property(AVFilterContext *ctx, AVFrame *frame)
     av_log(ctx, AV_LOG_INFO, "\n");
 }
 
+static void dump_ambient_viewing_env(AVFilterContext *ctx, AVFrameSideData *sd)
+{
+    const AVAmbientViewingEnv *metadata = (const AVAmbientViewingEnv *)sd->data;
+
+    av_log(ctx, AV_LOG_INFO, "Ambient Viewing Environment: \n");
+    av_log(ctx, AV_LOG_INFO, "    ambient_illuminance=%d, ambient_light_x=%d, ambient_light_y=%d",
+           metadata->ambient_illuminance, metadata->ambient_light_x, metadata->ambient_light_y);
+}
+
 static void update_sample_stats_8(const uint8_t *src, int len, int64_t *sum, int64_t *sum2)
 {
     int i;
@@ -812,6 +821,9 @@  static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
         case AV_FRAME_DATA_DOVI_METADATA:
             dump_dovi_metadata(ctx, sd);
             break;
+        case AV_FRAME_DATA_AMBIENT_VIEWING_ENV:
+             dump_ambient_viewing_env(ctx, sd);
+            break;
         default:
             av_log(ctx, AV_LOG_WARNING, "unknown side data type %d "
                    "(%"SIZE_SPECIFIER" bytes)\n", sd->type, sd->size);