diff options
author | Rodeo <[email protected]> | 2012-02-21 23:56:12 +0000 |
---|---|---|
committer | Rodeo <[email protected]> | 2012-02-21 23:56:12 +0000 |
commit | 8bd4efe5c7891fc428d56690dfd11aece7734d0e (patch) | |
tree | 396f9e2b342ff01b629d3623cf0da7b5f9658b43 /libhb | |
parent | 2599def15a4b622c9f0e6d354dd9c0ad90531d6c (diff) |
Add HB_INVALID_AUDIO_QUALITY define. -1 is valid for Vorbis VBR and thus doesn't work for this purpose.
Fixes Vorbis VBR with --aq < 0
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4461 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r-- | libhb/common.c | 8 | ||||
-rw-r--r-- | libhb/common.h | 3 | ||||
-rw-r--r-- | libhb/encvorbis.c | 2 | ||||
-rw-r--r-- | libhb/work.c | 8 |
4 files changed, 12 insertions, 9 deletions
diff --git a/libhb/common.c b/libhb/common.c index a55b78962..a5e16984c 100644 --- a/libhb/common.c +++ b/libhb/common.c @@ -581,7 +581,7 @@ void hb_get_audio_quality_limits(uint32_t codec, float *low, float *high, float default: *direction = 0; *granularity = 1; - *low = *high = -1.; + *low = *high = HB_INVALID_AUDIO_QUALITY; break; } } @@ -617,7 +617,7 @@ float hb_get_default_audio_quality( uint32_t codec ) break; default: - quality = -1.; + quality = HB_INVALID_AUDIO_QUALITY; break; } return quality; @@ -1561,7 +1561,7 @@ void hb_audio_config_init(hb_audio_config_t * audiocfg) audiocfg->in.track = audiocfg->out.track = 0; audiocfg->out.codec = HB_ACODEC_FAAC; audiocfg->out.bitrate = -1; - audiocfg->out.quality = -1; + audiocfg->out.quality = HB_INVALID_AUDIO_QUALITY; audiocfg->out.compression_level = -1; audiocfg->out.samplerate = -1; audiocfg->out.mixdown = -1; @@ -1615,7 +1615,7 @@ int hb_audio_add(const hb_job_t * job, const hb_audio_config_t * audiocfg) audio->config.out.dynamic_range_compression = 0; audio->config.out.gain = 0; audio->config.out.compression_level = -1; - audio->config.out.quality = -1; + audio->config.out.quality = HB_INVALID_AUDIO_QUALITY; } else { diff --git a/libhb/common.h b/libhb/common.h index d8ba0efa6..40af25df6 100644 --- a/libhb/common.h +++ b/libhb/common.h @@ -456,6 +456,9 @@ struct hb_job_s #define HB_INPUT_CH_LAYOUT_GET_ENCODED_FRONT_COUNT( a ) ( ( a & HB_INPUT_CH_LAYOUT_ENCODED_FRONT_MASK ) >> 4 ) #define HB_INPUT_CH_LAYOUT_GET_ENCODED_REAR_COUNT( a ) ( ( a & HB_INPUT_CH_LAYOUT_ENCODED_REAR_MASK ) ) +/* define an invalid VBR quality compatible with all VBR-capable codecs */ +#define HB_INVALID_AUDIO_QUALITY (-3.) + struct hb_audio_config_s { /* Output */ diff --git a/libhb/encvorbis.c b/libhb/encvorbis.c index bbbc19785..cb38351cd 100644 --- a/libhb/encvorbis.c +++ b/libhb/encvorbis.c @@ -85,7 +85,7 @@ int encvorbisInit( hb_work_object_t * w, hb_job_t * job ) return -1; } } - else if( audio->config.out.quality != -1 ) + else if( audio->config.out.quality != HB_INVALID_AUDIO_QUALITY ) { // map VBR quality to Vorbis API (divide by 10) if( vorbis_encode_setup_vbr( &pv->vi, pv->out_discrete_channels, diff --git a/libhb/work.c b/libhb/work.c index 80f0363c1..530defde9 100644 --- a/libhb/work.c +++ b/libhb/work.c @@ -437,7 +437,7 @@ void hb_display_job_info( hb_job_t * job ) hb_log( " + encoder: %s", hb_audio_encoders[j].human_readable_name ); if( audio->config.out.bitrate > 0 ) hb_log( " + bitrate: %d kbps, samplerate: %d Hz", audio->config.out.bitrate, audio->config.out.samplerate ); - else if( audio->config.out.quality != -1 ) + else if( audio->config.out.quality != HB_INVALID_AUDIO_QUALITY ) hb_log( " + quality: %.2f, samplerate: %d Hz", audio->config.out.quality, audio->config.out.samplerate ); else if( audio->config.out.samplerate > 0 ) hb_log( " + samplerate: %d Hz", audio->config.out.samplerate ); @@ -736,13 +736,13 @@ static void do_job( hb_job_t * job ) } /* sense-check the requested quality */ - if( audio->config.out.quality != -1 ) + if( audio->config.out.quality != HB_INVALID_AUDIO_QUALITY ) { float best_quality = hb_get_best_audio_quality( audio->config.out.codec, audio->config.out.quality ); if( best_quality != audio->config.out.quality ) { - if( best_quality == -1.0 ) + if( best_quality == HB_INVALID_AUDIO_QUALITY ) { hb_log( "work: quality mode not supported by codec" ); } @@ -758,7 +758,7 @@ static void do_job( hb_job_t * job ) } /* sense-check the requested bitrate */ - if( audio->config.out.quality == -1 ) + if( audio->config.out.quality == HB_INVALID_AUDIO_QUALITY ) { if( audio->config.out.bitrate <= 0 ) { |