[FFmpeg-devel] [PATCH 1/2] Support parsing of BlockAdditional data in Matroska
Vignesh Venkatasubramanian
vigneshv at google.com
Wed Jan 30 00:24:18 CET 2013
Attaching the media file used for the fate test.
On Tue, Jan 29, 2013 at 2:56 PM, Vignesh Venkatasubramanian
<vigneshv at google.com> wrote:
> Adds Ebml grammar definitions according to matroska specification for
> parsing data in BlockAdditional element. Matroska Spec of
> BlockAdditional: http://goo.gl/aFSl5
>
> Signed-off-by: Vignesh Venkatasubramanian <vigneshv at google.com>
> ---
> libavformat/matroska.h | 3 ++
> libavformat/matroskadec.c | 15 +++++-
> tests/fate/vpx.mak | 3 ++
> tests/ref/fate/vp8-alpha | 121 ++++++++++++++++++++++++++++++++++++++++++++++
> 4 files changed, 141 insertions(+), 1 deletion(-)
> create mode 100644 tests/ref/fate/vp8-alpha
>
> diff --git a/libavformat/matroska.h b/libavformat/matroska.h
> index 8411633..8250e0f 100644
> --- a/libavformat/matroska.h
> +++ b/libavformat/matroska.h
> @@ -175,6 +175,9 @@
> #define MATROSKA_ID_CLUSTERPOSITION 0xA7
> #define MATROSKA_ID_CLUSTERPREVSIZE 0xAB
> #define MATROSKA_ID_BLOCKGROUP 0xA0
> +#define MATROSKA_ID_BLOCKADDITIONS 0x75A1
> +#define MATROSKA_ID_BLOCKMORE 0xA6
> +#define MATROSKA_ID_BLOCKADDITIONAL 0xA5
> #define MATROSKA_ID_SIMPLEBLOCK 0xA3
>
> /* IDs in the blockgroup master */
> diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> index 1a15558..8b6b8d0 100644
> --- a/libavformat/matroskadec.c
> +++ b/libavformat/matroskadec.c
> @@ -163,6 +163,7 @@ typedef struct {
> AVStream *stream;
> int64_t end_timecode;
> int ms_compat;
> + int max_block_additional_id;
> } MatroskaTrack;
>
> typedef struct {
> @@ -279,6 +280,7 @@ typedef struct {
> int64_t reference;
> uint64_t non_simple;
> EbmlBin bin;
> + EbmlBin additional;
> } MatroskaBlock;
>
> static EbmlSyntax ebml_header[] = {
> @@ -385,6 +387,7 @@ static EbmlSyntax matroska_track[] = {
> { MATROSKA_ID_TRACKAUDIO, EBML_NEST, 0, offsetof(MatroskaTrack,audio), {.n=matroska_track_audio} },
> { MATROSKA_ID_TRACKOPERATION, EBML_NEST, 0, offsetof(MatroskaTrack,operation), {.n=matroska_track_operation} },
> { MATROSKA_ID_TRACKCONTENTENCODINGS,EBML_NEST, 0, 0, {.n=matroska_track_encodings} },
> + { MATROSKA_ID_TRACKMAXBLKADDID, EBML_UINT, 0, offsetof(MatroskaTrack,max_block_additional_id) },
> { MATROSKA_ID_TRACKFLAGENABLED, EBML_NONE },
> { MATROSKA_ID_TRACKFLAGLACING, EBML_NONE },
> { MATROSKA_ID_CODECNAME, EBML_NONE },
> @@ -393,7 +396,6 @@ static EbmlSyntax matroska_track[] = {
> { MATROSKA_ID_CODECDOWNLOADURL, EBML_NONE },
> { MATROSKA_ID_TRACKMINCACHE, EBML_NONE },
> { MATROSKA_ID_TRACKMAXCACHE, EBML_NONE },
> - { MATROSKA_ID_TRACKMAXBLKADDID, EBML_NONE },
> { 0 }
> };
>
> @@ -524,8 +526,19 @@ static EbmlSyntax matroska_segments[] = {
> { 0 }
> };
>
> +static EbmlSyntax matroska_blockmore[] = {
> + { MATROSKA_ID_BLOCKADDITIONAL, EBML_BIN, 0, offsetof(MatroskaBlock,additional) },
> + { 0 }
> +};
> +
> +static EbmlSyntax matroska_blockadditions[] = {
> + { MATROSKA_ID_BLOCKMORE, EBML_NEST, 0, 0, {.n=matroska_blockmore} },
> + { 0 }
> +};
> +
> static EbmlSyntax matroska_blockgroup[] = {
> { MATROSKA_ID_BLOCK, EBML_BIN, 0, offsetof(MatroskaBlock,bin) },
> + { MATROSKA_ID_BLOCKADDITIONS, EBML_NEST, 0, 0, {.n=matroska_blockadditions} },
> { MATROSKA_ID_SIMPLEBLOCK, EBML_BIN, 0, offsetof(MatroskaBlock,bin) },
> { MATROSKA_ID_BLOCKDURATION, EBML_UINT, 0, offsetof(MatroskaBlock,duration) },
> { MATROSKA_ID_BLOCKREFERENCE, EBML_UINT, 0, offsetof(MatroskaBlock,reference) },
> diff --git a/tests/fate/vpx.mak b/tests/fate/vpx.mak
> index a51ef07..1c6dce0 100644
> --- a/tests/fate/vpx.mak
> +++ b/tests/fate/vpx.mak
> @@ -22,6 +22,9 @@ fate-vp6a: CMD = framecrc -i $(SAMPLES)/flash-vp6/300x180-Scr-f8-056alpha.flv
> FATE_VP6-$(call DEMDEC, FLV, VP6F) += fate-vp6f
> fate-vp6f: CMD = framecrc -i $(SAMPLES)/flash-vp6/clip1024.flv
>
> +FATE_VP8-$(call DEMDEC, FLV, VP8) += fate-vp8-alpha
> +fate-vp8-alpha: CMD = framecrc -i $(SAMPLES)/vp8_alpha/vp8_video_with_alpha.webm
> +
> FATE_SAMPLES_AVCONV += $(FATE_VP6-yes)
> fate-vp6: $(FATE_VP6-yes)
>
> diff --git a/tests/ref/fate/vp8-alpha b/tests/ref/fate/vp8-alpha
> new file mode 100644
> index 0000000..03e0308
> --- /dev/null
> +++ b/tests/ref/fate/vp8-alpha
> @@ -0,0 +1,121 @@
> +#tb 0: 1/30
> +0, 0, 0, 1, 102400, 0xc052645d
> +0, 1, 1, 1, 102400, 0x22e9accc
> +0, 2, 2, 1, 102400, 0xc846f425
> +0, 3, 3, 1, 102400, 0x1ecd1495
> +0, 4, 4, 1, 102400, 0x9c27f587
> +0, 5, 5, 1, 102400, 0x63909393
> +0, 6, 6, 1, 102400, 0xd8cda9eb
> +0, 7, 7, 1, 102400, 0xb5d87818
> +0, 8, 8, 1, 102400, 0x0a46b317
> +0, 9, 9, 1, 102400, 0x5d25b984
> +0, 10, 10, 1, 102400, 0x37a2c70e
> +0, 11, 11, 1, 102400, 0xf58ccf81
> +0, 12, 12, 1, 102400, 0xc48cd6a3
> +0, 13, 13, 1, 102400, 0x7fa3e225
> +0, 14, 14, 1, 102400, 0x95820b00
> +0, 15, 15, 1, 102400, 0xb652e7ff
> +0, 16, 16, 1, 102400, 0x7efce71e
> +0, 17, 17, 1, 102400, 0x05aeeba0
> +0, 18, 18, 1, 102400, 0xf7b4f364
> +0, 19, 19, 1, 102400, 0xe65ef01b
> +0, 20, 20, 1, 102400, 0x9ea4eccf
> +0, 21, 21, 1, 102400, 0xd8ade06b
> +0, 22, 22, 1, 102400, 0x0e6de0d1
> +0, 23, 23, 1, 102400, 0x7205d977
> +0, 24, 24, 1, 102400, 0xe677d3a0
> +0, 25, 25, 1, 102400, 0xc94dd73d
> +0, 26, 26, 1, 102400, 0xc6f6d436
> +0, 27, 27, 1, 102400, 0x7780d7e2
> +0, 28, 28, 1, 102400, 0x8f4ad43d
> +0, 29, 29, 1, 102400, 0xc44bda0b
> +0, 30, 30, 1, 102400, 0x6469e963
> +0, 31, 31, 1, 102400, 0x0260f0a4
> +0, 32, 32, 1, 102400, 0xf598fa4d
> +0, 33, 33, 1, 102400, 0x573104b4
> +0, 34, 34, 1, 102400, 0x47d41026
> +0, 35, 35, 1, 102400, 0x85a51a5b
> +0, 36, 36, 1, 102400, 0x3f291595
> +0, 37, 37, 1, 102400, 0x513b0f7a
> +0, 38, 38, 1, 102400, 0x20540631
> +0, 39, 39, 1, 102400, 0x6acffb4f
> +0, 40, 40, 1, 102400, 0x70e4f2db
> +0, 41, 41, 1, 102400, 0x7220ed20
> +0, 42, 42, 1, 102400, 0x4885df38
> +0, 43, 43, 1, 102400, 0x5a52e3ca
> +0, 44, 44, 1, 102400, 0x4e7ce27e
> +0, 45, 45, 1, 102400, 0x75f8f6cc
> +0, 46, 46, 1, 102400, 0xd31d0fbb
> +0, 47, 47, 1, 102400, 0xcac51728
> +0, 48, 48, 1, 102400, 0xac0f1294
> +0, 49, 49, 1, 102400, 0x09821830
> +0, 50, 50, 1, 102400, 0xd4c31924
> +0, 51, 51, 1, 102400, 0xee0915fe
> +0, 52, 52, 1, 102400, 0x644a123f
> +0, 53, 53, 1, 102400, 0x88600902
> +0, 54, 54, 1, 102400, 0x9124024d
> +0, 55, 55, 1, 102400, 0x73970121
> +0, 56, 56, 1, 102400, 0x1ed105e4
> +0, 57, 57, 1, 102400, 0x437d0835
> +0, 58, 58, 1, 102400, 0xe1bd0857
> +0, 59, 59, 1, 102400, 0xfd340abf
> +0, 60, 60, 1, 102400, 0x7235467b
> +0, 61, 61, 1, 102400, 0xa8c54abc
> +0, 62, 62, 1, 102400, 0xb9ca4ba8
> +0, 63, 63, 1, 102400, 0xd7d2534f
> +0, 64, 64, 1, 102400, 0x6aaa5735
> +0, 65, 65, 1, 102400, 0x7c6a573b
> +0, 66, 66, 1, 102400, 0x39bf5bbd
> +0, 67, 67, 1, 102400, 0xde985524
> +0, 68, 68, 1, 102400, 0xc5e059c6
> +0, 69, 69, 1, 102400, 0x585a5da3
> +0, 70, 70, 1, 102400, 0x38df6bdf
> +0, 71, 71, 1, 102400, 0xcc386392
> +0, 72, 72, 1, 102400, 0x893f6164
> +0, 73, 73, 1, 102400, 0x84a95ce7
> +0, 74, 74, 1, 102400, 0xd77f63b9
> +0, 75, 75, 1, 102400, 0x6cd27d84
> +0, 76, 76, 1, 102400, 0xf28894f2
> +0, 77, 77, 1, 102400, 0xdc04aac0
> +0, 78, 78, 1, 102400, 0xd21cbd52
> +0, 79, 79, 1, 102400, 0x19fdc690
> +0, 80, 80, 1, 102400, 0x9c43d59d
> +0, 81, 81, 1, 102400, 0x16cad856
> +0, 82, 82, 1, 102400, 0xe846e320
> +0, 83, 83, 1, 102400, 0xe83cf08c
> +0, 84, 84, 1, 102400, 0x0e74f10f
> +0, 85, 85, 1, 102400, 0x3e79f8c2
> +0, 86, 86, 1, 102400, 0xfa4a053c
> +0, 87, 87, 1, 102400, 0xd33816bd
> +0, 88, 88, 1, 102400, 0x1a272119
> +0, 89, 89, 1, 102400, 0x89be265e
> +0, 90, 90, 1, 102400, 0x91d63378
> +0, 91, 91, 1, 102400, 0x83634069
> +0, 92, 92, 1, 102400, 0x12184ee1
> +0, 93, 93, 1, 102400, 0x81f26027
> +0, 94, 94, 1, 102400, 0x4612733e
> +0, 95, 95, 1, 102400, 0x2a928561
> +0, 96, 96, 1, 102400, 0x20539788
> +0, 97, 97, 1, 102400, 0x87dbae59
> +0, 98, 98, 1, 102400, 0xccacbeff
> +0, 99, 99, 1, 102400, 0x5d4cc67e
> +0, 100, 100, 1, 102400, 0xe85ac89c
> +0, 101, 101, 1, 102400, 0xf4a8cd88
> +0, 102, 102, 1, 102400, 0xc28ed257
> +0, 103, 103, 1, 102400, 0x820dd62e
> +0, 104, 104, 1, 102400, 0xc6f3ce7c
> +0, 105, 105, 1, 102400, 0x4ea3c642
> +0, 106, 106, 1, 102400, 0xedc0c8b0
> +0, 107, 107, 1, 102400, 0x87f1c4fd
> +0, 108, 108, 1, 102400, 0x82f7c6f2
> +0, 109, 109, 1, 102400, 0x3236cd9b
> +0, 110, 110, 1, 102400, 0xa45dd8d8
> +0, 111, 111, 1, 102400, 0x8ccae71d
> +0, 112, 112, 1, 102400, 0x72a3ed5a
> +0, 113, 113, 1, 102400, 0x423df7d3
> +0, 114, 114, 1, 102400, 0x07f9f74e
> +0, 115, 115, 1, 102400, 0x78fdec61
> +0, 116, 116, 1, 102400, 0x2822e5e9
> +0, 117, 117, 1, 102400, 0x2897de01
> +0, 118, 118, 1, 102400, 0x2ee9d05b
> +0, 119, 119, 1, 102400, 0xaf21d4f5
> --
> 1.8.1
>
--
Vignesh V | Software Engineer | vigneshv at google.com | 650-861-1330
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vp8_video_with_alpha.webm
Type: application/octet-stream
Size: 236739 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130129/d5e256d8/attachment.obj>
More information about the ffmpeg-devel
mailing list