diff mbox

[FFmpeg-devel,v2,3/3] ffprobe: add support for logging gamma side data

Message ID 20170925192809.1379-3-atomnuker@gmail.com
State New
Headers show

Commit Message

Rostislav Pehlivanov Sept. 25, 2017, 7:28 p.m. UTC
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
---
 ffprobe.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

James Almer Sept. 25, 2017, 7:44 p.m. UTC | #1
On 9/25/2017 4:28 PM, Rostislav Pehlivanov wrote:
> Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
> ---
>  ffprobe.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/ffprobe.c b/ffprobe.c
> index b2e8949d9f..171f856c2d 100644
> --- a/ffprobe.c
> +++ b/ffprobe.c
> @@ -2227,6 +2227,9 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
>                  if (tag)
>                      print_str(tag->key, tag->value);
>                  print_int("size", sd->size);
> +            } else if (sd->type == AV_FRAME_DATA_GAMMA) {

Check that sd->size >= sizeof(AVRational) as well.

> +                AVRational *gamma = (AVRational *)sd->data;
> +                print_q("gamma", *gamma, '/');
>              }
>              writer_print_section_footer(w);
>          }
>
wm4 Sept. 26, 2017, 12:14 p.m. UTC | #2
On Mon, 25 Sep 2017 16:44:45 -0300
James Almer <jamrial@gmail.com> wrote:

> On 9/25/2017 4:28 PM, Rostislav Pehlivanov wrote:
> > Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
> > ---
> >  ffprobe.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/ffprobe.c b/ffprobe.c
> > index b2e8949d9f..171f856c2d 100644
> > --- a/ffprobe.c
> > +++ b/ffprobe.c
> > @@ -2227,6 +2227,9 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
> >                  if (tag)
> >                      print_str(tag->key, tag->value);
> >                  print_int("size", sd->size);
> > +            } else if (sd->type == AV_FRAME_DATA_GAMMA) {  
> 
> Check that sd->size >= sizeof(AVRational) as well.

It's guaranteed to be that size.
James Almer Sept. 26, 2017, 2:12 p.m. UTC | #3
On 9/26/2017 9:14 AM, wm4 wrote:
> On Mon, 25 Sep 2017 16:44:45 -0300
> James Almer <jamrial@gmail.com> wrote:
> 
>> On 9/25/2017 4:28 PM, Rostislav Pehlivanov wrote:
>>> Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
>>> ---
>>>  ffprobe.c | 3 +++
>>>  1 file changed, 3 insertions(+)
>>>
>>> diff --git a/ffprobe.c b/ffprobe.c
>>> index b2e8949d9f..171f856c2d 100644
>>> --- a/ffprobe.c
>>> +++ b/ffprobe.c
>>> @@ -2227,6 +2227,9 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
>>>                  if (tag)
>>>                      print_str(tag->key, tag->value);
>>>                  print_int("size", sd->size);
>>> +            } else if (sd->type == AV_FRAME_DATA_GAMMA) {  
>>
>> Check that sd->size >= sizeof(AVRational) as well.
> 
> It's guaranteed to be that size.

Other side data types without a related struct check for size. See gop
timecode, expecting an int64_t, and display matrix, expecting 9 int32_t.
Maybe those should also be removed if that's indeed the case.
wm4 Sept. 26, 2017, 2:23 p.m. UTC | #4
On Tue, 26 Sep 2017 11:12:41 -0300
James Almer <jamrial@gmail.com> wrote:

> On 9/26/2017 9:14 AM, wm4 wrote:
> > On Mon, 25 Sep 2017 16:44:45 -0300
> > James Almer <jamrial@gmail.com> wrote:
> >   
> >> On 9/25/2017 4:28 PM, Rostislav Pehlivanov wrote:  
> >>> Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
> >>> ---
> >>>  ffprobe.c | 3 +++
> >>>  1 file changed, 3 insertions(+)
> >>>
> >>> diff --git a/ffprobe.c b/ffprobe.c
> >>> index b2e8949d9f..171f856c2d 100644
> >>> --- a/ffprobe.c
> >>> +++ b/ffprobe.c
> >>> @@ -2227,6 +2227,9 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
> >>>                  if (tag)
> >>>                      print_str(tag->key, tag->value);
> >>>                  print_int("size", sd->size);
> >>> +            } else if (sd->type == AV_FRAME_DATA_GAMMA) {    
> >>
> >> Check that sd->size >= sizeof(AVRational) as well.  
> > 
> > It's guaranteed to be that size.  
> 
> Other side data types without a related struct check for size. See gop
> timecode, expecting an int64_t, and display matrix, expecting 9 int32_t.
> Maybe those should also be removed if that's indeed the case.

Maybe that should wait until side data merging is fully removed (which
could cause this), to avoid creating yet another pointless discussion.
James Almer Sept. 26, 2017, 2:27 p.m. UTC | #5
On 9/26/2017 11:23 AM, wm4 wrote:
> On Tue, 26 Sep 2017 11:12:41 -0300
> James Almer <jamrial@gmail.com> wrote:
> 
>> On 9/26/2017 9:14 AM, wm4 wrote:
>>> On Mon, 25 Sep 2017 16:44:45 -0300
>>> James Almer <jamrial@gmail.com> wrote:
>>>   
>>>> On 9/25/2017 4:28 PM, Rostislav Pehlivanov wrote:  
>>>>> Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
>>>>> ---
>>>>>  ffprobe.c | 3 +++
>>>>>  1 file changed, 3 insertions(+)
>>>>>
>>>>> diff --git a/ffprobe.c b/ffprobe.c
>>>>> index b2e8949d9f..171f856c2d 100644
>>>>> --- a/ffprobe.c
>>>>> +++ b/ffprobe.c
>>>>> @@ -2227,6 +2227,9 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
>>>>>                  if (tag)
>>>>>                      print_str(tag->key, tag->value);
>>>>>                  print_int("size", sd->size);
>>>>> +            } else if (sd->type == AV_FRAME_DATA_GAMMA) {    
>>>>
>>>> Check that sd->size >= sizeof(AVRational) as well.  
>>>
>>> It's guaranteed to be that size.  
>>
>> Other side data types without a related struct check for size. See gop
>> timecode, expecting an int64_t, and display matrix, expecting 9 int32_t.
>> Maybe those should also be removed if that's indeed the case.
> 
> Maybe that should wait until side data merging is fully removed (which
> could cause this), to avoid creating yet another pointless discussion.

Side data merging is only for packet side data it seems, so no issues in
that regard.

In any case, it hardly a problem, so nevermind.
diff mbox

Patch

diff --git a/ffprobe.c b/ffprobe.c
index b2e8949d9f..171f856c2d 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -2227,6 +2227,9 @@  static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
                 if (tag)
                     print_str(tag->key, tag->value);
                 print_int("size", sd->size);
+            } else if (sd->type == AV_FRAME_DATA_GAMMA) {
+                AVRational *gamma = (AVRational *)sd->data;
+                print_q("gamma", *gamma, '/');
             }
             writer_print_section_footer(w);
         }