diff options
-rw-r--r-- | gtk/src/audiohandler.c | 6 | ||||
-rw-r--r-- | gtk/src/hb-backend.c | 4 | ||||
-rw-r--r-- | gtk/src/queuehandler.c | 2 | ||||
-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 |
7 files changed, 18 insertions, 15 deletions
diff --git a/gtk/src/audiohandler.c b/gtk/src/audiohandler.c index 693b5bff7..52c5f8599 100644 --- a/gtk/src/audiohandler.c +++ b/gtk/src/audiohandler.c @@ -578,7 +578,7 @@ ghb_audio_list_refresh_selected(signal_user_data_t *ud) codec = ghb_settings_combo_option(asettings, "AudioEncoderActual"); double quality = ghb_settings_get_double(asettings, "AudioTrackQuality"); if (ghb_settings_get_boolean(asettings, "AudioTrackQualityEnable") && - quality >= 0) + quality != HB_INVALID_AUDIO_QUALITY) { int codec = ghb_settings_combo_int(asettings, "AudioEncoderActual"); s_quality = ghb_format_quality("Q/", codec, quality); @@ -647,7 +647,7 @@ ghb_audio_list_refresh(signal_user_data_t *ud) codec = ghb_settings_combo_option(asettings, "AudioEncoderActual"); double quality = ghb_settings_get_double(asettings, "AudioTrackQuality"); if (ghb_settings_get_boolean(asettings, "AudioTrackQualityEnable") && - quality >= 0) + quality != HB_INVALID_AUDIO_QUALITY) { int codec = ghb_settings_combo_int(asettings, "AudioEncoderActual"); s_quality = ghb_format_quality("Q/", codec, quality); @@ -1046,7 +1046,7 @@ ghb_add_audio_to_ui(GtkBuilder *builder, const GValue *settings) codec = ghb_settings_combo_option(settings, "AudioEncoderActual"); double quality = ghb_settings_get_double(settings, "AudioTrackQuality"); if (ghb_settings_get_boolean(settings, "AudioTrackQualityEnable") && - quality >= 0) + quality != HB_INVALID_AUDIO_QUALITY) { int codec = ghb_settings_combo_int(settings, "AudioEncoderActual"); s_quality = ghb_format_quality("Q/", codec, quality); diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c index 695bb5465..837da3db2 100644 --- a/gtk/src/hb-backend.c +++ b/gtk/src/hb-backend.c @@ -4986,14 +4986,14 @@ add_job(hb_handle_t *h, GValue *js, gint unique_id, gint titleindex) audio.out.samplerate = srate; double quality = ghb_settings_get_double(asettings, "AudioTrackQuality"); if (ghb_settings_get_boolean(asettings, "AudioTrackQualityEnable") && - quality != -1) + quality != HB_INVALID_AUDIO_QUALITY) { audio.out.quality = quality; audio.out.bitrate = -1; } else { - audio.out.quality = -1; + audio.out.quality = HB_INVALID_AUDIO_QUALITY; audio.out.bitrate = ghb_settings_combo_int(asettings, "AudioBitrate"); diff --git a/gtk/src/queuehandler.c b/gtk/src/queuehandler.c index 939a805a7..405e96a3c 100644 --- a/gtk/src/queuehandler.c +++ b/gtk/src/queuehandler.c @@ -411,7 +411,7 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter) acodec = ghb_settings_combo_option(asettings, "AudioEncoderActual"); double q = ghb_settings_get_double(asettings, "AudioTrackQuality"); if (ghb_settings_get_boolean(asettings, "AudioTrackQualityEnable") && - q >= 0) + q != HB_INVALID_AUDIO_QUALITY) { int codec = ghb_settings_combo_int(asettings, "AudioEncoderActual"); quality = ghb_format_quality("Quality: ", codec, q); 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 ) { |