mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-28 18:32:22 +00:00
lavc: drop temporary compat wrappers for channel layout API change
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
bfe86a761a
commit
5636972c7a
@ -592,13 +592,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
}
|
||||
|
||||
av_channel_layout_copy(&avctx->ch_layout, &ac->oc[1].ch_layout);
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
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
|
||||
ac->oc[1].status = oc_type;
|
||||
|
||||
if (get_new_frame) {
|
||||
|
@ -137,8 +137,6 @@ static int64_t get_bit_rate(AVCodecContext *ctx)
|
||||
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
|
||||
{
|
||||
int ret = 0;
|
||||
int orig_channels;
|
||||
uint64_t orig_channel_layout;
|
||||
AVCodecInternal *avci;
|
||||
|
||||
if (avcodec_is_open(avctx))
|
||||
@ -275,14 +273,6 @@ FF_DISABLE_DEPRECATION_WARNINGS
|
||||
avctx->ch_layout.nb_channels = avctx->channels;
|
||||
}
|
||||
}
|
||||
|
||||
/* temporary compat wrapper for new-style callers and old-style codecs;
|
||||
* to be removed once all the codecs have been converted */
|
||||
if (avctx->ch_layout.nb_channels) {
|
||||
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
|
||||
|
||||
@ -346,13 +336,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
if (!HAVE_THREADS && !(codec->caps_internal & FF_CODEC_CAP_AUTO_THREADS))
|
||||
avctx->thread_count = 1;
|
||||
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
orig_channels = avctx->channels;
|
||||
orig_channel_layout = avctx->channel_layout;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
|
||||
if (!(avctx->active_thread_type & FF_THREAD_FRAME) ||
|
||||
avci->frame_thread_encoder) {
|
||||
if (avctx->codec->init) {
|
||||
@ -375,18 +358,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
/* decoder setting the old-style fields */
|
||||
if (avctx->channels != orig_channels ||
|
||||
avctx->channel_layout != orig_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;
|
||||
}
|
||||
}
|
||||
|
||||
/* 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 ?
|
||||
|
@ -1745,13 +1745,6 @@ int ff_dca_lbr_filter_frame(DCALbrDecoder *s, AVFrame *frame)
|
||||
|
||||
av_channel_layout_uninit(&avctx->ch_layout);
|
||||
av_channel_layout_from_mask(&avctx->ch_layout, channel_mask);
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
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
|
||||
|
||||
frame->nb_samples = 1024 << s->freq_range;
|
||||
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
|
||||
|
@ -79,14 +79,6 @@ int ff_dca_set_channel_layout(AVCodecContext *avctx, int *ch_remap, int dca_mask
|
||||
av_channel_layout_from_mask(&avctx->ch_layout, wav_mask);
|
||||
}
|
||||
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
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
|
||||
|
||||
return nchannels;
|
||||
}
|
||||
|
||||
|
@ -1701,26 +1701,6 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
|
||||
} else if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
/* temporary compat layer for decoders setting the old-style channel
|
||||
* layout fields; shall be removed after all the decoders are converted
|
||||
* to the new API */
|
||||
if ((avctx->channels > 0 && 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) {
|
||||
if (av_popcount64(avctx->channel_layout) != avctx->channels) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Inconsistent channel layout/channels\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
goto fail;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/* 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) ?
|
||||
|
@ -486,24 +486,9 @@ int ff_encode_preinit(AVCodecContext *avctx)
|
||||
av_log(avctx, AV_LOG_ERROR, "Specified channel layout '%s' is not supported\n", buf);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
}
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
else if (avctx->codec->channel_layouts) {
|
||||
if (!avctx->channel_layout) {
|
||||
av_log(avctx, AV_LOG_WARNING, "Channel layout not specified\n");
|
||||
} else {
|
||||
for (i = 0; avctx->codec->channel_layouts[i] != 0; i++)
|
||||
if (avctx->channel_layout == avctx->codec->channel_layouts[i])
|
||||
break;
|
||||
if (avctx->codec->channel_layouts[i] == 0) {
|
||||
char buf[512];
|
||||
av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout);
|
||||
av_log(avctx, AV_LOG_ERROR, "Specified channel layout '%s' is not supported\n", buf);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
if (avctx->channel_layout && avctx->channels) {
|
||||
int channels = av_get_channel_layout_nb_channels(avctx->channel_layout);
|
||||
if (channels != avctx->channels) {
|
||||
|
@ -1329,30 +1329,12 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
|
||||
}
|
||||
got_packet = 1;
|
||||
} else if (st->discard < AVDISCARD_ALL) {
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
int orig_channels = sti->avctx->channels;
|
||||
uint64_t orig_channel_layout = sti->avctx->channel_layout;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
if ((ret = parse_packet(s, pkt, pkt->stream_index, 0)) < 0)
|
||||
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
|
||||
/* parser setting the old-style fields */
|
||||
if (sti->avctx->channels != orig_channels ||
|
||||
sti->avctx->channel_layout != orig_channel_layout) {
|
||||
av_channel_layout_uninit(&sti->avctx->ch_layout);
|
||||
if (sti->avctx->channel_layout) {
|
||||
av_channel_layout_from_mask(&sti->avctx->ch_layout, sti->avctx->channel_layout);
|
||||
} else {
|
||||
sti->avctx->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
|
||||
sti->avctx->ch_layout.nb_channels = sti->avctx->channels;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user