Commit a565c7b7 authored by Michael Niedermayer's avatar Michael Niedermayer

aiffdec:Rewrite get_meta()

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 423986fc
...@@ -68,19 +68,20 @@ static int get_tag(AVIOContext *pb, uint32_t * tag) ...@@ -68,19 +68,20 @@ static int get_tag(AVIOContext *pb, uint32_t * tag)
static void get_meta(AVFormatContext *s, const char *key, int size) static void get_meta(AVFormatContext *s, const char *key, int size)
{ {
uint8_t *str = av_malloc(size+1); uint8_t *str = av_malloc(size+1);
int res;
if (!str) { if (str) {
avio_skip(s->pb, size); int res = avio_read(s->pb, str, size);
return; if (res < 0){
} av_free(str);
return;
res = avio_read(s->pb, str, size); }
if (res < 0) size += (size&1)-res;
return; str[res] = 0;
av_metadata_set2(&s->metadata, key, str, AV_METADATA_DONT_STRDUP_VAL);
}else
size+= size&1;
str[res] = 0; avio_skip(s->pb, size);
av_metadata_set2(&s->metadata, key, str, AV_METADATA_DONT_STRDUP_VAL);
} }
/* Returns the number of sound data frames or negative on error */ /* Returns the number of sound data frames or negative on error */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment