summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--contrib/ffmpeg/A04-aacenc-chan-order.patch46
-rw-r--r--gtk/src/hb-backend.c10
-rw-r--r--libhb/encavcodecaudio.c3
-rw-r--r--macosx/HBAudio.m7
-rw-r--r--test/test.c4
5 files changed, 69 insertions, 1 deletions
diff --git a/contrib/ffmpeg/A04-aacenc-chan-order.patch b/contrib/ffmpeg/A04-aacenc-chan-order.patch
new file mode 100644
index 000000000..6a8a6c988
--- /dev/null
+++ b/contrib/ffmpeg/A04-aacenc-chan-order.patch
@@ -0,0 +1,46 @@
+diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
+index 66af2b1..16c5906 100644
+--- a/libavcodec/aacenc.c
++++ b/libavcodec/aacenc.c
+@@ -135,6 +135,15 @@ static const uint8_t aac_chan_configs[6][5] = {
+ {4, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_LFE}, // 6 channels - front center + stereo + back stereo + LFE
+ };
+
++static const uint8_t channel_maps[][AAC_MAX_CHANNELS] = {
++ { 0 },
++ { 0, 1 },
++ { 2, 0, 1 },
++ { 2, 0, 1, 3 },
++ { 2, 0, 1, 3, 4 },
++ { 2, 0, 1, 4, 5, 3 },
++};
++
+ /**
+ * Make AAC audio config object.
+ * @see 1.6.2.1 "Syntax - AudioSpecificConfig"
+@@ -499,15 +508,24 @@ static int aac_encode_frame(AVCodecContext *avctx,
+ return 0;
+ if (data) {
+ if (!s->psypp) {
++ if (avctx->channels <= 2) {
+ memcpy(s->samples + 1024 * avctx->channels, data,
+ 1024 * avctx->channels * sizeof(s->samples[0]));
++ } else {
++ for (i = 0; i < 1024; i++)
++ for (ch = 0; ch < avctx->channels; ch++)
++ s->samples[(i + 1024) * avctx->channels + ch] =
++ ((int16_t*)data)[i * avctx->channels +
++ channel_maps[avctx->channels-1][ch]];
++ }
+ } else {
+ start_ch = 0;
+ samples2 = s->samples + 1024 * avctx->channels;
+ for (i = 0; i < chan_map[0]; i++) {
+ tag = chan_map[i+1];
+ chans = tag == TYPE_CPE ? 2 : 1;
+- ff_psy_preprocess(s->psypp, (uint16_t*)data + start_ch,
++ ff_psy_preprocess(s->psypp,
++ (uint16_t*)data + channel_maps[avctx->channels-1][start_ch],
+ samples2 + start_ch, start_ch, chans);
+ start_ch += chans;
+ }
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index 39c8cbd70..df909c1b9 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -252,6 +252,7 @@ combo_opts_t vcodec_opts =
static options_map_t d_acodec_opts[] =
{
{"AAC (faac)", "faac", HB_ACODEC_FAAC, "faac"},
+ {"AAC (ffmpeg)", "ffaac", HB_ACODEC_FFAAC, "ffaac"},
{"MP3 (lame)", "lame", HB_ACODEC_LAME, "lame"},
{"Vorbis", "vorbis", HB_ACODEC_VORBIS, "vorbis"},
{"AC3 (ffmpeg)", "ac3", HB_ACODEC_AC3, "ac3"},
@@ -1555,6 +1556,7 @@ ghb_grey_combo_options(GtkBuilder *builder)
ghb_value_free(gval);
grey_combo_box_item(builder, "x264_analyse", 4, TRUE);
+ grey_combo_box_item(builder, "AudioEncoder", HB_ACODEC_FFAAC, FALSE);
grey_combo_box_item(builder, "AudioEncoder", HB_ACODEC_FAAC, FALSE);
grey_combo_box_item(builder, "AudioEncoder", HB_ACODEC_LAME, FALSE);
grey_combo_box_item(builder, "AudioEncoder", HB_ACODEC_VORBIS, FALSE);
@@ -4145,6 +4147,10 @@ ghb_select_audio_codec(GValue *settings, hb_audio_config_t *aconfig, gint acodec
{
return HB_ACODEC_FAAC;
}
+ else if (acodec & HB_ACODEC_FFAAC)
+ {
+ return HB_ACODEC_FFAAC;
+ }
else
{
return HB_ACODEC_FAAC;
@@ -4172,6 +4178,10 @@ ghb_select_audio_codec(GValue *settings, hb_audio_config_t *aconfig, gint acodec
{
return HB_ACODEC_FAAC;
}
+ else if (acodec & HB_ACODEC_FFAAC)
+ {
+ return HB_ACODEC_FFAAC;
+ }
else
{
return HB_ACODEC_LAME;
diff --git a/libhb/encavcodecaudio.c b/libhb/encavcodecaudio.c
index 3258ca042..86ab66300 100644
--- a/libhb/encavcodecaudio.c
+++ b/libhb/encavcodecaudio.c
@@ -174,7 +174,8 @@ static hb_buffer_t * Encode( hb_work_object_t * w )
{
map = &hb_ac3_chan_map;
}
- else if ( audio->config.in.codec == HB_ACODEC_DCA )
+ else if ( audio->config.in.codec == HB_ACODEC_DCA ||
+ audio->config.in.codec == HB_ACODEC_LPCM )
{
map = &hb_qt_chan_map;
}
diff --git a/macosx/HBAudio.m b/macosx/HBAudio.m
index 408474359..ba684a3ca 100644
--- a/macosx/HBAudio.m
+++ b/macosx/HBAudio.m
@@ -85,6 +85,13 @@ static NSMutableArray *masterBitRateArray = nil;
nil]];
}
[masterCodecArray addObject: [NSDictionary dictionaryWithObjectsAndKeys:
+ NSLocalizedString(@"AAC (ffmpeg)", @"AAC (ffmpeg)"), keyAudioCodecName,
+ [NSNumber numberWithInt: HB_ACODEC_FFAAC], keyAudioCodec,
+ [NSNumber numberWithBool: YES], keyAudioMP4,
+ [NSNumber numberWithBool: YES], keyAudioMKV,
+ [NSNumber numberWithBool: NO], keyAudioMustMatchTrack,
+ nil]];
+ [masterCodecArray addObject: [NSDictionary dictionaryWithObjectsAndKeys:
NSLocalizedString(@"AAC (faac)", @"AAC (faac)"), keyAudioCodecName,
[NSNumber numberWithInt: HB_ACODEC_FAAC], keyAudioCodec,
[NSNumber numberWithBool: YES], keyAudioMP4,
diff --git a/test/test.c b/test/test.c
index d2b30124a..5052231e6 100644
--- a/test/test.c
+++ b/test/test.c
@@ -3569,6 +3569,10 @@ static int get_acodec_for_string( char *codec )
{
return HB_ACODEC_FAAC;
}
+ else if( !strcasecmp( codec, "ffaac" ) )
+ {
+ return HB_ACODEC_FFAAC;
+ }
else if( !strcasecmp( codec, "vorbis") )
{
return HB_ACODEC_VORBIS;