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/wc3movie.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/wc3movie.c')
-rw-r--r-- | libavformat/wc3movie.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c index 5369057dd4..502ff52564 100644 --- a/libavformat/wc3movie.c +++ b/libavformat/wc3movie.c @@ -140,10 +140,9 @@ static int wc3_read_header(AVFormatContext *s, unsigned int fourcc_tag; unsigned int size; AVStream *st; - char buffer[513]; int ret = 0; int current_palette = 0; - int bytes_to_read; + char *buffer; int i; unsigned char rotate; @@ -185,14 +184,14 @@ static int wc3_read_header(AVFormatContext *s, case BNAM_TAG: /* load up the name */ - if ((unsigned)size < 512) - bytes_to_read = size; - else - bytes_to_read = 512; - if ((ret = get_buffer(pb, buffer, bytes_to_read)) != bytes_to_read) + buffer = av_malloc(size+1); + if (!buffer) + return AVERROR_NOMEM; + if ((ret = get_buffer(pb, buffer, size)) != size) return AVERROR(EIO); - buffer[bytes_to_read] = 0; - av_metadata_set(&s->metadata, "title", buffer); + buffer[size] = 0; + av_metadata_set2(&s->metadata, "title", buffer, + AV_METADATA_DONT_STRDUP_VAL); break; case SIZE_TAG: |