From 3ea97767e49c599813d6a09c640a657d71c1a0de Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Thu, 29 Jan 2015 01:07:08 +0100 Subject: [PATCH] Add an ARES atom to extradata when encoding avui. Allows playback with QuickTime and the original codec. Tested by Olaf Matthes, olaf matthes gmx de --- libavcodec/avuienc.c | 9 +++++++-- libavcodec/version.h | 2 +- tests/ref/vsynth/vsynth1-avui | 4 ++-- tests/ref/vsynth/vsynth2-avui | 4 ++-- tests/ref/vsynth/vsynth_lena-avui | 4 ++-- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/libavcodec/avuienc.c b/libavcodec/avuienc.c index db640bb5a9..4b1b4086ec 100644 --- a/libavcodec/avuienc.c +++ b/libavcodec/avuienc.c @@ -22,6 +22,7 @@ #include "avcodec.h" #include "internal.h" +#include "libavutil/intreadwrite.h" static av_cold int avui_encode_init(AVCodecContext *avctx) { @@ -29,15 +30,19 @@ static av_cold int avui_encode_init(AVCodecContext *avctx) av_log(avctx, AV_LOG_ERROR, "Only 720x486 and 720x576 are supported.\n"); return AVERROR(EINVAL); } - if (!(avctx->extradata = av_mallocz(24 + FF_INPUT_BUFFER_PADDING_SIZE))) + if (!(avctx->extradata = av_mallocz(144 + FF_INPUT_BUFFER_PADDING_SIZE))) return AVERROR(ENOMEM); - avctx->extradata_size = 24; + avctx->extradata_size = 144; memcpy(avctx->extradata, "\0\0\0\x18""APRGAPRG0001", 16); if (avctx->field_order > AV_FIELD_PROGRESSIVE) { avctx->extradata[19] = 2; } else { avctx->extradata[19] = 1; } + memcpy(avctx->extradata + 24, "\0\0\0\x78""ARESARES0001""\0\0\0\x98", 20); + AV_WB32(avctx->extradata + 44, avctx->width); + AV_WB32(avctx->extradata + 48, avctx->height); + memcpy(avctx->extradata + 52, "\0\0\0\x1\0\0\0\x20\0\0\0\x2", 12); avctx->coded_frame = av_frame_alloc(); if (!avctx->coded_frame) { diff --git a/libavcodec/version.h b/libavcodec/version.h index dfb95e098f..3827c38f69 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -30,7 +30,7 @@ #define LIBAVCODEC_VERSION_MAJOR 56 #define LIBAVCODEC_VERSION_MINOR 21 -#define LIBAVCODEC_VERSION_MICRO 100 +#define LIBAVCODEC_VERSION_MICRO 101 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ diff --git a/tests/ref/vsynth/vsynth1-avui b/tests/ref/vsynth/vsynth1-avui index 53591e1d0a..1f080532b5 100644 --- a/tests/ref/vsynth/vsynth1-avui +++ b/tests/ref/vsynth/vsynth1-avui @@ -1,4 +1,4 @@ -87ef06cbd15934c282d4aa83e2a5cf0a *tests/data/fate/vsynth1-avui.mov -42624917 tests/data/fate/vsynth1-avui.mov +25ef49e1aee0b20d4feee89b8dc093b4 *tests/data/fate/vsynth1-avui.mov +42625037 tests/data/fate/vsynth1-avui.mov c5ccac874dbf808e9088bc3107860042 *tests/data/fate/vsynth1-avui.out.rawvideo stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth2-avui b/tests/ref/vsynth/vsynth2-avui index 1500386d34..2423916f4d 100644 --- a/tests/ref/vsynth/vsynth2-avui +++ b/tests/ref/vsynth/vsynth2-avui @@ -1,4 +1,4 @@ -4d46be4cf21d2f0dc0a857bb2603b899 *tests/data/fate/vsynth2-avui.mov -42624917 tests/data/fate/vsynth2-avui.mov +8f6ab410bb6b5dc4599e12968dbd0366 *tests/data/fate/vsynth2-avui.mov +42625037 tests/data/fate/vsynth2-avui.mov 36d7ca943916e1743cefa609eba0205c *tests/data/fate/vsynth2-avui.out.rawvideo stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth_lena-avui b/tests/ref/vsynth/vsynth_lena-avui index 02154a680b..c2fced8e6c 100644 --- a/tests/ref/vsynth/vsynth_lena-avui +++ b/tests/ref/vsynth/vsynth_lena-avui @@ -1,4 +1,4 @@ -df5efcfd2170df82e466be4deb7ce4a9 *tests/data/fate/vsynth_lena-avui.mov -42624917 tests/data/fate/vsynth_lena-avui.mov +26805e15d9e732cd24aea91ae564d5c3 *tests/data/fate/vsynth_lena-avui.mov +42625037 tests/data/fate/vsynth_lena-avui.mov dde5895817ad9d219f79a52d0bdfb001 *tests/data/fate/vsynth_lena-avui.out.rawvideo stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200