aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Melanson <mike@multimedia.cx>2004-12-09 19:44:55 +0000
committerMike Melanson <mike@multimedia.cx>2004-12-09 19:44:55 +0000
commit169eb021d03e19ee77329938f529f2d01410c23a (patch)
treeec2f372bca8377cca0f5bc4dc4eb09d45e94bb2f
parenta979965313d3c9c470950ca20852191cbe442461 (diff)
downloadffmpeg-169eb021d03e19ee77329938f529f2d01410c23a.tar.gz
load the 'avcC' atom needed for 'avc1' decoding
Originally committed as revision 3745 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavformat/mov.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 2b05b9486f..efec9d4129 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -116,6 +116,7 @@ static const CodecTag mov_video_tags[] = {
{ CODEC_ID_SMC, MKTAG('s', 'm', 'c', ' ') }, /* Apple Graphics (SMC) */
{ CODEC_ID_QTRLE, MKTAG('r', 'l', 'e', ' ') }, /* Apple Animation (RLE) */
{ CODEC_ID_QDRAW, MKTAG('q', 'd', 'r', 'w') }, /* QuickDraw */
+ { CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') }, /* AVC-1/H.264 */
{ CODEC_ID_NONE, 0 },
};
@@ -692,6 +693,23 @@ static int mov_read_smi(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
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];
+
+ av_free(st->codec.extradata);
+
+ st->codec.extradata_size = atom.size;
+ st->codec.extradata = (uint8_t*) av_mallocz(st->codec.extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
+
+ if (st->codec.extradata) {
+ get_buffer(pb, st->codec.extradata, atom.size);
+ } else
+ url_fskip(pb, atom.size);
+
+ return 0;
+}
+
static int mov_read_stco(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
{
AVStream *st = c->fc->streams[c->fc->nb_streams-1];
@@ -1481,7 +1499,8 @@ static const MOVParseTableEntry mov_default_parse_table[] = {
{ MKTAG( 's', 'd', 'h', 'd' ), mov_read_default },
{ MKTAG( 's', 'k', 'i', 'p' ), mov_read_leaf },
{ MKTAG( 's', 'm', 'h', 'd' ), mov_read_leaf }, /* sound media info header */
-{ MKTAG( 'S', 'M', 'I', ' ' ), mov_read_smi }, /* Sorrenson extension ??? */
+{ MKTAG( 'S', 'M', 'I', ' ' ), mov_read_smi }, /* Sorenson extension ??? */
+{ MKTAG( 'a', 'v', 'c', 'C' ), mov_read_avcC },
{ MKTAG( 's', 't', 'b', 'l' ), mov_read_default },
{ MKTAG( 's', 't', 'c', 'o' ), mov_read_stco },
{ MKTAG( 's', 't', 'd', 'p' ), mov_read_default },