summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>2007-03-02 12:12:29 +0000
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>2007-03-02 12:12:29 +0000
commit014a51028250b9e3c6674284a44bda4c9ba07ee0 (patch)
tree1fe4d3082ad928b8cfd7e97287df80f390790583
parent2f6547fb44e24c839857d2a8123335779ef4cccd (diff)
use generic atom to extradata reading function
Originally committed as revision 8191 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavformat/mov.c42
1 files changed, 9 insertions, 33 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index db408fe6a0..029199d37d 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -647,21 +647,18 @@ static int mov_read_enda(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
return 0;
}
-static int mov_read_alac(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
+/* FIXME modify qdm2/svq3/h264 decoders to take full atom as extradata */
+static int mov_read_extradata(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
{
AVStream *st = c->fc->streams[c->fc->nb_streams-1];
-
- // currently ALAC decoder expect full atom header - so let's fake it
- // this should be fixed and just ALAC header should be passed
-
+ if((uint64_t)atom.size > (1<<30))
+ return -1;
av_free(st->codec->extradata);
- st->codec->extradata_size = 36;
+ st->codec->extradata_size = atom.size + 8;
st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
-
if (st->codec->extradata) {
- memcpy(st->codec->extradata + 4, "alac", 4); // fake
- get_buffer(pb, st->codec->extradata + 8, 36 - 8);
- dprintf("Reading alac %d %s\n", st->codec->extradata_size, st->codec->extradata);
+ AV_WL32(st->codec->extradata + 4, atom.type);
+ get_buffer(pb, st->codec->extradata + 8, atom.size);
} else
url_fskip(pb, atom.size);
return 0;
@@ -691,27 +688,6 @@ static int mov_read_wave(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
return 0;
}
-static int mov_read_jp2h(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
-{
- AVStream *st = c->fc->streams[c->fc->nb_streams-1];
-
- if((uint64_t)atom.size > (1<<30))
- return -1;
-
- av_free(st->codec->extradata);
-
- st->codec->extradata_size = atom.size + 8;
- st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
-
- /* pass all jp2h atom to codec */
- if (st->codec->extradata) {
- memcpy(st->codec->extradata + 4, "jp2h", 4);
- get_buffer(pb, st->codec->extradata + 8, atom.size);
- } else
- url_fskip(pb, atom.size);
- return 0;
-}
-
static int mov_read_avcC(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
{
AVStream *st = c->fc->streams[c->fc->nb_streams-1];
@@ -1392,7 +1368,7 @@ static const MOVParseTableEntry mov_default_parse_table[] = {
{ MKTAG( 'e', 'n', 'd', 'a' ), mov_read_enda },
{ MKTAG( 'f', 't', 'y', 'p' ), mov_read_ftyp },
{ MKTAG( 'h', 'd', 'l', 'r' ), mov_read_hdlr },
-{ MKTAG( 'j', 'p', '2', 'h' ), mov_read_jp2h },
+{ MKTAG( 'j', 'p', '2', 'h' ), mov_read_extradata },
{ MKTAG( 'm', 'd', 'a', 't' ), mov_read_mdat },
{ MKTAG( 'm', 'd', 'h', 'd' ), mov_read_mdhd },
{ MKTAG( 'm', 'd', 'i', 'a' ), mov_read_default },
@@ -1400,7 +1376,7 @@ static const MOVParseTableEntry mov_default_parse_table[] = {
{ MKTAG( 'm', 'o', 'o', 'v' ), mov_read_moov },
{ MKTAG( 'm', 'v', 'h', 'd' ), mov_read_mvhd },
{ MKTAG( 'S', 'M', 'I', ' ' ), mov_read_smi }, /* Sorenson extension ??? */
-{ MKTAG( 'a', 'l', 'a', 'c' ), mov_read_alac }, /* alac specific atom */
+{ MKTAG( 'a', 'l', 'a', 'c' ), mov_read_extradata }, /* alac specific atom */
{ MKTAG( 'a', 'v', 'c', 'C' ), mov_read_avcC },
{ MKTAG( 's', 't', 'b', 'l' ), mov_read_default },
{ MKTAG( 's', 't', 'c', 'o' ), mov_read_stco },