diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2012-10-22 15:43:59 -0400 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2012-11-01 11:29:16 -0400 |
commit | c5b8acad731c06389b98df8248b6a536e1b7e58d (patch) | |
tree | 3c919099caf907449e38c3d3e39314a42b6b8836 | |
parent | a346aaf148dc2ce53da30e2f67223834495c0fd6 (diff) | |
download | ffmpeg-c5b8acad731c06389b98df8248b6a536e1b7e58d.tar.gz |
libgsmdec: always set channel layout and sample rate at initialization
Only mono 8kHz is supported.
-rw-r--r-- | libavcodec/libgsm.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/libavcodec/libgsm.c b/libavcodec/libgsm.c index e6d435ba05..afed7100a0 100644 --- a/libavcodec/libgsm.c +++ b/libavcodec/libgsm.c @@ -29,6 +29,7 @@ #include <gsm/gsm.h> +#include "libavutil/audioconvert.h" #include "avcodec.h" #include "internal.h" #include "gsm.h" @@ -149,19 +150,10 @@ typedef struct LibGSMDecodeContext { static av_cold int libgsm_decode_init(AVCodecContext *avctx) { LibGSMDecodeContext *s = avctx->priv_data; - if (avctx->channels > 1) { - av_log(avctx, AV_LOG_ERROR, "Mono required for GSM, got %d channels\n", - avctx->channels); - return -1; - } - - if (!avctx->channels) - avctx->channels = 1; - - if (!avctx->sample_rate) - avctx->sample_rate = 8000; - - avctx->sample_fmt = AV_SAMPLE_FMT_S16; + avctx->channels = 1; + avctx->channel_layout = AV_CH_LAYOUT_MONO; + avctx->sample_rate = 8000; + avctx->sample_fmt = AV_SAMPLE_FMT_S16; s->state = gsm_create(); |