diff options
Diffstat (limited to 'libavformat/aiffdec.c')
-rw-r--r-- | libavformat/aiffdec.c | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c index b3cbc112ca..239fca3452 100644 --- a/libavformat/aiffdec.c +++ b/libavformat/aiffdec.c @@ -2,20 +2,20 @@ * AIFF/AIFF-C demuxer * Copyright (c) 2006 Patrick Guimond * - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * Libav is distributed in the hope that it will be useful, + * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -25,6 +25,7 @@ #include "internal.h" #include "pcm.h" #include "aiff.h" +#include "isom.h" #define AIFF 0 #define AIFF_C_VERSION1 0xA2805140 @@ -53,7 +54,7 @@ static int get_tag(AVIOContext *pb, uint32_t * tag) { int size; - if (pb->eof_reached) + if (url_feof(pb)) return AVERROR(EIO); *tag = avio_rl32(pb); @@ -69,19 +70,20 @@ static int get_tag(AVIOContext *pb, uint32_t * tag) static void get_meta(AVFormatContext *s, const char *key, int size) { uint8_t *str = av_malloc(size+1); - int res; - if (!str) { - avio_skip(s->pb, size); - return; - } - - res = avio_read(s->pb, str, size); - if (res < 0) - return; + if (str) { + int res = avio_read(s->pb, str, size); + if (res < 0){ + av_free(str); + return; + } + size += (size&1)-res; + str[res] = 0; + av_dict_set(&s->metadata, key, str, AV_DICT_DONT_STRDUP_VAL); + }else + size+= size&1; - str[res] = 0; - av_dict_set(&s->metadata, key, str, AV_DICT_DONT_STRDUP_VAL); + avio_skip(s->pb, size); } /* Returns the number of sound data frames or negative on error */ @@ -256,6 +258,11 @@ static int aiff_read_header(AVFormatContext *s) st->codec->extradata_size = size; avio_read(pb, st->codec->extradata, size); break; + case MKTAG('C','H','A','N'): + if (size < 12) + return AVERROR_INVALIDDATA; + ff_mov_read_chan(s, size, st->codec); + break; default: /* Jump */ if (size & 1) /* Always even aligned */ size++; |