summaryrefslogtreecommitdiff
path: root/libavformat/vqf.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2009-12-13 20:27:29 +0000
committerMichael Niedermayer <michaelni@gmx.at>2009-12-13 20:27:29 +0000
commit12ad66712a18d039eea73a742ae626b2376f8f4f (patch)
treef6d863c1a428480ad0366d48c44c8b89ef53b3e3 /libavformat/vqf.c
parentb8f11ec8878641f699c07b8425079d3611a51072 (diff)
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/vqf.c')
-rw-r--r--libavformat/vqf.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/libavformat/vqf.c b/libavformat/vqf.c
index d2b48dda04..40fea47157 100644
--- a/libavformat/vqf.c
+++ b/libavformat/vqf.c
@@ -45,15 +45,18 @@ static int vqf_probe(AVProbeData *probe_packet)
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)