[FFmpeg-devel] [PATCH] ffprobe: print some basic information about avframe side data

Stefano Sabatini stefasab at gmail.com
Wed Jul 30 17:21:15 CEST 2014


On date Wednesday 2014-07-30 15:21:06 +0200, Michael Niedermayer encoded:
> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> ---
>  doc/ffprobe.xsd |   11 +++++++++++
>  ffprobe.c       |   21 ++++++++++++++++++++-
>  2 files changed, 31 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/ffprobe.xsd b/doc/ffprobe.xsd
> index 9ef9ecb..e0e9179 100644
> --- a/doc/ffprobe.xsd
> +++ b/doc/ffprobe.xsd
> @@ -55,6 +55,7 @@
>      <xsd:complexType name="frameType">
>        <xsd:sequence>
>              <xsd:element name="tag" type="ffprobe:tagType" minOccurs="0" maxOccurs="unbounded"/>
> +            <xsd:element name="sidedata_list" type="ffprobe:frameSideDataListType"   minOccurs="0" maxOccurs="1" />
>        </xsd:sequence>
>  
>        <xsd:attribute name="media_type"    type="xsd:string" use="required"/>
> @@ -91,6 +92,16 @@
>        <xsd:attribute name="repeat_pict"            type="xsd:int"   />
>      </xsd:complexType>
>  
> +    <xsd:complexType name="frameSideDataListType">
> +        <xsd:sequence>
> +            <xsd:element name="sidedata" type="ffprobe:frameSideDataType" minOccurs="1" maxOccurs="unbounded"/>

I'd say side_data for consistency

> +        </xsd:sequence>
> +    </xsd:complexType>
> +    <xsd:complexType name="frameSideDataType">
> +        <xsd:attribute name="side_data_type"              type="xsd:string"/>
> +        <xsd:attribute name="side_data_size"              type="xsd:int"   />
> +    </xsd:complexType>
> +
>      <xsd:complexType name="subtitleType">
>        <xsd:attribute name="media_type"         type="xsd:string" fixed="subtitle" use="required"/>
>        <xsd:attribute name="pts"                type="xsd:long" />
> diff --git a/ffprobe.c b/ffprobe.c
> index 1329466..c9fc79d 100644
> --- a/ffprobe.c
> +++ b/ffprobe.c
> @@ -123,6 +123,8 @@ typedef enum {
>      SECTION_ID_FRAME,
>      SECTION_ID_FRAMES,
>      SECTION_ID_FRAME_TAGS,

> +    SECTION_ID_FRAME_SIDEDATA_LIST,
> +    SECTION_ID_FRAME_SIDEDATA,

same here SIDE_DATA*

>      SECTION_ID_LIBRARY_VERSION,
>      SECTION_ID_LIBRARY_VERSIONS,
>      SECTION_ID_PACKET,
> @@ -152,8 +154,10 @@ static struct section sections[] = {
>      [SECTION_ID_FORMAT] =             { SECTION_ID_FORMAT, "format", 0, { SECTION_ID_FORMAT_TAGS, -1 } },
>      [SECTION_ID_FORMAT_TAGS] =        { SECTION_ID_FORMAT_TAGS, "tags", SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "format_tags" },
>      [SECTION_ID_FRAMES] =             { SECTION_ID_FRAMES, "frames", SECTION_FLAG_IS_ARRAY, { SECTION_ID_FRAME, SECTION_ID_SUBTITLE, -1 } },
> -    [SECTION_ID_FRAME] =              { SECTION_ID_FRAME, "frame", 0, { SECTION_ID_FRAME_TAGS, -1 } },
> +    [SECTION_ID_FRAME] =              { SECTION_ID_FRAME, "frame", 0, { SECTION_ID_FRAME_TAGS, SECTION_ID_FRAME_SIDEDATA_LIST, -1 } },
>      [SECTION_ID_FRAME_TAGS] =         { SECTION_ID_FRAME_TAGS, "tags", SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "frame_tags" },
> +    [SECTION_ID_FRAME_SIDEDATA_LIST] ={ SECTION_ID_FRAME_SIDEDATA_LIST, "sidedata_list", SECTION_FLAG_IS_ARRAY, { SECTION_ID_FRAME_SIDEDATA, -1 } },
> +    [SECTION_ID_FRAME_SIDEDATA] =     { SECTION_ID_FRAME_SIDEDATA, "sidedata", 0, { -1 } },
>      [SECTION_ID_LIBRARY_VERSIONS] =   { SECTION_ID_LIBRARY_VERSIONS, "library_versions", SECTION_FLAG_IS_ARRAY, { SECTION_ID_LIBRARY_VERSION, -1 } },
>      [SECTION_ID_LIBRARY_VERSION] =    { SECTION_ID_LIBRARY_VERSION, "library_version", 0, { -1 } },
>      [SECTION_ID_PACKETS] =            { SECTION_ID_PACKETS, "packets", SECTION_FLAG_IS_ARRAY, { SECTION_ID_PACKET, -1} },
> @@ -1722,6 +1726,7 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
>  {
>      AVBPrint pbuf;
>      const char *s;
> +    int i;
>  
>      av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED);
>  
> @@ -1784,6 +1789,20 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
>      }
>      if (do_show_frame_tags)
>          show_tags(w, av_frame_get_metadata(frame), SECTION_ID_FRAME_TAGS);
> +    if (frame->nb_side_data) {
> +        writer_print_section_header(w, SECTION_ID_FRAME_SIDEDATA_LIST);
> +        for (i = 0; i < frame->nb_side_data; i++) {
> +            AVFrameSideData *sd = frame->side_data[i];
> +            const char *name;
> +
> +            writer_print_section_header(w, SECTION_ID_FRAME_SIDEDATA);
> +            name = av_frame_side_data_name(sd->type);
> +            print_str("side_data_type", name ? name : "unknown");
> +            print_int("side_data_size", sd->size);
> +            writer_print_section_footer(w);
> +        }
> +        writer_print_section_footer(w);
> +    }
>  
>      writer_print_section_footer(w);

LGTM otherwise, thanks.
-- 
FFmpeg = Fascinating Fundamental Maxi Philosophical Emblematic Geek


More information about the ffmpeg-devel mailing list