diff options
author | Rodeo <[email protected]> | 2012-07-12 20:13:23 +0000 |
---|---|---|
committer | Rodeo <[email protected]> | 2012-07-12 20:13:23 +0000 |
commit | 252b183a32348050bbf9c23f3d70e9723db9271a (patch) | |
tree | c7a204fbdfd3c3413c788445cfad05c7a7344fc6 /libhb/platform/macosx | |
parent | f0c657025d394b1224abc6184bfea1540c9b9b16 (diff) |
hb_audio_remap improvements.
This moves some logic outside of the decoders/encoders and into a single place.
Encoders that do their own remapping (faac, vorbis) can still generate a remap table with hb_audio_remap_build_table(), without having to use hb_audio_remap().
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4827 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/platform/macosx')
-rw-r--r-- | libhb/platform/macosx/encca_aac.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/libhb/platform/macosx/encca_aac.c b/libhb/platform/macosx/encca_aac.c index 7839ed930..8ee84276e 100644 --- a/libhb/platform/macosx/encca_aac.c +++ b/libhb/platform/macosx/encca_aac.c @@ -49,7 +49,7 @@ struct hb_work_private_s uint64_t pts, ibytes; Float64 osamplerate; - int *remap_table; + hb_audio_remap_t *remap; }; #define MP4ESDescrTag 0x03 @@ -289,16 +289,12 @@ int encCoreAudioInit(hb_work_object_t *w, hb_job_t *job, enum AAC_MODE mode) audio->config.out.samples_per_frame = pv->isamples; // channel remapping - if (pv->nchannels > 2 && audio->config.in.channel_map != &hb_aac_chan_map) + uint64_t layout = hb_ff_mixdown_xlat(audio->config.out.mixdown, NULL); + pv->remap = hb_audio_remap_init(layout, &hb_aac_chan_map, + audio->config.in.channel_map); + if (pv->remap == NULL) { - uint64_t layout = hb_ff_mixdown_xlat(audio->config.out.mixdown, NULL); - pv->remap_table = hb_audio_remap_build_table(layout, - audio->config.in.channel_map, - &hb_aac_chan_map); - } - else - { - pv->remap_table = NULL; + hb_log("encCoreAudioInit: hb_audio_remap_init() failed"); } // get maximum output size @@ -344,9 +340,9 @@ void encCoreAudioClose(hb_work_object_t *w) { free(pv->buf); } - if (pv->remap_table != NULL) + if (pv->remap != NULL) { - free(pv->remap_table); + hb_audio_remap_free(pv->remap); } hb_list_empty(&pv->list); free(pv); @@ -392,12 +388,8 @@ static OSStatus inInputDataProc(AudioConverterRef converter, UInt32 *npackets, *npackets = buffers->mBuffers[0].mDataByteSize / pv->isamplesiz; pv->ibytes -= buffers->mBuffers[0].mDataByteSize; - if (pv->remap_table != NULL) - { - hb_audio_remap(pv->nchannels, *npackets, - (hb_sample_t*)buffers->mBuffers[0].mData, - pv->remap_table); - } + hb_audio_remap(pv->remap, + (hb_sample_t*)buffers->mBuffers[0].mData, *npackets); return noErr; } |