diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2009-12-13 20:27:29 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2009-12-13 20:27:29 +0000 |
commit | 12ad66712a18d039eea73a742ae626b2376f8f4f (patch) | |
tree | f6d863c1a428480ad0366d48c44c8b89ef53b3e3 /libavformat/aiffdec.c | |
parent | b8f11ec8878641f699c07b8425079d3611a51072 (diff) | |
download | ffmpeg-12ad66712a18d039eea73a742ae626b2376f8f4f.tar.gz |
Use AV_METADATA_DONT_STRDUP* / use av_malloced metadata instead of strduped
arrays of fixed length.
Code from ffmbc with changes to adapt to our metadata API.
Originally committed as revision 20836 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/aiffdec.c')
-rw-r--r-- | libavformat/aiffdec.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c index 60c44ea5e8..a56bb0911d 100644 --- a/libavformat/aiffdec.c +++ b/libavformat/aiffdec.c @@ -66,19 +66,20 @@ static int get_tag(ByteIOContext *pb, uint32_t * tag) /* Metadata string read */ static void get_meta(AVFormatContext *s, const char *key, int size) { - uint8_t str[1024]; - int res = get_buffer(s->pb, str, FFMIN(sizeof(str)-1, size)); + uint8_t *str = av_malloc(size+1); + int res; + + if (!str) { + url_fskip(s->pb, size); + return; + } + + res = get_buffer(s->pb, str, size); if (res < 0) return; str[res] = 0; - if (size & 1) - size++; - size -= res; - if (size) - url_fskip(s->pb, size); - - av_metadata_set(&s->metadata, key, str); + av_metadata_set2(&s->metadata, key, str, AV_METADATA_DONT_STRDUP_VAL); } /* Returns the number of sound data frames or negative on error */ |