summaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2015-04-03 21:12:28 +0000
committerjstebbins <[email protected]>2015-04-03 21:12:28 +0000
commit550d34e287cf12dd5347bdd0ddecf904a6c06c31 (patch)
tree8fc6857af6529980fc0cde6c3b1ee4fc8bc082fd /gtk
parenta80e6ccc6eea8bae648e5a6cf1573361335296f2 (diff)
LinGui: more refactoring
mostly moving "settings" stuff to "values" git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7047 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk')
-rw-r--r--gtk/src/audiohandler.c260
-rw-r--r--gtk/src/callbacks.c411
-rw-r--r--gtk/src/hb-backend.c424
-rw-r--r--gtk/src/hb-backend.h3
-rw-r--r--gtk/src/main.c23
-rw-r--r--gtk/src/presets.c301
-rw-r--r--gtk/src/preview.c22
-rw-r--r--gtk/src/queuehandler.c237
-rw-r--r--gtk/src/settings.c145
-rw-r--r--gtk/src/settings.h21
-rw-r--r--gtk/src/subtitlehandler.c222
-rw-r--r--gtk/src/values.c86
-rw-r--r--gtk/src/values.h12
-rw-r--r--gtk/src/videohandler.c69
-rw-r--r--gtk/src/x264handler.c67
15 files changed, 1079 insertions, 1224 deletions
diff --git a/gtk/src/audiohandler.c b/gtk/src/audiohandler.c
index 5a821b3e9..5ef825bd8 100644
--- a/gtk/src/audiohandler.c
+++ b/gtk/src/audiohandler.c
@@ -61,12 +61,12 @@ static void audio_deps(signal_user_data_t *ud, GhbValue *asettings, GtkWidget *w
gint titleindex;
const hb_title_t *title;
- title_id = ghb_settings_get_int(ud->settings, "title");
+ title_id = ghb_dict_get_int(ud->settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
if (asettings != NULL)
{
- track = ghb_settings_get_int(asettings, "AudioTrack");
+ track = ghb_dict_get_int(asettings, "AudioTrack");
codec = ghb_settings_audio_encoder_codec(asettings, "AudioEncoder");
aconfig = ghb_get_audio_info(title, track);
}
@@ -151,35 +151,35 @@ int ghb_get_copy_mask(GhbValue *settings)
{
gint mask = 0;
- if (ghb_settings_get_boolean(settings, "AudioAllowMP3Pass"))
+ if (ghb_dict_get_bool(settings, "AudioAllowMP3Pass"))
{
mask |= HB_ACODEC_MP3_PASS;
}
- if (ghb_settings_get_boolean(settings, "AudioAllowAACPass"))
+ if (ghb_dict_get_bool(settings, "AudioAllowAACPass"))
{
mask |= HB_ACODEC_AAC_PASS;
}
- if (ghb_settings_get_boolean(settings, "AudioAllowAC3Pass"))
+ if (ghb_dict_get_bool(settings, "AudioAllowAC3Pass"))
{
mask |= HB_ACODEC_AC3_PASS;
}
- if (ghb_settings_get_boolean(settings, "AudioAllowDTSPass"))
+ if (ghb_dict_get_bool(settings, "AudioAllowDTSPass"))
{
mask |= HB_ACODEC_DCA_PASS;
}
- if (ghb_settings_get_boolean(settings, "AudioAllowDTSHDPass"))
+ if (ghb_dict_get_bool(settings, "AudioAllowDTSHDPass"))
{
mask |= HB_ACODEC_DCA_HD_PASS;
}
- if (ghb_settings_get_boolean(settings, "AudioAllowEAC3Pass"))
+ if (ghb_dict_get_bool(settings, "AudioAllowEAC3Pass"))
{
mask |= HB_ACODEC_EAC3_PASS;
}
- if (ghb_settings_get_boolean(settings, "AudioAllowFLACPass"))
+ if (ghb_dict_get_bool(settings, "AudioAllowFLACPass"))
{
mask |= HB_ACODEC_FLAC_PASS;
}
- if (ghb_settings_get_boolean(settings, "AudioAllowTRUEHDPass"))
+ if (ghb_dict_get_bool(settings, "AudioAllowTRUEHDPass"))
{
mask |= HB_ACODEC_TRUEHD_PASS;
}
@@ -201,7 +201,7 @@ int ghb_select_fallback(GhbValue *settings, int acodec)
const char *mux_id;
const hb_container_t *mux;
- mux_id = ghb_settings_get_const_string(settings, "FileFormat");
+ mux_id = ghb_dict_get_string(settings, "FileFormat");
mux = ghb_lookup_container_by_name(mux_id);
fallback = ghb_settings_audio_encoder_codec(settings,
@@ -222,13 +222,13 @@ ghb_sanitize_audio_settings(GhbValue *settings, GhbValue *asettings)
const char *mux_id;
const hb_container_t *mux;
- mux_id = ghb_settings_get_const_string(settings, "FileFormat");
+ mux_id = ghb_dict_get_string(settings, "FileFormat");
mux = ghb_lookup_container_by_name(mux_id);
- title_id = ghb_settings_get_int(settings, "title");
+ title_id = ghb_dict_get_int(settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
- track = ghb_settings_get_int(asettings, "AudioTrack");
+ track = ghb_dict_get_int(asettings, "AudioTrack");
acodec = ghb_settings_audio_encoder_codec(asettings, "AudioEncoder");
mix = ghb_settings_mixdown_mix(asettings, "AudioMixdown");
bitrate = ghb_settings_audio_bitrate_rate(asettings, "AudioBitrate");
@@ -257,23 +257,23 @@ ghb_sanitize_audio_settings(GhbValue *settings, GhbValue *asettings)
bitrate = 448;
}
mix = HB_AMIXDOWN_NONE;
- ghb_settings_set_string(asettings, "AudioMixdown",
+ ghb_dict_set_string(asettings, "AudioMixdown",
hb_mixdown_get_short_name(mix));
- ghb_settings_set_string(asettings, "AudioSamplerate",
+ ghb_dict_set_string(asettings, "AudioSamplerate",
ghb_audio_samplerate_get_short_name(0));
- ghb_settings_set_double(asettings, "AudioTrackDRCSlider", 0.0);
+ ghb_dict_set_double(asettings, "AudioTrackDRCSlider", 0.0);
}
else
{
if (mix == HB_AMIXDOWN_NONE)
mix = ghb_get_best_mix(aconfig, select_acodec, mix);
bitrate = hb_audio_bitrate_get_best(select_acodec, bitrate, sr, mix);
- ghb_settings_set_string(asettings, "AudioMixdown",
+ ghb_dict_set_string(asettings, "AudioMixdown",
hb_mixdown_get_short_name(mix));
}
- ghb_settings_set_string(asettings, "AudioBitrate",
+ ghb_dict_set_string(asettings, "AudioBitrate",
ghb_audio_bitrate_get_short_name(bitrate));
- ghb_settings_set_string(asettings, "AudioEncoder",
+ ghb_dict_set_string(asettings, "AudioEncoder",
hb_audio_encoder_get_short_name(select_acodec));
}
@@ -290,9 +290,9 @@ ghb_adjust_audio_rate_combos(signal_user_data_t *ud)
hb_audio_config_t *aconfig;
gboolean codec_defined_bitrate = FALSE;
- title_id = ghb_settings_get_int(ud->settings, "title");
+ title_id = ghb_dict_get_int(ud->settings, "title");
title = ghb_lookup_title(title_id, NULL);
- track = ghb_settings_get_int(asettings, "AudioTrack");
+ track = ghb_dict_get_int(asettings, "AudioTrack");
aconfig = ghb_get_audio_info(title, track);
acodec = ghb_settings_audio_encoder_codec(asettings, "AudioEncoder");
@@ -320,15 +320,15 @@ ghb_adjust_audio_rate_combos(signal_user_data_t *ud)
ghb_set_bitrate_opts(ud->builder, low, high, -1);
}
ghb_ui_update(ud, "AudioEncoder",
- ghb_settings_get_value(asettings, "AudioEncoder"));
+ ghb_dict_get_value(asettings, "AudioEncoder"));
ghb_ui_update(ud, "AudioBitrate",
- ghb_settings_get_value(asettings, "AudioBitrate"));
+ ghb_dict_get_value(asettings, "AudioBitrate"));
ghb_ui_update(ud, "AudioSamplerate",
- ghb_settings_get_value(asettings, "AudioSamplerate"));
+ ghb_dict_get_value(asettings, "AudioSamplerate"));
ghb_ui_update(ud, "AudioMixdown",
- ghb_settings_get_value(asettings, "AudioMixdown"));
+ ghb_dict_get_value(asettings, "AudioMixdown"));
ghb_ui_update(ud, "AudioTrackDRCSlider",
- ghb_settings_get_value(asettings, "AudioTrackDRCSlider"));
+ ghb_dict_get_value(asettings, "AudioTrackDRCSlider"));
ghb_audio_list_refresh_selected(ud);
}
}
@@ -336,7 +336,7 @@ ghb_adjust_audio_rate_combos(signal_user_data_t *ud)
void ghb_santiize_audio_tracks(signal_user_data_t *ud)
{
int ii;
- GhbValue *alist = ghb_settings_get_value(ud->settings, "audio_list");
+ GhbValue *alist = ghb_dict_get_value(ud->settings, "audio_list");
int count = ghb_array_len(alist);
for (ii = 0; ii < count; ii++)
@@ -350,15 +350,15 @@ void ghb_santiize_audio_tracks(signal_user_data_t *ud)
if (asettings != NULL)
{
ghb_ui_update(ud, "AudioEncoder",
- ghb_settings_get_value(asettings, "AudioEncoder"));
+ ghb_dict_get_value(asettings, "AudioEncoder"));
ghb_ui_update(ud, "AudioBitrate",
- ghb_settings_get_value(asettings, "AudioBitrate"));
+ ghb_dict_get_value(asettings, "AudioBitrate"));
ghb_ui_update(ud, "AudioSamplerate",
- ghb_settings_get_value(asettings, "AudioSamplerate"));
+ ghb_dict_get_value(asettings, "AudioSamplerate"));
ghb_ui_update(ud, "AudioMixdown",
- ghb_settings_get_value(asettings, "AudioMixdown"));
+ ghb_dict_get_value(asettings, "AudioMixdown"));
ghb_ui_update(ud, "AudioTrackDRCSlider",
- ghb_settings_get_value(asettings, "AudioTrackDRCSlider"));
+ ghb_dict_get_value(asettings, "AudioTrackDRCSlider"));
}
}
@@ -407,35 +407,35 @@ audio_update_dialog_widgets(signal_user_data_t *ud, GhbValue *asettings)
block_updates = TRUE;
ghb_ui_update(ud, "AudioTrack",
- ghb_settings_get_value(asettings, "AudioTrack"));
+ ghb_dict_get_value(asettings, "AudioTrack"));
ghb_ui_update(ud, "AudioEncoder",
- ghb_settings_get_value(asettings, "AudioEncoder"));
+ ghb_dict_get_value(asettings, "AudioEncoder"));
ghb_ui_update(ud, "AudioBitrate",
- ghb_settings_get_value(asettings, "AudioBitrate"));
+ ghb_dict_get_value(asettings, "AudioBitrate"));
ghb_ui_update(ud, "AudioTrackName",
- ghb_settings_get_value(asettings, "AudioTrackName"));
+ ghb_dict_get_value(asettings, "AudioTrackName"));
ghb_ui_update(ud, "AudioSamplerate",
- ghb_settings_get_value(asettings, "AudioSamplerate"));
+ ghb_dict_get_value(asettings, "AudioSamplerate"));
ghb_ui_update(ud, "AudioMixdown",
- ghb_settings_get_value(asettings, "AudioMixdown"));
+ ghb_dict_get_value(asettings, "AudioMixdown"));
ghb_ui_update(ud, "AudioTrackDRCSlider",
- ghb_settings_get_value(asettings, "AudioTrackDRCSlider"));
- drc = ghb_settings_get_double(asettings, "AudioTrackDRCSlider");
+ ghb_dict_get_value(asettings, "AudioTrackDRCSlider"));
+ drc = ghb_dict_get_double(asettings, "AudioTrackDRCSlider");
s_drc = get_drc_string(drc);
ghb_ui_update(ud, "AudioTrackDRCValue", ghb_string_value(s_drc));
ghb_ui_update(ud, "AudioTrackGainSlider",
- ghb_settings_get_value(asettings, "AudioTrackGainSlider"));
- gain = ghb_settings_get_double(asettings, "AudioTrackGainSlider");
+ ghb_dict_get_value(asettings, "AudioTrackGainSlider"));
+ gain = ghb_dict_get_double(asettings, "AudioTrackGainSlider");
s_gain = get_gain_string(gain);
ghb_ui_update(ud, "AudioTrackGainValue", ghb_string_value(s_gain));
ghb_ui_update(ud, "AudioTrackQuality",
- ghb_settings_get_value(asettings, "AudioTrackQuality"));
- quality = ghb_settings_get_double(asettings, "AudioTrackQuality");
+ ghb_dict_get_value(asettings, "AudioTrackQuality"));
+ quality = ghb_dict_get_double(asettings, "AudioTrackQuality");
s_quality = get_quality_string(asettings, quality);
ghb_ui_update(ud, "AudioTrackQualityValue", ghb_string_value(s_quality));
ghb_ui_update(ud, "AudioTrackQualityEnable",
- ghb_settings_get_value(asettings, "AudioTrackQualityEnable"));
+ ghb_dict_get_value(asettings, "AudioTrackQualityEnable"));
block_updates = FALSE;
}
audio_deps(ud, asettings, NULL);
@@ -453,11 +453,11 @@ ghb_get_user_audio_lang(GhbValue *settings, const hb_title_t *title, gint track)
GhbValue *audio_list, *asettings;
const gchar *lang;
- audio_list = ghb_settings_get_value(settings, "audio_list");
+ audio_list = ghb_dict_get_value(settings, "audio_list");
if (ghb_array_len(audio_list) <= track)
return "und";
asettings = ghb_array_get(audio_list, track);
- track = ghb_settings_get_int(asettings, "AudioTrack");
+ track = ghb_dict_get_int(asettings, "AudioTrack");
lang = ghb_get_source_audio_lang(title, track);
return lang;
}
@@ -500,31 +500,30 @@ audio_add_track(
aconfig = ghb_get_audio_info(title, track);
asettings = ghb_dict_new();
- ghb_settings_set_int(asettings, "AudioTrack", track);
+ ghb_dict_set_int(asettings, "AudioTrack", track);
- ghb_settings_set_string(asettings, "AudioEncoder",
- hb_audio_encoder_get_short_name(encoder));
+ ghb_dict_set_string(asettings, "AudioEncoder",
+ hb_audio_encoder_get_short_name(encoder));
- ghb_settings_set_boolean(asettings,
- "AudioTrackQualityEnable", enable_quality);
- ghb_settings_set_double(asettings, "AudioTrackQuality", quality);
+ ghb_dict_set_bool(asettings, "AudioTrackQualityEnable", enable_quality);
+ ghb_dict_set_double(asettings, "AudioTrackQuality", quality);
- ghb_settings_set_string(asettings, "AudioBitrate",
+ ghb_dict_set_string(asettings, "AudioBitrate",
ghb_audio_bitrate_get_short_name(bitrate));
- ghb_settings_set_string(asettings, "AudioSamplerate",
+ ghb_dict_set_string(asettings, "AudioSamplerate",
ghb_audio_samplerate_get_short_name(samplerate));
if (aconfig != NULL)
{
mix = ghb_get_best_mix(aconfig, encoder, mix);
}
- ghb_settings_set_string(asettings, "AudioMixdown",
- hb_mixdown_get_short_name(mix));
+ ghb_dict_set_string(asettings, "AudioMixdown",
+ hb_mixdown_get_short_name(mix));
- ghb_settings_set_double(asettings, "AudioTrackDRCSlider", drc);
+ ghb_dict_set_double(asettings, "AudioTrackDRCSlider", drc);
- ghb_settings_set_double(asettings, "AudioTrackGainSlider", gain);
+ ghb_dict_set_double(asettings, "AudioTrackGainSlider", gain);
ghb_sanitize_audio_settings(settings, asettings);
audio_add_to_settings(settings, asettings);
@@ -552,7 +551,7 @@ audio_select_and_add_track(
const char *mux_id;
const hb_container_t *mux;
- mux_id = ghb_settings_get_const_string(settings, "FileFormat");
+ mux_id = ghb_dict_get_string(settings, "FileFormat");
mux = ghb_lookup_container_by_name(mux_id);
gint copy_mask = ghb_get_copy_mask(settings);
@@ -565,10 +564,10 @@ audio_select_and_add_track(
bitrate = ghb_settings_audio_bitrate_rate(audio, "AudioBitrate");
samplerate = ghb_settings_audio_samplerate_rate(audio, "AudioSamplerate");
mix = ghb_settings_mixdown_mix(audio, "AudioMixdown");
- drc = ghb_settings_get_double(audio, "AudioTrackDRCSlider");
- gain = ghb_settings_get_double(audio, "AudioTrackGainSlider");
- enable_quality = ghb_settings_get_boolean(audio, "AudioTrackQualityEnable");
- quality = ghb_settings_get_double(audio, "AudioTrackQuality");
+ drc = ghb_dict_get_double(audio, "AudioTrackDRCSlider");
+ gain = ghb_dict_get_double(audio, "AudioTrackGainSlider");
+ enable_quality = ghb_dict_get_bool(audio, "AudioTrackQualityEnable");
+ quality = ghb_dict_get_double(audio, "AudioTrackQuality");
track = ghb_find_audio_track(title, lang, start_track);
if (track >= 0)
@@ -600,15 +599,15 @@ static void set_pref_audio_with_lang(
const GhbValue *pref_audio, *audio_list;
int count, ii, track, track_count, audio_count;
- audio_list = ghb_settings_get_value(settings, "audio_list");
+ audio_list = ghb_dict_get_value(settings, "audio_list");
const char *mux_id;
const hb_container_t *mux;
- mux_id = ghb_settings_get_const_string(settings, "FileFormat");
+ mux_id = ghb_dict_get_string(settings, "FileFormat");
mux = ghb_lookup_container_by_name(mux_id);
- pref_audio = ghb_settings_get_value(settings, "AudioList");
+ pref_audio = ghb_dict_get_value(settings, "AudioList");
audio_count = hb_list_count(title->list_audio);
count = ghb_array_len(pref_audio);
int next_track = 0;
@@ -633,11 +632,11 @@ static void set_pref_audio_with_lang(
samplerate = ghb_settings_audio_samplerate_rate(audio,
"AudioSamplerate");
mix = ghb_settings_mixdown_mix(audio, "AudioMixdown");
- drc = ghb_settings_get_double(audio, "AudioTrackDRCSlider");
- gain = ghb_settings_get_double(audio, "AudioTrackGainSlider");
- enable_quality = ghb_settings_get_boolean(audio,
- "AudioTrackQualityEnable");
- quality = ghb_settings_get_double(audio, "AudioTrackQuality");
+ drc = ghb_dict_get_double(audio, "AudioTrackDRCSlider");
+ gain = ghb_dict_get_double(audio, "AudioTrackGainSlider");
+ enable_quality = ghb_dict_get_bool(audio,
+ "AudioTrackQualityEnable");
+ quality = ghb_dict_get_double(audio, "AudioTrackQuality");
// Check to see if:
// 1. pref codec is passthru
@@ -699,7 +698,7 @@ ghb_set_pref_audio_settings(GhbValue *settings)
// Clear the audio list
ghb_clear_audio_list_settings(settings);
- title_id = ghb_settings_get_int(settings, "title");
+ title_id = ghb_dict_get_int(settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
if (behavior == 0 || title == NULL)
{
@@ -717,7 +716,7 @@ ghb_set_pref_audio_settings(GhbValue *settings)
free_audio_hash_key_value, free_audio_hash_key_value);
// Find "best" audio based on audio preset defaults
- lang_list = ghb_settings_get_value(settings, "AudioLanguageList");
+ lang_list = ghb_dict_get_value(settings, "AudioLanguageList");
lang_count = ghb_array_len(lang_list);
for (ii = 0; ii < lang_count; ii++)
@@ -726,10 +725,10 @@ ghb_set_pref_audio_settings(GhbValue *settings)
gboolean mode;
GhbValue *glang = ghb_array_get(lang_list, ii);
lang = ghb_value_get_string(glang);
- mode = ghb_settings_get_boolean(settings, "AudioSecondaryEncoderMode");
+ mode = ghb_dict_get_bool(settings, "AudioSecondaryEncoderMode");
set_pref_audio_with_lang(title, settings, lang, behavior, mode, track_used);
}
- GhbValue *audio_list = ghb_settings_get_value(settings, "audio_list");
+ GhbValue *audio_list = ghb_dict_get_value(settings, "audio_list");
if (audio_list == NULL || ghb_array_len(audio_list) == 0)
{
// No matching audio tracks found. Add first track matching
@@ -764,7 +763,7 @@ audio_get_selected_settings(signal_user_data_t *ud, int *index)
// find audio settings
if (row < 0) return NULL;
- audio_list = ghb_settings_get_value(ud->settings, "audio_list");
+ audio_list = ghb_dict_get_value(ud->settings, "audio_list");
if (row >= ghb_array_len(audio_list))
return NULL;
@@ -790,8 +789,8 @@ audio_refresh_list_row_ui(
info_src_2 = NULL;
info_dst_2 = NULL;
- const gchar *s_track;
- gchar *s_drc, *s_gain, *s_br_quality, *s_sr, *s_track_name;
+ const gchar *s_track, *s_track_name;
+ gchar *s_drc, *s_gain, *s_br_quality, *s_sr;
gdouble drc, gain;
hb_audio_config_t *aconfig;
int track, sr;
@@ -799,9 +798,9 @@ audio_refresh_list_row_ui(
const hb_title_t *title;
const hb_encoder_t *encoder;
- title_id = ghb_settings_get_int(ud->settings, "title");
+ title_id = ghb_dict_get_int(ud->settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
- track = ghb_settings_get_int(settings, "AudioTrack");
+ track = ghb_dict_get_int(settings, "AudioTrack");
aconfig = ghb_get_audio_info(title, track);
if (aconfig == NULL)
{
@@ -812,8 +811,8 @@ audio_refresh_list_row_ui(
s_track = aconfig->lang.description;
encoder = ghb_settings_audio_encoder(settings, "AudioEncoder");
- double quality = ghb_settings_get_double(settings, "AudioTrackQuality");
- if (ghb_settings_get_boolean(settings, "AudioTrackQualityEnable") &&
+ double quality = ghb_dict_get_double(settings, "AudioTrackQuality");
+ if (ghb_dict_get_bool(settings, "AudioTrackQualityEnable") &&
quality != HB_INVALID_AUDIO_QUALITY)
{
s_br_quality = ghb_format_quality(_("Quality: "), encoder->codec, quality);
@@ -833,16 +832,16 @@ audio_refresh_list_row_ui(
const hb_mixdown_t *mix;
mix = ghb_settings_mixdown(settings, "AudioMixdown");
- gain = ghb_settings_get_double(settings, "AudioTrackGainSlider");
+ gain = ghb_dict_get_double(settings, "AudioTrackGainSlider");
s_gain = g_strdup_printf(_("%ddB"), (int)gain);
- drc = ghb_settings_get_double(settings, "AudioTrackDRCSlider");
+ drc = ghb_dict_get_double(settings, "AudioTrackDRCSlider");
if (drc < 1.0)
s_drc = g_strdup(_("Off"));
else
s_drc = g_strdup_printf("%.1f", drc);
- s_track_name = ghb_settings_get_string(settings, "AudioTrackName");
+ s_track_name = ghb_dict_get_string(settings, "AudioTrackName");
info_src = g_strdup_printf(_("<small>%d - %s (%.4gkHz)</small>"),
track + 1, s_track, (double)aconfig->in.samplerate / 1000);
@@ -919,7 +918,6 @@ audio_refresh_list_row_ui(
g_free(s_drc);
g_free(s_gain);
g_free(s_br_quality);
- g_free(s_track_name);
}
void
@@ -947,7 +945,7 @@ ghb_audio_list_refresh_selected(signal_user_data_t *ud)
gtk_tree_path_free(tp);
if (row < 0) return;
- audio_list = ghb_settings_get_value(ud->settings, "audio_list");
+ audio_list = ghb_dict_get_value(ud->settings, "audio_list");
if (row >= ghb_array_len(audio_list))
return;
@@ -971,7 +969,7 @@ audio_refresh_list_ui(signal_user_data_t *ud)
tm_count = gtk_tree_model_iter_n_children(tm, NULL);
- audio_list = ghb_settings_get_value(ud->settings, "audio_list");
+ audio_list = ghb_dict_get_value(ud->settings, "audio_list");
count = ghb_array_len(audio_list);
if (count != tm_count)
{
@@ -1038,7 +1036,7 @@ audio_codec_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
gint track;
gint br, sr, mix;
- title_id = ghb_settings_get_int(ud->settings, "title");
+ title_id = ghb_dict_get_int(ud->settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
if (asettings != NULL)
@@ -1055,7 +1053,7 @@ audio_codec_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
mix = HB_AMIXDOWN_NONE;
}
- track = ghb_settings_get_int(ud->settings, "AudioTrack");
+ track = ghb_dict_get_int(ud->settings, "AudioTrack");
if (sr)
{
sr = ghb_find_closest_audio_samplerate(sr);
@@ -1113,16 +1111,16 @@ audio_track_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
int track;
hb_audio_config_t *aconfig;
- title_id = ghb_settings_get_int(ud->settings, "title");
+ title_id = ghb_dict_get_int(ud->settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
- track = ghb_settings_get_int(ud->settings, "AudioTrack");
+ track = ghb_dict_get_int(ud->settings, "AudioTrack");
aconfig = ghb_get_audio_info(title, track);
if (aconfig != NULL)
{
char *desc;
desc = g_strdup_printf("%d - %s", track + 1,
aconfig->lang.description);
- ghb_settings_set_string(asettings, "AudioTrackDescription", desc);
+ ghb_dict_set_string(asettings, "AudioTrackDescription", desc);
g_free(desc);
}
}
@@ -1233,7 +1231,7 @@ quality_widget_changed_cb(GtkWidget *widget, gdouble quality, signal_user_data_t
asettings = audio_get_selected_settings(ud, NULL);
if (asettings != NULL)
{
- ghb_settings_set_double(asettings, "AudioTrackQuality", quality);
+ ghb_dict_set_double(asettings, "AudioTrackQuality", quality);
ghb_audio_list_refresh_selected(ud);
}
ghb_live_reset(ud);
@@ -1306,11 +1304,11 @@ ghb_clear_audio_list_settings(GhbValue *settings)
GhbValue *audio_list;
g_debug("clear_audio_list_settings ()");
- audio_list = ghb_settings_get_value(settings, "audio_list");
+ audio_list = ghb_dict_get_value(settings, "audio_list");
if (audio_list == NULL)
{
audio_list = ghb_array_new();
- ghb_settings_set_value(settings, "audio_list", audio_list);
+ ghb_dict_set(settings, "audio_list", audio_list);
}
else
ghb_array_reset(audio_list);
@@ -1392,7 +1390,7 @@ audio_list_selection_changed_cb(GtkTreeSelection *ts, signal_user_data_t *ud)
gtk_tree_path_free(tp);
if (row < 0) return;
- audio_list = ghb_settings_get_value(ud->settings, "audio_list");
+ audio_list = ghb_dict_get_value(ud->settings, "audio_list");
if (row >= 0 && row < ghb_array_len(audio_list))
asettings = ghb_array_get(audio_list, row);
}
@@ -1408,22 +1406,22 @@ audio_add_to_settings(GhbValue *settings, GhbValue *asettings)
gint titleindex;
hb_audio_config_t *aconfig;
- title_id = ghb_settings_get_int(settings, "title");
+ title_id = ghb_dict_get_int(settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
- audio_list = ghb_settings_get_value(settings, "audio_list");
+ audio_list = ghb_dict_get_value(settings, "audio_list");
if (audio_list == NULL)
{
- audio_list = ghb_array_new(8);
- ghb_settings_set_value(settings, "audio_list", audio_list);
+ audio_list = ghb_array_new();
+ ghb_dict_set(settings, "audio_list", audio_list);
}
- int track = ghb_settings_get_int(asettings, "AudioTrack");
+ int track = ghb_dict_get_int(asettings, "AudioTrack");
aconfig = ghb_get_audio_info(title, track);
if (aconfig != NULL)
{
char *desc;
desc = g_strdup_printf("%d - %s", track + 1, aconfig->lang.description);
- ghb_settings_set_string(asettings, "AudioTrackDescription", desc);
+ ghb_dict_set_string(asettings, "AudioTrackDescription", desc);
g_free(desc);
}
@@ -1431,7 +1429,7 @@ audio_add_to_settings(GhbValue *settings, GhbValue *asettings)
aname = ghb_dict_get(asettings, "AudioTrackName");
if (aname == NULL)
{
- ghb_settings_set_string(asettings, "AudioTrackName", "");
+ ghb_dict_set_string(asettings, "AudioTrackName", "");
}
ghb_array_append(audio_list, asettings);
}
@@ -1444,13 +1442,12 @@ audio_add_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
int title_id, titleindex;
const hb_title_t *title;
- title_id = ghb_settings_get_int(ud->settings, "title");
+ title_id = ghb_dict_get_int(ud->settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
// Back up settings in case we need to revert.
- backup = ghb_value_dup(
- ghb_settings_get_value(ud->settings, "audio_list"));
- GhbValue *pref_audio = ghb_settings_get_value(ud->settings, "AudioList");
+ backup = ghb_value_dup(ghb_dict_get_value(ud->settings, "audio_list"));
+ GhbValue *pref_audio = ghb_dict_get_value(ud->settings, "AudioList");
asettings = audio_select_and_add_track(title, ud->settings, pref_audio,
"und", 0, 0);
ghb_add_audio_to_ui(ud, asettings);
@@ -1464,7 +1461,7 @@ audio_add_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
gtk_widget_hide(dialog);
if (response != GTK_RESPONSE_OK)
{
- ghb_settings_take_value(ud->settings, "audio_list", backup);
+ ghb_dict_set(ud->settings, "audio_list", backup);
asettings = audio_get_selected_settings(ud, NULL);
if (asettings != NULL)
{
@@ -1489,9 +1486,9 @@ audio_add_all_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
ghb_clear_audio_list_settings(ud->settings);
ghb_clear_audio_list_ui(ud->builder);
- title_id = ghb_settings_get_int(ud->settings, "title");
+ title_id = ghb_dict_get_int(ud->settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
- GhbValue *pref_audio = ghb_settings_get_value(ud->settings, "AudioList");
+ GhbValue *pref_audio = ghb_dict_get_value(ud->settings, "AudioList");
int pref_count = ghb_array_len(pref_audio);
@@ -1509,7 +1506,7 @@ audio_add_all_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
track);
if (asettings != NULL)
{
- track = ghb_settings_get_int(asettings, "AudioTrack") + 1;
+ track = ghb_dict_get_int(asettings, "AudioTrack") + 1;
}
} while (asettings != NULL);
}
@@ -1537,8 +1534,7 @@ audio_edit_clicked_cb(GtkWidget *widget, gchar *path, signal_user_data_t *ud)
gtk_tree_selection_select_iter(ts, &ti);
// Back up settings in case we need to revert.
- backup = ghb_value_dup(
- ghb_settings_get_value(ud->settings, "audio_list"));
+ backup = ghb_value_dup(ghb_dict_get_value(ud->settings, "audio_list"));
// Pop up the edit dialog
GtkResponseType response;
@@ -1547,7 +1543,7 @@ audio_edit_clicked_cb(GtkWidget *widget, gchar *path, signal_user_data_t *ud)
gtk_widget_hide(dialog);
if (response != GTK_RESPONSE_OK)
{
- ghb_settings_take_value(ud->settings, "audio_list", backup);
+ ghb_dict_set(ud->settings, "audio_list", backup);
asettings = audio_get_selected_settings(ud, NULL);
if (asettings != NULL)
{
@@ -1595,7 +1591,7 @@ audio_remove_clicked_cb(GtkWidget *widget, gchar *path, signal_user_data_t *ud)
gtk_tree_selection_select_iter(ts, &nextIter);
}
- audio_list = ghb_settings_get_value(ud->settings, "audio_list");
+ audio_list = ghb_dict_get_value(ud->settings, "audio_list");
// Get the row number
indices = gtk_tree_path_get_indices (tp);
@@ -2049,7 +2045,7 @@ audio_def_setting_update(signal_user_data_t *ud, GtkWidget *widget)
GtkListBoxRow *row = audio_settings_get_row(widget);
gint index = gtk_list_box_row_get_index(row);
- GhbValue *alist = ghb_settings_get_value(ud->settings, "AudioList");
+ GhbValue *alist = ghb_dict_get_value(ud->settings, "AudioList");
int count = ghb_array_len(alist);
if (!block_updates && index >= 0 && index < count)
{
@@ -2085,7 +2081,7 @@ audio_add_lang_clicked_cb(GtkWidget *widget, signal_user_data_t *ud)
idx = (intptr_t)g_object_get_data(G_OBJECT(label), "lang_idx");
lang = ghb_iso639_lookup_by_int(idx);
glang = ghb_string_value_new(lang->iso639_2);
- alang_list = ghb_settings_get_value(ud->settings, "AudioLanguageList");
+ alang_list = ghb_dict_get_value(ud->settings, "AudioLanguageList");
ghb_array_append(alang_list, glang);
ghb_clear_presets_selection(ud);
}
@@ -2119,7 +2115,7 @@ audio_remove_lang_clicked_cb(GtkWidget *widget, signal_user_data_t *ud)
gtk_list_box_insert(avail, label, idx);
// Remove from preset language list
- alang_list = ghb_settings_get_value(ud->settings, "AudioLanguageList");
+ alang_list = ghb_dict_get_value(ud->settings, "AudioLanguageList");
ghb_array_remove(alang_list, index);
ghb_clear_presets_selection(ud);
}
@@ -2156,7 +2152,7 @@ void audio_def_set_limits(signal_user_data_t *ud, GtkWidget *widget, gboolean se
GtkListBoxRow *row = audio_settings_get_row(widget);
gint index = gtk_list_box_row_get_index(row);
- GhbValue *alist = ghb_settings_get_value(ud->settings, "AudioList");
+ GhbValue *alist = ghb_dict_get_value(ud->settings, "AudioList");
int count = ghb_array_len(alist);
if (index < 0 || index >= count)
return;
@@ -2166,7 +2162,7 @@ void audio_def_set_limits(signal_user_data_t *ud, GtkWidget *widget, gboolean se
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");
+ gdouble quality = ghb_dict_get_double(adict, "AudioTrackQuality");
// Allow quality settings if the current encoder supports quality
// or if the encoder is auto-passthru and the fallback encoder
@@ -2247,11 +2243,11 @@ audio_def_quality_enable_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
GtkListBoxRow *row = audio_settings_get_row(widget);
gint index = gtk_list_box_row_get_index(row);
- GhbValue *alist = ghb_settings_get_value(ud->settings, "AudioList");
+ GhbValue *alist = ghb_dict_get_value(ud->settings, "AudioList");
GhbValue *adict = ghb_array_get(alist, index);
audio_def_settings_bitrate_show(GTK_WIDGET(row),
- !ghb_settings_get_boolean(adict, "AudioTrackQualityEnable"));
+ !ghb_dict_get_bool(adict, "AudioTrackQualityEnable"));
ghb_clear_presets_selection(ud);
}
@@ -2265,7 +2261,7 @@ audio_def_quality_changed_cb(GtkWidget *widget, gdouble quality, signal_user_dat
"AudioTrackQualityValue");
gint index = gtk_list_box_row_get_index(row);
- GhbValue *alist = ghb_settings_get_value(ud->settings, "AudioList");
+ GhbValue *alist = ghb_dict_get_value(ud->settings, "AudioList");
GhbValue *adict = ghb_array_get(alist, index);
char *s_quality = get_quality_string(adict, quality);
ghb_update_widget(quality_label, ghb_string_value(s_quality));
@@ -2306,7 +2302,7 @@ audio_def_setting_add_cb(GtkWidget *widget, signal_user_data_t *ud)
GtkListBoxRow *row = audio_settings_get_row(widget);
GhbValue *adict;
- GhbValue *alist = ghb_settings_get_value(ud->settings, "AudioList");
+ GhbValue *alist = ghb_dict_get_value(ud->settings, "AudioList");
int count = ghb_array_len(alist);
if (count > 0)
{
@@ -2338,7 +2334,7 @@ audio_def_setting_remove_cb(GtkWidget *widget, signal_user_data_t *ud)
GtkListBoxRow *row = audio_settings_get_row(widget);
gint index = gtk_list_box_row_get_index(row);
- GhbValue *alist = ghb_settings_get_value(ud->settings, "AudioList");
+ GhbValue *alist = ghb_dict_get_value(ud->settings, "AudioList");
int count = ghb_array_len(alist);
if (index < 0 || index >= count)
{
@@ -2417,11 +2413,11 @@ audio_def_lang_list_init(signal_user_data_t *ud)
// Clear selected languages.
audio_def_selected_lang_list_clear(ud);
- lang_list = ghb_settings_get_value(ud->settings, "AudioLanguageList");
+ lang_list = ghb_dict_get_value(ud->settings, "AudioLanguageList");
if (lang_list == NULL)
{
lang_list = ghb_array_new();
- ghb_settings_set_value(ud->settings, "AudioLanguageList", lang_list);
+ ghb_dict_set(ud->settings, "AudioLanguageList", lang_list);
}
int ii, count;
@@ -2464,11 +2460,11 @@ void ghb_audio_defaults_to_ui(signal_user_data_t *ud)
audio_def_lang_list_init(ud);
// Init the AudioList settings if necessary
- alist = ghb_settings_get_value(ud->settings, "AudioList");
+ alist = ghb_dict_get_value(ud->settings, "AudioList");
if (alist == NULL)
{
alist = ghb_array_new();
- ghb_settings_set_value(ud->settings, "AudioList", alist);
+ ghb_dict_set(ud->settings, "AudioList", alist);
}
// Empty the current list
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c
index f1709dd81..321f823b1 100644
--- a/gtk/src/callbacks.c
+++ b/gtk/src/callbacks.c
@@ -153,7 +153,7 @@ dep_check(signal_user_data_t *ud, const gchar *name, gboolean *out_hide)
if (widget)
value = ghb_widget_string(widget);
else
- value = ghb_settings_get_string(ud->settings, widget_name);
+ value = ghb_dict_get_string_xform(ud->settings, widget_name);
while (values && values[jj])
{
if (values[jj][0] == '>')
@@ -539,11 +539,11 @@ get_extension(signal_user_data_t *ud, GhbValue *settings)
const char *mux_id;
const hb_container_t *mux;
- mux_id = ghb_settings_get_const_string(settings, "FileFormat");
+ mux_id = ghb_dict_get_string(settings, "FileFormat");
mux = ghb_lookup_container_by_name(mux_id);
if ((mux->format & HB_MUX_MASK_MP4) &&
- ghb_settings_get_boolean(ud->prefs, "UseM4v"))
+ ghb_dict_get_bool(ud->prefs, "UseM4v"))
{
return "m4v";
}
@@ -553,11 +553,11 @@ get_extension(signal_user_data_t *ud, GhbValue *settings)
static gboolean
check_name_template(signal_user_data_t *ud, const char *str)
{
- if (ghb_settings_get_boolean(ud->prefs, "auto_name"))
+ if (ghb_dict_get_bool(ud->prefs, "auto_name"))
{
const gchar *template;
- template = ghb_settings_get_const_string(ud->prefs, "auto_name_template");
+ template = ghb_dict_get_string(ud->prefs, "auto_name_template");
if (strstr(template, str) != NULL)
return TRUE;
}
@@ -573,26 +573,24 @@ set_destination_settings(signal_user_data_t *ud, GhbValue *settings)
extension = get_extension(ud, settings);
g_debug("set_destination_settings");
- if (ghb_settings_get_boolean(ud->prefs, "auto_name"))
+ if (ghb_dict_get_bool(ud->prefs, "auto_name"))
{
GString *str = g_string_new("");
- gchar *p;
- gchar *template;
+ const gchar *p;
- p = template = ghb_settings_get_string(ud->prefs, "auto_name_template");
+ p = ghb_dict_get_string(ud->prefs, "auto_name_template");
while (*p)
{
if (!strncmp(p, "{source}", strlen("{source}")))
{
- gchar *vol_name;
- vol_name = ghb_settings_get_string(settings, "volume_label");
+ const gchar *vol_name;
+ vol_name = ghb_dict_get_string(settings, "volume_label");
g_string_append_printf(str, "%s", vol_name);
- g_free(vol_name);
p += strlen("{source}");
}
else if (!strncmp(p, "{title}", strlen("{title}")))
{
- gint title = ghb_settings_get_int(settings, "title");
+ gint title = ghb_dict_get_int(settings, "title");
if (title >= 0)
g_string_append_printf(str, "%d", title);
p += strlen("{title}");
@@ -602,8 +600,8 @@ set_destination_settings(signal_user_data_t *ud, GhbValue *settings)
if (ghb_settings_combo_int(settings, "PtoPType") == 0)
{
gint start, end;
- start = ghb_settings_get_int(settings, "start_point");
- end = ghb_settings_get_int(settings, "end_point");
+ start = ghb_dict_get_int(settings, "start_point");
+ end = ghb_dict_get_int(settings, "end_point");
if (start == end)
g_string_append_printf(str, "%d", start);
else
@@ -635,24 +633,24 @@ set_destination_settings(signal_user_data_t *ud, GhbValue *settings)
}
else if (!strncmp(p, "{quality}", strlen("{quality}")))
{
- if (ghb_settings_get_boolean(settings, "vquality_type_constant"))
+ if (ghb_dict_get_bool(settings, "vquality_type_constant"))
{
gint vcodec;
const char *vqname;
double vquality;
vcodec = ghb_settings_video_encoder_codec(settings, "VideoEncoder");
vqname = hb_video_quality_get_name(vcodec);
- vquality = ghb_settings_get_double(settings, "VideoQualitySlider");
+ vquality = ghb_dict_get_double(settings, "VideoQualitySlider");
g_string_append_printf(str, "%s%.3g", vqname, vquality);
}
p += strlen("{quality}");
}
else if (!strncmp(p, "{bitrate}", strlen("{bitrate}")))
{
- if (ghb_settings_get_boolean(settings, "vquality_type_bitrate"))
+ if (ghb_dict_get_bool(settings, "vquality_type_bitrate"))
{
int vbitrate;
- vbitrate = ghb_settings_get_int(settings, "VideoAvgBitrate");
+ vbitrate = ghb_dict_get_int(settings, "VideoAvgBitrate");
g_string_append_printf(str, "%dkbps", vbitrate);
}
p += strlen("{bitrate}");
@@ -665,8 +663,7 @@ set_destination_settings(signal_user_data_t *ud, GhbValue *settings)
}
g_string_append_printf(str, ".%s", extension);
filename = g_string_free(str, FALSE);
- ghb_settings_set_string(settings, "dest_file", filename);
- g_free(template);
+ ghb_dict_set_string(settings, "dest_file", filename);
g_free(filename);
}
}
@@ -676,7 +673,7 @@ set_destination(signal_user_data_t *ud)
{
set_destination_settings(ud, ud->settings);
ghb_ui_update(ud, "dest_file",
- ghb_settings_get_value(ud->settings, "dest_file"));
+ ghb_dict_get_value(ud->settings, "dest_file"));
}
static gchar*
@@ -809,14 +806,14 @@ update_source_label(signal_user_data_t *ud, const gchar *source)
if (label != NULL)
{
gtk_label_set_text (GTK_LABEL(widget), label);
- ghb_settings_set_string(ud->settings, "volume_label", label);
+ ghb_dict_set_string(ud->settings, "volume_label", label);
g_free(label);
}
else
{
label = _("No Title Found");
gtk_label_set_text (GTK_LABEL(widget), label);
- ghb_settings_set_string(ud->settings, "volume_label", label);
+ ghb_dict_set_string(ud->settings, "volume_label", label);
return FALSE;
}
return TRUE;
@@ -927,22 +924,22 @@ update_title_duration(signal_user_data_t *ud)
int title_id, titleindex;
const hb_title_t *title;
- title_id = ghb_settings_get_int(ud->settings, "title");
+ title_id = ghb_dict_get_int(ud->settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
widget = GHB_WIDGET (ud->builder, "title_duration");
if (ghb_settings_combo_int(ud->settings, "PtoPType") == 0)
{
- start = ghb_settings_get_int(ud->settings, "start_point");
- end = ghb_settings_get_int(ud->settings, "end_point");
+ start = ghb_dict_get_int(ud->settings, "start_point");
+ end = ghb_dict_get_int(ud->settings, "end_point");
ghb_part_duration(title, start, end, &hh, &mm, &ss);
}
else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 1)
{
gint duration;
- start = ghb_settings_get_int(ud->settings, "start_point");
- end = ghb_settings_get_int(ud->settings, "end_point");
+ start = ghb_dict_get_int(ud->settings, "start_point");
+ end = ghb_dict_get_int(ud->settings, "end_point");
duration = end - start;
break_duration(duration, &hh, &mm, &ss);
}
@@ -953,8 +950,8 @@ update_title_duration(signal_user_data_t *ud)
gint64 frames;
gint duration;
- start = ghb_settings_get_int(ud->settings, "start_point");
- end = ghb_settings_get_int(ud->settings, "end_point");
+ start = ghb_dict_get_int(ud->settings, "start_point");
+ end = ghb_dict_get_int(ud->settings, "end_point");
frames = end - start + 1;
duration = frames * title->vrate.den / title->vrate.num;
break_duration(duration, &hh, &mm, &ss);
@@ -978,7 +975,7 @@ void ghb_show_container_options(signal_user_data_t *ud)
const char *mux_id;
const hb_container_t *mux;
- mux_id = ghb_settings_get_const_string(ud->settings, "FileFormat");
+ mux_id = ghb_dict_get_string(ud->settings, "FileFormat");
mux = ghb_lookup_container_by_name(mux_id);
gint enc = ghb_settings_video_encoder_codec(ud->settings, "VideoEncoder");
@@ -1045,7 +1042,7 @@ ghb_set_widget_ranges(signal_user_data_t *ud, GhbValue *settings)
const hb_title_t * title;
double val;
- title_id = ghb_settings_get_int(settings, "title");
+ title_id = ghb_dict_get_int(settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
// Reconfigure the UI combo boxes
@@ -1061,13 +1058,13 @@ ghb_set_widget_ranges(signal_user_data_t *ud, GhbValue *settings)
vbound = title->geometry.height;
hbound = title->geometry.width;
- val = ghb_settings_get_int(ud->settings, "PictureTopCrop");
+ val = ghb_dict_get_int(ud->settings, "PictureTopCrop");
spin_configure(ud, "PictureTopCrop", val, 0, vbound);
- val = ghb_settings_get_int(ud->settings, "PictureBottomCrop");
+ val = ghb_dict_get_int(ud->settings, "PictureBottomCrop");
spin_configure(ud, "PictureBottomCrop", val, 0, vbound);
- val = ghb_settings_get_int(ud->settings, "PictureLeftCrop");
+ val = ghb_dict_get_int(ud->settings, "PictureLeftCrop");
spin_configure(ud, "PictureLeftCrop", val, 0, hbound);
- val = ghb_settings_get_int(ud->settings, "PictureRightCrop");
+ val = ghb_dict_get_int(ud->settings, "PictureRightCrop");
spin_configure(ud, "PictureRightCrop", val, 0, hbound);
gint duration = title->duration / 90000;
@@ -1076,16 +1073,16 @@ ghb_set_widget_ranges(signal_user_data_t *ud, GhbValue *settings)
{
gint num_chapters = hb_list_count(title->list_chapter);
- val = ghb_settings_get_int(ud->settings, "start_point");
+ val = ghb_dict_get_int(ud->settings, "start_point");
spin_configure(ud, "start_point", val, 1, num_chapters);
- val = ghb_settings_get_int(ud->settings, "end_point");
+ val = ghb_dict_get_int(ud->settings, "end_point");
spin_configure(ud, "end_point", val, 1, num_chapters);
}
else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 1)
{
- val = ghb_settings_get_int(ud->settings, "start_point");
+ val = ghb_dict_get_int(ud->settings, "start_point");
spin_configure(ud, "start_point", val, 0, duration-1);
- val = ghb_settings_get_int(ud->settings, "end_point");
+ val = ghb_dict_get_int(ud->settings, "end_point");
spin_configure(ud, "end_point", val, 0, duration);
}
else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 2)
@@ -1094,13 +1091,13 @@ ghb_set_widget_ranges(signal_user_data_t *ud, GhbValue *settings)
max_frames = (gdouble)duration *
title->vrate.num / title->vrate.den;
- val = ghb_settings_get_int(ud->settings, "start_point");
+ val = ghb_dict_get_int(ud->settings, "start_point");
spin_configure(ud, "start_point", val, 1, max_frames);
- val = ghb_settings_get_int(ud->settings, "end_point");
+ val = ghb_dict_get_int(ud->settings, "end_point");
spin_configure(ud, "end_point", val, 1, max_frames);
}
- val = ghb_settings_get_int(ud->settings, "angle");
+ val = ghb_dict_get_int(ud->settings, "angle");
spin_configure(ud, "angle", val, 1, title->angle_count);
}
@@ -1108,7 +1105,7 @@ ghb_set_widget_ranges(signal_user_data_t *ud, GhbValue *settings)
int inverted, digits;
ghb_vquality_range(ud, &vqmin, &vqmax, &step, &page, &digits, &inverted);
- val = ghb_settings_get_double(ud->settings, "VideoQualitySlider");
+ val = ghb_dict_get_double(ud->settings, "VideoQualitySlider");
ghb_scale_configure(ud, "VideoQualitySlider", val, vqmin, vqmax,
step, page, digits, inverted);
}
@@ -1121,8 +1118,8 @@ check_chapter_markers(signal_user_data_t *ud)
if (ghb_settings_combo_int(ud->settings, "PtoPType") == 0)
{
- start = ghb_settings_get_int(ud->settings, "start_point");
- end = ghb_settings_get_int(ud->settings, "end_point");
+ start = ghb_dict_get_int(ud->settings, "start_point");
+ end = ghb_dict_get_int(ud->settings, "end_point");
widget = GHB_WIDGET (ud->builder, "ChapterMarkers");
gtk_widget_set_sensitive(widget, end > start);
}
@@ -1157,17 +1154,17 @@ ghb_load_settings(signal_user_data_t * ud)
return;
busy = TRUE;
- preset = ghb_settings_get_value(ud->settings, "preset");
- preset_modified = ghb_settings_get_boolean(ud->settings, "preset_modified");
+ preset = ghb_dict_get_value(ud->settings, "preset");
+ preset_modified = ghb_dict_get_bool(ud->settings, "preset_modified");
if (preset_modified)
{
ghb_clear_presets_selection(ud);
}
else
{
- ghb_settings_set_boolean(ud->settings, "preset_reload", TRUE);
+ ghb_dict_set_bool(ud->settings, "preset_reload", TRUE);
ghb_select_preset(ud->builder, preset);
- ghb_settings_set_boolean(ud->settings, "preset_reload", FALSE);
+ ghb_dict_set_bool(ud->settings, "preset_reload", FALSE);
}
ud->dont_clear_presets = TRUE;
@@ -1232,16 +1229,15 @@ start_scan(
widget = GHB_WIDGET(ud->builder, "source_title_open");
gtk_widget_set_sensitive(widget, FALSE);
ghb_backend_scan(path, title_id, preview_count,
- 90000L * ghb_settings_get_int64(ud->prefs, "MinTitleDuration"));
+ 90000L * ghb_dict_get_int(ud->prefs, "MinTitleDuration"));
}
gboolean
ghb_idle_scan(signal_user_data_t *ud)
{
- gchar *path;
- path = ghb_settings_get_string(ud->globals, "scan_source");
+ const gchar *path;
+ path = ghb_dict_get_string(ud->globals, "scan_source");
ghb_do_scan(ud, path, 0, TRUE);
- g_free(path);
return FALSE;
}
@@ -1266,7 +1262,7 @@ ghb_do_scan(
{
if (ghb_queue_edit_settings != NULL)
{
- title_id = ghb_settings_get_int(ghb_queue_edit_settings, "title");
+ title_id = ghb_dict_get_int(ghb_queue_edit_settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
ghb_array_replace(ud->settings_array, titleindex,
ghb_queue_edit_settings);
@@ -1287,19 +1283,18 @@ ghb_do_scan(
if (filename != NULL)
{
last_scan_file = g_strdup(filename);
- ghb_settings_set_string(ud->globals, "scan_source", filename);
+ ghb_dict_set_string(ud->globals, "scan_source", filename);
if (update_source_label(ud, filename))
{
- gchar *path;
+ const gchar *path;
gint preview_count;
show_scan_progress(ud);
- path = ghb_settings_get_string(ud->globals, "scan_source");
+ path = ghb_dict_get_string(ud->globals, "scan_source");
prune_logs(ud);
- preview_count = ghb_settings_get_int(ud->prefs, "preview_count");
+ preview_count = ghb_dict_get_int(ud->prefs, "preview_count");
start_scan(ud, path, title_id, preview_count);
- g_free(path);
}
else
{
@@ -1312,11 +1307,11 @@ static void
do_source_dialog(GtkButton *button, gboolean single, signal_user_data_t *ud)
{
GtkWidget *dialog;
- gchar *sourcename;
+ const gchar *sourcename;
gint response;
g_debug("source_browse_clicked_cb ()");
- sourcename = ghb_settings_get_string(ud->globals, "scan_source");
+ sourcename = ghb_dict_get_string(ud->globals, "scan_source");
GtkWidget *widget;
widget = GHB_WIDGET(ud->builder, "single_title_box");
if (single)
@@ -1352,20 +1347,19 @@ do_source_dialog(GtkButton *button, gboolean single, signal_user_data_t *ud)
gint title_id;
if (single)
- title_id = ghb_settings_get_int(ud->settings, "single_title");
+ title_id = ghb_dict_get_int(ud->settings, "single_title");
else
title_id = 0;
ghb_do_scan(ud, filename, title_id, TRUE);
if (strcmp(sourcename, filename) != 0)
{
- ghb_settings_set_string(ud->prefs, "default_source", filename);
+ ghb_dict_set_string(ud->prefs, "default_source", filename);
ghb_pref_save(ud->prefs, "default_source");
ghb_dvd_set_current(filename, ud);
}
g_free(filename);
}
}
- g_free(sourcename);
}
G_MODULE_EXPORT void
@@ -1393,18 +1387,17 @@ G_MODULE_EXPORT void
dvd_source_activate_cb(GtkWidget *widget, signal_user_data_t *ud)
{
const gchar *filename;
- gchar *sourcename;
+ const gchar *sourcename;
- sourcename = ghb_settings_get_string(ud->globals, "scan_source");
+ sourcename = ghb_dict_get_string(ud->globals, "scan_source");
filename = gtk_buildable_get_name(GTK_BUILDABLE(widget));
ghb_do_scan(ud, filename, 0, TRUE);
if (strcmp(sourcename, filename) != 0)
{
- ghb_settings_set_string(ud->prefs, "default_source", filename);
+ ghb_dict_set_string(ud->prefs, "default_source", filename);
ghb_pref_save(ud->prefs, "default_source");
ghb_dvd_set_current(filename, ud);
}
- g_free(sourcename);
}
void
@@ -1499,16 +1492,15 @@ static gboolean update_default_destination = FALSE;
G_MODULE_EXPORT void
dest_dir_set_cb(GtkFileChooserButton *dest_chooser, signal_user_data_t *ud)
{
- gchar *dest_file, *dest_dir, *dest;
+ const gchar *dest_file, *dest_dir;
+ gchar *dest;
g_debug("dest_dir_set_cb ()");
ghb_widget_to_setting(ud->settings, (GtkWidget*)dest_chooser);
- dest_file = ghb_settings_get_string(ud->settings, "dest_file");
- dest_dir = ghb_settings_get_string(ud->settings, "dest_dir");
+ dest_file = ghb_dict_get_string(ud->settings, "dest_file");
+ dest_dir = ghb_dict_get_string(ud->settings, "dest_dir");
dest = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", dest_dir, dest_file);
- ghb_settings_set_string(ud->settings, "destination", dest);
- g_free(dest_file);
- g_free(dest_dir);
+ ghb_dict_set_string(ud->settings, "destination", dest);
g_free(dest);
update_default_destination = TRUE;
}
@@ -1516,19 +1508,18 @@ dest_dir_set_cb(GtkFileChooserButton *dest_chooser, signal_user_data_t *ud)
G_MODULE_EXPORT void
dest_file_changed_cb(GtkEntry *entry, signal_user_data_t *ud)
{
- gchar *dest_file, *dest_dir, *dest;
+ const gchar *dest_file, *dest_dir;
+ gchar *dest;
g_debug("dest_file_changed_cb ()");
ghb_update_destination_extension(ud);
ghb_widget_to_setting(ud->settings, (GtkWidget*)entry);
// This signal goes off with ever keystroke, so I'm putting this
// update on the timer.
- dest_file = ghb_settings_get_string(ud->settings, "dest_file");
- dest_dir = ghb_settings_get_string(ud->settings, "dest_dir");
+ dest_file = ghb_dict_get_string(ud->settings, "dest_file");
+ dest_dir = ghb_dict_get_string(ud->settings, "dest_dir");
dest = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", dest_dir, dest_file);
- ghb_settings_set_string(ud->settings, "destination", dest);
- g_free(dest_file);
- g_free(dest_dir);
+ ghb_dict_set_string(ud->settings, "destination", dest);
g_free(dest);
update_default_destination = TRUE;
}
@@ -1538,13 +1529,13 @@ destination_browse_clicked_cb(GtkButton *button, signal_user_data_t *ud)
{
GtkWidget *dialog;
GtkEntry *entry;
- gchar *destname;
+ const gchar *destname;
gchar *basename;
GtkWindow *hb_window;
g_debug("destination_browse_clicked_cb ()");
hb_window = GTK_WINDOW(GHB_WIDGET(ud->builder, "hb_window"));
- destname = ghb_settings_get_string(ud->settings, "destination");
+ destname = ghb_dict_get_string(ud->settings, "destination");
dialog = gtk_file_chooser_dialog_new("Choose Destination",
hb_window,
GTK_FILE_CHOOSER_ACTION_SAVE,
@@ -1553,7 +1544,6 @@ destination_browse_clicked_cb(GtkButton *button, signal_user_data_t *ud)
NULL);
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), destname);
basename = g_path_get_basename(destname);
- g_free(destname);
gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), basename);
g_free(basename);
if (gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
@@ -1663,10 +1653,10 @@ update_aspect_info(signal_user_data_t *ud)
GtkWidget *widget;
gchar *text;
- text = ghb_settings_get_boolean(ud->settings, "PictureAutoCrop") ? _("On") : _("Off");
+ text = ghb_dict_get_bool(ud->settings, "PictureAutoCrop") ? _("On") : _("Off");
widget = GHB_WIDGET(ud->builder, "crop_auto");
gtk_label_set_text(GTK_LABEL(widget), text);
- text = ghb_settings_get_boolean(ud->settings, "autoscale") ? _("On") : _("Off");
+ text = ghb_dict_get_bool(ud->settings, "autoscale") ? _("On") : _("Off");
widget = GHB_WIDGET(ud->builder, "scale_auto");
gtk_label_set_text(GTK_LABEL(widget), text);
switch (ghb_settings_combo_int(ud->settings, "PicturePAR"))
@@ -1700,14 +1690,14 @@ update_crop_info(signal_user_data_t *ud)
gint title_id, titleindex;
const hb_title_t *title;
- title_id = ghb_settings_get_int(ud->settings, "title");
+ title_id = ghb_dict_get_int(ud->settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
if (title != NULL)
{
- crop[0] = ghb_settings_get_int(ud->settings, "PictureTopCrop");
- crop[1] = ghb_settings_get_int(ud->settings, "PictureBottomCrop");
- crop[2] = ghb_settings_get_int(ud->settings, "PictureLeftCrop");
- crop[3] = ghb_settings_get_int(ud->settings, "PictureRightCrop");
+ crop[0] = ghb_dict_get_int(ud->settings, "PictureTopCrop");
+ crop[1] = ghb_dict_get_int(ud->settings, "PictureBottomCrop");
+ crop[2] = ghb_dict_get_int(ud->settings, "PictureLeftCrop");
+ crop[3] = ghb_dict_get_int(ud->settings, "PictureRightCrop");
width = title->geometry.width - crop[2] - crop[3];
height = title->geometry.height - crop[0] - crop[1];
widget = GHB_WIDGET(ud->builder, "crop_dimensions");
@@ -1729,8 +1719,8 @@ update_scale_info(signal_user_data_t *ud)
GtkWidget *widget;
gchar *text;
- gint width = ghb_settings_get_int(ud->settings, "scale_width");
- gint height = ghb_settings_get_int(ud->settings, "scale_height");
+ gint width = ghb_dict_get_int(ud->settings, "scale_width");
+ gint height = ghb_dict_get_int(ud->settings, "scale_height");
widget = GHB_WIDGET(ud->builder, "scale_dimensions");
text = g_strdup_printf("%d x %d", width, height);
gtk_label_set_text(GTK_LABEL(widget), text);
@@ -1746,7 +1736,7 @@ ghb_update_title_info(signal_user_data_t *ud)
int title_id, titleindex;
const hb_title_t * title;
- title_id = ghb_settings_get_int(ud->settings, "title");
+ title_id = ghb_dict_get_int(ud->settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
if (title == NULL)
return;
@@ -1794,7 +1784,7 @@ set_title_settings(signal_user_data_t *ud, GhbValue *settings)
int title_id, titleindex;
const hb_title_t * title;
- title_id = ghb_settings_get_int(settings, "title");
+ title_id = ghb_dict_get_int(settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
ghb_subtitle_set_pref_lang(settings);
@@ -1802,74 +1792,74 @@ set_title_settings(signal_user_data_t *ud, GhbValue *settings)
{
gint num_chapters = hb_list_count(title->list_chapter);
- ghb_settings_set_int(settings, "angle", 1);
- ghb_settings_set_int(settings, "PtoPType", 0);
- ghb_settings_set_int(settings, "start_point", 1);
- ghb_settings_set_int(settings, "end_point", num_chapters);
- ghb_settings_set_int(settings, "source_width", title->geometry.width);
- ghb_settings_set_int(settings, "source_height", title->geometry.height);
- ghb_settings_set_string(settings, "source", title->path);
+ ghb_dict_set_int(settings, "angle", 1);
+ ghb_dict_set_int(settings, "PtoPType", 0);
+ ghb_dict_set_int(settings, "start_point", 1);
+ ghb_dict_set_int(settings, "end_point", num_chapters);
+ ghb_dict_set_int(settings, "source_width", title->geometry.width);
+ ghb_dict_set_int(settings, "source_height", title->geometry.height);
+ ghb_dict_set_string(settings, "source", title->path);
if (title->type == HB_STREAM_TYPE || title->type == HB_FF_STREAM_TYPE)
{
if (title->name != NULL && title->name[0] != 0)
{
- ghb_settings_set_string(settings, "volume_label", title->name);
+ ghb_dict_set_string(settings, "volume_label", title->name);
}
else
{
gchar *label = _("No Title Found");
- ghb_settings_set_string(settings, "volume_label", label);
+ ghb_dict_set_string(settings, "volume_label", label);
}
}
else
{
- ghb_settings_set_value(settings, "volume_label",
- ghb_settings_get_value(ud->settings, "volume_label"));
+ ghb_dict_set(settings, "volume_label", ghb_value_dup(
+ ghb_dict_get_value(ud->settings, "volume_label")));
}
- ghb_settings_set_int(settings, "scale_width",
+ ghb_dict_set_int(settings, "scale_width",
title->geometry.width - title->crop[2] - title->crop[3]);
// If anamorphic or keep_aspect, the hight will
// be automatically calculated
gboolean keep_aspect;
gint pic_par;
- keep_aspect = ghb_settings_get_boolean(settings, "PictureKeepRatio");
+ keep_aspect = ghb_dict_get_bool(settings, "PictureKeepRatio");
pic_par = ghb_settings_combo_int(settings, "PicturePAR");
if (!(keep_aspect || pic_par) || pic_par == 3)
{
- ghb_settings_set_int(settings, "scale_height",
+ ghb_dict_set_int(settings, "scale_height",
title->geometry.width - title->crop[0] - title->crop[1]);
}
ghb_set_scale_settings(settings, GHB_PIC_KEEP_PAR|GHB_PIC_USE_MAX);
- ghb_settings_set_int(settings, "angle_count", title->angle_count);
+ ghb_dict_set_int(settings, "angle_count", title->angle_count);
- ghb_settings_set_string(settings, "MetaName", title->name);
+ ghb_dict_set_string(settings, "MetaName", title->name);
if (title->metadata)
{
if (title->metadata->name)
{
- ghb_settings_set_string(settings, "MetaName",
+ ghb_dict_set_string(settings, "MetaName",
title->metadata->name);
}
- ghb_settings_set_string(settings, "MetaArtist",
+ ghb_dict_set_string(settings, "MetaArtist",
title->metadata->artist);
- ghb_settings_set_string(settings, "MetaReleaseDate",
+ ghb_dict_set_string(settings, "MetaReleaseDate",
title->metadata->release_date);
- ghb_settings_set_string(settings, "MetaComment",
+ ghb_dict_set_string(settings, "MetaComment",
title->metadata->comment);
if (!title->metadata->name && title->metadata->album)
{
- ghb_settings_set_string(settings, "MetaName",
+ ghb_dict_set_string(settings, "MetaName",
title->metadata->album);
}
- ghb_settings_set_string(settings, "MetaAlbumArtist",
+ ghb_dict_set_string(settings, "MetaAlbumArtist",
title->metadata->album_artist);
- ghb_settings_set_string(settings, "MetaGenre",
+ ghb_dict_set_string(settings, "MetaGenre",
title->metadata->genre);
- ghb_settings_set_string(settings, "MetaDescription",
+ ghb_dict_set_string(settings, "MetaDescription",
title->metadata->description);
- ghb_settings_set_string(settings, "MetaLongDescription",
+ ghb_dict_set_string(settings, "MetaLongDescription",
title->metadata->long_description);
}
update_chapter_list_settings(settings);
@@ -1878,19 +1868,18 @@ set_title_settings(signal_user_data_t *ud, GhbValue *settings)
}
set_destination_settings(ud, settings);
- ghb_settings_set_value(settings, "dest_dir",
- ghb_settings_get_value(ud->prefs, "destination_dir"));
+ ghb_dict_set(settings, "dest_dir", ghb_value_dup(
+ ghb_dict_get_value(ud->prefs, "destination_dir")));
- char *dest_file, *dest_dir, *dest;
- dest_file = ghb_settings_get_string(settings, "dest_file");
- dest_dir = ghb_settings_get_string(settings, "dest_dir");
+ const char *dest_file, *dest_dir;
+ char *dest;
+ dest_file = ghb_dict_get_string(settings, "dest_file");
+ dest_dir = ghb_dict_get_string(settings, "dest_dir");
dest = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", dest_dir, dest_file);
- ghb_settings_set_string(settings, "destination", dest);
- g_free(dest_file);
- g_free(dest_dir);
+ ghb_dict_set_string(settings, "destination", dest);
g_free(dest);
- ghb_settings_set_int(settings, "preview_frame", 2);
+ ghb_dict_set_int(settings, "preview_frame", 2);
}
void
@@ -1927,15 +1916,15 @@ load_all_titles(signal_user_data_t *ud, int titleindex)
for (ii = 0; ii < count; ii++)
{
int index;
- GhbValue *settings = ghb_settings_new();
+ GhbValue *settings = ghb_dict_new();
title = hb_list_item(list, ii);
index = (title != NULL) ? title->index : -1;
ghb_settings_init(settings, "Initialization");
ghb_preset_to_settings(settings, preset);
- ghb_settings_set_value(settings, "preset", preset_path);
- ghb_settings_set_int(settings, "title", index);
+ ghb_dict_set(settings, "preset", ghb_value_dup(preset_path));
+ ghb_dict_set_int(settings, "title", index);
set_title_settings(ud, settings);
ghb_array_append(settings_array, settings);
}
@@ -1983,7 +1972,7 @@ title_reset_clicked_cb(GtkWidget *widget, signal_user_data_t *ud)
int title_id, titleindex;
const hb_title_t *title;
- title_id = ghb_settings_get_int(ud->settings, "title");
+ title_id = ghb_dict_get_int(ud->settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
(void)title; // Silence "unused variable" warning
load_all_titles(ud, titleindex);
@@ -2002,7 +1991,7 @@ ptop_widget_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
ghb_check_dependency(ud, widget, NULL);
ghb_live_reset(ud);
- title_id = ghb_settings_get_int(ud->settings, "title");
+ title_id = ghb_dict_get_int(ud->settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
if (title == NULL)
return;
@@ -2043,13 +2032,13 @@ framerate_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
if (ghb_settings_video_framerate_rate(ud->settings, "VideoFramerate") != 0)
{
- if (!ghb_settings_get_boolean(ud->settings, "VideoFrameratePFR"))
+ if (!ghb_dict_get_bool(ud->settings, "VideoFrameratePFR"))
{
ghb_ui_update(ud, "VideoFramerateCFR", ghb_boolean_value(TRUE));
}
}
if (ghb_settings_video_framerate_rate(ud->settings, "VideoFramerate") == 0 &&
- ghb_settings_get_boolean(ud->settings, "VideoFrameratePFR"))
+ ghb_dict_get_bool(ud->settings, "VideoFrameratePFR"))
{
ghb_ui_update(ud, "VideoFramerateVFR", ghb_boolean_value(TRUE));
}
@@ -2129,7 +2118,7 @@ vquality_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
ghb_clear_presets_selection(ud);
ghb_live_reset(ud);
- double vquality = ghb_settings_get_double(ud->settings, "VideoQualitySlider");
+ double vquality = ghb_dict_get_double(ud->settings, "VideoQualitySlider");
if (vquality < 1.0)
{
ghb_ui_update(ud, "VideoProfile", ghb_string_value("auto"));
@@ -2221,8 +2210,8 @@ start_point_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
ghb_widget_to_setting(ud->settings, widget);
if (ghb_settings_combo_int(ud->settings, "PtoPType") == 0)
{
- start = ghb_settings_get_int(ud->settings, "start_point");
- end = ghb_settings_get_int(ud->settings, "end_point");
+ start = ghb_dict_get_int(ud->settings, "start_point");
+ end = ghb_dict_get_int(ud->settings, "end_point");
if (start > end)
ghb_ui_update(ud, "end_point", ghb_int_value(start));
ghb_check_dependency(ud, widget, NULL);
@@ -2230,14 +2219,14 @@ start_point_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
set_destination(ud);
widget = GHB_WIDGET (ud->builder, "ChapterMarkers");
// End may have been changed above, get it again
- end = ghb_settings_get_int(ud->settings, "end_point");
+ end = ghb_dict_get_int(ud->settings, "end_point");
gtk_widget_set_sensitive(widget, end > start);
update_title_duration(ud);
}
else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 1)
{
- start = ghb_settings_get_int(ud->settings, "start_point");
- end = ghb_settings_get_int(ud->settings, "end_point");
+ start = ghb_dict_get_int(ud->settings, "start_point");
+ end = ghb_dict_get_int(ud->settings, "end_point");
if (start >= end)
ghb_ui_update(ud, "end_point", ghb_int_value(start+1));
ghb_check_dependency(ud, widget, NULL);
@@ -2245,8 +2234,8 @@ start_point_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
}
else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 2)
{
- start = ghb_settings_get_int(ud->settings, "start_point");
- end = ghb_settings_get_int(ud->settings, "end_point");
+ start = ghb_dict_get_int(ud->settings, "start_point");
+ end = ghb_dict_get_int(ud->settings, "end_point");
if (start > end)
ghb_ui_update(ud, "end_point", ghb_int_value(start));
ghb_check_dependency(ud, widget, NULL);
@@ -2262,8 +2251,8 @@ end_point_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
ghb_widget_to_setting(ud->settings, widget);
if (ghb_settings_combo_int(ud->settings, "PtoPType") == 0)
{
- start = ghb_settings_get_int(ud->settings, "start_point");
- end = ghb_settings_get_int(ud->settings, "end_point");
+ start = ghb_dict_get_int(ud->settings, "start_point");
+ end = ghb_dict_get_int(ud->settings, "end_point");
if (start > end)
ghb_ui_update(ud, "start_point", ghb_int_value(end));
ghb_check_dependency(ud, widget, NULL);
@@ -2271,14 +2260,14 @@ end_point_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
set_destination(ud);
widget = GHB_WIDGET (ud->builder, "ChapterMarkers");
// Start may have been changed above, get it again
- start = ghb_settings_get_int(ud->settings, "start_point");
+ start = ghb_dict_get_int(ud->settings, "start_point");
gtk_widget_set_sensitive(widget, end > start);
update_title_duration(ud);
}
else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 1)
{
- start = ghb_settings_get_int(ud->settings, "start_point");
- end = ghb_settings_get_int(ud->settings, "end_point");
+ start = ghb_dict_get_int(ud->settings, "start_point");
+ end = ghb_dict_get_int(ud->settings, "end_point");
if (start >= end)
ghb_ui_update(ud, "start_point", ghb_int_value(end-1));
ghb_check_dependency(ud, widget, NULL);
@@ -2286,8 +2275,8 @@ end_point_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
}
else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 2)
{
- start = ghb_settings_get_int(ud->settings, "start_point");
- end = ghb_settings_get_int(ud->settings, "end_point");
+ start = ghb_dict_get_int(ud->settings, "start_point");
+ end = ghb_dict_get_int(ud->settings, "end_point");
if (start > end)
ghb_ui_update(ud, "start_point", ghb_int_value(end));
ghb_check_dependency(ud, widget, NULL);
@@ -2687,7 +2676,7 @@ find_queue_job(GhbValue *queue, gint unique_id, GhbValue **job)
for (ii = 0; ii < count; ii++)
{
js = ghb_array_get(queue, ii);
- job_unique_id = ghb_settings_get_int(js, "job_unique_id");
+ job_unique_id = ghb_dict_get_int(js, "job_unique_id");
if (job_unique_id == unique_id)
{
*job = js;
@@ -2702,13 +2691,14 @@ start_new_log(signal_user_data_t *ud, GhbValue *js)
{
time_t _now;
struct tm *now;
- gchar *log_path, *pos, *destname, *basename, *dest_dir;
+ gchar *log_path, *pos, *basename, *dest_dir;
+ const gchar *destname;
_now = time(NULL);
now = localtime(&_now);
- destname = ghb_settings_get_string(js, "destination");
+ destname = ghb_dict_get_string(js, "destination");
basename = g_path_get_basename(destname);
- if (ghb_settings_get_boolean(ud->prefs, "EncodeLogLocation"))
+ if (ghb_dict_get_bool(ud->prefs, "EncodeLogLocation"))
{
dest_dir = g_path_get_dirname (destname);
}
@@ -2716,7 +2706,6 @@ start_new_log(signal_user_data_t *ud, GhbValue *js)
{
dest_dir = ghb_get_user_config_dir("EncodeLogs");
}
- g_free(destname);
pos = g_strrstr( basename, "." );
if (pos != NULL)
{
@@ -2756,16 +2745,16 @@ submit_job(signal_user_data_t *ud, GhbValue *settings)
g_debug("submit_job");
if (settings == NULL) return;
- preset_modified = ghb_settings_get_boolean(settings, "preset_modified");
- path = ghb_settings_get_value(settings, "preset");
+ preset_modified = ghb_dict_get_bool(settings, "preset_modified");
+ path = ghb_dict_get_value(settings, "preset");
preset = ghb_preset_path_string(path);
type = ghb_preset_is_custom() ? "Custom " : "";
modified = preset_modified ? "Modified " : "";
ghb_log("%s%sPreset: %s", modified, type, preset);
g_free(preset);
- ghb_settings_set_int(settings, "job_unique_id", unique_id);
- ghb_settings_set_int(settings, "job_status", GHB_QUEUE_RUNNING);
+ ghb_dict_set_int(settings, "job_unique_id", unique_id);
+ ghb_dict_set_int(settings, "job_status", GHB_QUEUE_RUNNING);
start_new_log(ud, settings);
ghb_add_job(settings, unique_id);
ghb_start_queue();
@@ -2846,7 +2835,7 @@ queue_pending_count(GhbValue *queue)
{
js = ghb_array_get(queue, ii);
- status = ghb_settings_get_int(js, "job_status");
+ status = ghb_dict_get_int(js, "job_status");
if (status == GHB_QUEUE_PENDING)
{
nn++;
@@ -2886,7 +2875,7 @@ ghb_start_next_job(signal_user_data_t *ud)
{
js = ghb_array_get(ud->queue, ii);
- status = ghb_settings_get_int(js, "job_status");
+ status = ghb_dict_get_int(js, "job_status");
if (status == GHB_QUEUE_PENDING)
{
ghb_inhibit_gsm(ud);
@@ -3057,7 +3046,7 @@ ghb_backend_events(signal_user_data_t *ud)
status.queue.state == GHB_STATE_IDLE)
{
static gboolean prev_dvdnav;
- gboolean dvdnav = ghb_settings_get_boolean(ud->prefs, "use_dvdnav");
+ gboolean dvdnav = ghb_dict_get_bool(ud->prefs, "use_dvdnav");
if (dvdnav != prev_dvdnav)
{
hb_dvd_set_dvdnav(dvdnav);
@@ -3099,7 +3088,7 @@ ghb_backend_events(signal_user_data_t *ud)
}
else if (status.scan.state & GHB_STATE_SCANDONE)
{
- gchar *source;
+ const gchar *source;
GtkProgressBar *scan_prog;
GtkLabel *label;
@@ -3115,9 +3104,8 @@ ghb_backend_events(signal_user_data_t *ud)
widget = GHB_WIDGET(ud->builder, "source_title_open");
gtk_widget_set_sensitive(widget, TRUE);
- source = ghb_settings_get_string(ud->globals, "scan_source");
+ source = ghb_dict_get_string(ud->globals, "scan_source");
update_source_label(ud, source);
- g_free(source);
scan_prog = GTK_PROGRESS_BAR(GHB_WIDGET (ud->builder, "scan_prog"));
gtk_progress_bar_set_fraction (scan_prog, 1.0);
@@ -3148,10 +3136,10 @@ ghb_backend_events(signal_user_data_t *ud)
{
// Switch to the correct title in the list
ghb_ui_update(ud, "title",
- ghb_settings_get_value(ghb_queue_edit_settings, "title"));
+ ghb_dict_get_value(ghb_queue_edit_settings, "title"));
// The above should cause the current title index to update
- title_id = ghb_settings_get_int(ud->settings, "title");
+ title_id = ghb_dict_get_int(ud->settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
ghb_array_replace(ud->settings_array, titleindex,
ghb_queue_edit_settings);
@@ -3269,8 +3257,8 @@ ghb_backend_events(signal_user_data_t *ud)
g_io_channel_unref(ud->job_activity_log);
ud->job_activity_log = NULL;
if (js)
- ghb_settings_set_int(js, "job_status", qstatus);
- if (ghb_settings_get_boolean(ud->prefs, "RemoveFinishedJobs") &&
+ ghb_dict_set_int(js, "job_status", qstatus);
+ if (ghb_dict_get_bool(ud->prefs, "RemoveFinishedJobs") &&
status.queue.error == GHB_ERROR_NONE)
{
ghb_queue_remove_row(ud, index);
@@ -3330,18 +3318,17 @@ ghb_timer_cb(gpointer data)
ghb_backend_events(ud);
if (update_default_destination)
{
- gchar *dest, *dest_dir, *def_dest;
- dest = ghb_settings_get_string(ud->settings, "destination");
- dest_dir = g_path_get_dirname (dest);
- def_dest = ghb_settings_get_string(ud->prefs, "destination_dir");
+ const gchar *dest, *def_dest;
+ gchar *dest_dir;
+ dest = ghb_dict_get_string(ud->settings, "destination");
+ dest_dir = g_path_get_dirname(dest);
+ def_dest = ghb_dict_get_string(ud->prefs, "destination_dir");
if (strcmp(dest_dir, def_dest) != 0)
{
- ghb_settings_set_string (ud->prefs, "destination_dir", dest_dir);
+ ghb_dict_set_string(ud->prefs, "destination_dir", dest_dir);
ghb_pref_save(ud->prefs, "destination_dir");
}
- g_free(dest);
g_free(dest_dir);
- g_free(def_dest);
update_default_destination = FALSE;
}
if (update_preview)
@@ -3354,8 +3341,8 @@ ghb_timer_cb(gpointer data)
#if !defined(_NO_UPDATE_CHECK)
if (!appcast_busy)
{
- gchar *updates;
- updates = ghb_settings_get_string(ud->prefs, "check_updates");
+ const gchar *updates;
+ updates = ghb_dict_get_string(ud->prefs, "check_updates");
gint64 duration = 0;
if (strcmp(updates, "daily") == 0)
duration = 60 * 60 * 24;
@@ -3364,17 +3351,16 @@ ghb_timer_cb(gpointer data)
else if (strcmp(updates, "monthly") == 0)
duration = 60 * 60 * 24 * 7;
- g_free(updates);
if (duration != 0)
{
gint64 last;
time_t tt;
- last = ghb_settings_get_int64(ud->prefs, "last_update_check");
+ last = ghb_dict_get_int(ud->prefs, "last_update_check");
time(&tt);
if (last + duration < tt)
{
- ghb_settings_set_int64(ud->prefs,
+ ghb_dict_set_int(ud->prefs,
"last_update_check", tt);
ghb_pref_save(ud->prefs, "last_update_check");
GHB_THREAD_NEW("Update Check", (GThreadFunc)ghb_check_update, ud);
@@ -3651,7 +3637,7 @@ show_presets_toggled_cb(GtkWidget *widget, signal_user_data_t *ud)
g_debug("show_presets_clicked_cb ()");
frame = GHB_WIDGET (ud->builder, "presets_frame");
ghb_widget_to_setting(ud->prefs, widget);
- if (ghb_settings_get_boolean(ud->prefs, "show_presets"))
+ if (ghb_dict_get_bool(ud->prefs, "show_presets"))
{
gtk_widget_show_now(frame);
}
@@ -3724,9 +3710,9 @@ chapter_refresh_list_ui(signal_user_data_t *ud)
tm_count = gtk_tree_model_iter_n_children(tm, NULL);
- title_id = ghb_settings_get_int(ud->settings, "title");
+ title_id = ghb_dict_get_int(ud->settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
- chapter_list = ghb_settings_get_value(ud->settings, "chapter_list");
+ chapter_list = ghb_dict_get_value(ud->settings, "chapter_list");
count = ghb_array_len(chapter_list);
if (count != tm_count)
{
@@ -3757,11 +3743,11 @@ update_chapter_list_settings(GhbValue *settings)
const hb_title_t *title;
g_debug("update_chapter_list_settings ()");
- title_id = ghb_settings_get_int(settings, "title");
+ title_id = ghb_dict_get_int(settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
chapters = ghb_get_chapters(title);
if (chapters)
- ghb_settings_take_value(settings, "chapter_list", chapters);
+ ghb_dict_set(settings, "chapter_list", chapters);
}
static gint chapter_edit_key = 0;
@@ -3809,7 +3795,7 @@ chapter_edited_cb(
const GhbValue *chapters;
GhbValue *chapter;
- chapters = ghb_settings_get_value(ud->settings, "chapter_list");
+ chapters = ghb_dict_get_value(ud->settings, "chapter_list");
chapter = ghb_array_get(chapters, index-1);
ghb_string_value_set(chapter, text);
if ((chapter_edit_key == GDK_KEY_Return || chapter_edit_key == GDK_KEY_Down) &&
@@ -3908,7 +3894,7 @@ hbfd_toggled_cb(GtkWidget *widget, signal_user_data_t *ud)
{
g_debug("hbfd_toggled_cb");
ghb_widget_to_setting(ud->prefs, widget);
- gboolean hbfd = ghb_settings_get_boolean(ud->prefs, "hbfd");
+ gboolean hbfd = ghb_dict_get_bool(ud->prefs, "hbfd");
ghb_hbfd(ud, hbfd);
ghb_pref_save(ud->prefs, "hbfd");
}
@@ -3933,7 +3919,7 @@ pref_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
ghb_pref_set(ud->prefs, name);
gint preview_count;
- preview_count = ghb_settings_get_int(ud->prefs, "preview_count");
+ preview_count = ghb_dict_get_int(ud->prefs, "preview_count");
widget = GHB_WIDGET(ud->builder, "preview_frame");
gtk_range_set_range(GTK_RANGE(widget), 1, preview_count);
}
@@ -3963,7 +3949,7 @@ vqual_granularity_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
int inverted, digits;
ghb_vquality_range(ud, &vqmin, &vqmax, &step, &page, &digits, &inverted);
- val = ghb_settings_get_double(ud->settings, "VideoQualitySlider");
+ val = ghb_dict_get_double(ud->settings, "VideoQualitySlider");
ghb_scale_configure(ud, "VideoQualitySlider", val, vqmin, vqmax,
step, page, digits, inverted);
}
@@ -3985,11 +3971,11 @@ hbfd_feature_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
const gchar *name = ghb_get_setting_key(widget);
ghb_pref_set(ud->prefs, name);
- gboolean hbfd = ghb_settings_get_boolean(ud->prefs, "hbfd_feature");
+ gboolean hbfd = ghb_dict_get_bool(ud->prefs, "hbfd_feature");
if (hbfd)
{
const GhbValue *val;
- val = ghb_settings_get_value(ud->prefs, "hbfd");
+ val = ghb_dict_get_value(ud->prefs, "hbfd");
ghb_ui_settings_update(ud, ud->prefs, "hbfd", val);
}
widget = GHB_WIDGET(ud->builder, "hbfd");
@@ -4181,15 +4167,15 @@ handle_media_change(const gchar *device, gboolean insert, signal_user_data_t *ud
{
GHB_THREAD_NEW("Cache Volume Names",
(GThreadFunc)ghb_cache_volnames, ud);
- if (ghb_settings_get_boolean(ud->prefs, "AutoScan") &&
+ if (ghb_dict_get_bool(ud->prefs, "AutoScan") &&
ud->current_dvd_device != NULL &&
strcmp(device, ud->current_dvd_device) == 0)
{
show_scan_progress(ud);
update_source_label(ud, device);
gint preview_count;
- preview_count = ghb_settings_get_int(ud->prefs, "preview_count");
- ghb_settings_set_string(ud->globals, "scan_source", device);
+ preview_count = ghb_dict_get_int(ud->prefs, "preview_count");
+ ghb_dict_set_string(ud->globals, "scan_source", device);
start_scan(ud, device, 0, preview_count);
}
}
@@ -4207,7 +4193,7 @@ handle_media_change(const gchar *device, gboolean insert, signal_user_data_t *ud
{
ghb_hb_cleanup(TRUE);
prune_logs(ud);
- ghb_settings_set_string(ud->globals, "scan_source", "/dev/null");
+ ghb_dict_set_string(ud->globals, "scan_source", "/dev/null");
start_scan(ud, "/dev/null", 0, 1);
}
}
@@ -4288,13 +4274,13 @@ drive_changed_cb(GVolumeMonitor *gvm, GDrive *gd, signal_user_data_t *ud)
}
if (g_drive_has_media(gd))
{
- if (ghb_settings_get_boolean(ud->prefs, "AutoScan"))
+ if (ghb_dict_get_bool(ud->prefs, "AutoScan"))
{
show_scan_progress(ud);
update_source_label(ud, device);
gint preview_count;
- preview_count = ghb_settings_get_int(ud->prefs, "preview_count");
- ghb_settings_set_string(ud->globals, "scan_source", device);
+ preview_count = ghb_dict_get_int(ud->prefs, "preview_count");
+ ghb_dict_set_string(ud->globals, "scan_source", device);
start_scan(ud, device, 0, preview_count);
}
}
@@ -4302,7 +4288,7 @@ drive_changed_cb(GVolumeMonitor *gvm, GDrive *gd, signal_user_data_t *ud)
{
ghb_hb_cleanup(TRUE);
prune_logs(ud);
- ghb_settings_set_string(ud->globals, "scan_source", "/dev/null");
+ ghb_dict_set_string(ud->globals, "scan_source", "/dev/null");
start_scan(ud, "/dev/null", 0, 1);
}
}
@@ -4833,13 +4819,13 @@ tweak_setting_cb(
gboolean allow_tweaks;
g_debug("press %d %d", event->type, event->button);
- allow_tweaks = ghb_settings_get_boolean(ud->prefs, "allow_tweaks");
+ allow_tweaks = ghb_dict_get_bool(ud->prefs, "allow_tweaks");
if (allow_tweaks && event->type == GDK_BUTTON_PRESS && event->button == 3)
{ // Its a right mouse click
GtkWidget *dialog;
GtkEntry *entry;
GtkResponseType response;
- gchar *tweak = NULL;
+ const gchar *tweak = NULL;
name = ghb_get_setting_key(widget);
if (g_str_has_prefix(name, "tweak_"))
@@ -4851,14 +4837,13 @@ tweak_setting_cb(
tweak_name = g_strdup_printf("tweak_%s", name);
}
- tweak = ghb_settings_get_string (ud->settings, tweak_name);
+ tweak = ghb_dict_get_string(ud->settings, tweak_name);
dialog = GHB_WIDGET(ud->builder, "tweak_dialog");
gtk_window_set_title(GTK_WINDOW(dialog), tweak_name);
entry = GTK_ENTRY(GHB_WIDGET(ud->builder, "tweak_setting"));
if (tweak)
{
gtk_entry_set_text(entry, tweak);
- g_free(tweak);
}
response = gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_hide(dialog);
@@ -4866,7 +4851,7 @@ tweak_setting_cb(
{
tweak = (gchar*)gtk_entry_get_text(entry);
if (ghb_validate_filter_string(tweak, -1))
- ghb_settings_set_string(ud->settings, tweak_name, tweak);
+ ghb_dict_set_string(ud->settings, tweak_name, tweak);
else
{
GtkWindow *hb_window;
@@ -4976,7 +4961,7 @@ process_appcast(signal_user_data_t *ud)
ghb_appcast_parse(ud->appcast, &description, &build, &version);
if (build)
ibuild = g_strtod(build, NULL);
- skip = ghb_settings_get_int(ud->prefs, "update_skip_version");
+ skip = ghb_dict_get_int(ud->prefs, "update_skip_version");
if (description == NULL || build == NULL || version == NULL
|| ibuild <= hb_get_build(NULL) || skip == ibuild)
{
@@ -5005,7 +4990,7 @@ process_appcast(signal_user_data_t *ud)
if (response == GTK_RESPONSE_OK)
{
// Skip
- ghb_settings_set_int(ud->prefs, "update_skip_version", ibuild);
+ ghb_dict_set_int(ud->prefs, "update_skip_version", ibuild);
ghb_pref_save(ud->prefs, "update_skip_version");
}
g_free(msg);
@@ -5258,13 +5243,13 @@ window_configure_cb(
if (gtk_widget_get_visible(widget))
{
gint w, h;
- w = ghb_settings_get_int(ud->prefs, "window_width");
- h = ghb_settings_get_int(ud->prefs, "window_height");
+ w = ghb_dict_get_int(ud->prefs, "window_width");
+ h = ghb_dict_get_int(ud->prefs, "window_height");
if ( w != event->width || h != event->height )
{
- ghb_settings_set_int(ud->prefs, "window_width", event->width);
- ghb_settings_set_int(ud->prefs, "window_height", event->height);
+ ghb_dict_set_int(ud->prefs, "window_width", event->width);
+ ghb_dict_set_int(ud->prefs, "window_height", event->height);
ghb_pref_set(ud->prefs, "window_width");
ghb_pref_set(ud->prefs, "window_height");
ghb_prefs_store();
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index 5a65d20e1..146653932 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -991,7 +991,7 @@ ghb_subtitle_track_source(GhbValue *settings, gint track)
return SRTSUB;
if (track < 0)
return VOBSUB;
- title_id = ghb_settings_get_int(settings, "title");
+ title_id = ghb_dict_get_int(settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
if (title == NULL)
return VOBSUB;
@@ -1010,7 +1010,7 @@ ghb_subtitle_track_lang(GhbValue *settings, gint track)
gint title_id, titleindex;
const hb_title_t * title;
- title_id = ghb_settings_get_int(settings, "title");
+ title_id = ghb_dict_get_int(settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
if (title == NULL) // Bad titleindex
goto fail;
@@ -1100,16 +1100,16 @@ ghb_grey_combo_options(signal_user_data_t *ud)
const hb_title_t *title;
hb_audio_config_t *aconfig = NULL;
- title_id = ghb_settings_get_int(ud->settings, "title");
+ title_id = ghb_dict_get_int(ud->settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
- track = ghb_settings_get_int(ud->settings, "AudioTrack");
+ track = ghb_dict_get_int(ud->settings, "AudioTrack");
aconfig = ghb_get_audio_info(title, track);
const char *mux_id;
const hb_container_t *mux;
- mux_id = ghb_settings_get_const_string(ud->settings, "FileFormat");
+ mux_id = ghb_dict_get_string(ud->settings, "FileFormat");
mux = ghb_lookup_container_by_name(mux_id);
grey_builder_combo_box_item(ud->builder, "x264_analyse", 4, TRUE);
@@ -1336,15 +1336,21 @@ ghb_lookup_audio_samplerate_rate(const char *name)
int
ghb_settings_audio_samplerate_rate(const GhbValue *settings, const char *name)
{
- const char *rate_id = ghb_settings_get_const_string(settings, name);
- return ghb_lookup_audio_samplerate_rate(rate_id);
+ int result;
+ char *rate_id = ghb_dict_get_string_xform(settings, name);
+ result = ghb_lookup_audio_samplerate_rate(rate_id);
+ g_free(rate_id);
+ return result;
}
const hb_rate_t*
ghb_settings_audio_samplerate(const GhbValue *settings, const char *name)
{
- const char *rate_id = ghb_settings_get_const_string(settings, name);
- return ghb_lookup_audio_samplerate(rate_id);
+ const hb_rate_t *result;
+ char *rate_id = ghb_dict_get_string_xform(settings, name);
+ result = ghb_lookup_audio_samplerate(rate_id);
+ g_free(rate_id);
+ return result;
}
static void
@@ -1431,15 +1437,21 @@ ghb_lookup_video_framerate_rate(const char *name)
int
ghb_settings_video_framerate_rate(const GhbValue *settings, const char *name)
{
- const char *rate_id = ghb_settings_get_const_string(settings, name);
- return ghb_lookup_video_framerate_rate(rate_id);
+ int result;
+ char *rate_id = ghb_dict_get_string_xform(settings, name);
+ result = ghb_lookup_video_framerate_rate(rate_id);
+ g_free(rate_id);
+ return result;
}
const hb_rate_t*
ghb_settings_video_framerate(const GhbValue *settings, const char *name)
{
- const char *rate_id = ghb_settings_get_const_string(settings, name);
- return ghb_lookup_video_framerate(rate_id);
+ const hb_rate_t *result;
+ char *rate_id = ghb_dict_get_string_xform(settings, name);
+ result = ghb_lookup_video_framerate(rate_id);
+ g_free(rate_id);
+ return result;
}
static void
@@ -1502,14 +1514,14 @@ ghb_lookup_video_encoder_codec(const char *name)
int
ghb_settings_video_encoder_codec(const GhbValue *settings, const char *name)
{
- const char *encoder_id = ghb_settings_get_const_string(settings, name);
+ const char *encoder_id = ghb_dict_get_string(settings, name);
return ghb_lookup_video_encoder_codec(encoder_id);
}
const hb_encoder_t*
ghb_settings_video_encoder(const GhbValue *settings, const char *name)
{
- const char *encoder_id = ghb_settings_get_const_string(settings, name);
+ const char *encoder_id = ghb_dict_get_string(settings, name);
return ghb_lookup_video_encoder(encoder_id);
}
@@ -1576,14 +1588,14 @@ ghb_lookup_audio_encoder_codec(const char *name)
int
ghb_settings_audio_encoder_codec(const GhbValue *settings, const char *name)
{
- const char *encoder_id = ghb_settings_get_const_string(settings, name);
+ const char *encoder_id = ghb_dict_get_string(settings, name);
return ghb_lookup_audio_encoder_codec(encoder_id);
}
const hb_encoder_t*
ghb_settings_audio_encoder(const GhbValue *settings, const char *name)
{
- const char *encoder_id = ghb_settings_get_const_string(settings, name);
+ const char *encoder_id = ghb_dict_get_string(settings, name);
return ghb_lookup_audio_encoder(encoder_id);
}
@@ -1701,14 +1713,14 @@ ghb_lookup_mixdown_mix(const char *name)
int
ghb_settings_mixdown_mix(const GhbValue *settings, const char *name)
{
- const char *mixdown_id = ghb_settings_get_const_string(settings, name);
+ const char *mixdown_id = ghb_dict_get_string(settings, name);
return ghb_lookup_mixdown_mix(mixdown_id);
}
const hb_mixdown_t*
ghb_settings_mixdown(const GhbValue *settings, const char *name)
{
- const char *mixdown_id = ghb_settings_get_const_string(settings, name);
+ const char *mixdown_id = ghb_dict_get_string(settings, name);
return ghb_lookup_mixdown(mixdown_id);
}
@@ -2492,21 +2504,6 @@ ghb_lookup_combo_option(const gchar *name, const GhbValue *gval)
return NULL;
}
-const gchar*
-ghb_lookup_combo_string(const gchar *name, const GhbValue *gval)
-{
- if (gval == NULL)
- return NULL;
- else if (strcmp(name, "SrtLanguage") == 0)
- return lookup_audio_lang_option(gval);
- else
- {
- return lookup_generic_string(find_combo_table(name), gval);
- }
- g_warning("ghb_lookup_combo_int() couldn't find %s", name);
- return NULL;
-}
-
void ghb_init_lang_list_box(GtkListBox *list_box)
{
int ii;
@@ -2677,7 +2674,7 @@ init_ui_combo_boxes(GtkBuilder *builder)
// Construct the advanced options string
// The result is allocated, so someone must free it at some point.
-gchar*
+const gchar*
ghb_build_advanced_opts_string(GhbValue *settings)
{
gint vcodec;
@@ -2685,7 +2682,7 @@ ghb_build_advanced_opts_string(GhbValue *settings)
switch (vcodec)
{
case HB_VCODEC_X264:
- return ghb_settings_get_string(settings, "x264Option");
+ return ghb_dict_get_string(settings, "x264Option");
default:
return NULL;
@@ -2701,31 +2698,31 @@ void ghb_set_video_encoder_opts(hb_dict_t *dict, GhbValue *js)
case HB_VCODEC_X264:
{
if (vcodec == HB_VCODEC_X264 &&
- ghb_settings_get_boolean(js, "x264UseAdvancedOptions"))
+ ghb_dict_get_bool(js, "x264UseAdvancedOptions"))
{
const char *opts;
- opts = ghb_settings_get_const_string(js, "x264Option");
+ opts = ghb_dict_get_string(js, "x264Option");
hb_dict_set(dict, "Options", hb_value_string(opts));
}
else
{
const char *preset, *tune, *profile, *level, *opts;
GString *str = g_string_new("");
- preset = ghb_settings_get_const_string(js, "VideoPreset");
- tune = ghb_settings_get_const_string(js, "VideoTune");
- profile = ghb_settings_get_const_string(js, "VideoProfile");
- level = ghb_settings_get_const_string(js, "VideoLevel");
- opts = ghb_settings_get_const_string(js, "VideoOptionExtra");
+ preset = ghb_dict_get_string(js, "VideoPreset");
+ tune = ghb_dict_get_string(js, "VideoTune");
+ profile = ghb_dict_get_string(js, "VideoProfile");
+ level = ghb_dict_get_string(js, "VideoLevel");
+ opts = ghb_dict_get_string(js, "VideoOptionExtra");
char *tunes;
g_string_append_printf(str, "%s", tune);
if (vcodec == HB_VCODEC_X264)
{
- if (ghb_settings_get_boolean(js, "x264FastDecode"))
+ if (ghb_dict_get_bool(js, "x264FastDecode"))
{
g_string_append_printf(str, "%s%s", str->str[0] ? "," : "", "fastdecode");
}
- if (ghb_settings_get_boolean(js, "x264ZeroLatency"))
+ if (ghb_dict_get_bool(js, "x264ZeroLatency"))
{
g_string_append_printf(str, "%s%s", str->str[0] ? "," : "", "zerolatency");
}
@@ -2752,7 +2749,7 @@ void ghb_set_video_encoder_opts(hb_dict_t *dict, GhbValue *js)
case HB_VCODEC_FFMPEG_VP8:
{
const char *opts;
- opts = ghb_settings_get_const_string(js, "VideoOptionExtra");
+ opts = ghb_dict_get_string(js, "VideoOptionExtra");
if (opts != NULL && opts[0])
{
hb_dict_set(dict, "Options", hb_value_string(opts));
@@ -3104,15 +3101,21 @@ ghb_lookup_audio_bitrate_rate(const char *name)
int
ghb_settings_audio_bitrate_rate(const GhbValue *settings, const char *name)
{
- const char *rate_id = ghb_settings_get_const_string(settings, name);
- return ghb_lookup_audio_bitrate_rate(rate_id);
+ int result;
+ char *rate_id = ghb_dict_get_string_xform(settings, name);
+ result = ghb_lookup_audio_bitrate_rate(rate_id);
+ g_free(rate_id);
+ return result;
}
const hb_rate_t*
ghb_settings_audio_bitrate(const GhbValue *settings, const char *name)
{
- const char *rate_id = ghb_settings_get_const_string(settings, name);
- return ghb_lookup_audio_bitrate(rate_id);
+ const hb_rate_t *result;
+ char *rate_id = ghb_dict_get_string_xform(settings, name);
+ result = ghb_lookup_audio_bitrate(rate_id);
+ g_free(rate_id);
+ return result;
}
static ghb_status_t hb_status;
@@ -3390,8 +3393,8 @@ ghb_picture_settings_deps(signal_user_data_t *ud)
pic_par = ghb_settings_combo_int(ud->settings, "PicturePAR");
enable_keep_aspect = (pic_par != HB_ANAMORPHIC_STRICT &&
pic_par != HB_ANAMORPHIC_LOOSE);
- keep_aspect = ghb_settings_get_boolean(ud->settings, "PictureKeepRatio");
- autoscale = ghb_settings_get_boolean(ud->settings, "autoscale");
+ keep_aspect = ghb_dict_get_bool(ud->settings, "PictureKeepRatio");
+ autoscale = ghb_dict_get_bool(ud->settings, "autoscale");
enable_scale_width = enable_scale_height =
!autoscale && (pic_par != HB_ANAMORPHIC_STRICT);
@@ -3461,19 +3464,19 @@ ghb_set_scale_settings(GhbValue *settings, gint mode)
pic_par = ghb_settings_combo_int(settings, "PicturePAR");
if (pic_par == HB_ANAMORPHIC_STRICT)
{
- ghb_settings_set_boolean(settings, "autoscale", TRUE);
- ghb_settings_set_int(settings, "PictureModulus", 2);
- ghb_settings_set_boolean(settings, "PictureLooseCrop", TRUE);
+ ghb_dict_set_bool(settings, "autoscale", TRUE);
+ ghb_dict_set_int(settings, "PictureModulus", 2);
+ ghb_dict_set_bool(settings, "PictureLooseCrop", TRUE);
}
if (pic_par == HB_ANAMORPHIC_STRICT || pic_par == HB_ANAMORPHIC_LOOSE)
{
- ghb_settings_set_boolean(settings, "PictureKeepRatio", TRUE);
+ ghb_dict_set_bool(settings, "PictureKeepRatio", TRUE);
}
int title_id, titleindex;
const hb_title_t * title;
- title_id = ghb_settings_get_int(settings, "title");
+ title_id = ghb_dict_get_int(settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
if (title == NULL) return;
@@ -3488,12 +3491,12 @@ ghb_set_scale_settings(GhbValue *settings, gint mode)
mod = ghb_settings_combo_int(settings, "PictureModulus");
if (mod <= 0)
mod = 16;
- keep_aspect = ghb_settings_get_boolean(settings, "PictureKeepRatio");
- autocrop = ghb_settings_get_boolean(settings, "PictureAutoCrop");
- autoscale = ghb_settings_get_boolean(settings, "autoscale");
+ keep_aspect = ghb_dict_get_bool(settings, "PictureKeepRatio");
+ autocrop = ghb_dict_get_bool(settings, "PictureAutoCrop");
+ autoscale = ghb_dict_get_bool(settings, "autoscale");
// "PictureLooseCrop" is a flag that says we prefer to crop extra to
// satisfy alignment constraints rather than scaling to satisfy them.
- loosecrop = ghb_settings_get_boolean(settings, "PictureLooseCrop");
+ loosecrop = ghb_dict_get_bool(settings, "PictureLooseCrop");
// Align dimensions to either 16 or 2 pixels
// The scaler crashes if the dimensions are not divisible by 2
// x264 also will not accept dims that are not multiple of 2
@@ -3509,17 +3512,17 @@ ghb_set_scale_settings(GhbValue *settings, gint mode)
crop[1] = title->crop[1];
crop[2] = title->crop[2];
crop[3] = title->crop[3];
- ghb_settings_set_int(settings, "PictureTopCrop", crop[0]);
- ghb_settings_set_int(settings, "PictureBottomCrop", crop[1]);
- ghb_settings_set_int(settings, "PictureLeftCrop", crop[2]);
- ghb_settings_set_int(settings, "PictureRightCrop", crop[3]);
+ ghb_dict_set_int(settings, "PictureTopCrop", crop[0]);
+ ghb_dict_set_int(settings, "PictureBottomCrop", crop[1]);
+ ghb_dict_set_int(settings, "PictureLeftCrop", crop[2]);
+ ghb_dict_set_int(settings, "PictureRightCrop", crop[3]);
}
else
{
- crop[0] = ghb_settings_get_int(settings, "PictureTopCrop");
- crop[1] = ghb_settings_get_int(settings, "PictureBottomCrop");
- crop[2] = ghb_settings_get_int(settings, "PictureLeftCrop");
- crop[3] = ghb_settings_get_int(settings, "PictureRightCrop");
+ crop[0] = ghb_dict_get_int(settings, "PictureTopCrop");
+ crop[1] = ghb_dict_get_int(settings, "PictureBottomCrop");
+ crop[2] = ghb_dict_get_int(settings, "PictureLeftCrop");
+ crop[3] = ghb_dict_get_int(settings, "PictureRightCrop");
// Prevent manual crop from creating too small an image
if (title->geometry.height - crop[0] < crop[1] + 16)
{
@@ -3548,10 +3551,10 @@ ghb_set_scale_settings(GhbValue *settings, gint mode)
need2 = crop_width - width - need1;
crop[2] += need1;
crop[3] += need2;
- ghb_settings_set_int(settings, "PictureTopCrop", crop[0]);
- ghb_settings_set_int(settings, "PictureBottomCrop", crop[1]);
- ghb_settings_set_int(settings, "PictureLeftCrop", crop[2]);
- ghb_settings_set_int(settings, "PictureRightCrop", crop[3]);
+ ghb_dict_set_int(settings, "PictureTopCrop", crop[0]);
+ ghb_dict_set_int(settings, "PictureBottomCrop", crop[1]);
+ ghb_dict_set_int(settings, "PictureLeftCrop", crop[2]);
+ ghb_dict_set_int(settings, "PictureRightCrop", crop[3]);
}
uiGeo.crop[0] = crop[0];
uiGeo.crop[1] = crop[1];
@@ -3567,14 +3570,14 @@ ghb_set_scale_settings(GhbValue *settings, gint mode)
}
else
{
- width = ghb_settings_get_int(settings, "scale_width");
- height = ghb_settings_get_int(settings, "scale_height");
+ width = ghb_dict_get_int(settings, "scale_width");
+ height = ghb_dict_get_int(settings, "scale_height");
if (mode & GHB_PIC_USE_MAX)
{
max_width = MOD_DOWN(
- ghb_settings_get_int(settings, "PictureWidth"), mod);
+ ghb_dict_get_int(settings, "PictureWidth"), mod);
max_height = MOD_DOWN(
- ghb_settings_get_int(settings, "PictureHeight"), mod);
+ ghb_dict_get_int(settings, "PictureHeight"), mod);
}
}
g_debug("max_width %d, max_height %d\n", max_width, max_height);
@@ -3609,15 +3612,15 @@ ghb_set_scale_settings(GhbValue *settings, gint mode)
if (mode & GHB_PIC_KEEP_PAR)
{
uiGeo.geometry.par.num =
- ghb_settings_get_int(settings, "PicturePARWidth");
+ ghb_dict_get_int(settings, "PicturePARWidth");
uiGeo.geometry.par.den =
- ghb_settings_get_int(settings, "PicturePARHeight");
+ ghb_dict_get_int(settings, "PicturePARHeight");
}
else if (mode & (GHB_PIC_KEEP_DISPLAY_HEIGHT |
GHB_PIC_KEEP_DISPLAY_WIDTH))
{
uiGeo.geometry.par.num =
- ghb_settings_get_int(settings, "PictureDisplayWidth");
+ ghb_dict_get_int(settings, "PictureDisplayWidth");
uiGeo.geometry.par.den = width;
}
}
@@ -3631,18 +3634,18 @@ ghb_set_scale_settings(GhbValue *settings, gint mode)
// maxWidth and maxHeight
hb_set_anamorphic_size2(&srcGeo, &uiGeo, &resultGeo);
- ghb_settings_set_int(settings, "scale_width", resultGeo.width);
- ghb_settings_set_int(settings, "scale_height", resultGeo.height);
+ ghb_dict_set_int(settings, "scale_width", resultGeo.width);
+ ghb_dict_set_int(settings, "scale_height", resultGeo.height);
gint disp_width;
disp_width = ((gdouble)resultGeo.par.num / resultGeo.par.den) *
resultGeo.width + 0.5;
- ghb_settings_set_int(settings, "PicturePARWidth", resultGeo.par.num);
- ghb_settings_set_int(settings, "PicturePARHeight", resultGeo.par.den);
- ghb_settings_set_int(settings, "PictureDisplayWidth", disp_width);
- ghb_settings_set_int(settings, "PictureDisplayHeight", resultGeo.height);
+ ghb_dict_set_int(settings, "PicturePARWidth", resultGeo.par.num);
+ ghb_dict_set_int(settings, "PicturePARHeight", resultGeo.par.den);
+ ghb_dict_set_int(settings, "PictureDisplayWidth", disp_width);
+ ghb_dict_set_int(settings, "PictureDisplayHeight", resultGeo.height);
}
void
@@ -3651,8 +3654,8 @@ ghb_update_display_aspect_label(signal_user_data_t *ud)
gint disp_width, disp_height, dar_width, dar_height;
gchar *str;
- disp_width = ghb_settings_get_int(ud->settings, "PictureDisplayWidth");
- disp_height = ghb_settings_get_int(ud->settings, "PictureDisplayHeight");
+ disp_width = ghb_dict_get_int(ud->settings, "PictureDisplayWidth");
+ disp_height = ghb_dict_get_int(ud->settings, "PictureDisplayHeight");
hb_reduce(&dar_width, &dar_height, disp_width, disp_height);
gint iaspect = dar_width * 9 / dar_height;
if (dar_width > 2 * dar_height)
@@ -3695,7 +3698,7 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
// "PictureLooseCrop" is a flag that says we prefer to crop extra to
// satisfy alignment constraints rather than scaling to satisfy them.
- gboolean loosecrop = ghb_settings_get_boolean(ud->settings, "PictureLooseCrop");
+ gboolean loosecrop = ghb_dict_get_bool(ud->settings, "PictureLooseCrop");
if (loosecrop)
{
widget = GHB_WIDGET (ud->builder, "PictureTopCrop");
@@ -3749,22 +3752,22 @@ get_preview_geometry(signal_user_data_t *ud, const hb_title_t *title,
srcGeo->par = title->geometry.par;
uiGeo->mode = ghb_settings_combo_int(ud->settings, "PicturePAR");
- uiGeo->keep = ghb_settings_get_boolean(ud->settings, "PictureKeepRatio") ||
+ uiGeo->keep = ghb_dict_get_bool(ud->settings, "PictureKeepRatio") ||
uiGeo->mode == HB_ANAMORPHIC_STRICT ||
uiGeo->mode == HB_ANAMORPHIC_LOOSE;
uiGeo->itu_par = 0;
uiGeo->modulus = ghb_settings_combo_int(ud->settings, "PictureModulus");
- uiGeo->crop[0] = ghb_settings_get_int(ud->settings, "PictureTopCrop");
- uiGeo->crop[1] = ghb_settings_get_int(ud->settings, "PictureBottomCrop");
- uiGeo->crop[2] = ghb_settings_get_int(ud->settings, "PictureLeftCrop");
- uiGeo->crop[3] = ghb_settings_get_int(ud->settings, "PictureRightCrop");
- uiGeo->geometry.width = ghb_settings_get_int(ud->settings, "scale_width");
- uiGeo->geometry.height = ghb_settings_get_int(ud->settings, "scale_height");
- uiGeo->geometry.par.num = ghb_settings_get_int(ud->settings, "PicturePARWidth");
- uiGeo->geometry.par.den = ghb_settings_get_int(ud->settings, "PicturePARHeight");
+ uiGeo->crop[0] = ghb_dict_get_int(ud->settings, "PictureTopCrop");
+ uiGeo->crop[1] = ghb_dict_get_int(ud->settings, "PictureBottomCrop");
+ uiGeo->crop[2] = ghb_dict_get_int(ud->settings, "PictureLeftCrop");
+ uiGeo->crop[3] = ghb_dict_get_int(ud->settings, "PictureRightCrop");
+ uiGeo->geometry.width = ghb_dict_get_int(ud->settings, "scale_width");
+ uiGeo->geometry.height = ghb_dict_get_int(ud->settings, "scale_height");
+ uiGeo->geometry.par.num = ghb_dict_get_int(ud->settings, "PicturePARWidth");
+ uiGeo->geometry.par.den = ghb_dict_get_int(ud->settings, "PicturePARHeight");
uiGeo->maxWidth = 0;
uiGeo->maxHeight = 0;
- if (ghb_settings_get_boolean(ud->prefs, "preview_show_crop"))
+ if (ghb_dict_get_bool(ud->prefs, "preview_show_crop"))
{
gdouble xscale = (gdouble)uiGeo->geometry.width /
(title->geometry.width - uiGeo->crop[2] - uiGeo->crop[3]);
@@ -3811,64 +3814,55 @@ ghb_validate_filter_string(const gchar *str, gint max_fields)
gboolean
ghb_validate_filters(GhbValue *settings, GtkWindow *parent)
{
- gchar *str;
+ const gchar *str;
gint index;
gchar *message;
- gboolean decomb_deint = ghb_settings_get_boolean(settings, "PictureDecombDeinterlace");
+ gboolean decomb_deint = ghb_dict_get_bool(settings, "PictureDecombDeinterlace");
// deinte
index = ghb_settings_combo_int(settings, "PictureDeinterlace");
if (!decomb_deint && index == 1)
{
- str = ghb_settings_get_string(settings, "PictureDeinterlaceCustom");
+ str = ghb_dict_get_string(settings, "PictureDeinterlaceCustom");
if (!ghb_validate_filter_string(str, -1))
{
message = g_strdup_printf(
- _("Invalid Deinterlace Settings:\n\n%s\n"),
- str);
+ _("Invalid Deinterlace Settings:\n\n%s\n"), str);
ghb_message_dialog(parent, GTK_MESSAGE_ERROR,
message, _("Cancel"), NULL);
g_free(message);
- g_free(str);
return FALSE;
}
- g_free(str);
}
// detel
index = ghb_settings_combo_int(settings, "PictureDetelecine");
if (index == 1)
{
- str = ghb_settings_get_string(settings, "PictureDetelecineCustom");
+ str = ghb_dict_get_string(settings, "PictureDetelecineCustom");
if (!ghb_validate_filter_string(str, -1))
{
message = g_strdup_printf(
- _("Invalid Detelecine Settings:\n\n%s\n"),
- str);
+ _("Invalid Detelecine Settings:\n\n%s\n"), str);
ghb_message_dialog(parent, GTK_MESSAGE_ERROR,
message, _("Cancel"), NULL);
g_free(message);
- g_free(str);
return FALSE;
}
- g_free(str);
}
// decomb
index = ghb_settings_combo_int(settings, "PictureDecomb");
if (decomb_deint && index == 1)
{
- str = ghb_settings_get_string(settings, "PictureDecombCustom");
+ str = ghb_dict_get_string(settings, "PictureDecombCustom");
if (!ghb_validate_filter_string(str, -1))
{
message = g_strdup_printf(
- _("Invalid Decomb Settings:\n\n%s\n"),
- str);
+ _("Invalid Decomb Settings:\n\n%s\n"), str);
ghb_message_dialog(parent, GTK_MESSAGE_ERROR,
message, _("Cancel"), NULL);
g_free(message);
- g_free(str);
return FALSE;
}
- g_free(str);
}
// denoise
// TODO
@@ -3883,7 +3877,7 @@ ghb_validate_video(GhbValue *settings, GtkWindow *parent)
const char *mux_id;
const hb_container_t *mux;
- mux_id = ghb_settings_get_const_string(settings, "FileFormat");
+ mux_id = ghb_dict_get_string(settings, "FileFormat");
mux = ghb_lookup_container_by_name(mux_id);
vcodec = ghb_settings_video_encoder_codec(settings, "VideoEncoder");
@@ -3902,7 +3896,7 @@ ghb_validate_video(GhbValue *settings, GtkWindow *parent)
}
g_free(message);
vcodec = hb_video_encoder_get_default(mux->format);
- ghb_settings_set_string(settings, "VideoEncoder",
+ ghb_dict_set_string(settings, "VideoEncoder",
hb_video_encoder_get_short_name(vcodec));
}
return TRUE;
@@ -3915,7 +3909,7 @@ ghb_validate_subtitles(GhbValue *settings, GtkWindow *parent)
const hb_title_t * title;
gchar *message;
- title_id = ghb_settings_get_int(settings, "title");
+ title_id = ghb_dict_get_int(settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
if (title == NULL)
{
@@ -3928,15 +3922,15 @@ ghb_validate_subtitles(GhbValue *settings, GtkWindow *parent)
gint count, ii, source, track;
gboolean burned, one_burned = FALSE;
- slist = ghb_settings_get_value(settings, "subtitle_list");
+ slist = ghb_dict_get_value(settings, "subtitle_list");
count = ghb_array_len(slist);
for (ii = 0; ii < count; ii++)
{
subtitle = ghb_array_get(slist, ii);
- track = ghb_settings_get_int(subtitle, "SubtitleTrack");
- source = ghb_settings_get_int(subtitle, "SubtitleSource");
+ track = ghb_dict_get_int(subtitle, "SubtitleTrack");
+ source = ghb_dict_get_int(subtitle, "SubtitleSource");
burned = track != -1 &&
- ghb_settings_get_boolean(subtitle, "SubtitleBurned");
+ ghb_dict_get_bool(subtitle, "SubtitleBurned");
if (burned && one_burned)
{
// MP4 can only handle burned vobsubs. make sure there isn't
@@ -3960,9 +3954,9 @@ ghb_validate_subtitles(GhbValue *settings, GtkWindow *parent)
}
if (source == SRTSUB)
{
- gchar *filename;
+ const gchar *filename;
- filename = ghb_settings_get_string(subtitle, "SrtFile");
+ filename = ghb_dict_get_string(subtitle, "SrtFile");
if (!g_file_test(filename, G_FILE_TEST_IS_REGULAR))
{
message = g_strdup_printf(
@@ -3990,7 +3984,7 @@ ghb_validate_audio(GhbValue *settings, GtkWindow *parent)
const hb_title_t * title;
gchar *message;
- title_id = ghb_settings_get_int(settings, "title");
+ title_id = ghb_dict_get_int(settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
if (title == NULL)
{
@@ -4002,13 +3996,13 @@ ghb_validate_audio(GhbValue *settings, GtkWindow *parent)
const char *mux_id;
const hb_container_t *mux;
- mux_id = ghb_settings_get_const_string(settings, "FileFormat");
+ mux_id = ghb_dict_get_string(settings, "FileFormat");
mux = ghb_lookup_container_by_name(mux_id);
const GhbValue *audio_list;
gint count, ii;
- audio_list = ghb_settings_get_value(settings, "audio_list");
+ audio_list = ghb_dict_get_value(settings, "audio_list");
count = ghb_array_len(audio_list);
for (ii = 0; ii < count; ii++)
{
@@ -4017,7 +4011,7 @@ ghb_validate_audio(GhbValue *settings, GtkWindow *parent)
int track, codec;
asettings = ghb_array_get(audio_list, ii);
- track = ghb_settings_get_int(asettings, "AudioTrack");
+ track = ghb_dict_get_int(asettings, "AudioTrack");
codec = ghb_settings_audio_encoder_codec(asettings, "AudioEncoder");
if (codec == HB_ACODEC_AUTO_PASS)
continue;
@@ -4054,7 +4048,7 @@ ghb_validate_audio(GhbValue *settings, GtkWindow *parent)
codec = HB_ACODEC_FFAAC;
}
const char *name = hb_audio_encoder_get_short_name(codec);
- ghb_settings_set_string(asettings, "AudioEncoder", name);
+ ghb_dict_set_string(asettings, "AudioEncoder", name);
}
gchar *a_unsup = NULL;
gchar *mux_s = NULL;
@@ -4082,7 +4076,7 @@ ghb_validate_audio(GhbValue *settings, GtkWindow *parent)
}
g_free(message);
const char *name = hb_audio_encoder_get_short_name(codec);
- ghb_settings_set_string(asettings, "AudioEncoder", name);
+ ghb_dict_set_string(asettings, "AudioEncoder", name);
}
const hb_mixdown_t *mix;
@@ -4107,7 +4101,7 @@ ghb_validate_audio(GhbValue *settings, GtkWindow *parent)
}
g_free(message);
int amixdown = ghb_get_best_mix(aconfig, codec, mix->amixdown);
- ghb_settings_set_string(asettings, "AudioMixdown",
+ ghb_dict_set_string(asettings, "AudioMixdown",
hb_mixdown_get_short_name(amixdown));
}
}
@@ -4128,65 +4122,65 @@ add_job(hb_handle_t *h, GhbValue *js, gint unique_id)
const hb_container_t *mux;
int mux_id;
- mux_name = ghb_settings_get_const_string(js, "FileFormat");
+ mux_name = ghb_dict_get_string(js, "FileFormat");
mux = ghb_lookup_container_by_name(mux_name);
mux_id = mux->format;
int p_to_p = -1, seek_points, chapter_markers = 0;
int64_t range_start, range_stop;
- range_start = ghb_settings_get_int(js, "start_frame") + 1;
+ range_start = ghb_dict_get_int(js, "start_frame") + 1;
if (range_start)
{
- GhbValue *prefs = ghb_settings_get_value(js, "Preferences");
- seek_points = ghb_settings_get_int(prefs, "preview_count");
- range_stop = ghb_settings_get_int(prefs, "live_duration") * 90000LL;
+ GhbValue *prefs = ghb_dict_get_value(js, "Preferences");
+ seek_points = ghb_dict_get_int(prefs, "preview_count");
+ range_stop = ghb_dict_get_int(prefs, "live_duration") * 90000LL;
}
else
{
- chapter_markers = ghb_settings_get_boolean(js, "ChapterMarkers");
+ chapter_markers = ghb_dict_get_bool(js, "ChapterMarkers");
p_to_p = ghb_settings_combo_int(js, "PtoPType");
switch (p_to_p)
{
default:
case 0: // Chapter range
{
- range_start = ghb_settings_get_int(js, "start_point");
- range_stop = ghb_settings_get_int(js, "end_point");
+ range_start = ghb_dict_get_int(js, "start_point");
+ range_stop = ghb_dict_get_int(js, "end_point");
if (range_start == range_stop)
chapter_markers = 0;
} break;
case 1: // PTS range
{
double start, end;
- start = ghb_settings_get_double(js, "start_point");
- end = ghb_settings_get_double(js, "end_point");
+ start = ghb_dict_get_double(js, "start_point");
+ end = ghb_dict_get_double(js, "end_point");
range_start = (int64_t)start * 90000;
range_stop = (int64_t)end * 90000 - range_start;
} break;
case 2: // Frame range
{
- range_start = ghb_settings_get_int(js, "start_point") - 1;
- range_stop = ghb_settings_get_int(js, "end_point") - 1 -
+ range_start = ghb_dict_get_int(js, "start_point") - 1;
+ range_stop = ghb_dict_get_int(js, "end_point") - 1 -
range_start;
} break;
}
}
- const char *path = ghb_settings_get_const_string(js, "source");
- int title_id = ghb_settings_get_int(js, "title");
+ const char *path = ghb_dict_get_string(js, "source");
+ int title_id = ghb_dict_get_int(js, "title");
- int angle = ghb_settings_get_int(js, "angle");
+ int angle = ghb_dict_get_int(js, "angle");
hb_rational_t par;
- par.num = ghb_settings_get_int(js, "PicturePARWidth");
- par.den = ghb_settings_get_int(js, "PicturePARHeight");
+ par.num = ghb_dict_get_int(js, "PicturePARWidth");
+ par.den = ghb_dict_get_int(js, "PicturePARHeight");
int vcodec, acodec_copy_mask, acodec_fallback, grayscale;
vcodec = ghb_settings_video_encoder_codec(js, "VideoEncoder");
acodec_copy_mask = ghb_get_copy_mask(js);
acodec_fallback = ghb_settings_audio_encoder_codec(js, "AudioEncoderFallback");
- grayscale = ghb_settings_get_boolean(js, "VideoGrayScale");
+ grayscale = ghb_dict_get_bool(js, "VideoGrayScale");
dict = json_pack_ex(&error, 0,
"{"
@@ -4240,7 +4234,7 @@ add_job(hb_handle_t *h, GhbValue *js, gint unique_id)
g_warning("json pack job failure: %s", error.text);
return;
}
- const char *dest = ghb_settings_get_const_string(js, "destination");
+ const char *dest = ghb_dict_get_string(js, "destination");
hb_dict_t *dest_dict = hb_dict_get(dict, "Destination");
if (dest != NULL)
{
@@ -4249,10 +4243,10 @@ add_job(hb_handle_t *h, GhbValue *js, gint unique_id)
if (mux_id & HB_MUX_MASK_MP4)
{
int mp4_optimize, ipod_atom = 0;
- mp4_optimize = ghb_settings_get_boolean(js, "Mp4HttpOptimize");
+ mp4_optimize = ghb_dict_get_bool(js, "Mp4HttpOptimize");
if (vcodec == HB_VCODEC_X264)
{
- ipod_atom = ghb_settings_get_boolean(js, "Mp4iPodCompatible");
+ ipod_atom = ghb_dict_get_bool(js, "Mp4iPodCompatible");
}
hb_dict_t *mp4_dict;
mp4_dict = json_pack_ex(&error, 0, "{s:o, s:o}",
@@ -4319,17 +4313,17 @@ add_job(hb_handle_t *h, GhbValue *js, gint unique_id)
hb_dict_set(source_dict, "Range", range_dict);
hb_dict_t *video_dict = hb_dict_get(dict, "Video");
- if (ghb_settings_get_boolean(js, "vquality_type_constant"))
+ if (ghb_dict_get_bool(js, "vquality_type_constant"))
{
- double vquality = ghb_settings_get_double(js, "VideoQualitySlider");
+ double vquality = ghb_dict_get_double(js, "VideoQualitySlider");
hb_dict_set(video_dict, "Quality", hb_value_double(vquality));
}
- else if (ghb_settings_get_boolean(js, "vquality_type_bitrate"))
+ else if (ghb_dict_get_bool(js, "vquality_type_bitrate"))
{
int vbitrate, twopass, fastfirstpass;
- vbitrate = ghb_settings_get_int(js, "VideoAvgBitrate");
- twopass = ghb_settings_get_boolean(js, "VideoTwoPass");
- fastfirstpass = ghb_settings_get_boolean(js, "VideoTurboTwoPass");
+ vbitrate = ghb_dict_get_int(js, "VideoAvgBitrate");
+ twopass = ghb_dict_get_bool(js, "VideoTwoPass");
+ fastfirstpass = ghb_dict_get_bool(js, "VideoTurboTwoPass");
hb_dict_set(video_dict, "Bitrate", hb_value_int(vbitrate));
hb_dict_set(video_dict, "TwoPass", hb_value_bool(twopass));
hb_dict_set(video_dict, "Turbo", hb_value_bool(fastfirstpass));
@@ -4339,42 +4333,42 @@ add_job(hb_handle_t *h, GhbValue *js, gint unique_id)
hb_dict_t *meta_dict = hb_dict_get(dict, "MetaData");
const char * meta;
- meta = ghb_settings_get_const_string(js, "MetaName");
+ meta = ghb_dict_get_string(js, "MetaName");
if (meta && *meta)
{
hb_dict_set(meta_dict, "Name", hb_value_string(meta));
}
- meta = ghb_settings_get_const_string(js, "MetaArtist");
+ meta = ghb_dict_get_string(js, "MetaArtist");
if (meta && *meta)
{
hb_dict_set(meta_dict, "Artist", hb_value_string(meta));
}
- meta = ghb_settings_get_const_string(js, "MetaAlbumArtist");
+ meta = ghb_dict_get_string(js, "MetaAlbumArtist");
if (meta && *meta)
{
hb_dict_set(meta_dict, "AlbumArtist", hb_value_string(meta));
}
- meta = ghb_settings_get_const_string(js, "MetaReleaseDate");
+ meta = ghb_dict_get_string(js, "MetaReleaseDate");
if (meta && *meta)
{
hb_dict_set(meta_dict, "ReleaseDate", hb_value_string(meta));
}
- meta = ghb_settings_get_const_string(js, "MetaComment");
+ meta = ghb_dict_get_string(js, "MetaComment");
if (meta && *meta)
{
hb_dict_set(meta_dict, "Comment", hb_value_string(meta));
}
- meta = ghb_settings_get_const_string(js, "MetaGenre");
+ meta = ghb_dict_get_string(js, "MetaGenre");
if (meta && *meta)
{
hb_dict_set(meta_dict, "Genre", hb_value_string(meta));
}
- meta = ghb_settings_get_const_string(js, "MetaDescription");
+ meta = ghb_dict_get_string(js, "MetaDescription");
if (meta && *meta)
{
hb_dict_set(meta_dict, "Description", hb_value_string(meta));
}
- meta = ghb_settings_get_const_string(js, "MetaLongDescription");
+ meta = ghb_dict_get_string(js, "MetaLongDescription");
if (meta && *meta)
{
hb_dict_set(meta_dict, "LongDescription", hb_value_string(meta));
@@ -4389,7 +4383,7 @@ add_job(hb_handle_t *h, GhbValue *js, gint unique_id)
gint chap;
gint count;
- chapters = ghb_settings_get_value(js, "chapter_list");
+ chapters = ghb_dict_get_value(js, "chapter_list");
count = ghb_array_len(chapters);
for(chap = 0; chap < count; chap++)
{
@@ -4423,13 +4417,13 @@ add_job(hb_handle_t *h, GhbValue *js, gint unique_id)
// Crop scale filter
int width, height, crop[4];
- width = ghb_settings_get_int(js, "scale_width");
- height = ghb_settings_get_int(js, "scale_height");
+ width = ghb_dict_get_int(js, "scale_width");
+ height = ghb_dict_get_int(js, "scale_height");
- crop[0] = ghb_settings_get_int(js, "PictureTopCrop");
- crop[1] = ghb_settings_get_int(js, "PictureBottomCrop");
- crop[2] = ghb_settings_get_int(js, "PictureLeftCrop");
- crop[3] = ghb_settings_get_int(js, "PictureRightCrop");
+ crop[0] = ghb_dict_get_int(js, "PictureTopCrop");
+ crop[1] = ghb_dict_get_int(js, "PictureBottomCrop");
+ crop[2] = ghb_dict_get_int(js, "PictureLeftCrop");
+ crop[3] = ghb_dict_get_int(js, "PictureRightCrop");
filter_str = g_strdup_printf("%d:%d:%d:%d:%d:%d",
width, height, crop[0], crop[1], crop[2], crop[3]);
@@ -4456,7 +4450,7 @@ add_job(hb_handle_t *h, GhbValue *js, gint unique_id)
}
else
{
- filter_str = ghb_settings_get_const_string(js, "PictureDetelecineCustom");
+ filter_str = ghb_dict_get_string(js, "PictureDetelecineCustom");
}
filter_dict = json_pack_ex(&error, 0, "{s:o}",
"ID", hb_value_int(HB_FILTER_DETELECINE));
@@ -4475,7 +4469,7 @@ add_job(hb_handle_t *h, GhbValue *js, gint unique_id)
// Decomb filter
gboolean decomb_deint;
gint decomb, deint;
- decomb_deint = ghb_settings_get_boolean(js, "PictureDecombDeinterlace");
+ decomb_deint = ghb_dict_get_bool(js, "PictureDecombDeinterlace");
decomb = ghb_settings_combo_int(js, "PictureDecomb");
deint = ghb_settings_combo_int(js, "PictureDeinterlace");
if (decomb_deint && decomb)
@@ -4488,7 +4482,7 @@ add_job(hb_handle_t *h, GhbValue *js, gint unique_id)
}
else
{
- filter_str = ghb_settings_get_const_string(js, "PictureDecombCustom");
+ filter_str = ghb_dict_get_string(js, "PictureDecombCustom");
}
filter_dict = json_pack_ex(&error, 0, "{s:o}",
"ID", hb_value_int(HB_FILTER_DECOMB));
@@ -4515,7 +4509,7 @@ add_job(hb_handle_t *h, GhbValue *js, gint unique_id)
}
else
{
- filter_str = ghb_settings_get_const_string(js, "PictureDeinterlaceCustom");
+ filter_str = ghb_dict_get_string(js, "PictureDeinterlaceCustom");
}
filter_dict = json_pack_ex(&error, 0, "{s:o}",
"ID", hb_value_int(HB_FILTER_DEINTERLACE));
@@ -4532,16 +4526,16 @@ add_job(hb_handle_t *h, GhbValue *js, gint unique_id)
}
// Denoise filter
- if (strcmp(ghb_settings_get_const_string(js, "PictureDenoiseFilter"), "off"))
+ if (strcmp(ghb_dict_get_string(js, "PictureDenoiseFilter"), "off"))
{
int filter_id = HB_FILTER_HQDN3D;
- if (!strcmp(ghb_settings_get_const_string(js, "PictureDenoiseFilter"), "nlmeans"))
+ if (!strcmp(ghb_dict_get_string(js, "PictureDenoiseFilter"), "nlmeans"))
filter_id = HB_FILTER_NLMEANS;
- if (!strcmp(ghb_settings_get_const_string(js, "PictureDenoisePreset"), "custom"))
+ if (!strcmp(ghb_dict_get_string(js, "PictureDenoisePreset"), "custom"))
{
const char *filter_str;
- filter_str = ghb_settings_get_const_string(js, "PictureDenoiseCustom");
+ filter_str = ghb_dict_get_string(js, "PictureDenoiseCustom");
filter_dict = json_pack_ex(&error, 0, "{s:o, s:o}",
"ID", hb_value_int(filter_id),
"Settings", hb_value_string(filter_str));
@@ -4555,8 +4549,8 @@ add_job(hb_handle_t *h, GhbValue *js, gint unique_id)
else
{
const char *preset, *tune;
- preset = ghb_settings_get_const_string(js, "PictureDenoisePreset");
- tune = ghb_settings_get_const_string(js, "PictureDenoiseTune");
+ preset = ghb_dict_get_string(js, "PictureDenoisePreset");
+ tune = ghb_dict_get_string(js, "PictureDenoiseTune");
filter_str = hb_generate_filter_settings(filter_id, preset, tune);
filter_dict = json_pack_ex(&error, 0, "{s:o, s:o}",
"ID", hb_value_int(filter_id),
@@ -4572,7 +4566,7 @@ add_job(hb_handle_t *h, GhbValue *js, gint unique_id)
}
// Deblock filter
- gint deblock = ghb_settings_get_int(js, "PictureDeblock");
+ gint deblock = ghb_dict_get_int(js, "PictureDeblock");
if( deblock >= 5 )
{
filter_str = g_strdup_printf("%d", deblock);
@@ -4591,15 +4585,15 @@ add_job(hb_handle_t *h, GhbValue *js, gint unique_id)
// VFR filter
gint vrate_den = ghb_settings_video_framerate_rate(js, "VideoFramerate");
gint cfr;
- if (ghb_settings_get_boolean(js, "VideoFrameratePFR"))
+ if (ghb_dict_get_bool(js, "VideoFrameratePFR"))
cfr = 2;
- else if (ghb_settings_get_boolean(js, "VideoFramerateCFR"))
+ else if (ghb_dict_get_bool(js, "VideoFramerateCFR"))
cfr = 1;
else
cfr = 0;
// x264 zero latency requires CFR encode
- if (ghb_settings_get_boolean(js, "x264ZeroLatency"))
+ if (ghb_dict_get_bool(js, "x264ZeroLatency"))
{
cfr = 1;
ghb_log("zerolatency x264 tune selected, forcing constant framerate");
@@ -4629,7 +4623,7 @@ add_job(hb_handle_t *h, GhbValue *js, gint unique_id)
hb_value_array_t *json_audio_list = hb_dict_get(audios_dict, "AudioList");
const GhbValue *audio_list;
- audio_list = ghb_settings_get_value(js, "audio_list");
+ audio_list = ghb_dict_get_value(js, "audio_list");
count = ghb_array_len(audio_list);
for (ii = 0; ii < count; ii++)
{
@@ -4640,8 +4634,8 @@ add_job(hb_handle_t *h, GhbValue *js, gint unique_id)
double gain, drc, quality;
asettings = ghb_array_get(audio_list, ii);
- track = ghb_settings_get_int(asettings, "AudioTrack");
- aname = ghb_settings_get_const_string(asettings, "AudioTrackName");
+ track = ghb_dict_get_int(asettings, "AudioTrack");
+ aname = ghb_dict_get_string(asettings, "AudioTrackName");
acodec = ghb_settings_audio_encoder_codec(asettings, "AudioEncoder");
audio_dict = json_pack_ex(&error, 0,
"{s:o, s:o}",
@@ -4660,10 +4654,10 @@ add_job(hb_handle_t *h, GhbValue *js, gint unique_id)
// It would be better if this were done in libhb for us, but its not yet.
if (!ghb_audio_is_passthru(acodec))
{
- gain = ghb_settings_get_double(asettings, "AudioTrackGainSlider");
+ gain = ghb_dict_get_double(asettings, "AudioTrackGainSlider");
if (gain > 0)
hb_dict_set(audio_dict, "Gain", hb_value_double(gain));
- drc = ghb_settings_get_double(asettings, "AudioTrackDRCSlider");
+ drc = ghb_dict_get_double(asettings, "AudioTrackDRCSlider");
if (drc < 1.0)
drc = 0.0;
if (drc > 0)
@@ -4676,8 +4670,8 @@ add_job(hb_handle_t *h, GhbValue *js, gint unique_id)
asettings, "AudioSamplerate");
hb_dict_set(audio_dict, "Samplerate", hb_value_int(samplerate));
gboolean qe;
- qe = ghb_settings_get_boolean(asettings, "AudioTrackQualityEnable");
- quality = ghb_settings_get_double(asettings, "AudioTrackQuality");
+ qe = ghb_dict_get_bool(asettings, "AudioTrackQualityEnable");
+ quality = ghb_dict_get_double(asettings, "AudioTrackQuality");
if (qe && quality != HB_INVALID_AUDIO_QUALITY)
{
hb_dict_set(audio_dict, "Quality", hb_value_double(quality));
@@ -4700,7 +4694,7 @@ add_job(hb_handle_t *h, GhbValue *js, gint unique_id)
hb_value_array_t *json_subtitle_list = hb_dict_get(subtitles_dict, "SubtitleList");
const GhbValue *subtitle_list;
- subtitle_list = ghb_settings_get_value(js, "subtitle_list");
+ subtitle_list = ghb_dict_get_value(js, "subtitle_list");
count = ghb_array_len(subtitle_list);
for (ii = 0; ii < count; ii++)
{
@@ -4712,23 +4706,23 @@ add_job(hb_handle_t *h, GhbValue *js, gint unique_id)
ssettings = ghb_array_get(subtitle_list, ii);
- force = ghb_settings_get_boolean(ssettings, "SubtitleForced");
- burned = ghb_settings_get_boolean(ssettings, "SubtitleBurned");
- def = ghb_settings_get_boolean(ssettings, "SubtitleDefaultTrack");
- source = ghb_settings_get_int(ssettings, "SubtitleSource");
+ force = ghb_dict_get_bool(ssettings, "SubtitleForced");
+ burned = ghb_dict_get_bool(ssettings, "SubtitleBurned");
+ def = ghb_dict_get_bool(ssettings, "SubtitleDefaultTrack");
+ source = ghb_dict_get_int(ssettings, "SubtitleSource");
if (source == SRTSUB)
{
const gchar *filename, *lang, *code;
int offset;
- filename = ghb_settings_get_const_string(ssettings, "SrtFile");
+ filename = ghb_dict_get_string(ssettings, "SrtFile");
if (!g_file_test(filename, G_FILE_TEST_IS_REGULAR))
{
continue;
}
- offset = ghb_settings_get_int(ssettings, "SrtOffset");
- lang = ghb_settings_get_const_string(ssettings, "SrtLanguage");
- code = ghb_settings_get_const_string(ssettings, "SrtCodeset");
+ offset = ghb_dict_get_int(ssettings, "SrtOffset");
+ lang = ghb_dict_get_string(ssettings, "SrtLanguage");
+ code = ghb_dict_get_string(ssettings, "SrtCodeset");
if (burned && !one_burned && hb_subtitle_can_burn(SRTSUB))
{
// Only allow one subtitle to be burned into the video
@@ -4755,7 +4749,7 @@ add_job(hb_handle_t *h, GhbValue *js, gint unique_id)
hb_value_array_append(json_subtitle_list, subtitle_dict);
}
- track = ghb_settings_get_int(ssettings, "SubtitleTrack");
+ track = ghb_dict_get_int(ssettings, "SubtitleTrack");
if (track == -1)
{
hb_dict_t *search = hb_dict_get(subtitles_dict, "Search");
@@ -4990,7 +4984,7 @@ ghb_get_preview_image(
if( title == NULL ) return NULL;
gboolean deinterlace;
- if (ghb_settings_get_boolean(ud->settings, "PictureDecombDeinterlace"))
+ if (ghb_dict_get_bool(ud->settings, "PictureDecombDeinterlace"))
{
deinterlace = ghb_settings_combo_int(ud->settings, "PictureDecomb")
== 0 ? 0 : 1;
@@ -5056,15 +5050,15 @@ ghb_get_preview_image(
src_line += image->plane[0].stride;
dst += stride;
}
- gint w = ghb_settings_get_int(ud->settings, "scale_width");
- gint h = ghb_settings_get_int(ud->settings, "scale_height");
+ gint w = ghb_dict_get_int(ud->settings, "scale_width");
+ gint h = ghb_dict_get_int(ud->settings, "scale_height");
ghb_par_scale(ud, &w, &h, resultGeo.par.num, resultGeo.par.den);
gint c0, c1, c2, c3;
- c0 = ghb_settings_get_int(ud->settings, "PictureTopCrop");
- c1 = ghb_settings_get_int(ud->settings, "PictureBottomCrop");
- c2 = ghb_settings_get_int(ud->settings, "PictureLeftCrop");
- c3 = ghb_settings_get_int(ud->settings, "PictureRightCrop");
+ c0 = ghb_dict_get_int(ud->settings, "PictureTopCrop");
+ c1 = ghb_dict_get_int(ud->settings, "PictureBottomCrop");
+ c2 = ghb_dict_get_int(ud->settings, "PictureLeftCrop");
+ c3 = ghb_dict_get_int(ud->settings, "PictureRightCrop");
gdouble xscale = (gdouble)w / (gdouble)(title->geometry.width - c2 - c3);
gdouble yscale = (gdouble)h / (gdouble)(title->geometry.height - c0 - c1);
@@ -5076,13 +5070,13 @@ ghb_get_preview_image(
int previewHeight = image->height;
// If the preview is too large to fit the screen, reduce it's size.
- if (ghb_settings_get_boolean(ud->prefs, "reduce_hd_preview"))
+ if (ghb_dict_get_bool(ud->prefs, "reduce_hd_preview"))
{
GdkScreen *ss;
gint s_w, s_h;
gint factor = 80;
- if (ghb_settings_get_boolean(ud->prefs, "preview_fullscreen"))
+ if (ghb_dict_get_bool(ud->prefs, "preview_fullscreen"))
{
factor = 100;
}
@@ -5117,7 +5111,7 @@ ghb_get_preview_image(
preview = scaled_preview;
}
}
- if (ghb_settings_get_boolean(ud->prefs, "preview_show_crop"))
+ if (ghb_dict_get_bool(ud->prefs, "preview_show_crop"))
{
c0 *= yscale;
c1 *= yscale;
diff --git a/gtk/src/hb-backend.h b/gtk/src/hb-backend.h
index 53661e38a..6468432e0 100644
--- a/gtk/src/hb-backend.h
+++ b/gtk/src/hb-backend.h
@@ -139,7 +139,7 @@ void ghb_add_all_subtitles(signal_user_data_t *ud, gint titleindex);
gint ghb_find_subtitle_track(const hb_title_t * title, const gchar * lang, int start);
gint ghb_pick_subtitle_track(signal_user_data_t *ud);
gint ghb_longest_title(void);
-gchar* ghb_build_advanced_opts_string(GhbValue *settings);
+const gchar* ghb_build_advanced_opts_string(GhbValue *settings);
GdkPixbuf* ghb_get_preview_image(
const hb_title_t *title, gint index, signal_user_data_t *ud,
gint *out_width, gint *out_height);
@@ -157,7 +157,6 @@ void ghb_hb_cleanup(gboolean partial);
gint ghb_lookup_combo_int(const gchar *name, const GhbValue *gval);
gdouble ghb_lookup_combo_double(const gchar *name, const GhbValue *gval);
const gchar* ghb_lookup_combo_option(const gchar *name, const GhbValue *gval);
-const gchar* ghb_lookup_combo_string(const gchar *name, const GhbValue *gval);
gchar* ghb_get_tmp_dir();
gint ghb_find_closest_audio_samplerate(gint rate);
diff --git a/gtk/src/main.c b/gtk/src/main.c
index 3a9d581b1..5b60252fe 100644
--- a/gtk/src/main.c
+++ b/gtk/src/main.c
@@ -884,10 +884,10 @@ main(int argc, char *argv[])
g_log_set_handler("Gtk", G_LOG_LEVEL_WARNING, warn_log_handler, ud);
//g_log_set_handler("Gtk", G_LOG_LEVEL_CRITICAL, warn_log_handler, ud);
- ud->globals = ghb_settings_new();
- ud->prefs = ghb_settings_new();
+ ud->globals = ghb_dict_new();
+ ud->prefs = ghb_dict_new();
ud->settings_array = ghb_array_new();
- ud->settings = ghb_settings_new();
+ ud->settings = ghb_dict_new();
ghb_array_append(ud->settings_array, ud->settings);
ud->builder = create_builder_or_die(BUILDER_NAME);
@@ -1029,16 +1029,15 @@ main(int argc, char *argv[])
// empty title is initialized.
gint logLevel;
- logLevel = ghb_settings_get_int(ud->prefs, "LoggingLevel");
+ logLevel = ghb_dict_get_int(ud->prefs, "LoggingLevel");
ghb_backend_init(logLevel);
- if (ghb_settings_get_boolean(ud->prefs, "hbfd"))
+ if (ghb_dict_get_bool(ud->prefs, "hbfd"))
{
ghb_hbfd(ud, TRUE);
}
- gchar *source = ghb_settings_get_string(ud->prefs, "default_source");
+ const gchar *source = ghb_dict_get_string(ud->prefs, "default_source");
ghb_dvd_set_current(source, ud);
- g_free(source);
// Populate the presets tree view
ghb_presets_list_init(ud, NULL, 0);
@@ -1063,13 +1062,13 @@ main(int argc, char *argv[])
if (dvd_device != NULL)
{
// Source overridden from command line option
- ghb_settings_set_string(ud->globals, "scan_source", dvd_device);
+ ghb_dict_set_string(ud->globals, "scan_source", dvd_device);
g_idle_add((GSourceFunc)ghb_idle_scan, ud);
}
else
{
- GhbValue *gval = ghb_settings_get_value(ud->prefs, "default_source");
- ghb_settings_set_value(ud->globals, "scan_source", gval);
+ GhbValue *gval = ghb_dict_get_value(ud->prefs, "default_source");
+ ghb_dict_set(ud->globals, "scan_source", ghb_value_dup(gval));
}
// Reload and check status of the last saved queue
g_idle_add((GSourceFunc)ghb_reload_queue, ud);
@@ -1091,8 +1090,8 @@ main(int argc, char *argv[])
geo_mask = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE | GDK_HINT_BASE_SIZE;
gtk_window_set_geometry_hints(GTK_WINDOW(ghb_window), ghb_window,
&geo, geo_mask);
- window_width = ghb_settings_get_int(ud->prefs, "window_width");
- window_height = ghb_settings_get_int(ud->prefs, "window_height");
+ window_width = ghb_dict_get_int(ud->prefs, "window_width");
+ window_height = ghb_dict_get_int(ud->prefs, "window_height");
/*
* Filter objects in GtkBuilder xml
diff --git a/gtk/src/presets.c b/gtk/src/presets.c
index 099841b51..bdd8afdef 100644
--- a/gtk/src/presets.c
+++ b/gtk/src/presets.c
@@ -47,7 +47,6 @@ static GhbValue *presetsPlist = NULL;
static GhbValue *prefsPlist = NULL;
static gboolean prefs_modified = FALSE;
-static const GhbValue* preset_dict_get_value(GhbValue *dict, const gchar *key);
static void store_presets(void);
static void store_prefs(void);
@@ -174,7 +173,7 @@ preset_path_from_indices(GhbValue *presets, gint *indices, gint len)
name = ghb_dict_get(dict, "PresetName");
if (name)
ghb_array_append(path, ghb_value_dup(name));
- folder = ghb_value_get_bool(preset_dict_get_value(dict, "Folder"));
+ folder = ghb_value_get_bool(ghb_dict_get(dict, "Folder"));
if (!folder)
break;
presets = ghb_dict_get(dict, "ChildrenArray");
@@ -273,7 +272,7 @@ presets_get_dict(GhbValue *presets, gint *indices, gint len)
dict = ghb_array_get(presets, indices[ii]);
if (ii < len-1)
{
- folder = ghb_value_get_bool(preset_dict_get_value(dict, "Folder"));
+ folder = ghb_value_get_bool(ghb_dict_get(dict, "Folder"));
if (!folder)
return NULL;
presets = ghb_dict_get(dict, "ChildrenArray");
@@ -296,7 +295,7 @@ presets_get_folder(GhbValue *presets, gint *indices, gint len)
count = ghb_array_len(presets);
if (indices[ii] >= count) return NULL;
dict = ghb_array_get(presets, indices[ii]);
- folder = ghb_value_get_bool(preset_dict_get_value(dict, "Folder"));
+ folder = ghb_value_get_bool(ghb_dict_get(dict, "Folder"));
if (!folder)
break;
presets = ghb_dict_get(dict, "ChildrenArray");
@@ -316,7 +315,7 @@ plist_get_dict(GhbValue *presets, const gchar *name)
static const gchar*
preset_get_name(GhbValue *dict)
{
- return ghb_value_get_string(preset_dict_get_value(dict, "PresetName"));
+ return ghb_value_get_string(ghb_dict_get(dict, "PresetName"));
}
static gboolean
@@ -324,7 +323,7 @@ preset_folder_is_open(GhbValue *dict)
{
const GhbValue *gval;
- gval = preset_dict_get_value(dict, "FolderOpen");
+ gval = ghb_dict_get(dict, "FolderOpen");
if (gval != NULL)
return ghb_value_get_bool(gval);
return FALSE;
@@ -333,13 +332,13 @@ preset_folder_is_open(GhbValue *dict)
gboolean
ghb_preset_folder(GhbValue *dict)
{
- return ghb_value_get_int(preset_dict_get_value(dict, "Folder"));
+ return ghb_value_get_int(ghb_dict_get(dict, "Folder"));
}
gint
ghb_preset_type(GhbValue *dict)
{
- return ghb_value_get_int(preset_dict_get_value(dict, "Type"));
+ return ghb_value_get_int(ghb_dict_get(dict, "Type"));
}
static void
@@ -443,7 +442,7 @@ single_find_pos(GhbValue *presets, const gchar *name, gint type)
const gchar *str;
dict = ghb_array_get(presets, ii);
str = preset_get_name(dict);
- ptype = ghb_value_get_int(preset_dict_get_value(dict, "Type"));
+ ptype = ghb_value_get_int(ghb_dict_get(dict, "Type"));
if (strcasecmp(name, str) <= 0 && ptype == type)
{
return ii;
@@ -479,7 +478,7 @@ presets_find_pos(const GhbValue *path, gint type, gint *len)
return NULL;
}
dict = ghb_array_get(nested, indices[ii]);
- folder = ghb_value_get_bool(preset_dict_get_value(dict, "Folder"));
+ folder = ghb_value_get_bool(ghb_dict_get(dict, "Folder"));
nested = NULL;
if (!folder)
break;
@@ -502,7 +501,7 @@ preset_tree_depth(GhbValue *dict)
{
gboolean folder;
- folder = ghb_value_get_bool(preset_dict_get_value(dict, "Folder"));
+ folder = ghb_value_get_bool(ghb_dict_get(dict, "Folder"));
if (folder)
{
gint depth = 0;
@@ -532,7 +531,7 @@ preset_is_default(GhbValue *dict)
{
const GhbValue *val;
- val = preset_dict_get_value(dict, "Default");
+ val = ghb_dict_get(dict, "Default");
return ghb_value_get_bool(val);
}
@@ -548,7 +547,7 @@ presets_clear_default(GhbValue *presets)
gboolean folder;
dict = ghb_array_get(presets, ii);
- folder = ghb_value_get_bool(preset_dict_get_value(dict, "Folder"));
+ folder = ghb_value_get_bool(ghb_dict_get(dict, "Folder"));
if (folder)
{
GhbValue *nested;
@@ -580,12 +579,12 @@ presets_customize(GhbValue *presets)
dict = ghb_array_get(presets, ii);
- ptype = ghb_value_get_int(preset_dict_get_value(dict, "Type"));
+ ptype = ghb_value_get_int(ghb_dict_get(dict, "Type"));
if (ptype != PRESETS_CUSTOM)
{
ghb_dict_set(dict, "Type", ghb_int_value_new(PRESETS_CUSTOM));
}
- folder = ghb_value_get_bool(preset_dict_get_value(dict, "Folder"));
+ folder = ghb_value_get_bool(ghb_dict_get(dict, "Folder"));
if (folder)
{
GhbValue *nested;
@@ -609,7 +608,7 @@ presets_find_default2(GhbValue *presets, gint *len)
gboolean folder;
dict = ghb_array_get(presets, ii);
- folder = ghb_value_get_bool(preset_dict_get_value(dict, "Folder"));
+ folder = ghb_value_get_bool(ghb_dict_get(dict, "Folder"));
if (folder)
{
GhbValue *nested;
@@ -680,7 +679,7 @@ ghb_preset_indices_from_path(
if (ii < count-1)
{
dict = ghb_array_get(nested, indices[ii]);
- folder = ghb_value_get_bool(preset_dict_get_value(dict, "Folder"));
+ folder = ghb_value_get_bool(ghb_dict_get(dict, "Folder"));
if (!folder)
{
g_free(indices);
@@ -763,47 +762,6 @@ presets_set_folder_open(gboolean open, gint *indices, gint len)
}
}
-// Used for sorting dictionaries.
-gint
-key_cmp(gconstpointer a, gconstpointer b)
-{
- gchar *stra = (gchar*)a;
- gchar *strb = (gchar*)b;
-
- return strcmp(stra, strb);
-}
-
-static const GhbValue*
-preset_dict_get_value(GhbValue *dict, const gchar *key)
-{
- return ghb_dict_get(dict, key);
-}
-
-static const char * dict_get_string(GhbValue *dict, const char *key)
-{
- GhbValue *gval = ghb_dict_get(dict, key);
-
- if (gval == NULL)
- return NULL;
- return ghb_value_get_string(gval);
-}
-
-static gboolean dict_get_boolean(GhbValue *dict, const char *key)
-{
- GhbValue *gval = ghb_dict_get(dict, key);
-
- if (gval == NULL)
- return FALSE;
- return ghb_value_get_bool(gval);
-}
-
-const gchar*
-ghb_presets_get_description(GhbValue *pdict)
-{
- return dict_get_string(pdict, "PresetDescription");
-}
-
-
static void init_settings_from_dict(
GhbValue *dest, GhbValue *template, GhbValue *dict, gboolean filter);
@@ -932,7 +890,7 @@ init_settings_from_dict(
else
new_val = ghb_value_dup(val);
}
- ghb_settings_take_value(dest, key, new_val);
+ ghb_dict_set(dest, key, new_val);
}
if (filter || dict == NULL)
@@ -948,7 +906,7 @@ init_settings_from_dict(
val = ghb_dict_get(template, key);
if (val == NULL)
{
- ghb_settings_set_value(dest, key, gval);
+ ghb_dict_set(dest, key, ghb_value_dup(gval));
}
}
}
@@ -1001,7 +959,7 @@ ghb_settings_to_ui(signal_user_data_t *ud, GhbValue *dict)
for (ii = 0; widget_priority_list[ii] != NULL; ii++)
{
key = widget_priority_list[ii];
- gval = ghb_settings_get_value(tmp, key);
+ gval = ghb_dict_get_value(tmp, key);
if (gval != NULL)
ghb_ui_settings_update(ud, dict, key, gval);
}
@@ -1024,7 +982,7 @@ ghb_preset_is_custom()
const GhbValue *val;
if (current_preset == NULL) return FALSE;
- val = preset_dict_get_value(current_preset, "Type");
+ val = ghb_dict_get(current_preset, "Type");
return (ghb_value_get_int(val) == 1);
}
@@ -1056,13 +1014,13 @@ ghb_set_preset_settings_from_indices(
gboolean folder;
current_preset = dict;
- folder = ghb_value_get_bool(preset_dict_get_value(dict, "Folder"));
+ folder = ghb_value_get_bool(ghb_dict_get(dict, "Folder"));
if (folder)
ghb_preset_to_settings(ud->settings, NULL);
else
ghb_preset_to_settings(ud->settings, dict);
path = preset_path_from_indices(presetsPlist, indices, len);
- ghb_settings_set_value(ud->settings, "preset", path);
+ ghb_dict_set(ud->settings, "preset", ghb_value_dup(path));
ghb_value_free(&path);
}
}
@@ -1071,7 +1029,7 @@ static const GhbValue*
curr_preset_get_value(const gchar *key)
{
if (current_preset == NULL) return NULL;
- return preset_dict_get_value(current_preset, key);
+ return ghb_dict_get(current_preset, key);
}
void
@@ -1414,7 +1372,7 @@ ghb_prefs_save(GhbValue *settings)
iter = ghb_dict_iter_init(dict);
while (ghb_dict_iter_next(dict, &iter, &key, NULL))
{
- value = ghb_settings_get_value(settings, key);
+ value = ghb_dict_get_value(settings, key);
if (value != NULL)
{
ghb_dict_set(pref_dict, key, ghb_value_dup(value));
@@ -1429,7 +1387,7 @@ ghb_pref_save(GhbValue *settings, const gchar *key)
{
const GhbValue *value, *value2;
- value = ghb_settings_get_value(settings, key);
+ value = ghb_dict_get_value(settings, key);
if (value != NULL)
{
GhbValue *dict;
@@ -1450,7 +1408,7 @@ ghb_pref_set(GhbValue *settings, const gchar *key)
{
const GhbValue *value, *value2;
- value = ghb_settings_get_value(settings, key);
+ value = ghb_dict_get_value(settings, key);
if (value != NULL)
{
GhbValue *dict;
@@ -1496,7 +1454,7 @@ ghb_settings_init(GhbValue *settings, const char *name)
// pointer will break strict-aliasing rules"
while (ghb_dict_iter_next(internal, &iter, &key, &gval))
{
- ghb_settings_set_value(settings, key, gval);
+ ghb_dict_set(settings, key, ghb_value_dup(gval));
}
}
@@ -1698,7 +1656,8 @@ ghb_presets_list_init(
more_indices[len] = ii;
def = preset_is_default(dict);
- description = ghb_presets_get_description(dict);
+ description = ghb_value_get_string(
+ ghb_dict_get(dict, "PresetDescription"));
gtk_tree_store_append(store, &iter, piter);
type = ghb_preset_type(dict);
folder = ghb_preset_folder(dict);
@@ -1778,7 +1737,7 @@ presets_list_update_item(
name = preset_get_name(dict);
def = preset_is_default(dict);
- description = ghb_presets_get_description(dict);
+ description = ghb_value_get_string(ghb_dict_get(dict, "PresetDescription"));
type = ghb_preset_type(dict);
folder = ghb_preset_folder(dict);
color = get_preset_color(type, folder);
@@ -1842,7 +1801,7 @@ presets_list_insert(
preset = preset_get_name(dict);
def = preset_is_default(dict);
- description = ghb_presets_get_description(dict);
+ description = ghb_value_get_string(ghb_dict_get(dict, "PresetDescription"));
gtk_tree_store_insert(store, &iter, piter, indices[len-1]);
type = ghb_preset_type(dict);
folder = ghb_preset_folder(dict);
@@ -1896,7 +1855,7 @@ remove_std_presets(signal_user_data_t *ud)
gint ptype;
dict = ghb_array_get(presetsPlist, ii);
- ptype = ghb_value_get_int(preset_dict_get_value(dict, "Type"));
+ ptype = ghb_value_get_int(ghb_dict_get(dict, "Type"));
if (ptype == PRESETS_BUILTIN)
{
if (ghb_presets_remove(presetsPlist, &indices, 1))
@@ -2540,7 +2499,7 @@ import_xlat_preset(GhbValue *user_preset)
list = ghb_dict_get(dict, "SubtitleLanguageList");
if (list == NULL)
{
- list = ghb_array_new(8);
+ list = ghb_array_new();
ghb_dict_set(dict, "SubtitleLanguageList", list);
}
if (ghb_array_len(list) == 0)
@@ -2576,29 +2535,29 @@ import_xlat_preset(GhbValue *user_preset)
import_value_xlat(dict);
// Fix up all the internal settings that are derived from preset values.
- ghb_settings_set_boolean(dict, "PictureDeinterlaceDecomb",
- !ghb_settings_get_boolean(dict, "PictureDecombDeinterlace"));
+ ghb_dict_set_bool(dict, "PictureDeinterlaceDecomb",
+ !ghb_dict_get_bool(dict, "PictureDecombDeinterlace"));
- ghb_settings_set_value(dict, "scale_height",
- ghb_settings_get_value(dict, "PictureHeight"));
+ ghb_dict_set(dict, "scale_height", ghb_value_dup(
+ ghb_dict_get_value(dict, "PictureHeight")));
- ghb_settings_set_value(dict, "scale_width",
- ghb_settings_get_value(dict, "PictureWidth"));
+ ghb_dict_set(dict, "scale_width", ghb_value_dup(
+ ghb_dict_get_value(dict, "PictureWidth")));
gint uses_pic;
gint vqtype;
- uses_pic = ghb_settings_get_int(dict, "UsesPictureSettings");
- vqtype = ghb_settings_get_int(dict, "VideoQualityType");
+ uses_pic = ghb_dict_get_int(dict, "UsesPictureSettings");
+ vqtype = ghb_dict_get_int(dict, "VideoQualityType");
// "Use max" or "strict anamorphic" imply autoscale
if (uses_pic == 2)
{
- ghb_settings_set_boolean(dict, "autoscale", TRUE);
+ ghb_dict_set_bool(dict, "autoscale", TRUE);
}
else if (uses_pic == 1)
{
- ghb_settings_set_boolean(dict, "autoscale", FALSE);
+ ghb_dict_set_bool(dict, "autoscale", FALSE);
}
// VideoQualityType/0/1/2 - vquality_type_/target/bitrate/constant
@@ -2607,55 +2566,55 @@ import_xlat_preset(GhbValue *user_preset)
{
case 0:
{
- ghb_settings_set_boolean(dict, "vquality_type_bitrate", TRUE);
- ghb_settings_set_boolean(dict, "vquality_type_constant", FALSE);
+ ghb_dict_set_bool(dict, "vquality_type_bitrate", TRUE);
+ ghb_dict_set_bool(dict, "vquality_type_constant", FALSE);
} break;
case 1:
{
- ghb_settings_set_boolean(dict, "vquality_type_bitrate", TRUE);
- ghb_settings_set_boolean(dict, "vquality_type_constant", FALSE);
+ ghb_dict_set_bool(dict, "vquality_type_bitrate", TRUE);
+ ghb_dict_set_bool(dict, "vquality_type_constant", FALSE);
} break;
case 2:
{
- ghb_settings_set_boolean(dict, "vquality_type_bitrate", FALSE);
- ghb_settings_set_boolean(dict, "vquality_type_constant", TRUE);
+ ghb_dict_set_bool(dict, "vquality_type_bitrate", FALSE);
+ ghb_dict_set_bool(dict, "vquality_type_constant", TRUE);
} break;
default:
{
- ghb_settings_set_boolean(dict, "vquality_type_bitrate", FALSE);
- ghb_settings_set_boolean(dict, "vquality_type_constant", TRUE);
+ ghb_dict_set_bool(dict, "vquality_type_bitrate", FALSE);
+ ghb_dict_set_bool(dict, "vquality_type_constant", TRUE);
} break;
}
- const gchar *mode = ghb_settings_get_const_string(dict, "VideoFramerateMode");
+ const gchar *mode = ghb_dict_get_string(dict, "VideoFramerateMode");
if (strcmp(mode, "cfr") == 0)
{
- ghb_settings_set_boolean(dict, "VideoFramerateCFR", TRUE);
- ghb_settings_set_boolean(dict, "VideoFrameratePFR", FALSE);
- ghb_settings_set_boolean(dict, "VideoFramerateVFR", FALSE);
+ ghb_dict_set_bool(dict, "VideoFramerateCFR", TRUE);
+ ghb_dict_set_bool(dict, "VideoFrameratePFR", FALSE);
+ ghb_dict_set_bool(dict, "VideoFramerateVFR", FALSE);
}
else if (strcmp(mode, "pfr") == 0)
{
- ghb_settings_set_boolean(dict, "VideoFramerateCFR", FALSE);
- ghb_settings_set_boolean(dict, "VideoFrameratePFR", TRUE);
- ghb_settings_set_boolean(dict, "VideoFramerateVFR", FALSE);
+ ghb_dict_set_bool(dict, "VideoFramerateCFR", FALSE);
+ ghb_dict_set_bool(dict, "VideoFrameratePFR", TRUE);
+ ghb_dict_set_bool(dict, "VideoFramerateVFR", FALSE);
}
else
{
- ghb_settings_set_boolean(dict, "VideoFramerateCFR", FALSE);
- ghb_settings_set_boolean(dict, "VideoFrameratePFR", FALSE);
- ghb_settings_set_boolean(dict, "VideoFramerateVFR", TRUE);
+ ghb_dict_set_bool(dict, "VideoFramerateCFR", FALSE);
+ ghb_dict_set_bool(dict, "VideoFrameratePFR", FALSE);
+ ghb_dict_set_bool(dict, "VideoFramerateVFR", TRUE);
}
- if (ghb_settings_get_boolean(dict, "x264UseAdvancedOptions"))
+ if (ghb_dict_get_bool(dict, "x264UseAdvancedOptions"))
{
// Force preset/tune/profile/level/opts to conform to option string
- ghb_settings_set_string(dict, "VideoPreset", "medium");
- ghb_settings_set_string(dict, "VideoTune", "none");
- ghb_settings_set_string(dict, "VideoProfile", "auto");
- ghb_settings_set_string(dict, "VideoLevel", "auto");
- ghb_settings_set_value(dict, "VideoOptionExtra",
- ghb_settings_get_value(dict, "x264Option"));
+ ghb_dict_set_string(dict, "VideoPreset", "medium");
+ ghb_dict_set_string(dict, "VideoTune", "none");
+ ghb_dict_set_string(dict, "VideoProfile", "auto");
+ ghb_dict_set_string(dict, "VideoLevel", "auto");
+ ghb_dict_set(dict, "VideoOptionExtra", ghb_value_dup(
+ ghb_dict_get_value(dict, "x264Option")));
}
else
{
@@ -2667,40 +2626,40 @@ import_xlat_preset(GhbValue *user_preset)
videoPresets = hb_video_encoder_get_presets(encoder);
const char *videoPreset;
if (ghb_dict_get(user_preset, "x264Preset") != NULL)
- videoPreset = ghb_settings_get_const_string(dict, "x264Preset");
+ videoPreset = ghb_dict_get_string(dict, "x264Preset");
else
- videoPreset = ghb_settings_get_const_string(dict, "VideoPreset");
+ videoPreset = ghb_dict_get_string(dict, "VideoPreset");
int ii;
for (ii = 0; videoPreset && videoPresets && videoPresets[ii]; ii++)
{
if (!strcasecmp(videoPreset, videoPresets[ii]))
{
- ghb_settings_set_int(dict, "VideoPresetSlider", ii);
+ ghb_dict_set_int(dict, "VideoPresetSlider", ii);
break;
}
}
if (videoPreset != NULL)
- ghb_settings_set_string(dict, "VideoPreset", videoPreset);
+ ghb_dict_set_string(dict, "VideoPreset", videoPreset);
char *videoTune;
if (ghb_dict_get(user_preset, "x264Tune") != NULL)
- videoTune = ghb_settings_get_string(dict, "x264Tune");
+ videoTune = g_strdup(ghb_dict_get_string(dict, "x264Tune"));
else
- videoTune = ghb_settings_get_string(dict, "VideoTune");
+ videoTune = g_strdup(ghb_dict_get_string(dict, "VideoTune"));
char *tune = NULL;
char *saveptr;
char * tok = strtok_r(videoTune, ",./-+", &saveptr);
- ghb_settings_set_boolean(dict, "x264FastDecode", FALSE);
- ghb_settings_set_boolean(dict, "x264ZeroLatency", FALSE);
+ ghb_dict_set_bool(dict, "x264FastDecode", FALSE);
+ ghb_dict_set_bool(dict, "x264ZeroLatency", FALSE);
while (tok != NULL)
{
if (!strcasecmp(tok, "fastdecode"))
{
- ghb_settings_set_boolean(dict, "x264FastDecode", TRUE);
+ ghb_dict_set_bool(dict, "x264FastDecode", TRUE);
}
else if (!strcasecmp(tok, "zerolatency"))
{
- ghb_settings_set_boolean(dict, "x264ZeroLatency", TRUE);
+ ghb_dict_set_bool(dict, "x264ZeroLatency", TRUE);
}
else if (tune == NULL)
{
@@ -2715,31 +2674,31 @@ import_xlat_preset(GhbValue *user_preset)
g_free(videoTune);
if (tune != NULL)
{
- ghb_settings_set_string(dict, "VideoTune", tune);
+ ghb_dict_set_string(dict, "VideoTune", tune);
g_free(tune);
}
const char *videoProfile;
if (ghb_dict_get(user_preset, "x264Profile") != NULL)
- videoProfile = ghb_settings_get_const_string(dict, "x264Profile");
+ videoProfile = ghb_dict_get_string(dict, "x264Profile");
else
- videoProfile = ghb_settings_get_const_string(dict, "VideoProfile");
+ videoProfile = ghb_dict_get_string(dict, "VideoProfile");
if (videoProfile != NULL)
- ghb_settings_set_string(dict, "VideoProfile", videoProfile);
+ ghb_dict_set_string(dict, "VideoProfile", videoProfile);
const char *videoLevel;
if (ghb_dict_get(user_preset, "x264Level") != NULL)
- videoLevel = ghb_settings_get_const_string(dict, "x264Level");
+ videoLevel = ghb_dict_get_string(dict, "x264Level");
else
- videoLevel = ghb_settings_get_const_string(dict, "VideoLevel");
+ videoLevel = ghb_dict_get_string(dict, "VideoLevel");
if (videoLevel != NULL)
- ghb_settings_set_string(dict, "VideoLevel", videoLevel);
+ ghb_dict_set_string(dict, "VideoLevel", videoLevel);
if (ghb_dict_get(user_preset, "x264OptionExtra") != NULL)
{
const char *optionExtra;
- optionExtra = ghb_settings_get_const_string(dict, "x264OptionExtra");
- ghb_settings_set_string(dict, "VideoOptionExtra", optionExtra);
+ optionExtra = ghb_dict_get_string(dict, "x264OptionExtra");
+ ghb_dict_set_string(dict, "VideoOptionExtra", optionExtra);
}
return dict;
@@ -2758,7 +2717,7 @@ import_xlat_presets(GhbValue *presets)
for (ii = 0; ii < count; ii++)
{
dict = ghb_array_get(presets, ii);
- folder = ghb_value_get_bool(preset_dict_get_value(dict, "Folder"));
+ folder = ghb_value_get_bool(ghb_dict_get(dict, "Folder"));
if (folder)
{
GhbValue *nested;
@@ -2781,11 +2740,11 @@ export_xlat_preset(GhbValue *dict)
gboolean autoscale, br, constant;
g_debug("export_xlat_prest ()");
- autoscale = ghb_value_get_bool(preset_dict_get_value(dict, "autoscale"));
+ autoscale = ghb_value_get_bool(ghb_dict_get(dict, "autoscale"));
br = ghb_value_get_bool(
- preset_dict_get_value(dict, "vquality_type_bitrate"));
+ ghb_dict_get(dict, "vquality_type_bitrate"));
constant = ghb_value_get_bool(
- preset_dict_get_value(dict, "vquality_type_constant"));
+ ghb_dict_get(dict, "vquality_type_constant"));
if (autoscale)
{
@@ -2807,11 +2766,11 @@ export_xlat_preset(GhbValue *dict)
ghb_dict_set(dict, "VideoQualityType", ghb_int_value_new(2));
}
- if (ghb_value_get_bool(preset_dict_get_value(dict, "VideoFramerateCFR")))
+ if (ghb_value_get_bool(ghb_dict_get(dict, "VideoFramerateCFR")))
{
ghb_dict_set(dict, "VideoFramerateMode", ghb_string_value_new("cfr"));
}
- else if (ghb_value_get_bool(preset_dict_get_value(dict, "VideoFrameratePFR")))
+ else if (ghb_value_get_bool(ghb_dict_get(dict, "VideoFrameratePFR")))
{
ghb_dict_set(dict, "VideoFramerateMode", ghb_string_value_new("pfr"));
}
@@ -2820,7 +2779,7 @@ export_xlat_preset(GhbValue *dict)
ghb_dict_set(dict, "VideoFramerateMode", ghb_string_value_new("vfr"));
}
- if (ghb_value_get_int(preset_dict_get_value(dict, "PictureDeblock")) < 5)
+ if (ghb_value_get_int(ghb_dict_get(dict, "PictureDeblock")) < 5)
{
ghb_dict_set(dict, "PictureDeblock", ghb_int_value_new(0));
}
@@ -2836,7 +2795,7 @@ export_xlat_preset(GhbValue *dict)
adict = ghb_array_get(alist, ii);
drc = ghb_value_get_double(
- preset_dict_get_value(adict, "AudioTrackDRCSlider"));
+ ghb_dict_get(adict, "AudioTrackDRCSlider"));
if (drc < 1.0)
{
ghb_dict_set(adict, "AudioTrackDRCSlider",
@@ -2844,7 +2803,7 @@ export_xlat_preset(GhbValue *dict)
}
}
- if (ghb_value_get_bool(preset_dict_get_value(dict, "x264UseAdvancedOptions")))
+ if (ghb_value_get_bool(ghb_dict_get(dict, "x264UseAdvancedOptions")))
{
ghb_dict_remove(dict, "VideoPreset");
ghb_dict_remove(dict, "VideoTune");
@@ -2852,18 +2811,18 @@ export_xlat_preset(GhbValue *dict)
ghb_dict_remove(dict, "VideoLevel");
ghb_dict_remove(dict, "VideoOptionExtra");
}
- const char *tune = dict_get_string(dict, "VideoTune");
+ const char *tune = ghb_value_get_string(ghb_dict_get(dict, "VideoTune"));
if (tune != NULL)
{
GString *str = g_string_new("");
char *tunes;
g_string_append_printf(str, "%s", tune);
- if (dict_get_boolean(dict, "x264FastDecode"))
+ if (ghb_value_get_bool(ghb_dict_get(dict, "x264FastDecode")))
{
g_string_append_printf(str, ",%s", "fastdecode");
}
- if (dict_get_boolean(dict, "x264ZeroLatency"))
+ if (ghb_value_get_bool(ghb_dict_get(dict, "x264ZeroLatency")))
{
g_string_append_printf(str, ",%s", "zerolatency");
}
@@ -2894,7 +2853,7 @@ export_xlat_presets(GhbValue *presets)
for (ii = 0; ii < count; ii++)
{
dict = ghb_array_get(presets, ii);
- folder = ghb_value_get_bool(preset_dict_get_value(dict, "Folder"));
+ folder = ghb_value_get_bool(ghb_dict_get(dict, "Folder"));
if (folder)
{
GhbValue *nested;
@@ -3018,7 +2977,7 @@ replace_standard_presets(GhbValue *presetsArray)
gint ptype;
dict = ghb_array_get(presetsArray, ii);
- ptype = ghb_value_get_int(preset_dict_get_value(dict, "Type"));
+ ptype = ghb_value_get_int(ghb_dict_get(dict, "Type"));
if (ptype == PRESETS_BUILTIN)
{
gint indices = 0;
@@ -3174,8 +3133,8 @@ settings_save(signal_user_data_t *ud, const GhbValue *path)
}
}
current_preset = dict;
- ghb_settings_set_int64(dict, "Type", PRESETS_CUSTOM);
- ghb_settings_set_int64(dict, "PresetBuildNumber", hb_get_build(NULL));
+ ghb_dict_set_int(dict, "Type", PRESETS_CUSTOM);
+ ghb_dict_set_int(dict, "PresetBuildNumber", hb_get_build(NULL));
ghb_dict_set(dict, "PresetName", ghb_string_value_new(name));
if (replace)
@@ -3195,18 +3154,18 @@ settings_save(signal_user_data_t *ud, const GhbValue *path)
ghb_dict_set(dict, "Default", ghb_bool_value_new(FALSE));
presets_list_insert(ud, indices, len);
}
- if (!ghb_settings_get_boolean(ud->settings, "PictureWidthEnable"))
+ if (!ghb_dict_get_bool(ud->settings, "PictureWidthEnable"))
{
ghb_dict_remove(dict, "PictureWidth");
}
- if (!ghb_settings_get_boolean(ud->settings, "PictureHeightEnable"))
+ if (!ghb_dict_get_bool(ud->settings, "PictureHeightEnable"))
{
ghb_dict_remove(dict, "PictureHeight");
}
ghb_dict_set(dict, "autoscale",
ghb_bool_value_new(
- !ghb_settings_get_boolean(ud->settings, "PictureWidthEnable") &&
- !ghb_settings_get_boolean(ud->settings, "PictureHeightEnable")
+ !ghb_dict_get_bool(ud->settings, "PictureWidthEnable") &&
+ !ghb_dict_get_bool(ud->settings, "PictureHeightEnable")
)
);
@@ -3250,7 +3209,7 @@ folder_save(signal_user_data_t *ud, const GhbValue *path)
// Already exists, update its description
dict = presets_get_dict(presetsPlist, indices, len);
ghb_dict_set(dict, "PresetDescription",
- ghb_value_dup(preset_dict_get_value(
+ ghb_value_dup(ghb_dict_get(
ud->settings, "PresetDescription")));
presets_list_update_item(ud, indices, len, FALSE);
g_free(indices);
@@ -3272,7 +3231,7 @@ folder_save(signal_user_data_t *ud, const GhbValue *path)
}
}
ghb_dict_set(dict, "PresetDescription",
- ghb_value_dup(preset_dict_get_value(
+ ghb_value_dup(ghb_dict_get(
ud->settings, "PresetDescription")));
ghb_dict_set(dict, "PresetName", ghb_string_value_new(name));
folder = ghb_array_new();
@@ -3352,20 +3311,20 @@ update_subtitle_presets(signal_user_data_t *ud)
GhbValue *slist, *dict;
gint count, ii, source;
- subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
+ subtitle_list = ghb_dict_get_value(ud->settings, "subtitle_list");
slist = ghb_array_new();
count = ghb_array_len(subtitle_list);
for (ii = 0; ii < count; ii++)
{
subtitle = ghb_array_get(subtitle_list, ii);
- source = ghb_settings_get_int(subtitle, "SubtitleSource");
+ source = ghb_dict_get_int(subtitle, "SubtitleSource");
if (source != SRTSUB)
{
dict = ghb_value_dup(subtitle);
ghb_array_append(slist, dict);
}
}
- ghb_settings_take_value(ud->settings, "SubtitleList", slist);
+ ghb_dict_set(ud->settings, "SubtitleList", slist);
}
G_MODULE_EXPORT void
@@ -3396,7 +3355,7 @@ preset_import_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter);
gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(dialog), filter);
- exportDir = ghb_settings_get_const_string(ud->prefs, "ExportDirectory");
+ exportDir = ghb_dict_get_string(ud->prefs, "ExportDirectory");
if (exportDir == NULL || exportDir[0] == '\0')
{
exportDir = ".";
@@ -3464,11 +3423,11 @@ preset_import_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
}
ghb_value_free(&array);
- exportDir = ghb_settings_get_const_string(ud->prefs, "ExportDirectory");
+ exportDir = ghb_dict_get_string(ud->prefs, "ExportDirectory");
dir = g_path_get_dirname(filename);
if (strcmp(dir, exportDir) != 0)
{
- ghb_settings_set_string(ud->prefs, "ExportDirectory", dir);
+ ghb_dict_set_string(ud->prefs, "ExportDirectory", dir);
ghb_pref_save(ud->prefs, "ExportDirectory");
}
g_free(filename);
@@ -3535,7 +3494,7 @@ preset_export_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
GHB_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
NULL);
- exportDir = ghb_settings_get_const_string(ud->prefs, "ExportDirectory");
+ exportDir = ghb_dict_get_string(ud->prefs, "ExportDirectory");
if (exportDir == NULL || exportDir[0] == '\0')
{
exportDir = ".";
@@ -3574,11 +3533,11 @@ preset_export_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
store_plist(filename, array);
ghb_value_free(&array);
- exportDir = ghb_settings_get_const_string(ud->prefs, "ExportDirectory");
+ exportDir = ghb_dict_get_string(ud->prefs, "ExportDirectory");
dir = g_path_get_dirname(filename);
if (strcmp(dir, exportDir) != 0)
{
- ghb_settings_set_string(ud->prefs, "ExportDirectory", dir);
+ ghb_dict_set_string(ud->prefs, "ExportDirectory", dir);
ghb_pref_save(ud->prefs, "ExportDirectory");
}
g_free(dir);
@@ -3646,7 +3605,7 @@ presets_new_folder_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
}
ghb_array_append(dest, ghb_string_value_new(name));
GhbValue *val = ghb_widget_value(GTK_WIDGET(desc));
- ghb_settings_set_value(ud->settings, "PresetDescription", val);
+ ghb_dict_set(ud->settings, "PresetDescription", ghb_value_dup(val));
folder_save(ud, dest);
ghb_value_free(&dest);
}
@@ -3668,7 +3627,7 @@ presets_save_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
g_debug("presets_save_clicked_cb ()");
preset = get_selected_path(ud);
if (preset == NULL)
- preset = ghb_value_dup(ghb_settings_get_value(ud->settings, "preset"));
+ preset = ghb_value_dup(ghb_dict_get_value(ud->settings, "preset"));
count = ghb_array_len(preset);
if (count > 0)
@@ -3677,19 +3636,19 @@ presets_save_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
count = 1;
desc = GTK_TEXT_VIEW(GHB_WIDGET(ud->builder, "PresetDescription"));
- int width = ghb_settings_get_int(ud->settings, "PictureWidth");
- int height = ghb_settings_get_int(ud->settings, "PictureHeight");
- gboolean autoscale = ghb_settings_get_boolean(ud->settings, "autoscale");
+ int width = ghb_dict_get_int(ud->settings, "PictureWidth");
+ int height = ghb_dict_get_int(ud->settings, "PictureHeight");
+ gboolean autoscale = ghb_dict_get_bool(ud->settings, "autoscale");
ghb_ui_update(ud, "PictureWidthEnable", ghb_boolean_value(!autoscale));
ghb_ui_update(ud, "PictureHeightEnable", ghb_boolean_value(!autoscale));
if (!width)
{
- width = ghb_settings_get_int(ud->settings, "scale_width");
+ width = ghb_dict_get_int(ud->settings, "scale_width");
ghb_ui_update(ud, "PictureWidth", ghb_int_value(width));
}
if (!height)
{
- height = ghb_settings_get_int(ud->settings, "scale_height");
+ height = ghb_dict_get_int(ud->settings, "scale_height");
ghb_ui_update(ud, "PictureHeight", ghb_int_value(height));
}
dialog = GHB_WIDGET(ud->builder, "preset_save_dialog");
@@ -3743,7 +3702,7 @@ presets_restore_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
ghb_presets_reload(ud);
// Updating the presets list shuffles things around
// need to make sure the proper preset is selected
- preset = ghb_settings_get_value(ud->settings, "preset");
+ preset = ghb_dict_get_value(ud->settings, "preset");
ghb_select_preset(ud->builder, preset);
}
@@ -4194,14 +4153,14 @@ presets_list_selection_changed_cb(GtkTreeSelection *selection, signal_user_data_
len = gtk_tree_path_get_depth(treepath);
folder = ghb_presets_get_folder(presetsPlist, indices, len);
- if (!folder && !ghb_settings_get_boolean(ud->settings, "preset_reload"))
+ if (!folder && !ghb_dict_get_bool(ud->settings, "preset_reload"))
{
ghb_set_preset_settings_from_indices(ud, indices, len);
- ghb_settings_set_boolean(ud->settings, "preset_modified", FALSE);
+ ghb_dict_set_bool(ud->settings, "preset_modified", FALSE);
ghb_set_current_title_settings(ud);
ghb_load_settings(ud);
}
- ghb_settings_set_boolean(ud->settings, "preset_reload", FALSE);
+ ghb_dict_set_bool(ud->settings, "preset_reload", FALSE);
gtk_tree_path_free(treepath);
gtk_widget_set_sensitive(widget, TRUE);
@@ -4224,7 +4183,7 @@ ghb_clear_presets_selection(signal_user_data_t *ud)
treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
selection = gtk_tree_view_get_selection (treeview);
gtk_tree_selection_unselect_all (selection);
- ghb_settings_set_boolean(ud->settings, "preset_modified", TRUE);
+ ghb_dict_set_bool(ud->settings, "preset_modified", TRUE);
}
G_MODULE_EXPORT void
diff --git a/gtk/src/preview.c b/gtk/src/preview.c
index deb7da868..9f79486bf 100644
--- a/gtk/src/preview.c
+++ b/gtk/src/preview.c
@@ -307,7 +307,7 @@ caps_set(GstCaps *caps, signal_user_data_t *ud)
else
height = gst_util_uint64_scale_int(width, den, num);
- if (ghb_settings_get_boolean(ud->prefs, "reduce_hd_preview"))
+ if (ghb_dict_get_bool(ud->prefs, "reduce_hd_preview"))
{
GdkScreen *ss;
gint s_w, s_h;
@@ -762,10 +762,10 @@ live_preview_start_cb(GtkWidget *xwidget, signal_user_data_t *ud)
ud->preview->encode_frame = frame;
js = ghb_value_dup(ud->settings);
- ghb_settings_set_string(js, "destination", name);
- ghb_settings_set_int(js, "start_frame", ud->preview->frame);
+ ghb_dict_set_string(js, "destination", name);
+ ghb_dict_set_int(js, "start_frame", ud->preview->frame);
ud->preview->live_id = 0;
- ghb_settings_set_value(js, "Preferences", ud->prefs);
+ ghb_dict_set(js, "Preferences", ghb_value_dup(ud->prefs));
ghb_add_live_job(js, ud->preview->live_id);
ghb_start_live_encode();
ghb_value_free(&js);
@@ -919,7 +919,7 @@ ghb_set_preview_image(signal_user_data_t *ud)
live_preview_stop(ud);
- title_id = ghb_settings_get_int(ud->settings, "title");
+ title_id = ghb_dict_get_int(ud->settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
if (title == NULL) return;
widget = GHB_WIDGET (ud->builder, "preview_frame");
@@ -1153,17 +1153,17 @@ ghb_preview_set_visible(signal_user_data_t *ud)
GtkWidget *widget;
gboolean active;
- title_id = ghb_settings_get_int(ud->settings, "title");
+ title_id = ghb_dict_get_int(ud->settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
- active = ghb_settings_get_boolean(ud->globals, "show_preview") &&
+ active = ghb_dict_get_bool(ud->globals, "show_preview") &&
title != NULL;
widget = GHB_WIDGET(ud->builder, "preview_window");
gtk_widget_set_visible(widget, active);
if (active)
{
gint x, y;
- x = ghb_settings_get_int(ud->prefs, "preview_x");
- y = ghb_settings_get_int(ud->prefs, "preview_y");
+ x = ghb_dict_get_int(ud->prefs, "preview_x");
+ y = ghb_dict_get_int(ud->prefs, "preview_y");
if (x >= 0 && y >= 0)
gtk_window_move(GTK_WINDOW(widget), x, y);
}
@@ -1433,8 +1433,8 @@ preview_configure_cb(
if (gtk_widget_get_visible(widget))
{
gtk_window_get_position(GTK_WINDOW(widget), &x, &y);
- ghb_settings_set_int(ud->prefs, "preview_x", x);
- ghb_settings_set_int(ud->prefs, "preview_y", y);
+ ghb_dict_set_int(ud->prefs, "preview_x", x);
+ ghb_dict_set_int(ud->prefs, "preview_y", y);
ghb_pref_set(ud->prefs, "preview_x");
ghb_pref_set(ud->prefs, "preview_y");
ghb_prefs_store();
diff --git a/gtk/src/queuehandler.c b/gtk/src/queuehandler.c
index f721c03f6..2f48c8bf3 100644
--- a/gtk/src/queuehandler.c
+++ b/gtk/src/queuehandler.c
@@ -91,17 +91,17 @@ add_to_queue_list(signal_user_data_t *ud, GhbValue *settings, GtkTreeIter *piter
// Collect information for first line in the display
// Volume (Title X, Chapters Y through Z, N Video Passes) --> Destination
- title = ghb_settings_get_int(settings, "title");
- start_point = ghb_settings_get_int(settings, "start_point");
- end_point = ghb_settings_get_int(settings, "end_point");
- vol_name = ghb_settings_get_const_string(settings, "volume_label");
- dest = ghb_settings_get_const_string(settings, "destination");
+ title = ghb_dict_get_int(settings, "title");
+ start_point = ghb_dict_get_int(settings, "start_point");
+ end_point = ghb_dict_get_int(settings, "end_point");
+ vol_name = ghb_dict_get_string(settings, "volume_label");
+ dest = ghb_dict_get_string(settings, "destination");
basename = g_path_get_basename(dest);
escape = g_markup_escape_text(basename, -1);
escape2 = g_markup_escape_text(vol_name, -1);
- vqtype = ghb_settings_get_boolean(settings, "vquality_type_constant");
- two_pass = ghb_settings_get_boolean(settings, "VideoTwoPass");
+ vqtype = ghb_dict_get_bool(settings, "vquality_type_constant");
+ two_pass = ghb_dict_get_bool(settings, "VideoTwoPass");
const gchar *points = _("Chapters");
if (ghb_settings_combo_int(settings, "PtoPType") == 0)
@@ -141,7 +141,7 @@ add_to_queue_list(signal_user_data_t *ud, GhbValue *settings, GtkTreeIter *piter
}
// Set the job status icon
- status = ghb_settings_get_int(settings, "job_status");
+ status = ghb_dict_get_int(settings, "job_status");
const char *status_icon;
switch (status)
{
@@ -176,13 +176,13 @@ add_to_queue_list(signal_user_data_t *ud, GhbValue *settings, GtkTreeIter *piter
const char *mux_id;
const hb_container_t *mux;
- mux_id = ghb_settings_get_const_string(settings, "FileFormat");
+ mux_id = ghb_dict_get_string(settings, "FileFormat");
mux = ghb_lookup_container_by_name(mux_id);
- preset_modified = ghb_settings_get_boolean(settings, "preset_modified");
- path = ghb_settings_get_value(settings, "preset");
+ preset_modified = ghb_dict_get_bool(settings, "preset_modified");
+ path = ghb_dict_get_value(settings, "preset");
preset = ghb_preset_path_string(path);
- markers = ghb_settings_get_boolean(settings, "ChapterMarkers");
+ markers = ghb_dict_get_bool(settings, "ChapterMarkers");
if (preset_modified)
{
@@ -203,8 +203,8 @@ add_to_queue_list(signal_user_data_t *ud, GhbValue *settings, GtkTreeIter *piter
gboolean ipod = FALSE, http = FALSE;
if (mux->format & HB_MUX_MASK_MP4)
{
- ipod = ghb_settings_get_boolean(settings, "Mp4iPodCompatible");
- http = ghb_settings_get_boolean(settings, "Mp4HttpOptimize");
+ ipod = ghb_dict_get_bool(settings, "Mp4iPodCompatible");
+ http = ghb_dict_get_bool(settings, "Mp4HttpOptimize");
}
if (http || ipod || markers)
{
@@ -240,14 +240,14 @@ add_to_queue_list(signal_user_data_t *ud, GhbValue *settings, GtkTreeIter *piter
int crop[4];
gboolean keep_aspect;
- width = ghb_settings_get_int(settings, "scale_width");
- height = ghb_settings_get_int(settings, "scale_height");
- pic_par = ghb_settings_get_int(settings, "PicturePAR");
- keep_aspect = ghb_settings_get_boolean(settings, "PictureKeepRatio");
- crop[0] = ghb_settings_get_int(settings, "PictureTopCrop");
- crop[1] = ghb_settings_get_int(settings, "PictureBottomCrop");
- crop[2] = ghb_settings_get_int(settings, "PictureLeftCrop");
- crop[3] = ghb_settings_get_int(settings, "PictureRightCrop");
+ width = ghb_dict_get_int(settings, "scale_width");
+ height = ghb_dict_get_int(settings, "scale_height");
+ pic_par = ghb_dict_get_int(settings, "PicturePAR");
+ keep_aspect = ghb_dict_get_bool(settings, "PictureKeepRatio");
+ crop[0] = ghb_dict_get_int(settings, "PictureTopCrop");
+ crop[1] = ghb_dict_get_int(settings, "PictureBottomCrop");
+ crop[2] = ghb_dict_get_int(settings, "PictureLeftCrop");
+ crop[3] = ghb_dict_get_int(settings, "PictureRightCrop");
gchar *aspect_desc;
switch (pic_par)
@@ -286,8 +286,8 @@ add_to_queue_list(signal_user_data_t *ud, GhbValue *settings, GtkTreeIter *piter
}
gint source_width, source_height;
- source_width = ghb_settings_get_int(settings, "source_width");
- source_height = ghb_settings_get_int(settings, "source_height");
+ source_width = ghb_dict_get_int(settings, "source_width");
+ source_height = ghb_dict_get_int(settings, "source_height");
XPRINT(_("<b>Picture:</b> <small>"));
XPRINT(_("Source: %d x %d, Output %d x %d %s, Crop %d:%d:%d:%d"),
source_width, source_height, width, height, aspect_desc,
@@ -295,8 +295,8 @@ add_to_queue_list(signal_user_data_t *ud, GhbValue *settings, GtkTreeIter *piter
if (pic_par)
{
int display_width, display_height;
- display_width = ghb_settings_get_int(settings, "PictureDisplayWidth");
- display_height = ghb_settings_get_int(settings, "PictureDisplayHeight");
+ display_width = ghb_dict_get_int(settings, "PictureDisplayWidth");
+ display_height = ghb_dict_get_int(settings, "PictureDisplayHeight");
XPRINT(_(", Display %d x %d"),
display_width, display_height);
}
@@ -312,26 +312,26 @@ add_to_queue_list(signal_user_data_t *ud, GhbValue *settings, GtkTreeIter *piter
gboolean grayscale;
gboolean filters;
- decomb_deint = ghb_settings_get_boolean(settings, "PictureDecombDeinterlace");
+ decomb_deint = ghb_dict_get_bool(settings, "PictureDecombDeinterlace");
decomb = ghb_settings_combo_int(settings, "PictureDecomb");
decomb_opt = ghb_settings_combo_option(settings, "PictureDecomb");
- decomb_cust = ghb_settings_get_const_string(settings,
+ decomb_cust = ghb_dict_get_string(settings,
"PictureDecombCustom");
deint = ghb_settings_combo_int(settings, "PictureDeinterlace");
deint_opt = ghb_settings_combo_option(settings, "PictureDeinterlace");
- deint_cust = ghb_settings_get_const_string(settings,
+ deint_cust = ghb_dict_get_string(settings,
"PictureDeinterlaceCustom");
detel = ghb_settings_combo_int(settings, "PictureDetelecine");
- detel_cust = ghb_settings_get_const_string(settings,
+ detel_cust = ghb_dict_get_string(settings,
"PictureDetelecineCustom");
- deblock = ghb_settings_get_int(settings, "PictureDeblock");
+ deblock = ghb_dict_get_int(settings, "PictureDeblock");
denoise = ghb_settings_combo_int(settings, "PictureDenoiseFilter");
denoise_opt = ghb_settings_combo_option(settings, "PictureDenoiseFilter");
denoise_preset = ghb_settings_combo_option(settings, "PictureDenoisePreset");
denoise_tune = ghb_settings_combo_option(settings, "PictureDenoiseTune");
- denoise_cust = ghb_settings_get_const_string(settings,
+ denoise_cust = ghb_dict_get_string(settings,
"PictureDenoiseCustom");
- grayscale = ghb_settings_get_boolean(settings, "VideoGrayScale");
+ grayscale = ghb_dict_get_bool(settings, "VideoGrayScale");
filters = detel || (decomb_deint && decomb) || (!decomb_deint && deint) ||
denoise || (deblock >= 5) || grayscale;
@@ -416,7 +416,7 @@ add_to_queue_list(signal_user_data_t *ud, GhbValue *settings, GtkTreeIter *piter
if (fps->rate == 0)
{
const char *rate_mode;
- if (ghb_settings_get_boolean(settings, "VideoFramerateCFR"))
+ if (ghb_dict_get_bool(settings, "VideoFramerateCFR"))
rate_mode = _("(constant)");
else
rate_mode = _("(variable)");
@@ -424,7 +424,7 @@ add_to_queue_list(signal_user_data_t *ud, GhbValue *settings, GtkTreeIter *piter
}
else
{
- if (ghb_settings_get_boolean(settings, "VideoFrameratePFR"))
+ if (ghb_dict_get_bool(settings, "VideoFrameratePFR"))
{
XPRINT(_(", Framerate: Peak %s (may be lower)"), fps->name);
}
@@ -439,7 +439,7 @@ add_to_queue_list(signal_user_data_t *ud, GhbValue *settings, GtkTreeIter *piter
if (!vqtype)
{
// Has to be bitrate
- vqvalue = ghb_settings_get_int(settings, "VideoAvgBitrate");
+ vqvalue = ghb_dict_get_int(settings, "VideoAvgBitrate");
vq_desc = _("Bitrate:");
vq_units = _("kbps");
XPRINT(", %s %d%s",
@@ -448,7 +448,7 @@ add_to_queue_list(signal_user_data_t *ud, GhbValue *settings, GtkTreeIter *piter
else
{
// Constant quality
- vqvalue = ghb_settings_get_double(settings, "VideoQualitySlider");
+ vqvalue = ghb_dict_get_double(settings, "VideoQualitySlider");
vq_desc = _("Constant Quality:");
vq_units = hb_video_quality_get_name(video_encoder->codec);
XPRINT(", %s %.4g(%s)",
@@ -458,7 +458,7 @@ add_to_queue_list(signal_user_data_t *ud, GhbValue *settings, GtkTreeIter *piter
// Next line in the display (Turbo setting)
gboolean turbo;
- turbo = ghb_settings_get_boolean(settings, "VideoTurboTwoPass");
+ turbo = ghb_dict_get_bool(settings, "VideoTurboTwoPass");
if (!vqtype && two_pass && turbo)
{
XPRINT(_("<b>Turbo 1st Pass:</b> <small>On</small>\n"));
@@ -467,7 +467,7 @@ add_to_queue_list(signal_user_data_t *ud, GhbValue *settings, GtkTreeIter *piter
// Next line in the display (Video Encoder Options)
// Video Options: Preset - Tune - Profile - Level
if (video_encoder->codec == HB_VCODEC_X264 &&
- !ghb_settings_get_boolean(settings, "x264UseAdvancedOptions"))
+ !ghb_dict_get_bool(settings, "x264UseAdvancedOptions"))
{
const gchar *extra_opt = NULL;
@@ -478,13 +478,13 @@ add_to_queue_list(signal_user_data_t *ud, GhbValue *settings, GtkTreeIter *piter
const gchar *profile_opt, *level_opt;
gboolean fastdecode, zerolatency;
- preset_opt = ghb_settings_get_const_string(settings, "VideoPreset");
- tune_opt = ghb_settings_get_const_string(settings, "VideoTune");
- fastdecode = ghb_settings_get_boolean(settings, "x264FastDecode");
- zerolatency = ghb_settings_get_boolean(settings, "x264ZeroLatency");
- profile_opt = ghb_settings_get_const_string(settings, "VideoProfile");
- level_opt = ghb_settings_get_const_string(settings, "VideoLevel");
- extra_opt = ghb_settings_get_const_string(settings, "VideoOptionExtra");
+ preset_opt = ghb_dict_get_string(settings, "VideoPreset");
+ tune_opt = ghb_dict_get_string(settings, "VideoTune");
+ fastdecode = ghb_dict_get_bool(settings, "x264FastDecode");
+ zerolatency = ghb_dict_get_bool(settings, "x264ZeroLatency");
+ profile_opt = ghb_dict_get_string(settings, "VideoProfile");
+ level_opt = ghb_dict_get_string(settings, "VideoLevel");
+ extra_opt = ghb_dict_get_string(settings, "VideoOptionExtra");
XPRINT(_("<b>Video Options:</b> <small>Preset: %s</small>"), preset_opt);
if ((tune_opt != NULL && tune_opt[0] != 0) || zerolatency || fastdecode)
@@ -533,12 +533,11 @@ add_to_queue_list(signal_user_data_t *ud, GhbValue *settings, GtkTreeIter *piter
{
// Next line in the display (Video Encoder Options)
// Video Advanced Options: detailed settings
- gchar *opts = ghb_build_advanced_opts_string(settings);
+ const gchar *opts = ghb_build_advanced_opts_string(settings);
if (opts != NULL && opts[0] != 0)
{
XPRINT(_("<b>Advanced Options:</b> <small>%s</small>\n"), opts);
}
- g_free(opts);
}
// Next line in the display (Audio)
@@ -548,7 +547,7 @@ add_to_queue_list(signal_user_data_t *ud, GhbValue *settings, GtkTreeIter *piter
gint count, ii;
const GhbValue *audio_list;
- audio_list = ghb_settings_get_value(settings, "audio_list");
+ audio_list = ghb_dict_get_value(settings, "audio_list");
count = ghb_array_len(audio_list);
if (count == 1)
{
@@ -560,15 +559,16 @@ add_to_queue_list(signal_user_data_t *ud, GhbValue *settings, GtkTreeIter *piter
}
for (ii = 0; ii < count; ii++)
{
- gchar *quality = NULL, *track;
+ const gchar *track;
+ gchar *quality = NULL;
GhbValue *asettings;
const hb_encoder_t *audio_encoder;
asettings = ghb_array_get(audio_list, ii);
audio_encoder = ghb_settings_audio_encoder(asettings, "AudioEncoder");
- double q = ghb_settings_get_double(asettings, "AudioTrackQuality");
- if (ghb_settings_get_boolean(asettings, "AudioTrackQualityEnable") &&
+ double q = ghb_dict_get_double(asettings, "AudioTrackQuality");
+ if (ghb_dict_get_bool(asettings, "AudioTrackQualityEnable") &&
q != HB_INVALID_AUDIO_QUALITY)
{
quality = ghb_format_quality(_("Quality: "), audio_encoder->codec, q);
@@ -580,7 +580,7 @@ add_to_queue_list(signal_user_data_t *ud, GhbValue *settings, GtkTreeIter *piter
}
const hb_rate_t *sr;
sr = ghb_settings_audio_samplerate(asettings, "AudioSamplerate");
- track = ghb_settings_get_string(asettings, "AudioTrackDescription");
+ track = ghb_dict_get_string(asettings, "AudioTrackDescription");
const hb_mixdown_t *mix;
mix = ghb_settings_mixdown(asettings, "AudioMixdown");
if (count > 1)
@@ -595,7 +595,6 @@ add_to_queue_list(signal_user_data_t *ud, GhbValue *settings, GtkTreeIter *piter
XPRINT(_("%s --> Encoder: %s, Mixdown: %s, SampleRate: %s, %s"),
track, audio_encoder->name, mix->name, sr->name, quality);
}
- g_free(track);
g_free(quality);
}
if (count > 0)
@@ -609,7 +608,7 @@ add_to_queue_list(signal_user_data_t *ud, GhbValue *settings, GtkTreeIter *piter
// ...
const GhbValue *sub_list;
- sub_list = ghb_settings_get_value(settings, "subtitle_list");
+ sub_list = ghb_dict_get_value(settings, "subtitle_list");
count = ghb_array_len(sub_list);
if (count == 1)
{
@@ -622,16 +621,16 @@ add_to_queue_list(signal_user_data_t *ud, GhbValue *settings, GtkTreeIter *piter
for (ii = 0; ii < count; ii++)
{
GhbValue *settings;
- gchar *track;
+ const gchar *track;
gboolean force, burn, def;
gint source;
settings = ghb_array_get(sub_list, ii);
- track = ghb_settings_get_string(settings, "SubtitleTrackDescription");
- source = ghb_settings_get_int(settings, "SubtitleSource");
- force = ghb_settings_get_boolean(settings, "SubtitleForced");
- burn = ghb_settings_get_boolean(settings, "SubtitleBurned");
- def = ghb_settings_get_boolean(settings, "SubtitleDefaultTrack");
+ track = ghb_dict_get_string(settings, "SubtitleTrackDescription");
+ source = ghb_dict_get_int(settings, "SubtitleSource");
+ force = ghb_dict_get_bool(settings, "SubtitleForced");
+ burn = ghb_dict_get_bool(settings, "SubtitleBurned");
+ def = ghb_dict_get_bool(settings, "SubtitleDefaultTrack");
if (count > 1)
XPRINT("\t");
@@ -646,21 +645,19 @@ add_to_queue_list(signal_user_data_t *ud, GhbValue *settings, GtkTreeIter *piter
else
{
gint offset;
- gchar *filename, *basename, *code;
+ const gchar *filename, *code;
+ gchar *basename;
- offset = ghb_settings_get_int(settings, "SrtOffset");
- filename = ghb_settings_get_string(settings, "SrtFile");
+ offset = ghb_dict_get_int(settings, "SrtOffset");
+ filename = ghb_dict_get_string(settings, "SrtFile");
basename = g_path_get_basename(filename);
- code = ghb_settings_get_string(settings, "SrtCodeset");
+ code = ghb_dict_get_string(settings, "SrtCodeset");
XPRINT(_("<small> %s (%s), %s, Offset (ms) %d%s</small>\n"),
track, code, basename, offset, def ? " (Default)":"");
- g_free(filename);
g_free(basename);
- g_free(code);
}
- g_free(track);
}
// Remove the final newline in the string
@@ -705,7 +702,7 @@ ghb_update_status(signal_user_data_t *ud, int status, int index)
if (settings == NULL) // should never happen
return;
- if (ghb_settings_get_int(settings, "job_status") == GHB_QUEUE_RUNNING)
+ if (ghb_dict_get_int(settings, "job_status") == GHB_QUEUE_RUNNING)
return; // Never change the status of currently running jobs
GtkTreeView *treeview;
@@ -721,7 +718,7 @@ ghb_update_status(signal_user_data_t *ud, int status, int index)
}
g_free(path);
- ghb_settings_set_int(settings, "job_status", status);
+ ghb_dict_set_int(settings, "job_status", status);
}
void
@@ -748,7 +745,7 @@ save_queue_file(signal_user_data_t *ud)
GhbValue *settings = ghb_array_get(ud->queue, ii);
if (settings == NULL)
continue;
- ghb_settings_set_int(settings, "job_status", GHB_QUEUE_PENDING);
+ ghb_dict_set_int(settings, "job_status", GHB_QUEUE_PENDING);
}
GtkWidget *dialog;
@@ -824,8 +821,8 @@ open_queue_file(signal_user_data_t *ud)
GhbValue *settings = ghb_array_get(queue, ii);
ghb_value_incref(settings);
ghb_array_remove(queue, ii);
- ghb_settings_set_int(settings, "job_status", GHB_QUEUE_PENDING);
- ghb_settings_set_int(settings, "job_unique_id", 0);
+ ghb_dict_set_int(settings, "job_status", GHB_QUEUE_PENDING);
+ ghb_dict_set_int(settings, "job_unique_id", 0);
if (ud->queue == NULL)
ud->queue = ghb_array_new();
@@ -904,10 +901,10 @@ validate_settings(signal_user_data_t *ud, GhbValue *settings, gint batch)
hb_window = GTK_WINDOW(GHB_WIDGET(ud->builder, "hb_window"));
- title_id = ghb_settings_get_int(settings, "title");
+ title_id = ghb_dict_get_int(settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
if (title == NULL) return FALSE;
- dest = ghb_settings_get_const_string(settings, "destination");
+ dest = ghb_dict_get_string(settings, "destination");
count = ghb_array_len(ud->queue);
for (ii = 0; ii < count; ii++)
{
@@ -915,7 +912,7 @@ validate_settings(signal_user_data_t *ud, GhbValue *settings, gint batch)
const gchar *filename;
js = ghb_array_get(ud->queue, ii);
- filename = ghb_settings_get_const_string(js, "destination");
+ filename = ghb_dict_get_string(js, "destination");
if (strcmp(dest, filename) == 0)
{
message = g_strdup_printf(
@@ -1056,11 +1053,11 @@ queue_add(signal_user_data_t *ud, GhbValue *settings, gint batch)
// Copy current prefs into settings
// The job should run with the preferences that existed
// when the job was added to the queue.
- ghb_settings_set_value(settings, "Preferences", ud->prefs);
+ ghb_dict_set(settings, "Preferences", ghb_value_dup(ud->prefs));
// Make a copy of current settings to be used for the new job
- ghb_settings_set_int(settings, "job_status", GHB_QUEUE_PENDING);
- ghb_settings_set_int(settings, "job_unique_id", 0);
+ ghb_dict_set_int(settings, "job_status", GHB_QUEUE_PENDING);
+ ghb_dict_set_int(settings, "job_unique_id", 0);
ghb_array_append(ud->queue, settings);
add_to_queue_list(ud, settings, NULL);
@@ -1090,7 +1087,7 @@ title_multiple_can_select(GhbValue *settings_array, int index)
const char *dest;
settings = ghb_array_get(settings_array, index);
- gdest = ghb_settings_get_value(settings, "destination");
+ gdest = ghb_dict_get_value(settings, "destination");
dest = ghb_value_get_string(gdest);
if (dest == NULL)
return FALSE;
@@ -1102,7 +1099,7 @@ title_multiple_can_select(GhbValue *settings_array, int index)
const char *tmp;
settings = ghb_array_get(settings_array, ii);
- gdest = ghb_settings_get_value(settings, "destination");
+ gdest = ghb_dict_get_value(settings, "destination");
tmp = ghb_value_get_string(gdest);
if (tmp != NULL && !strncmp(dest, tmp, PATH_MAX))
return FALSE;
@@ -1251,7 +1248,7 @@ title_add_multiple_check_conflicts(signal_user_data_t *ud)
settings = ghb_array_get(ud->settings_array, ii);
can_select = title_multiple_can_select(ud->settings_array, ii);
- ghb_settings_set_boolean(settings, "title_selected", FALSE);
+ ghb_dict_set_bool(settings, "title_selected", FALSE);
gtk_toggle_button_set_active(selected, FALSE);
title_add_multiple_set_sensitive(GTK_WIDGET(row), can_select);
are_conflicts |= !can_select;
@@ -1294,7 +1291,7 @@ title_add_multiple_select_all_cb(GtkWidget *widget, signal_user_data_t *ud)
selected = GTK_TOGGLE_BUTTON(find_widget(row, "title_selected"));
settings = ghb_array_get(ud->settings_array, ii);
can_select = title_multiple_can_select(ud->settings_array, ii);
- ghb_settings_set_boolean(settings, "title_selected", can_select);
+ ghb_dict_set_bool(settings, "title_selected", can_select);
gtk_toggle_button_set_active(selected, TRUE);
title_add_multiple_set_sensitive(GTK_WIDGET(row), can_select);
}
@@ -1332,7 +1329,7 @@ title_add_multiple_clear_all_cb(GtkWidget *widget, signal_user_data_t *ud)
row = GTK_WIDGET(gtk_list_box_get_row_at_index(list, ii));
selected = GTK_TOGGLE_BUTTON(find_widget(row, "title_selected"));
settings = ghb_array_get(ud->settings_array, ii);
- ghb_settings_set_boolean(settings, "title_selected", FALSE);
+ ghb_dict_set_bool(settings, "title_selected", FALSE);
gtk_toggle_button_set_active(selected, FALSE);
}
clear_select_all_busy = FALSE;
@@ -1349,7 +1346,7 @@ add_multiple_titles(signal_user_data_t *ud)
GhbValue *settings;
settings = ghb_value_dup(ghb_array_get(ud->settings_array, ii));
- if (ghb_settings_get_boolean(settings, "title_selected"))
+ if (ghb_dict_get_bool(settings, "title_selected"))
{
queue_add(ud, settings, ii);
}
@@ -1395,7 +1392,7 @@ title_selected_cb(GtkWidget *widget, signal_user_data_t *ud)
selected = ghb_widget_boolean(widget);
settings = ghb_array_get(ud->settings_array, index);
can_select = title_multiple_can_select(ud->settings_array, index);
- ghb_settings_set_boolean(settings, "title_selected",
+ ghb_dict_set_bool(settings, "title_selected",
selected && can_select);
}
@@ -1403,7 +1400,8 @@ G_MODULE_EXPORT void
title_dest_file_cb(GtkWidget *widget, signal_user_data_t *ud)
{
GhbValue *settings;
- gchar *dest_file, *dest_dir, *dest;
+ const gchar *dest_dir;
+ gchar *dest_file, *dest;
GtkListBoxRow * row = title_get_row(widget);
if (row == NULL)
return;
@@ -1412,21 +1410,20 @@ title_dest_file_cb(GtkWidget *widget, signal_user_data_t *ud)
dest_file = ghb_widget_string(widget);
settings = ghb_array_get(ud->settings_array, index);
- ghb_settings_set_string(settings, "dest_file", dest_file);
- dest_dir = ghb_settings_get_string(settings, "dest_dir");
+ ghb_dict_set_string(settings, "dest_file", dest_file);
+ dest_dir = ghb_dict_get_string(settings, "dest_dir");
dest = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", dest_dir, dest_file);
- ghb_settings_set_string(settings, "destination", dest);
+ ghb_dict_set_string(settings, "destination", dest);
// Check if changing the destination file name resolves
// a file name conflict. Enable selection if so.
// Disable selection if it creates a confict!!!
gboolean can_select;
can_select = title_multiple_can_select(ud->settings_array, index);
- ghb_settings_set_boolean(settings, "title_selected", can_select);
+ ghb_dict_set_bool(settings, "title_selected", can_select);
title_add_multiple_set_sensitive(GTK_WIDGET(row), can_select);
g_free(dest_file);
- g_free(dest_dir);
g_free(dest);
title_add_multiple_set_conflict_label(ud,
@@ -1437,7 +1434,8 @@ G_MODULE_EXPORT void
title_dest_dir_cb(GtkWidget *widget, signal_user_data_t *ud)
{
GhbValue *settings;
- gchar *dest_file, *dest_dir, *dest;
+ const gchar *dest_file;
+ gchar *dest_dir, *dest;
GtkListBoxRow * row = title_get_row(widget);
if (row == NULL)
return;
@@ -1446,20 +1444,19 @@ title_dest_dir_cb(GtkWidget *widget, signal_user_data_t *ud)
dest_dir = ghb_widget_string(widget);
settings = ghb_array_get(ud->settings_array, index);
- ghb_settings_set_string(settings, "dest_dir", dest_dir);
- dest_file = ghb_settings_get_string(settings, "dest_file");
+ ghb_dict_set_string(settings, "dest_dir", dest_dir);
+ dest_file = ghb_dict_get_string(settings, "dest_file");
dest = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", dest_dir, dest_file);
- ghb_settings_set_string(settings, "destination", dest);
+ ghb_dict_set_string(settings, "destination", dest);
// Check if changing the destination file name resolves
// a file name conflict. Enable selection if so.
// Disable selection if it creates a confict!!!
gboolean can_select;
can_select = title_multiple_can_select(ud->settings_array, index);
- ghb_settings_set_boolean(settings, "title_selected", can_select);
+ ghb_dict_set_bool(settings, "title_selected", can_select);
title_add_multiple_set_sensitive(GTK_WIDGET(row), can_select);
- g_free(dest_file);
g_free(dest_dir);
g_free(dest);
@@ -1550,7 +1547,8 @@ queue_add_multiple_clicked_cb(GtkWidget *widget, signal_user_data_t *ud)
GtkLabel *label;
GtkEntry *entry;
GtkFileChooser *chooser;
- gchar *title_label, *dest_dir, *dest_file;
+ gchar *title_label;
+ const gchar *dest_dir, *dest_file;
int title_id, titleindex;
const hb_title_t *title;
@@ -1560,7 +1558,7 @@ queue_add_multiple_clicked_cb(GtkWidget *widget, signal_user_data_t *ud)
chooser = GTK_FILE_CHOOSER(find_widget(row, "title_dir"));
settings = ghb_array_get(ud->settings_array, ii);
- title_id = ghb_settings_get_int(settings, "title");
+ title_id = ghb_dict_get_int(settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
if (title != NULL)
{
@@ -1571,16 +1569,14 @@ queue_add_multiple_clicked_cb(GtkWidget *widget, signal_user_data_t *ud)
if (len > max_title_len)
max_title_len = len;
- dest_file = ghb_settings_get_string(settings, "dest_file");
- dest_dir = ghb_settings_get_string(settings, "dest_dir");
+ dest_file = ghb_dict_get_string(settings, "dest_file");
+ dest_dir = ghb_dict_get_string(settings, "dest_dir");
gtk_label_set_markup(label, title_label);
gtk_entry_set_text(entry, dest_file);
gtk_file_chooser_set_filename(chooser, dest_dir);
g_free(title_label);
- g_free(dest_file);
- g_free(dest_dir);
}
gtk_list_box_insert(list, row, -1);
@@ -1661,7 +1657,7 @@ queue_remove_clicked_cb(GtkWidget *widget, gchar *path, signal_user_data_t *ud)
if (row >= ghb_array_len(ud->queue))
return;
settings = ghb_array_get(ud->queue, row);
- status = ghb_settings_get_int(settings, "job_status");
+ status = ghb_dict_get_int(settings, "job_status");
if (status == GHB_QUEUE_RUNNING)
{
// Ask if wants to stop encode.
@@ -1669,7 +1665,7 @@ queue_remove_clicked_cb(GtkWidget *widget, gchar *path, signal_user_data_t *ud)
{
return;
}
- unique_id = ghb_settings_get_int(settings, "job_unique_id");
+ unique_id = ghb_dict_get_int(settings, "job_unique_id");
ghb_remove_job(unique_id);
}
// Remove the selected item
@@ -1697,7 +1693,7 @@ find_last_finished(GhbValue *queue)
for (ii = 0; ii < count; ii++)
{
js = ghb_array_get(queue, ii);
- status = ghb_settings_get_int(js, "job_status");
+ status = ghb_dict_get_int(js, "job_status");
if (status != GHB_QUEUE_DONE && status != GHB_QUEUE_RUNNING)
{
return ii-1;
@@ -1743,7 +1739,7 @@ queue_drag_motion_cb(
row = indices[0];
gtk_tree_path_free(path);
js = ghb_array_get(ud->queue, row);
- status = ghb_settings_get_int(js, "job_status");
+ status = ghb_dict_get_int(js, "job_status");
if (status != GHB_QUEUE_PENDING && status != GHB_QUEUE_CANCELED)
{
gdk_drag_status(ctx, 0, time);
@@ -1875,7 +1871,7 @@ queue_drag_cb(
break;
}
// Reset job to pending
- ghb_settings_set_int(js, "job_status", GHB_QUEUE_PENDING);
+ ghb_dict_set_int(js, "job_status", GHB_QUEUE_PENDING);
add_to_queue_list(ud, js, &iter);
dstpath = gtk_tree_model_get_path (dstmodel, &iter);
@@ -1908,7 +1904,7 @@ ghb_queue_buttons_grey(signal_user_data_t *ud)
gboolean show_start, show_stop, paused;
queue_count = ghb_array_len(ud->queue);
- title_id = ghb_settings_get_int(ud->settings, "title");
+ title_id = ghb_dict_get_int(ud->settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
queue_state = ghb_get_queue_state();
@@ -2028,7 +2024,7 @@ queue_start_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
for (ii = 0; ii < count; ii++)
{
js = ghb_array_get(ud->queue, ii);
- status = ghb_settings_get_int(js, "job_status");
+ status = ghb_dict_get_int(js, "job_status");
if ((status == GHB_QUEUE_RUNNING) ||
(status == GHB_QUEUE_PENDING))
{
@@ -2087,7 +2083,7 @@ find_pid:
for (ii = 0; ii < count; ii++)
{
settings = ghb_array_get(queue, ii);
- status = ghb_settings_get_int(settings, "job_status");
+ status = ghb_dict_get_int(settings, "job_status");
if (status != GHB_QUEUE_DONE && status != GHB_QUEUE_CANCELED)
{
unfinished++;
@@ -2115,7 +2111,7 @@ find_pid:
for (ii = count-1; ii >= 0; ii--)
{
settings = ghb_array_get(queue, ii);
- status = ghb_settings_get_int(settings, "job_status");
+ status = ghb_dict_get_int(settings, "job_status");
if (status == GHB_QUEUE_DONE || status == GHB_QUEUE_CANCELED)
{
ghb_array_remove(queue, ii);
@@ -2125,8 +2121,8 @@ find_pid:
for (ii = 0; ii < count; ii++)
{
settings = ghb_array_get(queue, ii);
- ghb_settings_set_int(settings, "job_unique_id", 0);
- ghb_settings_set_int(settings, "job_status", GHB_QUEUE_PENDING);
+ ghb_dict_set_int(settings, "job_unique_id", 0);
+ ghb_dict_set_int(settings, "job_status", GHB_QUEUE_PENDING);
add_to_queue_list(ud, settings, NULL);
}
ghb_queue_buttons_grey(ud);
@@ -2204,7 +2200,7 @@ queue_key_press_cb(
if (row >= ghb_array_len(ud->queue))
return FALSE;
settings = ghb_array_get(ud->queue, row);
- status = ghb_settings_get_int(settings, "job_status");
+ status = ghb_dict_get_int(settings, "job_status");
if (status == GHB_QUEUE_RUNNING)
{
// Ask if wants to stop encode.
@@ -2212,7 +2208,7 @@ queue_key_press_cb(
{
return TRUE;
}
- unique_id = ghb_settings_get_int(settings, "job_unique_id");
+ unique_id = ghb_dict_get_int(settings, "job_unique_id");
ghb_remove_job(unique_id);
}
// Remove the selected item
@@ -2258,7 +2254,7 @@ queue_edit_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
if (row >= ghb_array_len(ud->queue))
return;
ghb_queue_edit_settings = ghb_array_get(ud->queue, row);
- status = ghb_settings_get_int(ghb_queue_edit_settings, "job_status");
+ status = ghb_dict_get_int(ghb_queue_edit_settings, "job_status");
if (status == GHB_QUEUE_PENDING)
{
// Remove the selected item
@@ -2271,10 +2267,9 @@ queue_edit_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
ghb_queue_edit_settings = ghb_value_dup(ghb_queue_edit_settings);
}
- gchar *source;
- source = ghb_settings_get_string(ghb_queue_edit_settings, "source");
+ const gchar *source;
+ source = ghb_dict_get_string(ghb_queue_edit_settings, "source");
ghb_do_scan(ud, source, 0, FALSE);
- g_free(source);
GtkWidget *widget = GHB_WIDGET(ud->builder, "show_queue");
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), FALSE);
diff --git a/gtk/src/settings.c b/gtk/src/settings.c
index 31d66f5f8..9349015a4 100644
--- a/gtk/src/settings.c
+++ b/gtk/src/settings.c
@@ -31,157 +31,22 @@ debug_get_object(GtkBuilder* b, const gchar *n)
return gtk_builder_get_object(b, n);
}
-GhbValue*
-ghb_settings_new()
-{
- return ghb_dict_new();
-}
-
-void
-ghb_settings_set_value(
- GhbValue *settings,
- const gchar *key,
- const GhbValue *value)
-{
- if (key == NULL || value == NULL)
- return;
- ghb_dict_set(settings, key, ghb_value_dup(value));
-}
-
-void
-ghb_settings_take_value(GhbValue *settings, const gchar *key, GhbValue *value)
-{
- ghb_dict_set(settings, key, value);
-}
-
-void
-ghb_settings_set_string(
- GhbValue *settings,
- const gchar *key,
- const gchar *sval)
-{
- GhbValue *value;
- value = ghb_string_value_new(sval);
- ghb_dict_set(settings, key, value);
-}
-
-void
-ghb_settings_set_double(GhbValue *settings, const gchar *key, gdouble dval)
-{
- GhbValue *value;
- value = ghb_double_value_new(dval);
- ghb_dict_set(settings, key, value);
-}
-
-void
-ghb_settings_set_int64(GhbValue *settings, const gchar *key, gint64 ival)
-{
- GhbValue *value;
- value = ghb_int_value_new(ival);
- ghb_dict_set(settings, key, value);
-}
-
-void
-ghb_settings_set_int(GhbValue *settings, const gchar *key, gint ival)
-{
- GhbValue *value;
- value = ghb_int_value_new((gint64)ival);
- ghb_dict_set(settings, key, value);
-}
-
-void
-ghb_settings_set_boolean(GhbValue *settings, const gchar *key, gboolean bval)
-{
- GhbValue *value;
- value = ghb_bool_value_new(bval);
- ghb_dict_set(settings, key, value);
-}
-
-GhbValue*
-ghb_settings_get_value(const GhbValue *settings, const gchar *key)
-{
- GhbValue *value;
- value = ghb_dict_get(settings, key);
- if (value == NULL)
- g_debug("returning null (%s)", key);
- return value;
-}
-
-gboolean
-ghb_settings_get_boolean(const GhbValue *settings, const gchar *key)
-{
- const GhbValue* value;
- value = ghb_settings_get_value(settings, key);
- if (value == NULL) return FALSE;
- return ghb_value_get_bool(value);
-}
-
-gint64
-ghb_settings_get_int64(const GhbValue *settings, const gchar *key)
-{
- const GhbValue* value;
- value = ghb_settings_get_value(settings, key);
- if (value == NULL) return 0;
- return ghb_value_get_int(value);
-}
-
-gint
-ghb_settings_get_int(const GhbValue *settings, const gchar *key)
-{
- const GhbValue* value;
- value = ghb_settings_get_value(settings, key);
- if (value == NULL) return 0;
- return ghb_value_get_int(value);
-}
-
-gdouble
-ghb_settings_get_double(const GhbValue *settings, const gchar *key)
-{
- const GhbValue* value;
- value = ghb_settings_get_value(settings, key);
- if (value == NULL) return 0;
- return ghb_value_get_double(value);
-}
-
-const gchar*
-ghb_settings_get_const_string(const GhbValue *settings, const gchar *key)
-{
- const GhbValue* value;
- value = ghb_settings_get_value(settings, key);
- return ghb_value_get_string(value);
-}
-
-gchar*
-ghb_settings_get_string(const GhbValue *settings, const gchar *key)
-{
- const GhbValue* value;
- value = ghb_settings_get_value(settings, key);
- if (value == NULL) return g_strdup("");
- return ghb_value_get_string_xform(value);
-}
-
gint
ghb_settings_combo_int(const GhbValue *settings, const gchar *key)
{
- return ghb_lookup_combo_int(key, ghb_settings_get_value(settings, key));
+ return ghb_lookup_combo_int(key, ghb_dict_get_value(settings, key));
}
gdouble
ghb_settings_combo_double(const GhbValue *settings, const gchar *key)
{
- return ghb_lookup_combo_double(key, ghb_settings_get_value(settings, key));
+ return ghb_lookup_combo_double(key, ghb_dict_get_value(settings, key));
}
const gchar*
ghb_settings_combo_option(const GhbValue *settings, const gchar *key)
{
- return ghb_lookup_combo_option(key, ghb_settings_get_value(settings, key));
-}
-
-const gchar*
-ghb_settings_combo_string(const GhbValue *settings, const gchar *key)
-{
- return ghb_lookup_combo_string(key, ghb_settings_get_value(settings, key));
+ return ghb_lookup_combo_option(key, ghb_dict_get_value(settings, key));
}
// Map widget names to setting keys
@@ -434,7 +299,7 @@ ghb_widget_to_setting(GhbValue *settings, GtkWidget *widget)
value = ghb_widget_value(widget);
if (value != NULL)
{
- ghb_settings_take_value(settings, key, value);
+ ghb_dict_set(settings, key, value);
}
else
{
@@ -632,7 +497,7 @@ ghb_ui_update_from_settings(signal_user_data_t *ud, const gchar *name, const Ghb
g_debug("ghb_ui_update_from_settings() %s", name);
if (name == NULL)
return 0;
- value = ghb_settings_get_value(settings, name);
+ value = ghb_dict_get_value(settings, name);
if (value == NULL)
return 0;
object = GHB_OBJECT(ud->builder, name);
diff --git a/gtk/src/settings.h b/gtk/src/settings.h
index 895e4fbe6..98e413492 100644
--- a/gtk/src/settings.h
+++ b/gtk/src/settings.h
@@ -80,32 +80,11 @@ enum
GHB_QUEUE_DONE,
};
-GhbValue* ghb_settings_new(void);
-void ghb_settings_take_value(
- GhbValue *settings, const gchar *key, GhbValue *value);
-void ghb_settings_set_value(
- GhbValue *settings, const gchar *key, const GhbValue *value);
-void ghb_settings_set_string(
- GhbValue *settings, const gchar *key, const gchar *sval);
-void ghb_settings_set_double(GhbValue *settings, const gchar *key, gdouble dval);
-void ghb_settings_set_int64(GhbValue *settings, const gchar *key, gint64 ival);
-void ghb_settings_set_int(GhbValue *settings, const gchar *key, gint ival);
-void ghb_settings_set_boolean(
- GhbValue *settings, const gchar *key, gboolean bval);
void ghb_settings_copy(
GhbValue *settings, const gchar *key, const GhbValue *value);
-GhbValue* ghb_settings_get_value(const GhbValue *settings, const gchar *key);
-gboolean ghb_settings_get_boolean(const GhbValue *settings, const gchar *key);
-gint64 ghb_settings_get_int64(const GhbValue *settings, const gchar *key);
-gint ghb_settings_get_int(const GhbValue *settings, const gchar *key);
-gdouble ghb_settings_get_double(const GhbValue *settings, const gchar *key);
-gchar* ghb_settings_get_string(const GhbValue *settings, const gchar *key);
-const gchar* ghb_settings_get_const_string(
- const GhbValue *settings, const gchar *key);
gint ghb_settings_combo_int(const GhbValue *settings, const gchar *key);
gdouble ghb_settings_combo_double(const GhbValue *settings, const gchar *key);
const gchar* ghb_settings_combo_option(const GhbValue *settings, const gchar *key);
-const gchar* ghb_settings_combo_string(const GhbValue *settings, const gchar *key);
GhbValue* ghb_widget_value(GtkWidget *widget);
gchar* ghb_widget_string(GtkWidget *widget);
diff --git a/gtk/src/subtitlehandler.c b/gtk/src/subtitlehandler.c
index 440dbe0a6..b42b482b3 100644
--- a/gtk/src/subtitlehandler.c
+++ b/gtk/src/subtitlehandler.c
@@ -44,15 +44,15 @@ subtitle_refresh_list_row_ui(
info_src_2 = NULL;
info_dst_2 = NULL;
- forced = ghb_settings_get_boolean(subsettings, "SubtitleForced");
- burned = ghb_settings_get_boolean(subsettings, "SubtitleBurned");
- def = ghb_settings_get_boolean(subsettings, "SubtitleDefaultTrack");
+ forced = ghb_dict_get_bool(subsettings, "SubtitleForced");
+ burned = ghb_dict_get_bool(subsettings, "SubtitleBurned");
+ def = ghb_dict_get_bool(subsettings, "SubtitleDefaultTrack");
info_src = g_strdup_printf("<small>%s</small>",
- ghb_settings_get_const_string(subsettings, "SubtitleTrackDescription"));
- if (ghb_settings_get_int(subsettings, "SubtitleSource") == SRTSUB)
+ ghb_dict_get_string(subsettings, "SubtitleTrackDescription"));
+ if (ghb_dict_get_int(subsettings, "SubtitleSource") == SRTSUB)
{
gint offset;
- offset = ghb_settings_get_int(subsettings, "SrtOffset");
+ offset = ghb_dict_get_int(subsettings, "SrtOffset");
if (offset != 0)
{
info_dst_2 = g_strdup_printf("Offset: %dms", offset);
@@ -131,7 +131,7 @@ subtitle_refresh_list_ui_from_settings(signal_user_data_t *ud, GhbValue *setting
tm_count = gtk_tree_model_iter_n_children(tm, NULL);
- subtitle_list = ghb_settings_get_value(settings, "subtitle_list");
+ subtitle_list = ghb_dict_get_value(settings, "subtitle_list");
count = ghb_array_len(subtitle_list);
if (count != tm_count)
{
@@ -163,11 +163,11 @@ ghb_subtitle_exclusive_burn_settings(GhbValue *settings, gint index)
GhbValue *subsettings;
gint ii, count;
- subtitle_list = ghb_settings_get_value(settings, "subtitle_list");
+ subtitle_list = ghb_dict_get_value(settings, "subtitle_list");
subsettings = ghb_array_get(subtitle_list, index);
if (subsettings != NULL)
{
- int track = ghb_settings_get_int(subsettings, "SubtitleTrack");
+ int track = ghb_dict_get_int(subsettings, "SubtitleTrack");
if (track == -1)
{
// Allow 2 tracks to be marked burned when one is
@@ -183,14 +183,14 @@ ghb_subtitle_exclusive_burn_settings(GhbValue *settings, gint index)
if (ii != index)
{
subsettings = ghb_array_get(subtitle_list, ii);
- int track = ghb_settings_get_int(subsettings, "SubtitleTrack");
+ int track = ghb_dict_get_int(subsettings, "SubtitleTrack");
if (track != -1)
{
// Allow 2 tracks to be marked burned when one is
// foreign audio search. Extra burned track will be
// sanitized away if foreign audio search actually finds
// something.
- ghb_settings_set_boolean(subsettings, "SubtitleBurned", FALSE);
+ ghb_dict_set_bool(subsettings, "SubtitleBurned", FALSE);
}
}
}
@@ -210,14 +210,14 @@ ghb_subtitle_exclusive_default_settings(GhbValue *settings, gint index)
GhbValue *subtitle;
gint ii, count;
- subtitle_list = ghb_settings_get_value(settings, "subtitle_list");
+ subtitle_list = ghb_dict_get_value(settings, "subtitle_list");
count = ghb_array_len(subtitle_list);
for (ii = 0; ii < count; ii++)
{
if (ii != index)
{
subtitle = ghb_array_get(subtitle_list, ii);
- ghb_settings_set_boolean(subtitle, "SubtitleDefaultTrack", FALSE);
+ ghb_dict_set_bool(subtitle, "SubtitleDefaultTrack", FALSE);
}
}
}
@@ -249,39 +249,39 @@ subtitle_add_to_settings(GhbValue *settings, GhbValue *subsettings)
gboolean burned, forced, def;
gint source;
- subtitle_list = ghb_settings_get_value(settings, "subtitle_list");
+ subtitle_list = ghb_dict_get_value(settings, "subtitle_list");
if (subtitle_list == NULL)
{
subtitle_list = ghb_array_new();
- ghb_settings_set_value(settings, "subtitle_list", subtitle_list);
+ ghb_dict_set(settings, "subtitle_list", subtitle_list);
}
// Validate some settings
const char *mux_id;
const hb_container_t *mux;
- mux_id = ghb_settings_get_const_string(settings, "FileFormat");
+ mux_id = ghb_dict_get_string(settings, "FileFormat");
mux = ghb_lookup_container_by_name(mux_id);
- source = ghb_settings_get_int(subsettings, "SubtitleSource");
- burned = ghb_settings_get_boolean(subsettings, "SubtitleBurned");
+ source = ghb_dict_get_int(subsettings, "SubtitleSource");
+ burned = ghb_dict_get_bool(subsettings, "SubtitleBurned");
if (burned && !hb_subtitle_can_burn(source))
{
burned = FALSE;
- ghb_settings_set_boolean(subsettings, "SubtitleBurned", burned);
+ ghb_dict_set_bool(subsettings, "SubtitleBurned", burned);
}
if (!burned && !hb_subtitle_can_pass(source, mux->format))
{
burned = TRUE;
- ghb_settings_set_boolean(subsettings, "SubtitleBurned", burned);
- ghb_settings_set_boolean(subsettings, "SubtitleDefaultTrack", FALSE);
+ ghb_dict_set_bool(subsettings, "SubtitleBurned", burned);
+ ghb_dict_set_bool(subsettings, "SubtitleDefaultTrack", FALSE);
}
- def = ghb_settings_get_boolean(subsettings, "SubtitleDefaultTrack");
- forced = ghb_settings_get_boolean(subsettings, "SubtitleForced");
+ def = ghb_dict_get_bool(subsettings, "SubtitleDefaultTrack");
+ forced = ghb_dict_get_bool(subsettings, "SubtitleForced");
if (forced && !hb_subtitle_can_force(source))
{
forced = FALSE;
- ghb_settings_set_boolean(subsettings, "SubtitleForced", forced);
+ ghb_dict_set_bool(subsettings, "SubtitleForced", forced);
}
ghb_array_append(subtitle_list, subsettings);
@@ -299,15 +299,15 @@ subtitle_set_track_description(GhbValue *settings, GhbValue *subsettings)
{
char *desc = NULL;
- if (ghb_settings_get_int(subsettings, "SubtitleSource") == SRTSUB)
+ if (ghb_dict_get_int(subsettings, "SubtitleSource") == SRTSUB)
{
- gchar *filename, *code;
+ const gchar *filename, *code;
const gchar *lang;
lang = ghb_settings_combo_option(subsettings, "SrtLanguage");
- code = ghb_settings_get_string(subsettings, "SrtCodeset");
+ code = ghb_dict_get_string(subsettings, "SrtCodeset");
- filename = ghb_settings_get_string(subsettings, "SrtFile");
+ filename = ghb_dict_get_string(subsettings, "SrtFile");
if (g_file_test(filename, G_FILE_TEST_IS_REGULAR))
{
gchar *basename;
@@ -320,7 +320,6 @@ subtitle_set_track_description(GhbValue *settings, GhbValue *subsettings)
{
desc = g_strdup_printf("%s (%s)(SRT)", lang, code);
}
- g_free(code);
}
else
{
@@ -329,9 +328,9 @@ subtitle_set_track_description(GhbValue *settings, GhbValue *subsettings)
int track;
hb_subtitle_t *subtitle;
- title_id = ghb_settings_get_int(settings, "title");
+ title_id = ghb_dict_get_int(settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
- track = ghb_settings_get_int(subsettings, "SubtitleTrack");
+ track = ghb_dict_get_int(subsettings, "SubtitleTrack");
if (track < 0)
{
desc = g_strdup(_("Foreign Audio Search"));
@@ -350,12 +349,12 @@ subtitle_set_track_description(GhbValue *settings, GhbValue *subsettings)
if (desc != NULL)
{
- ghb_settings_set_string(
+ ghb_dict_set_string(
subsettings, "SubtitleTrackDescription", desc);
}
else
{
- ghb_settings_set_string(
+ ghb_dict_set_string(
subsettings, "SubtitleTrackDescription", "Error!");
}
@@ -394,31 +393,30 @@ static GhbValue* subtitle_add_track(
}
GhbValue *subsettings = ghb_dict_new();
- ghb_settings_set_int(subsettings, "SubtitleTrack", track);
- ghb_settings_set_int(subsettings, "SubtitleSource", source);
+ ghb_dict_set_int(subsettings, "SubtitleTrack", track);
+ ghb_dict_set_int(subsettings, "SubtitleSource", source);
// Set default SRT settings
- gchar *pref_lang, *dir, *filename;
+ const gchar *pref_lang, *dir;
+ gchar *filename;
- pref_lang = ghb_settings_get_string(settings, "PreferredLanguage");
- ghb_settings_set_string(subsettings, "SrtLanguage", pref_lang);
- g_free(pref_lang);
+ pref_lang = ghb_dict_get_string(settings, "PreferredLanguage");
+ ghb_dict_set_string(subsettings, "SrtLanguage", pref_lang);
- ghb_settings_set_string(subsettings, "SrtCodeset", "UTF-8");
+ ghb_dict_set_string(subsettings, "SrtCodeset", "UTF-8");
- dir = ghb_settings_get_string(ud->prefs, "SrtDir");
+ dir = ghb_dict_get_string(ud->prefs, "SrtDir");
filename = g_strdup_printf("%s/none", dir);
- ghb_settings_set_string(subsettings, "SrtFile", filename);
- g_free(dir);
+ ghb_dict_set_string(subsettings, "SrtFile", filename);
g_free(filename);
- ghb_settings_set_int(subsettings, "SrtOffset", 0);
+ ghb_dict_set_int(subsettings, "SrtOffset", 0);
subtitle_set_track_description(settings, subsettings);
if (burn)
{
- ghb_settings_set_boolean(subsettings, "SubtitleBurned", TRUE);
+ ghb_dict_set_bool(subsettings, "SubtitleBurned", TRUE);
if (track != -1)
{
// Allow 2 tracks to be marked burned when one is
@@ -430,24 +428,24 @@ static GhbValue* subtitle_add_track(
}
else
{
- ghb_settings_set_boolean(subsettings, "SubtitleBurned", FALSE);
+ ghb_dict_set_bool(subsettings, "SubtitleBurned", FALSE);
}
if (track == -1)
{
// Foreign audio search "track"
- ghb_settings_set_boolean(subsettings, "SubtitleForced", TRUE);
+ ghb_dict_set_bool(subsettings, "SubtitleForced", TRUE);
}
else
{
- ghb_settings_set_boolean(subsettings, "SubtitleForced", FALSE);
+ ghb_dict_set_bool(subsettings, "SubtitleForced", FALSE);
}
if (default_track)
{
- ghb_settings_set_boolean(subsettings, "SubtitleDefaultTrack", TRUE);
+ ghb_dict_set_bool(subsettings, "SubtitleDefaultTrack", TRUE);
}
else
{
- ghb_settings_set_boolean(subsettings, "SubtitleDefaultTrack", FALSE);
+ ghb_dict_set_bool(subsettings, "SubtitleDefaultTrack", FALSE);
}
subtitle_add_to_settings(settings, subsettings);
@@ -465,7 +463,7 @@ ghb_subtitle_title_change(signal_user_data_t *ud, gboolean show)
gtk_widget_set_sensitive(w, show);
int title_id, titleindex;
- title_id = ghb_settings_get_int(ud->settings, "title");
+ title_id = ghb_dict_get_int(ud->settings, "title");
const hb_title_t *title = ghb_lookup_title(title_id, &titleindex);
if (title != NULL)
{
@@ -508,7 +506,7 @@ ghb_set_pref_subtitle_settings(signal_user_data_t *ud, const hb_title_t *title,
const char *mux_id;
const hb_container_t *mux;
- mux_id = ghb_settings_get_const_string(settings, "FileFormat");
+ mux_id = ghb_dict_get_string(settings, "FileFormat");
mux = ghb_lookup_container_by_name(mux_id);
// Check to see if we need to add a subtitle track for foreign audio
@@ -518,11 +516,11 @@ ghb_set_pref_subtitle_settings(signal_user_data_t *ud, const hb_title_t *title,
// chosen Preferred Language AND the Preferred Language is NOT Any (und).
//
audio_lang = ghb_get_user_audio_lang(settings, title, 0);
- foreign_audio_search = ghb_settings_get_boolean(
+ foreign_audio_search = ghb_dict_get_bool(
settings, "SubtitleAddForeignAudioSearch");
- foreign_audio_subs = ghb_settings_get_boolean(
+ foreign_audio_subs = ghb_dict_get_bool(
settings, "SubtitleAddForeignAudioSubtitle");
- lang_list = ghb_settings_get_value(settings, "SubtitleLanguageList");
+ lang_list = ghb_dict_get_value(settings, "SubtitleLanguageList");
lang_count = ghb_array_len(lang_list);
if (lang_count > 0)
{
@@ -542,8 +540,8 @@ ghb_set_pref_subtitle_settings(signal_user_data_t *ud, const hb_title_t *title,
burn_behavior = ghb_settings_combo_int(settings, "SubtitleBurnBehavior");
burn_foreign = burn_behavior == 1 || burn_behavior == 3;
burn_first = burn_behavior == 2 || burn_behavior == 3;
- burn_dvd = ghb_settings_get_boolean(settings, "SubtitleBurnDVDSub");
- burn_bd = ghb_settings_get_boolean(settings, "SubtitleBurnBDSub");
+ burn_dvd = ghb_dict_get_bool(settings, "SubtitleBurnDVDSub");
+ burn_bd = ghb_dict_get_bool(settings, "SubtitleBurnBDSub");
if (foreign_audio_subs &&
(audio_lang == NULL || strncmp(audio_lang, pref_lang, 4)))
@@ -615,7 +613,7 @@ ghb_set_pref_subtitle_settings(signal_user_data_t *ud, const hb_title_t *title,
}
}
- if (ghb_settings_get_boolean(settings, "SubtitleAddCC"))
+ if (ghb_dict_get_bool(settings, "SubtitleAddCC"))
{
for (track = 0; track < sub_count; track++)
{
@@ -713,7 +711,7 @@ subtitle_get_selected_settings(signal_user_data_t *ud, int *index)
gtk_tree_path_free(tp);
if (row < 0) return NULL;
- subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
+ subtitle_list = ghb_dict_get_value(ud->settings, "subtitle_list");
if (row >= ghb_array_len(subtitle_list))
return NULL;
@@ -737,10 +735,10 @@ subtitle_update_dialog_widgets(signal_user_data_t *ud, GhbValue *subsettings)
const char *mux_id;
const hb_container_t *mux;
- mux_id = ghb_settings_get_const_string(ud->settings, "FileFormat");
+ mux_id = ghb_dict_get_string(ud->settings, "FileFormat");
mux = ghb_lookup_container_by_name(mux_id);
- int source = ghb_settings_get_int(subsettings, "SubtitleSource");
+ int source = ghb_dict_get_int(subsettings, "SubtitleSource");
ghb_ui_update_from_settings(ud, "SubtitleTrack", subsettings);
ghb_ui_update_from_settings(ud, "SrtLanguage", subsettings);
@@ -766,9 +764,9 @@ subtitle_update_dialog_widgets(signal_user_data_t *ud, GhbValue *subsettings)
gtk_widget_set_sensitive(widget,
hb_subtitle_can_pass(source, mux->format));
- burn = ghb_settings_get_int(subsettings, "SubtitleBurned");
- force = ghb_settings_get_int(subsettings, "SubtitleForced");
- def = ghb_settings_get_int(subsettings, "SubtitleDefaultTrack");
+ burn = ghb_dict_get_int(subsettings, "SubtitleBurned");
+ force = ghb_dict_get_int(subsettings, "SubtitleForced");
+ def = ghb_dict_get_int(subsettings, "SubtitleDefaultTrack");
if (!hb_subtitle_can_burn(source))
{
@@ -783,11 +781,11 @@ subtitle_update_dialog_widgets(signal_user_data_t *ud, GhbValue *subsettings)
def = FALSE;
burn = TRUE;
}
- ghb_settings_set_boolean(subsettings, "SubtitleBurned", burn);
+ ghb_dict_set_bool(subsettings, "SubtitleBurned", burn);
ghb_ui_update(ud, "SubtitleBurned", ghb_boolean_value(burn));
- ghb_settings_set_boolean(subsettings, "SubtitleForced", force);
+ ghb_dict_set_bool(subsettings, "SubtitleForced", force);
ghb_ui_update(ud, "SubtitleForced", ghb_boolean_value(force));
- ghb_settings_set_boolean(subsettings, "SubtitleDefaultTrack", def);
+ ghb_dict_set_bool(subsettings, "SubtitleDefaultTrack", def);
ghb_ui_update(ud, "SubtitleDefaultTrack", ghb_boolean_value(def));
// Hide regular subtitle widgets
@@ -839,9 +837,9 @@ subtitle_track_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
gint track, source;
ghb_widget_to_setting(subsettings, widget);
- track = ghb_settings_get_int(subsettings, "SubtitleTrack");
+ track = ghb_dict_get_int(subsettings, "SubtitleTrack");
source = ghb_subtitle_track_source(ud->settings, track);
- ghb_settings_set_int(subsettings, "SubtitleSource", source);
+ ghb_dict_set_int(subsettings, "SubtitleSource", source);
subtitle_set_track_description(ud->settings, subsettings);
subtitle_update_dialog_widgets(ud, subsettings);
ghb_subtitle_list_refresh_selected(ud);
@@ -866,7 +864,7 @@ subtitle_burned_toggled_cb(GtkWidget *widget, signal_user_data_t *ud)
if (subsettings != NULL)
{
ghb_widget_to_setting(subsettings, widget);
- if (ghb_settings_get_boolean(subsettings, "SubtitleBurned"))
+ if (ghb_dict_get_bool(subsettings, "SubtitleBurned"))
{
ghb_ui_update(ud, "SubtitleDefaultTrack", ghb_boolean_value(FALSE));
ghb_subtitle_exclusive_burn(ud, index);
@@ -887,7 +885,7 @@ subtitle_default_toggled_cb(GtkWidget *widget, signal_user_data_t *ud)
if (subsettings != NULL)
{
ghb_widget_to_setting(subsettings, widget);
- if (ghb_settings_get_boolean(subsettings, "SubtitleDefaultTrack"))
+ if (ghb_dict_get_bool(subsettings, "SubtitleDefaultTrack"))
{
ghb_ui_update(ud, "SubtitleBurned", ghb_boolean_value(FALSE));
ghb_subtitle_exclusive_default(ud, index);
@@ -906,17 +904,17 @@ subtitle_srt_radio_toggled_cb(GtkWidget *widget, signal_user_data_t *ud)
subsettings = subtitle_get_selected_settings(ud, NULL);
if (subsettings != NULL)
{
- if (ghb_settings_get_boolean(ud->settings, "SubtitleSrtEnable"))
+ if (ghb_dict_get_bool(ud->settings, "SubtitleSrtEnable"))
{
- ghb_settings_set_int(subsettings, "SubtitleSource", SRTSUB);
+ ghb_dict_set_int(subsettings, "SubtitleSource", SRTSUB);
}
else
{
int track, source;
- track = ghb_settings_get_int(subsettings, "SubtitleTrack");
+ track = ghb_dict_get_int(subsettings, "SubtitleTrack");
source = ghb_subtitle_track_source(ud->settings, track);
- ghb_settings_set_int(subsettings, "SubtitleSource", source);
+ ghb_dict_set_int(subsettings, "SubtitleSource", source);
}
subtitle_set_track_description(ud->settings, subsettings);
subtitle_update_dialog_widgets(ud, subsettings);
@@ -950,7 +948,7 @@ ghb_subtitle_list_refresh_selected(signal_user_data_t *ud)
gtk_tree_path_free(tp);
if (row < 0) return;
- subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
+ subtitle_list = ghb_dict_get_value(ud->settings, "subtitle_list");
if (row >= ghb_array_len(subtitle_list))
return;
@@ -994,7 +992,8 @@ srt_file_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
subsettings = subtitle_get_selected_settings(ud, NULL);
if (subsettings != NULL)
{
- gchar *filename, *dirname;
+ const gchar *filename;
+ gchar *dirname;
ghb_widget_to_setting(subsettings, widget);
subtitle_set_track_description(ud->settings, subsettings);
@@ -1002,19 +1001,18 @@ srt_file_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
ghb_live_reset(ud);
// Update SrtDir preference
- filename = ghb_settings_get_string(subsettings, "SrtFile");
+ filename = ghb_dict_get_string(subsettings, "SrtFile");
if (g_file_test(filename, G_FILE_TEST_IS_DIR))
{
- ghb_settings_set_string(ud->prefs, "SrtDir", filename);
+ ghb_dict_set_string(ud->prefs, "SrtDir", filename);
}
else
{
dirname = g_path_get_dirname(filename);
- ghb_settings_set_string(ud->prefs, "SrtDir", dirname);
+ ghb_dict_set_string(ud->prefs, "SrtDir", dirname);
g_free(dirname);
}
ghb_pref_save(ud->prefs, "SrtDir");
- g_free(filename);
}
}
@@ -1041,11 +1039,11 @@ ghb_clear_subtitle_list_settings(GhbValue *settings)
{
GhbValue *subtitle_list;
- subtitle_list = ghb_settings_get_value(settings, "subtitle_list");
+ subtitle_list = ghb_dict_get_value(settings, "subtitle_list");
if (subtitle_list == NULL)
{
subtitle_list = ghb_array_new();
- ghb_settings_set_value(settings, "subtitle_list", subtitle_list);
+ ghb_dict_set(settings, "subtitle_list", subtitle_list);
}
else
ghb_array_reset(subtitle_list);
@@ -1121,14 +1119,14 @@ subtitle_list_selection_changed_cb(GtkTreeSelection *ts, signal_user_data_t *ud)
row = indices[0];
gtk_tree_path_free(tp);
- subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
+ subtitle_list = ghb_dict_get_value(ud->settings, "subtitle_list");
if (row >= 0 && row < ghb_array_len(subtitle_list))
subsettings = ghb_array_get(subtitle_list, row);
}
subtitle_update_dialog_widgets(ud, subsettings);
if (subsettings)
{
- if (ghb_settings_get_boolean(subsettings, "SubtitleBurned"))
+ if (ghb_dict_get_bool(subsettings, "SubtitleBurned"))
{
ghb_subtitle_exclusive_burn(ud, row);
}
@@ -1140,7 +1138,7 @@ static gboolean subtitle_is_one_burned(GhbValue *settings)
GhbValue *subtitle_list, *subsettings;
int count, ii;
- subtitle_list = ghb_settings_get_value(settings, "subtitle_list");
+ subtitle_list = ghb_dict_get_value(settings, "subtitle_list");
if (subtitle_list == NULL)
return FALSE;
@@ -1148,7 +1146,7 @@ static gboolean subtitle_is_one_burned(GhbValue *settings)
for (ii = 0; ii < count; ii++)
{
subsettings = ghb_array_get(subtitle_list, ii);
- if (ghb_settings_get_boolean(subsettings, "SubtitleBurned"))
+ if (ghb_dict_get_bool(subsettings, "SubtitleBurned"))
{
return TRUE;
}
@@ -1167,7 +1165,7 @@ subtitle_add_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
int title_id, titleindex;
const hb_title_t *title;
- title_id = ghb_settings_get_int(ud->settings, "title");
+ title_id = ghb_dict_get_int(ud->settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
if (title == NULL)
{
@@ -1176,14 +1174,14 @@ subtitle_add_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
// Back up settings in case we need to revert.
backup = ghb_value_dup(
- ghb_settings_get_value(ud->settings, "subtitle_list"));
+ ghb_dict_get_value(ud->settings, "subtitle_list"));
one_burned = subtitle_is_one_burned(ud->settings);
const char *mux_id;
const hb_container_t *mux;
- mux_id = ghb_settings_get_const_string(ud->settings, "FileFormat");
+ mux_id = ghb_dict_get_string(ud->settings, "FileFormat");
mux = ghb_lookup_container_by_name(mux_id);
int count = hb_list_count(title->list_subtitle);
@@ -1209,7 +1207,7 @@ subtitle_add_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
gtk_widget_hide(dialog);
if (response != GTK_RESPONSE_OK)
{
- ghb_settings_take_value(ud->settings, "subtitle_list", backup);
+ ghb_dict_set(ud->settings, "subtitle_list", backup);
subsettings = subtitle_get_selected_settings(ud, NULL);
if (subsettings != NULL)
{
@@ -1233,7 +1231,7 @@ subtitle_add_all_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
const hb_title_t *title;
int title_id, titleindex;
- title_id = ghb_settings_get_int(ud->settings, "title");
+ title_id = ghb_dict_get_int(ud->settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
if (title == NULL)
{
@@ -1246,7 +1244,7 @@ subtitle_add_all_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
const char *mux_id;
const hb_container_t *mux;
- mux_id = ghb_settings_get_const_string(ud->settings, "FileFormat");
+ mux_id = ghb_dict_get_string(ud->settings, "FileFormat");
mux = ghb_lookup_container_by_name(mux_id);
int count = hb_list_count(title->list_subtitle);
@@ -1265,7 +1263,7 @@ subtitle_reset_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
int title_id, titleindex;
const hb_title_t *title;
- title_id = ghb_settings_get_int(ud->settings, "title");
+ title_id = ghb_dict_get_int(ud->settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
ghb_set_pref_subtitle(title, ud);
}
@@ -1278,14 +1276,14 @@ ghb_subtitle_prune(signal_user_data_t *ud)
gint ii;
gboolean one_burned = FALSE;
- subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
+ subtitle_list = ghb_dict_get_value(ud->settings, "subtitle_list");
if (subtitle_list == NULL)
return;
const char *mux_id;
const hb_container_t *mux;
- mux_id = ghb_settings_get_const_string(ud->settings, "FileFormat");
+ mux_id = ghb_dict_get_string(ud->settings, "FileFormat");
mux = ghb_lookup_container_by_name(mux_id);
for (ii = 0; ii < ghb_array_len(subtitle_list); )
@@ -1294,8 +1292,8 @@ ghb_subtitle_prune(signal_user_data_t *ud)
int source;
subsettings = ghb_array_get(subtitle_list, ii);
- burned = ghb_settings_get_boolean(subsettings, "SubtitleBurned");
- source = ghb_settings_get_boolean(subsettings, "SubtitleSource");
+ burned = ghb_dict_get_bool(subsettings, "SubtitleBurned");
+ source = ghb_dict_get_bool(subsettings, "SubtitleSource");
burned = burned || !hb_subtitle_can_pass(source, mux->format);
if (burned && one_burned)
{
@@ -1303,7 +1301,7 @@ ghb_subtitle_prune(signal_user_data_t *ud)
continue;
}
one_burned = one_burned || burned;
- ghb_settings_set_boolean(subsettings, "SubtitleBurned", burned);
+ ghb_dict_set_bool(subsettings, "SubtitleBurned", burned);
ii++;
}
subsettings = subtitle_get_selected_settings(ud, NULL);
@@ -1325,12 +1323,12 @@ ghb_reset_subtitles(signal_user_data_t *ud, GhbValue *settings)
g_debug("ghb_reset_subtitles");
ghb_clear_subtitle_list_settings(ud->settings);
ghb_clear_subtitle_list_ui(ud->builder);
- title_id = ghb_settings_get_int(ud->settings, "title");
+ title_id = ghb_dict_get_int(ud->settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
if (title == NULL)
return;
- slist = ghb_settings_get_value(settings, "subtitle_list");
+ slist = ghb_dict_get_value(settings, "subtitle_list");
count = ghb_array_len(slist);
for (ii = 0; ii < count; ii++)
{
@@ -1371,7 +1369,7 @@ subtitle_update_pref_lang(signal_user_data_t *ud, const iso639_lang_t *lang)
gtk_label_set_text(label, str);
g_free(str);
- ghb_settings_set_string(ud->settings, "PreferredLanguage", code);
+ ghb_dict_set_string(ud->settings, "PreferredLanguage", code);
button = GTK_BUTTON(GHB_WIDGET(ud->builder,
"SubtitleAddForeignAudioSubtitle"));
@@ -1394,20 +1392,20 @@ ghb_subtitle_set_pref_lang(GhbValue *settings)
{
GhbValue *lang_list;
gboolean set = FALSE;
- lang_list = ghb_settings_get_value(settings, "SubtitleLanguageList");
+ lang_list = ghb_dict_get_value(settings, "SubtitleLanguageList");
if (ghb_array_len(lang_list) > 0)
{
GhbValue *glang = ghb_array_get(lang_list, 0);
if (glang != NULL)
{
- ghb_settings_set_string(settings, "PreferredLanguage",
+ ghb_dict_set_string(settings, "PreferredLanguage",
ghb_value_get_string(glang));
set = TRUE;
}
}
if (!set)
{
- ghb_settings_set_string(settings, "PreferredLanguage", "und");
+ ghb_dict_set_string(settings, "PreferredLanguage", "und");
}
}
@@ -1438,7 +1436,7 @@ subtitle_add_lang_clicked_cb(GtkWidget *widget, signal_user_data_t *ud)
idx = (intptr_t)g_object_get_data(G_OBJECT(label), "lang_idx");
lang = ghb_iso639_lookup_by_int(idx);
glang = ghb_string_value_new(lang->iso639_2);
- lang_list = ghb_settings_get_value(ud->settings, "SubtitleLanguageList");
+ lang_list = ghb_dict_get_value(ud->settings, "SubtitleLanguageList");
if (ghb_array_len(lang_list) == 0)
{
subtitle_update_pref_lang(ud, lang);
@@ -1476,7 +1474,7 @@ subtitle_remove_lang_clicked_cb(GtkWidget *widget, signal_user_data_t *ud)
gtk_list_box_insert(avail, label, idx);
// Remove from preset language list
- lang_list = ghb_settings_get_value(ud->settings, "SubtitleLanguageList");
+ lang_list = ghb_dict_get_value(ud->settings, "SubtitleLanguageList");
ghb_array_remove(lang_list, index);
ghb_clear_presets_selection(ud);
@@ -1522,11 +1520,11 @@ static void subtitle_def_lang_list_init(signal_user_data_t *ud)
// Clear selected languages.
subtitle_def_selected_lang_list_clear(ud);
- lang_list = ghb_settings_get_value(ud->settings, "SubtitleLanguageList");
+ lang_list = ghb_dict_get_value(ud->settings, "SubtitleLanguageList");
if (lang_list == NULL)
{
lang_list = ghb_array_new();
- ghb_settings_set_value(ud->settings, "SubtitleLanguageList", lang_list);
+ ghb_dict_set(ud->settings, "SubtitleLanguageList", lang_list);
}
int ii, count;
@@ -1605,7 +1603,7 @@ subtitle_edit_clicked_cb(GtkWidget *widget, gchar *path, signal_user_data_t *ud)
// Back up settings in case we need to revert.
backup = ghb_value_dup(
- ghb_settings_get_value(ud->settings, "subtitle_list"));
+ ghb_dict_get_value(ud->settings, "subtitle_list"));
// Pop up the edit dialog
GtkResponseType response;
@@ -1614,7 +1612,7 @@ subtitle_edit_clicked_cb(GtkWidget *widget, gchar *path, signal_user_data_t *ud)
gtk_widget_hide(dialog);
if (response != GTK_RESPONSE_OK)
{
- ghb_settings_take_value(ud->settings, "subtitle_list", backup);
+ ghb_dict_set(ud->settings, "subtitle_list", backup);
subsettings = subtitle_get_selected_settings(ud, NULL);
if (subsettings != NULL)
{
@@ -1662,7 +1660,7 @@ subtitle_remove_clicked_cb(GtkWidget *widget, gchar *path, signal_user_data_t *u
gtk_tree_selection_select_iter(ts, &nextIter);
}
- subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
+ subtitle_list = ghb_dict_get_value(ud->settings, "subtitle_list");
// Get the row number
indices = gtk_tree_path_get_indices (tp);
diff --git a/gtk/src/values.c b/gtk/src/values.c
index 3985e6490..b413250cc 100644
--- a/gtk/src/values.c
+++ b/gtk/src/values.c
@@ -138,3 +138,89 @@ ghb_string_value_set(GhbValue *gval, const gchar *str)
json_string_set(gval, str);
}
+void
+ghb_dict_set_string(GhbValue *dict, const gchar *key, const gchar *sval)
+{
+ GhbValue *value;
+ value = ghb_string_value_new(sval);
+ ghb_dict_set(dict, key, value);
+}
+
+void
+ghb_dict_set_double(GhbValue *dict, const gchar *key, gdouble dval)
+{
+ GhbValue *value;
+ value = ghb_double_value_new(dval);
+ ghb_dict_set(dict, key, value);
+}
+
+void
+ghb_dict_set_int(GhbValue *dict, const gchar *key, gint64 ival)
+{
+ GhbValue *value;
+ value = ghb_int_value_new(ival);
+ ghb_dict_set(dict, key, value);
+}
+
+void
+ghb_dict_set_bool(GhbValue *dict, const gchar *key, gboolean bval)
+{
+ GhbValue *value;
+ value = ghb_bool_value_new(bval);
+ ghb_dict_set(dict, key, value);
+}
+
+GhbValue*
+ghb_dict_get_value(const GhbValue *dict, const gchar *key)
+{
+ GhbValue *value;
+ value = ghb_dict_get(dict, key);
+ if (value == NULL)
+ g_debug("returning null (%s)", key);
+ return value;
+}
+
+gboolean
+ghb_dict_get_bool(const GhbValue *dict, const gchar *key)
+{
+ const GhbValue* value;
+ value = ghb_dict_get_value(dict, key);
+ if (value == NULL) return FALSE;
+ return ghb_value_get_bool(value);
+}
+
+gint64
+ghb_dict_get_int(const GhbValue *dict, const gchar *key)
+{
+ const GhbValue* value;
+ value = ghb_dict_get_value(dict, key);
+ if (value == NULL) return 0;
+ return ghb_value_get_int(value);
+}
+
+gdouble
+ghb_dict_get_double(const GhbValue *dict, const gchar *key)
+{
+ const GhbValue* value;
+ value = ghb_dict_get_value(dict, key);
+ if (value == NULL) return 0;
+ return ghb_value_get_double(value);
+}
+
+const gchar*
+ghb_dict_get_string(const GhbValue *dict, const gchar *key)
+{
+ const GhbValue* value;
+ value = ghb_dict_get_value(dict, key);
+ return ghb_value_get_string(value);
+}
+
+gchar*
+ghb_dict_get_string_xform(const GhbValue *dict, const gchar *key)
+{
+ const GhbValue* value;
+ value = ghb_dict_get_value(dict, key);
+ if (value == NULL) return g_strdup("");
+ return ghb_value_get_string_xform(value);
+}
+
diff --git a/gtk/src/values.h b/gtk/src/values.h
index 9c2072710..87f7010cc 100644
--- a/gtk/src/values.h
+++ b/gtk/src/values.h
@@ -84,4 +84,16 @@ GhbValue* ghb_boolean_value(gboolean bval);
void debug_show_value(GhbValue *gval);
void debug_show_type(GhbType tp);
+void ghb_dict_set_string(GhbValue *dict, const gchar *key, const gchar *sval);
+void ghb_dict_set_double(GhbValue *dict, const gchar *key, gdouble dval);
+void ghb_dict_set_int(GhbValue *dict, const gchar *key, gint64 ival);
+void ghb_dict_set_bool(GhbValue *dict, const gchar *key, gboolean bval);
+
+GhbValue* ghb_dict_get_value(const GhbValue *dict, const gchar *key);
+gboolean ghb_dict_get_bool(const GhbValue *dict, const gchar *key);
+gint64 ghb_dict_get_int(const GhbValue *dict, const gchar *key);
+gdouble ghb_dict_get_double(const GhbValue *dict, const gchar *key);
+gchar* ghb_dict_get_string_xform(const GhbValue *dict, const gchar *key);
+const gchar* ghb_dict_get_string(const GhbValue *dict, const gchar *key);
+
#endif // _GHB_VALUES_H_
diff --git a/gtk/src/videohandler.c b/gtk/src/videohandler.c
index 94845442d..5bf706677 100644
--- a/gtk/src/videohandler.c
+++ b/gtk/src/videohandler.c
@@ -25,7 +25,7 @@
int ghb_get_video_encoder(GhbValue *settings)
{
const char *encoder;
- encoder = ghb_settings_get_const_string(settings, "VideoEncoder");
+ encoder = ghb_dict_get_string(settings, "VideoEncoder");
return hb_video_encoder_get_from_name(encoder);
}
@@ -86,42 +86,42 @@ ghb_video_setting_changed(GtkWidget *widget, signal_user_data_t *ud)
ghb_widget_to_setting(ud->settings, widget);
int encoder = ghb_get_video_encoder(ud->settings);
- int presetIndex = ghb_settings_get_int(ud->settings, "VideoPresetSlider");
+ int presetIndex = ghb_dict_get_int(ud->settings, "VideoPresetSlider");
const char * const *video_presets;
const char *preset;
video_presets = hb_video_encoder_get_presets(encoder);
if (video_presets != NULL)
{
preset = video_presets[presetIndex];
- ghb_settings_set_string(ud->settings, "VideoPreset", preset);
+ ghb_dict_set_string(ud->settings, "VideoPreset", preset);
}
- if (!ghb_settings_get_boolean(ud->settings, "x264UseAdvancedOptions") &&
+ if (!ghb_dict_get_bool(ud->settings, "x264UseAdvancedOptions") &&
encoder == HB_VCODEC_X264)
{
GString *str = g_string_new("");
- char *preset;
- char *tune;
- char *profile;
- char *level;
- char *opts;
+ const char *preset;
+ const char *tune;
+ const char *profile;
+ const char *level;
+ const char *opts;
char *tunes;
- preset = ghb_settings_get_string(ud->settings, "VideoPreset");
- tune = ghb_settings_get_string(ud->settings, "VideoTune");
- profile = ghb_settings_get_string(ud->settings, "VideoProfile");
- level = ghb_settings_get_string(ud->settings, "VideoLevel");
- opts = ghb_settings_get_string(ud->settings, "VideoOptionExtra");
+ preset = ghb_dict_get_string(ud->settings, "VideoPreset");
+ tune = ghb_dict_get_string(ud->settings, "VideoTune");
+ profile = ghb_dict_get_string(ud->settings, "VideoProfile");
+ level = ghb_dict_get_string(ud->settings, "VideoLevel");
+ opts = ghb_dict_get_string(ud->settings, "VideoOptionExtra");
if (tune[0] && strcmp(tune, "none"))
{
g_string_append_printf(str, "%s", tune);
}
- if (ghb_settings_get_boolean(ud->settings, "x264FastDecode"))
+ if (ghb_dict_get_bool(ud->settings, "x264FastDecode"))
{
g_string_append_printf(str, "%s%s", str->str[0] ? "," : "", "fastdecode");
}
- if (ghb_settings_get_boolean(ud->settings, "x264ZeroLatency"))
+ if (ghb_dict_get_bool(ud->settings, "x264ZeroLatency"))
{
g_string_append_printf(str, "%s%s", str->str[0] ? "," : "", "zerolatency");
}
@@ -129,15 +129,15 @@ ghb_video_setting_changed(GtkWidget *widget, signal_user_data_t *ud)
char * new_opts;
- int w = ghb_settings_get_int(ud->settings, "scale_width");
- int h = ghb_settings_get_int(ud->settings, "scale_height");
+ int w = ghb_dict_get_int(ud->settings, "scale_width");
+ int h = ghb_dict_get_int(ud->settings, "scale_height");
if (w == 0 || h == 0)
{
- if (!ghb_settings_get_boolean(ud->settings, "autoscale"))
+ if (!ghb_dict_get_bool(ud->settings, "autoscale"))
{
- w = ghb_settings_get_int(ud->settings, "PictureWidth");
- h = ghb_settings_get_int(ud->settings, "PictureHeight");
+ w = ghb_dict_get_int(ud->settings, "PictureWidth");
+ h = ghb_dict_get_int(ud->settings, "PictureHeight");
if (h == 0 && w != 0)
{
@@ -157,11 +157,11 @@ ghb_video_setting_changed(GtkWidget *widget, signal_user_data_t *ud)
if (!strcasecmp(profile, "auto"))
{
- profile[0] = 0;
+ profile = "";
}
if (!strcasecmp(level, "auto"))
{
- level[0] = 0;
+ level = "";
}
new_opts = hb_x264_param_unparse(
preset, tunes, opts, profile, level, w, h);
@@ -182,27 +182,21 @@ ghb_video_setting_changed(GtkWidget *widget, signal_user_data_t *ud)
g_free(new_tt);
g_free(new_opts);
- g_free(preset);
- g_free(tune);
- g_free(profile);
- g_free(level);
- g_free(opts);
g_free(tunes);
}
- else if (ghb_settings_get_boolean(ud->settings, "x264UseAdvancedOptions"))
+ else if (ghb_dict_get_bool(ud->settings, "x264UseAdvancedOptions"))
{
- char *opts = ghb_settings_get_string(ud->settings, "x264Option");
+ const char *opts = ghb_dict_get_string(ud->settings, "x264Option");
GtkWidget *eo = GTK_WIDGET(GHB_WIDGET(ud->builder, "VideoOptionExtra"));
char * new_tt;
if (opts)
- new_tt = g_strdup_printf(_("%s\n\nExpanded Options:\n\"%s\""), tt, opts);
+ new_tt = g_strdup_printf(_("%s\n\nExpanded Options:\n\"%s\""),
+ tt, opts);
else
new_tt = g_strdup_printf(_("%s\n\nExpanded Options:\n\"\""), tt);
gtk_widget_set_tooltip_text(eo, new_tt);
g_free(new_tt);
-
- g_free(opts);
}
ghb_check_dependency(ud, widget, NULL);
@@ -220,23 +214,22 @@ x264_use_advanced_options_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
ghb_widget_to_setting(ud->settings, widget);
- if (ghb_settings_get_boolean(ud->prefs, "HideAdvancedVideoSettings") &&
- ghb_settings_get_boolean(ud->settings, "x264UseAdvancedOptions"))
+ if (ghb_dict_get_bool(ud->prefs, "HideAdvancedVideoSettings") &&
+ ghb_dict_get_bool(ud->settings, "x264UseAdvancedOptions"))
{
ghb_ui_update(ud, "x264UseAdvancedOptions", ghb_boolean_value(FALSE));
return;
}
- if (ghb_settings_get_boolean(ud->settings, "x264UseAdvancedOptions"))
+ if (ghb_dict_get_bool(ud->settings, "x264UseAdvancedOptions"))
{
ghb_ui_update(ud, "VideoPresetSlider", ghb_int_value(5));
ghb_ui_update(ud, "VideoTune", ghb_string_value("none"));
ghb_ui_update(ud, "VideoProfile", ghb_string_value("auto"));
ghb_ui_update(ud, "VideoLevel", ghb_string_value("auto"));
- char *options = ghb_settings_get_string(ud->settings, "x264Option");
+ const char *options = ghb_dict_get_string(ud->settings, "x264Option");
ghb_ui_update(ud, "VideoOptionExtra", ghb_string_value(options));
- g_free(options);
}
ghb_check_dependency(ud, widget, NULL);
diff --git a/gtk/src/x264handler.c b/gtk/src/x264handler.c
index e8e2f3f2b..fb041a709 100644
--- a/gtk/src/x264handler.c
+++ b/gtk/src/x264handler.c
@@ -33,7 +33,7 @@ void ghb_show_hide_advanced_video( signal_user_data_t *ud )
{
gboolean hide;
- hide = ghb_settings_get_boolean(ud->prefs, "HideAdvancedVideoSettings");
+ hide = ghb_dict_get_bool(ud->prefs, "HideAdvancedVideoSettings");
if (hide)
{
ghb_ui_update(ud, "x264UseAdvancedOptions", ghb_boolean_value(FALSE));
@@ -137,11 +137,11 @@ x264_entry_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
if (!ignore_options_update)
{
GtkWidget *textview;
- gchar *options;
+ const gchar *options;
textview = GTK_WIDGET(GHB_WIDGET(ud->builder, "x264Option"));
ghb_widget_to_setting(ud->settings, textview);
- options = ghb_settings_get_string(ud->settings, "x264Option");
+ options = ghb_dict_get_string(ud->settings, "x264Option");
ignore_options_update = TRUE;
ghb_x264_parse_options(ud, options);
@@ -162,10 +162,8 @@ x264_entry_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
gtk_widget_set_tooltip_text(eo, new_tt);
g_free(new_tt);
- g_free(options);
- options = sopts;
+ g_free(sopts);
}
- g_free(options);
ignore_options_update = FALSE;
}
}
@@ -174,10 +172,11 @@ G_MODULE_EXPORT gboolean
x264_focus_out_cb(GtkWidget *widget, GdkEventFocus *event,
signal_user_data_t *ud)
{
- gchar *options, *sopts;
+ const gchar *options;
+ gchar *sopts;
ghb_widget_to_setting(ud->settings, widget);
- options = ghb_settings_get_string(ud->settings, "x264Option");
+ options = ghb_dict_get_string(ud->settings, "x264Option");
sopts = sanitize_x264opts(ud, options);
ignore_options_update = TRUE;
if (sopts != NULL && strcmp(sopts, options) != 0)
@@ -185,7 +184,6 @@ x264_focus_out_cb(GtkWidget *widget, GdkEventFocus *event,
ghb_ui_update(ud, "x264Option", ghb_string_value(sopts));
ghb_x264_parse_options(ud, sopts);
}
- g_free(options);
g_free(sopts);
ignore_options_update = FALSE;
return FALSE;
@@ -346,7 +344,7 @@ x264_update_double(signal_user_data_t *ud, const gchar *name, const gchar *val)
if (val == NULL) return;
dval = g_strtod (val, NULL);
- ghb_settings_set_double(ud->x264_priv, name, dval);
+ ghb_dict_set_double(ud->x264_priv, name, dval);
}
static void
@@ -356,7 +354,7 @@ x264_update_int(signal_user_data_t *ud, const gchar *name, const gchar *val)
if (val == NULL) return;
ival = g_strtod (val, NULL);
- ghb_settings_set_int(ud->x264_priv, name, ival);
+ ghb_dict_set_int(ud->x264_priv, name, ival);
}
static void
@@ -366,7 +364,7 @@ x264_update_int_setting(signal_user_data_t *ud, const gchar *name, const gchar *
if (val == NULL) return;
ival = g_strtod (val, NULL);
- ghb_settings_set_value(ud->x264_priv, name, ghb_int_value(ival));
+ ghb_dict_set(ud->x264_priv, name, ghb_int_value_new(ival));
ghb_check_dependency(ud, NULL, name);
}
@@ -394,18 +392,18 @@ static void
x264_update_bool(signal_user_data_t *ud, const gchar *name, const gchar *val)
{
if (val == NULL)
- ghb_settings_set_boolean(ud->x264_priv, name, TRUE);
+ ghb_dict_set_bool(ud->x264_priv, name, TRUE);
else
- ghb_settings_set_boolean(ud->x264_priv, name, str_is_true(val));
+ ghb_dict_set_bool(ud->x264_priv, name, str_is_true(val));
}
static void
x264_update_bool_setting(signal_user_data_t *ud, const gchar *name, const gchar *val)
{
if (val == NULL)
- ghb_settings_set_boolean(ud->x264_priv, name, TRUE);
+ ghb_dict_set_bool(ud->x264_priv, name, TRUE);
else
- ghb_settings_set_boolean(ud->x264_priv, name, str_is_true(val));
+ ghb_dict_set_bool(ud->x264_priv, name, str_is_true(val));
ghb_check_dependency(ud, NULL, name);
}
@@ -413,7 +411,7 @@ x264_update_bool_setting(signal_user_data_t *ud, const gchar *name, const gchar
static void
x264_update_combo(signal_user_data_t *ud, const gchar *name, const gchar *val)
{
- ghb_settings_set_string(ud->x264_priv, name, val);
+ ghb_dict_set_string(ud->x264_priv, name, val);
}
static void
@@ -442,8 +440,8 @@ x264_update_deblock(signal_user_data_t *ud, const gchar *xval)
}
}
g_free(val);
- ghb_settings_set_int(ud->x264_priv, "x264_deblock_alpha", avalue);
- ghb_settings_set_int(ud->x264_priv, "x264_deblock_beta", bvalue);
+ ghb_dict_set_int(ud->x264_priv, "x264_deblock_alpha", avalue);
+ ghb_dict_set_int(ud->x264_priv, "x264_deblock_beta", bvalue);
}
static void
@@ -465,8 +463,8 @@ x264_update_psy(signal_user_data_t *ud, const gchar *xval)
if (xval == NULL) return;
x264_parse_psy(xval, &rd_value, &trell_value);
- ghb_settings_set_double(ud->x264_priv, "x264_psy_rd", rd_value);
- ghb_settings_set_double(ud->x264_priv, "x264_psy_trell", trell_value);
+ ghb_dict_set_double(ud->x264_priv, "x264_psy_rd", rd_value);
+ ghb_dict_set_double(ud->x264_priv, "x264_psy_trell", trell_value);
}
static void do_update(signal_user_data_t *ud, char *name, gint type, char *val)
@@ -630,13 +628,11 @@ ghb_x264_parse_options(signal_user_data_t *ud, const gchar *options)
gchar*
get_deblock_val(signal_user_data_t *ud)
{
- gchar *alpha, *beta;
+ int alpha, beta;
gchar *result;
- alpha = ghb_settings_get_string(ud->x264_priv, "x264_deblock_alpha");
- beta = ghb_settings_get_string(ud->x264_priv, "x264_deblock_beta");
- result = g_strdup_printf("%s,%s", alpha, beta);
- g_free(alpha);
- g_free(beta);
+ alpha = ghb_dict_get_int(ud->x264_priv, "x264_deblock_alpha");
+ beta = ghb_dict_get_int(ud->x264_priv, "x264_deblock_beta");
+ result = g_strdup_printf("%d,%d", alpha, beta);
return result;
}
@@ -645,8 +641,8 @@ get_psy_val(signal_user_data_t *ud)
{
gdouble rd, trell;
gchar *result;
- rd = ghb_settings_get_double(ud->x264_priv, "x264_psy_rd");
- trell = ghb_settings_get_double(ud->x264_priv, "x264_psy_trell");
+ rd = ghb_dict_get_double(ud->x264_priv, "x264_psy_rd");
+ trell = ghb_dict_get_double(ud->x264_priv, "x264_psy_trell");
result = g_strdup_printf("%g|%g", rd, trell);
return result;
}
@@ -676,16 +672,15 @@ x264_opt_update(signal_user_data_t *ud, GtkWidget *widget)
if (opt_syns != NULL)
{
GString *x264opts = g_string_new("");
- gchar *options;
+ const gchar *options;
gchar **split = NULL;
gint ii;
gboolean foundit = FALSE;
- options = ghb_settings_get_string(ud->settings, "x264Option");
+ options = ghb_dict_get_string(ud->settings, "x264Option");
if (options)
{
split = g_strsplit(options, ":", -1);
- g_free(options);
}
for (ii = 0; split && split[ii] != NULL; ii++)
{
@@ -1006,7 +1001,7 @@ sanitize_x264opts(signal_user_data_t *ud, const gchar *options)
split[psy] = g_strdup_printf("psy-rd=%g|0", psy_rd);
}
}
- gint bframes = ghb_settings_get_int(ud->x264_priv, "x264_bframes");
+ gint bframes = ghb_dict_get_int(ud->x264_priv, "x264_bframes");
if (bframes == 0)
{
x264_remove_opt(split, x264_direct_syns);
@@ -1058,14 +1053,14 @@ sanitize_x264opts(signal_user_data_t *ud, const gchar *options)
void
ghb_x264_init(signal_user_data_t *ud)
{
- ud->x264_priv = ghb_settings_new();
+ ud->x264_priv = ghb_dict_new();
}
gboolean
ghb_background_refresh_x264Option(signal_user_data_t *ud)
{
const char *opt;
- opt = ghb_settings_get_const_string(ud->settings, "x264Option");
+ opt = ghb_dict_get_string(ud->settings, "x264Option");
GtkWidget *widget;
GtkTextBuffer *buffer;
@@ -1093,6 +1088,6 @@ ghb_background_refresh_x264Option(signal_user_data_t *ud)
void ghb_update_x264Option(signal_user_data_t *ud, const char *opt)
{
- ghb_settings_set_string(ud->settings, "x264Option", opt);
+ ghb_dict_set_string(ud->settings, "x264Option", opt);
g_idle_add((GSourceFunc)ghb_background_refresh_x264Option, ud);
}