*/
/**
- * @file libavcodec/ac3enc.c
+ * @file
* The simplest AC-3 encoder.
*/
//#define DEBUG
//#define DEBUG_BITALLOC
#include "libavutil/crc.h"
#include "avcodec.h"
-#include "get_bits.h" // for ff_reverse
+#include "libavutil/common.h" /* for av_reverse */
#include "put_bits.h"
#include "ac3.h"
#include "audioconvert.h"
/* reverse */
for(j=0;j<np;j++) {
- int k = ff_reverse[j] >> (8 - ln);
+ int k = av_reverse[j] >> (8 - ln);
if (k < j)
FFSWAP(IComplex, z[k], z[j]);
}
exp_strategy[0][ch] = EXP_NEW;
for(i=1;i<NB_BLOCKS;i++) {
exp_diff = calc_exp_diff(exp[i][ch], exp[i-1][ch], N/2);
-#ifdef DEBUG
- av_log(NULL, AV_LOG_DEBUG, "exp_diff=%d\n", exp_diff);
-#endif
+ dprintf(NULL, "exp_diff=%d\n", exp_diff);
if (exp_diff > EXP_DIFF_THRESHOLD)
exp_strategy[i][ch] = EXP_NEW;
else
ac3_common_init();
+ if (!avctx->channel_layout) {
+ av_log(avctx, AV_LOG_WARNING, "No channel layout specified. The "
+ "encoder will guess the layout, but it "
+ "might be incorrect.\n");
+ }
if (set_channel_info(s, avctx->channels, &avctx->channel_layout)) {
av_log(avctx, AV_LOG_ERROR, "invalid channel layout\n");
return -1;
AVCodec ac3_encoder = {
"ac3",
- CODEC_TYPE_AUDIO,
+ AVMEDIA_TYPE_AUDIO,
CODEC_ID_AC3,
sizeof(AC3EncodeContext),
AC3_encode_init,
AC3_encode_frame,
AC3_encode_close,
NULL,
- .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
+ .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
.long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
- .channel_layouts = (int64_t[]){
+ .channel_layouts = (const int64_t[]){
CH_LAYOUT_MONO,
CH_LAYOUT_STEREO,
CH_LAYOUT_2_1,