g726: convert to new channel layout API

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
release/5.1
Anton Khirnov 12 years ago committed by James Almer
parent 182866e9e4
commit e763a7cf0b
  1. 8
      libavcodec/g726.c

@ -324,7 +324,7 @@ static av_cold int g726_encode_init(AVCodecContext *avctx)
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
if(avctx->channels != 1){ if (avctx->ch_layout.nb_channels != 1) {
av_log(avctx, AV_LOG_ERROR, "Only mono is supported\n"); av_log(avctx, AV_LOG_ERROR, "Only mono is supported\n");
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
@ -436,12 +436,12 @@ static av_cold int g726_decode_init(AVCodecContext *avctx)
{ {
G726Context* c = avctx->priv_data; G726Context* c = avctx->priv_data;
if(avctx->channels > 1){ if (avctx->ch_layout.nb_channels > 1){
avpriv_request_sample(avctx, "Decoding more than one channel"); avpriv_request_sample(avctx, "Decoding more than one channel");
return AVERROR_PATCHWELCOME; return AVERROR_PATCHWELCOME;
} }
avctx->channels = 1; av_channel_layout_uninit(&avctx->ch_layout);
avctx->channel_layout = AV_CH_LAYOUT_MONO; avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
c->little_endian = !strcmp(avctx->codec->name, "g726le"); c->little_endian = !strcmp(avctx->codec->name, "g726le");

Loading…
Cancel
Save