From e50ecd9168341b9471c9c7989fe044ef12976964 Mon Sep 17 00:00:00 2001 From: jstebbins Date: Sat, 14 Jan 2012 19:53:55 +0000 Subject: Add preference to enabled auto passthru options The advanced auto passthru options are probably overkill for 90% of people. So simplify the UI by hiding them unless the user explicitly asks for them in preferences. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4410 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- gtk/src/audiohandler.c | 116 +++++++++++++++++++++++------------------- gtk/src/audiohandler.h | 1 + gtk/src/callbacks.c | 11 ++++ gtk/src/ghb.ui | 31 +++++++++-- gtk/src/internal_defaults.xml | 2 + 5 files changed, 107 insertions(+), 54 deletions(-) (limited to 'gtk') diff --git a/gtk/src/audiohandler.c b/gtk/src/audiohandler.c index 4f2925359..94b336306 100644 --- a/gtk/src/audiohandler.c +++ b/gtk/src/audiohandler.c @@ -28,6 +28,19 @@ static void ghb_clear_audio_list_ui(GtkBuilder *builder); static gboolean block_updates = FALSE; +void +ghb_show_hide_advanced_audio( signal_user_data_t *ud ) +{ + GtkWidget *widget; + + g_debug("audio_advanced_clicked_cb ()"); + widget = GHB_WIDGET(ud->builder, "AdvancedAudioExpander"); + if (!ghb_settings_get_boolean(ud->settings, "AdvancedAutoPassthru")) + gtk_widget_hide(widget); + else + gtk_widget_show(widget); +} + void check_list_full(signal_user_data_t *ud) { @@ -83,32 +96,42 @@ int ghb_get_copy_mask(GValue *settings) { gint mask = 0; - if (ghb_settings_get_boolean(settings, "AudioAllowMP3Pass")) - { - mask |= HB_ACODEC_MP3; - } - if (ghb_settings_get_boolean(settings, "AudioAllowAACPass")) - { - mask |= HB_ACODEC_FFAAC; - } - if (ghb_settings_get_boolean(settings, "AudioAllowAC3Pass")) - { - mask |= HB_ACODEC_AC3; - } - if (ghb_settings_get_boolean(settings, "AudioAllowDTSPass")) - { - mask |= HB_ACODEC_DCA; - } - if (ghb_settings_get_boolean(settings, "AudioAllowDTSHDPass")) - { - mask |= HB_ACODEC_DCA_HD; - } + if (!ghb_settings_get_boolean(settings, "AdvancedAutoPassthru")) + { + mask = HB_ACODEC_MP3 | + HB_ACODEC_FFAAC | + HB_ACODEC_AC3 | + HB_ACODEC_DCA | + HB_ACODEC_DCA_HD; + return mask; + } + if (ghb_settings_get_boolean(settings, "AudioAllowMP3Pass")) + { + mask |= HB_ACODEC_MP3; + } + if (ghb_settings_get_boolean(settings, "AudioAllowAACPass")) + { + mask |= HB_ACODEC_FFAAC; + } + if (ghb_settings_get_boolean(settings, "AudioAllowAC3Pass")) + { + mask |= HB_ACODEC_AC3; + } + if (ghb_settings_get_boolean(settings, "AudioAllowDTSPass")) + { + mask |= HB_ACODEC_DCA; + } + if (ghb_settings_get_boolean(settings, "AudioAllowDTSHDPass")) + { + mask |= HB_ACODEC_DCA_HD; + } return mask; } static int ghb_select_fallback( GValue *settings, int mux, int acodec ) { - gint fallback; + gint mask; + gint fallback = 0; switch ( acodec ) { @@ -122,16 +145,30 @@ static int ghb_select_fallback( GValue *settings, int mux, int acodec ) return HB_ACODEC_AC3; default: - fallback = ghb_settings_combo_int(settings, - "AudioEncoderFallback"); + { + if (ghb_settings_get_boolean(settings, "AdvancedAutoPassthru")) + fallback = ghb_settings_combo_int(settings, + "AudioEncoderFallback"); + } } if ( mux == HB_MUX_MP4 ) { - if ( !(fallback & (HB_ACODEC_AC3 | HB_ACODEC_LAME | - HB_ACODEC_FAAC | HB_ACODEC_FFAAC))) - { - fallback = HB_ACODEC_FAAC; - } + mask = HB_ACODEC_LAME | + HB_ACODEC_FFAAC | + HB_ACODEC_FAAC | + HB_ACODEC_AC3; + } + if ( mux == HB_MUX_MKV ) + { + mask = HB_ACODEC_LAME | + HB_ACODEC_FFAAC | + HB_ACODEC_AC3 | + HB_ACODEC_DCA | + HB_ACODEC_DCA_HD; + } + if (!(fallback & mask )) + { + fallback = HB_ACODEC_LAME; } return fallback; } @@ -1180,29 +1217,6 @@ audio_add_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) check_list_full(ud); } -G_MODULE_EXPORT void -audio_advanced_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) -{ - GtkWidget *dialog; - - g_debug("audio_advanced_clicked_cb ()"); - dialog = GHB_WIDGET(ud->builder, "audio_dialog"); - if (gtk_widget_get_visible(dialog)) - gtk_widget_hide(dialog); - else - gtk_widget_show(dialog); -} - -G_MODULE_EXPORT void -audio_advanced_ok_cb(GtkWidget *xwidget, signal_user_data_t *ud) -{ - GtkWidget *dialog; - - g_debug("audio_advanced_clicked_cb ()"); - dialog = GHB_WIDGET(ud->builder, "audio_dialog"); - gtk_widget_hide(dialog); -} - G_MODULE_EXPORT void audio_remove_clicked_cb(GtkWidget *widget, signal_user_data_t *ud) { diff --git a/gtk/src/audiohandler.h b/gtk/src/audiohandler.h index d228a784f..de0346225 100644 --- a/gtk/src/audiohandler.h +++ b/gtk/src/audiohandler.h @@ -37,5 +37,6 @@ gint ghb_select_audio_codec(gint mux, hb_audio_config_t *aconfig, gint acodec, g int ghb_get_copy_mask(GValue *settings); void ghb_audio_list_refresh(signal_user_data_t *ud); char * ghb_format_quality( const char *prefix, int codec, double quality ); +void ghb_show_hide_advanced_audio( signal_user_data_t *ud ); #endif // _AUDIOHANDLER_H_ diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c index 28666f788..94a932d67 100644 --- a/gtk/src/callbacks.c +++ b/gtk/src/callbacks.c @@ -3716,6 +3716,17 @@ hbfd_toggled_cb(GtkWidget *widget, signal_user_data_t *ud) ghb_pref_save(ud->settings, "hbfd"); } +G_MODULE_EXPORT void +advanced_audio_changed_cb(GtkWidget *widget, signal_user_data_t *ud) +{ + g_debug("advanced_audio_changed_cb"); + ghb_widget_to_setting (ud->settings, widget); + ghb_check_dependency(ud, widget, NULL); + const gchar *name = ghb_get_setting_key(widget); + ghb_pref_save(ud->settings, name); + ghb_show_hide_advanced_audio( ud ); +} + G_MODULE_EXPORT void pref_changed_cb(GtkWidget *widget, signal_user_data_t *ud) { diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui index c19a4b785..945fec510 100644 --- a/gtk/src/ghb.ui +++ b/gtk/src/ghb.ui @@ -2193,8 +2193,8 @@ FFMpeg's and Theora's scale is more linear. These encoders do not have a lossle - - True + + False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK False Advanced @@ -5150,6 +5150,31 @@ no-fast-pskip=0:no-dct-decimate=0:cabac=1 4 + + + True + 6 + 6 + 12 + + + Enable Advanced Auto-Passthru options + Enabling this adds extra widgets to the audio panel that allow +you to specify which particular codecs shall be passed +and which codec to use when passthru is not possible + True + True + False + True + + + + + + False + 5 + + True @@ -5191,7 +5216,7 @@ no-fast-pskip=0:no-dct-decimate=0:cabac=1 False - 5 + 6 diff --git a/gtk/src/internal_defaults.xml b/gtk/src/internal_defaults.xml index d6b856f13..606c096ea 100644 --- a/gtk/src/internal_defaults.xml +++ b/gtk/src/internal_defaults.xml @@ -125,6 +125,8 @@ Preferences + AdvancedAutoPassthru + AutoScan AddCC -- cgit v1.2.3