Commit 20e88d86 authored by Carl Eugen Hoyos's avatar Carl Eugen Hoyos

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.
parent 1c2beff0
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
*/ */
#include "avcodec.h" #include "avcodec.h"
#include "libavutil/intreadwrite.h"
static av_cold int avui_decode_init(AVCodecContext *avctx) static av_cold int avui_decode_init(AVCodecContext *avctx)
{ {
...@@ -40,17 +41,28 @@ static int avui_decode_frame(AVCodecContext *avctx, void *data, ...@@ -40,17 +41,28 @@ static int avui_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *avpkt) int *data_size, AVPacket *avpkt)
{ {
AVFrame *pic = avctx->coded_frame; AVFrame *pic = avctx->coded_frame;
const uint8_t *src = avpkt->data; const uint8_t *src = avpkt->data, *extradata = avctx->extradata;
const uint8_t *srca; const uint8_t *srca;
uint8_t *y, *u, *v, *a; uint8_t *y, *u, *v, *a;
int transparent, interlaced = 1, skip, opaque_length, i, j, k; int transparent, interlaced = 1, skip, opaque_length, i, j, k;
uint32_t extradata_size = avctx->extradata_size;
if (pic->data[0]) if (pic->data[0])
avctx->release_buffer(avctx, pic); avctx->release_buffer(avctx, pic);
if (avctx->extradata_size >= 24 && while (extradata_size >= 24) {
!memcmp(&avctx->extradata[4], "APRGAPRG0001", 12)) uint32_t atom_size = AV_RB32(extradata);
interlaced = avctx->extradata[19] != 1; 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) { if (avctx->height == 486) {
skip = 10; skip = 10;
} else { } else {
......
...@@ -939,7 +939,7 @@ static int mov_read_jp2h(MOVContext *c, AVIOContext *pb, MOVAtom atom) ...@@ -939,7 +939,7 @@ static int mov_read_jp2h(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return mov_read_extradata(c, pb, atom, CODEC_ID_JPEG2000); return mov_read_extradata(c, pb, atom, CODEC_ID_JPEG2000);
} }
static int mov_read_aprg(MOVContext *c, AVIOContext *pb, MOVAtom atom) static int mov_read_avid(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
return mov_read_extradata(c, pb, atom, CODEC_ID_AVUI); return mov_read_extradata(c, pb, atom, CODEC_ID_AVUI);
} }
...@@ -2548,7 +2548,9 @@ static int mov_read_tref(MOVContext *c, AVIOContext *pb, MOVAtom atom) ...@@ -2548,7 +2548,9 @@ static int mov_read_tref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
} }
static const MOVParseTableEntry mov_default_parse_table[] = { static const MOVParseTableEntry mov_default_parse_table[] = {
{ MKTAG('A','P','R','G'), mov_read_aprg }, { MKTAG('A','C','L','R'), mov_read_avid },
{ MKTAG('A','P','R','G'), mov_read_avid },
{ MKTAG('A','R','E','S'), mov_read_avid },
{ MKTAG('a','v','s','s'), mov_read_avss }, { MKTAG('a','v','s','s'), mov_read_avss },
{ MKTAG('c','h','p','l'), mov_read_chpl }, { MKTAG('c','h','p','l'), mov_read_chpl },
{ MKTAG('c','o','6','4'), mov_read_stco }, { MKTAG('c','o','6','4'), mov_read_stco },
......
...@@ -1072,9 +1072,10 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track) ...@@ -1072,9 +1072,10 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
mov_write_d263_tag(pb); mov_write_d263_tag(pb);
else if(track->enc->codec_id == CODEC_ID_SVQ3) else if(track->enc->codec_id == CODEC_ID_SVQ3)
mov_write_svq3_tag(pb); mov_write_svq3_tag(pb);
else if(track->enc->codec_id == CODEC_ID_AVUI) else if(track->enc->codec_id == CODEC_ID_AVUI) {
mov_write_extradata_tag(pb, track); mov_write_extradata_tag(pb, track);
else if(track->enc->codec_id == CODEC_ID_DNXHD) avio_wb32(pb, 0);
} else if(track->enc->codec_id == CODEC_ID_DNXHD)
mov_write_avid_tag(pb, track); mov_write_avid_tag(pb, track);
else if(track->enc->codec_id == CODEC_ID_H264) { else if(track->enc->codec_id == CODEC_ID_H264) {
mov_write_avcc_tag(pb, track); mov_write_avcc_tag(pb, track);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment