diff options
Diffstat (limited to 'libavcodec/s302m.c')
-rw-r--r-- | libavcodec/s302m.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/libavcodec/s302m.c b/libavcodec/s302m.c index 66d25f11b4..5f73148f77 100644 --- a/libavcodec/s302m.c +++ b/libavcodec/s302m.c @@ -3,20 +3,20 @@ * Copyright (c) 2008 Laurent Aimar <fenrir@videolan.org> * Copyright (c) 2009 Baptiste Coudurier <baptiste.coudurier@gmail.com> * - * 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 */ @@ -66,6 +66,19 @@ static int s302m_parse_frame_header(AVCodecContext *avctx, const uint8_t *buf, avctx->sample_fmt = AV_SAMPLE_FMT_S16; avctx->channels = channels; + switch(channels) { + case 2: + avctx->channel_layout = AV_CH_LAYOUT_STEREO; + break; + case 4: + avctx->channel_layout = AV_CH_LAYOUT_QUAD; + break; + case 6: + avctx->channel_layout = AV_CH_LAYOUT_5POINT1_BACK; + break; + case 8: + avctx->channel_layout = AV_CH_LAYOUT_5POINT1_BACK | AV_CH_LAYOUT_STEREO_DOWNMIX; + } avctx->sample_rate = 48000; avctx->bit_rate = 48000 * avctx->channels * (avctx->bits_per_coded_sample + 4) + 32 * (48000 / (buf_size * 8 / @@ -93,10 +106,8 @@ static int s302m_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ block_size = (avctx->bits_per_coded_sample + 4) / 4; frame->nb_samples = 2 * (buf_size / block_size) / avctx->channels; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } buf_size = (frame->nb_samples * avctx->channels / 2) * block_size; |