diff options
author | jstebbins <[email protected]> | 2014-08-11 17:16:23 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2014-08-11 17:16:23 +0000 |
commit | 9f932fe0d2d9d2255e1dfd80b3c542901f260142 (patch) | |
tree | d908fc00a933aebccf6a03b605445451ec2ba5a4 /gtk | |
parent | 193d4e7df8c3ade21d168d2ab49a80afb20746cd (diff) |
LinGui: Fix a problem with audio quality slider
It was getting reset to default value every time another audio
widget changed.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6290 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/src/audiohandler.c | 48 |
1 files changed, 34 insertions, 14 deletions
diff --git a/gtk/src/audiohandler.c b/gtk/src/audiohandler.c index 32ce8367f..2f7c93aea 100644 --- a/gtk/src/audiohandler.c +++ b/gtk/src/audiohandler.c @@ -1780,6 +1780,8 @@ audio_def_setting_add_cb(GtkWidget *w, signal_user_data_t *ud); G_MODULE_EXPORT void audio_def_setting_remove_cb(GtkWidget *w, signal_user_data_t *ud); G_MODULE_EXPORT void +audio_def_encoder_changed_cb(GtkWidget *w, signal_user_data_t *ud); +G_MODULE_EXPORT void audio_def_encode_setting_changed_cb(GtkWidget *w, signal_user_data_t *ud); G_MODULE_EXPORT void audio_def_drc_changed_cb(GtkWidget *w, gdouble drc, signal_user_data_t *ud); @@ -1829,7 +1831,7 @@ GtkWidget * ghb_create_audio_settings_row(signal_user_data_t *ud) gtk_widget_set_valign(GTK_WIDGET(combo), GTK_ALIGN_CENTER); gtk_widget_set_name(GTK_WIDGET(combo), "AudioEncoder"); gtk_widget_show(GTK_WIDGET(combo)); - g_signal_connect(combo, "changed", (GCallback)audio_def_encode_setting_changed_cb, ud); + g_signal_connect(combo, "changed", (GCallback)audio_def_encoder_changed_cb, ud); gtk_box_pack_start(box2, GTK_WIDGET(combo), FALSE, FALSE, 0); box3 = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0)); @@ -2133,26 +2135,33 @@ audio_remove_lang_clicked_cb(GtkWidget *widget, signal_user_data_t *ud) } } -static void audio_quality_update_limits(GtkWidget *widget, int encoder) +static void audio_quality_update_limits( + GtkWidget *widget, + int encoder, + gboolean set_default, + gdouble value) { - float low, high, gran, defval; + float low, high, gran; int dir; hb_audio_quality_get_limits(encoder, &low, &high, &gran, &dir); - defval = hb_audio_quality_get_default(encoder); + if (set_default) + { + value = hb_audio_quality_get_default(encoder); + if (dir) + { + // Quality values are inverted + value = high - value + low; + } + } GtkScaleButton *sb; GtkAdjustment *adj; sb = GTK_SCALE_BUTTON(widget); adj = gtk_scale_button_get_adjustment(sb); - if (dir) - { - // Quality values are inverted - defval = high - defval + low; - } - gtk_adjustment_configure (adj, defval, low, high, gran, gran * 10, 0); + gtk_adjustment_configure (adj, value, low, high, gran, gran * 10, 0); } -void audio_def_set_limits(signal_user_data_t *ud, GtkWidget *widget) +void audio_def_set_limits(signal_user_data_t *ud, GtkWidget *widget, gboolean set_default) { GtkListBoxRow *row = audio_settings_get_row(widget); gint index = gtk_list_box_row_get_index(row); @@ -2167,6 +2176,8 @@ void audio_def_set_limits(signal_user_data_t *ud, GtkWidget *widget) int codec = ghb_settings_audio_encoder_codec(adict, "AudioEncoder"); int fallback = ghb_settings_audio_encoder_codec(ud->settings, "AudioEncoderFallback"); + gdouble quality = ghb_settings_get_double(adict, "AudioTrackQuality"); + // Allow quality settings if the current encoder supports quality // or if the encoder is auto-passthru and the fallback encoder // supports quality. @@ -2185,7 +2196,8 @@ void audio_def_set_limits(signal_user_data_t *ud, GtkWidget *widget) enc = fallback; } audio_quality_update_limits(find_widget(GTK_WIDGET(row), - "AudioTrackQuality"), enc); + "AudioTrackQuality"), enc, + set_default, quality); } enc = codec; @@ -2210,7 +2222,7 @@ void audio_def_set_limits(signal_user_data_t *ud, GtkWidget *widget) void audio_def_set_all_limits_cb(GtkWidget *widget, gpointer data) { signal_user_data_t *ud = (signal_user_data_t*)data; - audio_def_set_limits(ud, widget); + audio_def_set_limits(ud, widget, FALSE); } void audio_def_set_all_limits(signal_user_data_t *ud) @@ -2350,10 +2362,18 @@ audio_def_setting_remove_cb(GtkWidget *widget, signal_user_data_t *ud) } G_MODULE_EXPORT void +audio_def_encoder_changed_cb(GtkWidget *widget, signal_user_data_t *ud) +{ + audio_def_setting_update(ud, widget); + audio_def_set_limits(ud, widget, TRUE); + ghb_clear_presets_selection(ud); +} + +G_MODULE_EXPORT void audio_def_encode_setting_changed_cb(GtkWidget *widget, signal_user_data_t *ud) { audio_def_setting_update(ud, widget); - audio_def_set_limits(ud, widget); + audio_def_set_limits(ud, widget, FALSE); ghb_clear_presets_selection(ud); } |