History

avformat/mov: read reel_name metadata from tmcd atom

Mark Reid committed 12 years ago

Commit f1e626a1 parent 92a28e91 file · +20 −0Browse files

Unified · Split

libavformat/mov.c+20−0
@@ -1531,6 +1531,26 @@ static int mov_parse_stsd_data(MOVContext *c, AVIOContext *pb, · 1530 unmodified lines
15311531 st->codec->flags2 |= CODEC_FLAG2_DROP_FRAME_TIMECODE;
15321532 st->codec->time_base.den = st->codec->extradata[16]; /* number of frame */
15331533 st->codec->time_base.num = 1;
1534+ if (size > 30) {
1535+ uint32_t len = AV_RB32(st->codec->extradata + 18); /* name atom length */
1536+ uint32_t format = AV_RB32(st->codec->extradata + 22);
1537+ if (format == AV_RB32("name") && (int64_t)size >= (int64_t)len + 18) {
1538+ uint16_t str_size = AV_RB16(st->codec->extradata + 26); /* string length */
1539+ if (str_size > 0 && size >= (int)str_size + 26) {
1540+ char *reel_name = av_malloc(str_size + 1);
1541+ if (!reel_name)
1542+ return AVERROR(ENOMEM);
1543+ memcpy(reel_name, st->codec->extradata + 30, str_size);
1544+ reel_name[str_size] = 0; /* Add null terminator */
1545+ /* don't add reel_name if emtpy string */
1546+ if (*reel_name == 0) {
1547+ av_free(reel_name);
1548+ } else {
1549+ av_dict_set(&st->metadata, "reel_name", reel_name, AV_DICT_DONT_STRDUP_VAL);
1550+ }
1551+ }
1552+ }
1553+ }
15341554 }
15351555 } else {
15361556 /* other codec type, just skip (rtp, mp4s ...) */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t