Unified · Split
| @@ -56,7 +56,8 @@ static av_cold int cng_decode_init(AVCodecContext *avctx) · 55 unmodified lines | ||
| 56 | 56 | CNGContext *p = avctx->priv_data; |
| 57 | 57 | |
| 58 | 58 | avctx->sample_fmt = AV_SAMPLE_FMT_S16; |
| 59 | − avctx->channels = 1; | |
| 59 | + av_channel_layout_uninit(&avctx->ch_layout); | |
| 60 | + avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO; | |
| 60 | 61 | avctx->sample_rate = 8000; |
| 61 | 62 | |
| 62 | 63 | p->order = 12; |
| @@ -48,11 +48,6 @@ static av_cold int cng_encode_init(AVCodecContext *avctx) · 47 unmodified lines | ||
| 48 | 48 | CNGContext *p = avctx->priv_data; |
| 49 | 49 | int ret; |
| 50 | 50 | |
| 51 | − if (avctx->channels != 1) { | |
| 52 | − av_log(avctx, AV_LOG_ERROR, "Only mono supported\n"); | |
| 53 | − return AVERROR(EINVAL); | |
| 54 | − } | |
| 55 | − | |
| 56 | 51 | avctx->frame_size = 640; |
| 57 | 52 | p->order = 10; |
| 58 | 53 | if ((ret = ff_lpc_init(&p->lpc, avctx->frame_size, p->order, FF_LPC_TYPE_LEVINSON)) < 0) |
| @@ -113,5 +108,6 @@ const AVCodec ff_comfortnoise_encoder = { · 54 unmodified lines | ||
| 113 | 108 | .close = cng_encode_close, |
| 114 | 109 | .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16, |
| 115 | 110 | AV_SAMPLE_FMT_NONE }, |
| 111 | + .ch_layouts = (const AVChannelLayout[]){ AV_CHANNEL_LAYOUT_MONO, { 0 } }, | |
| 116 | 112 | .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, |
| 117 | 113 | }; |