aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2010-04-16 20:36:24 +0000
committerMartin Storsjö <martin@martin.st>2010-04-16 20:36:24 +0000
commit653d7aeb616d33f78df8df8c1d4e228847594677 (patch)
treecf6d0b0c6a5649c392cf7c65e0db96a9014665d4
parent6086731299e4d249ddc459e406b2ebb0cb71f6f4 (diff)
downloadffmpeg-653d7aeb616d33f78df8df8c1d4e228847594677.tar.gz
Parse strf mov atoms
This fixes roundup issue 1270. Originally committed as revision 22894 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavformat/mov.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 0f03da1eb7..aaaa587564 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -811,6 +811,34 @@ static int mov_read_glbl(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return 0;
}
+/**
+ * An strf atom is a BITMAPINFOHEADER struct. This struct is 40 bytes itself,
+ * but can have extradata appended at the end after the 40 bytes belonging
+ * to the struct.
+ */
+static int mov_read_strf(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+{
+ AVStream *st;
+
+ if (c->fc->nb_streams < 1)
+ return 0;
+ if (atom.size <= 40)
+ return 0;
+ 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 = av_mallocz(atom.size - 40 + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (!st->codec->extradata)
+ return AVERROR(ENOMEM);
+ st->codec->extradata_size = atom.size - 40;
+ url_fskip(pb, 40);
+ get_buffer(pb, st->codec->extradata, atom.size - 40);
+ return 0;
+}
+
static int mov_read_stco(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
{
AVStream *st;
@@ -2161,6 +2189,7 @@ static const MOVParseTableEntry mov_default_parse_table[] = {
{ MKTAG('s','t','b','l'), mov_read_default },
{ MKTAG('s','t','c','o'), mov_read_stco },
{ MKTAG('s','t','p','s'), mov_read_stps },
+{ MKTAG('s','t','r','f'), mov_read_strf },
{ MKTAG('s','t','s','c'), mov_read_stsc },
{ MKTAG('s','t','s','d'), mov_read_stsd }, /* sample description */
{ MKTAG('s','t','s','s'), mov_read_stss }, /* sync sample */