diff mbox series

[FFmpeg-devel,3/4] ffprobe: expose AVAmbientViewingEnvironment side data in AVFrames

Message ID 20230110211949.8195-3-jeebjp@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/4] avcodec/cbs_{h2645, sei}: add support for Ambient Viewing Environment SEI | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Jan Ekström Jan. 10, 2023, 9:19 p.m. UTC
---
 fftools/ffprobe.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

James Almer Jan. 10, 2023, 9:35 p.m. UTC | #1
On 1/10/2023 6:19 PM, Jan Ekström wrote:
> ---
>   fftools/ffprobe.c | 15 +++++++++++++++
>   1 file changed, 15 insertions(+)
> 
> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> index d2f126d9d6..15c61e1c7c 100644
> --- a/fftools/ffprobe.c
> +++ b/fftools/ffprobe.c
> @@ -33,6 +33,7 @@
>   #include "libavformat/version.h"
>   #include "libavcodec/avcodec.h"
>   #include "libavcodec/version.h"
> +#include "libavutil/ambient_viewing_environment.h"
>   #include "libavutil/avassert.h"
>   #include "libavutil/avstring.h"
>   #include "libavutil/bprint.h"
> @@ -2268,6 +2269,17 @@ static void print_dynamic_hdr_vivid(WriterContext *w, const AVDynamicHDRVivid *m
>       }
>   }
>   
> +static void print_ambient_viewing_environment(WriterContext *w,
> +                                              const AVAmbientViewingEnvironment *env)
> +{
> +    if (!env)
> +        return;
> +
> +    print_q("ambient_illuminance", env->ambient_illuminance, '/');
> +    print_q("ambient_light_x",     env->ambient_light_x,     '/');
> +    print_q("ambient_light_y",     env->ambient_light_y,     '/');
> +}
> +
>   static void print_pkt_side_data(WriterContext *w,
>                                   AVCodecParameters *par,
>                                   const AVPacketSideData *side_data,
> @@ -2704,6 +2716,9 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
>               } else if (sd->type == AV_FRAME_DATA_DYNAMIC_HDR_VIVID) {
>                   AVDynamicHDRVivid *metadata = (AVDynamicHDRVivid *)sd->data;
>                   print_dynamic_hdr_vivid(w, metadata);
> +            } else if (sd->type == AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT) {
> +                print_ambient_viewing_environment(
> +                    w, (const AVAmbientViewingEnvironment *)sd->data);
>               }
>               writer_print_section_footer(w);
>           }

Should be ok.
Stefano Sabatini Jan. 14, 2023, 8:03 p.m. UTC | #2
On date Tuesday 2023-01-10 23:19:48 +0200, Jan Ekström wrote:
> ---
>  fftools/ffprobe.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)

Missing doc/ffprobe.xsd changes?

LGTM otherwise.
Jan Ekström Jan. 14, 2023, 8:59 p.m. UTC | #3
On Sat, Jan 14, 2023 at 10:03 PM Stefano Sabatini <stefasab@gmail.com> wrote:
>
> On date Tuesday 2023-01-10 23:19:48 +0200, Jan Ekström wrote:
> > ---
> >  fftools/ffprobe.c | 15 +++++++++++++++
> >  1 file changed, 15 insertions(+)
>
> Missing doc/ffprobe.xsd changes?
>
> LGTM otherwise.
>

I quickly checked ffprobe.xsd and it doesn't seem to define any of the
side data entries that it prints out, other than
frameSideDataTimecodeList ? So if each packet/frame side data type
output should have been added there, it seems to have been neglected
for quite a while.

Jan
Stefano Sabatini Jan. 15, 2023, 1:14 a.m. UTC | #4
On date Saturday 2023-01-14 22:59:31 +0200, Jan Ekström wrote:
> On Sat, Jan 14, 2023 at 10:03 PM Stefano Sabatini <stefasab@gmail.com> wrote:
> >
> > On date Tuesday 2023-01-10 23:19:48 +0200, Jan Ekström wrote:
> > > ---
> > >  fftools/ffprobe.c | 15 +++++++++++++++
> > >  1 file changed, 15 insertions(+)
> >
> > Missing doc/ffprobe.xsd changes?
> >
> > LGTM otherwise.
> >
> 
> I quickly checked ffprobe.xsd and it doesn't seem to define any of the
> side data entries that it prints out, other than
> frameSideDataTimecodeList ? So if each packet/frame side data type
> output should have been added there, it seems to have been neglected
> for quite a while.

I see, so feel free to push as is, fixing this has a broader scope
(can be done separately I guess).
diff mbox series

Patch

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index d2f126d9d6..15c61e1c7c 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -33,6 +33,7 @@ 
 #include "libavformat/version.h"
 #include "libavcodec/avcodec.h"
 #include "libavcodec/version.h"
+#include "libavutil/ambient_viewing_environment.h"
 #include "libavutil/avassert.h"
 #include "libavutil/avstring.h"
 #include "libavutil/bprint.h"
@@ -2268,6 +2269,17 @@  static void print_dynamic_hdr_vivid(WriterContext *w, const AVDynamicHDRVivid *m
     }
 }
 
+static void print_ambient_viewing_environment(WriterContext *w,
+                                              const AVAmbientViewingEnvironment *env)
+{
+    if (!env)
+        return;
+
+    print_q("ambient_illuminance", env->ambient_illuminance, '/');
+    print_q("ambient_light_x",     env->ambient_light_x,     '/');
+    print_q("ambient_light_y",     env->ambient_light_y,     '/');
+}
+
 static void print_pkt_side_data(WriterContext *w,
                                 AVCodecParameters *par,
                                 const AVPacketSideData *side_data,
@@ -2704,6 +2716,9 @@  static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
             } else if (sd->type == AV_FRAME_DATA_DYNAMIC_HDR_VIVID) {
                 AVDynamicHDRVivid *metadata = (AVDynamicHDRVivid *)sd->data;
                 print_dynamic_hdr_vivid(w, metadata);
+            } else if (sd->type == AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT) {
+                print_ambient_viewing_environment(
+                    w, (const AVAmbientViewingEnvironment *)sd->data);
             }
             writer_print_section_footer(w);
         }