summaryrefslogtreecommitdiff
path: root/libavcodec/avuidec.c
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <cehoyos@ag.or.at>2012-07-25 09:26:17 +0200
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2012-07-25 09:26:17 +0200
commit20e88d86182d9bb49112648d9a42849a7b17eacd (patch)
tree62968b71a8526abd596024e128e81160d6524044 /libavcodec/avuidec.c
parent1c2beff04a661b398266a8655c6e55ab47791002 (diff)
Fix avui stream-copy.
The native decoder and MPlayer's binary decoder only need the APRG atom, QuickTime at least requires also the ARES atom and four additional 0 bytes padding at the end of stsd.
Diffstat (limited to 'libavcodec/avuidec.c')
-rw-r--r--libavcodec/avuidec.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/libavcodec/avuidec.c b/libavcodec/avuidec.c
index 32fd819ea7..41f6d9f497 100644
--- a/libavcodec/avuidec.c
+++ b/libavcodec/avuidec.c
@@ -21,6 +21,7 @@
*/
#include "avcodec.h"
+#include "libavutil/intreadwrite.h"
static av_cold int avui_decode_init(AVCodecContext *avctx)
{
@@ -40,17 +41,28 @@ static int avui_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *avpkt)
{
AVFrame *pic = avctx->coded_frame;
- const uint8_t *src = avpkt->data;
+ const uint8_t *src = avpkt->data, *extradata = avctx->extradata;
const uint8_t *srca;
uint8_t *y, *u, *v, *a;
int transparent, interlaced = 1, skip, opaque_length, i, j, k;
+ uint32_t extradata_size = avctx->extradata_size;
if (pic->data[0])
avctx->release_buffer(avctx, pic);
- if (avctx->extradata_size >= 24 &&
- !memcmp(&avctx->extradata[4], "APRGAPRG0001", 12))
- interlaced = avctx->extradata[19] != 1;
+ while (extradata_size >= 24) {
+ uint32_t atom_size = AV_RB32(extradata);
+ if (!memcmp(&extradata[4], "APRGAPRG0001", 12)) {
+ interlaced = extradata[19] != 1;
+ break;
+ }
+ if (atom_size && atom_size <= extradata_size) {
+ extradata += atom_size;
+ extradata_size -= atom_size;
+ } else {
+ break;
+ }
+ }
if (avctx->height == 486) {
skip = 10;
} else {