diff options
author | jstebbins <[email protected]> | 2011-07-24 16:05:29 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2011-07-24 16:05:29 +0000 |
commit | 4055a1e30dd5522770844e6e09c308ccf665f412 (patch) | |
tree | 9e1d8ac284a0af836f071d1b2e86b35c8a9ff379 /libhb | |
parent | b083d74c3e01e42b617e664fa63c39e3a8edf6ad (diff) |
libhb: encavcodecaudio improvements
Compute the output layout once in encavcodecaInit and store it in a member
of the hb_encavcodeca work object.
Fix the channel mapping of ffaac in our code rather than applying a patch
to Libav. The Libav AAC encoder is bound to see a certain amount of
commit activity since it needs to be improved. A patch affecting the AAC
encoder is bound to break regularly
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4131 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r-- | libhb/encavcodecaudio.c | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/libhb/encavcodecaudio.c b/libhb/encavcodecaudio.c index 78d1a0565..9239c519a 100644 --- a/libhb/encavcodecaudio.c +++ b/libhb/encavcodecaudio.c @@ -16,6 +16,7 @@ struct hb_work_private_s int out_discrete_channels; int samples_per_frame; + int layout; unsigned long input_samples; unsigned long output_bytes; hb_list_t * list; @@ -69,16 +70,19 @@ static int encavcodecaInit( hb_work_object_t * w, hb_job_t * job ) { case HB_AMIXDOWN_MONO: context->channel_layout = AV_CH_LAYOUT_MONO; + pv->layout = HB_INPUT_CH_LAYOUT_MONO; break; case HB_AMIXDOWN_STEREO: case HB_AMIXDOWN_DOLBY: case HB_AMIXDOWN_DOLBYPLII: context->channel_layout = AV_CH_LAYOUT_STEREO; + pv->layout = HB_INPUT_CH_LAYOUT_STEREO; break; case HB_AMIXDOWN_6CH: context->channel_layout = AV_CH_LAYOUT_5POINT1; + pv->layout = HB_INPUT_CH_LAYOUT_3F2R | HB_INPUT_CH_LAYOUT_HAS_LFE; break; default: @@ -168,26 +172,14 @@ static hb_buffer_t * Encode( hb_work_object_t * w ) hb_list_getbytes( pv->list, pv->buf, pv->input_samples * sizeof( float ), &pts, &pos); - if ( audio->config.in.channel_map != &hb_smpte_chan_map ) + // XXX: ffaac fails to remap from the internal libav* channel map (SMPTE) to the native AAC channel map + // do it here - this hack should be removed if Libav fixes the bug + hb_chan_map_t * out_map = ( w->codec_param == CODEC_ID_AAC ) ? &hb_qt_chan_map : &hb_smpte_chan_map; + + if ( audio->config.in.channel_map != out_map ) { - int layout; - switch (audio->config.out.mixdown) - { - case HB_AMIXDOWN_MONO: - layout = HB_INPUT_CH_LAYOUT_MONO; - break; - case HB_AMIXDOWN_STEREO: - case HB_AMIXDOWN_DOLBY: - case HB_AMIXDOWN_DOLBYPLII: - layout = HB_INPUT_CH_LAYOUT_STEREO; - break; - case HB_AMIXDOWN_6CH: - default: - layout = HB_INPUT_CH_LAYOUT_3F2R | HB_INPUT_CH_LAYOUT_HAS_LFE; - break; - } - hb_layout_remap( audio->config.in.channel_map, &hb_smpte_chan_map, layout, - (float*)pv->buf, pv->samples_per_frame); + hb_layout_remap( audio->config.in.channel_map, out_map, pv->layout, + (float*)pv->buf, pv->samples_per_frame ); } // Do we need to convert our internal float format? |