summaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2012-01-14 19:53:55 +0000
committerjstebbins <[email protected]>2012-01-14 19:53:55 +0000
commite50ecd9168341b9471c9c7989fe044ef12976964 (patch)
treef370db5f45cccae2a3b4be935a5140095ed596b1 /gtk
parent58c1508dc01105a9985e103c675eb09099693c6b (diff)
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
Diffstat (limited to 'gtk')
-rw-r--r--gtk/src/audiohandler.c116
-rw-r--r--gtk/src/audiohandler.h1
-rw-r--r--gtk/src/callbacks.c11
-rw-r--r--gtk/src/ghb.ui31
-rw-r--r--gtk/src/internal_defaults.xml2
5 files changed, 107 insertions, 54 deletions
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
@@ -29,6 +29,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)
{
GValue *audio_list;
@@ -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;
}
@@ -1181,29 +1218,6 @@ audio_add_clicked_cb(GtkWidget *xwidget, signal_user_data_t *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)
{
GtkTreeView *treeview;
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
@@ -3717,6 +3717,17 @@ hbfd_toggled_cb(GtkWidget *widget, signal_user_data_t *ud)
}
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)
{
g_debug("pref_changed_cb");
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
</packing>
</child>
<child>
- <object class="GtkExpander" id="expander1">
- <property name="visible">True</property>
+ <object class="GtkExpander" id="AdvancedAudioExpander">
+ <property name="visible">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="expanded">False</property>
<property name="label">Advanced</property>
@@ -5151,6 +5151,31 @@ no-fast-pskip=0:no-dct-decimate=0:cabac=1</property>
</packing>
</child>
<child>
+ <object class="GtkAlignment" id="alignment65">
+ <property name="visible">True</property>
+ <property name="top_padding">6</property>
+ <property name="bottom_padding">6</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkCheckButton" id="AdvancedAutoPassthru">
+ <property name="label" translatable="yes">Enable Advanced Auto-Passthru options</property>
+ <property name="tooltip-text" translatable="yes">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</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="advanced_audio_changed_cb"/>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">5</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkAlignment" id="hidden_prefs">
<property name="visible">True</property>
<property name="top_padding">6</property>
@@ -5191,7 +5216,7 @@ no-fast-pskip=0:no-dct-decimate=0:cabac=1</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="position">5</property>
+ <property name="position">6</property>
</packing>
</child>
</object>
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 @@
</dict>
<key>Preferences</key>
<dict>
+ <key>AdvancedAutoPassthru</key>
+ <false />
<key>AutoScan</key>
<false />
<key>AddCC</key>