summaryrefslogtreecommitdiffstats
path: root/gtk/src/settings.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2008-08-08 17:53:44 +0000
committerjstebbins <[email protected]>2008-08-08 17:53:44 +0000
commite5bfe9599b4f572c43f8508199f2731e58edec5c (patch)
tree8f324e4e56368686f72dc58bf32689622a6220af /gtk/src/settings.c
parent2b82b98c040ab7579e5c5c07e20aa017c23d0fef (diff)
LinGui: address scott's complaint that the way i handle audio presets
is confusing. Eliminated the extra audio settings tab. consolidated everything in the Audio/Subtitles tab. up to 8 audios can be stored in a preset now. limit was 2 before, even though up to 8 audios could be added manually for an encode. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1620 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src/settings.c')
-rw-r--r--gtk/src/settings.c124
1 files changed, 122 insertions, 2 deletions
diff --git a/gtk/src/settings.c b/gtk/src/settings.c
index 1e78fcbd6..662561038 100644
--- a/gtk/src/settings.c
+++ b/gtk/src/settings.c
@@ -21,6 +21,7 @@
#include "hb-backend.h"
void dump_settings(GHashTable *settings);
+void ghb_pref_audio_init(signal_user_data_t *ud);
GObject*
debug_get_object(GtkBuilder* b, const gchar *n)
@@ -1034,6 +1035,10 @@ preset_update_ui(signal_user_data_t *ud, presets_data_t *data, const gchar *key)
// Initialize the ui from presets file.
if (data == NULL) return;
str = g_key_file_get_string(data->keyFile, data->name, key, NULL);
+ if (str == NULL)
+ {
+ str = g_key_file_get_string(internalKeyFile, "Presets", key, NULL);
+ }
if (str != NULL)
{
ghb_ui_update(ud, key, str);
@@ -1046,7 +1051,7 @@ ghb_set_preset(signal_user_data_t *ud, const gchar *name)
{
presets_data_t *data;
- g_debug("ghb_update_from_preset() %s\n", name);
+ g_debug("ghb_set_preset() %s\n", name);
if (name == NULL)
{
name = ghb_presets_get_name(0);
@@ -1061,6 +1066,7 @@ ghb_set_preset(signal_user_data_t *ud, const gchar *name)
preset_to_ui(ud, data);
ghb_settings_set_string(ud->settings, "preset", name);
}
+ ghb_pref_audio_init(ud);
}
void
@@ -1071,7 +1077,7 @@ ghb_update_from_preset(
{
presets_data_t *data;
- g_debug("ghb_set_preset() %s\n", name);
+ g_debug("ghb_update_from_preset() %s %s\n", name, key);
if (name == NULL) return;
data = presets_list_search(presetsList, name);
preset_update_ui(ud, data, key);
@@ -2012,3 +2018,117 @@ ghb_sanitize_x264opts(signal_user_data_t *ud, const gchar *options)
return result;
}
+static gint pref_acodec[8];
+static gint pref_bitrate[8];
+static gint pref_rate[8];
+static gint pref_mix[8];
+static gdouble pref_drc[8];
+static gint pref_audio_count = 0;
+
+void
+ghb_pref_audio_init(signal_user_data_t *ud)
+{
+ const gchar *acodec, *bitrate, *rate, *mix, *drc;
+ gchar **split_acodec, **split_bitrate, **split_rate;
+ gchar **split_mix, **split_drc;
+
+ acodec = ghb_settings_get_string(ud->settings, "pref_audio_codec");
+ bitrate = ghb_settings_get_string(ud->settings, "pref_audio_bitrate");
+ rate = ghb_settings_get_string(ud->settings, "pref_audio_rate");
+ mix = ghb_settings_get_string(ud->settings, "pref_audio_mix");
+ drc = ghb_settings_get_string(ud->settings, "pref_audio_drc");
+ split_acodec = g_strsplit(acodec, ",", 8);
+ split_bitrate = g_strsplit(bitrate, ",", 8);
+ split_rate = g_strsplit(rate, ",", 8);
+ split_mix = g_strsplit(mix, ",", 8);
+ split_drc = g_strsplit(drc, ",", 8);
+ if (split_acodec == NULL)
+ { // This should never happen, but just in case...
+ split_acodec = g_strsplit("faac", ",", -1);
+ }
+ gint ii;
+ for (ii = 0; split_acodec[ii]; ii++)
+ {
+ pref_acodec[ii] = ghb_lookup_acodec(split_acodec[ii]);
+ }
+ pref_audio_count = ii;
+ for (ii = 0; split_bitrate && split_bitrate[ii]; ii++)
+ {
+ pref_bitrate[ii] = ghb_lookup_bitrate(split_bitrate[ii]);
+ }
+ for (ii = 0; ii < pref_audio_count; ii++)
+ {
+ pref_bitrate[ii] = pref_bitrate[0];
+ }
+ for (ii = 0; split_rate && split_rate[ii]; ii++)
+ {
+ pref_rate[ii] = ghb_lookup_rate(split_rate[ii]);
+ }
+ for (ii = 0; ii < pref_audio_count; ii++)
+ {
+ pref_rate[ii] = pref_rate[0];
+ }
+ for (ii = 0; split_mix && split_mix[ii]; ii++)
+ {
+ pref_mix[ii] = ghb_lookup_mix(split_mix[ii]);
+ }
+ for (ii = 0; ii < pref_audio_count; ii++)
+ {
+ pref_mix[ii] = pref_mix[0];
+ }
+ for (ii = 0; split_drc && split_drc[ii]; ii++)
+ {
+ pref_drc[ii] = ghb_lookup_drc(split_drc[ii]);
+ }
+ for (ii = 0; ii < pref_audio_count; ii++)
+ {
+ pref_drc[ii] = pref_drc[0];
+ }
+}
+
+gint
+ghb_pref_acount()
+{
+ return pref_audio_count;
+}
+
+gint
+ghb_pref_acodec(gint index)
+{
+ if (index >= pref_audio_count)
+ return 0;
+ return pref_acodec[index];
+}
+
+gint
+ghb_pref_bitrate(gint index)
+{
+ if (index >= pref_audio_count)
+ return 0;
+ return pref_bitrate[index];
+}
+
+gint
+ghb_pref_rate(gint index)
+{
+ if (index >= pref_audio_count)
+ return 0;
+ return pref_rate[index];
+}
+
+gint
+ghb_pref_mix(gint index)
+{
+ if (index >= pref_audio_count)
+ return 0;
+ return pref_mix[index];
+}
+
+gdouble
+ghb_pref_drc(gint index)
+{
+ if (index >= pref_audio_count)
+ return 0;
+ return pref_drc[index];
+}
+