Mercurial > libavformat.hg
diff vqf.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 | 1f87eacc3c32 |
children | 536e5527c1e0 |
line wrap: on
line diff
--- a/vqf.c Sun Dec 13 20:22:27 2009 +0000 +++ b/vqf.c Sun Dec 13 20:27:29 2009 +0000 @@ -45,15 +45,18 @@ static void add_metadata(AVFormatContext *s, const char *tag, unsigned int tag_len, unsigned int remaining) { - char buf[2048]; - int len = FFMIN3(tag_len, remaining, sizeof(buf) - 1); + int len = FFMIN(tag_len, remaining); + char *buf; - if (len != tag_len) - av_log(s, AV_LOG_ERROR, "Warning: truncating metadata!\n"); + if (len == UINT_MAX) + return; + buf = av_malloc(len+1); + if (!buf) + return; get_buffer(s->pb, buf, len); buf[len] = 0; - av_metadata_set(&s->metadata, tag, buf); + av_metadata_set2(&s->metadata, tag, buf, AV_METADATA_DONT_STRDUP_VAL); } static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap)