diff options
Diffstat (limited to 'libavcodec/tak.c')
-rw-r--r-- | libavcodec/tak.c | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/libavcodec/tak.c b/libavcodec/tak.c index 867a84bc71..92dc44c2cd 100644 --- a/libavcodec/tak.c +++ b/libavcodec/tak.c @@ -2,20 +2,20 @@ * TAK common code * Copyright (c) 2012 Paul B Mahol * - * 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 */ @@ -24,6 +24,28 @@ #include "libavutil/intreadwrite.h" #include "tak.h" +static const int64_t tak_channel_layouts[] = { + 0, + AV_CH_FRONT_LEFT, + AV_CH_FRONT_RIGHT, + AV_CH_FRONT_CENTER, + AV_CH_LOW_FREQUENCY, + AV_CH_BACK_LEFT, + AV_CH_BACK_RIGHT, + AV_CH_FRONT_LEFT_OF_CENTER, + AV_CH_FRONT_RIGHT_OF_CENTER, + AV_CH_BACK_CENTER, + AV_CH_SIDE_LEFT, + AV_CH_SIDE_RIGHT, + AV_CH_TOP_CENTER, + AV_CH_TOP_FRONT_LEFT, + AV_CH_TOP_FRONT_CENTER, + AV_CH_TOP_FRONT_RIGHT, + AV_CH_TOP_BACK_LEFT, + AV_CH_TOP_BACK_CENTER, + AV_CH_TOP_BACK_RIGHT, +}; + static const uint16_t frame_duration_type_quants[] = { 3, 4, 6, 8, 4096, 8192, 16384, 512, 1024, 2048, }; @@ -108,8 +130,8 @@ void avpriv_tak_parse_streaminfo(GetBitContext *gb, TAKStreamInfo *s) for (i = 0; i < s->channels; i++) { int value = get_bits(gb, TAK_FORMAT_CH_LAYOUT_BITS); - if (value > 0 && value <= 18) - channel_mask |= 1 << (value - 1); + if (value < FF_ARRAY_ELEMS(tak_channel_layouts)) + channel_mask |= tak_channel_layouts[value]; } } } @@ -144,6 +166,9 @@ int ff_tak_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb, align_get_bits(gb); } + if (ti->flags & TAK_FRAME_FLAG_HAS_METADATA) + return AVERROR_INVALIDDATA; + skip_bits(gb, 24); return 0; |