summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavcodec/Makefile6
-rw-r--r--libavcodec/ac3.h41
-rw-r--r--libavcodec/ac3enc.h5
-rw-r--r--libavcodec/ac3enc_combined.c118
-rw-r--r--libavcodec/ac3enc_float.c4
-rw-r--r--libavcodec/allcodecs.c3
6 files changed, 9 insertions, 168 deletions
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 6026d07f42..e0e19a21a1 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -62,9 +62,9 @@ OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o \
mpeg4audio.o kbdwin.o
OBJS-$(CONFIG_AASC_DECODER) += aasc.o msrledec.o
OBJS-$(CONFIG_AC3_DECODER) += ac3dec.o ac3dec_data.o ac3.o kbdwin.o
-OBJS-$(CONFIG_AC3_ENCODER) += ac3enc_combined.o ac3enc_fixed.o ac3enc_float.o ac3tab.o ac3.o kbdwin.o ac3enc.o
-OBJS-$(CONFIG_AC3_FLOAT_ENCODER) += ac3enc_float.o ac3tab.o ac3tab.o ac3.o kbdwin.o
-OBJS-$(CONFIG_AC3_FIXED_ENCODER) += ac3enc_fixed.o ac3tab.o ac3tab.o ac3.o ac3enc.o
+OBJS-$(CONFIG_AC3_ENCODER) += ac3enc_float.o ac3enc.o ac3tab.o \
+ ac3.o kbdwin.o
+OBJS-$(CONFIG_AC3_FIXED_ENCODER) += ac3enc_fixed.o ac3enc.o ac3tab.o ac3.o
OBJS-$(CONFIG_ALAC_DECODER) += alac.o
OBJS-$(CONFIG_ALAC_ENCODER) += alacenc.o
OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mpeg4audio.o
diff --git a/libavcodec/ac3.h b/libavcodec/ac3.h
index 94d6652e78..d53527844c 100644
--- a/libavcodec/ac3.h
+++ b/libavcodec/ac3.h
@@ -131,49 +131,8 @@ typedef enum {
EAC3_FRAME_TYPE_RESERVED
} EAC3FrameType;
-/**
- * Encoding Options used by AVOption.
- */
-typedef struct AC3EncOptions {
- /* AC-3 metadata options*/
- int dialogue_level;
- int bitstream_mode;
- float center_mix_level;
- float surround_mix_level;
- int dolby_surround_mode;
- int audio_production_info;
- int mixing_level;
- int room_type;
- int copyright;
- int original;
- int extended_bsi_1;
- int preferred_stereo_downmix;
- float ltrt_center_mix_level;
- float ltrt_surround_mix_level;
- float loro_center_mix_level;
- float loro_surround_mix_level;
- int extended_bsi_2;
- int dolby_surround_ex_mode;
- int dolby_headphone_mode;
- int ad_converter_type;
- int eac3_mixing_metadata;
- int eac3_info_metadata;
-
- /* other encoding options */
- int allow_per_frame_metadata;
- int stereo_rematrixing;
- int channel_coupling;
- int cpl_start;
-} AC3EncOptions;
-
void ff_ac3_common_init(void);
-extern const int64_t ff_ac3_channel_layouts[];
-extern const AVOption ff_ac3_options[];
-
-extern AVCodec ff_ac3_float_encoder;
-extern AVCodec ff_ac3_fixed_encoder;
-
/**
* Calculate the log power-spectral density of the input signal.
* This gives a rough estimate of signal power in the frequency domain by using
diff --git a/libavcodec/ac3enc.h b/libavcodec/ac3enc.h
index 5c05f2c915..65e88c9e01 100644
--- a/libavcodec/ac3enc.h
+++ b/libavcodec/ac3enc.h
@@ -83,7 +83,6 @@ typedef int64_t CoefSumType;
#define AC3ENC_OPT_ADCONV_HDCD 1
-#if 0
/**
* Encoding Options used by AVOption.
*/
@@ -118,7 +117,7 @@ typedef struct AC3EncOptions {
int channel_coupling;
int cpl_start;
} AC3EncOptions;
-#endif
+
/**
* Data for a single audio block.
*/
@@ -257,6 +256,8 @@ typedef struct AC3EncodeContext {
} AC3EncodeContext;
+extern const int64_t ff_ac3_channel_layouts[19];
+
int ff_ac3_encode_init(AVCodecContext *avctx);
int ff_ac3_encode_close(AVCodecContext *avctx);
diff --git a/libavcodec/ac3enc_combined.c b/libavcodec/ac3enc_combined.c
deleted file mode 100644
index a3f1d27bc5..0000000000
--- a/libavcodec/ac3enc_combined.c
+++ /dev/null
@@ -1,118 +0,0 @@
-
-#include "libavutil/opt.h"
-#include "libavutil/samplefmt.h"
-#include "avcodec.h"
-#include "ac3.h"
-
-typedef struct CombineContext{
- AVClass *av_class; ///< AVClass used for AVOption
- AC3EncOptions options; ///< encoding options
- void *ctx;
- AVCodec *codec;
-}CombineContext;
-
-#define OFFSET(param) offsetof(CombineContext, options.param)
-#define AC3ENC_PARAM (AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
-
-#define AC3ENC_TYPE_AC3_FIXED 0
-#define AC3ENC_TYPE_AC3 1
-#define AC3ENC_TYPE_EAC3 2
-
-#define AC3ENC_TYPE 12354
-
-/* common option values */
-#define AC3ENC_OPT_NONE -1
-#define AC3ENC_OPT_AUTO -1
-#define AC3ENC_OPT_OFF 0
-#define AC3ENC_OPT_ON 1
-#define AC3ENC_OPT_NOT_INDICATED 0
-#define AC3ENC_OPT_MODE_ON 1
-#define AC3ENC_OPT_MODE_OFF 2
-
-/* specific option values */
-#define AC3ENC_OPT_LARGE_ROOM 1
-#define AC3ENC_OPT_SMALL_ROOM 2
-#define AC3ENC_OPT_DOWNMIX_LTRT 1
-#define AC3ENC_OPT_DOWNMIX_LORO 2
-#define AC3ENC_OPT_ADCONV_STANDARD 0
-#define AC3ENC_OPT_ADCONV_HDCD 1
-
-#include "ac3enc_opts_template.c"
-
-static AVClass ac3enc_class = { "AC-3 Encoder", av_default_item_name,
- eac3_options, LIBAVUTIL_VERSION_INT };
-
-static av_cold AVCodec *get_codec(enum AVSampleFormat s){
-#if CONFIG_AC3_FIXED_ENCODER
- if(s==AV_SAMPLE_FMT_S16) return &ff_ac3_fixed_encoder;
-#endif
-#if CONFIG_AC3_FLOAT_ENCODER
- if(s==AV_SAMPLE_FMT_FLT) return &ff_ac3_float_encoder;
-#endif
- return NULL;
-}
-
-
-static av_cold int encode_init(AVCodecContext *avctx)
-{
- CombineContext *c= avctx->priv_data;
- int ret;
- int offset= (uint8_t*)&c->options - (uint8_t*)c;
-
- c->codec= get_codec(avctx->sample_fmt);
- if(!c->codec){
- av_log(avctx, AV_LOG_ERROR, "Unsupported sample format\n");
- return -1;
- }
- c->ctx= av_mallocz(c->codec->priv_data_size);
- memcpy((uint8_t*)c->ctx + offset, &c->options, (uint8_t*)&c->ctx - (uint8_t*)&c->options);
- FFSWAP(void *,avctx->priv_data, c->ctx);
- ret= c->codec->init(avctx);
- FFSWAP(void *,avctx->priv_data, c->ctx);
- return ret;
-}
-
-static int encode_frame(AVCodecContext *avctx, unsigned char *frame,
- int buf_size, void *data)
-{
- CombineContext *c= avctx->priv_data;
- int ret;
-
- FFSWAP(void *,avctx->priv_data, c->ctx);
- ret= c->codec->encode(avctx, frame, buf_size, data);
- FFSWAP(void *,avctx->priv_data, c->ctx);
- return ret;
-}
-
-static av_cold int encode_close(AVCodecContext *avctx)
-{
- CombineContext *c= avctx->priv_data;
- int ret;
-
- FFSWAP(void *,avctx->priv_data, c->ctx);
- ret= c->codec->close(avctx);
- FFSWAP(void *,avctx->priv_data, c->ctx);
- return ret;
-}
-
-AVCodec ff_ac3_encoder = {
- "ac3",
- AVMEDIA_TYPE_AUDIO,
- CODEC_ID_AC3,
- sizeof(CombineContext),
- encode_init,
- encode_frame,
- encode_close,
- NULL,
- .sample_fmts = (const enum AVSampleFormat[]){
-#if CONFIG_AC3_FLOAT_ENCODER
- AV_SAMPLE_FMT_FLT,
-#endif
-#if CONFIG_AC3_FIXED_ENCODER
- AV_SAMPLE_FMT_S16,
-#endif
- AV_SAMPLE_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
- .priv_class = &ac3enc_class,
- .channel_layouts = ff_ac3_channel_layouts,
-};
diff --git a/libavcodec/ac3enc_float.c b/libavcodec/ac3enc_float.c
index 8845518fe0..b1d1221667 100644
--- a/libavcodec/ac3enc_float.c
+++ b/libavcodec/ac3enc_float.c
@@ -120,8 +120,8 @@ static void clip_coefficients(DSPContext *dsp, float *coef, unsigned int len)
#if CONFIG_AC3_ENCODER
-AVCodec ff_ac3_float_encoder = {
- .name = "ac3 float",
+AVCodec ff_ac3_encoder = {
+ .name = "ac3",
.type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_AC3,
.priv_data_size = sizeof(AC3EncodeContext),
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 5480c7e78b..89955017e0 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -239,8 +239,7 @@ void avcodec_register_all(void)
REGISTER_ENCDEC (AAC, aac);
REGISTER_DECODER (AAC_LATM, aac_latm);
REGISTER_ENCDEC (AC3, ac3);
- REGISTER_ENCODER (AC3_FIXED, ac3_fixed); //deprecated, just for libav compatibility
-// REGISTER_ENCODER (AC3_FLOAT, ac3_float); dont remove dont outcomment, for configure
+ REGISTER_ENCODER (AC3_FIXED, ac3_fixed);
REGISTER_ENCDEC (ALAC, alac);
REGISTER_DECODER (ALS, als);
REGISTER_DECODER (AMRNB, amrnb);