[FFmpeg-devel] [PATCH 3/4] avfilter/vf_showinfo: add support for ambient viewing environment metadata

lance.lmwang at gmail.com lance.lmwang at gmail.com
Mon Mar 28 02:25:12 EEST 2022


From: Limin Wang <lance.lmwang at gmail.com>

Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
---
 libavfilter/vf_showinfo.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index 12d3931..ad86251 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -42,6 +42,7 @@
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/video_enc_params.h"
 #include "libavutil/detection_bbox.h"
+#include "libavutil/ambient_viewing_env_metadata.h"
 
 #include "avfilter.h"
 #include "internal.h"
@@ -651,6 +652,15 @@ static void dump_color_property(AVFilterContext *ctx, AVFrame *frame)
     av_log(ctx, AV_LOG_INFO, "\n");
 }
 
+static void dump_ambient_viewing_env_metadata(AVFilterContext *ctx, AVFrameSideData *sd)
+{
+    const AVAmbientViewingEnvMetadata *metadata = (const AVAmbientViewingEnvMetadata *)sd->data;
+
+    av_log(ctx, AV_LOG_INFO, "Ambient Viewing Environment metadata: \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 +822,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_metadata(ctx, sd);
+            break;
         default:
             av_log(ctx, AV_LOG_WARNING, "unknown side data type %d "
                    "(%"SIZE_SPECIFIER" bytes)\n", sd->type, sd->size);
-- 
1.8.3.1



More information about the ffmpeg-devel mailing list