diff options
Diffstat (limited to 'libhb')
-rw-r--r-- | libhb/common.c | 31 | ||||
-rw-r--r-- | libhb/common.h | 2 | ||||
-rw-r--r-- | libhb/encfaac.c | 293 | ||||
-rw-r--r-- | libhb/hb.c | 3 | ||||
-rw-r--r-- | libhb/internal.h | 1 | ||||
-rw-r--r-- | libhb/module.defs | 9 | ||||
-rw-r--r-- | libhb/muxavformat.c | 1 | ||||
-rw-r--r-- | libhb/muxmkv.c | 1 | ||||
-rw-r--r-- | libhb/muxmp4.c | 2 | ||||
-rw-r--r-- | libhb/work.c | 1 |
10 files changed, 3 insertions, 341 deletions
diff --git a/libhb/common.c b/libhb/common.c index b3291c2b2..34bc5a047 100644 --- a/libhb/common.c +++ b/libhb/common.c @@ -244,6 +244,7 @@ hb_encoder_internal_t hb_audio_encoders[] = { // legacy encoders, back to HB 0.9.4 whenever possible (disabled) { { "", "dts", NULL, HB_ACODEC_DCA_PASS, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 0, HB_GID_ACODEC_DTS_PASS, }, + { { "AAC (faac)", "faac", NULL, 0, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 0, HB_GID_ACODEC_AAC, }, { { "AAC (ffmpeg)", "ffaac", NULL, HB_ACODEC_FFAAC, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 0, HB_GID_ACODEC_AAC, }, { { "AC3 (ffmpeg)", "ffac3", NULL, HB_ACODEC_AC3, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 0, HB_GID_ACODEC_AC3, }, { { "MP3 (lame)", "lame", NULL, HB_ACODEC_LAME, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 0, HB_GID_ACODEC_MP3, }, @@ -253,7 +254,6 @@ hb_encoder_internal_t hb_audio_encoders[] = // actual encoders { { "AAC (CoreAudio)", "ca_aac", "AAC (Apple AudioToolbox)", HB_ACODEC_CA_AAC, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_ACODEC_AAC, }, { { "HE-AAC (CoreAudio)", "ca_haac", "HE-AAC (Apple AudioToolbox)", HB_ACODEC_CA_HAAC, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_ACODEC_AAC_HE, }, - { { "AAC (faac)", "faac", "AAC (libfaac)", HB_ACODEC_FAAC, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_ACODEC_AAC, }, { { "AAC (avcodec)", "av_aac", "AAC (libavcodec)", HB_ACODEC_FFAAC, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_ACODEC_AAC, }, { { "AAC (FDK)", "fdk_aac", "AAC (libfdk_aac)", HB_ACODEC_FDK_AAC, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_ACODEC_AAC, }, { { "HE-AAC (FDK)", "fdk_haac", "HE-AAC (libfdk_aac)", HB_ACODEC_FDK_HAAC, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_ACODEC_AAC_HE, }, @@ -285,11 +285,6 @@ static int hb_audio_encoder_is_enabled(int encoder) return 1; #endif -#ifdef USE_FAAC - case HB_ACODEC_FAAC: - return 1; -#endif - #ifdef USE_LIBAV_AAC case HB_ACODEC_FFAAC: return avcodec_find_encoder_by_name("aac") != NULL; @@ -862,21 +857,6 @@ fail: * Encoder 1.0 channel 2.0 channels 5.1 channels 6.1 channels 7.1 channels * -------------------------------------------------------------------------------------- * - * faac - * ---- - * supported samplerates: 8 - 48 kHz - * libfaac/util.c defines the bitrate limits: - * MinBitrate() -> 8000 bps (per channel, incl. LFE). - * MaxBitrate() -> (6144 * samplerate / 1024) bps (per channel, incl. LFE). - * But output bitrates don't go as high as the theoretical maximums: - * 12 kHz 43 (72) 87 (144) 260 (432) 303 (504) 342 (576) - * 24 kHz 87 (144) 174 (288) 514 (864) 595 (1008) 669 (1152) - * 48 kHz 174 (288) 347 (576) 970 (1728) 1138 (2016) 1287 (2304) - * Also, faac isn't a great encoder, so you don't want to allow too low a bitrate. - * Limits: minimum of 32 Kbps per channel - * maximum of 192 Kbps per channel at 32-48 kHz, adjusted for sr_shift - * - * * ffaac * ----- * supported samplerates: 8 - 48 kHz @@ -1061,11 +1041,6 @@ void hb_audio_bitrate_get_limits(uint32_t codec, int samplerate, int mixdown, (samplerate >= 22050))); break; - case HB_ACODEC_FAAC: - *low = (nchannels + lfe_count) * 32; - *high = (nchannels + lfe_count) * (192 >> sr_shift); - break; - case HB_ACODEC_FFAAC: *low = ((nchannels + lfe_count) * 32); *high = ((nchannels + lfe_count) * @@ -1500,7 +1475,6 @@ int hb_mixdown_has_codec_support(int mixdown, uint32_t codec) case HB_ACODEC_LAME: return (mixdown <= HB_AMIXDOWN_DOLBYPLII); - case HB_ACODEC_FAAC: case HB_ACODEC_CA_AAC: case HB_ACODEC_CA_HAAC: return ((mixdown <= HB_AMIXDOWN_5POINT1) || @@ -1894,8 +1868,7 @@ int hb_audio_encoder_get_default(int muxer) // Lame is better than our low-end AAC encoders // if the container is MKV, use the former // AAC is still used when the container is MP4 (for better compatibility) - if ((codec == HB_ACODEC_FAAC || - codec == HB_ACODEC_FFAAC) && (muxer & HB_MUX_MASK_MKV) == muxer) + if (codec == HB_ACODEC_FFAAC && (muxer & HB_MUX_MASK_MKV) == muxer) { return HB_ACODEC_LAME; } diff --git a/libhb/common.h b/libhb/common.h index f709f7570..bc790e2d9 100644 --- a/libhb/common.h +++ b/libhb/common.h @@ -597,7 +597,6 @@ struct hb_job_s /* Audio starts here */ /* Audio Codecs: Update win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/NativeConstants.cs when changing these consts */ #define HB_ACODEC_MASK 0x00FFFF00 -#define HB_ACODEC_FAAC 0x00000100 #define HB_ACODEC_LAME 0x00000200 #define HB_ACODEC_VORBIS 0x00000400 #define HB_ACODEC_AC3 0x00000800 @@ -1088,7 +1087,6 @@ extern hb_work_object_t hb_encx265; extern hb_work_object_t hb_decavcodeca; extern hb_work_object_t hb_decavcodecv; extern hb_work_object_t hb_declpcm; -extern hb_work_object_t hb_encfaac; extern hb_work_object_t hb_enclame; extern hb_work_object_t hb_encvorbis; extern hb_work_object_t hb_muxer; diff --git a/libhb/encfaac.c b/libhb/encfaac.c deleted file mode 100644 index 4060c778a..000000000 --- a/libhb/encfaac.c +++ /dev/null @@ -1,293 +0,0 @@ -/* encfaac.c - - Copyright (c) 2003-2014 HandBrake Team - This file is part of the HandBrake source code - Homepage: <http://handbrake.fr/>. - It may be used under the terms of the GNU General Public License v2. - For full terms see the file COPYING file or visit http://www.gnu.org/licenses/gpl-2.0.html - */ - -#ifdef USE_FAAC -#include "hb.h" -#include "audio_remap.h" - -#include "faac.h" - -struct hb_work_private_s -{ - hb_job_t * job; - - faacEncHandle * faac; - unsigned long input_samples; - unsigned long output_bytes; - uint8_t * buf; - uint8_t * obuf; - hb_list_t * list; - double pts; - double framedur; - int out_discrete_channels; -}; - -int encfaacInit( hb_work_object_t *, hb_job_t * ); -int encfaacWork( hb_work_object_t *, hb_buffer_t **, hb_buffer_t ** ); -void encfaacClose( hb_work_object_t * ); - -hb_work_object_t hb_encfaac = -{ - WORK_ENCFAAC, - "AAC encoder (libfaac)", - encfaacInit, - encfaacWork, - encfaacClose -}; - -/*********************************************************************** - * hb_work_encfaac_init - *********************************************************************** - * - **********************************************************************/ -int encfaacInit( hb_work_object_t * w, hb_job_t * job ) -{ - hb_work_private_t * pv = calloc( 1, sizeof( hb_work_private_t ) ); - hb_audio_t * audio = w->audio; - faacEncConfigurationPtr cfg; - uint8_t * bytes; - unsigned long length; - - w->private_data = pv; - - pv->job = job; - - /* pass the number of channels used into the private work data */ - pv->out_discrete_channels = hb_mixdown_get_discrete_channel_count(audio->config.out.mixdown); - - pv->faac = faacEncOpen( audio->config.out.samplerate, pv->out_discrete_channels, - &pv->input_samples, &pv->output_bytes ); - pv->buf = malloc( pv->input_samples * sizeof( float ) ); - pv->obuf = malloc( pv->output_bytes ); - pv->framedur = 90000.0 * pv->input_samples / - ( audio->config.out.samplerate * pv->out_discrete_channels ); - audio->config.out.samples_per_frame = pv->input_samples / pv->out_discrete_channels; - - cfg = faacEncGetCurrentConfiguration( pv->faac ); - cfg->mpegVersion = MPEG4; - cfg->aacObjectType = LOW; - cfg->allowMidside = 1; - - /* channel configuration & remapping */ - uint64_t layout = hb_ff_mixdown_xlat(audio->config.out.mixdown, NULL); - hb_audio_remap_build_table(&hb_aac_chan_map, audio->config.in.channel_map, - layout, cfg->channel_map); - - switch (audio->config.out.mixdown) - { - case HB_AMIXDOWN_7POINT1: - cfg->channelConfiguration = 0; - cfg->numFrontChannels = 3; - cfg->numSideChannels = 2; - cfg->numBackChannels = 2; - cfg->numLFEChannels = 1; - break; - - case HB_AMIXDOWN_6POINT1: - cfg->channelConfiguration = 0; - cfg->numFrontChannels = 3; - cfg->numSideChannels = 0; - cfg->numBackChannels = 3; - cfg->numLFEChannels = 1; - break; - - case HB_AMIXDOWN_5_2_LFE: - cfg->channelConfiguration = 7; - break; - - default: - cfg->channelConfiguration = - hb_mixdown_get_discrete_channel_count(audio->config.out.mixdown); - break; - } - - cfg->useTns = 0; - cfg->bitRate = audio->config.out.bitrate * 1000 / pv->out_discrete_channels; /* Per channel */ - cfg->bandWidth = 0; - cfg->outputFormat = 0; - cfg->inputFormat = FAAC_INPUT_FLOAT; - - if( !faacEncSetConfiguration( pv->faac, cfg ) ) - { - hb_log( "faacEncSetConfiguration failed" ); - *job->done_error = HB_ERROR_INIT; - *job->die = 1; - return 0; - } - - if( faacEncGetDecoderSpecificInfo( pv->faac, &bytes, &length ) < 0 ) - { - hb_log( "faacEncGetDecoderSpecificInfo failed" ); - *job->done_error = HB_ERROR_INIT; - *job->die = 1; - return 0; - } - memcpy( w->config->extradata.bytes, bytes, length ); - w->config->extradata.length = length; - free( bytes ); - - pv->list = hb_list_init(); - - return 0; -} - -/*********************************************************************** - * Close - *********************************************************************** - * - **********************************************************************/ -void encfaacClose( hb_work_object_t * w ) -{ - hb_work_private_t * pv = w->private_data; - if ( pv ) - { - if ( pv->faac ) - { - faacEncClose( pv->faac ); - pv->faac = NULL; - } - if ( pv->buf ) - { - free( pv->buf ); - pv->buf = NULL; - } - if ( pv->obuf ) - { - free( pv->obuf ); - pv->obuf = NULL; - } - if ( pv->list ) - hb_list_empty( &pv->list ); - - free( pv ); - w->private_data = NULL; - } -} - -/*********************************************************************** - * Encode - *********************************************************************** - * - **********************************************************************/ -static hb_buffer_t * Encode( hb_work_object_t * w ) -{ - hb_work_private_t * pv = w->private_data; - - if( hb_list_bytes( pv->list ) < pv->input_samples * sizeof( float ) ) - { - /* Need more data */ - return NULL; - } - - uint64_t pts, pos; - hb_list_getbytes( pv->list, pv->buf, pv->input_samples * sizeof( float ), - &pts, &pos ); - - int i; - float *fltBuf = (float*)pv->buf; - for ( i = 0; i < pv->input_samples; i++ ) - fltBuf[i] *= 32768.0; - - int size = faacEncEncode( pv->faac, (int32_t *)pv->buf, pv->input_samples, - pv->obuf, pv->output_bytes ); - - // AAC needs four frames before it can start encoding so we'll get nothing - // on the first three calls to the encoder. - if ( size > 0 ) - { - hb_buffer_t * buf = hb_buffer_init( size ); - memcpy( buf->data, pv->obuf, size ); - buf->size = size; - buf->s.start = pv->pts; - buf->s.duration = pv->framedur; - buf->s.stop = buf->s.start + buf->s.duration; - buf->s.type = AUDIO_BUF; - buf->s.frametype = HB_FRAME_AUDIO; - pv->pts += pv->framedur; - return buf; - } - return NULL; -} - -static hb_buffer_t *Flush( hb_work_object_t *w, hb_buffer_t *bufin ) -{ - hb_work_private_t *pv = w->private_data; - - // pad whatever data we have out to four input frames. - int nbytes = hb_list_bytes( pv->list ); - int pad = pv->input_samples * sizeof(float) * 4 - nbytes; - if ( pad > 0 ) - { - hb_buffer_t *tmp = hb_buffer_init( pad ); - memset( tmp->data, 0, pad ); - hb_list_add( pv->list, tmp ); - } - - // There are up to three frames buffered in the encoder plus one - // in our list buffer so four calls to Encode should get them all. - hb_buffer_t *bufout = NULL, *buf = NULL; - while ( hb_list_bytes( pv->list ) >= pv->input_samples * sizeof(float) ) - { - hb_buffer_t *b = Encode( w ); - if ( b ) - { - if ( bufout == NULL ) - { - bufout = b; - } - else - { - buf->next = b; - } - buf = b; - } - } - // add the eof marker to the end of our buf chain - if ( buf ) - buf->next = bufin; - else - bufout = bufin; - return bufout; -} - -/*********************************************************************** - * Work - *********************************************************************** - * - **********************************************************************/ -int encfaacWork( hb_work_object_t * w, hb_buffer_t ** buf_in, - hb_buffer_t ** buf_out ) -{ - hb_work_private_t * pv = w->private_data; - hb_buffer_t * buf; - - if ( (*buf_in)->size <= 0 ) - { - // EOF on input. Finish encoding what we have buffered then send - // it & the eof downstream. - - *buf_out = Flush( w, *buf_in ); - *buf_in = NULL; - return HB_WORK_DONE; - } - - hb_list_add( pv->list, *buf_in ); - *buf_in = NULL; - - *buf_out = buf = Encode( w ); - - while( buf ) - { - buf->next = Encode( w ); - buf = buf->next; - } - - return HB_WORK_OK; -} -#endif // USE_FAAC diff --git a/libhb/hb.c b/libhb/hb.c index b6a939e3a..303781cc5 100644 --- a/libhb/hb.c +++ b/libhb/hb.c @@ -1651,9 +1651,6 @@ int hb_global_init() hb_register(&hb_encca_aac); hb_register(&hb_encca_haac); #endif -#ifdef USE_FAAC - hb_register(&hb_encfaac); -#endif hb_register(&hb_enclame); hb_register(&hb_enctheora); hb_register(&hb_encvorbis); diff --git a/libhb/internal.h b/libhb/internal.h index fa3b36f5f..5255c6fac 100644 --- a/libhb/internal.h +++ b/libhb/internal.h @@ -415,7 +415,6 @@ enum WORK_DECAVCODEC, WORK_DECAVCODECV, WORK_DECLPCM, - WORK_ENCFAAC, WORK_ENCLAME, WORK_ENCVORBIS, WORK_ENC_CA_AAC, diff --git a/libhb/module.defs b/libhb/module.defs index 02279befd..73a3b6999 100644 --- a/libhb/module.defs +++ b/libhb/module.defs @@ -1,4 +1,4 @@ -__deps__ := A52DEC BZIP2 FAAC FFMPEG FONTCONFIG FREETYPE LAME LIBASS LIBDCA \ +__deps__ := A52DEC BZIP2 FFMPEG FONTCONFIG FREETYPE LAME LIBASS LIBDCA \ LIBDVDREAD LIBDVDNAV LIBICONV LIBMKV LIBOGG LIBSAMPLERATE LIBTHEORA LIBVORBIS LIBXML2 \ MP4V2 PTHREADW32 X264 X265 ZLIB LIBBLURAY FDKAAC LIBMFX @@ -42,9 +42,6 @@ endif ifeq (1,$(FEATURE.libav_aac)) LIBHB.GCC.D += USE_LIBAV_AAC endif -ifeq (1,$(FEATURE.faac)) -LIBHB.GCC.D += USE_FAAC -endif ifeq (1,$(FEATURE.mp4v2)) LIBHB.GCC.D += USE_MP4V2 endif @@ -126,10 +123,6 @@ ifeq (1,$(FEATURE.fdk_aac)) LIBHB.dll.libs += $(CONTRIB.build/)lib/libfdk-aac.a endif -ifeq (1,$(FEATURE.faac)) -LIBHB.dll.libs += $(CONTRIB.build/)lib/libfaac.a -endif - ifeq (1,$(FEATURE.qsv)) LIBHB.dll.libs += $(CONTRIB.build/)lib/libmfx.a endif diff --git a/libhb/muxavformat.c b/libhb/muxavformat.c index 3e9d9b9e9..a5ca6b5fa 100644 --- a/libhb/muxavformat.c +++ b/libhb/muxavformat.c @@ -490,7 +490,6 @@ static int avformatInit( hb_mux_object_t * m ) audio->priv.config.extradata.length); } break; - case HB_ACODEC_FAAC: case HB_ACODEC_FFAAC: case HB_ACODEC_CA_AAC: case HB_ACODEC_CA_HAAC: diff --git a/libhb/muxmkv.c b/libhb/muxmkv.c index 6c531a755..0c2a28490 100644 --- a/libhb/muxmkv.c +++ b/libhb/muxmkv.c @@ -302,7 +302,6 @@ static int MKVInit( hb_mux_object_t * m ) } track->codecID = MK_ACODEC_FLAC; break; - case HB_ACODEC_FAAC: case HB_ACODEC_FFAAC: case HB_ACODEC_CA_AAC: case HB_ACODEC_CA_HAAC: diff --git a/libhb/muxmp4.c b/libhb/muxmp4.c index dfb4ed58a..946277574 100644 --- a/libhb/muxmp4.c +++ b/libhb/muxmp4.c @@ -439,7 +439,6 @@ static int MP4Init( hb_mux_object_t * m ) } } break; - case HB_ACODEC_FAAC: case HB_ACODEC_FFAAC: case HB_ACODEC_CA_AAC: case HB_ACODEC_CA_HAAC: @@ -456,7 +455,6 @@ static int MP4Init( hb_mux_object_t * m ) switch ( audio->config.out.codec & HB_ACODEC_MASK ) { - case HB_ACODEC_FAAC: case HB_ACODEC_FFAAC: case HB_ACODEC_CA_AAC: case HB_ACODEC_CA_HAAC: diff --git a/libhb/work.c b/libhb/work.c index 2192f593b..c8dcb0c0b 100644 --- a/libhb/work.c +++ b/libhb/work.c @@ -139,7 +139,6 @@ hb_work_object_t* hb_codec_encoder(int codec) switch (codec) { case HB_ACODEC_AC3: return hb_get_work(WORK_ENCAVCODEC_AUDIO); - case HB_ACODEC_FAAC: return hb_get_work(WORK_ENCFAAC); case HB_ACODEC_LAME: return hb_get_work(WORK_ENCLAME); case HB_ACODEC_VORBIS: return hb_get_work(WORK_ENCVORBIS); case HB_ACODEC_CA_AAC: return hb_get_work(WORK_ENC_CA_AAC); |