mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
avutil: remove deprecated FF_API_OLD_CHANNEL_LAYOUT
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
a12cd3be98
commit
65ddc74988
@ -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
|
||||
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);
|
||||
#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
|
||||
}
|
||||
}
|
||||
|
||||
MATCH_PER_STREAM_OPT(sample_fmts, str, sample_fmt, oc, st);
|
||||
|
@ -135,12 +135,6 @@ get_next:
|
||||
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;
|
||||
|
@ -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,
|
||||
@ -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),
|
||||
|
@ -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,
|
||||
|
@ -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),
|
||||
|
@ -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++) {
|
||||
|
@ -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
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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,
|
||||
|
@ -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[] = {
|
||||
@ -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,
|
||||
|
@ -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 },
|
||||
@ -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 },
|
||||
|
@ -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 },
|
||||
@ -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 },
|
||||
|
@ -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, \
|
||||
@ -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)
|
||||
|
@ -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
|
||||
@ -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) {
|
||||
|
@ -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.
|
||||
@ -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.
|
||||
|
@ -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}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
@ -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;
|
||||
|
@ -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.
|
||||
*/
|
||||
|
@ -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)) {
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
@ -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;
|
||||
}
|
||||
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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 }
|
||||
},
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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 = {
|
||||
@ -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)
|
||||
};
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
@ -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,
|
||||
};
|
||||
|
@ -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 },
|
||||
@ -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 },
|
||||
|
@ -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 },
|
||||
|
@ -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 },
|
||||
|
@ -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 },
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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)) {
|
||||
|
@ -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,
|
||||
};
|
||||
@ -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,
|
||||
|
@ -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 } },
|
||||
|
@ -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 } },
|
||||
|
@ -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},
|
||||
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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 } },
|
||||
};
|
||||
|
@ -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 } },
|
||||
|
@ -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 } },
|
||||
|
@ -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,
|
||||
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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 */
|
||||
|
@ -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 },
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
@ -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,
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
@ -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);
|
||||
@ -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 )
|
||||
@ -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++)
|
||||
@ -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)
|
||||
@ -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 },
|
||||
|
@ -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);
|
||||
|
@ -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, ¶m->ch_layout);
|
||||
if (ret < 0)
|
||||
@ -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)
|
||||
@ -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)
|
||||
@ -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",
|
||||
s->channel_layout_str);
|
||||
av_channel_layout_from_mask(&s->ch_layout, mask);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
if (chlayout.order == AV_CHANNEL_ORDER_UNSPEC && !nret) {
|
||||
|
@ -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];
|
||||
|
@ -118,9 +118,6 @@ int main(void)
|
||||
"65C",
|
||||
"5.1",
|
||||
"stereo",
|
||||
"1+1+1+1",
|
||||
"1c+1c+1c+1c",
|
||||
"2c+1c",
|
||||
"0x3",
|
||||
};
|
||||
|
||||
|
@ -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)
|
||||
@ -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;
|
||||
|
@ -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;
|
||||
@ -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) {
|
||||
|
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -71,12 +61,7 @@ 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 },
|
||||
};
|
||||
static const AVClass dfpwm_demuxer_class = {
|
||||
|
@ -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;
|
||||
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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))
|
||||
);
|
||||
|
@ -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));
|
||||
|
@ -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;
|
||||
|
||||
@ -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) {
|
||||
@ -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 = {
|
||||
@ -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 },
|
||||
};
|
||||
|
||||
|
@ -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 &&
|
||||
@ -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;
|
||||
|
@ -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
|
||||
@ -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().
|
||||
|
@ -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));
|
||||
@ -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]) {
|
||||
@ -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);
|
||||
}
|
||||
@ -363,11 +335,6 @@ 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);
|
||||
|
||||
@ -375,31 +342,14 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
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;
|
||||
}
|
||||
|
||||
/* duplicate the frame data if it's not refcounted */
|
||||
if (!src->buf[0]) {
|
||||
@ -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);
|
||||
@ -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);
|
||||
|
||||
@ -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) {
|
||||
@ -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;
|
||||
@ -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++)
|
||||
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
@ -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
|
||||
|
110
libavutil/opt.c
110
libavutil/opt.c
@ -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:
|
||||
@ -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) {
|
||||
@ -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
|
||||
@ -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) {
|
||||
@ -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)
|
||||
{
|
||||
@ -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;
|
||||
@ -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;
|
||||
@ -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>",
|
||||
};
|
||||
@ -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, ")");
|
||||
}
|
||||
@ -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);
|
||||
@ -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);
|
||||
@ -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;
|
||||
@ -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:
|
||||
|
@ -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,
|
||||
};
|
||||
@ -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
|
||||
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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},
|
||||
@ -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"},
|
||||
|
@ -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];
|
||||
@ -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,
|
||||
|
@ -36,52 +36,6 @@ int swr_set_channel_mapping(struct SwrContext *s, const int *channel_map){
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
struct SwrContext *swr_alloc_set_opts(struct SwrContext *s,
|
||||
int64_t out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate,
|
||||
int64_t in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate,
|
||||
int log_offset, void *log_ctx){
|
||||
if(!s) s= swr_alloc();
|
||||
if(!s) return NULL;
|
||||
|
||||
s->log_level_offset= log_offset;
|
||||
s->log_ctx= log_ctx;
|
||||
|
||||
if (av_opt_set_int(s, "ocl", out_ch_layout, 0) < 0)
|
||||
goto fail;
|
||||
|
||||
if (av_opt_set_int(s, "osf", out_sample_fmt, 0) < 0)
|
||||
goto fail;
|
||||
|
||||
if (av_opt_set_int(s, "osr", out_sample_rate, 0) < 0)
|
||||
goto fail;
|
||||
|
||||
if (av_opt_set_int(s, "icl", in_ch_layout, 0) < 0)
|
||||
goto fail;
|
||||
|
||||
if (av_opt_set_int(s, "isf", in_sample_fmt, 0) < 0)
|
||||
goto fail;
|
||||
|
||||
if (av_opt_set_int(s, "isr", in_sample_rate, 0) < 0)
|
||||
goto fail;
|
||||
|
||||
if (av_opt_set_int(s, "ich", av_get_channel_layout_nb_channels(s-> user_in_ch_layout), 0) < 0)
|
||||
goto fail;
|
||||
|
||||
if (av_opt_set_int(s, "och", av_get_channel_layout_nb_channels(s->user_out_ch_layout), 0) < 0)
|
||||
goto fail;
|
||||
|
||||
av_opt_set_int(s, "uch", 0, 0);
|
||||
return s;
|
||||
fail:
|
||||
av_log(s, AV_LOG_ERROR, "Failed to set option\n");
|
||||
swr_free(&s);
|
||||
return NULL;
|
||||
}
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
|
||||
int swr_alloc_set_opts2(struct SwrContext **ps,
|
||||
const AVChannelLayout *out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate,
|
||||
const AVChannelLayout *in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate,
|
||||
@ -117,14 +71,6 @@ int swr_alloc_set_opts2(struct SwrContext **ps,
|
||||
|
||||
av_opt_set_int(s, "uch", 0, 0);
|
||||
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
// Clear old API values so they don't take precedence in swr_init()
|
||||
av_opt_set_int(s, "icl", 0, 0);
|
||||
av_opt_set_int(s, "ocl", 0, 0);
|
||||
av_opt_set_int(s, "ich", 0, 0);
|
||||
av_opt_set_int(s, "och", 0, 0);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
fail:
|
||||
av_log(s, AV_LOG_ERROR, "Failed to set option\n");
|
||||
@ -213,65 +159,7 @@ av_cold int swr_init(struct SwrContext *s){
|
||||
av_log(s, AV_LOG_ERROR, "Requested output sample rate %d is invalid\n", s->out_sample_rate);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
s->out.ch_count = s-> user_out_ch_count;
|
||||
s-> in.ch_count = s-> user_in_ch_count;
|
||||
|
||||
// if the old/new fields are set inconsistently, prefer the old ones
|
||||
if (s->user_used_ch_count && s->user_used_ch_count != s->user_used_chlayout.nb_channels) {
|
||||
av_channel_layout_uninit(&s->used_ch_layout);
|
||||
s->used_ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
|
||||
s->used_ch_layout.nb_channels = s->user_used_ch_count;
|
||||
} else if (av_channel_layout_check(&s->user_used_chlayout)) {
|
||||
ret = av_channel_layout_copy(&s->used_ch_layout, &s->user_used_chlayout);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
if ((s->user_in_ch_count && s->user_in_ch_count != s->user_in_chlayout.nb_channels) ||
|
||||
(s->user_in_ch_layout && (s->user_in_chlayout.order != AV_CHANNEL_ORDER_NATIVE ||
|
||||
s->user_in_chlayout.u.mask != s->user_in_ch_layout))) {
|
||||
av_channel_layout_uninit(&s->in_ch_layout);
|
||||
if (s->user_in_ch_layout)
|
||||
av_channel_layout_from_mask(&s->in_ch_layout, s->user_in_ch_layout);
|
||||
else {
|
||||
s->in_ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
|
||||
s->in_ch_layout.nb_channels = s->user_in_ch_count;
|
||||
}
|
||||
} else if (av_channel_layout_check(&s->user_in_chlayout))
|
||||
av_channel_layout_copy(&s->in_ch_layout, &s->user_in_chlayout);
|
||||
|
||||
if ((s->user_out_ch_count && s->user_out_ch_count != s->user_out_chlayout.nb_channels) ||
|
||||
(s->user_out_ch_layout && (s->user_out_chlayout.order != AV_CHANNEL_ORDER_NATIVE ||
|
||||
s->user_out_chlayout.u.mask != s->user_out_ch_layout))) {
|
||||
av_channel_layout_uninit(&s->out_ch_layout);
|
||||
if (s->user_out_ch_layout)
|
||||
av_channel_layout_from_mask(&s->out_ch_layout, s->user_out_ch_layout);
|
||||
else {
|
||||
s->out_ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
|
||||
s->out_ch_layout.nb_channels = s->user_out_ch_count;
|
||||
}
|
||||
} else if (av_channel_layout_check(&s->user_out_chlayout))
|
||||
av_channel_layout_copy(&s->out_ch_layout, &s->user_out_chlayout);
|
||||
|
||||
if (!s->out.ch_count)
|
||||
s->out.ch_count = s->out_ch_layout.nb_channels;
|
||||
if (!s-> in.ch_count)
|
||||
s-> in.ch_count = s->in_ch_layout.nb_channels;
|
||||
|
||||
if (!(ret = av_channel_layout_check(&s->in_ch_layout)) || s->in_ch_layout.nb_channels > SWR_CH_MAX) {
|
||||
if (ret)
|
||||
av_channel_layout_describe(&s->in_ch_layout, l1, sizeof(l1));
|
||||
av_log(s, AV_LOG_WARNING, "Input channel layout \"%s\" is invalid or unsupported.\n", ret ? l1 : "");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
if (!(ret = av_channel_layout_check(&s->out_ch_layout)) || s->out_ch_layout.nb_channels > SWR_CH_MAX) {
|
||||
if (ret)
|
||||
av_channel_layout_describe(&s->out_ch_layout, l2, sizeof(l2));
|
||||
av_log(s, AV_LOG_WARNING, "Output channel layout \"%s\" is invalid or unsupported.\n", ret ? l2 : "");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
#else
|
||||
s->out.ch_count = s-> user_out_chlayout.nb_channels;
|
||||
s-> in.ch_count = s-> user_in_chlayout.nb_channels;
|
||||
|
||||
@ -294,7 +182,6 @@ av_cold int swr_init(struct SwrContext *s){
|
||||
ret |= av_channel_layout_copy(&s->used_ch_layout, &s->user_used_chlayout);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
#endif
|
||||
|
||||
s->int_sample_fmt= s->user_int_sample_fmt;
|
||||
|
||||
@ -423,13 +310,6 @@ av_cold int swr_init(struct SwrContext *s){
|
||||
}
|
||||
|
||||
av_channel_layout_describe(&s->out_ch_layout, l2, sizeof(l2));
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
if (s->out_ch_layout.order != AV_CHANNEL_ORDER_UNSPEC && s->out.ch_count != s->out_ch_layout.nb_channels) {
|
||||
av_log(s, AV_LOG_ERROR, "Output channel layout %s mismatches specified channel count %d\n", l2, s->out.ch_count);
|
||||
ret = AVERROR(EINVAL);
|
||||
goto fail;
|
||||
}
|
||||
#endif
|
||||
av_channel_layout_describe(&s->in_ch_layout, l1, sizeof(l1));
|
||||
if (s->in_ch_layout.order != AV_CHANNEL_ORDER_UNSPEC && s->used_ch_layout.nb_channels != s->in_ch_layout.nb_channels) {
|
||||
av_log(s, AV_LOG_ERROR, "Input channel layout %s mismatches specified channel count %d\n", l1, s->used_ch_layout.nb_channels);
|
||||
|
@ -234,35 +234,6 @@ int swr_init(struct SwrContext *s);
|
||||
*/
|
||||
int swr_is_initialized(struct SwrContext *s);
|
||||
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
/**
|
||||
* Allocate SwrContext if needed and set/reset common parameters.
|
||||
*
|
||||
* This function does not require s to be allocated with swr_alloc(). On the
|
||||
* other hand, swr_alloc() can use swr_alloc_set_opts() to set the parameters
|
||||
* on the allocated context.
|
||||
*
|
||||
* @param s existing Swr context if available, or NULL if not
|
||||
* @param out_ch_layout output channel layout (AV_CH_LAYOUT_*)
|
||||
* @param out_sample_fmt output sample format (AV_SAMPLE_FMT_*).
|
||||
* @param out_sample_rate output sample rate (frequency in Hz)
|
||||
* @param in_ch_layout input channel layout (AV_CH_LAYOUT_*)
|
||||
* @param in_sample_fmt input sample format (AV_SAMPLE_FMT_*).
|
||||
* @param in_sample_rate input sample rate (frequency in Hz)
|
||||
* @param log_offset logging level offset
|
||||
* @param log_ctx parent logging context, can be NULL
|
||||
*
|
||||
* @see swr_init(), swr_free()
|
||||
* @return NULL on error, allocated context otherwise
|
||||
* @deprecated use @ref swr_alloc_set_opts2()
|
||||
*/
|
||||
attribute_deprecated
|
||||
struct SwrContext *swr_alloc_set_opts(struct SwrContext *s,
|
||||
int64_t out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate,
|
||||
int64_t in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate,
|
||||
int log_offset, void *log_ctx);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Allocate SwrContext if needed and set/reset common parameters.
|
||||
*
|
||||
@ -399,40 +370,6 @@ int swr_set_compensation(struct SwrContext *s, int sample_delta, int compensatio
|
||||
*/
|
||||
int swr_set_channel_mapping(struct SwrContext *s, const int *channel_map);
|
||||
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
/**
|
||||
* Generate a channel mixing matrix.
|
||||
*
|
||||
* This function is the one used internally by libswresample for building the
|
||||
* default mixing matrix. It is made public just as a utility function for
|
||||
* building custom matrices.
|
||||
*
|
||||
* @param in_layout input channel layout
|
||||
* @param out_layout output channel layout
|
||||
* @param center_mix_level mix level for the center channel
|
||||
* @param surround_mix_level mix level for the surround channel(s)
|
||||
* @param lfe_mix_level mix level for the low-frequency effects channel
|
||||
* @param rematrix_maxval if 1.0, coefficients will be normalized to prevent
|
||||
* overflow. if INT_MAX, coefficients will not be
|
||||
* normalized.
|
||||
* @param[out] matrix mixing coefficients; matrix[i + stride * o] is
|
||||
* the weight of input channel i in output channel o.
|
||||
* @param stride distance between adjacent input channels in the
|
||||
* matrix array
|
||||
* @param matrix_encoding matrixed stereo downmix mode (e.g. dplii)
|
||||
* @param log_ctx parent logging context, can be NULL
|
||||
* @return 0 on success, negative AVERROR code on failure
|
||||
* @deprecated use @ref swr_build_matrix2()
|
||||
*/
|
||||
attribute_deprecated
|
||||
int swr_build_matrix(uint64_t in_layout, uint64_t out_layout,
|
||||
double center_mix_level, double surround_mix_level,
|
||||
double lfe_mix_level, double rematrix_maxval,
|
||||
double rematrix_volume, double *matrix,
|
||||
int stride, enum AVMatrixEncoding matrix_encoding,
|
||||
void *log_ctx);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Generate a channel mixing matrix.
|
||||
*
|
||||
|
@ -32,15 +32,6 @@ int swr_config_frame(SwrContext *s, const AVFrame *out, const AVFrame *in)
|
||||
swr_close(s);
|
||||
|
||||
if (in) {
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
// if the old/new fields are set inconsistently, prefer the old ones
|
||||
if ((in->channel_layout && (in->ch_layout.order != AV_CHANNEL_ORDER_NATIVE ||
|
||||
in->ch_layout.u.mask != in->channel_layout))) {
|
||||
av_channel_layout_from_mask(&ch_layout, in->channel_layout);
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
} else
|
||||
#endif
|
||||
if ((ret = av_channel_layout_copy(&ch_layout, &in->ch_layout)) < 0)
|
||||
goto fail;
|
||||
if ((ret = av_opt_set_chlayout(s, "ichl", &ch_layout, 0)) < 0)
|
||||
@ -52,16 +43,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
}
|
||||
|
||||
if (out) {
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
// if the old/new fields are set inconsistently, prefer the old ones
|
||||
if ((out->channel_layout && (out->ch_layout.order != AV_CHANNEL_ORDER_NATIVE ||
|
||||
out->ch_layout.u.mask != out->channel_layout))) {
|
||||
av_channel_layout_uninit(&ch_layout);
|
||||
av_channel_layout_from_mask(&ch_layout, out->channel_layout);
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
} else
|
||||
#endif
|
||||
if ((ret = av_channel_layout_copy(&ch_layout, &out->ch_layout)) < 0)
|
||||
goto fail;
|
||||
if ((ret = av_opt_set_chlayout(s, "ochl", &ch_layout, 0)) < 0)
|
||||
@ -87,15 +68,6 @@ static int config_changed(SwrContext *s,
|
||||
int ret = 0, err;
|
||||
|
||||
if (in) {
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
// if the old/new fields are set inconsistently, prefer the old ones
|
||||
if ((in->channel_layout && (in->ch_layout.order != AV_CHANNEL_ORDER_NATIVE ||
|
||||
in->ch_layout.u.mask != in->channel_layout))) {
|
||||
av_channel_layout_from_mask(&ch_layout, in->channel_layout);
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
} else
|
||||
#endif
|
||||
if ((err = av_channel_layout_copy(&ch_layout, &in->ch_layout)) < 0)
|
||||
return err;
|
||||
if (av_channel_layout_compare(&s->in_ch_layout, &ch_layout) ||
|
||||
@ -106,16 +78,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
}
|
||||
|
||||
if (out) {
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
// if the old/new fields are set inconsistently, prefer the old ones
|
||||
if ((out->channel_layout && (out->ch_layout.order != AV_CHANNEL_ORDER_NATIVE ||
|
||||
out->ch_layout.u.mask != out->channel_layout))) {
|
||||
av_channel_layout_uninit(&ch_layout);
|
||||
av_channel_layout_from_mask(&ch_layout, out->channel_layout);
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
} else
|
||||
#endif
|
||||
if ((err = av_channel_layout_copy(&ch_layout, &out->ch_layout)) < 0)
|
||||
return err;
|
||||
if (av_channel_layout_compare(&s->out_ch_layout, &ch_layout) ||
|
||||
@ -169,14 +131,7 @@ static inline int available_samples(AVFrame *out)
|
||||
if (av_sample_fmt_is_planar(out->format)) {
|
||||
return samples;
|
||||
} else {
|
||||
int channels;
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
channels = av_get_channel_layout_nb_channels(out->channel_layout);
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
if (!channels)
|
||||
#endif
|
||||
channels = out->ch_layout.nb_channels;
|
||||
int channels = out->ch_layout.nb_channels;
|
||||
return samples / channels;
|
||||
}
|
||||
}
|
||||
|
@ -114,13 +114,6 @@ struct SwrContext {
|
||||
const int *channel_map; ///< channel index (or -1 if muted channel) map
|
||||
int engine;
|
||||
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
int user_used_ch_count; ///< User set used channel count
|
||||
int user_in_ch_count; ///< User set input channel count
|
||||
int user_out_ch_count; ///< User set output channel count
|
||||
int64_t user_in_ch_layout; ///< User set input channel layout
|
||||
int64_t user_out_ch_layout; ///< User set output channel layout
|
||||
#endif
|
||||
AVChannelLayout user_used_chlayout; ///< User set used channel layout
|
||||
AVChannelLayout user_in_chlayout; ///< User set input channel layout
|
||||
AVChannelLayout user_out_chlayout; ///< User set output channel layout
|
||||
|
@ -82,7 +82,4 @@ quad(side)
|
||||
0 = ff_parse_channel_layout(0000000000000000, 65, 65C);
|
||||
0 = ff_parse_channel_layout(000000000000003F, 6, 5.1);
|
||||
0 = ff_parse_channel_layout(0000000000000003, 2, stereo);
|
||||
0 = ff_parse_channel_layout(0000000000000001, 1, 1+1+1+1);
|
||||
0 = ff_parse_channel_layout(0000000000000004, 1, 1c+1c+1c+1c);
|
||||
0 = ff_parse_channel_layout(0000000000000007, 3, 2c+1c);
|
||||
0 = ff_parse_channel_layout(0000000000000003, 2, 0x3);
|
||||
|
Loading…
Reference in New Issue
Block a user