Skip to content

Commit

Permalink
avutil: remove deprecated FF_API_OLD_CHANNEL_LAYOUT
Browse files Browse the repository at this point in the history
Signed-off-by: James Almer <jamrial@gmail.com>
  • Loading branch information
jamrial committed Mar 7, 2024
1 parent a12cd3b commit 65ddc74
Show file tree
Hide file tree
Showing 100 changed files with 20 additions and 1,792 deletions.
21 changes: 3 additions & 18 deletions fftools/ffmpeg_mux_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -840,24 +840,9 @@ static int new_stream_audio(Muxer *mux, const OptionsContext *o,
}

MATCH_PER_STREAM_OPT(audio_ch_layouts, str, layout, oc, st);
if (layout) {
if (av_channel_layout_from_string(&audio_enc->ch_layout, layout) < 0) {
#if FF_API_OLD_CHANNEL_LAYOUT
uint64_t mask;
AV_NOWARN_DEPRECATED({
mask = av_get_channel_layout(layout);
})
if (!mask) {
#endif
av_log(ost, AV_LOG_FATAL, "Unknown channel layout: %s\n", layout);
return AVERROR(EINVAL);
#if FF_API_OLD_CHANNEL_LAYOUT
}
av_log(ost, AV_LOG_WARNING, "Channel layout '%s' uses a deprecated syntax.\n",
layout);
av_channel_layout_from_mask(&audio_enc->ch_layout, mask);
#endif
}
if (layout && av_channel_layout_from_string(&audio_enc->ch_layout, layout) < 0) {
av_log(ost, AV_LOG_FATAL, "Unknown channel layout: %s\n", layout);
return AVERROR(EINVAL);
}

MATCH_PER_STREAM_OPT(sample_fmts, str, sample_fmt, oc, st);
Expand Down
6 changes: 0 additions & 6 deletions libavcodec/aac_ac3_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,6 @@ int ff_aac_ac3_parse(AVCodecParserContext *s1,
avctx->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
avctx->ch_layout.nb_channels = hdr.channels;
}
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
avctx->channels = avctx->ch_layout.nb_channels;
avctx->channel_layout = hdr.channel_layout;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
}
s1->duration = hdr.num_blocks * 256;
avctx->audio_service_type = hdr.bitstream_mode;
Expand Down
2 changes: 0 additions & 2 deletions libavcodec/aacdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,6 @@ const FFCodec ff_aac_decoder = {
},
.p.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(ff_aac_channel_layout)
.p.ch_layouts = ff_aac_ch_layout,
.flush = flush,
.p.priv_class = &aac_decoder_class,
Expand All @@ -590,7 +589,6 @@ const FFCodec ff_aac_latm_decoder = {
},
.p.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(ff_aac_channel_layout)
.p.ch_layouts = ff_aac_ch_layout,
.flush = flush,
.p.profiles = NULL_IF_CONFIG_SMALL(ff_aac_profiles),
Expand Down
17 changes: 0 additions & 17 deletions libavcodec/aacdec_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,23 +92,6 @@ const int16_t ff_aac_channel_map[3][4][6] = {
},
};

#if FF_API_OLD_CHANNEL_LAYOUT
const uint64_t ff_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,
AV_CH_LAYOUT_7POINT1_WIDE_BACK,
AV_CH_LAYOUT_6POINT1_BACK,
AV_CH_LAYOUT_7POINT1,
AV_CH_LAYOUT_22POINT2,
AV_CH_LAYOUT_7POINT1_TOP_BACK,
0,
};
#endif

const AVChannelLayout ff_aac_ch_layout[] = {
AV_CHANNEL_LAYOUT_MONO,
AV_CHANNEL_LAYOUT_STEREO,
Expand Down
1 change: 0 additions & 1 deletion libavcodec/aacdec_fixed.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,6 @@ const FFCodec ff_aac_fixed_decoder = {
},
.p.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(ff_aac_channel_layout)
.p.ch_layouts = ff_aac_ch_layout,
.p.priv_class = &aac_decoder_class,
.p.profiles = NULL_IF_CONFIG_SMALL(ff_aac_profiles),
Expand Down
7 changes: 0 additions & 7 deletions libavcodec/aacdec_template.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,13 +469,6 @@ static int output_configure(AACDecContext *ac,
}
// Try to sniff a reasonable channel order, otherwise output the
// channels in the order the PCE declared them.
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
if (avctx->request_channel_layout == AV_CH_LAYOUT_NATIVE)
ac->output_channel_order = CHANNEL_ORDER_CODED;
FF_ENABLE_DEPRECATION_WARNINGS
#endif

if (ac->output_channel_order == CHANNEL_ORDER_DEFAULT)
layout = sniff_channel_order(layout_map, tags);
for (i = 0; i < tags; i++) {
Expand Down
4 changes: 0 additions & 4 deletions libavcodec/aacdectab.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ extern const uint8_t ff_aac_channel_layout_map[16][16][3];

extern const int16_t ff_aac_channel_map[3][4][6];

#if FF_API_OLD_CHANNEL_LAYOUT
extern const uint64_t ff_aac_channel_layout[];
#endif

extern const AVChannelLayout ff_aac_ch_layout[];
FF_VISIBILITY_POP_HIDDEN

Expand Down
8 changes: 0 additions & 8 deletions libavcodec/ac3dec.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,6 @@ static void ac3_downmix(AVCodecContext *avctx)
const AVChannelLayout stereo = (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO;

/* allow downmixing to stereo or mono */
#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 (avctx->ch_layout.nb_channels > 1 &&
!av_channel_layout_compare(&s->downmix_layout, &mono)) {
av_channel_layout_uninit(&avctx->ch_layout);
Expand Down
24 changes: 0 additions & 24 deletions libavcodec/ac3enc.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,30 +150,6 @@ static uint8_t exponent_group_tab[2][3][256];
/**
* List of supported channel layouts.
*/
#if FF_API_OLD_CHANNEL_LAYOUT
const uint64_t ff_ac3_channel_layouts[19] = {
AV_CH_LAYOUT_MONO,
AV_CH_LAYOUT_STEREO,
AV_CH_LAYOUT_2_1,
AV_CH_LAYOUT_SURROUND,
AV_CH_LAYOUT_2_2,
AV_CH_LAYOUT_QUAD,
AV_CH_LAYOUT_4POINT0,
AV_CH_LAYOUT_5POINT0,
AV_CH_LAYOUT_5POINT0_BACK,
(AV_CH_LAYOUT_MONO | AV_CH_LOW_FREQUENCY),
(AV_CH_LAYOUT_STEREO | AV_CH_LOW_FREQUENCY),
(AV_CH_LAYOUT_2_1 | AV_CH_LOW_FREQUENCY),
(AV_CH_LAYOUT_SURROUND | AV_CH_LOW_FREQUENCY),
(AV_CH_LAYOUT_2_2 | AV_CH_LOW_FREQUENCY),
(AV_CH_LAYOUT_QUAD | AV_CH_LOW_FREQUENCY),
(AV_CH_LAYOUT_4POINT0 | AV_CH_LOW_FREQUENCY),
AV_CH_LAYOUT_5POINT1,
AV_CH_LAYOUT_5POINT1_BACK,
0
};
#endif

const AVChannelLayout ff_ac3_ch_layouts[19] = {
AV_CHANNEL_LAYOUT_MONO,
AV_CHANNEL_LAYOUT_STEREO,
Expand Down
3 changes: 0 additions & 3 deletions libavcodec/ac3enc.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,6 @@ typedef struct AC3EncodeContext {
void (*output_frame_header)(struct AC3EncodeContext *s);
} AC3EncodeContext;

#if FF_API_OLD_CHANNEL_LAYOUT
extern const uint64_t ff_ac3_channel_layouts[19];
#endif
extern const AVChannelLayout ff_ac3_ch_layouts[19];
extern const AVOption ff_ac3_enc_options[];
extern const AVClass ff_ac3enc_class;
Expand Down
1 change: 0 additions & 1 deletion libavcodec/ac3enc_fixed.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ const FFCodec ff_ac3_fixed_encoder = {
.p.priv_class = &ff_ac3enc_class,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.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,
};
1 change: 0 additions & 1 deletion libavcodec/ac3enc_float.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ const FFCodec ff_ac3_encoder = {
AV_SAMPLE_FMT_NONE },
.p.priv_class = &ff_ac3enc_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
16 changes: 0 additions & 16 deletions libavcodec/alacenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -617,21 +617,6 @@ static int alac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
return 0;
}

#if FF_API_OLD_CHANNEL_LAYOUT
static const uint64_t alac_channel_layouts[ALAC_MAX_CHANNELS + 1] = {
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,
AV_CH_LAYOUT_6POINT1_BACK,
AV_CH_LAYOUT_7POINT1_WIDE_BACK,
0
};
#endif


#define OFFSET(x) offsetof(AlacEncodeContext, x)
#define AE AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
static const AVOption options[] = {
Expand Down Expand Up @@ -660,7 +645,6 @@ const FFCodec ff_alac_encoder = {
.init = alac_encode_init,
FF_CODEC_ENCODE_CB(alac_encode_frame),
.close = alac_encode_close,
CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(alac_channel_layouts)
.p.ch_layouts = ff_alac_ch_layouts,
.p.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S32P,
AV_SAMPLE_FMT_S16P,
Expand Down
2 changes: 0 additions & 2 deletions libavcodec/aptxdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ const FFCodec ff_aptx_decoder = {
.init = ff_aptx_init,
FF_CODEC_DECODE_CB(aptx_decode_frame),
.p.capabilities = AV_CODEC_CAP_DR1,
CODEC_OLD_CHANNEL_LAYOUTS(AV_CH_LAYOUT_STEREO)
.p.ch_layouts = (const AVChannelLayout[]) { AV_CHANNEL_LAYOUT_STEREO, { 0 } },
.p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S32P,
AV_SAMPLE_FMT_NONE },
Expand All @@ -200,7 +199,6 @@ const FFCodec ff_aptx_hd_decoder = {
.init = ff_aptx_init,
FF_CODEC_DECODE_CB(aptx_decode_frame),
.p.capabilities = AV_CODEC_CAP_DR1,
CODEC_OLD_CHANNEL_LAYOUTS(AV_CH_LAYOUT_STEREO)
.p.ch_layouts = (const AVChannelLayout[]) { AV_CHANNEL_LAYOUT_STEREO, { 0 } },
.p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S32P,
AV_SAMPLE_FMT_NONE },
Expand Down
2 changes: 0 additions & 2 deletions libavcodec/aptxenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,6 @@ const FFCodec ff_aptx_encoder = {
.init = aptx_encode_init,
FF_CODEC_ENCODE_CB(aptx_encode_frame),
.close = aptx_close,
CODEC_OLD_CHANNEL_LAYOUTS(AV_CH_LAYOUT_STEREO)
.p.ch_layouts = (const AVChannelLayout[]) { AV_CHANNEL_LAYOUT_STEREO, { 0 } },
.p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S32P,
AV_SAMPLE_FMT_NONE },
Expand All @@ -295,7 +294,6 @@ const FFCodec ff_aptx_hd_encoder = {
.init = aptx_encode_init,
FF_CODEC_ENCODE_CB(aptx_encode_frame),
.close = aptx_close,
CODEC_OLD_CHANNEL_LAYOUTS(AV_CH_LAYOUT_STEREO)
.p.ch_layouts = (const AVChannelLayout[]) { AV_CHANNEL_LAYOUT_STEREO, { 0 } },
.p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S32P,
AV_SAMPLE_FMT_NONE },
Expand Down
19 changes: 0 additions & 19 deletions libavcodec/audiotoolboxenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,6 @@ static const AVOption options[] = {
.p.priv_class = &ffat_##NAME##_enc_class, \
.p.capabilities = AV_CODEC_CAP_DELAY | \
AV_CODEC_CAP_ENCODER_FLUSH CAPS, \
CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(CHANNEL_LAYOUTS) \
.p.ch_layouts = CH_LAYOUTS, \
.p.sample_fmts = (const enum AVSampleFormat[]) { \
AV_SAMPLE_FMT_S16, \
Expand All @@ -674,24 +673,6 @@ static const AVChannelLayout aac_at_ch_layouts[] = {
{ 0 },
};

#if FF_API_OLD_CHANNEL_LAYOUT
static const uint64_t aac_at_channel_layouts[] = {
AV_CH_LAYOUT_MONO,
AV_CH_LAYOUT_STEREO,
AV_CH_LAYOUT_SURROUND,
AV_CH_LAYOUT_4POINT0,
AV_CH_LAYOUT_5POINT0,
AV_CH_LAYOUT_5POINT1,
AV_CH_LAYOUT_6POINT0,
AV_CH_LAYOUT_6POINT1,
AV_CH_LAYOUT_7POINT0,
AV_CH_LAYOUT_7POINT1_WIDE_BACK,
AV_CH_LAYOUT_QUAD,
AV_CH_LAYOUT_OCTAGONAL,
0,
};
#endif

FFAT_ENC(aac, AV_CODEC_ID_AAC, aac_profiles, , aac_at_channel_layouts, aac_at_ch_layouts)
//FFAT_ENC(adpcm_ima_qt, AV_CODEC_ID_ADPCM_IMA_QT, NULL)
FFAT_ENC(alac, AV_CODEC_ID_ALAC, NULL, , NULL, NULL)
Expand Down
29 changes: 0 additions & 29 deletions libavcodec/avcodec.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,26 +241,6 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
goto free_and_end;
}

#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
/* compat wrapper for old-style callers */
if (avctx->channel_layout && !avctx->channels)
avctx->channels = av_popcount64(avctx->channel_layout);

if ((avctx->channels && avctx->ch_layout.nb_channels != avctx->channels) ||
(avctx->channel_layout && (avctx->ch_layout.order != AV_CHANNEL_ORDER_NATIVE ||
avctx->ch_layout.u.mask != avctx->channel_layout))) {
av_channel_layout_uninit(&avctx->ch_layout);
if (avctx->channel_layout) {
av_channel_layout_from_mask(&avctx->ch_layout, avctx->channel_layout);
} else {
avctx->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
}
avctx->ch_layout.nb_channels = avctx->channels;
}
FF_ENABLE_DEPRECATION_WARNINGS
#endif

/* AV_CODEC_CAP_CHANNEL_CONF is a decoder-only flag; so the code below
* in particular checks that nb_channels is set for all audio encoders. */
if (avctx->codec_type == AVMEDIA_TYPE_AUDIO && !avctx->ch_layout.nb_channels
Expand Down Expand Up @@ -345,15 +325,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
if (!avctx->bit_rate)
avctx->bit_rate = get_bit_rate(avctx);

#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
/* update the deprecated fields for old-style callers */
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

/* validate channel layout from the decoder */
if ((avctx->ch_layout.nb_channels && !av_channel_layout_check(&avctx->ch_layout)) ||
avctx->ch_layout.nb_channels > FF_SANE_NB_CHANNELS) {
Expand Down
29 changes: 0 additions & 29 deletions libavcodec/avcodec.h
Original file line number Diff line number Diff line change
Expand Up @@ -1049,15 +1049,6 @@ typedef struct AVCodecContext {
/* audio only */
int sample_rate; ///< samples per second

#if FF_API_OLD_CHANNEL_LAYOUT
/**
* number of audio channels
* @deprecated use ch_layout.nb_channels
*/
attribute_deprecated
int channels;
#endif

/**
* audio sample format
* - encoding: Set by user.
Expand Down Expand Up @@ -1090,26 +1081,6 @@ typedef struct AVCodecContext {
*/
int cutoff;

#if FF_API_OLD_CHANNEL_LAYOUT
/**
* Audio channel layout.
* - encoding: set by user.
* - decoding: set by user, may be overwritten by libavcodec.
* @deprecated use ch_layout
*/
attribute_deprecated
uint64_t channel_layout;

/**
* Request decoder to use this channel layout if it can (0 for default)
* - encoding: unused
* - decoding: Set by user.
* @deprecated use "downmix" codec private option
*/
attribute_deprecated
uint64_t request_channel_layout;
#endif

/**
* Type of service that the audio stream conveys.
* - encoding: Set by user.
Expand Down
7 changes: 0 additions & 7 deletions libavcodec/codec.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,6 @@ typedef struct AVCodec {
const enum AVPixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1
const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
#if FF_API_OLD_CHANNEL_LAYOUT
/**
* @deprecated use ch_layouts instead
*/
attribute_deprecated
const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0
#endif
const AVClass *priv_class; ///< AVClass for the private context
const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {AV_PROFILE_UNKNOWN}

Expand Down

0 comments on commit 65ddc74

Please sign in to comment.