Commit 38aeab3b authored by bcoudurier's avatar bcoudurier

use generic atom to extradata reading function

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@8191 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 2934d1bf
...@@ -647,21 +647,18 @@ static int mov_read_enda(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) ...@@ -647,21 +647,18 @@ static int mov_read_enda(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
return 0; 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]; AVStream *st = c->fc->streams[c->fc->nb_streams-1];
if((uint64_t)atom.size > (1<<30))
// currently ALAC decoder expect full atom header - so let's fake it return -1;
// this should be fixed and just ALAC header should be passed
av_free(st->codec->extradata); 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); st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
if (st->codec->extradata) { if (st->codec->extradata) {
memcpy(st->codec->extradata + 4, "alac", 4); // fake AV_WL32(st->codec->extradata + 4, atom.type);
get_buffer(pb, st->codec->extradata + 8, 36 - 8); get_buffer(pb, st->codec->extradata + 8, atom.size);
dprintf("Reading alac %d %s\n", st->codec->extradata_size, st->codec->extradata);
} else } else
url_fskip(pb, atom.size); url_fskip(pb, atom.size);
return 0; return 0;
...@@ -691,27 +688,6 @@ static int mov_read_wave(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) ...@@ -691,27 +688,6 @@ static int mov_read_wave(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
return 0; 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) static int mov_read_avcC(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
{ {
AVStream *st = c->fc->streams[c->fc->nb_streams-1]; AVStream *st = c->fc->streams[c->fc->nb_streams-1];
...@@ -1392,7 +1368,7 @@ static const MOVParseTableEntry mov_default_parse_table[] = { ...@@ -1392,7 +1368,7 @@ static const MOVParseTableEntry mov_default_parse_table[] = {
{ MKTAG( 'e', 'n', 'd', 'a' ), mov_read_enda }, { MKTAG( 'e', 'n', 'd', 'a' ), mov_read_enda },
{ MKTAG( 'f', 't', 'y', 'p' ), mov_read_ftyp }, { MKTAG( 'f', 't', 'y', 'p' ), mov_read_ftyp },
{ MKTAG( 'h', 'd', 'l', 'r' ), mov_read_hdlr }, { 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', 'a', 't' ), mov_read_mdat },
{ MKTAG( 'm', 'd', 'h', 'd' ), mov_read_mdhd }, { MKTAG( 'm', 'd', 'h', 'd' ), mov_read_mdhd },
{ MKTAG( 'm', 'd', 'i', 'a' ), mov_read_default }, { MKTAG( 'm', 'd', 'i', 'a' ), mov_read_default },
...@@ -1400,7 +1376,7 @@ static const MOVParseTableEntry mov_default_parse_table[] = { ...@@ -1400,7 +1376,7 @@ static const MOVParseTableEntry mov_default_parse_table[] = {
{ MKTAG( 'm', 'o', 'o', 'v' ), mov_read_moov }, { MKTAG( 'm', 'o', 'o', 'v' ), mov_read_moov },
{ MKTAG( 'm', 'v', 'h', 'd' ), mov_read_mvhd }, { MKTAG( 'm', 'v', 'h', 'd' ), mov_read_mvhd },
{ MKTAG( 'S', 'M', 'I', ' ' ), mov_read_smi }, /* Sorenson extension ??? */ { 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( 'a', 'v', 'c', 'C' ), mov_read_avcC },
{ MKTAG( 's', 't', 'b', 'l' ), mov_read_default }, { MKTAG( 's', 't', 'b', 'l' ), mov_read_default },
{ MKTAG( 's', 't', 'c', 'o' ), mov_read_stco }, { MKTAG( 's', 't', 'c', 'o' ), mov_read_stco },
......
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