diff options
author | Mark Reid <mindmark@gmail.com> | 2014-08-07 10:20:36 -0700 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-08-07 23:37:55 +0200 |
commit | f1e626a3570c8367e096e655660a2f7be5673a86 (patch) | |
tree | 873ee86b2eef54f10bf1198eec9ef77ff0565b47 /libavformat/mov.c | |
parent | 92a28e9f562124732fa27f0c62118f15a6fee239 (diff) | |
download | ffmpeg-f1e626a3570c8367e096e655660a2f7be5673a86.tar.gz |
avformat/mov: read reel_name metadata from tmcd atom
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r-- | libavformat/mov.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index 57977f3772..6c6d2661ec 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1531,6 +1531,26 @@ static int mov_parse_stsd_data(MOVContext *c, AVIOContext *pb, st->codec->flags2 |= CODEC_FLAG2_DROP_FRAME_TIMECODE; st->codec->time_base.den = st->codec->extradata[16]; /* number of frame */ st->codec->time_base.num = 1; + if (size > 30) { + uint32_t len = AV_RB32(st->codec->extradata + 18); /* name atom length */ + uint32_t format = AV_RB32(st->codec->extradata + 22); + if (format == AV_RB32("name") && (int64_t)size >= (int64_t)len + 18) { + uint16_t str_size = AV_RB16(st->codec->extradata + 26); /* string length */ + if (str_size > 0 && size >= (int)str_size + 26) { + char *reel_name = av_malloc(str_size + 1); + if (!reel_name) + return AVERROR(ENOMEM); + memcpy(reel_name, st->codec->extradata + 30, str_size); + reel_name[str_size] = 0; /* Add null terminator */ + /* don't add reel_name if emtpy string */ + if (*reel_name == 0) { + av_free(reel_name); + } else { + av_dict_set(&st->metadata, "reel_name", reel_name, AV_DICT_DONT_STRDUP_VAL); + } + } + } + } } } else { /* other codec type, just skip (rtp, mp4s ...) */ |