Mercurial > libavformat.hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
5445:d1b5bb2bfe92 | 5446:4211f91f69b1 |
---|---|
228 } | 228 } |
229 | 229 |
230 static int avi_read_tag(AVFormatContext *s, const char *key, unsigned int size) | 230 static int avi_read_tag(AVFormatContext *s, const char *key, unsigned int size) |
231 { | 231 { |
232 ByteIOContext *pb = s->pb; | 232 ByteIOContext *pb = s->pb; |
233 uint8_t value[1024]; | 233 char *value; |
234 | 234 |
235 int64_t i = url_ftell(pb); | |
236 size += (size & 1); | 235 size += (size & 1); |
237 get_strz(pb, value, sizeof(value)); | 236 |
238 url_fseek(pb, i+size, SEEK_SET); | 237 if (size == UINT_MAX) |
239 | 238 return -1; |
240 return av_metadata_set(&s->metadata, key, value); | 239 value = av_malloc(size+1); |
240 if (!value) | |
241 return -1; | |
242 get_strz(pb, value, size); | |
243 | |
244 return av_metadata_set2(&s->metadata, key, value, | |
245 AV_METADATA_DONT_STRDUP_VAL); | |
241 } | 246 } |
242 | 247 |
243 static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) | 248 static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) |
244 { | 249 { |
245 AVIContext *avi = s->priv_data; | 250 AVIContext *avi = s->priv_data; |