diff options
Diffstat (limited to 'libavcodec/libgsmdec.c')
-rw-r--r-- | libavcodec/libgsmdec.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/libavcodec/libgsmdec.c b/libavcodec/libgsmdec.c index 419f364..89e1de0 100644 --- a/libavcodec/libgsmdec.c +++ b/libavcodec/libgsmdec.c @@ -3,20 +3,20 @@ * Copyright (c) 2005 Alban Bedel <albeu@free.fr> * Copyright (c) 2006, 2007 Michel Bardiaux <mbardiaux@mediaxim.be> * - * 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 */ @@ -27,7 +27,12 @@ // The idiosyncrasies of GSM-in-WAV are explained at http://kbs.cs.tu-berlin.de/~jutta/toast.html +#include "config.h" +#if HAVE_GSM_H #include <gsm.h> +#else +#include <gsm/gsm.h> +#endif #include "libavutil/channel_layout.h" #include "libavutil/common.h" @@ -45,7 +50,8 @@ static av_cold int libgsm_decode_init(AVCodecContext *avctx) { avctx->channels = 1; avctx->channel_layout = AV_CH_LAYOUT_MONO; - avctx->sample_rate = 8000; + if (!avctx->sample_rate) + avctx->sample_rate = 8000; avctx->sample_fmt = AV_SAMPLE_FMT_S16; s->state = gsm_create(); @@ -91,10 +97,8 @@ static int libgsm_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = avctx->frame_size; - 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; - } samples = (int16_t *)frame->data[0]; for (i = 0; i < avctx->frame_size / GSM_FRAME_SIZE; i++) { @@ -119,6 +123,7 @@ static void libgsm_flush(AVCodecContext *avctx) { gsm_option(s->state, GSM_OPT_WAV49, &one); } +#if CONFIG_LIBGSM_DECODER AVCodec ff_libgsm_decoder = { .name = "libgsm", .long_name = NULL_IF_CONFIG_SMALL("libgsm GSM"), @@ -132,7 +137,8 @@ AVCodec ff_libgsm_decoder = { .capabilities = AV_CODEC_CAP_DR1, .wrapper_name = "libgsm", }; - +#endif +#if CONFIG_LIBGSM_MS_DECODER AVCodec ff_libgsm_ms_decoder = { .name = "libgsm_ms", .long_name = NULL_IF_CONFIG_SMALL("libgsm GSM Microsoft variant"), @@ -146,3 +152,4 @@ AVCodec ff_libgsm_ms_decoder = { .capabilities = AV_CODEC_CAP_DR1, .wrapper_name = "libgsm", }; +#endif |