Commit c5b8acad authored by Justin Ruggles's avatar Justin Ruggles

libgsmdec: always set channel layout and sample rate at initialization

Only mono 8kHz is supported.
parent a346aaf1
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <gsm/gsm.h> #include <gsm/gsm.h>
#include "libavutil/audioconvert.h"
#include "avcodec.h" #include "avcodec.h"
#include "internal.h" #include "internal.h"
#include "gsm.h" #include "gsm.h"
...@@ -149,19 +150,10 @@ typedef struct LibGSMDecodeContext { ...@@ -149,19 +150,10 @@ typedef struct LibGSMDecodeContext {
static av_cold int libgsm_decode_init(AVCodecContext *avctx) { static av_cold int libgsm_decode_init(AVCodecContext *avctx) {
LibGSMDecodeContext *s = avctx->priv_data; LibGSMDecodeContext *s = avctx->priv_data;
if (avctx->channels > 1) { avctx->channels = 1;
av_log(avctx, AV_LOG_ERROR, "Mono required for GSM, got %d channels\n", avctx->channel_layout = AV_CH_LAYOUT_MONO;
avctx->channels); avctx->sample_rate = 8000;
return -1; avctx->sample_fmt = AV_SAMPLE_FMT_S16;
}
if (!avctx->channels)
avctx->channels = 1;
if (!avctx->sample_rate)
avctx->sample_rate = 8000;
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
s->state = gsm_create(); s->state = gsm_create();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment