summaryrefslogtreecommitdiff
path: root/libavcodec/libshine.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2019-06-04 17:48:08 +0200
committerJames Almer <jamrial@gmail.com>2022-03-15 09:42:43 -0300
commitffdf7269a5c07c9e5910dc14eb3fd2e171944f79 (patch)
treeca8884c5b5fe898ef4368f46a8bfad2bd9c95e66 /libavcodec/libshine.c
parente869c06ef58c8574b1ba06fdc15ea643229f8ff7 (diff)
downloadffmpeg-ffdf7269a5c07c9e5910dc14eb3fd2e171944f79.tar.gz
libshine: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/libshine.c')
-rw-r--r--libavcodec/libshine.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/libavcodec/libshine.c b/libavcodec/libshine.c
index fbc84846ae..1352a3a165 100644
--- a/libavcodec/libshine.c
+++ b/libavcodec/libshine.c
@@ -44,7 +44,7 @@ static av_cold int libshine_encode_init(AVCodecContext *avctx)
{
SHINEContext *s = avctx->priv_data;
- if (avctx->channels <= 0 || avctx->channels > 2){
+ if (avctx->ch_layout.nb_channels <= 0 || avctx->ch_layout.nb_channels > 2){
av_log(avctx, AV_LOG_ERROR, "only mono or stereo is supported\n");
return AVERROR(EINVAL);
}
@@ -52,9 +52,9 @@ static av_cold int libshine_encode_init(AVCodecContext *avctx)
shine_set_config_mpeg_defaults(&s->config.mpeg);
if (avctx->bit_rate)
s->config.mpeg.bitr = avctx->bit_rate / 1000;
- s->config.mpeg.mode = avctx->channels == 2 ? STEREO : MONO;
+ s->config.mpeg.mode = avctx->ch_layout.nb_channels == 2 ? STEREO : MONO;
s->config.wave.samplerate = avctx->sample_rate;
- s->config.wave.channels = avctx->channels == 2 ? PCM_STEREO : PCM_MONO;
+ s->config.wave.channels = avctx->ch_layout.nb_channels == 2 ? PCM_STEREO : PCM_MONO;
if (shine_check_config(s->config.wave.samplerate, s->config.mpeg.bitr) < 0) {
av_log(avctx, AV_LOG_ERROR, "invalid configuration\n");
return AVERROR(EINVAL);
@@ -144,8 +144,14 @@ const AVCodec ff_libshine_encoder = {
.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16P,
AV_SAMPLE_FMT_NONE },
.supported_samplerates = libshine_sample_rates,
+#if FF_API_OLD_CHANNEL_LAYOUT
.channel_layouts = (const uint64_t[]) { AV_CH_LAYOUT_MONO,
AV_CH_LAYOUT_STEREO,
0 },
+#endif
+ .ch_layouts = (const AVChannelLayout[]) { AV_CHANNEL_LAYOUT_MONO,
+ AV_CHANNEL_LAYOUT_STEREO,
+ { 0 },
+ },
.wrapper_name = "libshine",
};