summaryrefslogtreecommitdiffstats
path: root/libhb/platform/macosx
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2011-10-12 20:19:33 +0000
committerjstebbins <[email protected]>2011-10-12 20:19:33 +0000
commit9d95d88d5a05abf6086ab474c0aa2583a9da6345 (patch)
tree5ff672576f6efacb2f03a36b85a88a8b2d3e85e1 /libhb/platform/macosx
parentd41d9e0d88a689a11fe0978d4e415b89e72c2e62 (diff)
Add flac + quality + compression level support
Adds flac audio to cli, lingui, and macgui Adds quality and compression level options to cli Adds quality option to lingui Quality option works for vorbis and lame git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4281 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/platform/macosx')
-rw-r--r--libhb/platform/macosx/encca_aac.c89
1 files changed, 57 insertions, 32 deletions
diff --git a/libhb/platform/macosx/encca_aac.c b/libhb/platform/macosx/encca_aac.c
index 35b737e79..35eee4a00 100644
--- a/libhb/platform/macosx/encca_aac.c
+++ b/libhb/platform/macosx/encca_aac.c
@@ -200,33 +200,58 @@ int encCoreAudioInit( hb_work_object_t * w, hb_job_t * job, enum AAC_MODE mode )
AudioConverterSetProperty( pv->converter, kAudioConverterCodecQuality,
sizeof( tmp ), &tmp );
- // set encoder bitrate control mode to constrained variable
- tmp = kAudioCodecBitRateControlMode_VariableConstrained;
- AudioConverterSetProperty( pv->converter, kAudioCodecPropertyBitRateControlMode,
- sizeof( tmp ), &tmp );
-
- // get available bitrates
- AudioValueRange *bitrates;
- ssize_t bitrateCounts;
- err = AudioConverterGetPropertyInfo( pv->converter, kAudioConverterApplicableEncodeBitRates,
- &tmpsiz, NULL);
- bitrates = malloc( tmpsiz );
- err = AudioConverterGetProperty( pv->converter, kAudioConverterApplicableEncodeBitRates,
- &tmpsiz, bitrates);
- bitrateCounts = tmpsiz / sizeof( AudioValueRange );
-
- // set bitrate
- tmp = audio->config.out.bitrate * 1000;
- if( tmp < bitrates[0].mMinimum )
- tmp = bitrates[0].mMinimum;
- if( tmp > bitrates[bitrateCounts-1].mMinimum )
- tmp = bitrates[bitrateCounts-1].mMinimum;
- free( bitrates );
- if( tmp != audio->config.out.bitrate * 1000 )
- hb_log( "encca_aac: sanitizing track %d audio bitrate %d to %"PRIu32"",
- audio->config.out.track, audio->config.out.bitrate, tmp/1000 );
- AudioConverterSetProperty( pv->converter, kAudioConverterEncodeBitRate,
- sizeof( tmp ), &tmp );
+ if( audio->config.out.bitrate > 0 )
+ {
+ // set encoder bitrate control mode to constrained variable
+ tmp = kAudioCodecBitRateControlMode_VariableConstrained;
+ AudioConverterSetProperty( pv->converter, kAudioCodecPropertyBitRateControlMode,
+ sizeof( tmp ), &tmp );
+
+ // get available bitrates
+ AudioValueRange *bitrates;
+ ssize_t bitrateCounts;
+ err = AudioConverterGetPropertyInfo( pv->converter, kAudioConverterApplicableEncodeBitRates,
+ &tmpsiz, NULL);
+ bitrates = malloc( tmpsiz );
+ err = AudioConverterGetProperty( pv->converter, kAudioConverterApplicableEncodeBitRates,
+ &tmpsiz, bitrates);
+ bitrateCounts = tmpsiz / sizeof( AudioValueRange );
+
+ // set bitrate
+ tmp = audio->config.out.bitrate * 1000;
+ if( tmp < bitrates[0].mMinimum )
+ tmp = bitrates[0].mMinimum;
+ if( tmp > bitrates[bitrateCounts-1].mMinimum )
+ tmp = bitrates[bitrateCounts-1].mMinimum;
+ free( bitrates );
+ if( tmp != audio->config.out.bitrate * 1000 )
+ hb_log( "encca_aac: sanitizing track %d audio bitrate %d to %"PRIu32"",
+ audio->config.out.track, audio->config.out.bitrate, tmp/1000 );
+ AudioConverterSetProperty( pv->converter, kAudioConverterEncodeBitRate,
+ sizeof( tmp ), &tmp );
+ }
+ else if( audio->config.out.quality >= 0 )
+ {
+ if( mode != AAC_MODE_LC )
+ {
+ hb_log( "encCoreAudioInit: internal error, VBR set but not applicable" );
+ return 1;
+ }
+ // set encoder bitrate control mode to variable
+ tmp = kAudioCodecBitRateControlMode_Variable;
+ AudioConverterSetProperty( pv->converter, kAudioCodecPropertyBitRateControlMode,
+ sizeof( tmp ), &tmp );
+
+ // set quality
+ tmp = audio->config.out.quality;
+ AudioConverterSetProperty( pv->converter, kAudioCodecPropertySoundQualityForVBR,
+ sizeof( tmp ), &tmp );
+ }
+ else
+ {
+ hb_log( "encCoreAudioInit: internal error, bitrate/quality not set" );
+ return 1;
+ }
// get real input
tmpsiz = sizeof( input );
@@ -272,14 +297,14 @@ int encCoreAudioInit( hb_work_object_t * w, hb_job_t * job, enum AAC_MODE mode )
tmp = HB_CONFIG_MAX_SIZE;
AudioConverterGetProperty( pv->converter,
kAudioConverterCompressionMagicCookie,
- &tmp, w->config->aac.bytes );
+ &tmp, w->config->extradata.bytes );
// CoreAudio returns a complete ESDS, but we only need
// the DecoderSpecific info.
UInt8* buffer = NULL;
- ReadESDSDescExt(w->config->aac.bytes, &buffer, &tmpsiz, 0);
- w->config->aac.length = tmpsiz;
- memmove( w->config->aac.bytes, buffer,
- w->config->aac.length );
+ ReadESDSDescExt(w->config->extradata.bytes, &buffer, &tmpsiz, 0);
+ w->config->extradata.length = tmpsiz;
+ memmove( w->config->extradata.bytes, buffer,
+ w->config->extradata.length );
pv->list = hb_list_init();
pv->buf = NULL;