[FFmpeg-devel] [PATCH] avfilter/vf_showinfo: add support for Ambient Viewing Environment side data

James Almer jamrial at gmail.com
Fri Jan 13 23:35:36 EET 2023


Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavfilter/vf_showinfo.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index d5edbd2f0a..e55625b338 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_environment.h"
 #include "libavutil/uuid.h"
 
 #include "avfilter.h"
@@ -601,6 +602,17 @@ static void dump_dovi_metadata(AVFilterContext *ctx, const AVFrameSideData *sd)
     av_log(ctx, AV_LOG_INFO, "source_diagonal=%"PRIu16"; ", color->source_diagonal);
 }
 
+static void dump_ambient_viewing_environment(AVFilterContext *ctx, const AVFrameSideData *sd)
+{
+    const AVAmbientViewingEnvironment *ambient_viewing_environment =
+                                               (const AVAmbientViewingEnvironment *)sd->data;
+
+    av_log(ctx, AV_LOG_INFO, "ambient_illuminance=%f, ambient_light_x=%f, ambient_light_y=%f",
+           av_q2d(ambient_viewing_environment->ambient_illuminance),
+           av_q2d(ambient_viewing_environment->ambient_light_x),
+           av_q2d(ambient_viewing_environment->ambient_light_y));
+}
+
 static void dump_color_property(AVFilterContext *ctx, AVFrame *frame)
 {
     const char *color_range_str     = av_color_range_name(frame->color_range);
@@ -797,6 +809,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_ENVIRONMENT:
+            dump_ambient_viewing_environment(ctx, sd);
+            break;
         default:
             if (name)
                 av_log(ctx, AV_LOG_INFO,
-- 
2.39.0



More information about the ffmpeg-devel mailing list