1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-08 13:22:53 +02:00

ac3: convert to new channel layout API

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
Vittorio Giovara 2017-03-29 14:01:56 +02:00 committed by James Almer
parent 494760f971
commit 111ed1b16b
11 changed files with 135 additions and 46 deletions

View File

@ -97,6 +97,12 @@ get_next:
avctx->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; avctx->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
avctx->ch_layout.nb_channels = s->channels; avctx->ch_layout.nb_channels = s->channels;
} }
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
avctx->channels = avctx->ch_layout.nb_channels;
avctx->channel_layout = s->channel_layout;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
} }
s1->duration = s->samples; s1->duration = s->samples;
avctx->audio_service_type = s->service_type; avctx->audio_service_type = s->service_type;

View File

@ -32,6 +32,7 @@
#include "libavutil/channel_layout.h" #include "libavutil/channel_layout.h"
#include "libavutil/crc.h" #include "libavutil/crc.h"
#include "libavutil/downmix_info.h" #include "libavutil/downmix_info.h"
#include "libavutil/intmath.h"
#include "libavutil/opt.h" #include "libavutil/opt.h"
#include "libavutil/thread.h" #include "libavutil/thread.h"
#include "bswapdsp.h" #include "bswapdsp.h"
@ -186,6 +187,8 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx)
{ {
static AVOnce init_static_once = AV_ONCE_INIT; static AVOnce init_static_once = AV_ONCE_INIT;
AC3DecodeContext *s = avctx->priv_data; AC3DecodeContext *s = avctx->priv_data;
const AVChannelLayout mono = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
const AVChannelLayout stereo = (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO;
int i, ret; int i, ret;
s->avctx = avctx; s->avctx = avctx;
@ -214,12 +217,23 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx)
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
/* allow downmixing to stereo or mono */ /* allow downmixing to stereo or mono */
if (avctx->channels > 1 && #if FF_API_OLD_CHANNEL_LAYOUT
avctx->request_channel_layout == AV_CH_LAYOUT_MONO) FF_DISABLE_DEPRECATION_WARNINGS
avctx->channels = 1; if (avctx->request_channel_layout) {
else if (avctx->channels > 2 && av_channel_layout_uninit(&s->downmix_layout);
avctx->request_channel_layout == AV_CH_LAYOUT_STEREO) av_channel_layout_from_mask(&s->downmix_layout, avctx->request_channel_layout);
avctx->channels = 2; }
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);
avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
} else if (avctx->ch_layout.nb_channels > 2 &&
!av_channel_layout_compare(&s->downmix_layout, &stereo)) {
av_channel_layout_uninit(&avctx->ch_layout);
avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO;
}
s->downmixed = 1; s->downmixed = 1;
for (i = 0; i < AC3_MAX_CHANNELS; i++) { for (i = 0; i < AC3_MAX_CHANNELS; i++) {
@ -1480,6 +1494,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
const SHORTFLOAT *output[AC3_MAX_CHANNELS]; const SHORTFLOAT *output[AC3_MAX_CHANNELS];
enum AVMatrixEncoding matrix_encoding; enum AVMatrixEncoding matrix_encoding;
AVDownmixInfo *downmix_info; AVDownmixInfo *downmix_info;
uint64_t mask;
s->superframe_size = 0; s->superframe_size = 0;
@ -1590,11 +1605,11 @@ dependent_frame:
if (s->lfe_on) if (s->lfe_on)
s->output_mode |= AC3_OUTPUT_LFEON; s->output_mode |= AC3_OUTPUT_LFEON;
if (s->channels > 1 && if (s->channels > 1 &&
avctx->request_channel_layout == AV_CH_LAYOUT_MONO) { !av_channel_layout_compare(&s->downmix_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_MONO)) {
s->out_channels = 1; s->out_channels = 1;
s->output_mode = AC3_CHMODE_MONO; s->output_mode = AC3_CHMODE_MONO;
} else if (s->channels > 2 && } else if (s->channels > 2 &&
avctx->request_channel_layout == AV_CH_LAYOUT_STEREO) { !av_channel_layout_compare(&s->downmix_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO)) {
s->out_channels = 2; s->out_channels = 2;
s->output_mode = AC3_CHMODE_STEREO; s->output_mode = AC3_CHMODE_STEREO;
} }
@ -1615,10 +1630,13 @@ dependent_frame:
av_log(avctx, AV_LOG_ERROR, "unable to determine channel mode\n"); av_log(avctx, AV_LOG_ERROR, "unable to determine channel mode\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
avctx->channels = s->out_channels;
avctx->channel_layout = ff_ac3_channel_layout_tab[s->output_mode & ~AC3_OUTPUT_LFEON]; mask = ff_ac3_channel_layout_tab[s->output_mode & ~AC3_OUTPUT_LFEON];
if (s->output_mode & AC3_OUTPUT_LFEON) if (s->output_mode & AC3_OUTPUT_LFEON)
avctx->channel_layout |= AV_CH_LOW_FREQUENCY; mask |= AV_CH_LOW_FREQUENCY;
av_channel_layout_uninit(&avctx->ch_layout);
av_channel_layout_from_mask(&avctx->ch_layout, mask);
/* set audio service type based on bitstream mode for AC-3 */ /* set audio service type based on bitstream mode for AC-3 */
avctx->audio_service_type = s->bitstream_mode; avctx->audio_service_type = s->bitstream_mode;
@ -1714,20 +1732,20 @@ skip:
channel_layout |= ff_eac3_custom_channel_map_locations[ch][1]; channel_layout |= ff_eac3_custom_channel_map_locations[ch][1];
} }
} }
if (av_get_channel_layout_nb_channels(channel_layout) > EAC3_MAX_CHANNELS) { if (av_popcount64(channel_layout) > EAC3_MAX_CHANNELS) {
av_log(avctx, AV_LOG_ERROR, "Too many channels (%d) coded\n", av_log(avctx, AV_LOG_ERROR, "Too many channels (%d) coded\n",
av_get_channel_layout_nb_channels(channel_layout)); av_popcount64(channel_layout));
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
avctx->channel_layout = channel_layout; av_channel_layout_uninit(&avctx->ch_layout);
avctx->channels = av_get_channel_layout_nb_channels(channel_layout); av_channel_layout_from_mask(&avctx->ch_layout, channel_layout);
for (ch = 0; ch < EAC3_MAX_CHANNELS; ch++) { for (ch = 0; ch < EAC3_MAX_CHANNELS; ch++) {
if (s->channel_map & (1 << (EAC3_MAX_CHANNELS - ch - 1))) { if (s->channel_map & (1 << (EAC3_MAX_CHANNELS - ch - 1))) {
if (ff_eac3_custom_channel_map_locations[ch][0]) { if (ff_eac3_custom_channel_map_locations[ch][0]) {
int index = av_get_channel_layout_channel_index(channel_layout, int index = av_channel_layout_index_from_channel(&avctx->ch_layout,
ff_eac3_custom_channel_map_locations[ch][1]); ff_ctzll(ff_eac3_custom_channel_map_locations[ch][1]));
if (index < 0) if (index < 0)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
if (extend >= channel_map_size) if (extend >= channel_map_size)
@ -1739,8 +1757,7 @@ skip:
for (i = 0; i < 64; i++) { for (i = 0; i < 64; i++) {
if ((1ULL << i) & ff_eac3_custom_channel_map_locations[ch][1]) { if ((1ULL << i) & ff_eac3_custom_channel_map_locations[ch][1]) {
int index = av_get_channel_layout_channel_index(channel_layout, int index = av_channel_layout_index_from_channel(&avctx->ch_layout, i);
1ULL << i);
if (index < 0) if (index < 0)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
if (extend >= channel_map_size) if (extend >= channel_map_size)
@ -1759,7 +1776,7 @@ skip:
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret; return ret;
for (ch = 0; ch < avctx->channels; ch++) { for (ch = 0; ch < avctx->ch_layout.nb_channels; ch++) {
int map = extended_channel_map[ch]; int map = extended_channel_map[ch];
av_assert0(ch>=AV_NUM_DATA_POINTERS || frame->extended_data[ch] == frame->data[ch]); av_assert0(ch>=AV_NUM_DATA_POINTERS || frame->extended_data[ch] == frame->data[ch]);
memcpy((SHORTFLOAT *)frame->extended_data[ch], memcpy((SHORTFLOAT *)frame->extended_data[ch],

View File

@ -251,6 +251,8 @@ typedef struct AC3DecodeContext {
DECLARE_ALIGNED(32, uint8_t, input_buffer)[AC3_FRAME_BUFFER_SIZE + AV_INPUT_BUFFER_PADDING_SIZE]; ///< temp buffer to prevent overread DECLARE_ALIGNED(32, uint8_t, input_buffer)[AC3_FRAME_BUFFER_SIZE + AV_INPUT_BUFFER_PADDING_SIZE]; ///< temp buffer to prevent overread
DECLARE_ALIGNED(32, SHORTFLOAT, output_buffer)[EAC3_MAX_CHANNELS][AC3_BLOCK_SIZE * 6]; ///< final output buffer DECLARE_ALIGNED(32, SHORTFLOAT, output_buffer)[EAC3_MAX_CHANNELS][AC3_BLOCK_SIZE * 6]; ///< final output buffer
///@} ///@}
AVChannelLayout downmix_layout;
} AC3DecodeContext; } AC3DecodeContext;
/** /**

View File

@ -157,6 +157,7 @@ static const AVOption options[] = {
{ "cons_noisegen", "enable consistent noise generation", OFFSET(consistent_noise_generation), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, PAR }, { "cons_noisegen", "enable consistent noise generation", OFFSET(consistent_noise_generation), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, PAR },
{ "drc_scale", "percentage of dynamic range compression to apply", OFFSET(drc_scale), AV_OPT_TYPE_FLOAT, {.dbl = 1.0}, 0.0, 6.0, PAR }, { "drc_scale", "percentage of dynamic range compression to apply", OFFSET(drc_scale), AV_OPT_TYPE_FLOAT, {.dbl = 1.0}, 0.0, 6.0, PAR },
{ "heavy_compr", "enable heavy dynamic range compression", OFFSET(heavy_compression), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, PAR }, { "heavy_compr", "enable heavy dynamic range compression", OFFSET(heavy_compression), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, PAR },
{ "downmix", "Request a specific channel layout from the decoder", OFFSET(downmix_layout), AV_OPT_TYPE_CHLAYOUT, {.str = NULL}, .flags = PAR },
{ NULL}, { NULL},
}; };

View File

@ -43,6 +43,8 @@ static const AVOption options[] = {
{"loro_cmixlev", "Lo/Ro Center Mix Level", OFFSET(loro_center_mix_level), AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0}, {"loro_cmixlev", "Lo/Ro Center Mix Level", OFFSET(loro_center_mix_level), AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0},
{"loro_surmixlev", "Lo/Ro Surround Mix Level", OFFSET(loro_surround_mix_level), AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0}, {"loro_surmixlev", "Lo/Ro Surround Mix Level", OFFSET(loro_surround_mix_level), AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0},
{ "downmix", "Request a specific channel layout from the decoder", OFFSET(downmix_layout), AV_OPT_TYPE_CHLAYOUT, {.str = NULL}, .flags = PAR },
{ NULL}, { NULL},
}; };

View File

@ -147,6 +147,7 @@ static uint8_t exponent_group_tab[2][3][256];
/** /**
* List of supported channel layouts. * List of supported channel layouts.
*/ */
#if FF_API_OLD_CHANNEL_LAYOUT
const uint64_t ff_ac3_channel_layouts[19] = { const uint64_t ff_ac3_channel_layouts[19] = {
AV_CH_LAYOUT_MONO, AV_CH_LAYOUT_MONO,
AV_CH_LAYOUT_STEREO, AV_CH_LAYOUT_STEREO,
@ -168,6 +169,47 @@ const uint64_t ff_ac3_channel_layouts[19] = {
AV_CH_LAYOUT_5POINT1_BACK, AV_CH_LAYOUT_5POINT1_BACK,
0 0
}; };
#endif
const AVChannelLayout ff_ac3_ch_layouts[19] = {
AV_CHANNEL_LAYOUT_MONO,
AV_CHANNEL_LAYOUT_STEREO,
AV_CHANNEL_LAYOUT_2_1,
AV_CHANNEL_LAYOUT_SURROUND,
AV_CHANNEL_LAYOUT_2_2,
AV_CHANNEL_LAYOUT_QUAD,
AV_CHANNEL_LAYOUT_4POINT0,
AV_CHANNEL_LAYOUT_5POINT0,
AV_CHANNEL_LAYOUT_5POINT0_BACK,
{
.nb_channels = 2,
.order = AV_CHANNEL_ORDER_NATIVE,
.u.mask = AV_CH_LAYOUT_MONO | AV_CH_LOW_FREQUENCY,
},
{
.nb_channels = 3,
.order = AV_CHANNEL_ORDER_NATIVE,
.u.mask = AV_CH_LAYOUT_STEREO | AV_CH_LOW_FREQUENCY,
},
{
.nb_channels = 4,
.order = AV_CHANNEL_ORDER_NATIVE,
.u.mask = AV_CH_LAYOUT_2_1 | AV_CH_LOW_FREQUENCY,
},
{
.nb_channels = 4,
.order = AV_CHANNEL_ORDER_NATIVE,
.u.mask = AV_CH_LAYOUT_SURROUND | AV_CH_LOW_FREQUENCY,
},
{
.nb_channels = 5,
.order = AV_CHANNEL_ORDER_NATIVE,
.u.mask = AV_CH_LAYOUT_4POINT0 | AV_CH_LOW_FREQUENCY,
},
AV_CHANNEL_LAYOUT_5POINT1,
AV_CHANNEL_LAYOUT_5POINT1_BACK,
{ 0 },
};
/** /**
* Table to remap channels from SMPTE order to AC-3 order. * Table to remap channels from SMPTE order to AC-3 order.
@ -1797,7 +1839,7 @@ static void dprint_options(AC3EncodeContext *s)
} }
ff_dlog(avctx, "bitstream_id: %s (%d)\n", strbuf, s->bitstream_id); ff_dlog(avctx, "bitstream_id: %s (%d)\n", strbuf, s->bitstream_id);
ff_dlog(avctx, "sample_fmt: %s\n", av_get_sample_fmt_name(avctx->sample_fmt)); ff_dlog(avctx, "sample_fmt: %s\n", av_get_sample_fmt_name(avctx->sample_fmt));
av_get_channel_layout_string(strbuf, 32, s->channels, avctx->channel_layout); av_channel_layout_describe(&avctx->ch_layout, strbuf, sizeof(strbuf));
ff_dlog(avctx, "channel_layout: %s\n", strbuf); ff_dlog(avctx, "channel_layout: %s\n", strbuf);
ff_dlog(avctx, "sample_rate: %d\n", s->sample_rate); ff_dlog(avctx, "sample_rate: %d\n", s->sample_rate);
ff_dlog(avctx, "bit_rate: %d\n", s->bit_rate); ff_dlog(avctx, "bit_rate: %d\n", s->bit_rate);
@ -2041,11 +2083,11 @@ int ff_ac3_validate_metadata(AC3EncodeContext *s)
/* validate audio service type / channels combination */ /* validate audio service type / channels combination */
if ((avctx->audio_service_type == AV_AUDIO_SERVICE_TYPE_KARAOKE && if ((avctx->audio_service_type == AV_AUDIO_SERVICE_TYPE_KARAOKE &&
avctx->channels == 1) || avctx->ch_layout.nb_channels == 1) ||
((avctx->audio_service_type == AV_AUDIO_SERVICE_TYPE_COMMENTARY || ((avctx->audio_service_type == AV_AUDIO_SERVICE_TYPE_COMMENTARY ||
avctx->audio_service_type == AV_AUDIO_SERVICE_TYPE_EMERGENCY || avctx->audio_service_type == AV_AUDIO_SERVICE_TYPE_EMERGENCY ||
avctx->audio_service_type == AV_AUDIO_SERVICE_TYPE_VOICE_OVER) avctx->audio_service_type == AV_AUDIO_SERVICE_TYPE_VOICE_OVER)
&& avctx->channels > 1)) { && avctx->ch_layout.nb_channels > 1)) {
av_log(avctx, AV_LOG_ERROR, "invalid audio service type for the " av_log(avctx, AV_LOG_ERROR, "invalid audio service type for the "
"specified number of channels\n"); "specified number of channels\n");
return AVERROR(EINVAL); return AVERROR(EINVAL);
@ -2167,27 +2209,29 @@ av_cold int ff_ac3_encode_close(AVCodecContext *avctx)
/* /*
* Set channel information during initialization. * Set channel information during initialization.
*/ */
static av_cold int set_channel_info(AC3EncodeContext *s, int channels, static av_cold int set_channel_info(AVCodecContext *avctx)
uint64_t *channel_layout)
{ {
int ch_layout; AC3EncodeContext *s = avctx->priv_data;
int channels = avctx->ch_layout.nb_channels;
uint64_t mask = avctx->ch_layout.u.mask;
if (channels < 1 || channels > AC3_MAX_CHANNELS) if (channels < 1 || channels > AC3_MAX_CHANNELS)
return AVERROR(EINVAL); return AVERROR(EINVAL);
if (*channel_layout > 0x7FF) if (mask > 0x7FF)
return AVERROR(EINVAL); return AVERROR(EINVAL);
ch_layout = *channel_layout;
if (!ch_layout)
ch_layout = av_get_default_channel_layout(channels);
s->lfe_on = !!(ch_layout & AV_CH_LOW_FREQUENCY); if (!mask)
av_channel_layout_default(&avctx->ch_layout, channels);
mask = avctx->ch_layout.u.mask;
s->lfe_on = !!(mask & AV_CH_LOW_FREQUENCY);
s->channels = channels; s->channels = channels;
s->fbw_channels = channels - s->lfe_on; s->fbw_channels = channels - s->lfe_on;
s->lfe_channel = s->lfe_on ? s->fbw_channels + 1 : -1; s->lfe_channel = s->lfe_on ? s->fbw_channels + 1 : -1;
if (s->lfe_on) if (s->lfe_on)
ch_layout -= AV_CH_LOW_FREQUENCY; mask -= AV_CH_LOW_FREQUENCY;
switch (ch_layout) { switch (mask) {
case AV_CH_LAYOUT_MONO: s->channel_mode = AC3_CHMODE_MONO; break; case AV_CH_LAYOUT_MONO: s->channel_mode = AC3_CHMODE_MONO; break;
case AV_CH_LAYOUT_STEREO: s->channel_mode = AC3_CHMODE_STEREO; break; case AV_CH_LAYOUT_STEREO: s->channel_mode = AC3_CHMODE_STEREO; break;
case AV_CH_LAYOUT_SURROUND: s->channel_mode = AC3_CHMODE_3F; break; case AV_CH_LAYOUT_SURROUND: s->channel_mode = AC3_CHMODE_3F; break;
@ -2204,9 +2248,9 @@ static av_cold int set_channel_info(AC3EncodeContext *s, int channels,
s->has_surround = s->channel_mode & 0x04; s->has_surround = s->channel_mode & 0x04;
s->channel_map = ac3_enc_channel_map[s->channel_mode][s->lfe_on]; s->channel_map = ac3_enc_channel_map[s->channel_mode][s->lfe_on];
*channel_layout = ch_layout;
if (s->lfe_on) if (s->lfe_on)
*channel_layout |= AV_CH_LOW_FREQUENCY; mask |= AV_CH_LOW_FREQUENCY;
av_channel_layout_from_mask(&avctx->ch_layout, mask);
return 0; return 0;
} }
@ -2218,12 +2262,12 @@ static av_cold int validate_options(AC3EncodeContext *s)
int i, ret, max_sr; int i, ret, max_sr;
/* validate channel layout */ /* validate channel layout */
if (!avctx->channel_layout) { if (!avctx->ch_layout.nb_channels) {
av_log(avctx, AV_LOG_WARNING, "No channel layout specified. The " av_log(avctx, AV_LOG_WARNING, "No channel layout specified. The "
"encoder will guess the layout, but it " "encoder will guess the layout, but it "
"might be incorrect.\n"); "might be incorrect.\n");
} }
ret = set_channel_info(s, avctx->channels, &avctx->channel_layout); ret = set_channel_info(avctx);
if (ret) { if (ret) {
av_log(avctx, AV_LOG_ERROR, "invalid channel layout\n"); av_log(avctx, AV_LOG_ERROR, "invalid channel layout\n");
return ret; return ret;

View File

@ -266,8 +266,10 @@ typedef struct AC3EncodeContext {
void (*output_frame_header)(struct AC3EncodeContext *s); void (*output_frame_header)(struct AC3EncodeContext *s);
} AC3EncodeContext; } AC3EncodeContext;
#if FF_API_OLD_CHANNEL_LAYOUT
extern const uint64_t ff_ac3_channel_layouts[19]; 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 AVOption ff_ac3_enc_options[];
extern const AVClass ff_ac3enc_class; extern const AVClass ff_ac3enc_class;
extern const AVCodecDefault ff_ac3_enc_defaults[]; extern const AVCodecDefault ff_ac3_enc_defaults[];

View File

@ -119,6 +119,7 @@ static av_cold int ac3_fixed_encode_init(AVCodecContext *avctx)
} }
FF_DISABLE_DEPRECATION_WARNINGS
const AVCodec ff_ac3_fixed_encoder = { const AVCodec ff_ac3_fixed_encoder = {
.name = "ac3_fixed", .name = "ac3_fixed",
.long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"), .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
@ -134,6 +135,10 @@ const AVCodec ff_ac3_fixed_encoder = {
.priv_class = &ff_ac3enc_class, .priv_class = &ff_ac3enc_class,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
.supported_samplerates = ff_ac3_sample_rate_tab, .supported_samplerates = ff_ac3_sample_rate_tab,
#if FF_API_OLD_CHANNEL_LAYOUT
.channel_layouts = ff_ac3_channel_layouts, .channel_layouts = ff_ac3_channel_layouts,
#endif
.ch_layouts = ff_ac3_ch_layouts,
.defaults = ff_ac3_enc_defaults, .defaults = ff_ac3_enc_defaults,
}; };
FF_ENABLE_DEPRECATION_WARNINGS

View File

@ -123,6 +123,7 @@ av_cold int ff_ac3_float_encode_init(AVCodecContext *avctx)
return ff_ac3_encode_init(avctx); return ff_ac3_encode_init(avctx);
} }
FF_DISABLE_DEPRECATION_WARNINGS
const AVCodec ff_ac3_encoder = { const AVCodec ff_ac3_encoder = {
.name = "ac3", .name = "ac3",
.long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"), .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
@ -137,7 +138,11 @@ const AVCodec ff_ac3_encoder = {
AV_SAMPLE_FMT_NONE }, AV_SAMPLE_FMT_NONE },
.priv_class = &ff_ac3enc_class, .priv_class = &ff_ac3enc_class,
.supported_samplerates = ff_ac3_sample_rate_tab, .supported_samplerates = ff_ac3_sample_rate_tab,
#if FF_API_OLD_CHANNEL_LAYOUT
.channel_layouts = ff_ac3_channel_layouts, .channel_layouts = ff_ac3_channel_layouts,
#endif
.ch_layouts = ff_ac3_ch_layouts,
.defaults = ff_ac3_enc_defaults, .defaults = ff_ac3_enc_defaults,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
}; };
FF_ENABLE_DEPRECATION_WARNINGS

View File

@ -248,6 +248,7 @@ void ff_eac3_output_frame_header(AC3EncodeContext *s)
} }
FF_DISABLE_DEPRECATION_WARNINGS
const AVCodec ff_eac3_encoder = { const AVCodec ff_eac3_encoder = {
.name = "eac3", .name = "eac3",
.long_name = NULL_IF_CONFIG_SMALL("ATSC A/52 E-AC-3"), .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52 E-AC-3"),
@ -262,7 +263,11 @@ const AVCodec ff_eac3_encoder = {
AV_SAMPLE_FMT_NONE }, AV_SAMPLE_FMT_NONE },
.priv_class = &eac3enc_class, .priv_class = &eac3enc_class,
.supported_samplerates = ff_ac3_sample_rate_tab, .supported_samplerates = ff_ac3_sample_rate_tab,
#if FF_API_OLD_CHANNEL_LAYOUT
.channel_layouts = ff_ac3_channel_layouts, .channel_layouts = ff_ac3_channel_layouts,
#endif
.ch_layouts = ff_ac3_ch_layouts,
.defaults = ff_ac3_enc_defaults, .defaults = ff_ac3_enc_defaults,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
}; };
FF_ENABLE_DEPRECATION_WARNINGS

View File

@ -6,13 +6,13 @@ FATE_AC3 += fate-ac3-4.0
fate-ac3-4.0: CMD = pcm -i $(TARGET_SAMPLES)/ac3/millers_crossing_4.0.ac3 fate-ac3-4.0: CMD = pcm -i $(TARGET_SAMPLES)/ac3/millers_crossing_4.0.ac3
fate-ac3-4.0: REF = $(SAMPLES)/ac3/millers_crossing_4.0_v2.pcm fate-ac3-4.0: REF = $(SAMPLES)/ac3/millers_crossing_4.0_v2.pcm
#request_channel_layout 4 -> front channel #downmix 4.0 -> front channel
FATE_AC3 += fate-ac3-4.0-downmix-mono FATE_AC3 += fate-ac3-4.0-downmix-mono
fate-ac3-4.0-downmix-mono: CMD = pcm -request_channel_layout 4 -i $(TARGET_SAMPLES)/ac3/millers_crossing_4.0.ac3 fate-ac3-4.0-downmix-mono: CMD = pcm -downmix mono -i $(TARGET_SAMPLES)/ac3/millers_crossing_4.0.ac3
fate-ac3-4.0-downmix-mono: REF = $(SAMPLES)/ac3/millers_crossing_4.0_mono_v2.pcm fate-ac3-4.0-downmix-mono: REF = $(SAMPLES)/ac3/millers_crossing_4.0_mono_v2.pcm
FATE_AC3 += fate-ac3-4.0-downmix-stereo FATE_AC3 += fate-ac3-4.0-downmix-stereo
fate-ac3-4.0-downmix-stereo: CMD = pcm -request_channel_layout stereo -i $(TARGET_SAMPLES)/ac3/millers_crossing_4.0.ac3 fate-ac3-4.0-downmix-stereo: CMD = pcm -downmix stereo -i $(TARGET_SAMPLES)/ac3/millers_crossing_4.0.ac3
fate-ac3-4.0-downmix-stereo: REF = $(SAMPLES)/ac3/millers_crossing_4.0_stereo_v2.pcm fate-ac3-4.0-downmix-stereo: REF = $(SAMPLES)/ac3/millers_crossing_4.0_stereo_v2.pcm
FATE_AC3 += fate-ac3-5.1 FATE_AC3 += fate-ac3-5.1
@ -20,11 +20,11 @@ fate-ac3-5.1: CMD = pcm -i $(TARGET_SAMPLES)/ac3/monsters_inc_5.1_448_small.ac3
fate-ac3-5.1: REF = $(SAMPLES)/ac3/monsters_inc_5.1_448_small_v2.pcm fate-ac3-5.1: REF = $(SAMPLES)/ac3/monsters_inc_5.1_448_small_v2.pcm
FATE_AC3 += fate-ac3-5.1-downmix-mono FATE_AC3 += fate-ac3-5.1-downmix-mono
fate-ac3-5.1-downmix-mono: CMD = pcm -request_channel_layout FC -i $(TARGET_SAMPLES)/ac3/monsters_inc_5.1_448_small.ac3 fate-ac3-5.1-downmix-mono: CMD = pcm -downmix FC -i $(TARGET_SAMPLES)/ac3/monsters_inc_5.1_448_small.ac3
fate-ac3-5.1-downmix-mono: REF = $(SAMPLES)/ac3/monsters_inc_5.1_448_small_mono_v2.pcm fate-ac3-5.1-downmix-mono: REF = $(SAMPLES)/ac3/monsters_inc_5.1_448_small_mono_v2.pcm
FATE_AC3 += fate-ac3-5.1-downmix-stereo FATE_AC3 += fate-ac3-5.1-downmix-stereo
fate-ac3-5.1-downmix-stereo: CMD = pcm -request_channel_layout 2c -i $(TARGET_SAMPLES)/ac3/monsters_inc_5.1_448_small.ac3 fate-ac3-5.1-downmix-stereo: CMD = pcm -downmix stereo -i $(TARGET_SAMPLES)/ac3/monsters_inc_5.1_448_small.ac3
fate-ac3-5.1-downmix-stereo: REF = $(SAMPLES)/ac3/monsters_inc_5.1_448_small_stereo_v2.pcm fate-ac3-5.1-downmix-stereo: REF = $(SAMPLES)/ac3/monsters_inc_5.1_448_small_stereo_v2.pcm
FATE_AC3 += fate-ac3-fixed-2.0 FATE_AC3 += fate-ac3-fixed-2.0
@ -32,15 +32,15 @@ fate-ac3-fixed-2.0: CMD = pcm -c ac3_fixed -i $(TARGET_SAMPLES)/ac3/monsters_inc
fate-ac3-fixed-2.0: REF = $(SAMPLES)/ac3/monsters_inc_2.0_192_small_v2.pcm fate-ac3-fixed-2.0: REF = $(SAMPLES)/ac3/monsters_inc_2.0_192_small_v2.pcm
FATE_AC3 += fate-ac3-fixed-4.0-downmix-mono FATE_AC3 += fate-ac3-fixed-4.0-downmix-mono
fate-ac3-fixed-4.0-downmix-mono: CMD = pcm -c ac3_fixed -request_channel_layout mono -i $(TARGET_SAMPLES)/ac3/millers_crossing_4.0.ac3 fate-ac3-fixed-4.0-downmix-mono: CMD = pcm -c ac3_fixed -downmix mono -i $(TARGET_SAMPLES)/ac3/millers_crossing_4.0.ac3
fate-ac3-fixed-4.0-downmix-mono: REF = $(SAMPLES)/ac3/millers_crossing_4.0_mono_v2.pcm fate-ac3-fixed-4.0-downmix-mono: REF = $(SAMPLES)/ac3/millers_crossing_4.0_mono_v2.pcm
FATE_AC3 += fate-ac3-fixed-5.1-downmix-mono FATE_AC3 += fate-ac3-fixed-5.1-downmix-mono
fate-ac3-fixed-5.1-downmix-mono: CMD = pcm -c ac3_fixed -request_channel_layout 4 -i $(TARGET_SAMPLES)/ac3/monsters_inc_5.1_448_small.ac3 fate-ac3-fixed-5.1-downmix-mono: CMD = pcm -c ac3_fixed -downmix mono -i $(TARGET_SAMPLES)/ac3/monsters_inc_5.1_448_small.ac3
fate-ac3-fixed-5.1-downmix-mono: REF = $(SAMPLES)/ac3/monsters_inc_5.1_448_small_mono_v2.pcm fate-ac3-fixed-5.1-downmix-mono: REF = $(SAMPLES)/ac3/monsters_inc_5.1_448_small_mono_v2.pcm
FATE_AC3 += fate-ac3-fixed-5.1-downmix-stereo FATE_AC3 += fate-ac3-fixed-5.1-downmix-stereo
fate-ac3-fixed-5.1-downmix-stereo: CMD = pcm -c ac3_fixed -request_channel_layout 3 -i $(TARGET_SAMPLES)/ac3/monsters_inc_5.1_448_small.ac3 fate-ac3-fixed-5.1-downmix-stereo: CMD = pcm -c ac3_fixed -downmix stereo -i $(TARGET_SAMPLES)/ac3/monsters_inc_5.1_448_small.ac3
fate-ac3-fixed-5.1-downmix-stereo: REF = $(SAMPLES)/ac3/monsters_inc_5.1_448_small_stereo_v2.pcm fate-ac3-fixed-5.1-downmix-stereo: REF = $(SAMPLES)/ac3/monsters_inc_5.1_448_small_stereo_v2.pcm
FATE_EAC3 += fate-eac3-1 FATE_EAC3 += fate-eac3-1