[FFmpeg-devel] [PATCH 1/2] Adding support for parsing BlockAdditional

Michael Niedermayer michaelni at gmx.at
Tue Feb 5 01:53:32 CET 2013


On Mon, Feb 04, 2013 at 03:17:51PM -0800, Vignesh Venkatasubramanian wrote:
> Matroska specification lists support for BlockAdditional element
> which is not supported by ffmpeg's matroska parser. This patch
> adds grammar definitions for parsing that element (and few other
> related elements) and then puts the data in AVPacket.side_data
> with new AVPacketSideDataType AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL.
> It also updates the fate test crc generator to generate frame crc
> based on both data and side_data instead of just data.
> 
> Signed-off-by: Vignesh Venkatasubramanian <vigneshv at google.com>
> ---
>  libavcodec/avcodec.h      |   8 +
>  libavformat/framecrcenc.c |   7 +-
>  libavformat/matroska.h    |   4 +
>  libavformat/matroskadec.c |  41 ++-
>  tests/fate/vpx.mak        |   3 +
>  tests/ref/fate/vp8-alpha  | 755 ++++++++++++++++++++++++++++++++++++++++++++++
>  6 files changed, 813 insertions(+), 5 deletions(-)
>  create mode 100644 tests/ref/fate/vp8-alpha
> 
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index ca7764a..2ed63e2 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -983,6 +983,14 @@ enum AVPacketSideDataType {
>       * @endcode
>       */
>      AV_PKT_DATA_SUBTITLE_POSITION,
> +
> +    /**
> +     * Data found in BlockAdditional element of matroska container. There is
> +     * no end marker for the data, so it is required to rely on the side data 
> +     * size to recognize the end. 8 byte id (as found in BlockAddId) followed 
> +     * by data.
> +     */
> +    AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
>  };
>  
>  /**

> diff --git a/libavformat/framecrcenc.c b/libavformat/framecrcenc.c
> index 8a69748..7a53f64 100644
> --- a/libavformat/framecrcenc.c
> +++ b/libavformat/framecrcenc.c
> @@ -23,12 +23,17 @@
>  #include "libavutil/avstring.h"
>  #include "avformat.h"
>  #include "internal.h"
> +#include "libavcodec/avcodec.h"
>  
>  static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt)
>  {
> -    uint32_t crc = av_adler32_update(0, pkt->data, pkt->size);
> +    uint32_t crc;
>      char buf[256];
>  
> +    av_packet_merge_side_data(pkt);
> +    crc = av_adler32_update(0, pkt->data, pkt->size);
> +    av_packet_split_side_data(pkt);
> +
>      snprintf(buf, sizeof(buf), "%d, %10"PRId64", %10"PRId64", %8d, %8d, 0x%08x",
>               pkt->stream_index, pkt->dts, pkt->pts, pkt->duration, pkt->size, crc);
>      if (pkt->flags != AV_PKT_FLAG_KEY)

I think its better to print a list of CRCs, one for each side data
element.
It could be quite helpfull when debuging, when one but not the other
changes. Also the framecrcenc change belongs into a seperate patch.

Ive also uploaded the new file, though would prefer a smaller file to
keep the whole fate suite as small and fast as possible
no big issue though, its ok as is if you think such a bigger file
provides more complete testing

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130205/cde5bb3c/attachment.asc>


More information about the ffmpeg-devel mailing list