Mercurial > libavformat.hg
diff avidec.c @ 5446:4211f91f69b1 libavformat
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.
author | michael |
---|---|
date | Sun, 13 Dec 2009 20:27:29 +0000 |
parents | a8e26981c104 |
children | 7698da6e1f0a |
line wrap: on
line diff
--- a/avidec.c Sun Dec 13 20:22:27 2009 +0000 +++ b/avidec.c Sun Dec 13 20:27:29 2009 +0000 @@ -230,14 +230,19 @@ static int avi_read_tag(AVFormatContext *s, const char *key, unsigned int size) { ByteIOContext *pb = s->pb; - uint8_t value[1024]; + char *value; - int64_t i = url_ftell(pb); size += (size & 1); - get_strz(pb, value, sizeof(value)); - url_fseek(pb, i+size, SEEK_SET); - return av_metadata_set(&s->metadata, key, value); + if (size == UINT_MAX) + return -1; + value = av_malloc(size+1); + if (!value) + return -1; + get_strz(pb, value, size); + + return av_metadata_set2(&s->metadata, key, value, + AV_METADATA_DONT_STRDUP_VAL); } static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)