Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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.
  • Loading branch information...
commit 20e88d86182d9bb49112648d9a42849a7b17eacd 1 parent 1c2beff
cehoyos cehoyos authored
20 libavcodec/avuidec.c
@@ -21,6 +21,7 @@
21 21 */
22 22
23 23 #include "avcodec.h"
  24 +#include "libavutil/intreadwrite.h"
24 25
25 26 static av_cold int avui_decode_init(AVCodecContext *avctx)
26 27 {
@@ -40,17 +41,28 @@ static int avui_decode_frame(AVCodecContext *avctx, void *data,
40 41 int *data_size, AVPacket *avpkt)
41 42 {
42 43 AVFrame *pic = avctx->coded_frame;
43   - const uint8_t *src = avpkt->data;
  44 + const uint8_t *src = avpkt->data, *extradata = avctx->extradata;
44 45 const uint8_t *srca;
45 46 uint8_t *y, *u, *v, *a;
46 47 int transparent, interlaced = 1, skip, opaque_length, i, j, k;
  48 + uint32_t extradata_size = avctx->extradata_size;
47 49
48 50 if (pic->data[0])
49 51 avctx->release_buffer(avctx, pic);
50 52
51   - if (avctx->extradata_size >= 24 &&
52   - !memcmp(&avctx->extradata[4], "APRGAPRG0001", 12))
53   - interlaced = avctx->extradata[19] != 1;
  53 + while (extradata_size >= 24) {
  54 + uint32_t atom_size = AV_RB32(extradata);
  55 + if (!memcmp(&extradata[4], "APRGAPRG0001", 12)) {
  56 + interlaced = extradata[19] != 1;
  57 + break;
  58 + }
  59 + if (atom_size && atom_size <= extradata_size) {
  60 + extradata += atom_size;
  61 + extradata_size -= atom_size;
  62 + } else {
  63 + break;
  64 + }
  65 + }
54 66 if (avctx->height == 486) {
55 67 skip = 10;
56 68 } else {
6 libavformat/mov.c
@@ -939,7 +939,7 @@ static int mov_read_jp2h(MOVContext *c, AVIOContext *pb, MOVAtom atom)
939 939 return mov_read_extradata(c, pb, atom, CODEC_ID_JPEG2000);
940 940 }
941 941
942   -static int mov_read_aprg(MOVContext *c, AVIOContext *pb, MOVAtom atom)
  942 +static int mov_read_avid(MOVContext *c, AVIOContext *pb, MOVAtom atom)
943 943 {
944 944 return mov_read_extradata(c, pb, atom, CODEC_ID_AVUI);
945 945 }
@@ -2548,7 +2548,9 @@ static int mov_read_tref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
2548 2548 }
2549 2549
2550 2550 static const MOVParseTableEntry mov_default_parse_table[] = {
2551   -{ MKTAG('A','P','R','G'), mov_read_aprg },
  2551 +{ MKTAG('A','C','L','R'), mov_read_avid },
  2552 +{ MKTAG('A','P','R','G'), mov_read_avid },
  2553 +{ MKTAG('A','R','E','S'), mov_read_avid },
2552 2554 { MKTAG('a','v','s','s'), mov_read_avss },
2553 2555 { MKTAG('c','h','p','l'), mov_read_chpl },
2554 2556 { MKTAG('c','o','6','4'), mov_read_stco },
5 libavformat/movenc.c
@@ -1072,9 +1072,10 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
1072 1072 mov_write_d263_tag(pb);
1073 1073 else if(track->enc->codec_id == CODEC_ID_SVQ3)
1074 1074 mov_write_svq3_tag(pb);
1075   - else if(track->enc->codec_id == CODEC_ID_AVUI)
  1075 + else if(track->enc->codec_id == CODEC_ID_AVUI) {
1076 1076 mov_write_extradata_tag(pb, track);
1077   - else if(track->enc->codec_id == CODEC_ID_DNXHD)
  1077 + avio_wb32(pb, 0);
  1078 + } else if(track->enc->codec_id == CODEC_ID_DNXHD)
1078 1079 mov_write_avid_tag(pb, track);
1079 1080 else if(track->enc->codec_id == CODEC_ID_H264) {
1080 1081 mov_write_avcc_tag(pb, track);

0 comments on commit 20e88d8

Please sign in to comment.
Something went wrong with that request. Please try again.