19 changes: 0 additions & 19 deletions libavcodec/codec_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,25 +284,6 @@ typedef struct FFCodec {
.update_thread_context_for_user = NULL
#endif

#if FF_API_OLD_CHANNEL_LAYOUT
#define CODEC_OLD_CHANNEL_LAYOUTS(...) CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(((const uint64_t[]) { __VA_ARGS__, 0 }))
#if defined(__clang__)
#define CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(array) \
FF_DISABLE_DEPRECATION_WARNINGS \
.p.channel_layouts = (array), \
FF_ENABLE_DEPRECATION_WARNINGS
#else
#define CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(array) .p.channel_layouts = (array),
#endif
#else
/* This is only provided to allow to test disabling FF_API_OLD_CHANNEL_LAYOUT
* without removing all the FF_API_OLD_CHANNEL_LAYOUT codeblocks.
* It is of course still expected to be removed when FF_API_OLD_CHANNEL_LAYOUT
* will be finally removed (along with all usages of these macros). */
#define CODEC_OLD_CHANNEL_LAYOUTS(...)
#define CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(array)
#endif

#define FF_CODEC_DECODE_CB(func) \
.cb_type = FF_CODEC_CB_TYPE_DECODE, \
.cb.decode = (func)
Expand Down
46 changes: 0 additions & 46 deletions libavcodec/codec_par.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,32 +168,9 @@ int avcodec_parameters_from_context(AVCodecParameters *par,
break;
case AVMEDIA_TYPE_AUDIO:
par->format = codec->sample_fmt;
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
// if the old/new fields are set inconsistently, prefer the old ones
if ((codec->channels && codec->channels != codec->ch_layout.nb_channels) ||
(codec->channel_layout && (codec->ch_layout.order != AV_CHANNEL_ORDER_NATIVE ||
codec->ch_layout.u.mask != codec->channel_layout))) {
if (codec->channel_layout)
av_channel_layout_from_mask(&par->ch_layout, codec->channel_layout);
else {
par->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
par->ch_layout.nb_channels = codec->channels;
}
FF_ENABLE_DEPRECATION_WARNINGS
} else {
#endif
ret = av_channel_layout_copy(&par->ch_layout, &codec->ch_layout);
if (ret < 0)
return ret;
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
}
par->channel_layout = par->ch_layout.order == AV_CHANNEL_ORDER_NATIVE ?
par->ch_layout.u.mask : 0;
par->channels = par->ch_layout.nb_channels;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
par->sample_rate = codec->sample_rate;
par->block_align = codec->block_align;
par->frame_size = codec->frame_size;
Expand Down Expand Up @@ -255,32 +232,9 @@ int avcodec_parameters_to_context(AVCodecContext *codec,
break;
case AVMEDIA_TYPE_AUDIO:
codec->sample_fmt = par->format;
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
// if the old/new fields are set inconsistently, prefer the old ones
if ((par->channels && par->channels != par->ch_layout.nb_channels) ||
(par->channel_layout && (par->ch_layout.order != AV_CHANNEL_ORDER_NATIVE ||
par->ch_layout.u.mask != par->channel_layout))) {
if (par->channel_layout)
av_channel_layout_from_mask(&codec->ch_layout, par->channel_layout);
else {
codec->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
codec->ch_layout.nb_channels = par->channels;
}
FF_ENABLE_DEPRECATION_WARNINGS
} else {
#endif
ret = av_channel_layout_copy(&codec->ch_layout, &par->ch_layout);
if (ret < 0)
return ret;
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
}
codec->channel_layout = codec->ch_layout.order == AV_CHANNEL_ORDER_NATIVE ?
codec->ch_layout.u.mask : 0;
codec->channels = codec->ch_layout.nb_channels;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
codec->sample_rate = par->sample_rate;
codec->block_align = par->block_align;
codec->frame_size = par->frame_size;
Expand Down
16 changes: 0 additions & 16 deletions libavcodec/codec_par.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,22 +149,6 @@ typedef struct AVCodecParameters {
*/
int video_delay;

#if FF_API_OLD_CHANNEL_LAYOUT
/**
* Audio only. The channel layout bitmask. May be 0 if the channel layout is
* unknown or unspecified, otherwise the number of bits set must be equal to
* the channels field.
* @deprecated use ch_layout
*/
attribute_deprecated
uint64_t channel_layout;
/**
* Audio only. The number of audio channels.
* @deprecated use ch_layout.nb_channels
*/
attribute_deprecated
int channels;
#endif
/**
* Audio only. The number of audio samples per second.
*/
Expand Down
12 changes: 0 additions & 12 deletions libavcodec/dcadec.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,18 +352,6 @@ static av_cold int dcadec_init(AVCodecContext *avctx)

s->crctab = av_crc_get_table(AV_CRC_16_CCITT);

#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
if (avctx->request_channel_layout & AV_CH_LAYOUT_NATIVE)
s->output_channel_order = CHANNEL_ORDER_CODED;

if (avctx->request_channel_layout & ~AV_CH_LAYOUT_NATIVE) {
av_channel_layout_uninit(&s->downmix_layout);
av_channel_layout_from_mask(&s->downmix_layout, avctx->request_channel_layout & ~AV_CH_LAYOUT_NATIVE);
}
FF_ENABLE_DEPRECATION_WARNINGS
#endif

if (s->downmix_layout.nb_channels) {
if (!av_channel_layout_compare(&s->downmix_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO) ||
!av_channel_layout_compare(&s->downmix_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO_DOWNMIX)) {
Expand Down
3 changes: 0 additions & 3 deletions libavcodec/dcaenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1325,9 +1325,6 @@ const FFCodec ff_dca_encoder = {
.p.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S32,
AV_SAMPLE_FMT_NONE },
.p.supported_samplerates = sample_rates,
CODEC_OLD_CHANNEL_LAYOUTS(AV_CH_LAYOUT_MONO, AV_CH_LAYOUT_STEREO,
AV_CH_LAYOUT_2_2, AV_CH_LAYOUT_5POINT0,
AV_CH_LAYOUT_5POINT1)
.p.ch_layouts = (const AVChannelLayout[]){
AV_CHANNEL_LAYOUT_MONO,
AV_CHANNEL_LAYOUT_STEREO,
Expand Down
51 changes: 0 additions & 51 deletions libavcodec/decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,39 +92,6 @@ static int apply_param_change(AVCodecContext *avctx, const AVPacket *avpkt)
flags = bytestream_get_le32(&data);
size -= 4;

#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) {
if (size < 4)
goto fail;
val = bytestream_get_le32(&data);
if (val <= 0 || val > INT_MAX) {
av_log(avctx, AV_LOG_ERROR, "Invalid channel count");
ret = AVERROR_INVALIDDATA;
goto fail2;
}
av_channel_layout_uninit(&avctx->ch_layout);
avctx->ch_layout.nb_channels = val;
avctx->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
size -= 4;
}
if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT) {
if (size < 8)
goto fail;
av_channel_layout_uninit(&avctx->ch_layout);
ret = av_channel_layout_from_mask(&avctx->ch_layout, bytestream_get_le64(&data));
if (ret < 0)
goto fail2;
size -= 8;
}
if (flags & (AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT |
AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT)) {
avctx->channels = avctx->ch_layout.nb_channels;
avctx->channel_layout = (avctx->ch_layout.order == AV_CHANNEL_ORDER_NATIVE) ?
avctx->ch_layout.u.mask : 0;
}
FF_ENABLE_DEPRECATION_WARNINGS
#endif
if (flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) {
if (size < 4)
goto fail;
Expand Down Expand Up @@ -582,15 +549,6 @@ static int fill_frame_props(const AVCodecContext *avctx, AVFrame *frame)
if (ret < 0)
return ret;
}
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
if (!frame->channel_layout)
frame->channel_layout = avctx->ch_layout.order == AV_CHANNEL_ORDER_NATIVE ?
avctx->ch_layout.u.mask : 0;
if (!frame->channels)
frame->channels = avctx->ch_layout.nb_channels;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
if (!frame->sample_rate)
frame->sample_rate = avctx->sample_rate;
}
Expand Down Expand Up @@ -1633,15 +1591,6 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
goto fail;
}
} else if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
/* compat layer for old-style get_buffer() implementations */
avctx->channels = avctx->ch_layout.nb_channels;
avctx->channel_layout = (avctx->ch_layout.order == AV_CHANNEL_ORDER_NATIVE) ?
avctx->ch_layout.u.mask : 0;
FF_ENABLE_DEPRECATION_WARNINGS
#endif

if (frame->nb_samples * (int64_t)avctx->ch_layout.nb_channels > avctx->max_samples) {
av_log(avctx, AV_LOG_ERROR, "samples per frame %d, exceeds max_samples %"PRId64"\n", frame->nb_samples, avctx->max_samples);
ret = AVERROR(EINVAL);
Expand Down
7 changes: 0 additions & 7 deletions libavcodec/dolby_e.c
Original file line number Diff line number Diff line change
Expand Up @@ -1272,13 +1272,6 @@ static av_cold int dolby_e_init(AVCodecContext *avctx)
if (!(s->fdsp = avpriv_float_dsp_alloc(0)))
return AVERROR(ENOMEM);

#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
if (avctx->request_channel_layout & AV_CH_LAYOUT_NATIVE)
s->dectx.metadata.output_channel_order = CHANNEL_ORDER_CODED;
FF_ENABLE_DEPRECATION_WARNINGS
#endif

s->dectx.metadata.multi_prog_warned = s->dectx.metadata.output_channel_order == CHANNEL_ORDER_CODED;
s->dectx.avctx = s->avctx = avctx;
return 0;
Expand Down
1 change: 0 additions & 1 deletion libavcodec/eac3enc.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ const FFCodec ff_eac3_encoder = {
AV_SAMPLE_FMT_NONE },
.p.priv_class = &eac3enc_class,
.p.supported_samplerates = ff_ac3_sample_rate_tab,
CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(ff_ac3_channel_layouts)
.p.ch_layouts = ff_ac3_ch_layouts,
.defaults = ff_ac3_enc_defaults,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
Expand Down
1 change: 0 additions & 1 deletion libavcodec/g722enc.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,6 @@ const FFCodec ff_adpcm_g722_encoder = {
.close = g722_encode_close,
FF_CODEC_ENCODE_CB(g722_encode_frame),
.p.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE },
CODEC_OLD_CHANNEL_LAYOUTS(AV_CH_LAYOUT_MONO)
.p.ch_layouts = (const AVChannelLayout[]){
AV_CHANNEL_LAYOUT_MONO, { 0 }
},
Expand Down
6 changes: 0 additions & 6 deletions libavcodec/get_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,6 @@ static int update_frame_pool(AVCodecContext *avctx, AVFrame *frame)
if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
int planar = av_sample_fmt_is_planar(frame->format);
ch = frame->ch_layout.nb_channels;
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
if (!ch)
ch = frame->channels;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
planes = planar ? ch : 1;
}

Expand Down
2 changes: 0 additions & 2 deletions libavcodec/libcodec2.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ const FFCodec ff_libcodec2_decoder = {
.init = libcodec2_init_decoder,
.close = libcodec2_close,
FF_CODEC_DECODE_CB(libcodec2_decode),
CODEC_OLD_CHANNEL_LAYOUTS(AV_CH_LAYOUT_MONO)
};

const FFCodec ff_libcodec2_encoder = {
Expand All @@ -208,5 +207,4 @@ const FFCodec ff_libcodec2_encoder = {
.init = libcodec2_init_encoder,
.close = libcodec2_close,
FF_CODEC_ENCODE_CB(libcodec2_encode),
CODEC_OLD_CHANNEL_LAYOUTS(AV_CH_LAYOUT_MONO)
};
8 changes: 0 additions & 8 deletions libavcodec/libfdk-aacdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,6 @@ static av_cold int fdk_aac_decode_init(AVCodecContext *avctx)
return AVERROR_UNKNOWN;
}

#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
if (avctx->request_channel_layout) {
av_channel_layout_uninit(&s->downmix_layout);
av_channel_layout_from_mask(&s->downmix_layout, avctx->request_channel_layout);
}
FF_ENABLE_DEPRECATION_WARNINGS
#endif
if (s->downmix_layout.nb_channels > 0 &&
s->downmix_layout.order != AV_CHANNEL_ORDER_NATIVE) {
int downmix_channels = -1;
Expand Down
23 changes: 0 additions & 23 deletions libavcodec/libfdk-aacenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -557,28 +557,6 @@ static const FFCodecDefault aac_encode_defaults[] = {
{ NULL }
};

#if FF_API_OLD_CHANNEL_LAYOUT
static const uint64_t aac_channel_layout[] = {
AV_CH_LAYOUT_MONO,
AV_CH_LAYOUT_STEREO,
AV_CH_LAYOUT_SURROUND,
AV_CH_LAYOUT_4POINT0,
AV_CH_LAYOUT_5POINT0_BACK,
AV_CH_LAYOUT_5POINT1_BACK,
#if FDKENC_VER_AT_LEAST(4, 0) // 4.0.0
AV_CH_LAYOUT_6POINT1_BACK,
#endif
#if FDKENC_VER_AT_LEAST(3, 4) // 3.4.12
AV_CH_LAYOUT_7POINT1_WIDE_BACK,
AV_CH_LAYOUT_7POINT1,
#endif
#if FDKENC_VER_AT_LEAST(4, 0) // 4.0.0
AV_CH_LAYOUT_7POINT1_TOP_BACK,
#endif
0,
};
#endif /* FF_API_OLD_CHANNEL_LAYOUT */

static const AVChannelLayout aac_ch_layouts[16] = {
AV_CHANNEL_LAYOUT_MONO,
AV_CHANNEL_LAYOUT_STEREO,
Expand Down Expand Up @@ -625,6 +603,5 @@ const FFCodec ff_libfdk_aac_encoder = {
.p.profiles = profiles,
.p.supported_samplerates = aac_sample_rates,
.p.wrapper_name = "libfdk",
CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(aac_channel_layout)
.p.ch_layouts = aac_ch_layouts,
};
2 changes: 0 additions & 2 deletions libavcodec/libgsmenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ const FFCodec ff_libgsm_encoder = {
FF_CODEC_ENCODE_CB(libgsm_encode_frame),
.close = libgsm_encode_close,
.defaults = libgsm_defaults,
CODEC_OLD_CHANNEL_LAYOUTS(AV_CH_LAYOUT_MONO)
.p.ch_layouts = (const AVChannelLayout[]) { AV_CHANNEL_LAYOUT_MONO, { 0 } },
.p.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
AV_SAMPLE_FMT_NONE },
Expand All @@ -146,7 +145,6 @@ const FFCodec ff_libgsm_ms_encoder = {
FF_CODEC_ENCODE_CB(libgsm_encode_frame),
.close = libgsm_encode_close,
.defaults = libgsm_defaults,
CODEC_OLD_CHANNEL_LAYOUTS(AV_CH_LAYOUT_MONO)
.p.ch_layouts = (const AVChannelLayout[]) { AV_CHANNEL_LAYOUT_MONO, { 0 } },
.p.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
AV_SAMPLE_FMT_NONE },
Expand Down
1 change: 0 additions & 1 deletion libavcodec/libmp3lame.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,6 @@ const FFCodec ff_libmp3lame_encoder = {
AV_SAMPLE_FMT_S16P,
AV_SAMPLE_FMT_NONE },
.p.supported_samplerates = libmp3lame_sample_rates,
CODEC_OLD_CHANNEL_LAYOUTS(AV_CH_LAYOUT_MONO, AV_CH_LAYOUT_STEREO)
.p.ch_layouts = (const AVChannelLayout[]) { AV_CHANNEL_LAYOUT_MONO,
AV_CHANNEL_LAYOUT_STEREO,
{ 0 },
Expand Down
1 change: 0 additions & 1 deletion libavcodec/libshine.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ const FFCodec ff_libshine_encoder = {
.p.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16P,
AV_SAMPLE_FMT_NONE },
.p.supported_samplerates = libshine_sample_rates,
CODEC_OLD_CHANNEL_LAYOUTS(AV_CH_LAYOUT_MONO, AV_CH_LAYOUT_STEREO)
.p.ch_layouts = (const AVChannelLayout[]) { AV_CHANNEL_LAYOUT_MONO,
AV_CHANNEL_LAYOUT_STEREO,
{ 0 },
Expand Down
1 change: 0 additions & 1 deletion libavcodec/libspeexenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,6 @@ const FFCodec ff_libspeex_encoder = {
.close = encode_close,
.p.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
AV_SAMPLE_FMT_NONE },
CODEC_OLD_CHANNEL_LAYOUTS(AV_CH_LAYOUT_MONO, AV_CH_LAYOUT_STEREO)
.p.ch_layouts = (const AVChannelLayout[]) { AV_CHANNEL_LAYOUT_MONO,
AV_CHANNEL_LAYOUT_STEREO,
{ 0 },
Expand Down
1 change: 0 additions & 1 deletion libavcodec/libtwolame.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ const FFCodec ff_libtwolame_encoder = {
AV_SAMPLE_FMT_S16P,
AV_SAMPLE_FMT_NONE
},
CODEC_OLD_CHANNEL_LAYOUTS(AV_CH_LAYOUT_MONO, AV_CH_LAYOUT_STEREO)
.p.ch_layouts = (const AVChannelLayout[]) {
AV_CHANNEL_LAYOUT_MONO,
AV_CHANNEL_LAYOUT_STEREO,
Expand Down
9 changes: 0 additions & 9 deletions libavcodec/mlp.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,6 @@ const ChannelInformation ff_mlp_ch_info[21] = {
{ 0x3F, 0x04, 0x02, 0x00 },
};

#if FF_API_OLD_CHANNEL_LAYOUT
const uint64_t ff_mlp_channel_layouts[12] = {
AV_CH_LAYOUT_MONO, AV_CH_LAYOUT_STEREO, AV_CH_LAYOUT_2_1,
AV_CH_LAYOUT_QUAD, AV_CH_LAYOUT_2POINT1, AV_CH_LAYOUT_SURROUND,
AV_CH_LAYOUT_4POINT0, AV_CH_LAYOUT_5POINT0_BACK, AV_CH_LAYOUT_3POINT1,
AV_CH_LAYOUT_4POINT1, AV_CH_LAYOUT_5POINT1_BACK, 0,
};
#endif

const AVChannelLayout ff_mlp_ch_layouts[12] = {
AV_CHANNEL_LAYOUT_MONO, AV_CHANNEL_LAYOUT_STEREO, AV_CHANNEL_LAYOUT_2_1,
AV_CHANNEL_LAYOUT_QUAD, AV_CHANNEL_LAYOUT_2POINT1, AV_CHANNEL_LAYOUT_SURROUND,
Expand Down
3 changes: 0 additions & 3 deletions libavcodec/mlp.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,6 @@ typedef struct {
*/
extern const ChannelInformation ff_mlp_ch_info[21];

#if FF_API_OLD_CHANNEL_LAYOUT
extern const uint64_t ff_mlp_channel_layouts[12];
#endif
extern const AVChannelLayout ff_mlp_ch_layouts[12];

/** MLP uses checksums that seem to be based on the standard CRC algorithm, but
Expand Down
9 changes: 0 additions & 9 deletions libavcodec/mlpdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,15 +306,6 @@ static av_cold int mlp_decode_init(AVCodecContext *avctx)
m->substream[substr].lossless_check_data = 0xffffffff;
ff_mlpdsp_init(&m->dsp);

#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
if (avctx->request_channel_layout) {
av_channel_layout_uninit(&m->downmix_layout);
av_channel_layout_from_mask(&m->downmix_layout, avctx->request_channel_layout);
}
FF_ENABLE_DEPRECATION_WARNINGS
#endif

if (m->downmix_layout.nb_channels) {
if (!av_channel_layout_compare(&m->downmix_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO) ||
!av_channel_layout_compare(&m->downmix_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO_DOWNMIX)) {
Expand Down
2 changes: 0 additions & 2 deletions libavcodec/mlpenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2309,7 +2309,6 @@ const FFCodec ff_mlp_encoder = {
.p.priv_class = &mlp_class,
.p.sample_fmts = (const enum AVSampleFormat[]) {AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_NONE},
.p.supported_samplerates = (const int[]) {44100, 48000, 88200, 96000, 176400, 192000, 0},
CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(ff_mlp_channel_layouts)
.p.ch_layouts = ff_mlp_ch_layouts,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
};
Expand All @@ -2330,7 +2329,6 @@ const FFCodec ff_truehd_encoder = {
.p.priv_class = &mlp_class,
.p.sample_fmts = (const enum AVSampleFormat[]) {AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_NONE},
.p.supported_samplerates = (const int[]) {44100, 48000, 88200, 96000, 176400, 192000, 0},
CODEC_OLD_CHANNEL_LAYOUTS(AV_CH_LAYOUT_MONO, AV_CH_LAYOUT_STEREO, AV_CH_LAYOUT_2POINT1, AV_CH_LAYOUT_SURROUND, AV_CH_LAYOUT_3POINT1, AV_CH_LAYOUT_4POINT0, AV_CH_LAYOUT_4POINT1, AV_CH_LAYOUT_5POINT0, AV_CH_LAYOUT_5POINT1)
.p.ch_layouts = (const AVChannelLayout[]) {
AV_CHANNEL_LAYOUT_MONO,
AV_CHANNEL_LAYOUT_STEREO,
Expand Down
1 change: 0 additions & 1 deletion libavcodec/mpegaudioenc_fixed.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ const FFCodec ff_mp2fixed_encoder = {
.p.supported_samplerates = (const int[]){
44100, 48000, 32000, 22050, 24000, 16000, 0
},
CODEC_OLD_CHANNEL_LAYOUTS(AV_CH_LAYOUT_MONO, AV_CH_LAYOUT_STEREO)
.p.ch_layouts = (const AVChannelLayout[]){ AV_CHANNEL_LAYOUT_MONO,
AV_CHANNEL_LAYOUT_STEREO,
{ 0 } },
Expand Down
1 change: 0 additions & 1 deletion libavcodec/mpegaudioenc_float.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ const FFCodec ff_mp2_encoder = {
.p.supported_samplerates = (const int[]){
44100, 48000, 32000, 22050, 24000, 16000, 0
},
CODEC_OLD_CHANNEL_LAYOUTS(AV_CH_LAYOUT_MONO, AV_CH_LAYOUT_STEREO)
.p.ch_layouts = (const AVChannelLayout[]){ AV_CHANNEL_LAYOUT_MONO,
AV_CHANNEL_LAYOUT_STEREO,
{ 0 } },
Expand Down
7 changes: 0 additions & 7 deletions libavcodec/options_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ static const AVOption avcodec_options[] = {
{"time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, {.dbl = 0}, 0, INT_MAX},
{"g", "set the group of picture (GOP) size", OFFSET(gop_size), AV_OPT_TYPE_INT, {.i64 = 12 }, INT_MIN, INT_MAX, V|E},
{"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, A|D|E},
#if FF_API_OLD_CHANNEL_LAYOUT
{"ac", "set number of audio channels", OFFSET(channels), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, A|D|E},
#endif
{"cutoff", "set cutoff bandwidth", OFFSET(cutoff), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|E},
{"frame_size", NULL, OFFSET(frame_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, A|E},
{"frame_number", NULL, OFFSET(frame_num), AV_OPT_TYPE_INT64, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
Expand Down Expand Up @@ -269,10 +266,6 @@ static const AVOption avcodec_options[] = {
{"compression_level", NULL, OFFSET(compression_level), AV_OPT_TYPE_INT, {.i64 = FF_COMPRESSION_DEFAULT }, INT_MIN, INT_MAX, V|A|E},
{"bits_per_raw_sample", NULL, OFFSET(bits_per_raw_sample), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX},
{"ch_layout", NULL, OFFSET(ch_layout), AV_OPT_TYPE_CHLAYOUT, {.str = NULL }, 0, 0, A|E|D, .unit = "ch_layout"},
#if FF_API_OLD_CHANNEL_LAYOUT
{"channel_layout", NULL, OFFSET(channel_layout), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64 = DEFAULT }, 0, UINT64_MAX, A|E|D, .unit = "channel_layout"},
{"request_channel_layout", NULL, OFFSET(request_channel_layout), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64 = DEFAULT }, 0, UINT64_MAX, A|D, .unit = "request_channel_layout"},
#endif
{"rc_max_vbv_use", NULL, OFFSET(rc_max_available_vbv_use), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, 0.0, FLT_MAX, V|E},
{"rc_min_vbv_use", NULL, OFFSET(rc_min_vbv_overflow_use), AV_OPT_TYPE_FLOAT, {.dbl = 3 }, 0.0, FLT_MAX, V|E},
#if FF_API_TICKS_PER_FRAME
Expand Down
1 change: 0 additions & 1 deletion libavcodec/opusenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,6 @@ const FFCodec ff_opus_encoder = {
.close = opus_encode_end,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.p.supported_samplerates = (const int []){ 48000, 0 },
CODEC_OLD_CHANNEL_LAYOUTS(AV_CH_LAYOUT_MONO, AV_CH_LAYOUT_STEREO)
.p.ch_layouts = (const AVChannelLayout []){ AV_CHANNEL_LAYOUT_MONO,
AV_CHANNEL_LAYOUT_STEREO, { 0 } },
.p.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLTP,
Expand Down
7 changes: 0 additions & 7 deletions libavcodec/packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -596,13 +596,6 @@ typedef struct AVPacketList {
#define AV_PKT_FLAG_DISPOSABLE 0x0010

enum AVSideDataParamChangeFlags {
#if FF_API_OLD_CHANNEL_LAYOUT
/**
* @deprecated those are not used by any decoder
*/
AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001,
AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002,
#endif
AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE = 0x0004,
AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS = 0x0008,
};
Expand Down
11 changes: 0 additions & 11 deletions libavcodec/pcm-blurayenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,17 +279,6 @@ const FFCodec ff_pcm_bluray_encoder = {
.init = pcm_bluray_encode_init,
FF_CODEC_ENCODE_CB(pcm_bluray_encode_frame),
.p.supported_samplerates = (const int[]) { 48000, 96000, 192000, 0 },
CODEC_OLD_CHANNEL_LAYOUTS(
AV_CH_LAYOUT_MONO,
AV_CH_LAYOUT_STEREO,
AV_CH_LAYOUT_SURROUND,
AV_CH_LAYOUT_2_1,
AV_CH_LAYOUT_4POINT0,
AV_CH_LAYOUT_2_2,
AV_CH_LAYOUT_5POINT0,
AV_CH_LAYOUT_5POINT1,
AV_CH_LAYOUT_7POINT0,
AV_CH_LAYOUT_7POINT1)
.p.ch_layouts = (const AVChannelLayout[]) {
AV_CHANNEL_LAYOUT_MONO,
AV_CHANNEL_LAYOUT_STEREO,
Expand Down
2 changes: 0 additions & 2 deletions libavcodec/pcm-dvdenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,6 @@ const FFCodec ff_pcm_dvd_encoder = {
.init = pcm_dvd_encode_init,
FF_CODEC_ENCODE_CB(pcm_dvd_encode_frame),
.p.supported_samplerates = (const int[]) { 48000, 96000, 0},
CODEC_OLD_CHANNEL_LAYOUTS(AV_CH_LAYOUT_MONO, AV_CH_LAYOUT_STEREO,
AV_CH_LAYOUT_5POINT1, AV_CH_LAYOUT_7POINT1)
.p.ch_layouts = (const AVChannelLayout[]) { AV_CHANNEL_LAYOUT_MONO,
AV_CHANNEL_LAYOUT_STEREO,
AV_CHANNEL_LAYOUT_5POINT1,
Expand Down
6 changes: 0 additions & 6 deletions libavcodec/pthread_frame.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,6 @@ FF_ENABLE_DEPRECATION_WARNINGS

dst->sample_rate = src->sample_rate;
dst->sample_fmt = src->sample_fmt;
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
dst->channels = src->channels;
dst->channel_layout = src->channel_layout;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
err = av_channel_layout_copy(&dst->ch_layout, &src->ch_layout);
if (err < 0)
return err;
Expand Down
1 change: 0 additions & 1 deletion libavcodec/ra144enc.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,5 @@ const FFCodec ff_ra_144_encoder = {
.p.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
AV_SAMPLE_FMT_NONE },
.p.supported_samplerates = (const int[]){ 8000, 0 },
CODEC_OLD_CHANNEL_LAYOUTS(AV_CH_LAYOUT_MONO)
.p.ch_layouts = (const AVChannelLayout[]){ AV_CHANNEL_LAYOUT_MONO, { 0 } },
};
1 change: 0 additions & 1 deletion libavcodec/sbcdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,6 @@ const FFCodec ff_sbc_decoder = {
.init = sbc_decode_init,
FF_CODEC_DECODE_CB(sbc_decode_frame),
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF,
CODEC_OLD_CHANNEL_LAYOUTS(AV_CH_LAYOUT_MONO, AV_CH_LAYOUT_STEREO)
.p.ch_layouts = (const AVChannelLayout[]) { AV_CHANNEL_LAYOUT_MONO,
AV_CHANNEL_LAYOUT_STEREO,
{ 0 } },
Expand Down
1 change: 0 additions & 1 deletion libavcodec/sbcenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,6 @@ const FFCodec ff_sbc_encoder = {
.priv_data_size = sizeof(SBCEncContext),
.init = sbc_encode_init,
FF_CODEC_ENCODE_CB(sbc_encode_frame),
CODEC_OLD_CHANNEL_LAYOUTS(AV_CH_LAYOUT_MONO, AV_CH_LAYOUT_STEREO)
.p.ch_layouts = (const AVChannelLayout[]) { AV_CHANNEL_LAYOUT_MONO,
AV_CHANNEL_LAYOUT_STEREO,
{ 0 } },
Expand Down
14 changes: 2 additions & 12 deletions libavcodec/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -784,12 +784,7 @@ int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes)
{
int channels = avctx->ch_layout.nb_channels;
int duration;
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
if (!channels)
channels = avctx->channels;
FF_ENABLE_DEPRECATION_WARNINGS
#endif

duration = get_audio_frame_duration(avctx->codec_id, avctx->sample_rate,
channels, avctx->block_align,
avctx->codec_tag, avctx->bits_per_coded_sample,
Expand All @@ -802,12 +797,7 @@ int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes)
{
int channels = par->ch_layout.nb_channels;
int duration;
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
if (!channels)
channels = par->channels;
FF_ENABLE_DEPRECATION_WARNINGS
#endif

duration = get_audio_frame_duration(par->codec_id, par->sample_rate,
channels, par->block_align,
par->codec_tag, par->bits_per_coded_sample,
Expand Down
14 changes: 0 additions & 14 deletions libavcodec/vorbis_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,6 @@ const uint8_t ff_vorbis_channel_layout_offsets[8][8] = {
{ 0, 2, 1, 7, 5, 6, 3, 4 },
};

#if FF_API_OLD_CHANNEL_LAYOUT
const uint64_t ff_vorbis_channel_layouts[9] = {
AV_CH_LAYOUT_MONO,
AV_CH_LAYOUT_STEREO,
AV_CH_LAYOUT_SURROUND,
AV_CH_LAYOUT_QUAD,
AV_CH_LAYOUT_5POINT0_BACK,
AV_CH_LAYOUT_5POINT1_BACK,
AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER,
AV_CH_LAYOUT_7POINT1,
0
};
#endif

const AVChannelLayout ff_vorbis_ch_layouts[9] = {
AV_CHANNEL_LAYOUT_MONO,
AV_CHANNEL_LAYOUT_STEREO,
Expand Down
3 changes: 0 additions & 3 deletions libavcodec/vorbis_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
extern const float ff_vorbis_floor1_inverse_db_table[256];
extern const float * const ff_vorbis_vwin[8];
extern const uint8_t ff_vorbis_channel_layout_offsets[8][8];
#if FF_API_OLD_CHANNEL_LAYOUT
extern const uint64_t ff_vorbis_channel_layouts[9];
#endif
extern const AVChannelLayout ff_vorbis_ch_layouts[9];

#endif /* AVCODEC_VORBIS_DATA_H */
1 change: 0 additions & 1 deletion libavcodec/vorbisdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1890,7 +1890,6 @@ const FFCodec ff_vorbis_decoder = {
.flush = vorbis_decode_flush,
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(ff_vorbis_channel_layouts)
.p.ch_layouts = ff_vorbis_ch_layouts,
.p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE },
Expand Down
5 changes: 0 additions & 5 deletions libavfilter/af_afir.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,11 +508,6 @@ static int config_output(AVFilterLink *outlink)
s->one2many = ctx->inputs[1 + s->selir]->ch_layout.nb_channels == 1;
outlink->sample_rate = ctx->inputs[0]->sample_rate;
outlink->time_base = ctx->inputs[0]->time_base;
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
outlink->channel_layout = ctx->inputs[0]->channel_layout;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
if ((ret = av_channel_layout_copy(&outlink->ch_layout, &ctx->inputs[0]->ch_layout)) < 0)
return ret;
outlink->ch_layout.nb_channels = ctx->inputs[0]->ch_layout.nb_channels;
Expand Down
13 changes: 0 additions & 13 deletions libavfilter/af_aformat.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,21 +103,8 @@ static int parse_channel_layouts(AVFilterContext *ctx)

ret = av_channel_layout_from_string(&fmt, cur);
if (ret < 0) {
#if FF_API_OLD_CHANNEL_LAYOUT
uint64_t mask;
FF_DISABLE_DEPRECATION_WARNINGS
mask = av_get_channel_layout(cur);
if (!mask) {
#endif
av_log(ctx, AV_LOG_ERROR, "Error parsing channel layout: %s.\n", cur);
return AVERROR(EINVAL);
#if FF_API_OLD_CHANNEL_LAYOUT
}
FF_ENABLE_DEPRECATION_WARNINGS
av_log(ctx, AV_LOG_WARNING, "Channel layout '%s' uses a deprecated syntax.\n",
cur);
av_channel_layout_from_mask(&fmt, mask);
#endif
}
ret = ff_add_channel_layout(&s->channel_layouts, &fmt);
av_channel_layout_uninit(&fmt);
Expand Down
6 changes: 0 additions & 6 deletions libavfilter/af_amerge.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,6 @@ static int try_push_frame(AVFilterContext *ctx, int nb_samples)

if ((ret = av_channel_layout_copy(&outbuf->ch_layout, &outlink->ch_layout)) < 0)
return ret;
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
outbuf->channel_layout = outlink->channel_layout;
outbuf->channels = outlink->ch_layout.nb_channels;
FF_ENABLE_DEPRECATION_WARNINGS
#endif

while (nb_samples) {
/* Unroll the most common sample formats: speed +~350% for the loop,
Expand Down
6 changes: 0 additions & 6 deletions libavfilter/af_aresample.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamplesref)

av_frame_copy_props(outsamplesref, insamplesref);
outsamplesref->format = outlink->format;
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
outsamplesref->channels = outlink->ch_layout.nb_channels;
outsamplesref->channel_layout = outlink->channel_layout;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
ret = av_channel_layout_copy(&outsamplesref->ch_layout, &outlink->ch_layout);
if (ret < 0)
return ret;
Expand Down
10 changes: 0 additions & 10 deletions libavfilter/af_ashowinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
{
AVFilterContext *ctx = inlink->dst;
AShowInfoContext *s = ctx->priv;
#if FF_API_OLD_CHANNEL_LAYOUT
AVChannelLayout layout = { 0 };
#endif
char chlayout_str[128];
uint32_t checksum = 0;
int channels = inlink->ch_layout.nb_channels;
Expand All @@ -203,13 +200,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
s->plane_checksums[0];
}

#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
if (av_channel_layout_from_mask(&layout, buf->channel_layout)) {
av_channel_layout_describe(&layout, chlayout_str, sizeof(chlayout_str));
FF_ENABLE_DEPRECATION_WARNINGS
} else if (buf->ch_layout.nb_channels)
#endif
av_channel_layout_describe(&buf->ch_layout, chlayout_str, sizeof(chlayout_str));

av_log(ctx, AV_LOG_INFO,
Expand Down
6 changes: 0 additions & 6 deletions libavfilter/af_channelmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,6 @@ static int channelmap_filter_frame(AVFilterLink *inlink, AVFrame *buf)
memcpy(buf->data, buf->extended_data,
FFMIN(FF_ARRAY_ELEMS(buf->data), nch_out) * sizeof(buf->data[0]));

#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
buf->channels = outlink->ch_layout.nb_channels;
buf->channel_layout = outlink->channel_layout;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
if ((ret = av_channel_layout_copy(&buf->ch_layout, &outlink->ch_layout)) < 0)
return ret;

Expand Down
7 changes: 0 additions & 7 deletions libavfilter/af_channelsplit.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,6 @@ static int filter_frame(AVFilterLink *outlink, AVFrame *buf)
ret = av_channel_layout_from_mask(&buf_out->ch_layout, 1ULL << channel);
if (ret < 0)
return ret;
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
buf_out->channel_layout =
av_channel_layout_extract_channel(buf->channel_layout, s->map[i]);
buf_out->channels = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif

return ff_filter_frame(ctx->outputs[i], buf_out);
}
Expand Down
6 changes: 0 additions & 6 deletions libavfilter/af_join.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,12 +504,6 @@ static int try_push_frame(AVFilterContext *ctx)
av_make_q(1, outlink->sample_rate),
outlink->time_base);

#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
frame->channel_layout = outlink->channel_layout;
frame->channels = outlink->ch_layout.nb_channels;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
if ((ret = av_channel_layout_copy(&frame->ch_layout, &outlink->ch_layout)) < 0)
goto fail;
frame->sample_rate = outlink->sample_rate;
Expand Down
5 changes: 0 additions & 5 deletions libavfilter/af_ladspa.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,11 +402,6 @@ static int config_output(AVFilterLink *outlink)
if (s->nb_inputs == s->nb_outputs) {
if ((ret = av_channel_layout_copy(&outlink->ch_layout, &inlink->ch_layout)) < 0)
return ret;
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
outlink->channel_layout = inlink->channel_layout;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
}

ret = 0;
Expand Down
5 changes: 0 additions & 5 deletions libavfilter/af_lv2.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,6 @@ static int config_output(AVFilterLink *outlink)
int ret;
if ((ret = av_channel_layout_copy(&outlink->ch_layout, &inlink->ch_layout)) < 0)
return ret;
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
outlink->channel_layout = inlink->channel_layout;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
}

} else {
Expand Down
6 changes: 0 additions & 6 deletions libavfilter/af_pan.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,12 +379,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
swr_convert(pan->swr, outsamples->extended_data, n,
(void *)insamples->extended_data, n);
av_frame_copy_props(outsamples, insamples);
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
outsamples->channel_layout = outlink->channel_layout;
outsamples->channels = outlink->ch_layout.nb_channels;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
if ((ret = av_channel_layout_copy(&outsamples->ch_layout, &outlink->ch_layout)) < 0) {
av_frame_free(&outsamples);
av_frame_free(&insamples);
Expand Down
12 changes: 0 additions & 12 deletions libavfilter/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@ AVFrame *ff_default_get_audio_buffer(AVFilterLink *link, int nb_samples)
FilterLinkInternal *const li = ff_link_internal(link);
int channels = link->ch_layout.nb_channels;
int align = av_cpu_max_align();
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
int channel_layout_nb_channels = av_get_channel_layout_nb_channels(link->channel_layout);

av_assert0(channels == channel_layout_nb_channels || !channel_layout_nb_channels);
FF_ENABLE_DEPRECATION_WARNINGS
#endif

if (!li->frame_pool) {
li->frame_pool = ff_frame_pool_audio_init(av_buffer_allocz, channels,
Expand Down Expand Up @@ -89,11 +82,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
return NULL;

frame->nb_samples = nb_samples;
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
frame->channel_layout = link->channel_layout;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
if (link->ch_layout.order != AV_CHANNEL_ORDER_UNSPEC &&
av_channel_layout_copy(&frame->ch_layout, &link->ch_layout) < 0) {
av_frame_free(&frame);
Expand Down
8 changes: 0 additions & 8 deletions libavfilter/avfilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -560,14 +560,6 @@ struct AVFilterLink {
int h; ///< agreed upon image height
AVRational sample_aspect_ratio; ///< agreed upon sample aspect ratio
/* These parameters apply only to audio */
#if FF_API_OLD_CHANNEL_LAYOUT
/**
* channel layout of current buffer (see libavutil/channel_layout.h)
* @deprecated use ch_layout
*/
attribute_deprecated
uint64_t channel_layout;
#endif
int sample_rate; ///< samples per second

int format; ///< agreed upon media format
Expand Down
6 changes: 0 additions & 6 deletions libavfilter/avfiltergraph.c
Original file line number Diff line number Diff line change
Expand Up @@ -733,12 +733,6 @@ static int pick_format(AVFilterLink *link, AVFilterLink *ref)
ret = av_channel_layout_copy(&link->ch_layout, &link->incfg.channel_layouts->channel_layouts[0]);
if (ret < 0)
return ret;
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
link->channel_layout = link->ch_layout.order == AV_CHANNEL_ORDER_NATIVE ?
link->ch_layout.u.mask : 0;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
}

ff_formats_unref(&link->incfg.formats);
Expand Down
70 changes: 1 addition & 69 deletions libavfilter/buffersink.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,6 @@ typedef struct BufferSinkContext {
/* only used for audio */
enum AVSampleFormat *sample_fmts; ///< list of accepted sample formats
int sample_fmts_size;
#if FF_API_OLD_CHANNEL_LAYOUT
int64_t *channel_layouts; ///< list of accepted channel layouts
int channel_layouts_size;
int *channel_counts; ///< list of accepted channel counts
int channel_counts_size;
#endif
char *channel_layouts_str; ///< list of accepted channel layouts
int all_channel_counts;
int *sample_rates; ///< list of accepted sample rates
Expand All @@ -71,31 +65,6 @@ typedef struct BufferSinkContext {

#define NB_ITEMS(list) (list ## _size / sizeof(*list))

#if FF_API_OLD_CHANNEL_LAYOUT
static void cleanup_redundant_layouts(AVFilterContext *ctx)
{
BufferSinkContext *buf = ctx->priv;
int nb_layouts = NB_ITEMS(buf->channel_layouts);
int nb_counts = NB_ITEMS(buf->channel_counts);
uint64_t counts = 0;
int i, lc, n;

for (i = 0; i < nb_counts; i++)
if (buf->channel_counts[i] < 64)
counts |= (uint64_t)1 << buf->channel_counts[i];
for (i = lc = 0; i < nb_layouts; i++) {
n = av_popcount64(buf->channel_layouts[i]);
if (n < 64 && (counts & ((uint64_t)1 << n)))
av_log(ctx, AV_LOG_WARNING,
"Removing channel layout 0x%"PRIx64", redundant with %d channels\n",
buf->channel_layouts[i], n);
else
buf->channel_layouts[lc++] = buf->channel_layouts[i];
}
buf->channel_layouts_size = lc * sizeof(*buf->channel_layouts);
}
#endif

int attribute_align_arg av_buffersink_get_frame(AVFilterContext *ctx, AVFrame *frame)
{
return av_buffersink_get_frame_flags(ctx, frame, 0);
Expand Down Expand Up @@ -216,11 +185,6 @@ MAKE_AVFILTERLINK_ACCESSOR(AVRational , sample_aspect_ratio)
MAKE_AVFILTERLINK_ACCESSOR(enum AVColorSpace, colorspace)
MAKE_AVFILTERLINK_ACCESSOR(enum AVColorRange, color_range)

#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
MAKE_AVFILTERLINK_ACCESSOR(uint64_t , channel_layout )
FF_ENABLE_DEPRECATION_WARNINGS
#endif
MAKE_AVFILTERLINK_ACCESSOR(int , sample_rate )

MAKE_AVFILTERLINK_ACCESSOR(AVBufferRef * , hw_frames_ctx )
Expand Down Expand Up @@ -301,10 +265,6 @@ static int asink_query_formats(AVFilterContext *ctx)

CHECK_LIST_SIZE(sample_fmts)
CHECK_LIST_SIZE(sample_rates)
#if FF_API_OLD_CHANNEL_LAYOUT
CHECK_LIST_SIZE(channel_layouts)
CHECK_LIST_SIZE(channel_counts)
#endif

if (buf->sample_fmts_size) {
for (i = 0; i < NB_ITEMS(buf->sample_fmts); i++)
Expand All @@ -314,32 +274,10 @@ static int asink_query_formats(AVFilterContext *ctx)
return ret;
}

if (
#if FF_API_OLD_CHANNEL_LAYOUT
buf->channel_layouts_size || buf->channel_counts_size ||
#endif
buf->channel_layouts_str || buf->all_channel_counts) {
#if FF_API_OLD_CHANNEL_LAYOUT
cleanup_redundant_layouts(ctx);
for (i = 0; i < NB_ITEMS(buf->channel_layouts); i++)
if ((ret = av_channel_layout_from_mask(&layout, buf->channel_layouts[i])) < 0 ||
(ret = ff_add_channel_layout(&layouts, &layout)) < 0)
return ret;
for (i = 0; i < NB_ITEMS(buf->channel_counts); i++) {
layout = FF_COUNT2LAYOUT(buf->channel_counts[i]);
if ((ret = ff_add_channel_layout(&layouts, &layout)) < 0)
return ret;
}
#endif
if (buf->channel_layouts_str || buf->all_channel_counts) {
if (buf->channel_layouts_str) {
const char *cur = buf->channel_layouts_str;

#if FF_API_OLD_CHANNEL_LAYOUT
if (layouts)
av_log(ctx, AV_LOG_WARNING,
"Conflicting ch_layouts and list of channel_counts/channel_layouts. Ignoring the former\n");
else
#endif
while (cur) {
char *next = strchr(cur, '|');
if (next)
Expand Down Expand Up @@ -395,12 +333,6 @@ static const AVOption buffersink_options[] = {
static const AVOption abuffersink_options[] = {
{ "sample_fmts", "set the supported sample formats", OFFSET(sample_fmts), AV_OPT_TYPE_BINARY, .flags = FLAGS },
{ "sample_rates", "set the supported sample rates", OFFSET(sample_rates), AV_OPT_TYPE_BINARY, .flags = FLAGS },
#if FF_API_OLD_CHANNEL_LAYOUT
{ "channel_layouts", "set the supported channel layouts (deprecated, use ch_layouts)",
OFFSET(channel_layouts), AV_OPT_TYPE_BINARY, .flags = FLAGS | AV_OPT_FLAG_DEPRECATED },
{ "channel_counts", "set the supported channel counts (deprecated, use ch_layouts)",
OFFSET(channel_counts), AV_OPT_TYPE_BINARY, .flags = FLAGS | AV_OPT_FLAG_DEPRECATED },
#endif
{ "ch_layouts", "set a '|'-separated list of supported channel layouts",
OFFSET(channel_layouts_str), AV_OPT_TYPE_STRING, .flags = FLAGS },
{ "all_channel_counts", "accept all channel counts", OFFSET(all_channel_counts), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS },
Expand Down
4 changes: 0 additions & 4 deletions libavfilter/buffersink.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ enum AVColorSpace av_buffersink_get_colorspace (const AVFilterContext *c
enum AVColorRange av_buffersink_get_color_range (const AVFilterContext *ctx);

int av_buffersink_get_channels (const AVFilterContext *ctx);
#if FF_API_OLD_CHANNEL_LAYOUT
attribute_deprecated
uint64_t av_buffersink_get_channel_layout (const AVFilterContext *ctx);
#endif
int av_buffersink_get_ch_layout (const AVFilterContext *ctx,
AVChannelLayout *ch_layout);
int av_buffersink_get_sample_rate (const AVFilterContext *ctx);
Expand Down
44 changes: 2 additions & 42 deletions libavfilter/buffersrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,16 +152,6 @@ int av_buffersrc_parameters_set(AVFilterContext *ctx, AVBufferSrcParameters *par
}
if (param->sample_rate > 0)
s->sample_rate = param->sample_rate;
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
// if the old/new fields are set inconsistently, prefer the old ones
if (param->channel_layout && (param->ch_layout.order != AV_CHANNEL_ORDER_NATIVE ||
param->ch_layout.u.mask != param->channel_layout)) {
av_channel_layout_uninit(&s->ch_layout);
av_channel_layout_from_mask(&s->ch_layout, param->channel_layout);
FF_ENABLE_DEPRECATION_WARNINGS
} else
#endif
if (param->ch_layout.nb_channels) {
int ret = av_channel_layout_copy(&s->ch_layout, &param->ch_layout);
if (ret < 0)
Expand Down Expand Up @@ -206,16 +196,6 @@ int attribute_align_arg av_buffersrc_add_frame_flags(AVFilterContext *ctx, AVFra
AVFrame *copy;
int refcounted, ret;

#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
if (frame && frame->channel_layout &&
av_get_channel_layout_nb_channels(frame->channel_layout) != frame->channels) {
av_log(ctx, AV_LOG_ERROR, "Layout indicates a different number of channels than actually present\n");
return AVERROR(EINVAL);
}
FF_ENABLE_DEPRECATION_WARNINGS
#endif

s->nb_failed_requests = 0;

if (!frame)
Expand All @@ -237,13 +217,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
break;
case AVMEDIA_TYPE_AUDIO:
/* For layouts unknown on input but known on link after negotiation. */
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
if (!frame->channel_layout)
frame->channel_layout = s->ch_layout.order == AV_CHANNEL_ORDER_NATIVE ?
s->ch_layout.u.mask : 0;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
if (frame->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC) {
ret = av_channel_layout_copy(&frame->ch_layout, &s->ch_layout);
if (ret < 0)
Expand Down Expand Up @@ -419,22 +392,9 @@ static av_cold int init_audio(AVFilterContext *ctx)
if (!s->ch_layout.nb_channels) {
ret = av_channel_layout_from_string(&s->ch_layout, s->channel_layout_str);
if (ret < 0) {
#if FF_API_OLD_CHANNEL_LAYOUT
uint64_t mask;
FF_DISABLE_DEPRECATION_WARNINGS
mask = av_get_channel_layout(s->channel_layout_str);
if (!mask) {
#endif
av_log(ctx, AV_LOG_ERROR, "Invalid channel layout %s.\n",
s->channel_layout_str);
return AVERROR(EINVAL);
#if FF_API_OLD_CHANNEL_LAYOUT
}
FF_ENABLE_DEPRECATION_WARNINGS
av_log(ctx, AV_LOG_WARNING, "Channel layout '%s' uses a deprecated syntax.\n",
av_log(ctx, AV_LOG_ERROR, "Invalid channel layout %s.\n",
s->channel_layout_str);
av_channel_layout_from_mask(&s->ch_layout, mask);
#endif
return AVERROR(EINVAL);
}
}

Expand Down
9 changes: 0 additions & 9 deletions libavfilter/buffersrc.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,6 @@ typedef struct AVBufferSrcParameters {
*/
int sample_rate;

#if FF_API_OLD_CHANNEL_LAYOUT
/**
* Audio only, the audio channel layout
* @deprecated use ch_layout
*/
attribute_deprecated
uint64_t channel_layout;
#endif

/**
* Audio only, the audio channel layout
*/
Expand Down
5 changes: 0 additions & 5 deletions libavfilter/f_streamselect.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,6 @@ static int config_output(AVFilterLink *outlink)
case AVMEDIA_TYPE_AUDIO:
outlink->sample_rate = inlink->sample_rate;
outlink->ch_layout.nb_channels = inlink->ch_layout.nb_channels;
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
outlink->channel_layout = inlink->channel_layout;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
break;
}

Expand Down
20 changes: 2 additions & 18 deletions libavfilter/formats.c
Original file line number Diff line number Diff line change
Expand Up @@ -972,24 +972,8 @@ int ff_parse_channel_layout(AVChannelLayout *ret, int *nret, const char *arg,

res = av_channel_layout_from_string(&chlayout, arg);
if (res < 0) {
#if FF_API_OLD_CHANNEL_LAYOUT
int64_t mask;
int nb_channels;
FF_DISABLE_DEPRECATION_WARNINGS
if (av_get_extended_channel_layout(arg, &mask, &nb_channels) < 0) {
#endif
av_log(log_ctx, AV_LOG_ERROR, "Invalid channel layout '%s'\n", arg);
return AVERROR(EINVAL);
#if FF_API_OLD_CHANNEL_LAYOUT
}
FF_ENABLE_DEPRECATION_WARNINGS
av_log(log_ctx, AV_LOG_WARNING, "Channel layout '%s' uses a deprecated syntax.\n",
arg);
if (mask)
av_channel_layout_from_mask(&chlayout, mask);
else
chlayout = (AVChannelLayout) { .order = AV_CHANNEL_ORDER_UNSPEC, .nb_channels = nb_channels };
#endif
av_log(log_ctx, AV_LOG_ERROR, "Invalid channel layout '%s'\n", arg);
return AVERROR(EINVAL);
}

if (chlayout.order == AV_CHANNEL_ORDER_UNSPEC && !nret) {
Expand Down
5 changes: 0 additions & 5 deletions libavfilter/framepool.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,6 @@ AVFrame *ff_frame_pool_get(FFFramePool *pool)
break;
case AVMEDIA_TYPE_AUDIO:
frame->nb_samples = pool->nb_samples;
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
frame->channels = pool->channels;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
frame->ch_layout.nb_channels = pool->channels;
frame->format = pool->format;
frame->linesize[0] = pool->linesize[0];
Expand Down
3 changes: 0 additions & 3 deletions libavfilter/tests/formats.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,6 @@ int main(void)
"65C",
"5.1",
"stereo",
"1+1+1+1",
"1c+1c+1c+1c",
"2c+1c",
"0x3",
};

Expand Down
19 changes: 0 additions & 19 deletions libavformat/demux.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,18 +199,6 @@ static int update_stream_avctx(AVFormatContext *s)
sti->parser = NULL;
}

#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
if (st->codecpar->ch_layout.nb_channels &&
!st->codecpar->channels) {
st->codecpar->channels = st->codecpar->ch_layout.nb_channels;
st->codecpar->channel_layout = st->codecpar->ch_layout.order == AV_CHANNEL_ORDER_NATIVE ?
st->codecpar->ch_layout.u.mask : 0;

}
FF_ENABLE_DEPRECATION_WARNINGS
#endif

/* update internal codec context, for the parser */
ret = avcodec_parameters_to_context(sti->avctx, st->codecpar);
if (ret < 0)
Expand Down Expand Up @@ -1452,13 +1440,6 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
return ret;
st->codecpar->sample_rate = sti->avctx->sample_rate;
st->codecpar->bit_rate = sti->avctx->bit_rate;
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
st->codecpar->channels = sti->avctx->ch_layout.nb_channels;
st->codecpar->channel_layout = sti->avctx->ch_layout.order == AV_CHANNEL_ORDER_NATIVE ?
sti->avctx->ch_layout.u.mask : 0;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
ret = av_channel_layout_copy(&st->codecpar->ch_layout, &sti->avctx->ch_layout);
if (ret < 0)
return ret;
Expand Down
20 changes: 0 additions & 20 deletions libavformat/demux_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,18 +158,6 @@ int ff_add_param_change(AVPacket *pkt, int32_t channels,
if (!pkt)
return AVERROR(EINVAL);

#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
if (channels) {
size += 4;
flags |= AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT;
}
if (channel_layout) {
size += 8;
flags |= AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT;
}
FF_ENABLE_DEPRECATION_WARNINGS
#endif
if (sample_rate) {
size += 4;
flags |= AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE;
Expand All @@ -182,14 +170,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
if (!data)
return AVERROR(ENOMEM);
bytestream_put_le32(&data, flags);
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
if (channels)
bytestream_put_le32(&data, channels);
if (channel_layout)
bytestream_put_le64(&data, channel_layout);
FF_ENABLE_DEPRECATION_WARNINGS
#endif
if (sample_rate)
bytestream_put_le32(&data, sample_rate);
if (width || height) {
Expand Down
17 changes: 1 addition & 16 deletions libavformat/dfpwmdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
typedef struct DFPWMAudioDemuxerContext {
AVClass *class;
int sample_rate;
#if FF_API_OLD_CHANNEL_LAYOUT
int channels;
#endif
AVChannelLayout ch_layout;
} DFPWMAudioDemuxerContext;

Expand All @@ -52,16 +49,9 @@ static int dfpwm_read_header(AVFormatContext *s)
par->codec_type = AVMEDIA_TYPE_AUDIO;
par->codec_id = AV_CODEC_ID_DFPWM;
par->sample_rate = s1->sample_rate;
#if FF_API_OLD_CHANNEL_LAYOUT
if (s1->ch_layout.nb_channels) {
#endif
ret = av_channel_layout_copy(&par->ch_layout, &s1->ch_layout);
if (ret < 0)
return ret;
#if FF_API_OLD_CHANNEL_LAYOUT
} else
par->ch_layout.nb_channels = s1->channels;
#endif
par->bits_per_coded_sample = 1;
par->block_align = 1;

Expand All @@ -71,13 +61,8 @@ static int dfpwm_read_header(AVFormatContext *s)

static const AVOption dfpwm_options[] = {
{ "sample_rate", "", offsetof(DFPWMAudioDemuxerContext, sample_rate), AV_OPT_TYPE_INT, {.i64 = 48000}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
#if FF_API_OLD_CHANNEL_LAYOUT
{ "channels", "", offsetof(DFPWMAudioDemuxerContext, channels), AV_OPT_TYPE_INT, {.i64 = 1}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_DEPRECATED },
{ "ch_layout", "", offsetof(DFPWMAudioDemuxerContext, ch_layout), AV_OPT_TYPE_CHLAYOUT, {.str = NULL}, 0, 0, AV_OPT_FLAG_DECODING_PARAM },
#else
{ "ch_layout", "", offsetof(DFPWMAudioDemuxerContext, ch_layout), AV_OPT_TYPE_CHLAYOUT, {.str = "mono"}, 0, 0, AV_OPT_FLAG_DECODING_PARAM },
#endif
{ NULL },
{ NULL },
};
static const AVClass dfpwm_demuxer_class = {
.class_name = "dfpwm demuxer",
Expand Down
25 changes: 0 additions & 25 deletions libavformat/dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,6 @@ static void dump_paramchange(void *ctx, const AVPacketSideData *sd, int log_leve
int size = sd->size;
const uint8_t *data = sd->data;
uint32_t flags, sample_rate, width, height;
#if FF_API_OLD_CHANNEL_LAYOUT
uint32_t channels;
uint64_t layout;
#endif

if (!data || sd->size < 4)
goto fail;
Expand All @@ -189,27 +185,6 @@ static void dump_paramchange(void *ctx, const AVPacketSideData *sd, int log_leve
data += 4;
size -= 4;

#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) {
if (size < 4)
goto fail;
channels = AV_RL32(data);
data += 4;
size -= 4;
av_log(ctx, log_level, "channel count %"PRIu32", ", channels);
}
if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT) {
if (size < 8)
goto fail;
layout = AV_RL64(data);
data += 8;
size -= 8;
av_log(ctx, log_level,
"channel layout: %s, ", av_get_channel_name(layout));
}
FF_ENABLE_DEPRECATION_WARNINGS
#endif /* FF_API_OLD_CHANNEL_LAYOUT */
if (flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) {
if (size < 4)
goto fail;
Expand Down
16 changes: 0 additions & 16 deletions libavformat/mux.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,22 +233,6 @@ static int init_muxer(AVFormatContext *s, AVDictionary **options)
goto fail;
}

#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
/* if the caller is using the deprecated channel layout API,
* convert it to the new style */
if (!par->ch_layout.nb_channels &&
par->channels) {
if (par->channel_layout) {
av_channel_layout_from_mask(&par->ch_layout, par->channel_layout);
} else {
par->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
par->ch_layout.nb_channels = par->channels;
}
}
FF_ENABLE_DEPRECATION_WARNINGS
#endif

if (!par->block_align)
par->block_align = par->ch_layout.nb_channels *
av_get_bits_per_sample(par->codec_id) >> 3;
Expand Down
4 changes: 0 additions & 4 deletions libavformat/nutdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -969,10 +969,6 @@ static int read_sm_data(AVFormatContext *s, AVIOContext *bc, AVPacket *pkt, int
if (!dst)
return AVERROR(ENOMEM);
bytestream_put_le32(&dst,
#if FF_API_OLD_CHANNEL_LAYOUT
AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT*(!!channels) +
AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT*(!!channel_layout) +
#endif
AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE*(!!sample_rate) +
AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS*(!!(width|height))
);
Expand Down
15 changes: 0 additions & 15 deletions libavformat/nutenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -916,21 +916,6 @@ static int write_sm_data(AVFormatContext *s, AVIOContext *bc, AVPacket *pkt, int
break;
case AV_PKT_DATA_PARAM_CHANGE:
flags = bytestream_get_le32(&data);
#if FF_API_OLD_CHANNEL_LAYOUT
if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) {
put_str(dyn_bc, "Channels");
put_s(dyn_bc, bytestream_get_le32(&data));
sm_data_count++;
}
if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT) {
put_str(dyn_bc, "ChannelLayout");
put_s(dyn_bc, -2);
put_str(dyn_bc, "u64");
put_v(dyn_bc, 8);
avio_write(dyn_bc, data, 8); data+=8;
sm_data_count++;
}
#endif
if (flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) {
put_str(dyn_bc, "SampleRate");
put_s(dyn_bc, bytestream_get_le32(&data));
Expand Down
20 changes: 0 additions & 20 deletions libavformat/pcmdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
typedef struct PCMAudioDemuxerContext {
AVClass *class;
int sample_rate;
#if FF_API_OLD_CHANNEL_LAYOUT
int channels;
#endif
AVChannelLayout ch_layout;
} PCMAudioDemuxerContext;

Expand All @@ -55,16 +52,9 @@ static int pcm_read_header(AVFormatContext *s)
par->codec_type = AVMEDIA_TYPE_AUDIO;
par->codec_id = s->iformat->raw_codec_id;
par->sample_rate = s1->sample_rate;
#if FF_API_OLD_CHANNEL_LAYOUT
if (s1->ch_layout.nb_channels) {
#endif
ret = av_channel_layout_copy(&par->ch_layout, &s1->ch_layout);
if (ret < 0)
return ret;
#if FF_API_OLD_CHANNEL_LAYOUT
} else
par->ch_layout.nb_channels = s1->channels;
#endif

av_opt_get(s->pb, "mime_type", AV_OPT_SEARCH_CHILDREN, &mime_type);
if (mime_type && s->iformat->mime_type) {
Expand Down Expand Up @@ -114,12 +104,7 @@ static int pcm_read_header(AVFormatContext *s)

static const AVOption pcm_options[] = {
{ "sample_rate", "", offsetof(PCMAudioDemuxerContext, sample_rate), AV_OPT_TYPE_INT, {.i64 = 44100}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
#if FF_API_OLD_CHANNEL_LAYOUT
{ "channels", "", offsetof(PCMAudioDemuxerContext, channels), AV_OPT_TYPE_INT, {.i64 = 1}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_DEPRECATED },
{ "ch_layout", "", offsetof(PCMAudioDemuxerContext, ch_layout), AV_OPT_TYPE_CHLAYOUT, {.str = NULL}, 0, 0, AV_OPT_FLAG_DECODING_PARAM },
#else
{ "ch_layout", "", offsetof(PCMAudioDemuxerContext, ch_layout), AV_OPT_TYPE_CHLAYOUT, {.str = "mono"}, 0, 0, AV_OPT_FLAG_DECODING_PARAM },
#endif
{ NULL },
};
static const AVClass pcm_demuxer_class = {
Expand Down Expand Up @@ -180,12 +165,7 @@ PCMDEF(vidc, "PCM Archimedes VIDC", NULL, VIDC)
#if CONFIG_SLN_DEMUXER
static const AVOption sln_options[] = {
{ "sample_rate", "", offsetof(PCMAudioDemuxerContext, sample_rate), AV_OPT_TYPE_INT, {.i64 = 8000}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
#if FF_API_OLD_CHANNEL_LAYOUT
{ "channels", "", offsetof(PCMAudioDemuxerContext, channels), AV_OPT_TYPE_INT, {.i64 = 1}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_DEPRECATED },
{ "ch_layout", "", offsetof(PCMAudioDemuxerContext, ch_layout), AV_OPT_TYPE_CHLAYOUT, {.str = NULL}, 0, 0, AV_OPT_FLAG_DECODING_PARAM },
#else
{ "ch_layout", "", offsetof(PCMAudioDemuxerContext, ch_layout), AV_OPT_TYPE_CHLAYOUT, {.str = "mono"}, 0, 0, AV_OPT_FLAG_DECODING_PARAM },
#endif
{ NULL },
};

Expand Down
192 changes: 0 additions & 192 deletions libavutil/channel_layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,6 @@ static const struct channel_name channel_names[] = {
[AV_CHAN_BOTTOM_FRONT_RIGHT ] = { "BFR", "bottom front right" },
};

static const char *get_channel_name(enum AVChannel channel_id)
{
if ((unsigned) channel_id >= FF_ARRAY_ELEMS(channel_names) ||
!channel_names[channel_id].name)
return NULL;
return channel_names[channel_id].name;
}

void av_channel_name_bprint(AVBPrint *bp, enum AVChannel channel_id)
{
if (channel_id >= AV_CHAN_AMBISONIC_BASE &&
Expand Down Expand Up @@ -214,190 +206,6 @@ static const struct channel_layout_name channel_layout_map[] = {
{ "22.2", AV_CHANNEL_LAYOUT_22POINT2, },
};

#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
static uint64_t get_channel_layout_single(const char *name, int name_len)
{
int i;
char *end;
int64_t layout;

for (i = 0; i < FF_ARRAY_ELEMS(channel_layout_map); i++) {
if (strlen(channel_layout_map[i].name) == name_len &&
!memcmp(channel_layout_map[i].name, name, name_len))
return channel_layout_map[i].layout.u.mask;
}
for (i = 0; i < FF_ARRAY_ELEMS(channel_names); i++)
if (channel_names[i].name &&
strlen(channel_names[i].name) == name_len &&
!memcmp(channel_names[i].name, name, name_len))
return (int64_t)1 << i;

errno = 0;
i = strtol(name, &end, 10);

if (!errno && (end + 1 - name == name_len && *end == 'c'))
return av_get_default_channel_layout(i);

errno = 0;
layout = strtoll(name, &end, 0);
if (!errno && end - name == name_len)
return FFMAX(layout, 0);
return 0;
}

uint64_t av_get_channel_layout(const char *name)
{
const char *n, *e;
const char *name_end = name + strlen(name);
int64_t layout = 0, layout_single;

for (n = name; n < name_end; n = e + 1) {
for (e = n; e < name_end && *e != '+' && *e != '|'; e++);
layout_single = get_channel_layout_single(n, e - n);
if (!layout_single)
return 0;
layout |= layout_single;
}
return layout;
}

int av_get_extended_channel_layout(const char *name, uint64_t* channel_layout, int* nb_channels)
{
int nb = 0;
char *end;
uint64_t layout = av_get_channel_layout(name);

if (layout) {
*channel_layout = layout;
*nb_channels = av_get_channel_layout_nb_channels(layout);
return 0;
}

nb = strtol(name, &end, 10);
if (!errno && *end == 'C' && *(end + 1) == '\0' && nb > 0 && nb < 64) {
*channel_layout = 0;
*nb_channels = nb;
return 0;
}

return AVERROR(EINVAL);
}

void av_bprint_channel_layout(struct AVBPrint *bp,
int nb_channels, uint64_t channel_layout)
{
int i;

if (nb_channels <= 0)
nb_channels = av_get_channel_layout_nb_channels(channel_layout);

for (i = 0; i < FF_ARRAY_ELEMS(channel_layout_map); i++)
if (nb_channels == channel_layout_map[i].layout.nb_channels &&
channel_layout == channel_layout_map[i].layout.u.mask) {
av_bprintf(bp, "%s", channel_layout_map[i].name);
return;
}

av_bprintf(bp, "%d channels", nb_channels);
if (channel_layout) {
int i, ch;
av_bprintf(bp, " (");
for (i = 0, ch = 0; i < 64; i++) {
if ((channel_layout & (UINT64_C(1) << i))) {
const char *name = get_channel_name(i);
if (name) {
if (ch > 0)
av_bprintf(bp, "+");
av_bprintf(bp, "%s", name);
}
ch++;
}
}
av_bprintf(bp, ")");
}
}

void av_get_channel_layout_string(char *buf, int buf_size,
int nb_channels, uint64_t channel_layout)
{
AVBPrint bp;

av_bprint_init_for_buffer(&bp, buf, buf_size);
av_bprint_channel_layout(&bp, nb_channels, channel_layout);
}

int av_get_channel_layout_nb_channels(uint64_t channel_layout)
{
return av_popcount64(channel_layout);
}

int64_t av_get_default_channel_layout(int nb_channels) {
int i;
for (i = 0; i < FF_ARRAY_ELEMS(channel_layout_map); i++)
if (nb_channels == channel_layout_map[i].layout.nb_channels)
return channel_layout_map[i].layout.u.mask;
return 0;
}

int av_get_channel_layout_channel_index(uint64_t channel_layout,
uint64_t channel)
{
if (!(channel_layout & channel) ||
av_get_channel_layout_nb_channels(channel) != 1)
return AVERROR(EINVAL);
channel_layout &= channel - 1;
return av_get_channel_layout_nb_channels(channel_layout);
}

const char *av_get_channel_name(uint64_t channel)
{
int i;
if (av_get_channel_layout_nb_channels(channel) != 1)
return NULL;
for (i = 0; i < 64; i++)
if ((1ULL<<i) & channel)
return get_channel_name(i);
return NULL;
}

const char *av_get_channel_description(uint64_t channel)
{
int i;
if (av_get_channel_layout_nb_channels(channel) != 1)
return NULL;
for (i = 0; i < FF_ARRAY_ELEMS(channel_names); i++)
if ((1ULL<<i) & channel)
return channel_names[i].description;
return NULL;
}

uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index)
{
int i;

if (av_get_channel_layout_nb_channels(channel_layout) <= index)
return 0;

for (i = 0; i < 64; i++) {
if ((1ULL << i) & channel_layout && !index--)
return 1ULL << i;
}
return 0;
}

int av_get_standard_channel_layout(unsigned index, uint64_t *layout,
const char **name)
{
if (index >= FF_ARRAY_ELEMS(channel_layout_map))
return AVERROR_EOF;
if (layout) *layout = channel_layout_map[index].layout.u.mask;
if (name) *name = channel_layout_map[index].name;
return 0;
}
FF_ENABLE_DEPRECATION_WARNINGS
#endif

int av_channel_layout_custom_init(AVChannelLayout *channel_layout, int nb_channels)
{
AVChannelCustom *map;
Expand Down
150 changes: 0 additions & 150 deletions libavutil/channel_layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,6 @@ enum AVChannelOrder {
#define AV_CH_BOTTOM_FRONT_LEFT (1ULL << AV_CHAN_BOTTOM_FRONT_LEFT )
#define AV_CH_BOTTOM_FRONT_RIGHT (1ULL << AV_CHAN_BOTTOM_FRONT_RIGHT )

#if FF_API_OLD_CHANNEL_LAYOUT
/** Channel mask value used for AVCodecContext.request_channel_layout
to indicate that the user requests the channel order of the decoder output
to be the native codec channel order.
@deprecated channel order is now indicated in a special field in
AVChannelLayout
*/
#define AV_CH_LAYOUT_NATIVE 0x8000000000000000ULL
#endif

/**
* @}
* @defgroup channel_mask_c Audio channel layouts
Expand Down Expand Up @@ -434,146 +424,6 @@ typedef struct AVChannelLayout {

struct AVBPrint;

#if FF_API_OLD_CHANNEL_LAYOUT
/**
* @name Deprecated Functions
* @{
*/

/**
* Return a channel layout id that matches name, or 0 if no match is found.
*
* name can be one or several of the following notations,
* separated by '+' or '|':
* - the name of an usual channel layout (mono, stereo, 4.0, quad, 5.0,
* 5.0(side), 5.1, 5.1(side), 7.1, 7.1(wide), downmix);
* - the name of a single channel (FL, FR, FC, LFE, BL, BR, FLC, FRC, BC,
* SL, SR, TC, TFL, TFC, TFR, TBL, TBC, TBR, DL, DR);
* - a number of channels, in decimal, followed by 'c', yielding
* the default channel layout for that number of channels (@see
* av_get_default_channel_layout);
* - a channel layout mask, in hexadecimal starting with "0x" (see the
* AV_CH_* macros).
*
* Example: "stereo+FC" = "2c+FC" = "2c+1c" = "0x7"
*
* @deprecated use av_channel_layout_from_string()
*/
attribute_deprecated
uint64_t av_get_channel_layout(const char *name);

/**
* Return a channel layout and the number of channels based on the specified name.
*
* This function is similar to (@see av_get_channel_layout), but can also parse
* unknown channel layout specifications.
*
* @param[in] name channel layout specification string
* @param[out] channel_layout parsed channel layout (0 if unknown)
* @param[out] nb_channels number of channels
*
* @return 0 on success, AVERROR(EINVAL) if the parsing fails.
* @deprecated use av_channel_layout_from_string()
*/
attribute_deprecated
int av_get_extended_channel_layout(const char *name, uint64_t* channel_layout, int* nb_channels);

/**
* Return a description of a channel layout.
* If nb_channels is <= 0, it is guessed from the channel_layout.
*
* @param buf put here the string containing the channel layout
* @param buf_size size in bytes of the buffer
* @param nb_channels number of channels
* @param channel_layout channel layout bitset
* @deprecated use av_channel_layout_describe()
*/
attribute_deprecated
void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout);

/**
* Append a description of a channel layout to a bprint buffer.
* @deprecated use av_channel_layout_describe()
*/
attribute_deprecated
void av_bprint_channel_layout(struct AVBPrint *bp, int nb_channels, uint64_t channel_layout);

/**
* Return the number of channels in the channel layout.
* @deprecated use AVChannelLayout.nb_channels
*/
attribute_deprecated
int av_get_channel_layout_nb_channels(uint64_t channel_layout);

/**
* Return default channel layout for a given number of channels.
*
* @deprecated use av_channel_layout_default()
*/
attribute_deprecated
int64_t av_get_default_channel_layout(int nb_channels);

/**
* Get the index of a channel in channel_layout.
*
* @param channel_layout channel layout bitset
* @param channel a channel layout describing exactly one channel which must be
* present in channel_layout.
*
* @return index of channel in channel_layout on success, a negative AVERROR
* on error.
*
* @deprecated use av_channel_layout_index_from_channel()
*/
attribute_deprecated
int av_get_channel_layout_channel_index(uint64_t channel_layout,
uint64_t channel);

/**
* Get the channel with the given index in channel_layout.
* @deprecated use av_channel_layout_channel_from_index()
*/
attribute_deprecated
uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index);

/**
* Get the name of a given channel.
*
* @return channel name on success, NULL on error.
*
* @deprecated use av_channel_name()
*/
attribute_deprecated
const char *av_get_channel_name(uint64_t channel);

/**
* Get the description of a given channel.
*
* @param channel a channel layout with a single channel
* @return channel description on success, NULL on error
* @deprecated use av_channel_description()
*/
attribute_deprecated
const char *av_get_channel_description(uint64_t channel);

/**
* Get the value and name of a standard channel layout.
*
* @param[in] index index in an internal list, starting at 0
* @param[out] layout channel layout mask
* @param[out] name name of the layout
* @return 0 if the layout exists,
* <0 if index is beyond the limits
* @deprecated use av_channel_layout_standard()
*/
attribute_deprecated
int av_get_standard_channel_layout(unsigned index, uint64_t *layout,
const char **name);
/**
* @}
*/
#endif

/**
* Get a human readable string in an abbreviated form describing a given channel.
* This is the inverse function of @ref av_channel_from_string().
Expand Down
127 changes: 6 additions & 121 deletions libavutil/frame.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@
#include "samplefmt.h"
#include "hwcontext.h"

#if FF_API_OLD_CHANNEL_LAYOUT
#define CHECK_CHANNELS_CONSISTENCY(frame) \
av_assert2(!(frame)->channel_layout || \
(frame)->channels == \
av_get_channel_layout_nb_channels((frame)->channel_layout))
#endif

static void get_frame_defaults(AVFrame *frame)
{
memset(frame, 0, sizeof(*frame));
Expand Down Expand Up @@ -181,21 +174,6 @@ static int get_audio_buffer(AVFrame *frame, int align)
int channels, planes;
int ret;

#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
if (!frame->ch_layout.nb_channels) {
if (frame->channel_layout) {
av_channel_layout_from_mask(&frame->ch_layout, frame->channel_layout);
} else {
frame->ch_layout.nb_channels = frame->channels;
frame->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
}
}
frame->channels = frame->ch_layout.nb_channels;
frame->channel_layout = frame->ch_layout.order == AV_CHANNEL_ORDER_NATIVE ?
frame->ch_layout.u.mask : 0;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
channels = frame->ch_layout.nb_channels;
planes = planar ? channels : 1;
if (!frame->linesize[0]) {
Expand Down Expand Up @@ -245,17 +223,11 @@ int av_frame_get_buffer(AVFrame *frame, int align)
if (frame->format < 0)
return AVERROR(EINVAL);

FF_DISABLE_DEPRECATION_WARNINGS
if (frame->width > 0 && frame->height > 0)
return get_video_buffer(frame, align);
else if (frame->nb_samples > 0 &&
(av_channel_layout_check(&frame->ch_layout)
#if FF_API_OLD_CHANNEL_LAYOUT
|| frame->channel_layout || frame->channels > 0
#endif
))
(av_channel_layout_check(&frame->ch_layout)))
return get_audio_buffer(frame, align);
FF_ENABLE_DEPRECATION_WARNINGS

return AVERROR(EINVAL);
}
Expand Down Expand Up @@ -363,43 +335,21 @@ int av_frame_ref(AVFrame *dst, const AVFrame *src)
int ret = 0;

av_assert1(dst->width == 0 && dst->height == 0);
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
av_assert1(dst->channels == 0);
FF_ENABLE_DEPRECATION_WARNINGS
#endif
av_assert1(dst->ch_layout.nb_channels == 0 &&
dst->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC);

dst->format = src->format;
dst->width = src->width;
dst->height = src->height;
dst->nb_samples = src->nb_samples;
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
dst->channels = src->channels;
dst->channel_layout = src->channel_layout;
if (!av_channel_layout_check(&src->ch_layout)) {
if (src->channel_layout)
av_channel_layout_from_mask(&dst->ch_layout, src->channel_layout);
else {
dst->ch_layout.nb_channels = src->channels;
dst->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
}
}
FF_ENABLE_DEPRECATION_WARNINGS
#endif

ret = frame_copy_props(dst, src, 0);
if (ret < 0)
goto fail;

// this check is needed only until FF_API_OLD_CHANNEL_LAYOUT is out
if (av_channel_layout_check(&src->ch_layout)) {
ret = av_channel_layout_copy(&dst->ch_layout, &src->ch_layout);
if (ret < 0)
goto fail;
}
ret = av_channel_layout_copy(&dst->ch_layout, &src->ch_layout);
if (ret < 0)
goto fail;

/* duplicate the frame data if it's not refcounted */
if (!src->buf[0]) {
Expand Down Expand Up @@ -503,27 +453,10 @@ int av_frame_replace(AVFrame *dst, const AVFrame *src)
dst->width = src->width;
dst->height = src->height;
dst->nb_samples = src->nb_samples;
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
dst->channels = src->channels;
dst->channel_layout = src->channel_layout;
if (!av_channel_layout_check(&src->ch_layout)) {
av_channel_layout_uninit(&dst->ch_layout);
if (src->channel_layout)
av_channel_layout_from_mask(&dst->ch_layout, src->channel_layout);
else {
dst->ch_layout.nb_channels = src->channels;
dst->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
}
} else {
#endif

ret = av_channel_layout_copy(&dst->ch_layout, &src->ch_layout);
if (ret < 0)
goto fail;
#if FF_API_OLD_CHANNEL_LAYOUT
}
FF_ENABLE_DEPRECATION_WARNINGS
#endif

wipe_side_data(dst);
av_dict_free(&dst->metadata);
Expand Down Expand Up @@ -649,11 +582,6 @@ void av_frame_unref(AVFrame *frame)
void av_frame_move_ref(AVFrame *dst, AVFrame *src)
{
av_assert1(dst->width == 0 && dst->height == 0);
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
av_assert1(dst->channels == 0);
FF_ENABLE_DEPRECATION_WARNINGS
#endif
av_assert1(dst->ch_layout.nb_channels == 0 &&
dst->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC);

Expand Down Expand Up @@ -692,12 +620,6 @@ int av_frame_make_writable(AVFrame *frame)
tmp.format = frame->format;
tmp.width = frame->width;
tmp.height = frame->height;
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
tmp.channels = frame->channels;
tmp.channel_layout = frame->channel_layout;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
tmp.nb_samples = frame->nb_samples;
ret = av_channel_layout_copy(&tmp.ch_layout, &frame->ch_layout);
if (ret < 0) {
Expand Down Expand Up @@ -745,15 +667,6 @@ AVBufferRef *av_frame_get_plane_buffer(const AVFrame *frame, int plane)

if (frame->nb_samples) {
int channels = frame->ch_layout.nb_channels;

#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
if (!channels) {
channels = frame->channels;
CHECK_CHANNELS_CONSISTENCY(frame);
}
FF_ENABLE_DEPRECATION_WARNINGS
#endif
if (!channels)
return NULL;
planes = av_sample_fmt_is_planar(frame->format) ? channels : 1;
Expand Down Expand Up @@ -860,30 +773,8 @@ static int frame_copy_audio(AVFrame *dst, const AVFrame *src)
int channels = dst->ch_layout.nb_channels;
int planes = planar ? channels : 1;

#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
if (!channels || !src->ch_layout.nb_channels) {
if (dst->channels != src->channels ||
dst->channel_layout != src->channel_layout)
return AVERROR(EINVAL);
CHECK_CHANNELS_CONSISTENCY(src);
}
if (!channels) {
channels = dst->channels;
planes = planar ? channels : 1;
}
FF_ENABLE_DEPRECATION_WARNINGS
#endif

if (dst->nb_samples != src->nb_samples ||
#if FF_API_OLD_CHANNEL_LAYOUT
(av_channel_layout_check(&dst->ch_layout) &&
av_channel_layout_check(&src->ch_layout) &&
#endif
av_channel_layout_compare(&dst->ch_layout, &src->ch_layout))
#if FF_API_OLD_CHANNEL_LAYOUT
)
#endif
return AVERROR(EINVAL);

for (int i = 0; i < planes; i++)
Expand All @@ -901,17 +792,11 @@ int av_frame_copy(AVFrame *dst, const AVFrame *src)
if (dst->format != src->format || dst->format < 0)
return AVERROR(EINVAL);

FF_DISABLE_DEPRECATION_WARNINGS
if (dst->width > 0 && dst->height > 0)
return frame_copy_video(dst, src);
else if (dst->nb_samples > 0 &&
(av_channel_layout_check(&dst->ch_layout)
#if FF_API_OLD_CHANNEL_LAYOUT
|| dst->channels > 0
#endif
))
(av_channel_layout_check(&dst->ch_layout)))
return frame_copy_audio(dst, src);
FF_ENABLE_DEPRECATION_WARNINGS

return AVERROR(EINVAL);
}
Expand Down
20 changes: 0 additions & 20 deletions libavutil/frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -566,15 +566,6 @@ typedef struct AVFrame {
*/
int sample_rate;

#if FF_API_OLD_CHANNEL_LAYOUT
/**
* Channel layout of the audio data.
* @deprecated use ch_layout instead
*/
attribute_deprecated
uint64_t channel_layout;
#endif

/**
* AVBuffer references backing the data for this frame. All the pointers in
* data and extended_data must point inside one of the buffers in buf or
Expand Down Expand Up @@ -720,17 +711,6 @@ typedef struct AVFrame {
#define FF_DECODE_ERROR_CONCEALMENT_ACTIVE 4
#define FF_DECODE_ERROR_DECODE_SLICES 8

#if FF_API_OLD_CHANNEL_LAYOUT
/**
* number of audio channels, only used for audio.
* - encoding: unused
* - decoding: Read by user.
* @deprecated use ch_layout instead
*/
attribute_deprecated
int channels;
#endif

#if FF_API_FRAME_PKT
/**
* size of the corresponding packet containing the compressed
Expand Down
110 changes: 0 additions & 110 deletions libavutil/opt.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ static int read_number(const AVOption *o, const void *dst, double *num, int *den
case AV_OPT_TYPE_INT:
*intnum = *(int *)dst;
return 0;
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
case AV_OPT_TYPE_CHANNEL_LAYOUT:
FF_ENABLE_DEPRECATION_WARNINGS
#endif
case AV_OPT_TYPE_DURATION:
case AV_OPT_TYPE_INT64:
case AV_OPT_TYPE_UINT64:
Expand Down Expand Up @@ -131,11 +126,6 @@ static int write_number(void *obj, const AVOption *o, void *dst, double num, int
*(int *)dst = llrint(num / den) * intnum;
break;
case AV_OPT_TYPE_DURATION:
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
case AV_OPT_TYPE_CHANNEL_LAYOUT:
FF_ENABLE_DEPRECATION_WARNINGS
#endif
case AV_OPT_TYPE_INT64:{
double d = num / den;
if (intnum == 1 && d == (double)INT64_MAX) {
Expand Down Expand Up @@ -506,9 +496,6 @@ FF_DISABLE_DEPRECATION_WARNINGS
o->type != AV_OPT_TYPE_PIXEL_FMT && o->type != AV_OPT_TYPE_SAMPLE_FMT &&
o->type != AV_OPT_TYPE_IMAGE_SIZE &&
o->type != AV_OPT_TYPE_DURATION && o->type != AV_OPT_TYPE_COLOR &&
#if FF_API_OLD_CHANNEL_LAYOUT
o->type != AV_OPT_TYPE_CHANNEL_LAYOUT &&
#endif
o->type != AV_OPT_TYPE_BOOL))
return AVERROR(EINVAL);
FF_ENABLE_DEPRECATION_WARNINGS
Expand Down Expand Up @@ -567,23 +554,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
}
case AV_OPT_TYPE_COLOR:
return set_string_color(obj, o, val, dst);
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
case AV_OPT_TYPE_CHANNEL_LAYOUT:
if (!val || !strcmp(val, "none")) {
*(int64_t *)dst = 0;
} else {
int64_t cl = av_get_channel_layout(val);
if (!cl) {
av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as channel layout\n", val);
ret = AVERROR(EINVAL);
}
*(int64_t *)dst = cl;
return ret;
}
break;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
case AV_OPT_TYPE_CHLAYOUT:
ret = set_string_channel_layout(obj, o, val, dst);
if (ret < 0) {
Expand Down Expand Up @@ -754,26 +724,6 @@ int av_opt_set_sample_fmt(void *obj, const char *name, enum AVSampleFormat fmt,
return set_format(obj, name, fmt, search_flags, AV_OPT_TYPE_SAMPLE_FMT, "sample", AV_SAMPLE_FMT_NB);
}

#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
int av_opt_set_channel_layout(void *obj, const char *name, int64_t cl, int search_flags)
{
void *target_obj;
const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);

if (!o || !target_obj)
return AVERROR_OPTION_NOT_FOUND;
if (o->type != AV_OPT_TYPE_CHANNEL_LAYOUT) {
av_log(obj, AV_LOG_ERROR,
"The value set by option '%s' is not a channel layout.\n", o->name);
return AVERROR(EINVAL);
}
*(int64_t *)(((uint8_t *)target_obj) + o->offset) = cl;
return 0;
}
FF_ENABLE_DEPRECATION_WARNINGS
#endif

int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val,
int search_flags)
{
Expand Down Expand Up @@ -937,15 +887,6 @@ int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
(int)((uint8_t *)dst)[0], (int)((uint8_t *)dst)[1],
(int)((uint8_t *)dst)[2], (int)((uint8_t *)dst)[3]);
break;
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
case AV_OPT_TYPE_CHANNEL_LAYOUT:

i64 = *(int64_t *)dst;
ret = snprintf(buf, sizeof(buf), "0x%"PRIx64, i64);
break;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
case AV_OPT_TYPE_CHLAYOUT:
ret = av_channel_layout_describe(dst, buf, sizeof(buf));
break;
Expand Down Expand Up @@ -1083,27 +1024,6 @@ int av_opt_get_sample_fmt(void *obj, const char *name, int search_flags, enum AV
return get_format(obj, name, search_flags, out_fmt, AV_OPT_TYPE_SAMPLE_FMT, "sample");
}

#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
int av_opt_get_channel_layout(void *obj, const char *name, int search_flags, int64_t *cl)
{
void *dst, *target_obj;
const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
if (!o || !target_obj)
return AVERROR_OPTION_NOT_FOUND;
if (o->type != AV_OPT_TYPE_CHANNEL_LAYOUT) {
av_log(obj, AV_LOG_ERROR,
"The value for option '%s' is not a channel layout.\n", name);
return AVERROR(EINVAL);
}

dst = ((uint8_t*)target_obj) + o->offset;
*cl = *(int64_t *)dst;
return 0;
}
FF_ENABLE_DEPRECATION_WARNINGS
#endif

int av_opt_get_chlayout(void *obj, const char *name, int search_flags, AVChannelLayout *cl)
{
void *dst, *target_obj;
Expand Down Expand Up @@ -1254,9 +1174,6 @@ static void log_type(void *av_log_obj, const AVOption *o,
[AV_OPT_TYPE_SAMPLE_FMT] = "<sample_fmt>",
[AV_OPT_TYPE_DURATION] = "<duration>",
[AV_OPT_TYPE_COLOR] = "<color>",
#if FF_API_OLD_CHANNEL_LAYOUT
[AV_OPT_TYPE_CHANNEL_LAYOUT]= "<channel_layout>",
#endif
[AV_OPT_TYPE_CHLAYOUT] = "<channel_layout>",
[AV_OPT_TYPE_BOOL] = "<boolean>",
};
Expand Down Expand Up @@ -1335,13 +1252,6 @@ static void log_default(void *obj, void *av_log_obj, const AVOption *opt)
case AV_OPT_TYPE_CHLAYOUT:
av_log(av_log_obj, AV_LOG_INFO, "\"%s\"", opt->default_val.str);
break;
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
case AV_OPT_TYPE_CHANNEL_LAYOUT:
av_log(av_log_obj, AV_LOG_INFO, "0x%"PRIx64, opt->default_val.i64);
break;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
}
av_log(av_log_obj, AV_LOG_INFO, ")");
}
Expand Down Expand Up @@ -1459,11 +1369,6 @@ void av_opt_set_defaults2(void *s, int mask, int flags)
case AV_OPT_TYPE_INT64:
case AV_OPT_TYPE_UINT64:
case AV_OPT_TYPE_DURATION:
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
case AV_OPT_TYPE_CHANNEL_LAYOUT:
FF_ENABLE_DEPRECATION_WARNINGS
#endif
case AV_OPT_TYPE_PIXEL_FMT:
case AV_OPT_TYPE_SAMPLE_FMT:
write_number(s, opt, dst, 1, 1, opt->default_val.i64);
Expand Down Expand Up @@ -1827,11 +1732,6 @@ static int opt_size(enum AVOptionType type)
case AV_OPT_TYPE_FLAGS:
return sizeof(int);
case AV_OPT_TYPE_DURATION:
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
case AV_OPT_TYPE_CHANNEL_LAYOUT:
FF_ENABLE_DEPRECATION_WARNINGS
#endif
case AV_OPT_TYPE_INT64:
case AV_OPT_TYPE_UINT64:
return sizeof(int64_t);
Expand Down Expand Up @@ -1971,11 +1871,6 @@ int av_opt_query_ranges_default(AVOptionRanges **ranges_arg, void *obj, const ch
case AV_OPT_TYPE_DOUBLE:
case AV_OPT_TYPE_DURATION:
case AV_OPT_TYPE_COLOR:
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
case AV_OPT_TYPE_CHANNEL_LAYOUT:
FF_ENABLE_DEPRECATION_WARNINGS
#endif
break;
case AV_OPT_TYPE_STRING:
range->component_min = 0;
Expand Down Expand Up @@ -2054,11 +1949,6 @@ int av_opt_is_set_to_default(void *obj, const AVOption *o)
case AV_OPT_TYPE_PIXEL_FMT:
case AV_OPT_TYPE_SAMPLE_FMT:
case AV_OPT_TYPE_INT:
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
case AV_OPT_TYPE_CHANNEL_LAYOUT:
FF_ENABLE_DEPRECATION_WARNINGS
#endif
case AV_OPT_TYPE_DURATION:
case AV_OPT_TYPE_INT64:
case AV_OPT_TYPE_UINT64:
Expand Down
11 changes: 0 additions & 11 deletions libavutil/opt.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,6 @@ enum AVOptionType{
AV_OPT_TYPE_VIDEO_RATE, ///< offset must point to AVRational
AV_OPT_TYPE_DURATION,
AV_OPT_TYPE_COLOR,
#if FF_API_OLD_CHANNEL_LAYOUT
AV_OPT_TYPE_CHANNEL_LAYOUT,
#endif
AV_OPT_TYPE_BOOL,
AV_OPT_TYPE_CHLAYOUT,
};
Expand Down Expand Up @@ -723,10 +720,6 @@ int av_opt_set_image_size(void *obj, const char *name, int w, int h, int search_
int av_opt_set_pixel_fmt (void *obj, const char *name, enum AVPixelFormat fmt, int search_flags);
int av_opt_set_sample_fmt(void *obj, const char *name, enum AVSampleFormat fmt, int search_flags);
int av_opt_set_video_rate(void *obj, const char *name, AVRational val, int search_flags);
#if FF_API_OLD_CHANNEL_LAYOUT
attribute_deprecated
int av_opt_set_channel_layout(void *obj, const char *name, int64_t ch_layout, int search_flags);
#endif
int av_opt_set_chlayout(void *obj, const char *name, const AVChannelLayout *layout, int search_flags);
/**
* @note Any old dictionary present is discarded and replaced with a copy of the new one. The
Expand Down Expand Up @@ -788,10 +781,6 @@ int av_opt_get_image_size(void *obj, const char *name, int search_flags, int *w_
int av_opt_get_pixel_fmt (void *obj, const char *name, int search_flags, enum AVPixelFormat *out_fmt);
int av_opt_get_sample_fmt(void *obj, const char *name, int search_flags, enum AVSampleFormat *out_fmt);
int av_opt_get_video_rate(void *obj, const char *name, int search_flags, AVRational *out_val);
#if FF_API_OLD_CHANNEL_LAYOUT
attribute_deprecated
int av_opt_get_channel_layout(void *obj, const char *name, int search_flags, int64_t *ch_layout);
#endif
int av_opt_get_chlayout(void *obj, const char *name, int search_flags, AVChannelLayout *layout);
/**
* @param[out] out_val The returned dictionary is a copy of the actual value and must
Expand Down
1 change: 0 additions & 1 deletion libavutil/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@
* @{
*/

#define FF_API_OLD_CHANNEL_LAYOUT (LIBAVUTIL_VERSION_MAJOR < 59)
#define FF_API_AV_FOPEN_UTF8 (LIBAVUTIL_VERSION_MAJOR < 59)
#define FF_API_PKT_DURATION (LIBAVUTIL_VERSION_MAJOR < 59)
#define FF_API_REORDERED_OPAQUE (LIBAVUTIL_VERSION_MAJOR < 59)
Expand Down
22 changes: 0 additions & 22 deletions libswresample/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,6 @@
#define DEPREC AV_OPT_FLAG_DEPRECATED

static const AVOption options[]={
#if FF_API_OLD_CHANNEL_LAYOUT
{"ich" , "set input channel count (Deprecated, use ichl)",
OFFSET(user_in_ch_count ), AV_OPT_TYPE_INT, {.i64=0 }, 0 , SWR_CH_MAX, PARAM|DEPREC},
{"in_channel_count" , "set input channel count (Deprecated, use in_chlayout)",
OFFSET(user_in_ch_count ), AV_OPT_TYPE_INT, {.i64=0 }, 0 , SWR_CH_MAX, PARAM|DEPREC},
{"och" , "set output channel count (Deprecated, use ochl)",
OFFSET(user_out_ch_count ), AV_OPT_TYPE_INT, {.i64=0 }, 0 , SWR_CH_MAX, PARAM|DEPREC},
{"out_channel_count" , "set output channel count (Deprecated, use out_chlayout)",
OFFSET(user_out_ch_count ), AV_OPT_TYPE_INT, {.i64=0 }, 0 , SWR_CH_MAX, PARAM|DEPREC},
{"uch" , "set used channel count" , OFFSET(user_used_ch_count), AV_OPT_TYPE_INT, {.i64=0 }, 0 , SWR_CH_MAX, PARAM|DEPREC},
{"used_channel_count" , "set used channel count" , OFFSET(user_used_ch_count), AV_OPT_TYPE_INT, {.i64=0 }, 0 , SWR_CH_MAX, PARAM|DEPREC},
#endif
{"isr" , "set input sample rate" , OFFSET( in_sample_rate), AV_OPT_TYPE_INT , {.i64=0 }, 0 , INT_MAX , PARAM},
{"in_sample_rate" , "set input sample rate" , OFFSET( in_sample_rate), AV_OPT_TYPE_INT , {.i64=0 }, 0 , INT_MAX , PARAM},
{"osr" , "set output sample rate" , OFFSET(out_sample_rate), AV_OPT_TYPE_INT , {.i64=0 }, 0 , INT_MAX , PARAM},
Expand All @@ -59,16 +47,6 @@ static const AVOption options[]={
{"out_sample_fmt" , "set output sample format" , OFFSET(out_sample_fmt ), AV_OPT_TYPE_SAMPLE_FMT , {.i64=AV_SAMPLE_FMT_NONE}, -1 , INT_MAX, PARAM},
{"tsf" , "set internal sample format" , OFFSET(user_int_sample_fmt), AV_OPT_TYPE_SAMPLE_FMT , {.i64=AV_SAMPLE_FMT_NONE}, -1 , INT_MAX, PARAM},
{"internal_sample_fmt" , "set internal sample format" , OFFSET(user_int_sample_fmt), AV_OPT_TYPE_SAMPLE_FMT , {.i64=AV_SAMPLE_FMT_NONE}, -1 , INT_MAX, PARAM},
#if FF_API_OLD_CHANNEL_LAYOUT
{"icl" , "set input channel layout (Deprecated, use ichl)",
OFFSET(user_in_ch_layout), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=0 }, INT64_MIN, INT64_MAX, PARAM|DEPREC, .unit = "channel_layout"},
{"in_channel_layout" , "set input channel layout (Deprecated, use in_chlayout)",
OFFSET(user_in_ch_layout), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=0 }, INT64_MIN, INT64_MAX, PARAM|DEPREC, .unit = "channel_layout"},
{"ocl" , "set output channel layout (Deprecated, use ochl)",
OFFSET(user_out_ch_layout), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=0 }, INT64_MIN, INT64_MAX, PARAM|DEPREC, .unit = "channel_layout"},
{"out_channel_layout" , "set output channel layout (Deprecated, use out_chlayout)",
OFFSET(user_out_ch_layout), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=0 }, INT64_MIN, INT64_MAX, PARAM|DEPREC, .unit = "channel_layout"},
#endif
{"ichl" , "set input channel layout" , OFFSET(user_in_chlayout ), AV_OPT_TYPE_CHLAYOUT, {.str=NULL }, 0, 0 , PARAM, .unit = "chlayout"},
{"in_chlayout" , "set input channel layout" , OFFSET(user_in_chlayout ), AV_OPT_TYPE_CHLAYOUT, {.str=NULL }, 0, 0 , PARAM, .unit = "chlayout"},
{"ochl" , "set output channel layout" , OFFSET(user_out_chlayout), AV_OPT_TYPE_CHLAYOUT, {.str=NULL }, 0, 0 , PARAM, .unit = "chlayout"},
Expand Down
48 changes: 2 additions & 46 deletions libswresample/rematrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,37 +64,14 @@
int swr_set_matrix(struct SwrContext *s, const double *matrix, int stride)
{
int nb_in, nb_out, in, out;
int user_in_chlayout_nb_channels, user_out_chlayout_nb_channels;

if (!s || s->in_convert) // s needs to be allocated but not initialized
return AVERROR(EINVAL);
memset(s->matrix, 0, sizeof(s->matrix));
memset(s->matrix_flt, 0, sizeof(s->matrix_flt));

#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
user_in_chlayout_nb_channels = av_get_channel_layout_nb_channels(s->user_in_ch_layout);
FF_ENABLE_DEPRECATION_WARNINGS
if (!user_in_chlayout_nb_channels)
#endif
user_in_chlayout_nb_channels = s->user_in_chlayout.nb_channels;
nb_in =
#if FF_API_OLD_CHANNEL_LAYOUT
(s->user_in_ch_count > 0) ? s->user_in_ch_count :
#endif
user_in_chlayout_nb_channels;
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
user_out_chlayout_nb_channels = av_get_channel_layout_nb_channels(s->user_out_ch_layout);
FF_ENABLE_DEPRECATION_WARNINGS
if (!user_out_chlayout_nb_channels)
#endif
user_out_chlayout_nb_channels = s->user_out_chlayout.nb_channels;
nb_out =
#if FF_API_OLD_CHANNEL_LAYOUT
(s->user_out_ch_count > 0) ? s->user_out_ch_count :
#endif
user_out_chlayout_nb_channels;
nb_in = s->user_in_chlayout.nb_channels;
nb_out = s->user_out_chlayout.nb_channels;
for (out = 0; out < nb_out; out++) {
for (in = 0; in < nb_in; in++)
s->matrix_flt[out][in] = s->matrix[out][in] = matrix[in];
Expand Down Expand Up @@ -146,27 +123,6 @@ static int sane_layout(AVChannelLayout *ch_layout) {
return 1;
}

#if FF_API_OLD_CHANNEL_LAYOUT
av_cold int swr_build_matrix(uint64_t in_ch_layout_param, uint64_t out_ch_layout_param,
double center_mix_level, double surround_mix_level,
double lfe_mix_level, double maxval,
double rematrix_volume, double *matrix_param,
int stride, enum AVMatrixEncoding matrix_encoding, void *log_context)
{
AVChannelLayout in_ch_layout = { 0 }, out_ch_layout = { 0 };
int ret;

ret = av_channel_layout_from_mask(&in_ch_layout, in_ch_layout_param);
ret |= av_channel_layout_from_mask(&out_ch_layout, out_ch_layout_param);
if (ret < 0)
return ret;

return swr_build_matrix2(&in_ch_layout, &out_ch_layout, center_mix_level, surround_mix_level,
lfe_mix_level, maxval, rematrix_volume, matrix_param,
stride, matrix_encoding, log_context);
}
#endif

av_cold int swr_build_matrix2(const AVChannelLayout *in_layout, const AVChannelLayout *out_layout,
double center_mix_level, double surround_mix_level,
double lfe_mix_level, double maxval,
Expand Down
Loading