/*
* appcast.c
* Copyright (C) John Stebbins 2008-2013 <stebbins@stebbins>
- *
+ *
* appcast.c is free software.
- *
+ *
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
static const gchar*
lookup_attr_value(
- const gchar *name,
- const gchar **attr_names,
+ const gchar *name,
+ const gchar **attr_names,
const gchar **attr_values)
{
gint ii;
}
return NULL;
}
-
+
static void
start_element(
- GMarkupParseContext *ctx,
- const gchar *tag,
+ GMarkupParseContext *ctx,
+ const gchar *tag,
const gchar **attr_names,
const gchar **attr_values,
gpointer ud,
GError **error)
{
parse_data_t *pd = (parse_data_t*)ud;
- union
+ union
{
gint id;
gpointer pid;
static void
end_element(
- GMarkupParseContext *ctx,
- const gchar *tag,
+ GMarkupParseContext *ctx,
+ const gchar *tag,
gpointer ud,
GError **error)
{
parse_data_t *pd = (parse_data_t*)ud;
gint id;
- union
+ union
{
gint id;
gpointer pid;
static void
text_data(
- GMarkupParseContext *ctx,
- const gchar *text,
+ GMarkupParseContext *ctx,
+ const gchar *text,
gsize len,
gpointer ud,
GError **error)
{
parse_data_t *pd = (parse_data_t*)ud;
- union
+ union
{
gint id;
gpointer pid;
static void
passthrough(
- GMarkupParseContext *ctx,
- const gchar *text,
+ GMarkupParseContext *ctx,
+ const gchar *text,
gsize len,
gpointer ud,
GError **error)
}
// This is required or the parser crashes
-static void
+static void
destroy_notify(gpointer data)
{ // Do nothing
//g_debug("destroy parser");
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
if (asettings != NULL)
{
- track = ghb_settings_combo_int(asettings, "AudioTrack");
+ track = ghb_settings_get_int(asettings, "AudioTrack");
encoder = ghb_settings_combo_int(asettings, "AudioEncoder");
aconfig = ghb_get_scan_audio_info(titleindex, track);
}
g_debug("ghb_santiize_audio ()");
mux = ghb_settings_combo_int(settings, "FileFormat");
titleindex = ghb_settings_get_int(settings, "title_no");
- track = ghb_settings_combo_int(asettings, "AudioTrack");
+ track = ghb_settings_get_int(asettings, "AudioTrack");
acodec = ghb_settings_combo_int(asettings, "AudioEncoder");
mix = ghb_settings_combo_int(asettings, "AudioMixdown");
bitrate = ghb_settings_combo_int(asettings, "AudioBitrate");
g_hash_table_destroy(track_used);
}
-void
-ghb_set_pref_audio_from_settings(signal_user_data_t *ud, GValue *settings)
-{
- const GValue *audio_list, *audio;
- gint count, ii;
-
- // Clear the audio list
- ghb_clear_audio_list_ui(ud->builder);
-
- audio_list = ghb_settings_get_value(settings, "audio_list");
- count = ghb_array_len(audio_list);
- for (ii = 0; ii < count; ii++)
- {
- audio = ghb_array_get_nth(audio_list, ii);
- ghb_add_audio_to_ui(ud, audio);
- ghb_adjust_audio_rate_combos(ud);
- }
-}
-
static GValue*
audio_get_selected_settings(signal_user_data_t *ud, int *index)
{
int titleindex, track, sr, codec;
titleindex = ghb_settings_combo_int(ud->settings, "title");
- track = ghb_settings_combo_int(settings, "AudioTrack");
+ track = ghb_settings_get_int(settings, "AudioTrack");
aconfig = ghb_get_scan_audio_info(titleindex, track);
if (aconfig == NULL)
{
}
titleindex = ghb_settings_combo_int(ud->settings, "title");
- track = ghb_settings_combo_int(ud->settings, "AudioTrack");
+ track = ghb_settings_get_int(ud->settings, "AudioTrack");
if (sr)
{
sr = ghb_find_closest_audio_samplerate(sr);
asettings = audio_select_and_add_track(title, ud->settings,
pref_audio, "und", ii,
track);
- ghb_add_audio_to_ui(ud, asettings);
if (asettings != NULL)
{
- track = ghb_settings_combo_int(asettings, "AudioTrack") + 1;
+ track = ghb_settings_get_int(asettings, "AudioTrack") + 1;
}
} while (asettings != NULL);
}
+ audio_refresh_list_ui(ud);
}
G_MODULE_EXPORT void
{
int titleindex = ghb_settings_combo_int(ud->settings, "title");
ghb_set_pref_audio_settings(titleindex, ud->settings);
- ghb_set_pref_audio_from_settings(ud, ud->settings);
-}
-
-void
-ghb_set_audio(signal_user_data_t *ud, GValue *settings)
-{
- gint acodec_code;
-
- GValue *alist;
- GValue *track, *audio, *acodec, *bitrate, *rate,
- *mix, *drc, *gain, *quality, *enable_quality;
- gint count, ii;
-
- g_debug("set_audio");
- // Clear the audio list
- ghb_clear_audio_list_settings(ud->settings);
- ghb_clear_audio_list_ui(ud->builder);
- alist = ghb_settings_get_value(settings, "audio_list");
-
- count = ghb_array_len(alist);
- for (ii = 0; ii < count; ii++)
- {
- audio = ghb_array_get_nth(alist, ii);
- track = ghb_settings_get_value(audio, "AudioTrack");
- acodec = ghb_settings_get_value(audio, "AudioEncoder");
- enable_quality = ghb_settings_get_value(audio, "AudioTrackQualityEnable");
- quality = ghb_settings_get_value(audio, "AudioTrackQuality");
- bitrate = ghb_settings_get_value(audio, "AudioBitrate");
- rate = ghb_settings_get_value(audio, "AudioSamplerate");
- mix = ghb_settings_get_value(audio, "AudioMixdown");
- gain = ghb_settings_get_value(audio, "AudioTrackGain");
- drc = ghb_settings_get_value(audio, "AudioTrackDRCSlider");
- acodec_code = ghb_lookup_combo_int("AudioEncoder", acodec);
-
- if (acodec_code != 0)
- {
- GValue *asettings = ghb_dict_value_new();
- ghb_settings_set_value(asettings, "AudioTrack", track);
- ghb_settings_set_value(asettings, "AudioEncoder", acodec);
- ghb_settings_set_value(asettings, "AudioTrackQualityEnable", enable_quality);
- ghb_settings_set_value(asettings, "AudioTrackQuality", quality);
-
- // This gets set autimatically if the codec is passthru
- ghb_settings_set_value(asettings, "AudioBitrate", bitrate);
- ghb_settings_set_value(asettings, "AudioSamplerate", rate);
- ghb_settings_set_value(asettings, "AudioMixdown", mix);
- ghb_settings_set_value(asettings, "AudioTrackGain", gain);
- ghb_settings_set_value(asettings, "AudioTrackDRCSlider", drc);
-
- audio_add_to_settings(ud->settings, asettings);
- ghb_add_audio_to_ui(ud, asettings);
- ghb_adjust_audio_rate_combos(ud);
- }
- }
+ audio_refresh_list_ui(ud);
}
static GtkWidget *find_widget(GtkWidget *widget, gchar *name)
gtk_list_box_insert(avail, label, idx);
}
-static void audio_def_selected_lang_list_clear(signal_user_data_t *ud)
+static void
+audio_def_selected_lang_list_clear(signal_user_data_t *ud)
{
GtkListBox *avail, *selected;
avail = GTK_LIST_BOX(GHB_WIDGET(ud->builder, "audio_avail_lang"));
audio_def_lang_list_clear_cb, (gpointer)avail);
}
-static void audio_def_lang_list_init(signal_user_data_t *ud)
+static void
+audio_def_lang_list_init(signal_user_data_t *ud)
{
GValue *lang_list;
}
}
-void ghb_audio_def_settings_init(signal_user_data_t *ud)
+void ghb_audio_defaults_to_ui(signal_user_data_t *ud)
{
GtkListBox *list_box;
GValue *alist;
/*
* audiohandler.h
* Copyright (C) John Stebbins 2008-2013 <stebbins@stebbins>
- *
+ *
* audiohandler.h is free software.
- *
+ *
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
- *
+ *
* callbacks.h is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with callbacks.h. If not, write to:
* The Free Software Foundation, Inc.,
void ghb_adjust_audio_rate_combos(signal_user_data_t *ud);
void ghb_set_pref_audio_settings(gint titleindex, GValue *settings);
-void ghb_set_pref_audio_from_settings(signal_user_data_t *ud, GValue *settings);
-void ghb_set_audio(signal_user_data_t *ud, GValue *settings);
const gchar* ghb_get_user_audio_lang(GValue *settings, hb_title_t *title, gint track);
void ghb_audio_list_refresh_selected(signal_user_data_t *ud);
gint ghb_select_audio_codec(gint mux, hb_audio_config_t *aconfig, gint acodec, gint fallback_acodec, gint copy_mask);
void ghb_audio_list_refresh_all(signal_user_data_t *ud);
char * ghb_format_quality( const char *prefix, int codec, double quality );
void ghb_init_audio_defaults_ui(signal_user_data_t *ud);
-void ghb_audio_def_settings_init(signal_user_data_t *ud);
+void ghb_audio_defaults_to_ui(signal_user_data_t *ud);
GtkListBoxRow* ghb_find_lang_row(GtkListBox *list_box, int lang_idx);
void ghb_audio_title_change(signal_user_data_t *ud, gboolean title_valid);
/*
* callbacks.c
* Copyright (C) John Stebbins 2008-2013 <stebbins@stebbins>
- *
+ *
* callbacks.c is free software.
- *
+ *
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
#include "ghbcellrenderertext.h"
#include "x264handler.h"
-static void reset_chapter_list(signal_user_data_t *ud, GValue *settings);
-static void update_chapter_list_from_settings(GtkBuilder *builder, GValue *settings);
+static void load_all_titles(signal_user_data_t *ud, int titleindex);
static void update_chapter_list_settings(GValue *settings);
static GList* dvd_device_list();
static void prune_logs(signal_user_data_t *ud);
gboolean result = TRUE;
GValue *array, *data;
gchar *widget_name;
-
+
g_debug("dep_check () %s", name);
if (rev_map == NULL) return TRUE;
void
ghb_check_dependency(
- signal_user_data_t *ud,
- GtkWidget *widget,
+ signal_user_data_t *ud,
+ GtkWidget *widget,
const char *alt_name)
{
GObject *dep_object;
camel_convert(gchar *str)
{
gint state = CAMEL_OTHER;
-
+
if (str == NULL) return;
while (*str)
{
state = CAMEL_FIRST_UPPER;
else
state = CAMEL_OTHER;
-
+
} break;
case CAMEL_FIRST_UPPER:
{
if (name != NULL)
g_free(name);
}
-
+
free_drive(link->data);
link = link->next;
}
}
static const gchar*
-get_extension(GValue *settings)
+get_extension(signal_user_data_t *ud, GValue *settings)
{
int container;
const gchar *extension;
container = ghb_settings_combo_int(settings, "FileFormat");
if ((container & HB_MUX_MASK_MP4) &&
- ghb_settings_get_boolean(settings, "UseM4v"))
+ ghb_settings_get_boolean(ud->prefs, "UseM4v"))
{
return "m4v";
}
}
static void
-set_destination_settings(GValue *settings)
+set_destination_settings(signal_user_data_t *ud, GValue *settings)
{
+ const gchar *extension;
+ gchar *filename;
+
+ extension = get_extension(ud, settings);
+
g_debug("set_destination_settings");
- if (ghb_settings_get_boolean(settings, "use_source_name"))
+ if (ghb_settings_get_boolean(ud->prefs, "use_source_name"))
{
GString *str = g_string_new("");
gchar *vol_name;
- const gchar *extension;
- gchar *new_name;
gint title;
-
- extension = get_extension(settings);
+
vol_name = ghb_settings_get_string(settings, "volume_label");
g_string_append_printf(str, "%s", vol_name);
title = ghb_settings_get_int(settings, "title_no");
if (title >= 0)
{
- if (ghb_settings_get_boolean(settings, "title_no_in_destination"))
+ if (ghb_settings_get_boolean(ud->prefs, "title_no_in_destination"))
{
g_string_append_printf(str, " - %d", title+1);
}
- if (ghb_settings_combo_int(settings, "PtoPType") == 0 &&
- ghb_settings_get_boolean(
- settings, "chapters_in_destination"))
+ if (ghb_settings_combo_int(settings, "PtoPType") == 0 &&
+ ghb_settings_get_boolean(ud->prefs, "chapters_in_destination"))
{
gint start, end;
if (!ghb_settings_get_boolean(
- settings, "title_no_in_destination"))
+ ud->prefs, "title_no_in_destination"))
{
g_string_append_printf(str, " -");
}
}
}
g_string_append_printf(str, ".%s", extension);
- new_name = g_string_free(str, FALSE);
- ghb_settings_set_string(settings, "dest_file", new_name);
+ filename = g_string_free(str, FALSE);
+ ghb_settings_set_string(settings, "dest_file", filename);
g_free(vol_name);
- g_free(new_name);
+ g_free(filename);
+ }
+ else
+ {
+ filename = g_strdup_printf("new_video.%s", extension);
+ ghb_settings_set_string(settings, "dest_file", filename);
+ g_free(filename);
}
}
static void
set_destination(signal_user_data_t *ud)
{
- set_destination_settings(ud->settings);
- ghb_ui_update(ud, "dest_file",
+ set_destination_settings(ud, ud->settings);
+ ghb_ui_update(ud, "dest_file",
ghb_settings_get_value(ud->settings, "dest_file"));
}
if (dtype == DRIVE_CDROM)
{
gchar vname[51], fsname[51];
- GetVolumeInformation(drive, vname, 50, NULL,
+ GetVolumeInformation(drive, vname, 50, NULL,
NULL, NULL, fsname, 50);
name = g_strdup(vname);
return name;
}
static gboolean
-update_source_label(signal_user_data_t *ud, const gchar *source, gboolean update_dest)
+update_source_label(signal_user_data_t *ud, const gchar *source)
{
gchar *label = NULL;
gint len;
gchar **path;
gchar *start;
gchar *filename = g_strdup(source);
-
+
g_debug("update_source_label()");
len = strlen(filename);
if (g_file_test(filename, G_FILE_TEST_IS_DIR))
start++;
else
start = filename;
-
+
path = g_strsplit(start, G_DIR_SEPARATOR_S, -1);
len = g_strv_length (path);
if ((len > 1) && (strcmp("VIDEO_TS", path[len-1]) == 0))
}
}
g_free(filename);
- GtkWidget *widget = GHB_WIDGET (ud->builder, "source_title");
+ GtkWidget *widget = GHB_WIDGET (ud->builder, "volume_label");
if (label != NULL)
{
gtk_label_set_text (GTK_LABEL(widget), label);
ghb_settings_set_string(ud->settings, "volume_label", label);
g_free(label);
- if (update_dest)
- set_destination(ud);
}
else
{
const gchar *device;
gboolean foundit = FALSE;
GtkComboBox *combo;
-
+
g_debug("chooser_file_selected_cb ()");
if (name == NULL) return;
{
GtkComboBoxText *combo;
GList *drives, *link;
-
+
g_debug("source_dialog_extra_widgets ()");
combo = GTK_COMBO_BOX_TEXT(GHB_WIDGET(ud->builder, "source_device"));
gtk_list_store_clear(GTK_LIST_STORE(
gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0);
}
-extern GValue *ghb_queue_edit_settings;
-static gchar *last_scan_file = NULL;
+static void break_duration(gint64 duration, gint *hh, gint *mm, gint *ss)
+{
+ *hh = duration / (60*60);
+ *mm = (duration / 60) % 60;
+ *ss = duration % 60;
+}
+
+static void
+update_title_duration(signal_user_data_t *ud)
+{
+ gint ti;
+ gint hh, mm, ss, start, end;
+ gchar *text;
+ GtkWidget *widget;
+
+ ti = ghb_settings_combo_int(ud->settings, "title");
+ 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");
+ ghb_part_duration(ti, 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");
+ duration = end - start;
+ break_duration(duration, &hh, &mm, &ss);
+ }
+ else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 2)
+ {
+ hb_title_t * title = ghb_get_title_info (ti);
+ if (title != NULL)
+ {
+ gint64 frames;
+ gint duration;
+
+ start = ghb_settings_get_int(ud->settings, "start_point");
+ end = ghb_settings_get_int(ud->settings, "end_point");
+ frames = end - start + 1;
+ duration = frames * title->rate_base / title->rate;
+ break_duration(duration, &hh, &mm, &ss);
+ }
+ else
+ {
+ hh = mm = ss = 0;
+ }
+ }
+ text = g_strdup_printf("%02d:%02d:%02d", hh, mm, ss);
+ gtk_label_set_text(GTK_LABEL(widget), text);
+ g_free(text);
+}
+
+static void show_container_options(signal_user_data_t *ud)
+{
+ GtkWidget *w1, *w2, *w3;
+ w1 = GHB_WIDGET(ud->builder, "Mp4LargeFile");
+ w2 = GHB_WIDGET(ud->builder, "Mp4HttpOptimize");
+ w3 = GHB_WIDGET(ud->builder, "Mp4iPodCompatible");
+
+ gint mux = ghb_settings_combo_int(ud->settings, "FileFormat");
+ gint enc = ghb_settings_combo_int(ud->settings, "VideoEncoder");
+
+ gtk_widget_set_visible(w1, (mux == HB_MUX_MP4V2));
+ gtk_widget_set_visible(w2, (mux & HB_MUX_MASK_MP4));
+ gtk_widget_set_visible(w3, (mux & HB_MUX_MASK_MP4) && (enc == HB_VCODEC_X264));
+}
+
+void
+ghb_set_widget_ranges(signal_user_data_t *ud, GValue *settings)
+{
+ GtkWidget *widget;
+ int titleindex = ghb_settings_combo_int(settings, "title");
+ hb_title_t * title = ghb_get_title_info(titleindex);
+
+ // Reconfigure the UI combo boxes
+ ghb_update_ui_combo_box(ud, "AudioTrack", titleindex, FALSE);
+ ghb_update_ui_combo_box(ud, "SubtitleTrack", titleindex, FALSE);
+
+ if (title != NULL)
+ {
+ // Set the limits of cropping. hb_set_anamorphic_size crashes if
+ // you pass it a cropped width or height == 0.
+ gint bound;
+ bound = title->height / 2 - 8;
+ widget = GHB_WIDGET(ud->builder, "PictureTopCrop");
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(widget), 0, bound);
+ widget = GHB_WIDGET(ud->builder, "PictureBottomCrop");
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(widget), 0, bound);
+ bound = title->width / 2 - 8;
+ widget = GHB_WIDGET(ud->builder, "PictureLeftCrop");
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(widget), 0, bound);
+ widget = GHB_WIDGET(ud->builder, "PictureRightCrop");
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(widget), 0, bound);
+
+ gint duration = title->duration / 90000;
+
+ gint num_chapters = hb_list_count(title->list_chapter);
+ if (ghb_settings_combo_int(ud->settings, "PtoPType") == 0)
+ {
+ widget = GHB_WIDGET(ud->builder, "start_point");
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(widget), 1, num_chapters);
+ widget = GHB_WIDGET(ud->builder, "end_point");
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(widget), 1, num_chapters);
+ }
+ else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 1)
+ {
+
+ widget = GHB_WIDGET (ud->builder, "start_point");
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(widget), 0, duration-1);
+ widget = GHB_WIDGET (ud->builder, "end_point");
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(widget), 1, duration);
+ }
+ else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 2)
+ {
+ gdouble max_frames = (gdouble)duration * title->rate / title->rate_base;
+ widget = GHB_WIDGET(ud->builder, "start_point");
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(widget), 1, max_frames);
+ widget = GHB_WIDGET(ud->builder, "end_point");
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(widget), 1, max_frames);
+ }
+
+ widget = GHB_WIDGET (ud->builder, "angle");
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(widget), 1, title->angle_count);
+ }
+
+ gdouble vqmin, vqmax, step, page;
+ gboolean inverted;
+ gint digits;
+
+ ghb_vquality_range(ud, &vqmin, &vqmax, &step, &page, &digits, &inverted);
+ GtkWidget *qp = GHB_WIDGET(ud->builder, "VideoQualitySlider");
+ gtk_range_set_range (GTK_RANGE(qp), vqmin, vqmax);
+ gtk_range_set_increments (GTK_RANGE(qp), step, page);
+ gtk_scale_set_digits(GTK_SCALE(qp), digits);
+ gtk_range_set_inverted (GTK_RANGE(qp), inverted);
+}
+
+static void
+check_chapter_markers(signal_user_data_t *ud)
+{
+ GtkWidget *widget;
+ gint start, end;
+
+ 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");
+ widget = GHB_WIDGET (ud->builder, "ChapterMarkers");
+ gtk_widget_set_sensitive(widget, end > start);
+ }
+}
+
+#if 0
+void
+show_settings(GValue *settings)
+{
+ GHashTableIter iter;
+ gchar *key;
+ GValue *gval;
+
+ ghb_dict_iter_init(&iter, settings);
+ // middle (void*) cast prevents gcc warning "defreferencing type-punned
+ // pointer will break strict-aliasing rules"
+ while (g_hash_table_iter_next(
+ &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval))
+ {
+ char *str = ghb_value_string(gval);
+ printf("show key %s val %s\n", key, str);
+ g_free(str);
+ }
+}
+#endif
+
+void
+ghb_load_settings(signal_user_data_t * ud)
+{
+ GValue *preset;
+ gboolean preset_modified;
+ static gboolean busy = FALSE;
+
+ if (busy)
+ return;
+ busy = TRUE;
+
+ preset = ghb_settings_get_value(ud->settings, "preset");
+ preset_modified = ghb_settings_get_boolean(ud->settings, "preset_modified");
+ if (preset_modified)
+ {
+ ghb_clear_presets_selection(ud);
+ }
+ else
+ {
+ ghb_settings_set_boolean(ud->settings, "preset_reload", TRUE);
+ ghb_select_preset(ud->builder, preset);
+ ghb_settings_set_boolean(ud->settings, "preset_reload", FALSE);
+ }
+
+ ghb_set_widget_ranges(ud, ud->settings);
+ ghb_check_all_depencencies(ud);
+ show_container_options(ud);
+ check_chapter_markers(ud);
+
+ ud->dont_clear_presets = TRUE;
+ ud->scale_busy = TRUE;
+
+ ghb_settings_to_ui(ud, ud->settings);
+ ghb_audio_defaults_to_ui(ud);
+ ghb_subtitle_defaults_to_ui(ud);
+ ghb_audio_list_refresh_all(ud);
+ ghb_subtitle_list_refresh_all(ud);
+ ghb_chapter_list_refresh_all(ud);
+ update_title_duration(ud);
+ ghb_update_title_info(ud);
+
+ ud->dont_clear_presets = FALSE;
+ ud->scale_busy = FALSE;
+ busy = FALSE;
+}
-static void
+static void
show_scan_progress(signal_user_data_t *ud)
{
GtkProgressBar *progress;
gtk_progress_bar_set_fraction (progress, 0);
gtk_widget_show(GTK_WIDGET(progress));
- label = GTK_LABEL(GHB_WIDGET(ud->builder, "source_title"));
+ label = GTK_LABEL(GHB_WIDGET(ud->builder, "volume_label"));
gtk_label_set_text( label, _("Scanning ...") );
}
static void
start_scan(
- signal_user_data_t *ud,
- const gchar *path,
- gint titlenum,
+ signal_user_data_t *ud,
+ const gchar *path,
+ gint titlenum,
gint preview_count)
{
GtkWidget *widget;
gtk_widget_set_sensitive(widget, FALSE);
widget = GHB_WIDGET(ud->builder, "source_title_open");
gtk_widget_set_sensitive(widget, FALSE);
- ghb_backend_scan(path, titlenum, preview_count,
- 90000L * ghb_settings_get_int64(ud->settings, "MinTitleDuration"));
+ ghb_backend_scan(path, titlenum, preview_count,
+ 90000L * ghb_settings_get_int64(ud->prefs, "MinTitleDuration"));
}
gboolean
ghb_idle_scan(signal_user_data_t *ud)
{
gchar *path;
- path = ghb_settings_get_string( ud->settings, "scan_source");
+ path = ghb_settings_get_string(ud->globals, "scan_source");
ghb_do_scan(ud, path, 0, TRUE);
g_free(path);
return FALSE;
}
+extern GValue *ghb_queue_edit_settings;
+static gchar *last_scan_file = NULL;
+
void
ghb_do_scan(
- signal_user_data_t *ud,
- const gchar *filename,
- gint titlenum,
+ signal_user_data_t *ud,
+ const gchar *filename,
+ gint titlenum,
gboolean force)
{
g_debug("ghb_do_scan()");
if (!force && last_scan_file != NULL &&
strcmp(last_scan_file, filename) == 0)
{
- if (ghb_queue_edit_settings)
+ if (ghb_queue_edit_settings != NULL)
{
- ghb_settings_to_ui(ud, ghb_queue_edit_settings);
- ghb_set_audio(ud, ghb_queue_edit_settings);
- ghb_reset_subtitles(ud, ghb_queue_edit_settings);
- reset_chapter_list(ud, ghb_queue_edit_settings);
- ghb_value_free(ghb_queue_edit_settings);
+ int titleindex = ghb_settings_get_int(ghb_queue_edit_settings, "title_no");
+ ghb_array_replace(ud->settings_array, titleindex, ghb_queue_edit_settings);
+ ud->settings = ghb_queue_edit_settings;
+ ghb_load_settings(ud);
ghb_queue_edit_settings = NULL;
}
+ else
+ {
+ int titleindex = ghb_settings_get_int(ud->settings, "title_no");
+ load_all_titles(ud, titleindex);
+ }
return;
}
if (last_scan_file != NULL)
if (filename != NULL)
{
last_scan_file = g_strdup(filename);
- ghb_settings_set_string(ud->settings, "scan_source", filename);
- if (update_source_label(ud, filename, TRUE))
+ ghb_settings_set_string(ud->globals, "scan_source", filename);
+ if (update_source_label(ud, filename))
{
gchar *path;
gint preview_count;
show_scan_progress(ud);
- path = ghb_settings_get_string( ud->settings, "scan_source");
+ path = ghb_settings_get_string(ud->globals, "scan_source");
prune_logs(ud);
- preview_count = ghb_settings_get_int(ud->settings, "preview_count");
+ preview_count = ghb_settings_get_int(ud->prefs, "preview_count");
start_scan(ud, path, titlenum, preview_count);
g_free(path);
}
gint response;
g_debug("source_browse_clicked_cb ()");
- sourcename = ghb_settings_get_string(ud->settings, "scan_source");
+ sourcename = ghb_settings_get_string(ud->globals, "scan_source");
GtkWidget *widget;
widget = GHB_WIDGET(ud->builder, "single_title_box");
if (single)
ghb_do_scan(ud, filename, titlenum, TRUE);
if (strcmp(sourcename, filename) != 0)
{
- ghb_settings_set_string (ud->settings,
- "default_source", filename);
- ghb_pref_save (ud->settings, "default_source");
- ghb_dvd_set_current (filename, ud);
+ ghb_settings_set_string(ud->prefs, "default_source", filename);
+ ghb_pref_save(ud->prefs, "default_source");
+ ghb_dvd_set_current(filename, ud);
}
g_free(filename);
}
const gchar *filename;
gchar *sourcename;
- sourcename = ghb_settings_get_string(ud->settings, "scan_source");
+ sourcename = ghb_settings_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->settings, "default_source", filename);
- ghb_pref_save (ud->settings, "default_source");
- ghb_dvd_set_current (filename, ud);
+ ghb_settings_set_string(ud->prefs, "default_source", filename);
+ ghb_pref_save(ud->prefs, "default_source");
+ ghb_dvd_set_current(filename, ud);
}
g_free(sourcename);
}
if (busy)
return;
busy = TRUE;
- extension = get_extension(ud->settings);
+ extension = get_extension(ud, ud->settings);
entry = GTK_ENTRY(GHB_WIDGET(ud->builder, "dest_file"));
filename = g_strdup(gtk_entry_get_text(entry));
for (ii = 0; containers[ii] != NULL; ii++)
{
gchar *pos;
gchar *new_name;
-
+
pos = g_strrstr( filename, "." );
if (pos == NULL)
{
// Extension is already correct
break;
}
- new_name = g_strjoin(".", filename, extension, NULL);
+ new_name = g_strjoin(".", filename, extension, NULL);
ghb_ui_update(ud, "dest_file", ghb_string_value(new_name));
g_free(new_name);
break;
G_MODULE_EXPORT gboolean
destination_grab_cb(
- GtkEntry *entry,
+ GtkEntry *entry,
signal_user_data_t *ud)
{
destination_select_title(entry);
dest_dir_set_cb(GtkFileChooserButton *dest_chooser, signal_user_data_t *ud)
{
gchar *dest_file, *dest_dir, *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_file_changed_cb(GtkEntry *entry, signal_user_data_t *ud)
{
gchar *dest_file, *dest_dir, *dest;
-
+
g_debug("dest_file_changed_cb ()");
ghb_update_destination_extension(ud);
ghb_widget_to_setting(ud->settings, (GtkWidget*)entry);
{
char *filename, *dirname;
GtkFileChooser *dest_chooser;
-
+
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
basename = g_path_get_basename(filename);
dirname = g_path_get_dirname(filename);
ghb_grey_combo_options (ud);
}
-static void
-set_visible(GtkWidget *widget, gboolean visible)
-{
- if (visible)
- {
- gtk_widget_show_now(widget);
- }
- else
- {
- gtk_widget_hide(widget);
- }
-}
-
-static void show_container_options(signal_user_data_t *ud)
-{
- GtkWidget *w1, *w2, *w3;
- w1 = GHB_WIDGET(ud->builder, "Mp4LargeFile");
- w2 = GHB_WIDGET(ud->builder, "Mp4HttpOptimize");
- w3 = GHB_WIDGET(ud->builder, "Mp4iPodCompatible");
-
- gint mux = ghb_settings_combo_int(ud->settings, "FileFormat");
- gint enc = ghb_settings_combo_int(ud->settings, "VideoEncoder");
-
- set_visible(w1, (mux == HB_MUX_MP4V2));
- set_visible(w2, (mux & HB_MUX_MASK_MP4));
- set_visible(w3, (mux & HB_MUX_MASK_MP4) && (enc == HB_VCODEC_X264));
-}
-
G_MODULE_EXPORT void
container_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
return rate_s;
}
-static void break_duration(gint64 duration, gint *hh, gint *mm, gint *ss)
-{
- *hh = duration / (60*60);
- *mm = (duration / 60) % 60;
- *ss = duration % 60;
-}
-
static void
-update_title_duration(signal_user_data_t *ud)
+update_aspect_info(signal_user_data_t *ud)
{
- gint ti;
- gint hh, mm, ss, start, end;
- gchar *text;
GtkWidget *widget;
+ gchar *text;
- ti = ghb_settings_combo_int(ud->settings, "title");
- widget = GHB_WIDGET (ud->builder, "title_duration");
-
- if (ghb_settings_combo_int(ud->settings, "PtoPType") == 0)
+ text = ghb_settings_get_boolean(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");
+ widget = GHB_WIDGET(ud->builder, "scale_auto");
+ gtk_label_set_text(GTK_LABEL(widget), text);
+ switch (ghb_settings_combo_int(ud->settings, "PicturePAR"))
{
- start = ghb_settings_get_int(ud->settings, "start_point");
- end = ghb_settings_get_int(ud->settings, "end_point");
- ghb_part_duration(ti, start, end, &hh, &mm, &ss);
+ case 0:
+ text = _("Off");
+ break;
+ case 1:
+ text = _("Strict");
+ break;
+ case 2:
+ text = _("Loose");
+ break;
+ case 3:
+ text = _("Custom");
+ break;
+ default:
+ text = _("Unknown");
+ break;
}
- else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 1)
- {
- gint duration;
+ widget = GHB_WIDGET(ud->builder, "scale_anamorphic");
+ gtk_label_set_text(GTK_LABEL(widget), text);
+}
- start = ghb_settings_get_int(ud->settings, "start_point");
- end = ghb_settings_get_int(ud->settings, "end_point");
- duration = end - start;
- break_duration(duration, &hh, &mm, &ss);
- }
- else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 2)
- {
- hb_title_t * title = ghb_get_title_info (ti);
- if (title != NULL)
- {
- gint64 frames;
- gint duration;
+static void
+update_crop_info(signal_user_data_t *ud)
+{
+ GtkWidget *widget;
+ gchar *text;
+ gint width, height, crop[4];
+ gint titleindex;
+ hb_title_t *title;
- start = ghb_settings_get_int(ud->settings, "start_point");
- end = ghb_settings_get_int(ud->settings, "end_point");
- frames = end - start + 1;
- duration = frames * title->rate_base / title->rate;
- break_duration(duration, &hh, &mm, &ss);
- }
- else
- {
- hh = mm = ss = 0;
- }
+ titleindex = ghb_settings_combo_int(ud->settings, "title");
+ title = ghb_get_title_info(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");
+ width = title->width - crop[2] - crop[3];
+ height = title->height - crop[0] - crop[1];
+ widget = GHB_WIDGET(ud->builder, "crop_dimensions");
+ text = g_strdup_printf ("%d x %d", width, height);
+ gtk_label_set_text(GTK_LABEL(widget), text);
+ widget = GHB_WIDGET(ud->builder, "crop_dimensions2");
+ gtk_label_set_text(GTK_LABEL(widget), text);
+ g_free(text);
}
- text = g_strdup_printf("%02d:%02d:%02d", hh, mm, ss);
+ widget = GHB_WIDGET (ud->builder, "crop_values");
+ text = g_strdup_printf ("%d:%d:%d:%d", crop[0], crop[1], crop[2], crop[3]);
gtk_label_set_text (GTK_LABEL(widget), text);
g_free(text);
}
static void
-show_title_info(signal_user_data_t *ud, hb_title_t *title)
+update_scale_info(signal_user_data_t *ud)
{
GtkWidget *widget;
gchar *text;
- ghb_settings_set_string(ud->settings, "source", title->path);
- if (title->type == HB_STREAM_TYPE || title->type == HB_FF_STREAM_TYPE)
- {
- GtkWidget *widget = GHB_WIDGET (ud->builder, "source_title");
- if (title->name != NULL && title->name[0] != 0)
- {
- gtk_label_set_text (GTK_LABEL(widget), title->name);
- ghb_settings_set_string(ud->settings, "volume_label", title->name);
- set_destination(ud);
- }
- else
- {
- gchar *label = _("No Title Found");
- gtk_label_set_text (GTK_LABEL(widget), label);
- ghb_settings_set_string(ud->settings, "volume_label", label);
- }
- }
- ud->dont_clear_presets = TRUE;
- ud->scale_busy = TRUE;
+ gint width = ghb_settings_get_int(ud->settings, "scale_width");
+ gint height = ghb_settings_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);
+ g_free(text);
+}
+
+void
+ghb_update_title_info(signal_user_data_t *ud)
+{
+ GtkWidget *widget;
+ gchar *text;
+
+ int titleindex = ghb_settings_get_int(ud->settings, "title_no");
+ hb_title_t * title = ghb_get_title_info(titleindex);
+ if (title == NULL)
+ return;
+
update_title_duration(ud);
- widget = GHB_WIDGET (ud->builder, "source_codec");
+
+ widget = GHB_WIDGET (ud->builder, "source_video_codec");
if ( title->video_codec_name )
gtk_label_set_text (GTK_LABEL(widget), title->video_codec_name);
else
gtk_label_set_text (GTK_LABEL(widget), "Unknown");
+
widget = GHB_WIDGET (ud->builder, "source_dimensions");
text = g_strdup_printf ("%d x %d", title->width, title->height);
gtk_label_set_text (GTK_LABEL(widget), text);
- ghb_settings_set_int(ud->settings, "source_width", title->width);
- ghb_settings_set_int(ud->settings, "source_height", title->height);
g_free(text);
+
widget = GHB_WIDGET (ud->builder, "source_aspect");
gint aspect_n, aspect_d;
hb_reduce(&aspect_n, &aspect_d,
title->height * title->pixel_aspect_height);
text = get_aspect_string(aspect_n, aspect_d);
gtk_label_set_text (GTK_LABEL(widget), text);
- g_free(text);
-
- widget = GHB_WIDGET (ud->builder, "source_frame_rate");
- text = (gchar*)get_rate_string(title->rate_base, title->rate);
- gtk_label_set_text (GTK_LABEL(widget), text);
- g_free(text);
-
- //widget = GHB_WIDGET (ud->builder, "source_interlaced");
- //gtk_label_set_text (GTK_LABEL(widget), title->interlaced ? "Yes" : "No");
-
- ghb_ui_update(ud, "scale_width",
- ghb_int64_value(title->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(ud->settings, "PictureKeepRatio");
- pic_par = ghb_settings_combo_int(ud->settings, "PicturePAR");
- if (!(keep_aspect || pic_par) || pic_par == 3)
- {
- ghb_ui_update(ud, "scale_height",
- ghb_int64_value(title->height - title->crop[0] - title->crop[1]));
- }
-
- // Set the limits of cropping. hb_set_anamorphic_size crashes if
- // you pass it a cropped width or height == 0.
- gint bound;
- bound = title->height / 2 - 8;
- widget = GHB_WIDGET (ud->builder, "PictureTopCrop");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 0, bound);
- widget = GHB_WIDGET (ud->builder, "PictureBottomCrop");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 0, bound);
- bound = title->width / 2 - 8;
- widget = GHB_WIDGET (ud->builder, "PictureLeftCrop");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 0, bound);
- widget = GHB_WIDGET (ud->builder, "PictureRightCrop");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 0, bound);
- if (ghb_settings_get_boolean(ud->settings, "PictureAutoCrop"))
- {
- ghb_ui_update(ud, "PictureTopCrop", ghb_int64_value(title->crop[0]));
- ghb_ui_update(ud, "PictureBottomCrop", ghb_int64_value(title->crop[1]));
- ghb_ui_update(ud, "PictureLeftCrop", ghb_int64_value(title->crop[2]));
- ghb_ui_update(ud, "PictureRightCrop", ghb_int64_value(title->crop[3]));
- }
- ud->scale_busy = FALSE;
- ghb_set_scale (ud, GHB_PIC_KEEP_PAR|GHB_PIC_USE_MAX);
- gint width, height, crop[4];
- 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");
- width = title->width - crop[2] - crop[3];
- height = title->height - crop[0] - crop[1];
- widget = GHB_WIDGET (ud->builder, "crop_dimensions");
- text = g_strdup_printf ("%d x %d", width, height);
- gtk_label_set_text (GTK_LABEL(widget), text);
- g_free(text);
-
-
- gint duration = title->duration / 90000;
-
- gint num_chapters = hb_list_count(title->list_chapter);
- if (ghb_settings_combo_int(ud->settings, "PtoPType") == 0)
- {
- widget = GHB_WIDGET (ud->builder, "start_point");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, num_chapters);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), 1);
-
- widget = GHB_WIDGET (ud->builder, "end_point");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, num_chapters);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), num_chapters);
- }
- else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 1)
- {
+ g_free(text);
- widget = GHB_WIDGET (ud->builder, "start_point");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 0, duration-1);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), 0);
+ widget = GHB_WIDGET (ud->builder, "source_frame_rate");
+ text = (gchar*)get_rate_string(title->rate_base, title->rate);
+ gtk_label_set_text (GTK_LABEL(widget), text);
+ g_free(text);
- widget = GHB_WIDGET (ud->builder, "end_point");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, duration);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), duration);
- }
- else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 2)
- {
- gdouble max_frames = (gdouble)duration * title->rate / title->rate_base;
- widget = GHB_WIDGET (ud->builder, "start_point");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, max_frames);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), 1);
+ //widget = GHB_WIDGET (ud->builder, "source_interlaced");
+ //gtk_label_set_text (GTK_LABEL(widget), title->interlaced ? "Yes" : "No");
- widget = GHB_WIDGET (ud->builder, "end_point");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, max_frames);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), max_frames);
- }
+ ghb_update_display_aspect_label(ud);
- widget = GHB_WIDGET (ud->builder, "angle");
- gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), 1);
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, title->angle_count);
- ghb_settings_set_int(ud->settings, "angle_count", title->angle_count);
- ud->dont_clear_presets = FALSE;
- // Set default metadata name
- ghb_ui_update(ud, "MetaName", ghb_string_value(title->name));
- if (title->metadata)
- {
- if (title->metadata->name)
- {
- ghb_ui_update(ud, "MetaName",
- ghb_string_value(title->metadata->name));
- }
- ghb_ui_update(ud, "MetaArtist",
- ghb_string_value(title->metadata->artist));
- ghb_ui_update(ud, "MetaReleaseDate",
- ghb_string_value(title->metadata->release_date));
- ghb_ui_update(ud, "MetaComment",
- ghb_string_value(title->metadata->comment));
- if (!title->metadata->name && title->metadata->album)
- {
- ghb_ui_update(ud, "MetaName",
- ghb_string_value(title->metadata->album));
- }
- ghb_ui_update(ud, "MetaAlbumArtist",
- ghb_string_value(title->metadata->album_artist));
- ghb_ui_update(ud, "MetaGenre",
- ghb_string_value(title->metadata->genre));
- ghb_ui_update(ud, "MetaDescription",
- ghb_string_value(title->metadata->description));
- ghb_ui_update(ud, "MetaLongDescription",
- ghb_string_value(title->metadata->long_description));
- }
+ update_crop_info(ud);
+ update_aspect_info(ud);
+ update_scale_info(ud);
}
void
-set_title_settings(GValue *settings, gint titleindex)
+set_title_settings(signal_user_data_t *ud, GValue *settings, gint titleindex)
{
ghb_settings_set_int(settings, "title", titleindex);
ghb_settings_set_int(settings, "title_no", titleindex);
{
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_string(settings, "volume_label", label);
}
}
+ else
+ {
+ ghb_settings_set_value(settings, "volume_label",
+ ghb_settings_get_value(ud->settings, "volume_label"));
+ }
ghb_settings_set_int(settings, "scale_width",
title->width - title->crop[2] - title->crop[3]);
- // If anamorphic or keep_aspect, the hight will
+ // If anamorphic or keep_aspect, the hight will
// be automatically calculated
gboolean keep_aspect;
gint pic_par;
ghb_settings_set_string(settings, "MetaLongDescription",
title->metadata->long_description);
}
- ghb_set_pref_subtitle_settings(title, settings);
+ ghb_set_pref_subtitle_settings(ud, title, settings);
}
update_chapter_list_settings(settings);
ghb_set_pref_audio_settings(titleindex, settings);
- set_destination_settings(settings);
+
+ set_destination_settings(ud, settings);
+ ghb_settings_set_value(settings, "dest_dir",
+ ghb_settings_get_value(ud->prefs, "destination_dir"));
char *dest_file, *dest_dir, *dest;
dest_file = ghb_settings_get_string(settings, "dest_file");
g_free(dest_file);
g_free(dest_dir);
g_free(dest);
+
+ ghb_settings_set_int(settings, "preview_frame", 2);
+}
+
+void
+ghb_set_current_title_settings(signal_user_data_t *ud)
+{
+ int titleindex = ghb_settings_get_int(ud->settings, "title_no");
+ set_title_settings(ud, ud->settings, titleindex);
+}
+
+static void
+load_all_titles(signal_user_data_t *ud, int titleindex)
+{
+ gint ii, count;
+ GValue *preset, *preset_path;
+ GValue *settings_array;
+
+ hb_list_t *list = ghb_get_title_list();
+ count = hb_list_count(list);
+
+ if (count == 0)
+ count = 1;
+
+ settings_array = ghb_array_value_new(count);
+
+ preset = ghb_get_current_preset(ud);
+ preset_path = ghb_get_current_preset_path(ud);
+ for (ii = 0; ii < count; ii++)
+ {
+ GValue *settings = ghb_settings_new();
+
+ ghb_settings_init(settings, "Initialization");
+ ghb_settings_init(settings, "Presets");
+ ghb_preset_to_settings(settings, preset);
+ ghb_settings_set_value(settings, "preset", preset_path);
+ set_title_settings(ud, settings, ii);
+ ghb_array_append(settings_array, settings);
+ }
+ if (titleindex < 0 || titleindex >= count)
+ {
+ titleindex = 0;
+ }
+ ghb_value_free(ud->settings_array);
+ ud->settings_array = settings_array;
+ ud->settings = ghb_array_get_nth(ud->settings_array, titleindex);
}
void
ghb_add_all_titles(signal_user_data_t *ud)
{
gint ii;
- gint count = ghb_get_title_count();
+ gint count;
+ count = ghb_array_len(ud->settings_array);
for (ii = 0; ii < count; ii++)
{
- GValue *settings = ghb_value_dup(ud->settings);
- ghb_settings_set_boolean(settings, "use_source_name", TRUE);
- hb_title_t * title = ghb_get_title_info(ii);
- if (title != NULL)
- {
- if (title->type == HB_DVD_TYPE ||
- title->type == HB_BD_TYPE)
- {
- ghb_settings_set_boolean(settings,
- "title_no_in_destination", TRUE);
- }
- }
- set_title_settings(settings, ii);
+ GValue *settings;
+
+ settings = ghb_value_dup(ghb_array_get_nth(ud->settings_array, ii));
ghb_queue_add(ud, settings, ii);
}
}
G_MODULE_EXPORT void
title_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- gint titleindex;
+ gint titleindex, count;
+ GValue *wval;
g_debug("title_changed_cb ()");
- ghb_widget_to_setting(ud->settings, widget);
- titleindex = ghb_settings_combo_int(ud->settings, "title");
- ghb_settings_set_int(ud->settings, "title_no", titleindex);
- ghb_update_ui_combo_box (ud, "AudioTrack", titleindex, FALSE);
- ghb_update_ui_combo_box (ud, "SubtitleTrack", titleindex, FALSE);
+ wval = ghb_widget_value(widget);
+ titleindex = ghb_lookup_combo_int("title", wval);
+ ghb_value_free(wval);
+
+ count = ghb_array_len(ud->settings_array);
+ int idx = (titleindex >= 0 && titleindex < count) ? titleindex : 0;
+ ud->settings = ghb_array_get_nth(ud->settings_array, idx);
+ ghb_load_settings(ud);
hb_title_t * title = ghb_get_title_info(titleindex);
- if (title != NULL)
- {
- show_title_info(ud, title);
- }
- ghb_check_dependency(ud, widget, NULL);
- update_chapter_list_settings(ud->settings);
- update_chapter_list_from_settings(ud->builder, ud->settings);
ghb_audio_title_change(ud, title != NULL);
- ghb_set_pref_audio_settings(titleindex, ud->settings);
- ghb_set_pref_audio_from_settings(ud, ud->settings);
ghb_subtitle_title_change(ud, title != NULL);
- ghb_set_pref_subtitle(titleindex, ud);
- ghb_grey_combo_options (ud);
-
- // Unfortunately, there is no way to query how many frames were
- // actually generated during the scan.
- // If I knew how many were generated, I would adjust the spin
- // control range here.
- // I do know how many were asked for.
- gint preview_count;
- preview_count = ghb_settings_get_int(ud->settings, "preview_count");
- widget = GHB_WIDGET(ud->builder, "preview_frame");
- gtk_range_set_range (GTK_RANGE(widget), 1, preview_count);
- ghb_ui_update(ud, "preview_frame", ghb_int64_value(2));
-
- ghb_set_preview_image (ud);
- if (ghb_settings_get_boolean(ud->settings, "title_no_in_destination"))
- {
- set_destination(ud);
- }
- ghb_preview_set_visible(ud);
+ ghb_grey_combo_options(ud);
- gint end;
- widget = GHB_WIDGET (ud->builder, "ChapterMarkers");
- end = ghb_settings_get_int(ud->settings, "end_point");
- if (1 == end)
- {
- gtk_widget_set_sensitive(widget, FALSE);
- }
- else
+ if (title != NULL)
{
- gtk_widget_set_sensitive(widget, TRUE);
+ ghb_set_preview_image(ud);
+ ghb_preview_set_visible(ud);
}
}
}
G_MODULE_EXPORT gboolean
-meta_focus_out_cb(GtkWidget *widget, GdkEventFocus *event,
+meta_focus_out_cb(GtkWidget *widget, GdkEventFocus *event,
signal_user_data_t *ud)
{
ghb_widget_to_setting(ud->settings, widget);
gdouble step;
if (vcodec == HB_VCODEC_X264)
{
- step = ghb_settings_combo_double(ud->settings,
- "VideoQualityGranularity");
+ step = ghb_settings_combo_double(ud->prefs, "VideoQualityGranularity");
}
else
{
if (start > end)
ghb_ui_update(ud, "end_point", ghb_int_value(start));
ghb_check_dependency(ud, widget, NULL);
- if (ghb_settings_get_boolean(ud->settings, "chapters_in_destination"))
+ if (ghb_settings_get_boolean(ud->prefs, "chapters_in_destination"))
{
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");
- if (start == end)
- {
- gtk_widget_set_sensitive(widget, FALSE);
- }
- else
- {
- gtk_widget_set_sensitive(widget, TRUE);
- }
+ gtk_widget_set_sensitive(widget, end > start);
update_title_duration(ud);
}
else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 1)
if (start > end)
ghb_ui_update(ud, "start_point", ghb_int_value(end));
ghb_check_dependency(ud, widget, NULL);
- if (ghb_settings_get_boolean(ud->settings, "chapters_in_destination"))
+ if (ghb_settings_get_boolean(ud->prefs, "chapters_in_destination"))
{
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");
- if (start == end)
- {
- gtk_widget_set_sensitive(widget, FALSE);
- }
- else
- {
- gtk_widget_set_sensitive(widget, TRUE);
- }
+ gtk_widget_set_sensitive(widget, end > start);
update_title_duration(ud);
}
else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 1)
ghb_check_dependency(ud, widget, NULL);
ghb_clear_presets_selection(ud);
if (gtk_widget_is_sensitive(widget))
- ghb_set_scale (ud, GHB_PIC_KEEP_WIDTH);
+ ghb_set_scale(ud, GHB_PIC_KEEP_WIDTH);
update_preview = TRUE;
- gchar *text;
- gint width = ghb_settings_get_int(ud->settings, "scale_width");
- gint height = ghb_settings_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);
- g_free(text);
ghb_live_reset(ud);
+
+ update_scale_info(ud);
}
G_MODULE_EXPORT void
ghb_check_dependency(ud, widget, NULL);
ghb_clear_presets_selection(ud);
if (gtk_widget_is_sensitive(widget))
- ghb_set_scale (ud, GHB_PIC_KEEP_HEIGHT);
+ ghb_set_scale(ud, GHB_PIC_KEEP_HEIGHT);
update_preview = TRUE;
- gchar *text;
- gint width = ghb_settings_get_int(ud->settings, "scale_width");
- gint height = ghb_settings_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);
- g_free(text);
ghb_live_reset(ud);
+
+ update_scale_info(ud);
}
G_MODULE_EXPORT void
crop_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- gint titleindex, crop[4];
-
g_debug("crop_changed_cb ()");
ghb_widget_to_setting(ud->settings, widget);
ghb_check_dependency(ud, widget, NULL);
ghb_clear_presets_selection(ud);
if (gtk_widget_is_sensitive(widget))
- ghb_set_scale (ud, 0);
-
- 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");
- titleindex = ghb_settings_combo_int(ud->settings, "title");
- hb_title_t * title = ghb_get_title_info(titleindex);
- if (title != NULL)
- {
- gint width, height;
- gchar *text;
-
- width = title->width - crop[2] - crop[3];
- height = title->height - crop[0] - crop[1];
- widget = GHB_WIDGET (ud->builder, "crop_dimensions");
- text = g_strdup_printf ("%d x %d", width, height);
- gtk_label_set_text (GTK_LABEL(widget), text);
- widget = GHB_WIDGET (ud->builder, "crop_dimensions2");
- gtk_label_set_text (GTK_LABEL(widget), text);
- g_free(text);
- }
- gchar *text;
- widget = GHB_WIDGET (ud->builder, "crop_values");
- text = g_strdup_printf ("%d:%d:%d:%d", crop[0], crop[1], crop[2], crop[3]);
- gtk_label_set_text (GTK_LABEL(widget), text);
- g_free(text);
+ ghb_set_scale(ud, 0);
update_preview = TRUE;
ghb_live_reset(ud);
+
+ update_crop_info(ud);
}
G_MODULE_EXPORT void
ghb_clear_presets_selection(ud);
ghb_live_reset(ud);
if (gtk_widget_is_sensitive(widget))
- ghb_set_scale (ud, GHB_PIC_KEEP_DISPLAY_WIDTH);
+ ghb_set_scale(ud, GHB_PIC_KEEP_DISPLAY_WIDTH);
update_preview = TRUE;
}
ghb_clear_presets_selection(ud);
ghb_live_reset(ud);
if (gtk_widget_is_sensitive(widget))
- ghb_set_scale (ud, GHB_PIC_KEEP_DISPLAY_HEIGHT);
+ ghb_set_scale(ud, GHB_PIC_KEEP_DISPLAY_HEIGHT);
update_preview = TRUE;
}
ghb_clear_presets_selection(ud);
ghb_live_reset(ud);
if (gtk_widget_is_sensitive(widget))
- ghb_set_scale (ud, GHB_PIC_KEEP_PAR);
+ ghb_set_scale(ud, GHB_PIC_KEEP_PAR);
update_preview = TRUE;
}
ghb_clear_presets_selection(ud);
ghb_live_reset(ud);
if (gtk_widget_is_sensitive(widget))
- ghb_set_scale (ud, 0);
+ ghb_set_scale(ud, 0);
update_preview = TRUE;
-
- gchar *text;
-
- text = ghb_settings_get_boolean(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");
- widget = GHB_WIDGET (ud->builder, "scale_auto");
- gtk_label_set_text (GTK_LABEL(widget), text);
- switch (ghb_settings_combo_int(ud->settings, "PicturePAR"))
- {
- case 0:
- text = _("Off");
- break;
- case 1:
- text = _("Strict");
- break;
- case 2:
- text = _("Loose");
- break;
- case 3:
- text = _("Custom");
- break;
- default:
- text = _("Unknown");
- break;
- }
- widget = GHB_WIDGET (ud->builder, "scale_anamorphic");
- gtk_label_set_text (GTK_LABEL(widget), text);
+
+ update_aspect_info(ud);
}
G_MODULE_EXPORT void
show_crop_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
g_debug("show_crop_changed_cb ()");
- ghb_widget_to_setting(ud->settings, widget);
+ ghb_widget_to_setting(ud->prefs, widget);
ghb_check_dependency(ud, widget, NULL);
ghb_live_reset(ud);
if (gtk_widget_is_sensitive(widget))
- ghb_set_scale (ud, 0);
+ ghb_set_scale(ud, 0);
+ ghb_pref_save (ud->prefs, "preview_show_crop");
update_preview = TRUE;
}
gtk_main_quit();
return FALSE;
}
- str = g_strdup_printf(_("%s\n\n%s in %d seconds ..."),
+ str = g_strdup_printf(_("%s\n\n%s in %d seconds ..."),
cd->msg, cd->action, cd->timeout);
gtk_message_dialog_set_markup(cd->dlg, str);
g_free(str);
gtk_main_quit();
return FALSE;
}
- str = g_strdup_printf(_("%s\n\n%s in %d seconds ..."),
+ str = g_strdup_printf(_("%s\n\n%s in %d seconds ..."),
cd->msg, cd->action, cd->timeout);
gtk_message_dialog_set_markup(cd->dlg, str);
g_free(str);
ghb_suspend_gpm();
return FALSE;
}
- str = g_strdup_printf(_("%s\n\n%s in %d seconds ..."),
+ str = g_strdup_printf(_("%s\n\n%s in %d seconds ..."),
cd->msg, cd->action, cd->timeout);
gtk_message_dialog_set_markup(cd->dlg, str);
g_free(str);
void
ghb_countdown_dialog(
- GtkMessageType type,
- const gchar *message,
- const gchar *action,
- const gchar *cancel,
+ GtkMessageType type,
+ const gchar *message,
+ const gchar *action,
+ const gchar *cancel,
GSourceFunc action_func,
signal_user_data_t *ud,
gint timeout)
GtkResponseType response;
guint timeout_id;
countdown_t cd;
-
+
cd.msg = message;
cd.action = action;
cd.timeout = timeout;
// Toss up a warning dialog
dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
type, GTK_BUTTONS_NONE,
- _("%s\n\n%s in %d seconds ..."),
+ _("%s\n\n%s in %d seconds ..."),
message, action, timeout);
- gtk_dialog_add_buttons( GTK_DIALOG(dialog),
+ gtk_dialog_add_buttons( GTK_DIALOG(dialog),
cancel, GTK_RESPONSE_CANCEL,
NULL);
{
GtkWidget *dialog;
GtkResponseType response;
-
+
// Toss up a warning dialog
dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
type, GTK_BUTTONS_NONE,
"%s", message);
- gtk_dialog_add_buttons( GTK_DIALOG(dialog),
+ gtk_dialog_add_buttons( GTK_DIALOG(dialog),
no, GTK_RESPONSE_NO,
yes, GTK_RESPONSE_YES, NULL);
response = gtk_dialog_run(GTK_DIALOG(dialog));
dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
type, GTK_BUTTONS_NONE,
"%s", message);
- gtk_dialog_add_buttons( GTK_DIALOG(dialog),
+ gtk_dialog_add_buttons( GTK_DIALOG(dialog),
cancel, GTK_RESPONSE_CANCEL, NULL);
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy (dialog);
{
GtkWidget *dialog;
GtkResponseType response;
-
+
if (extra_msg == NULL) extra_msg = "";
// Toss up a warning dialog
dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE,
_("%sYour movie will be lost if you don't continue encoding."),
extra_msg);
- gtk_dialog_add_buttons( GTK_DIALOG(dialog),
+ gtk_dialog_add_buttons( GTK_DIALOG(dialog),
_("Cancel Current and Stop"), 1,
_("Cancel Current, Start Next"), 2,
_("Finish Current, then Stop"), 3,
{
GtkWidget *dialog;
GtkResponseType response;
-
+
if (extra_msg == NULL) extra_msg = "";
// Toss up a warning dialog
dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE,
_("%sYour movie will be lost if you don't continue encoding."),
extra_msg);
- gtk_dialog_add_buttons( GTK_DIALOG(dialog),
+ gtk_dialog_add_buttons( GTK_DIALOG(dialog),
_("Cancel Current and Stop"), 1,
_("Continue Encoding"), 4,
NULL);
gint days;
// Only prune logs stored in the default config dir location
- days = ghb_settings_combo_int(ud->settings, "LogLongevity");
+ days = ghb_settings_combo_int(ud->prefs, "LogLongevity");
if (days > 365)
return;
{
const gchar *file;
gint duration = days * 24 * 60 * 60;
-
+
GDir *gdir = g_dir_open(dest_dir, 0, NULL);
time_t now;
now = localtime(&_now);
destname = ghb_settings_get_string(js, "destination");
basename = g_path_get_basename(destname);
- if (ghb_settings_get_boolean(ud->settings, "EncodeLogLocation"))
+ if (ghb_settings_get_boolean(ud->prefs, "EncodeLogLocation"))
{
dest_dir = g_path_get_dirname (destname);
}
{
gchar *ver_str;
- ver_str = g_strdup_printf("Handbrake Version: %s (%d)\n",
+ ver_str = g_strdup_printf("Handbrake Version: %s (%d)\n",
hb_get_version(NULL), hb_get_build(NULL));
- g_io_channel_write_chars (ud->job_activity_log, ver_str,
+ g_io_channel_write_chars (ud->job_activity_log, ver_str,
-1, NULL, NULL);
g_free(ver_str);
}
g_free(str);
}
-GValue*
+GValue*
ghb_start_next_job(signal_user_data_t *ud, gboolean find_first)
{
static gint current = 0;
GValue *js;
gint ii, count;
gint job_unique_id;
-
+
*job = NULL;
g_debug("find_queue_job");
if (unique_id == 0) // Invalid Id
{
if (status->job_cur == 1 && subtitle_scan)
{
- task_str = g_strdup_printf(_("pass %d (subtitle scan) of %d, "),
+ task_str = g_strdup_printf(_("pass %d (subtitle scan) of %d, "),
status->job_cur, status->job_count);
}
else
{
- task_str = g_strdup_printf(_("pass %d of %d, "),
+ task_str = g_strdup_printf(_("pass %d of %d, "),
status->job_cur, status->job_count);
}
}
" (%.2f fps, avg %.2f fps, ETA %02dh%02dm%02ds)"),
job_str, task_str,
100.0 * status->progress,
- status->rate_cur, status->rate_avg, status->hours,
+ status->rate_cur, status->rate_avg, status->hours,
status->minutes, status->seconds );
}
else
GtkTreeIter iter;
static gint prev_scan_state = 0;
static gint prev_queue_state = 0;
-
+
ghb_track_status();
ghb_get_status(&status);
if (prev_scan_state != status.scan.state ||
}
progress = GTK_PROGRESS_BAR(GHB_WIDGET (ud->builder, "progressbar"));
work_status = GTK_LABEL(GHB_WIDGET (ud->builder, "work_status"));
- if (status.scan.state == GHB_STATE_IDLE &&
+ if (status.scan.state == GHB_STATE_IDLE &&
status.queue.state == GHB_STATE_IDLE)
{
static gboolean prev_dvdnav;
- gboolean dvdnav = ghb_settings_get_boolean(ud->settings, "use_dvdnav");
+ gboolean dvdnav = ghb_settings_get_boolean(ud->prefs, "use_dvdnav");
if (dvdnav != prev_dvdnav)
{
hb_dvd_set_dvdnav(dvdnav);
GtkLabel *label;
scan_prog = GTK_PROGRESS_BAR(GHB_WIDGET (ud->builder, "scan_prog"));
- label = GTK_LABEL(GHB_WIDGET (ud->builder, "source_title"));
+ label = GTK_LABEL(GHB_WIDGET (ud->builder, "volume_label"));
if (status.scan.title_cur == 0)
{
widget = GHB_WIDGET(ud->builder, "source_title_open");
gtk_widget_set_sensitive(widget, TRUE);
- source = ghb_settings_get_string(ud->settings, "scan_source");
- update_source_label(ud, source, FALSE);
+ source = ghb_settings_get_string(ud->globals, "scan_source");
+ update_source_label(ud, source);
scan_prog = GTK_PROGRESS_BAR(GHB_WIDGET (ud->builder, "scan_prog"));
gtk_progress_bar_set_fraction (scan_prog, 1.0);
gtk_widget_hide(GTK_WIDGET(scan_prog));
- if (!ghb_settings_get_boolean(ud->settings, "preset_modified"))
- {
- ghb_refresh_preset(ud);
- }
-
ghb_update_ui_combo_box(ud, "title", 0, FALSE);
+
titleindex = ghb_longest_title();
- ghb_ui_update(ud, "title", ghb_int64_value(titleindex));
+ load_all_titles(ud, titleindex);
- label = GTK_LABEL(GHB_WIDGET (ud->builder, "source_title"));
+ label = GTK_LABEL(GHB_WIDGET (ud->builder, "volume_label"));
// Are there really any titles.
hb_title_t * title = ghb_get_title_info(titleindex);
if (title == NULL)
{
- gtk_label_set_text(label, _("None"));
+ gtk_label_set_text(label, _("No Title Found"));
}
ghb_clear_scan_state(GHB_STATE_SCANDONE);
- if (ghb_queue_edit_settings)
+
+ ghb_ui_update(ud, "title", ghb_int64_value(titleindex));
+
+ if (ghb_queue_edit_settings != NULL)
{
- ghb_settings_to_ui(ud, ghb_queue_edit_settings);
- ghb_set_audio(ud, ghb_queue_edit_settings);
- ghb_reset_subtitles(ud, ghb_queue_edit_settings);
- reset_chapter_list(ud, ghb_queue_edit_settings);
- ghb_value_free(ghb_queue_edit_settings);
+ // Switch to the correct title in the list
+ ghb_ui_update(ud, "title",
+ ghb_settings_get_value(ghb_queue_edit_settings, "title"));
+
+ // The above should cause the current title index to update
+ int titleindex = ghb_settings_get_int(ud->settings, "title_no");
+ ghb_array_replace(ud->settings_array, titleindex,
+ ghb_queue_edit_settings);
+ ud->settings = ghb_queue_edit_settings;
+ ghb_load_settings(ud);
ghb_queue_edit_settings = NULL;
}
}
status_str = searching_status_string(ud, &status.queue);
label = GTK_LABEL(GHB_WIDGET(ud->builder, "queue_status"));
gtk_label_set_text (label, status_str);
- if (ghb_settings_get_boolean(ud->settings, "show_status"))
+ if (ghb_settings_get_boolean(ud->prefs, "show_status"))
{
#if !GTK_CHECK_VERSION(2, 16, 0)
GtkStatusIcon *si;
status_str = working_status_string(ud, &status.queue);
label = GTK_LABEL(GHB_WIDGET(ud->builder, "queue_status"));
gtk_label_set_text (label, status_str);
- if (ghb_settings_get_boolean(ud->settings, "show_status"))
+ if (ghb_settings_get_boolean(ud->prefs, "show_status"))
{
#if defined(_USE_APP_IND)
char * ai_status_str= g_strdup_printf(
index = find_queue_job(ud->queue, status.queue.unique_id, &js);
treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "queue_list"));
store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
- if (ud->cancel_encode == GHB_CANCEL_ALL ||
+ if (ud->cancel_encode == GHB_CANCEL_ALL ||
ud->cancel_encode == GHB_CANCEL_CURRENT)
status.queue.error = GHB_ERROR_CANCELED;
switch( status.queue.error )
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->settings, "destination_dir");
+ def_dest = ghb_settings_get_string(ud->prefs, "destination_dir");
if (strcmp(dest_dir, def_dest) != 0)
{
- ghb_settings_set_string (ud->settings, "destination_dir", dest_dir);
- ghb_pref_save (ud->settings, "destination_dir");
+ ghb_settings_set_string (ud->prefs, "destination_dir", dest_dir);
+ ghb_pref_save (ud->prefs, "destination_dir");
}
g_free(dest);
g_free(dest_dir);
if (!appcast_busy)
{
gchar *updates;
- updates = ghb_settings_get_string(ud->settings, "check_updates");
+ updates = ghb_settings_get_string(ud->prefs, "check_updates");
gint64 duration = 0;
if (strcmp(updates, "daily") == 0)
duration = 60 * 60 * 24;
gint64 last;
time_t tt;
- last = ghb_settings_get_int64(ud->settings, "last_update_check");
+ last = ghb_settings_get_int64(ud->prefs, "last_update_check");
time(&tt);
if (last + duration < tt)
{
- ghb_settings_set_int64(ud->settings,
+ ghb_settings_set_int64(ud->prefs,
"last_update_check", tt);
- ghb_pref_save(ud->settings, "last_update_check");
+ ghb_pref_save(ud->prefs, "last_update_check");
GHB_THREAD_NEW("Update Check", (GThreadFunc)ghb_check_update, ud);
}
}
GtkTextMark *mark;
GError *gerror = NULL;
GIOStatus status;
-
+
signal_user_data_t *ud = (signal_user_data_t*)data;
status = g_io_channel_read_line (source, &text, &length, NULL, &gerror);
textview = GTK_TEXT_VIEW(GHB_WIDGET (ud->builder, "activity_view"));
buffer = gtk_text_view_get_buffer (textview);
// I would like to auto-scroll the window when the scrollbar
- // is at the bottom,
+ // is at the bottom,
// must determine whether the insert point is at
- // the bottom of the window
+ // the bottom of the window
window = gtk_text_view_get_window(textview, GTK_TEXT_WINDOW_TEXT);
if (window != NULL)
{
width = gdk_window_get_width(window);
height = gdk_window_get_height(window);
- gtk_text_view_window_to_buffer_coords(textview,
+ gtk_text_view_window_to_buffer_coords(textview,
GTK_TEXT_WINDOW_TEXT, width, height, &x, &y);
gtk_text_view_get_iter_at_location(textview, &iter, x, y);
if (gtk_text_iter_is_end(&iter))
gsize one = 1;
utf8_text[length-1] = '\r';
#endif
- g_io_channel_write_chars (ud->activity_log, utf8_text,
+ g_io_channel_write_chars (ud->activity_log, utf8_text,
length, &outlength, NULL);
#if defined(_WIN32)
- g_io_channel_write_chars (ud->activity_log, "\n",
+ g_io_channel_write_chars (ud->activity_log, "\n",
one, &one, NULL);
#endif
g_io_channel_flush(ud->activity_log, NULL);
if (ud->job_activity_log)
{
- g_io_channel_write_chars (ud->job_activity_log, utf8_text,
+ g_io_channel_write_chars (ud->job_activity_log, utf8_text,
length, &outlength, NULL);
#if defined(_WIN32)
- g_io_channel_write_chars (ud->activity_log, "\n",
+ g_io_channel_write_chars (ud->activity_log, "\n",
one, &outlength, NULL);
#endif
g_io_channel_flush(ud->job_activity_log, NULL);
show_activity_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
GtkWidget *widget = GHB_WIDGET (ud->builder, "activity_window");
- set_visible(widget, gtk_toggle_tool_button_get_active(
+ gtk_widget_set_visible(widget, gtk_toggle_tool_button_get_active(
GTK_TOGGLE_TOOL_BUTTON(xwidget)));
}
show_activity_menu_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
GtkWidget *widget = GHB_WIDGET (ud->builder, "activity_window");
- set_visible(widget, TRUE);
+ gtk_widget_set_visible(widget, TRUE);
widget = GHB_WIDGET (ud->builder, "show_activity");
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), TRUE);
}
G_MODULE_EXPORT gboolean
activity_window_delete_cb(GtkWidget *xwidget, GdkEvent *event, signal_user_data_t *ud)
{
- set_visible(xwidget, FALSE);
+ gtk_widget_set_visible(xwidget, FALSE);
GtkWidget *widget = GHB_WIDGET (ud->builder, "show_activity");
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), FALSE);
return TRUE;
_now = time(NULL);
now = localtime( &_now );
- snprintf(fmt, 362, "[%02d:%02d:%02d] gtkgui: %s\n",
+ snprintf(fmt, 362, "[%02d:%02d:%02d] gtkgui: %s\n",
now->tm_hour, now->tm_min, now->tm_sec, log);
va_start(args, log);
vfprintf(stderr, fmt, args);
ShellExecute(NULL, "open", url, NULL, NULL, SW_SHOWNORMAL);
#else
gboolean result;
- char *argv[] =
+ char *argv[] =
{"xdg-open",NULL,NULL,NULL};
argv[1] = (gchar*)url;
result = g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL,
#endif
gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(widget), ver);
g_free(ver);
- gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(widget),
+ gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(widget),
HB_PROJECT_URL_WEBSITE);
- gtk_about_dialog_set_website_label(GTK_ABOUT_DIALOG(widget),
+ gtk_about_dialog_set_website_label(GTK_ABOUT_DIALOG(widget),
HB_PROJECT_URL_WEBSITE);
gtk_widget_show (widget);
}
show_queue_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
GtkWidget *widget = GHB_WIDGET (ud->builder, "queue_window");
- set_visible(widget, gtk_toggle_tool_button_get_active(
+ gtk_widget_set_visible(widget, gtk_toggle_tool_button_get_active(
GTK_TOGGLE_TOOL_BUTTON(xwidget)));
}
show_queue_menu_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
GtkWidget *widget = GHB_WIDGET (ud->builder, "queue_window");
- set_visible(widget, TRUE);
+ gtk_widget_set_visible(widget, TRUE);
widget = GHB_WIDGET (ud->builder, "show_queue");
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), TRUE);
}
G_MODULE_EXPORT gboolean
queue_window_delete_cb(GtkWidget *xwidget, GdkEvent *event, signal_user_data_t *ud)
{
- set_visible(xwidget, FALSE);
+ gtk_widget_set_visible(xwidget, FALSE);
GtkWidget *widget = GHB_WIDGET (ud->builder, "show_queue");
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), FALSE);
return TRUE;
}
G_MODULE_EXPORT void
-show_presets_toggled_cb(GtkWidget *action, signal_user_data_t *ud)
+show_presets_toggled_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- GtkWidget *widget;
+ GtkWidget *frame;
GtkWindow *hb_window;
-
+
g_debug("show_presets_clicked_cb ()");
- widget = GHB_WIDGET (ud->builder, "presets_frame");
- ghb_widget_to_setting(ud->settings, action);
- if (ghb_settings_get_boolean(ud->settings, "show_presets"))
+ frame = GHB_WIDGET (ud->builder, "presets_frame");
+ ghb_widget_to_setting(ud->prefs, widget);
+ if (ghb_settings_get_boolean(ud->prefs, "show_presets"))
{
- gtk_widget_show_now(widget);
+ gtk_widget_show_now(frame);
}
else
{
- gtk_widget_hide(widget);
+ gtk_widget_hide(frame);
hb_window = GTK_WINDOW(GHB_WIDGET (ud->builder, "hb_window"));
gtk_window_resize(hb_window, 16, 16);
}
- ghb_pref_save(ud->settings, "show_presets");
+ ghb_pref_save(ud->prefs, "show_presets");
+}
+
+static void
+chapter_refresh_list_row_ui(
+ GtkTreeModel *tm,
+ GtkTreeIter *ti,
+ GValue *chapter_list,
+ int titleindex,
+ int index)
+{
+ gchar *chapter, *s_duration, *s_start;
+ gint hh, mm, ss;
+ gint64 duration, start;
+
+ // Update row with settings data
+ g_debug("Updating chapter row ui");
+ chapter = ghb_value_string(ghb_array_get_nth(chapter_list, index));
+ duration = ghb_get_chapter_duration(titleindex, index) / 90000;
+ break_duration(duration, &hh, &mm, &ss);
+ s_duration = g_strdup_printf("%02d:%02d:%02d", hh, mm, ss);
+ start = ghb_get_chapter_start(titleindex, index) / 90000;
+ break_duration(start, &hh, &mm, &ss);
+ s_start = g_strdup_printf("%02d:%02d:%02d", hh, mm, ss);
+ gtk_list_store_set(GTK_LIST_STORE(tm), ti,
+ 0, index+1,
+ 1, s_start,
+ 2, s_duration,
+ 3, chapter,
+ 4, TRUE,
+ -1);
+ g_free(chapter);
+ g_free(s_duration);
+ g_free(s_start);
}
static void
-reset_chapter_list(signal_user_data_t *ud, GValue *settings)
+ghb_clear_chapter_list_ui(GtkBuilder *builder)
{
- GtkTreeView *treeview;
- GtkTreeIter iter;
- GtkListStore *store;
- gboolean done;
- GValue *chapters;
- gint titleindex, ii;
- gint count;
- gint64 ch_start = 0;
-
- g_debug("reset_chapter_list ()");
- chapters = ghb_value_dup(ghb_settings_get_value(settings, "chapter_list"));
- count = ghb_array_len(chapters);
- ghb_settings_set_value(ud->settings, "chapter_list", chapters);
+ GtkTreeView *tv;
+ GtkListStore *ts;
+
+ tv = GTK_TREE_VIEW(GHB_WIDGET(builder, "chapters_list"));
+ ts = GTK_LIST_STORE(gtk_tree_view_get_model(tv));
+ gtk_list_store_clear(ts);
+}
+
+static void
+chapter_refresh_list_ui(signal_user_data_t *ud)
+{
+ GValue *chapter_list;
+ gint ii, count, tm_count;
+ GtkTreeView *tv;
+ GtkTreeModel *tm;
+ GtkTreeIter ti;
+ int titleindex;
+
+ tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "chapters_list"));
+ tm = gtk_tree_view_get_model(tv);
+
+ tm_count = gtk_tree_model_iter_n_children(tm, NULL);
+
titleindex = ghb_settings_combo_int(ud->settings, "title");
-
- treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "chapters_list"));
- store = GTK_LIST_STORE(gtk_tree_view_get_model(treeview));
- ii = 0;
- if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter))
+ chapter_list = ghb_settings_get_value(ud->settings, "chapter_list");
+ count = ghb_array_len(chapter_list);
+ if (count != tm_count)
{
- do
+ ghb_clear_chapter_list_ui(ud->builder);
+ for (ii = 0; ii < count; ii++)
{
-
- if (ii < count)
- {
- gchar *chapter, *duration, *start;
- gint hh, mm, ss;
- gint64 dur;
-
- // Update row with settings data
- g_debug("Updating row");
- chapter = ghb_value_string(ghb_array_get_nth(chapters, ii));
- ghb_get_chapter_duration(titleindex, ii, &dur);
- dur /= 90000;
- break_duration(dur, &hh, &mm, &ss);
- duration = g_strdup_printf("%02d:%02d:%02d", hh, mm, ss);
- break_duration(ch_start, &hh, &mm, &ss);
- start = g_strdup_printf("%02d:%02d:%02d", hh, mm, ss);
- ch_start += dur;
- gtk_list_store_set(store, &iter,
- 0, ii+1,
- 1, start,
- 2, duration,
- 3, chapter,
- 4, TRUE,
- -1);
- g_free(chapter);
- g_free(duration);
- ii++;
- done = !gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter);
- }
- else
- {
- // No more settings data, remove row
- g_debug("Removing row");
- done = !gtk_list_store_remove(store, &iter);
- }
- } while (!done);
- }
- while (ii < count)
- {
- gchar *chapter, *duration, *start;
- gint hh, mm, ss;
- gint64 dur;
-
- // Additional settings, add row
- g_debug("Adding row");
- chapter = ghb_value_string(ghb_array_get_nth(chapters, ii));
- ghb_get_chapter_duration(titleindex, ii, &dur);
- dur /= 90000;
- break_duration(dur, &hh, &mm, &ss);
- duration = g_strdup_printf("%02d:%02d:%02d", hh, mm, ss);
- break_duration(ch_start, &hh, &mm, &ss);
- start = g_strdup_printf("%02d:%02d:%02d", hh, mm, ss);
- ch_start += dur;
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, ii+1,
- 1, start,
- 2, duration,
- 3, chapter,
- 4, TRUE,
- -1);
- g_free(chapter);
- g_free(duration);
- ii++;
+ gtk_list_store_append(GTK_LIST_STORE(tm), &ti);
+ }
+ }
+ for (ii = 0; ii < count; ii++)
+ {
+ gtk_tree_model_iter_nth_child(tm, &ti, NULL, ii);
+ chapter_refresh_list_row_ui(tm, &ti, chapter_list, titleindex, ii);
}
}
+void
+ghb_chapter_list_refresh_all(signal_user_data_t *ud)
+{
+ chapter_refresh_list_ui(ud);
+}
+
static void
update_chapter_list_settings(GValue *settings)
{
GValue *chapters;
gint titleindex;
-
+
g_debug("update_chapter_list_settings ()");
titleindex = ghb_settings_get_int(settings, "title_no");
chapters = ghb_get_chapters(titleindex);
ghb_settings_set_value(settings, "chapter_list", chapters);
}
-static void
-update_chapter_list_from_settings(GtkBuilder *builder, GValue *settings)
-{
- GtkTreeView *treeview;
- GtkTreeIter iter;
- GtkListStore *store;
- gboolean done;
- GValue *chapters;
- gint titleindex, ii;
- gint count;
- gint64 ch_start = 0;
-
- g_debug("update_chapter_list ()");
- titleindex = ghb_settings_get_int(settings, "title_no");
- chapters = ghb_settings_get_value(settings, "chapter_list");
- count = ghb_array_len(chapters);
-
- treeview = GTK_TREE_VIEW(GHB_WIDGET(builder, "chapters_list"));
- store = GTK_LIST_STORE(gtk_tree_view_get_model(treeview));
- ii = 0;
- if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter))
- {
- do
- {
-
- if (ii < count)
- {
- gchar *chapter, *duration, *start;
- gint hh, mm, ss;
- gint64 dur;
-
- // Update row with settings data
- g_debug("Updating row");
- chapter = ghb_value_string(ghb_array_get_nth(chapters, ii));
- ghb_get_chapter_duration(titleindex, ii, &dur);
- dur /= 90000;
- break_duration(dur, &hh, &mm, &ss);
- duration = g_strdup_printf("%02d:%02d:%02d", hh, mm, ss);
- break_duration(ch_start, &hh, &mm, &ss);
- start = g_strdup_printf("%02d:%02d:%02d", hh, mm, ss);
- ch_start += dur;
- gtk_list_store_set(store, &iter,
- 0, ii+1,
- 1, start,
- 2, duration,
- 3, chapter,
- 4, TRUE,
- -1);
- g_free(chapter);
- g_free(duration);
- ii++;
- done = !gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter);
- }
- else
- {
- // No more settings data, remove row
- g_debug("Removing row");
- done = !gtk_list_store_remove(store, &iter);
- }
- } while (!done);
- }
- while (ii < count)
- {
- gchar *chapter, *duration, *start;
- gint hh, mm, ss;
- gint64 dur;
-
- // Additional settings, add row
- g_debug("Adding row");
- chapter = ghb_value_string(ghb_array_get_nth(chapters, ii));
- ghb_get_chapter_duration(titleindex, ii, &dur);
- dur /= 90000;
- break_duration(dur, &hh, &mm, &ss);
- duration = g_strdup_printf("%02d:%02d:%02d", hh, mm, ss);
- break_duration(ch_start, &hh, &mm, &ss);
- start = g_strdup_printf("%02d:%02d:%02d", hh, mm, ss);
- ch_start += dur;
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, ii+1,
- 1, start,
- 2, duration,
- 3, chapter,
- 4, TRUE,
- -1);
- g_free(chapter);
- g_free(duration);
- ii++;
- }
-}
-
static gint chapter_edit_key = 0;
G_MODULE_EXPORT gboolean
G_MODULE_EXPORT void
chapter_edited_cb(
- GhbCellRendererText *cell,
- gchar *path,
- gchar *text,
+ GhbCellRendererText *cell,
+ gchar *path,
+ gchar *text,
signal_user_data_t *ud)
{
GtkTreePath *treepath;
gint index;
gint *pi;
gint row;
-
+
g_debug("chapter_edited_cb ()");
g_debug("path (%s)", path);
g_debug("text (%s)", text);
pi = gtk_tree_path_get_indices(treepath);
row = pi[0];
gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, treepath);
- gtk_list_store_set(store, &iter,
+ gtk_list_store_set(store, &iter,
3, text,
4, TRUE,
-1);
//
// Now, you might be asking why I don't catch the keypress
// event and determine what action to take based on that.
- // The Gtk developers in their infinite wisdom have made the
+ // The Gtk developers in their infinite wisdom have made the
// actual GtkEdit widget being used a private member of
// GtkCellRendererText, so it can not be accessed to hang a
// signal handler off of. And they also do not propagate the
debug_log_handler(const gchar *domain, GLogLevelFlags flags, const gchar *msg, gpointer data)
{
signal_user_data_t *ud = (signal_user_data_t*)data;
-
+
if (ud->debug)
{
printf("%s: %s\n", domain, msg);
GtkWidget *widget;
g_debug("ghb_hbfd");
widget = GHB_WIDGET(ud->builder, "queue_pause1");
- set_visible(widget, !hbfd);
+ gtk_widget_set_visible(widget, !hbfd);
widget = GHB_WIDGET(ud->builder, "queue_add");
- set_visible(widget, !hbfd);
+ gtk_widget_set_visible(widget, !hbfd);
widget = GHB_WIDGET(ud->builder, "show_queue");
- set_visible(widget, !hbfd);
+ gtk_widget_set_visible(widget, !hbfd);
widget = GHB_WIDGET(ud->builder, "show_activity");
- set_visible(widget, !hbfd);
+ gtk_widget_set_visible(widget, !hbfd);
widget = GHB_WIDGET(ud->builder, "chapter_box");
- set_visible(widget, !hbfd);
+ gtk_widget_set_visible(widget, !hbfd);
widget = GHB_WIDGET(ud->builder, "container_box");
- set_visible(widget, !hbfd);
+ gtk_widget_set_visible(widget, !hbfd);
widget = GHB_WIDGET(ud->builder, "SettingsNotebook");
- set_visible(widget, !hbfd);
+ gtk_widget_set_visible(widget, !hbfd);
widget = GHB_WIDGET(ud->builder, "presets_save");
- set_visible(widget, !hbfd);
+ gtk_widget_set_visible(widget, !hbfd);
widget = GHB_WIDGET(ud->builder, "presets_remove");
- set_visible(widget, !hbfd);
+ gtk_widget_set_visible(widget, !hbfd);
widget = GHB_WIDGET (ud->builder, "hb_window");
gtk_window_resize(GTK_WINDOW(widget), 16, 16);
hbfd_toggled_cb(GtkWidget *widget, signal_user_data_t *ud)
{
g_debug("hbfd_toggled_cb");
- ghb_widget_to_setting (ud->settings, widget);
- gboolean hbfd = ghb_settings_get_boolean(ud->settings, "hbfd");
+ ghb_widget_to_setting(ud->prefs, widget);
+ gboolean hbfd = ghb_settings_get_boolean(ud->prefs, "hbfd");
ghb_hbfd(ud, hbfd);
- ghb_pref_save(ud->settings, "hbfd");
-}
-
-G_MODULE_EXPORT void
-advanced_audio_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
-{
- g_debug("advanced_audio_changed_cb");
- ghb_widget_to_setting (ud->settings, widget);
- ghb_check_dependency(ud, widget, NULL);
- const gchar *name = ghb_get_setting_key(widget);
- ghb_pref_save(ud->settings, name);
+ ghb_pref_save(ud->prefs, "hbfd");
}
G_MODULE_EXPORT void
advanced_video_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
g_debug("advanced_video_changed_cb");
- ghb_widget_to_setting (ud->settings, widget);
- ghb_check_dependency(ud, widget, NULL);
+ ghb_widget_to_setting(ud->prefs, widget);
const gchar *name = ghb_get_setting_key(widget);
- ghb_pref_save(ud->settings, name);
- ghb_show_hide_advanced_video( ud );
+ ghb_pref_save(ud->prefs, name);
+ ghb_show_hide_advanced_video(ud);
}
G_MODULE_EXPORT void
pref_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
g_debug("pref_changed_cb");
- ghb_widget_to_setting (ud->settings, widget);
+ ghb_widget_to_setting (ud->prefs, widget);
+// FIXME?
ghb_check_dependency(ud, widget, NULL);
const gchar *name = ghb_get_setting_key(widget);
- ghb_pref_save(ud->settings, name);
+ ghb_pref_save(ud->prefs, name);
+
+ gint preview_count;
+ preview_count = ghb_settings_get_int(ud->prefs, "preview_count");
+ widget = GHB_WIDGET(ud->builder, "preview_frame");
+ gtk_range_set_range(GTK_RANGE(widget), 1, preview_count);
}
G_MODULE_EXPORT void
use_m4v_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
g_debug("use_m4v_changed_cb");
- ghb_widget_to_setting (ud->settings, widget);
+ ghb_widget_to_setting (ud->prefs, widget);
ghb_check_dependency(ud, widget, NULL);
const gchar *name = ghb_get_setting_key(widget);
- ghb_pref_save(ud->settings, name);
+ ghb_pref_save(ud->prefs, name);
ghb_update_destination_extension(ud);
}
show_status_cb(GtkWidget *widget, signal_user_data_t *ud)
{
g_debug("show_status_cb");
- ghb_widget_to_setting (ud->settings, widget);
+ ghb_widget_to_setting (ud->prefs, widget);
ghb_check_dependency(ud, widget, NULL);
const gchar *name = ghb_get_setting_key(widget);
- ghb_pref_save(ud->settings, name);
+ ghb_pref_save(ud->prefs, name);
#if defined(_USE_APP_IND)
if (ud->ai)
{
- if (ghb_settings_get_boolean(ud->settings, "show_status"))
+ if (ghb_settings_get_boolean(ud->prefs, "show_status"))
{
app_indicator_set_status(ud->ai, APP_INDICATOR_STATUS_ACTIVE);
}
si = GTK_STATUS_ICON(GHB_OBJECT (ud->builder, "hb_status"));
gtk_status_icon_set_visible(si,
- ghb_settings_get_boolean(ud->settings, "show_status"));
+ ghb_settings_get_boolean(ud->prefs, "show_status"));
#endif
}
vqual_granularity_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
g_debug("vqual_granularity_changed_cb");
- ghb_widget_to_setting (ud->settings, widget);
+ ghb_widget_to_setting (ud->prefs, widget);
ghb_check_dependency(ud, widget, NULL);
const gchar *name = ghb_get_setting_key(widget);
- ghb_pref_save(ud->settings, name);
+ ghb_pref_save(ud->prefs, name);
gdouble vqmin, vqmax, step, page;
gboolean inverted;
tweaks_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
g_debug("tweaks_changed_cb");
- ghb_widget_to_setting (ud->settings, widget);
+ ghb_widget_to_setting (ud->prefs, widget);
const gchar *name = ghb_get_setting_key(widget);
- ghb_pref_save(ud->settings, name);
+ ghb_pref_save(ud->prefs, name);
}
G_MODULE_EXPORT void
hbfd_feature_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
g_debug("hbfd_feature_changed_cb");
- ghb_widget_to_setting (ud->settings, widget);
+ ghb_widget_to_setting (ud->prefs, widget);
const gchar *name = ghb_get_setting_key(widget);
- ghb_pref_save(ud->settings, name);
+ ghb_pref_save(ud->prefs, name);
- gboolean hbfd = ghb_settings_get_boolean(ud->settings, "hbfd_feature");
+ gboolean hbfd = ghb_settings_get_boolean(ud->prefs, "hbfd_feature");
if (hbfd)
{
const GValue *val;
- val = ghb_settings_get_value(ud->settings, "hbfd");
- ghb_ui_update(ud, "hbfd", val);
+ val = ghb_settings_get_value(ud->prefs, "hbfd");
+ ghb_ui_settings_update(ud, ud->prefs, "hbfd", val);
}
widget = GHB_WIDGET (ud->builder, "hbfd");
gtk_widget_set_visible(widget, hbfd);
GtkWidget *widget;
gchar *drive = get_dvd_device_name(link->data);
gchar *name = get_dvd_volume_name(link->data);
-
+
widget = gtk_menu_item_new_with_label(name);
gtk_buildable_set_name(GTK_BUILDABLE(widget), drive);
gtk_widget_set_tooltip_text(widget, _("Scan this DVD source"));
gtk_widget_set_visible(widget, TRUE);
// Connect signal to action (menu item)
- g_signal_connect(widget, "activate",
+ g_signal_connect(widget, "activate",
(GCallback)dvd_source_activate_cb, ud);
g_free(name);
g_free(drive);
dtype = GetDriveType(drive);
if (dtype == DRIVE_CDROM)
{
- dvd_devices = g_list_append(dvd_devices,
+ dvd_devices = g_list_append(dvd_devices,
(gpointer)g_strdup(drive));
}
}
#else
GVolumeMonitor *gvm;
GList *drives, *link;
-
+
gvm = g_volume_monitor_get ();
drives = g_volume_monitor_get_connected_drives (gvm);
link = drives;
while (link != NULL)
{
GDrive *gd;
-
+
gd = (GDrive*)link->data;
if (ghb_is_cd(gd))
{
{
GHB_THREAD_NEW("Cache Volume Names",
(GThreadFunc)ghb_cache_volnames, ud);
- if (ghb_settings_get_boolean(ud->settings, "AutoScan") &&
+ if (ghb_settings_get_boolean(ud->prefs, "AutoScan") &&
ud->current_dvd_device != NULL &&
strcmp(device, ud->current_dvd_device) == 0)
{
show_scan_progress(ud);
- update_source_label(ud, device, TRUE);
+ update_source_label(ud, device);
gint preview_count;
- preview_count = ghb_settings_get_int(ud->settings, "preview_count");
- ghb_settings_set_string(ud->settings, "scan_source", device);
+ preview_count = ghb_settings_get_int(ud->prefs, "preview_count");
+ ghb_settings_set_string(ud->globals, "scan_source", device);
start_scan(ud, device, 0, preview_count);
}
}
{
ghb_hb_cleanup(TRUE);
prune_logs(ud);
- ghb_settings_set_string(ud->settings, "scan_source", "/dev/null");
+ ghb_settings_set_string(ud->globals, "scan_source", "/dev/null");
start_scan(ud, "/dev/null", 0, 1);
}
}
}
if (g_drive_has_media(gd))
{
- if (ghb_settings_get_boolean(ud->settings, "AutoScan"))
+ if (ghb_settings_get_boolean(ud->prefs, "AutoScan"))
{
show_scan_progress(ud);
- update_source_label(ud, device, TRUE);
+ update_source_label(ud, device);
gint preview_count;
- preview_count = ghb_settings_get_int(ud->settings, "preview_count");
- ghb_settings_set_string(ud->settings, "scan_source", device);
+ preview_count = ghb_settings_get_int(ud->prefs, "preview_count");
+ ghb_settings_set_string(ud->globals, "scan_source", device);
start_scan(ud, device, 0, preview_count);
}
}
{
ghb_hb_cleanup(TRUE);
prune_logs(ud);
- ghb_settings_set_string(ud->settings, "scan_source", "/dev/null");
+ ghb_settings_set_string(ud->globals, "scan_source", "/dev/null");
start_scan(ud, "/dev/null", 0, 1);
}
}
#define GPM_DBUS_PM_PATH "/org/freedesktop/PowerManagement"
#define GPM_DBUS_PM_INTERFACE "org.freedesktop.PowerManagement"
#define GPM_DBUS_INHIBIT_PATH "/org/freedesktop/PowerManagement/Inhibit"
-#define GPM_DBUS_INHIBIT_INTERFACE "org.freedesktop.PowerManagement.Inhibit"
+#define GPM_DBUS_INHIBIT_INTERFACE "org.freedesktop.PowerManagement.Inhibit"
static gboolean gpm_inhibited = FALSE;
static guint gpm_cookie = -1;
#endif
DBusGProxy *proxy;
GError *error = NULL;
gboolean res;
-
+
g_debug("ghb_can_suspend_gpm()");
conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
DBusGProxy *proxy;
GError *error = NULL;
gboolean res;
-
+
g_debug("ghb_suspend_gpm()");
conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
DBusGProxy *proxy;
GError *error = NULL;
gboolean res;
-
+
g_debug("ghb_can_shutdown_gpm()");
conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
DBusGProxy *proxy;
GError *error = NULL;
gboolean res;
-
+
g_debug("ghb_shutdown_gpm()");
conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
DBusGProxy *proxy;
GError *error = NULL;
gboolean res;
-
+
if (gpm_inhibited)
{
DBusGProxy *proxy;
GError *error = NULL;
gboolean res;
-
+
g_debug("ghb_uninhibit_gpm() gpm_cookie %u", gpm_cookie);
if (!gpm_inhibited)
DBusGProxy *proxy;
GError *error = NULL;
gboolean res;
-
+
g_debug("ghb_can_shutdown_gpm()");
conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
DBusGProxy *proxy;
GError *error = NULL;
gboolean res;
-
+
g_debug("ghb_shutdown_gpm()");
conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
gboolean res;
guint xid;
GtkWidget *widget;
-
+
if (gpm_inhibited)
{
DBusGProxy *proxy;
GError *error = NULL;
gboolean res;
-
+
g_debug("ghb_uninhibit_gsm() gpm_cookie %u", gpm_cookie);
if (!gpm_inhibited)
#endif
}
-G_MODULE_EXPORT gboolean
+G_MODULE_EXPORT gboolean
tweak_setting_cb(
- GtkWidget *widget,
- GdkEventButton *event,
+ GtkWidget *widget,
+ GdkEventButton *event,
signal_user_data_t *ud)
{
const gchar *name;
gboolean allow_tweaks;
g_debug("press %d %d", event->type, event->button);
- allow_tweaks = ghb_settings_get_boolean(ud->settings, "allow_tweaks");
+ allow_tweaks = ghb_settings_get_boolean(ud->prefs, "allow_tweaks");
if (allow_tweaks && event->type == GDK_BUTTON_PRESS && event->button == 3)
{ // Its a right mouse click
GtkWidget *dialog;
return ret;
}
-G_MODULE_EXPORT gboolean
+G_MODULE_EXPORT gboolean
easter_egg_cb(
- GtkWidget *widget,
- GdkEventButton *event,
+ GtkWidget *widget,
+ GdkEventButton *event,
signal_user_data_t *ud)
{
g_debug("press %d %d", event->type, event->button);
GtkWidget *dialog, *label;
gint response, ibuild = 0, skip;
- if (ud->appcast == NULL || ud->appcast_len < 15 ||
+ if (ud->appcast == NULL || ud->appcast_len < 15 ||
strncmp(&(ud->appcast[9]), "200 OK", 6))
{
goto done;
ghb_appcast_parse(ud->appcast, &description, &build, &version);
if (build)
ibuild = g_strtod(build, NULL);
- skip = ghb_settings_get_int(ud->settings, "update_skip_version");
- if (description == NULL || build == NULL || version == NULL
+ skip = ghb_settings_get_int(ud->prefs, "update_skip_version");
+ if (description == NULL || build == NULL || version == NULL
|| ibuild <= hb_get_build(NULL) || skip == ibuild)
{
goto done;
if (response == GTK_RESPONSE_OK)
{
// Skip
- ghb_settings_set_int(ud->settings, "update_skip_version", ibuild);
- ghb_pref_save(ud->settings, "update_skip_version");
+ ghb_settings_set_int(ud->prefs, "update_skip_version", ibuild);
+ ghb_pref_save(ud->prefs, "update_skip_version");
}
g_free(msg);
gsize len;
GError *gerror = NULL;
GIOStatus status;
-
+
g_debug("ghb_net_recv_cb");
signal_user_data_t *ud = (signal_user_data_t*)data;
G_MODULE_EXPORT gboolean
hb_visibility_event_cb(
- GtkWidget *widget,
- GdkEventVisibility *vs,
+ GtkWidget *widget,
+ GdkEventVisibility *vs,
signal_user_data_t *ud)
{
ud->hb_visibility = vs->state;
ghb_notify_done(signal_user_data_t *ud)
{
- if (ghb_settings_combo_int(ud->settings, "WhenComplete") == 0)
+ if (ghb_settings_combo_int(ud->prefs, "WhenComplete") == 0)
return;
#if !defined(_WIN32)
g_object_unref(G_OBJECT(pb));
#endif
- if (ghb_settings_combo_int(ud->settings, "WhenComplete") == 3)
+ if (ghb_settings_combo_int(ud->prefs, "WhenComplete") == 3)
{
if (ghb_can_shutdown_gsm())
{
- ghb_countdown_dialog(GTK_MESSAGE_WARNING,
+ ghb_countdown_dialog(GTK_MESSAGE_WARNING,
_("Your encode is complete."),
- _("Shutting down the computer"),
+ _("Shutting down the computer"),
_("Cancel"), (GSourceFunc)shutdown_cb, ud, 60);
}
}
- if (ghb_settings_combo_int(ud->settings, "WhenComplete") == 2)
+ if (ghb_settings_combo_int(ud->prefs, "WhenComplete") == 2)
{
if (ghb_can_suspend_gpm())
{
- ghb_countdown_dialog(GTK_MESSAGE_WARNING,
+ ghb_countdown_dialog(GTK_MESSAGE_WARNING,
_("Your encode is complete."),
- _("Putting computer to sleep"),
+ _("Putting computer to sleep"),
_("Cancel"), (GSourceFunc)suspend_cb, ud, 60);
}
}
- if (ghb_settings_combo_int(ud->settings, "WhenComplete") == 4)
+ if (ghb_settings_combo_int(ud->prefs, "WhenComplete") == 4)
{
- ghb_countdown_dialog(GTK_MESSAGE_WARNING,
+ ghb_countdown_dialog(GTK_MESSAGE_WARNING,
_("Your encode is complete."),
- _("Quiting Handbrake"),
+ _("Quiting Handbrake"),
_("Cancel"), (GSourceFunc)quit_cb, ud, 60);
}
}
if (gtk_widget_get_visible(widget))
{
gint w, h;
- w = ghb_settings_get_int(ud->settings, "window_width");
- h = ghb_settings_get_int(ud->settings, "window_height");
+ w = ghb_settings_get_int(ud->prefs, "window_width");
+ h = ghb_settings_get_int(ud->prefs, "window_height");
if ( w != event->width || h != event->height )
{
- ghb_settings_set_int(ud->settings, "window_width", event->width);
- ghb_settings_set_int(ud->settings, "window_height", event->height);
- ghb_pref_set(ud->settings, "window_width");
- ghb_pref_set(ud->settings, "window_height");
+ ghb_settings_set_int(ud->prefs, "window_width", event->width);
+ ghb_settings_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();
}
}
/*
* callbacks.h
* Copyright (C) John Stebbins 2008-2013 <stebbins@stebbins>
- *
+ *
* callbacks.h is free software.
- *
+ *
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
- *
+ *
* callbacks.h is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with callbacks.h. If not, write to:
* The Free Software Foundation, Inc.,
#endif
#include <gtk/gtk.h>
+#include "hb.h"
#include "settings.h"
#if GLIB_CHECK_VERSION(2, 32, 0)
gboolean ghb_file_menu_add_dvd(signal_user_data_t *ud);
void ghb_udev_init(void);
gboolean ghb_message_dialog(
- GtkMessageType type, const gchar *message,
+ GtkMessageType type, const gchar *message,
const gchar *no, const gchar *yes);
void ghb_error_dialog(
GtkMessageType type, const gchar *message, const gchar *cancel);
GValue* ghb_start_next_job(signal_user_data_t *ud, gboolean find_first);
void ghb_check_dependency(
signal_user_data_t *ud, GtkWidget *widget, const gchar *alt_name);
-void ghb_do_scan( signal_user_data_t *ud, const gchar *filename,
+void ghb_do_scan( signal_user_data_t *ud, const gchar *filename,
gint titlenum, gboolean force);
void ghb_log(gchar *log, ...);
gpointer ghb_check_update(signal_user_data_t *ud);
void ghb_update_pending(signal_user_data_t *ud);
gboolean ghb_idle_scan(signal_user_data_t *ud);
void ghb_add_all_titles(signal_user_data_t *ud);
+void ghb_update_title_info(signal_user_data_t *ud);
+void ghb_chapter_list_refresh_all(signal_user_data_t *ud);
+void ghb_load_settings(signal_user_data_t * ud);
+void ghb_set_current_title_settings(signal_user_data_t *ud);
#endif // _CALLBACKS_H_
static const gchar*
lookup_attr_value(
- const gchar *name,
- const gchar **attr_names,
+ const gchar *name,
+ const gchar **attr_names,
const gchar **attr_values)
{
gint ii;
}
return NULL;
}
-
+
static GValue*
read_string_from_file(const gchar *filename)
{
static void
start_element(
- GMarkupParseContext *ctx,
- const gchar *tag,
+ GMarkupParseContext *ctx,
+ const gchar *tag,
const gchar **attr_names,
const gchar **attr_values,
gpointer ud,
GError **error)
{
parse_data_t *pd = (parse_data_t*)ud;
- union
+ union
{
gint id;
gpointer pid;
int bps = gdk_pixbuf_get_bits_per_sample(pb);
int rowstride = gdk_pixbuf_get_rowstride(pb);
- ghb_dict_insert(gval, g_strdup("colorspace"),
+ ghb_dict_insert(gval, g_strdup("colorspace"),
ghb_int_value_new(colorspace));
- ghb_dict_insert(gval, g_strdup("alpha"),
+ ghb_dict_insert(gval, g_strdup("alpha"),
ghb_boolean_value_new(alpha));
- ghb_dict_insert(gval, g_strdup("width"),
+ ghb_dict_insert(gval, g_strdup("width"),
ghb_int_value_new(width));
- ghb_dict_insert(gval, g_strdup("height"),
+ ghb_dict_insert(gval, g_strdup("height"),
ghb_int_value_new(height));
- ghb_dict_insert(gval, g_strdup("bps"),
+ ghb_dict_insert(gval, g_strdup("bps"),
ghb_int_value_new(bps));
- ghb_dict_insert(gval, g_strdup("rowstride"),
+ ghb_dict_insert(gval, g_strdup("rowstride"),
ghb_int_value_new(rowstride));
rd = g_malloc(sizeof(ghb_rawdata_t));
static void
end_element(
- GMarkupParseContext *ctx,
- const gchar *name,
+ GMarkupParseContext *ctx,
+ const gchar *name,
gpointer ud,
GError **error)
{
parse_data_t *pd = (parse_data_t*)ud;
gint id;
- union
+ union
{
gint id;
gpointer pid;
static void
text_data(
- GMarkupParseContext *ctx,
- const gchar *text,
+ GMarkupParseContext *ctx,
+ const gchar *text,
gsize len,
gpointer ud,
GError **error)
static void
passthrough(
- GMarkupParseContext *ctx,
- const gchar *text,
+ GMarkupParseContext *ctx,
+ const gchar *text,
gsize len,
gpointer ud,
GError **error)
}
// This is required or the parser crashes
-static void
+static void
destroy_notify(gpointer data)
{ // Do nothing
//g_debug("destroy parser");
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
*/
-
+
// Well, I waisted a bit of time on this. It seems libhb has a function for
// this that I hadn't discovered yet. hb_dvd_name().
} PACKED;
#define VOLUME_ID_LABEL_SIZE 64
-typedef struct
+typedef struct
{
gint fd;
gchar label[VOLUME_ID_LABEL_SIZE+1];
get_buffer(int fd, guint64 off, gsize len)
{
gint buf_len;
-
- if (lseek(fd, off, SEEK_SET) < 0)
+
+ if (lseek(fd, off, SEEK_SET) < 0)
{
return NULL;
}
guint8 *buffer = g_malloc(len);
buf_len = read(fd, buffer, len);
- if (buf_len < 0)
+ if (buf_len < 0)
{
g_free(buffer);
return NULL;
return buffer;
}
-static gint
+static gint
set_unicode16(guint8 *str, gsize len, const guint8 *buf, gint endianess, gsize count)
{
gint ii, jj;
return jj;
}
-static void
+static void
set_label_string(guint8 *str, const guint8 *buf, gsize count)
{
gint ii;
memcpy(str, buf, count);
str[count] = 0;
-
+
/* remove trailing whitespace */
ii = strlen((gchar*)str);
- while (ii--)
+ while (ii--)
{
if (!g_ascii_isspace(str[ii]))
break;
}
str[ii+1] = 0;
}
-
-static gint
+
+static gint
probe_udf(udf_info_t *id)
{
struct volume_descriptor *vd;
GFile *gfile;
gfile = g_file_new_for_path(name);
- info = g_file_query_info(gfile,
+ info = g_file_query_info(gfile,
G_FILE_ATTRIBUTE_STANDARD_NAME ","
G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET ","
G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK,
g_object_unref(parent);
g_object_unref(info);
- info = g_file_query_info(gfile,
+ info = g_file_query_info(gfile,
G_FILE_ATTRIBUTE_STANDARD_NAME ","
G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET ","
G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK,
ud->current_dvd_device = NULL;
}
gfile = g_file_new_for_path(resolved);
- info = g_file_query_info(gfile,
+ info = g_file_query_info(gfile,
G_FILE_ATTRIBUTE_STANDARD_TYPE,
G_FILE_QUERY_INFO_NONE, NULL, NULL);
if (info != NULL)
{
if (g_file_info_get_file_type(info) == G_FILE_TYPE_SPECIAL)
{
- // I could go through the trouble to scan the connected drives and
- // verify that this device is connected and is a DVD. But I don't
+ // I could go through the trouble to scan the connected drives and
+ // verify that this device is connected and is a DVD. But I don't
// think its neccessary.
ud->current_dvd_device = resolved;
}
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
</packing>
</child>
<child>
- <object class="GtkLabel" id="source_title">
+ <object class="GtkLabel" id="volume_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="source_codec">
+ <object class="GtkLabel" id="source_video_codec">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Show Cropped area of the preview</property>
<property name="xalign">0</property>
- <property name="draw_indicator">False</property>
+ <property name="draw_indicator">True</property>
<signal name="toggled" handler="show_crop_changed_cb" swapped="no"/>
</object>
<packing>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Open Preview Window</property>
<property name="hexpand">False</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">False</property>
+ <property name="halign">start</property>
+ <property name="margin_left">12</property>
+ <property name="draw_indicator">True</property>
<signal name="toggled" handler="preview_button_clicked_cb" swapped="no"/>
</object>
<packing>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<property name="group">PictureDecombDeinterlace</property>
+ <signal name="toggled" handler="setting_widget_changed_cb" swapped="no"/>
</object>
<packing>
<property name="top_attach">2</property>
PROP_WIDTH_CHARS,
PROP_WRAP_WIDTH,
PROP_ALIGN,
-
+
/* Style args */
PROP_BACKGROUND,
PROP_FOREGROUND,
PROP_LANGUAGE,
PROP_ELLIPSIZE,
PROP_WRAP_MODE,
-
+
/* Whether-a-style-arg-is-set args */
PROP_BACKGROUND_SET,
PROP_FOREGROUND_SET,
guint markup_set : 1;
guint ellipsize_set : 1;
guint align_set : 1;
-
+
gulong focus_out_id;
PangoLanguage *language;
PangoEllipsizeMode ellipsize;
PangoWrapMode wrap_mode;
PangoAlignment align;
-
+
gulong populate_popup_id;
gulong entry_menu_popdown_timeout;
gboolean in_entry_menu;
-
+
gint width_chars;
gint wrap_width;
-
+
GtkWidget *entry;
};
GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (class);
object_class->finalize = ghb_cell_renderer_text_finalize;
-
+
object_class->get_property = ghb_cell_renderer_text_get_property;
object_class->set_property = ghb_cell_renderer_text_set_property;
P_("Text to render"),
NULL,
GTK_PARAM_READWRITE));
-
+
g_object_class_install_property (object_class,
PROP_MARKUP,
g_param_spec_string ("markup",
FALSE,
GTK_PARAM_READWRITE));
-
+
g_object_class_install_property (object_class,
PROP_BACKGROUND,
g_param_spec_string ("background",
P_("Background color"),
P_("Background color as a GdkColor"),
GDK_TYPE_COLOR,
- GTK_PARAM_READWRITE));
+ GTK_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_FOREGROUND,
PANGO_TYPE_FONT_DESCRIPTION,
GTK_PARAM_READWRITE));
-
+
g_object_class_install_property (object_class,
PROP_FAMILY,
g_param_spec_string ("family",
PANGO_TYPE_VARIANT,
PANGO_VARIANT_NORMAL,
GTK_PARAM_READWRITE));
-
+
g_object_class_install_property (object_class,
PROP_WEIGHT,
g_param_spec_int ("weight",
PANGO_TYPE_STRETCH,
PANGO_STRETCH_NORMAL,
GTK_PARAM_READWRITE));
-
+
g_object_class_install_property (object_class,
PROP_SIZE,
g_param_spec_int ("size",
0.0,
G_MAXDOUBLE,
0.0,
- GTK_PARAM_READWRITE));
+ GTK_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_SCALE,
G_MAXDOUBLE,
1.0,
GTK_PARAM_READWRITE));
-
+
g_object_class_install_property (object_class,
PROP_RISE,
g_param_spec_int ("rise",
P_("Whether to strike through the text"),
FALSE,
GTK_PARAM_READWRITE));
-
+
g_object_class_install_property (object_class,
PROP_UNDERLINE,
g_param_spec_enum ("underline",
/**
* GhbCellRendererText:ellipsize:
*
- * Specifies the preferred place to ellipsize the string, if the cell renderer
- * does not have enough room to display the entire string. Setting it to
+ * Specifies the preferred place to ellipsize the string, if the cell renderer
+ * does not have enough room to display the entire string. Setting it to
* %PANGO_ELLIPSIZE_NONE turns off ellipsizing. See the wrap-width property
* for another way of making the text fit into a given width.
*
/**
* GhbCellRendererText:width-chars:
- *
+ *
* The desired width of the cell, in characters. If this property is set to
* -1, the width will be calculated automatically, otherwise the cell will
* request either 3 characters or the property value, whichever is greater.
- *
+ *
* Since: 2.6
**/
g_object_class_install_property (object_class,
G_MAXINT,
-1,
GTK_PARAM_READWRITE));
-
+
/**
* GhbCellRendererText:wrap-mode:
*
- * Specifies how to break the string into multiple lines, if the cell
- * renderer does not have enough room to display the entire string.
+ * Specifies how to break the string into multiple lines, if the cell
+ * renderer does not have enough room to display the entire string.
* This property has no effect unless the wrap-width property is set.
*
* Since: 2.8
/**
* GhbCellRendererText:wrap-width:
*
- * Specifies the width at which the text is wrapped. The wrap-mode property can
+ * Specifies the width at which the text is wrapped. The wrap-mode property can
* be used to influence at what character positions the line breaks can be placed.
* Setting wrap-width to -1 turns wrapping off.
*
/**
* GhbCellRendererText:alignment:
*
- * Specifies how to align the lines of text with respect to each other.
+ * Specifies how to align the lines of text with respect to each other.
*
- * Note that this property describes how to align the lines of text in
- * case there are several of them. The "xalign" property of #GtkCellRenderer,
+ * Note that this property describes how to align the lines of text in
+ * case there are several of them. The "xalign" property of #GtkCellRenderer,
* on the other hand, sets the horizontal alignment of the whole text.
*
* Since: 2.10
PANGO_TYPE_ALIGNMENT,
PANGO_ALIGN_LEFT,
GTK_PARAM_READWRITE));
-
+
/* Style props are set or not */
#define ADD_SET_PROP(propname, propval, nick, blurb) g_object_class_install_property (object_class, propval, g_param_spec_boolean (propname, nick, blurb, FALSE, GTK_PARAM_READWRITE))
ADD_SET_PROP ("foreground-set", PROP_FOREGROUND_SET,
P_("Foreground set"),
P_("Whether this tag affects the foreground color"));
-
+
ADD_SET_PROP ("editable-set", PROP_EDITABLE_SET,
P_("Editability set"),
P_("Whether this tag affects text editability"));
ADD_SET_PROP ("family-set", PROP_FAMILY_SET,
P_("Font family set"),
- P_("Whether this tag affects the font family"));
+ P_("Whether this tag affects the font family"));
ADD_SET_PROP ("style-set", PROP_STYLE_SET,
P_("Font style set"),
ADD_SET_PROP ("scale-set", PROP_SCALE_SET,
P_("Font scale set"),
P_("Whether this tag scales the font size by a factor"));
-
+
ADD_SET_PROP ("rise-set", PROP_RISE_SET,
P_("Rise set"),
P_("Whether this tag affects the rise"));
case PROP_BACKGROUND_GDK:
{
GdkColor color;
-
+
color.red = celltext->background.red;
color.green = celltext->background.green;
color.blue = celltext->background.blue;
-
+
g_value_set_boxed (value, &color);
}
break;
case PROP_FOREGROUND_GDK:
{
GdkColor color;
-
+
color.red = celltext->foreground.red;
color.green = celltext->foreground.green;
color.blue = celltext->foreground.blue;
-
+
g_value_set_boxed (value, &color);
}
break;
case PROP_FONT:
g_value_take_string (value, pango_font_description_to_string (celltext->font));
break;
-
+
case PROP_FONT_DESC:
g_value_set_boxed (value, celltext->font);
break;
case PROP_SCALE:
g_value_set_double (value, celltext->font_scale);
break;
-
+
case PROP_EDITABLE:
g_value_set_boolean (value, celltext->editable);
break;
case PROP_RISE:
g_value_set_int (value, celltext->rise);
- break;
+ break;
case PROP_LANGUAGE:
g_value_set_static_string (value, pango_language_to_string (priv->language));
case PROP_ELLIPSIZE:
g_value_set_enum (value, priv->ellipsize);
break;
-
+
case PROP_WRAP_MODE:
g_value_set_enum (value, priv->wrap_mode);
break;
case PROP_WRAP_WIDTH:
g_value_set_int (value, priv->wrap_width);
break;
-
+
case PROP_ALIGN:
g_value_set_enum (value, priv->align);
break;
{
PangoFontMask mask = get_property_font_set_mask (param_id);
g_value_set_boolean (value, (pango_font_description_get_set_fields (celltext->font) & mask) != 0);
-
+
break;
}
case PROP_SCALE_SET:
g_value_set_boolean (value, celltext->scale_set);
break;
-
+
case PROP_EDITABLE_SET:
g_value_set_boolean (value, celltext->editable_set);
break;
case PROP_ALIGN_SET:
g_value_set_boolean (value, priv->align_set);
break;
-
+
case PROP_WIDTH_CHARS:
g_value_set_int (value, priv->width_chars);
- break;
+ break;
case PROP_BACKGROUND:
case PROP_FOREGROUND:
celltext->background_set = TRUE;
g_object_notify (G_OBJECT (celltext), "background-set");
}
-
+
celltext->background.red = color->red;
celltext->background.green = color->green;
celltext->background.blue = color->blue;
celltext->foreground_set = TRUE;
g_object_notify (G_OBJECT (celltext), "foreground-set");
}
-
+
celltext->foreground.red = color->red;
celltext->foreground.green = color->green;
celltext->foreground.blue = color->blue;
PangoFontMask to_set)
{
PangoFontMask changed_mask = 0;
-
+
if (to_set & PANGO_FONT_MASK_FAMILY)
{
const char *family = pango_font_description_get_family (desc);
size = 10 * PANGO_SCALE;
changed_mask |= PANGO_FONT_MASK_SIZE;
}
-
+
pango_font_description_set_size (desc, size);
}
GObject *object = G_OBJECT (celltext);
PangoFontDescription *new_font_desc;
PangoFontMask old_mask, new_mask, changed_mask, set_changed_mask;
-
+
if (font_desc)
new_font_desc = pango_font_description_copy (font_desc);
else
pango_font_description_free (celltext->font);
celltext->font = new_font_desc;
-
+
g_object_freeze_notify (object);
g_object_notify (object, "font-desc");
g_object_notify (object, "font");
-
+
if (changed_mask & PANGO_FONT_MASK_FAMILY)
g_object_notify (object, "family");
if (changed_mask & PANGO_FONT_MASK_STYLE)
}
notify_set_changed (object, set_changed_mask);
-
+
g_object_thaw_notify (object);
}
case PROP_SINGLE_PARAGRAPH_MODE:
priv->single_paragraph = g_value_get_boolean (value);
break;
-
+
case PROP_BACKGROUND:
{
GdkColor color;
g_object_notify (object, "background-gdk");
}
break;
-
+
case PROP_FOREGROUND:
{
GdkColor color;
set_font_description (celltext, font_desc);
pango_font_description_free (font_desc);
-
+
if (celltext->fixed_height_rows != -1)
celltext->calc_fixed_height = TRUE;
}
case PROP_FONT_DESC:
set_font_description (celltext, g_value_get_boxed (value));
-
+
if (celltext->fixed_height_rows != -1)
celltext->calc_fixed_height = TRUE;
break;
case PROP_SIZE_POINTS:
{
PangoFontMask old_set_mask = pango_font_description_get_set_fields (celltext->font);
-
+
switch (param_id)
{
case PROP_FAMILY:
g_object_notify (object, "size");
break;
}
-
+
if (celltext->fixed_height_rows != -1)
celltext->calc_fixed_height = TRUE;
-
+
notify_set_changed (object, old_set_mask & pango_font_description_get_set_fields (celltext->font));
g_object_notify (object, "font-desc");
g_object_notify (object, "font");
break;
}
-
+
case PROP_SCALE:
celltext->font_scale = g_value_get_double (value);
celltext->scale_set = TRUE;
celltext->calc_fixed_height = TRUE;
g_object_notify (object, "scale-set");
break;
-
+
case PROP_EDITABLE:
celltext->editable = g_value_get_boolean (value);
celltext->editable_set = TRUE;
celltext->underline_style = g_value_get_enum (value);
celltext->underline_set = TRUE;
g_object_notify (object, "underline-set");
-
+
break;
case PROP_RISE:
g_object_notify (object, "rise-set");
if (celltext->fixed_height_rows != -1)
celltext->calc_fixed_height = TRUE;
- break;
+ break;
case PROP_LANGUAGE:
priv->language_set = TRUE;
priv->ellipsize_set = TRUE;
g_object_notify (object, "ellipsize-set");
break;
-
+
case PROP_WRAP_MODE:
priv->wrap_mode = g_value_get_enum (value);
break;
-
+
case PROP_WRAP_WIDTH:
priv->wrap_width = g_value_get_int (value);
break;
-
+
case PROP_WIDTH_CHARS:
priv->width_chars = g_value_get_int (value);
- break;
+ break;
case PROP_ALIGN:
priv->align = g_value_get_enum (value);
else
{
PangoFontMask changed_mask;
-
+
changed_mask = set_font_desc_fields (celltext->font,
get_property_font_set_mask (param_id));
notify_fields_changed (G_OBJECT (celltext), changed_mask);
case PROP_SCALE_SET:
celltext->scale_set = g_value_get_boolean (value);
break;
-
+
case PROP_EDITABLE_SET:
celltext->editable_set = g_value_get_boolean (value);
break;
case PROP_ALIGN_SET:
priv->align_set = g_value_get_boolean (value);
break;
-
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
/**
* ghb_cell_renderer_text_new:
- *
+ *
* Creates a new #GhbCellRendererText. Adjust how text is drawn using
* object properties. Object properties can be
* set globally (with g_object_set()). Also, with #GtkTreeViewColumn,
* you can bind the "text" property on the cell renderer to a string
* value in the model, thus rendering a different string in each row
* of the #GtkTreeView
- *
+ *
* Return value: the new cell renderer
**/
GtkCellRenderer *
{
attr->start_index = 0;
attr->end_index = G_MAXINT;
-
+
pango_attr_list_insert (attr_list, attr);
}
GhbCellRendererTextPrivate *priv;
priv = GHB_CELL_RENDERER_TEXT_GET_PRIVATE (celltext);
-
+
layout = gtk_widget_create_pango_layout (widget, celltext->text);
if (celltext->extra_attrs)
if (will_render)
{
/* Add options that affect appearance but not size */
-
+
/* note that background doesn't go here, since it affects
* background_area not the PangoLayout area
*/
-
+
if (celltext->foreground_set
&& (flags & GTK_CELL_RENDERER_SELECTED) == 0)
{
PangoColor color;
color = celltext->foreground;
-
+
add_attr (attr_list,
pango_attr_foreground_new (color.red, color.green, color.blue));
}
if (celltext->scale_set &&
celltext->font_scale != 1.0)
add_attr (attr_list, pango_attr_scale_new (celltext->font_scale));
-
+
if (celltext->underline_set)
uline = celltext->underline_style;
else
if (priv->language_set)
add_attr (attr_list, pango_attr_language_new (priv->language));
-
+
if ((flags & GTK_CELL_RENDERER_PRELIT) == GTK_CELL_RENDERER_PRELIT)
{
switch (uline)
pango_layout_set_attributes (layout, attr_list);
pango_attr_list_unref (attr_list);
-
+
return layout;
}
gtk_cell_renderer_set_fixed_size (cell,
cell_width, 2*cell_ypad +
celltext->fixed_height_rows * PANGO_PIXELS (row_height));
-
+
if (height)
{
*height = cell_height;
if (width == NULL)
return;
}
-
+
if (layout)
g_object_ref (layout);
else
{
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
*x_offset = (1.0 - cell_xalign) * (cell_area->width - (2 * cell_xpad));
- else
+ else
*x_offset = cell_xalign * (cell_area->width - (2 * cell_xpad));
if ((priv->ellipsize_set && priv->ellipsize != PANGO_ELLIPSIZE_NONE) || priv->wrap_width != -1)
gboolean sensitive;
sensitive = gtk_cell_renderer_get_sensitive(cell);
- if (!sensitive)
+ if (!sensitive)
{
state = GTK_STATE_INSENSITIVE;
}
gtk_cell_renderer_get_padding(cell, &xpad, &ypad);
- if (celltext->background_set &&
+ if (celltext->background_set &&
(flags & GTK_CELL_RENDERER_SELECTED) == 0)
{
gdk_cairo_rectangle (cr, background_area);
}
if (priv->ellipsize_set && priv->ellipsize != PANGO_ELLIPSIZE_NONE)
- pango_layout_set_width (layout,
+ pango_layout_set_width (layout,
(cell_area->width - x_offset - 2 * xpad) * PANGO_SCALE);
else if (priv->wrap_width == -1)
pango_layout_set_width (layout, -1);
gint xpad, ypad;
sensitive = gtk_cell_renderer_get_sensitive(cell);
- if (!sensitive)
+ if (!sensitive)
{
state = GTK_STATE_INSENSITIVE;
}
gtk_cell_renderer_get_padding(cell, &xpad, &ypad);
- if (celltext->background_set &&
+ if (celltext->background_set &&
(flags & GTK_CELL_RENDERER_SELECTED) == 0)
{
cairo_t *cr = gdk_cairo_create (window);
celltext->background.green / 65535.,
celltext->background.blue / 65535.);
cairo_fill (cr);
-
+
cairo_destroy (cr);
}
if (priv->ellipsize_set && priv->ellipsize != PANGO_ELLIPSIZE_NONE)
- pango_layout_set_width (layout,
+ pango_layout_set_width (layout,
(cell_area->width - x_offset - 2 * xpad) * PANGO_SCALE);
else if (priv->wrap_width == -1)
pango_layout_set_width (layout, -1);
gboolean editing_canceled;
g_object_get(entry, "editing-canceled", &editing_canceled, NULL);
- gtk_cell_renderer_stop_editing (GTK_CELL_RENDERER (data),
+ gtk_cell_renderer_stop_editing (GTK_CELL_RENDERER (data),
editing_canceled);
if (editing_canceled)
return;
g_object_set_data_full (G_OBJECT (priv->entry),
I_(GHB_CELL_RENDERER_TEXT_PATH), g_strdup (path), g_free);
-
+
gtk_editable_select_region (GTK_EDITABLE (priv->entry), 0, -1);
-
+
#if 0
GtkRequisition min_size, size;
priv->populate_popup_id = g_signal_connect (priv->entry, "populate_popup",
G_CALLBACK (ghb_cell_renderer_text_populate_popup),
celltext);
-
+
gtk_widget_show (priv->entry);
return GTK_CELL_EDITABLE (priv->entry);
* ghb_cell_renderer_text_set_fixed_height_from_font:
* @renderer: A #GhbCellRendererText
* @number_of_rows: Number of rows of text each cell renderer is allocated, or -1
- *
+ *
* Sets the height of a renderer to explicitly be determined by the "font" and
* "y_pad" property set on it. Further changes in these properties do not
* affect the height, so they must be accompanied by a subsequent call to this
gdouble font_scale;
PangoColor foreground;
PangoColor background;
-
+
PangoAttrList *extra_attrs;
PangoUnderline underline_style;
guint editable : 1;
guint scale_set : 1;
-
+
guint foreground_set : 1;
guint background_set : 1;
-
+
guint underline_set : 1;
guint rise_set : 1;
-
+
guint strikethrough_set : 1;
guint editable_set : 1;
#endif
return font;
-}
+}
#if !GTK_CHECK_VERSION(3, 0, 0)
#define gtk_widget_override_font gtk_widget_modify_font
return GTK_TYPE_WIDGET;
}
-static void
+static void
ghb_compositor_get_property (
GObject *object,
guint prop_id,
}
}
-static void
+static void
ghb_compositor_set_property (
GObject *object,
guint prop_id,
return (cca->z_pos - ccb->z_pos);
}
-static void
+static void
ghb_compositor_set_child_property(
GtkContainer *container,
GtkWidget *child,
break;
}
- if (gtk_widget_get_visible (child) &&
+ if (gtk_widget_get_visible (child) &&
gtk_widget_get_visible (GTK_WIDGET(compositor)))
{
gtk_widget_queue_resize (child);
}
-static void
+static void
ghb_compositor_get_child_property(
GtkContainer *container,
GtkWidget *child,
* Insert in the given position of the zlist in the compositor.
* All children in the zlist must have associated GdkDrawable's
* This means they must be GtkDrawingArea or GtkEventBox
- *
+ *
**/
void
ghb_compositor_zlist_insert (
GhbCompositor *compositor,
- GtkWidget *child,
- gint z_pos,
+ GtkWidget *child,
+ gint z_pos,
gdouble opacity)
{
GhbCompositorChild *cc;
gtk_widget_style_attach(widget);
if (visible_window)
- gtk_style_set_background(widget->style, window,
+ gtk_style_set_background(widget->style, window,
GTK_STATE_NORMAL);
#endif
}
if (!gtk_widget_get_has_window(widget))
{
- child_allocation.x = allocation->x +
+ child_allocation.x = allocation->x +
gtk_container_get_border_width(GTK_CONTAINER(widget));
- child_allocation.y = allocation->y +
+ child_allocation.y = allocation->y +
gtk_container_get_border_width(GTK_CONTAINER(widget));
}
else
child_allocation.y = 0;
}
- child_allocation.width = MAX (allocation->width -
+ child_allocation.width = MAX (allocation->width -
gtk_container_get_border_width(GTK_CONTAINER (widget)) * 2, 0);
- child_allocation.height = MAX (allocation->height -
+ child_allocation.height = MAX (allocation->height -
gtk_container_get_border_width(GTK_CONTAINER (widget)) * 2, 0);
if (gtk_widget_get_realized(widget))
if (
//!gtk_cairo_should_draw_window(cr, gtk_widget_get_window(child)) ||
- !gtk_widget_get_visible(cc->widget) ||
+ !gtk_widget_get_visible(cc->widget) ||
!gtk_widget_get_visible(child))
continue;
{
/* get our child */
child = GTK_WIDGET(draw->data);
- if (!gtk_widget_get_visible(cc->widget) ||
+ if (!gtk_widget_get_visible(cc->widget) ||
!gtk_widget_get_visible(child))
continue;
GType ghb_compositor_get_type (void) G_GNUC_CONST;
GtkWidget* ghb_compositor_new (void);
void ghb_compositor_zlist_insert (GhbCompositor *compositor,
- GtkWidget *child,
+ GtkWidget *child,
gint z_pos, gdouble opacity);
G_END_DECLS
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
static gchar **index_str = NULL;
static gint index_str_size = 0;
-static void
+static void
index_str_init(gint max_index)
{
gint ii;
#endif
const iso639_lang_t ghb_language_table[] =
-{
+{
{ "Any", "", "zz", "und" },
{ "Afar", "", "aa", "aar" },
{ "Abkhazian", "", "ab", "abk" },
void
ghb_vquality_range(
- signal_user_data_t *ud,
- gdouble *min,
+ signal_user_data_t *ud,
+ gdouble *min,
gdouble *max,
gdouble *step,
gdouble *page,
{
*min = 0;
*max = 51;
- *step = ghb_settings_combo_double(ud->settings,
+ *step = ghb_settings_combo_double(ud->prefs,
"VideoQualityGranularity");
if (*step == 0.2 || *step == 0.5)
*digits = 1;
hb_title_t * title;
hb_subtitle_t * sub;
-
+
if (h_scan == NULL) return VOBSUB;
title = ghb_get_title_info( titleindex );
if (title == NULL) return VOBSUB; // Bad titleindex
ghb_get_title_number(gint titleindex)
{
hb_title_t * title;
-
+
title = ghb_get_title_info( titleindex );
if (title == NULL) return 1; // Bad titleindex
return title->index;
hb_list_t * list;
hb_title_t * title;
hb_audio_config_t *audio = NULL;
-
+
if (h == NULL) return NULL;
list = hb_get_titles( h );
if( !hb_list_count( list ) )
{
GtkListStore *store;
GtkTreeIter iter;
-
+
store = GTK_LIST_STORE(gtk_combo_box_get_model (combo));
if (find_combo_item_by_int(GTK_TREE_MODEL(store), value, &iter))
{
- gtk_list_store_set(store, &iter,
- 1, !grey,
+ gtk_list_store_set(store, &iter,
+ 1, !grey,
-1);
}
}
{
if (!(mux & enc->muxers))
{
- grey_builder_combo_box_item(ud->builder, "AudioEncoder",
+ grey_builder_combo_box_item(ud->builder, "AudioEncoder",
enc->codec, TRUE);
grey_builder_combo_box_item(ud->builder, "AudioEncoderFallback",
enc->codec, TRUE);
}
else
{
- grey_builder_combo_box_item(ud->builder, "AudioEncoder",
+ grey_builder_combo_box_item(ud->builder, "AudioEncoder",
enc->codec, FALSE);
grey_builder_combo_box_item(ud->builder, "AudioEncoderFallback",
enc->codec, FALSE);
{
if (!(mux & enc->muxers))
{
- grey_builder_combo_box_item(ud->builder, "VideoEncoder",
+ grey_builder_combo_box_item(ud->builder, "VideoEncoder",
enc->codec, TRUE);
}
else
{
- grey_builder_combo_box_item(ud->builder, "VideoEncoder",
+ grey_builder_combo_box_item(ud->builder, "VideoEncoder",
enc->codec, FALSE);
}
}
if (mix == HB_AMIXDOWN_NONE)
mix = HB_INVALID_AMIXDOWN;
-
+
return hb_mixdown_get_best( acodec, layout, mix );
}
// 3 - String that is used for presets
// 4 - Int value determined by backend
// 5 - String value determined by backend
- store = gtk_list_store_new(5, G_TYPE_STRING, G_TYPE_BOOLEAN,
+ store = gtk_list_store_new(5, G_TYPE_STRING, G_TYPE_BOOLEAN,
G_TYPE_STRING, G_TYPE_DOUBLE, G_TYPE_STRING);
gtk_combo_box_set_model(combo, GTK_TREE_MODEL(store));
{ // Combo box entry
gtk_combo_box_set_entry_text_column(GTK_COMBO_BOX(combo), 0);
}
-}
+}
// Set up the model for the combo box
static void
// First modify the combobox model to allow greying out of options
combo = GTK_COMBO_BOX(GHB_WIDGET(builder, name));
ghb_init_combo_box(combo);
-}
+}
void
ghb_audio_samplerate_opts_set(GtkComboBox *combo)
GtkTreeIter iter;
GtkListStore *store;
gchar *str;
-
+
g_debug("audio_samplerate_opts_set ()\n");
store = GTK_LIST_STORE(gtk_combo_box_get_model (combo));
gtk_list_store_clear(store);
// Add an item for "Same As Source"
gtk_list_store_append(store, &iter);
str = g_strdup_printf("<small>%s</small>", _("Same as source"));
- gtk_list_store_set(store, &iter,
+ gtk_list_store_set(store, &iter,
0, str,
- 1, TRUE,
- 2, "source",
- 3, 0.0,
- 4, "source",
+ 1, TRUE,
+ 2, "source",
+ 3, 0.0,
+ 4, "source",
-1);
g_free(str);
{
gtk_list_store_append(store, &iter);
str = g_strdup_printf("<small>%s</small>", rate->name);
- gtk_list_store_set(store, &iter,
+ gtk_list_store_set(store, &iter,
0, str,
- 1, TRUE,
- 2, rate->name,
- 3, (gdouble)rate->rate,
+ 1, TRUE,
+ 2, rate->name,
+ 3, (gdouble)rate->rate,
4, rate->name,
-1);
g_free(str);
{
GtkTreeIter iter;
GtkListStore *store;
-
+
g_debug("video_framerate_opts_set ()\n");
GtkComboBox *combo = GTK_COMBO_BOX(GHB_WIDGET(builder, name));
store = GTK_LIST_STORE(gtk_combo_box_get_model (combo));
gtk_list_store_clear(store);
// Add an item for "Same As Source"
gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, _("Same as source"),
- 1, TRUE,
- 2, "source",
- 3, 0.0,
- 4, "source",
+ gtk_list_store_set(store, &iter,
+ 0, _("Same as source"),
+ 1, TRUE,
+ 2, "source",
+ 3, 0.0,
+ 4, "source",
-1);
const hb_rate_t *rate;
}
option = g_strdup_printf ("%s %s", rate->name, desc);
gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, option,
- 1, TRUE,
- 2, rate->name,
- 3, (gdouble)rate->rate,
- 4, rate->name,
+ gtk_list_store_set(store, &iter,
+ 0, option,
+ 1, TRUE,
+ 2, rate->name,
+ 3, (gdouble)rate->rate,
+ 4, rate->name,
-1);
g_free(option);
}
GtkTreeIter iter;
GtkListStore *store;
gchar *str;
-
+
g_debug("video_encoder_opts_set ()\n");
GtkComboBox *combo = GTK_COMBO_BOX(GHB_WIDGET(builder, name));
store = GTK_LIST_STORE(gtk_combo_box_get_model (combo));
{
gtk_list_store_append(store, &iter);
str = g_strdup_printf("<small>%s</small>", enc->name);
- gtk_list_store_set(store, &iter,
+ gtk_list_store_set(store, &iter,
0, str,
- 1, TRUE,
- 2, enc->short_name,
+ 1, TRUE,
+ 2, enc->short_name,
3, (gdouble)enc->codec,
- 4, enc->short_name,
+ 4, enc->short_name,
-1);
g_free(str);
}
GtkTreeIter iter;
GtkListStore *store;
gchar *str;
-
+
g_debug("ghb_audio_encoder_opts_set_with_mask()\n");
store = GTK_LIST_STORE(gtk_combo_box_get_model (combo));
gtk_list_store_clear(store);
{
gtk_list_store_append(store, &iter);
str = g_strdup_printf("<small>%s</small>", enc->name);
- gtk_list_store_set(store, &iter,
+ gtk_list_store_set(store, &iter,
0, str,
- 1, TRUE,
- 2, enc->short_name,
+ 1, TRUE,
+ 2, enc->short_name,
3, (gdouble)enc->codec,
- 4, enc->short_name,
+ 4, enc->short_name,
-1);
g_free(str);
}
GtkTreeIter iter;
GtkListStore *store;
gchar *str;
-
+
GtkComboBox *combo = GTK_COMBO_BOX(GHB_WIDGET(builder, name));
store = GTK_LIST_STORE(gtk_combo_box_get_model (combo));
gtk_list_store_clear(store);
{
gtk_list_store_append(store, &iter);
str = g_strdup_printf("<small>%s</small>", enc->name);
- gtk_list_store_set(store, &iter,
+ gtk_list_store_set(store, &iter,
0, str,
- 1, TRUE,
- 2, enc->short_name,
+ 1, TRUE,
+ 2, enc->short_name,
3, (gdouble)enc->codec,
- 4, enc->short_name,
+ 4, enc->short_name,
-1);
g_free(str);
}
GtkTreeIter iter;
GtkListStore *store;
gchar *str;
-
+
g_debug("mix_opts_set ()\n");
store = GTK_LIST_STORE(gtk_combo_box_get_model (combo));
gtk_list_store_clear(store);
{
gtk_list_store_append(store, &iter);
str = g_strdup_printf("<small>%s</small>", mix->name);
- gtk_list_store_set(store, &iter,
+ gtk_list_store_set(store, &iter,
0, str,
- 1, TRUE,
- 2, mix->short_name,
- 3, (gdouble)mix->amixdown,
- 4, mix->short_name,
+ 1, TRUE,
+ 2, mix->short_name,
+ 3, (gdouble)mix->amixdown,
+ 4, mix->short_name,
-1);
g_free(str);
}
GtkTreeIter iter;
GtkListStore *store;
gchar *str;
-
+
g_debug("hb_container_opts_set ()\n");
GtkComboBox *combo = GTK_COMBO_BOX(GHB_WIDGET(builder, name));
store = GTK_LIST_STORE(gtk_combo_box_get_model (combo));
{
gtk_list_store_append(store, &iter);
str = g_strdup_printf("<small>%s</small>", mux->name);
- gtk_list_store_set(store, &iter,
+ gtk_list_store_set(store, &iter,
0, str,
- 1, TRUE,
- 2, mux->short_name,
+ 1, TRUE,
+ 2, mux->short_name,
3, (gdouble)mux->format,
- 4, mux->short_name,
+ 4, mux->short_name,
-1);
g_free(str);
}
GtkTreeIter iter;
GtkListStore *store;
gint ii;
-
+
g_debug("srt_codeset_opts_set ()\n");
GtkComboBox *combo = GTK_COMBO_BOX(GHB_WIDGET(builder, name));
store = GTK_LIST_STORE(gtk_combo_box_get_model (combo));
for (ii = 0; ii < SRT_TABLE_SIZE; ii++)
{
gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
+ gtk_list_store_set(store, &iter,
0, srt_codeset_table[ii],
- 1, TRUE,
+ 1, TRUE,
2, srt_codeset_table[ii],
- 3, (gdouble)ii,
+ 3, (gdouble)ii,
4, srt_codeset_table[ii],
-1);
}
GtkTreeIter iter;
GtkListStore *store;
gint ii;
-
+
g_debug("language_opts_set ()\n");
GtkComboBox *combo = GTK_COMBO_BOX(GHB_WIDGET(builder, name));
store = GTK_LIST_STORE(gtk_combo_box_get_model (combo));
lang = ghb_language_table[ii].native_name;
else
lang = ghb_language_table[ii].eng_name;
-
+
gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
+ gtk_list_store_set(store, &iter,
0, lang,
- 1, TRUE,
- 2, ghb_language_table[ii].iso639_2,
- 3, (gdouble)ii,
- 4, ghb_language_table[ii].iso639_1,
+ 1, TRUE,
+ 2, ghb_language_table[ii].iso639_2,
+ 3, (gdouble)ii,
+ 4, ghb_language_table[ii].iso639_1,
-1);
}
}
hb_title_t * title = NULL;
gint ii;
gint count = 0;
-
+
g_debug("title_opts_set ()\n");
GtkComboBox *combo = GTK_COMBO_BOX(GHB_WIDGET(builder, name));
store = GTK_LIST_STORE(gtk_combo_box_get_model (combo));
{
// No titles. Fill in a default.
gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, _("No Titles"),
- 1, TRUE,
- 2, "none",
- 3, -1.0,
- 4, "none",
+ gtk_list_store_set(store, &iter,
+ 0, _("No Titles"),
+ 1, TRUE,
+ 2, "none",
+ 3, -1.0,
+ 4, "none",
-1);
title_opts.map[0].option = "No Titles";
title_opts.map[0].shortOpt = "none";
{
char *tmp;
tmp = g_strdup_printf ("%d - %02dh%02dm%02ds - %s",
- title->index, title->hours, title->minutes, title->seconds,
+ title->index, title->hours, title->minutes, title->seconds,
title->name);
titles[ii] = g_markup_escape_text(tmp, -1);
g_free(tmp);
else
{
char *tmp;
- tmp = g_strdup_printf ("%d - %s",
+ tmp = g_strdup_printf ("%d - %s",
title->index, title->name);
titles[ii] = g_markup_escape_text(tmp, -1);
g_free(tmp);
if (title->duration != 0)
{
titles[ii] = g_strdup_printf("%d (%05d.MPLS) - %02dh%02dm%02ds",
- title->index, title->playlist, title->hours,
+ title->index, title->playlist, title->hours,
title->minutes, title->seconds);
}
else
}
}
gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, titles[ii],
- 1, TRUE,
- 2, titles[ii],
- 3, (gdouble)ii,
- 4, titles[ii],
+ gtk_list_store_set(store, &iter,
+ 0, titles[ii],
+ 1, TRUE,
+ 2, titles[ii],
+ 3, (gdouble)ii,
+ 4, titles[ii],
-1);
title_opts.map[ii].option = titles[ii];
title_opts.map[ii].shortOpt = titles[ii];
gtk_list_store_clear(store);
gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
+ gtk_list_store_set(store, &iter,
0, _("None"),
- 1, TRUE,
+ 1, TRUE,
2, "none",
- 3, (gdouble)0,
+ 3, (gdouble)0,
4, "none",
-1);
if (strcmp(tunes[ii], "fastdecode") && strcmp(tunes[ii], "zerolatency"))
{
gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
+ gtk_list_store_set(store, &iter,
0, tunes[ii],
- 1, TRUE,
+ 1, TRUE,
2, tunes[ii],
3, (gdouble)ii + 1,
4, tunes[ii],
for (ii = 0; ii < count; ii++)
{
gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
+ gtk_list_store_set(store, &iter,
0, profiles[ii],
- 1, TRUE,
+ 1, TRUE,
2, profiles[ii],
3, (gdouble)ii,
4, profiles[ii],
for (ii = 0; ii < count; ii++)
{
gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
+ gtk_list_store_set(store, &iter,
0, levels[ii],
- 1, TRUE,
+ 1, TRUE,
2, levels[ii],
3, (gdouble)ii,
4, levels[ii],
{
gdouble ivalue;
gboolean foundit = FALSE;
-
+
if (gtk_tree_model_get_iter_first (store, iter))
{
do
gint ii;
gint count = 0;
gchar *str;
-
+
g_debug("audio_track_opts_set ()\n");
GtkComboBox *combo = GTK_COMBO_BOX(GHB_WIDGET(builder, name));
store = GTK_LIST_STORE(gtk_combo_box_get_model (combo));
// No audio. set some default
gtk_list_store_append(store, &iter);
str = g_strdup_printf("<small>%s</small>", _("No Audio"));
- gtk_list_store_set(store, &iter,
+ gtk_list_store_set(store, &iter,
0, str,
- 1, TRUE,
- 2, "none",
- 3, -1.0,
- 4, "none",
+ 1, TRUE,
+ 2, "none",
+ 3, -1.0,
+ 4, "none",
-1);
g_free(str);
audio_track_opts.map[0].option = g_strdup("No Audio");
gtk_list_store_append(store, &iter);
char *tmp = g_strdup_printf("%d - %s", ii + 1, audio->lang.description);
str = g_strdup_printf("<small>%s</small>", tmp);
- gtk_list_store_set(store, &iter,
+ gtk_list_store_set(store, &iter,
0, str,
- 1, TRUE,
- 2, index_str[ii],
- 3, (gdouble)ii,
- 4, index_str[ii],
+ 1, TRUE,
+ 2, index_str[ii],
+ 3, (gdouble)ii,
+ 4, index_str[ii],
-1);
g_free(str);
audio_track_opts.map[ii].option = g_strdup(tmp);
hb_title_t * title = NULL;
hb_audio_config_t * audio;
gchar * desc = "Unknown";
-
+
g_debug("ghb_audio_track_description ()\n");
title = ghb_get_title_info( titleindex );
hb_subtitle_t * subtitle;
gint ii, count = 0;
static char ** options = NULL;
-
+
g_debug("subtitle_track_opts_set ()\n");
GtkComboBox *combo = GTK_COMBO_BOX(GHB_WIDGET(builder, name));
store = GTK_LIST_STORE(gtk_combo_box_get_model (combo));
if (count > 0)
{
gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, _("Foreign Audio Search"),
- 1, TRUE,
- 2, "-1",
- 3, -1.0,
- 4, "auto",
+ gtk_list_store_set(store, &iter,
+ 0, _("Foreign Audio Search"),
+ 1, TRUE,
+ 2, "-1",
+ 3, -1.0,
+ 4, "auto",
-1);
subtitle_opts.map[0].option = "Foreign Audio Search";
subtitle_opts.map[0].shortOpt = "-1";
for (ii = 0; ii < count; ii++)
{
subtitle = (hb_subtitle_t *)hb_list_item(title->list_subtitle, ii);
- options[ii] = g_strdup_printf("%d - %s (%s)", ii+1,
- subtitle->lang,
+ options[ii] = g_strdup_printf("%d - %s (%s)", ii+1,
+ subtitle->lang,
hb_subsource_name(subtitle->source));
subtitle_opts.map[ii+1].option = options[ii];
subtitle_opts.map[ii+1].shortOpt = index_str[ii];
subtitle_opts.map[ii+1].ivalue = ii;
subtitle_opts.map[ii+1].svalue = subtitle->iso639_2;
gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, options[ii],
- 1, TRUE,
- 2, index_str[ii],
- 3, (gdouble)ii,
- 4, subtitle->iso639_2,
+ gtk_list_store_set(store, &iter,
+ 0, options[ii],
+ 1, TRUE,
+ 2, index_str[ii],
+ 3, (gdouble)ii,
+ 4, subtitle->iso639_2,
-1);
}
options[count] = NULL;
else
{
gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, _("None"),
- 1, TRUE,
- 2, "0",
- 3, 0.0,
- 4, "none",
+ gtk_list_store_set(store, &iter,
+ 0, _("None"),
+ 1, TRUE,
+ 2, "0",
+ 3, 0.0,
+ 4, "none",
-1);
subtitle_opts.map[0].option = "None";
subtitle_opts.map[0].shortOpt = "0";
gint ii;
gint count = 0;
gint feature;
-
+
g_debug("ghb_longest_title ()\n");
if (h_scan == NULL) return 0;
title_set = hb_get_title_set( h_scan );
{
hb_audio_config_t * audio;
const gchar *lang = "und";
-
+
g_debug("ghb_lookup_1st_audio_lang ()\n");
if (title == NULL)
return lang;
GtkTreeIter iter;
GtkListStore *store;
gint ii;
-
+
g_debug("generic_opts_set ()\n");
if (name == NULL || opts == NULL) return;
GtkComboBox *combo = GTK_COMBO_BOX(GHB_WIDGET(builder, name));
for (ii = 0; ii < opts->count; ii++)
{
gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, gettext(opts->map[ii].option),
- 1, TRUE,
- 2, opts->map[ii].shortOpt,
- 3, opts->map[ii].ivalue,
- 4, opts->map[ii].svalue,
+ gtk_list_store_set(store, &iter,
+ 0, gettext(opts->map[ii].option),
+ 1, TRUE,
+ 2, opts->map[ii].shortOpt,
+ 3, opts->map[ii].ivalue,
+ 4, opts->map[ii].svalue,
-1);
}
}
GtkListStore *store;
gint ii;
gchar *str;
-
+
g_debug("small_opts_set ()\n");
if (name == NULL || opts == NULL) return;
GtkComboBox *combo = GTK_COMBO_BOX(GHB_WIDGET(builder, name));
gtk_list_store_append(store, &iter);
str = g_strdup_printf("<small>%s</small>",
gettext(opts->map[ii].option));
- gtk_list_store_set(store, &iter,
+ gtk_list_store_set(store, &iter,
0, str,
- 1, TRUE,
- 2, opts->map[ii].shortOpt,
- 3, opts->map[ii].ivalue,
- 4, opts->map[ii].svalue,
+ 1, TRUE,
+ 2, opts->map[ii].shortOpt,
+ 3, opts->map[ii].ivalue,
+ 4, opts->map[ii].svalue,
-1);
g_free(str);
}
void
ghb_update_ui_combo_box(
- signal_user_data_t *ud,
- const gchar *name,
- gint user_data,
+ signal_user_data_t *ud,
+ const gchar *name,
+ gint user_data,
gboolean all)
{
GtkComboBox *combo = NULL;
gint handler_id = 0;
if (name != NULL)
- {
+ {
g_debug("ghb_update_ui_combo_box() %s\n", name);
// Clearing a combo box causes a rash of "changed" events, even when
// the active item is -1 (inactive). To control things, I'm disabling
if (signal_id > 0)
{
// Valid signal id found. This should always succeed.
- handler_id = g_signal_handler_find ((gpointer)combo, G_SIGNAL_MATCH_ID,
+ handler_id = g_signal_handler_find ((gpointer)combo, G_SIGNAL_MATCH_ID,
signal_id, 0, 0, 0, 0);
if (handler_id > 0)
{
g_signal_handler_block ((gpointer)combo, handler_id);
}
}
- }
+ }
if (all)
{
audio_bitrate_opts_set(ud->builder, "AudioBitrate");
g_signal_handler_unblock ((gpointer)combo, handler_id);
}
}
-
+
static void
init_ui_combo_boxes(GtkBuilder *builder)
{
hb_chapter_t * chapter;
gint count, c;
gint64 duration;
-
+
*hh = *mm = *ss = 0;
title = ghb_get_title_info( tt );
if (title == NULL) return;
*ss = (duration / 90000) % 60;
}
-void
-ghb_get_chapter_duration(gint ti, gint ii, gint64 *duration)
+gint64
+ghb_get_chapter_duration(gint ti, gint chap)
{
hb_title_t * title;
hb_chapter_t * chapter;
gint count;
-
+
g_debug("ghb_get_chapter_duration (title = %d)\n", ti);
- *duration = 0;
title = ghb_get_title_info( ti );
- if (title == NULL) return;
+ if (title == NULL) return 0;
count = hb_list_count( title->list_chapter );
- if (ii >= count) return;
- chapter = hb_list_item(title->list_chapter, ii);
- if (chapter == NULL) return;
- *duration = chapter->duration;
+ if (chap >= count) return 0;
+ chapter = hb_list_item(title->list_chapter, chap);
+ if (chapter == NULL) return 0;
+ return chapter->duration;
+}
+
+gint64
+ghb_get_chapter_start(gint ti, gint chap)
+{
+ hb_title_t * title;
+ hb_chapter_t * chapter;
+ gint count, ii;
+ gint64 start = 0;
+
+ g_debug("ghb_get_chapter_start (title = %d)\n", ti);
+ title = ghb_get_title_info( ti );
+ if (title == NULL) return 0;
+ count = hb_list_count( title->list_chapter );
+ if (chap > count) return chap = count;
+ for (ii = 0; ii < chap; ii++)
+ {
+ chapter = hb_list_item(title->list_chapter, ii);
+ start += chapter->duration;
+ }
+ return start;
}
GValue*
hb_chapter_t * chapter;
gint count, ii;
GValue *chapters = NULL;
-
+
g_debug("ghb_get_chapters (title = %d)\n", titleindex);
chapters = ghb_array_value_new(0);
ghb_array_append(chapters, ghb_string_value_new(str));
g_free(str);
}
- else
+ else
{
ghb_array_append(chapters, ghb_string_value_new(chapter->title));
}
GtkTreeIter iter;
GtkListStore *store;
gchar *str;
-
+
g_debug("audio_bitrate_opts_add ()\n");
if (rate >= 0 && rate < 8) return;
{
str = g_strdup_printf ("<small>%s</small>", ghb_custom_bitrate_str);
gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, str,
- 1, TRUE,
- 2, ghb_custom_bitrate_str,
- 3, (gdouble)rate,
- 4, ghb_custom_bitrate_str,
+ gtk_list_store_set(store, &iter,
+ 0, str,
+ 1, TRUE,
+ 2, ghb_custom_bitrate_str,
+ 3, (gdouble)rate,
+ 4, ghb_custom_bitrate_str,
-1);
g_free(str);
}
void
ghb_audio_bitrate_opts_filter(
GtkComboBox *combo,
- gint first_rate,
+ gint first_rate,
gint last_rate)
{
GtkTreeIter iter;
GtkListStore *store;
gdouble ivalue;
gboolean done = FALSE;
-
+
g_debug("audio_bitrate_opts_filter ()\n");
store = GTK_LIST_STORE(gtk_combo_box_get_model (combo));
if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL(store), &iter))
static void
audio_bitrate_opts_update(
- GtkBuilder *builder,
- const gchar *name,
- gint first_rate,
+ GtkBuilder *builder,
+ const gchar *name,
+ gint first_rate,
gint last_rate,
gint extra_rate)
{
GtkListStore *store;
gdouble ivalue;
gboolean done = FALSE;
-
+
g_debug("audio_bitrate_opts_clean ()\n");
GtkComboBox *combo = GTK_COMBO_BOX(GHB_WIDGET(builder, name));
ghb_audio_bitrate_opts_filter(combo, first_rate, last_rate);
GtkTreeIter iter;
GtkListStore *store;
gchar *str;
-
+
g_debug("audio_bitrate_opts_set ()\n");
store = GTK_LIST_STORE(gtk_combo_box_get_model (combo));
gtk_list_store_clear(store);
{
gtk_list_store_append(store, &iter);
str = g_strdup_printf ("<small>%s</small>", rate->name);
- gtk_list_store_set(store, &iter,
+ gtk_list_store_set(store, &iter,
0, str,
- 1, TRUE,
- 2, rate->name,
- 3, (gdouble)rate->rate,
- 4, rate->name,
+ 1, TRUE,
+ 2, rate->name,
+ 3, (gdouble)rate->rate,
+ 4, rate->name,
-1);
g_free(str);
}
void
ghb_set_bitrate_opts(
- GtkBuilder *builder,
- gint first_rate,
+ GtkBuilder *builder,
+ gint first_rate,
gint last_rate,
gint extra_rate)
{
memcpy(status, &hb_status, sizeof(ghb_status_t));
}
-void
+void
ghb_track_status()
{
hb_state_t s_scan;
case HB_STATE_PAUSED:
hb_status.scan.state |= GHB_STATE_PAUSED;
break;
-
+
case HB_STATE_MUXING:
{
hb_status.scan.state |= GHB_STATE_MUXING;
// When a job is stopped, libhb removes it from the job list,
// but does not remove other jobs that may be associated with it.
// Associated jobs are taged in the sequence id.
- while ((job = hb_job(h_scan, 0)) != NULL)
+ while ((job = hb_job(h_scan, 0)) != NULL)
hb_rem( h_scan, job );
} break;
#undef p
case HB_STATE_PAUSED:
hb_status.queue.state |= GHB_STATE_PAUSED;
break;
-
+
case HB_STATE_MUXING:
{
hb_status.queue.state |= GHB_STATE_MUXING;
// When a job is stopped, libhb removes it from the job list,
// but does not remove other jobs that may be associated with it.
// Associated jobs are taged in the sequence id.
- while ((job = hb_job(h_queue, 0)) != NULL)
+ while ((job = hb_job(h_queue, 0)) != NULL)
hb_rem( h_queue, job );
} break;
#undef p
return hb_list_item( list, titleindex );
}
+hb_list_t *
+ghb_get_title_list()
+{
+ if (h_scan == NULL) return NULL;
+ return hb_get_titles( h_scan );
+}
+
hb_audio_config_t*
ghb_get_scan_audio_info(gint titleindex, gint audioindex)
{
hb_audio_config_t *aconfig;
-
+
aconfig = get_hb_audio(h_scan, titleindex, audioindex);
return aconfig;
}
gint mod;
gint max_width = 0;
gint max_height = 0;
-
+
g_debug("ghb_set_scale ()\n");
pic_par = ghb_settings_combo_int(settings, "PicturePAR");
ghb_settings_set_int(settings, "PictureLeftCrop", crop[2]);
ghb_settings_set_int(settings, "PictureRightCrop", crop[3]);
}
- hb_reduce(&aspect_n, &aspect_d,
- title->width * title->pixel_aspect_width,
+ hb_reduce(&aspect_n, &aspect_d,
+ title->width * title->pixel_aspect_width,
title->height * title->pixel_aspect_height);
crop_width = title->width - crop[2] - crop[3];
crop_height = title->height - crop[0] - crop[1];
job->anamorphic.keep_display_aspect = 0;
if (mode & GHB_PIC_KEEP_PAR)
{
- job->anamorphic.par_width =
+ job->anamorphic.par_width =
ghb_settings_get_int(settings, "PicturePARWidth");
- job->anamorphic.par_height =
+ job->anamorphic.par_height =
ghb_settings_get_int(settings, "PicturePARHeight");
}
else
{
- job->anamorphic.dar_width =
+ job->anamorphic.dar_width =
ghb_settings_get_int(settings, "PictureDisplayWidth");
job->anamorphic.dar_height = height;
}
job->anamorphic.keep_display_aspect = 1;
}
// hb_set_anamorphic_size will adjust par, dar, and width/height
- // to conform to job parameters that have been set, including
+ // to conform to job parameters that have been set, including
// maxWidth and maxHeight
hb_set_anamorphic_size(job, &width, &height, &par_width, &par_height);
- if (job->anamorphic.mode == 3 && !keep_aspect &&
+ if (job->anamorphic.mode == 3 && !keep_aspect &&
mode & GHB_PIC_KEEP_PAR)
{
// hb_set_anamorphic_size reduces the par, which we
par_height = ghb_settings_get_int(settings, "PicturePARHeight");
}
}
- else
+ else
{
// Adjust dims according to max values
if (max_height) height = MIN(height, max_height);
{
gdouble par;
gint new_width, new_height;
-
- // Compute pixel aspect ration.
+
+ // Compute pixel aspect ration.
par = (gdouble)(title->height * aspect_n) / (title->width * aspect_d);
// Must scale so that par becomes 1:1
// Try to keep largest dimension
hb_job_close( &job );
}
+void
+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");
+ hb_reduce(&dar_width, &dar_height, disp_width, disp_height);
+ gint iaspect = dar_width * 9 / dar_height;
+ if (dar_width > 2 * dar_height)
+ {
+ str = g_strdup_printf("%.2f : 1", (gdouble)dar_width / dar_height);
+ }
+ else if (iaspect <= 16 && iaspect >= 15)
+ {
+ str = g_strdup_printf("%.2f : 9", (gdouble)dar_width * 9 / dar_height);
+ }
+ else if (iaspect <= 12 && iaspect >= 11)
+ {
+ str = g_strdup_printf("%.2f : 3", (gdouble)dar_width * 3 / dar_height);
+ }
+ else
+ {
+ str = g_strdup_printf("%d : %d", dar_width, dar_height);
+ }
+ ghb_ui_update(ud, "display_aspect", ghb_string_value(str));
+ g_free(str);
+}
+
void
ghb_set_scale(signal_user_data_t *ud, gint mode)
{
gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), 2, 16);
}
- ghb_ui_update_from_settings(ud->builder, "autoscale", ud->settings);
- ghb_ui_update_from_settings(ud->builder, "PictureModulus", ud->settings);
- ghb_ui_update_from_settings(ud->builder, "PictureLooseCrop", ud->settings);
- ghb_ui_update_from_settings(ud->builder, "PictureKeepRatio", ud->settings);
-
- ghb_ui_update_from_settings(ud->builder, "PictureTopCrop", ud->settings);
- ghb_ui_update_from_settings(ud->builder, "PictureBottomCrop", ud->settings);
- ghb_ui_update_from_settings(ud->builder, "PictureLeftCrop", ud->settings);
- ghb_ui_update_from_settings(ud->builder, "PictureRightCrop", ud->settings);
+ ghb_ui_update_from_settings(ud, "autoscale", ud->settings);
+ ghb_ui_update_from_settings(ud, "PictureModulus", ud->settings);
+ ghb_ui_update_from_settings(ud, "PictureLooseCrop", ud->settings);
+ ghb_ui_update_from_settings(ud, "PictureKeepRatio", ud->settings);
- ghb_ui_update_from_settings(ud->builder, "scale_width", ud->settings);
- ghb_ui_update_from_settings(ud->builder, "scale_height", ud->settings);
+ ghb_ui_update_from_settings(ud, "PictureTopCrop", ud->settings);
+ ghb_ui_update_from_settings(ud, "PictureBottomCrop", ud->settings);
+ ghb_ui_update_from_settings(ud, "PictureLeftCrop", ud->settings);
+ ghb_ui_update_from_settings(ud, "PictureRightCrop", ud->settings);
- ghb_ui_update_from_settings(ud->builder, "PicturePARWidth", ud->settings);
- ghb_ui_update_from_settings(ud->builder, "PicturePARHeight", ud->settings);
- ghb_ui_update_from_settings(ud->builder, "PictureDisplayWidth", ud->settings);
- ghb_ui_update_from_settings(ud->builder, "PictureDisplayHeight", ud->settings);
- gint disp_width, disp_height, dar_width, dar_height;
- gchar *str;
+ ghb_ui_update_from_settings(ud, "scale_width", ud->settings);
+ ghb_ui_update_from_settings(ud, "scale_height", ud->settings);
- disp_width = ghb_settings_get_int(ud->settings, "PictureDisplayWidth");
- disp_height = ghb_settings_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)
- {
- str = g_strdup_printf("%.2f : 1", (gdouble)dar_width / dar_height);
- }
- else if (iaspect <= 16 && iaspect >= 15)
- {
- str = g_strdup_printf("%.2f : 9", (gdouble)dar_width * 9 / dar_height);
- }
- else if (iaspect <= 12 && iaspect >= 11)
- {
- str = g_strdup_printf("%.2f : 3", (gdouble)dar_width * 3 / dar_height);
- }
- else
- {
- str = g_strdup_printf("%d : %d", dar_width, dar_height);
- }
- ghb_ui_update(ud, "display_aspect", ghb_string_value(str));
- g_free(str);
+ ghb_ui_update_from_settings(ud, "PicturePARWidth", ud->settings);
+ ghb_ui_update_from_settings(ud, "PicturePARHeight", ud->settings);
+ ghb_ui_update_from_settings(ud, "PictureDisplayWidth", ud->settings);
+ ghb_ui_update_from_settings(ud, "PictureDisplayHeight", ud->settings);
+ ghb_update_display_aspect_label(ud);
ud->scale_busy = FALSE;
}
static void
-set_preview_job_settings(hb_job_t *job, GValue *settings)
+set_preview_job_settings(signal_user_data_t *ud, hb_job_t *job, GValue *settings)
{
job->crop[0] = ghb_settings_get_int(settings, "PictureTopCrop");
job->crop[1] = ghb_settings_get_int(settings, "PictureBottomCrop");
job->crop[3] = ghb_settings_get_int(settings, "PictureRightCrop");
job->anamorphic.mode = ghb_settings_combo_int(settings, "PicturePAR");
- job->modulus =
+ job->modulus =
ghb_settings_combo_int(settings, "PictureModulus");
job->width = ghb_settings_get_int(settings, "scale_width");
job->height = ghb_settings_get_int(settings, "scale_height");
- if (ghb_settings_get_boolean(settings, "preview_show_crop"))
+ if (ghb_settings_get_boolean(ud->prefs, "preview_show_crop"))
{
- gdouble xscale = (gdouble)job->width /
+ gdouble xscale = (gdouble)job->width /
(gdouble)(job->title->width - job->crop[2] - job->crop[3]);
- gdouble yscale = (gdouble)job->height /
+ gdouble yscale = (gdouble)job->height /
(gdouble)(job->title->height - job->crop[0] - job->crop[1]);
-
+
job->width += xscale * (job->crop[2] + job->crop[3]);
job->height += yscale * (job->crop[0] + job->crop[1]);
job->crop[0] = 0;
if (job->anamorphic.mode == 3 && !keep_aspect)
{
job->anamorphic.keep_display_aspect = 0;
- job->anamorphic.par_width =
+ job->anamorphic.par_width =
ghb_settings_get_int(settings, "PicturePARWidth");
- job->anamorphic.par_height =
+ job->anamorphic.par_height =
ghb_settings_get_int(settings, "PicturePARHeight");
}
else
_("Srt file does not exist or not a regular file.\n\n"
"You should choose a valid file.\n"
"If you continue, this subtitle will be ignored."));
- if (!ghb_message_dialog(GTK_MESSAGE_WARNING, message,
+ if (!ghb_message_dialog(GTK_MESSAGE_WARNING, message,
_("Cancel"), _("Continue")))
{
g_free(message);
aconfig = (hb_audio_config_t *) hb_list_audio_config_item(
title->list_audio, track );
if ( ghb_audio_is_passthru(codec) &&
- !(ghb_audio_can_passthru(aconfig->in.codec) &&
+ !(ghb_audio_can_passthru(aconfig->in.codec) &&
(aconfig->in.codec & codec)))
{
// Not supported. AC3 is passthrough only, so input must be AC3
gchar *a_unsup = NULL;
gchar *mux_s = NULL;
if (mux & HB_MUX_MASK_MP4)
- {
+ {
mux_s = "MP4";
// mp4/vorbis|DTS combination is not supported.
if (codec == HB_ACODEC_VORBIS)
gchar *message;
gint min, max;
- if (ghb_settings_get_boolean(settings, "nocheckvquality")) return TRUE;
vcodec = ghb_settings_combo_int(settings, "VideoEncoder");
gdouble vquality;
vquality = ghb_settings_get_double(settings, "VideoQualitySlider");
"many players and editors.\n\n"
"It will produce enormous output files.\n\n"
"Are you sure you wish to use this setting?"));
- if (!ghb_message_dialog(GTK_MESSAGE_QUESTION, message,
+ if (!ghb_message_dialog(GTK_MESSAGE_QUESTION, message,
_("Cancel"), _("Continue")))
{
g_free(message);
"Typical values range from %d to %d.\n\n"
"Are you sure you wish to use this setting?"),
(gint)vquality, min, max);
- if (!ghb_message_dialog(GTK_MESSAGE_QUESTION, message,
+ if (!ghb_message_dialog(GTK_MESSAGE_QUESTION, message,
_("Cancel"), _("Continue")))
{
g_free(message);
hb_filter_object_t * filter;
gchar *filter_str;
gchar *dest_str = NULL;
+ GValue *prefs;
g_debug("add_job()\n");
if (h == NULL) return;
job = hb_job_init( title );
if (job == NULL) return;
+ prefs = ghb_settings_get_value(js, "Preferences");
job->angle = ghb_settings_get_int(js, "angle");
job->start_at_preview = ghb_settings_get_int(js, "start_frame") + 1;
if (job->start_at_preview)
{
- job->seek_points = ghb_settings_get_int(js, "preview_count");
- job->pts_to_stop = ghb_settings_get_int(js, "live_duration") * 90000LL;
+ job->seek_points = ghb_settings_get_int(prefs, "preview_count");
+ job->pts_to_stop = ghb_settings_get_int(prefs, "live_duration") * 90000LL;
}
job->mux = ghb_settings_combo_int(js, "FileFormat");
start = ghb_settings_get_int(js, "start_point");
end = ghb_settings_get_int(js, "end_point");
job->pts_to_start = (int64_t)MIN(duration-1, start) * 90000;
- job->pts_to_stop = (int64_t)MAX(start+1, end) * 90000 -
+ job->pts_to_stop = (int64_t)MAX(start+1, end) * 90000 -
job->pts_to_start;
}
if (ghb_settings_combo_int(js, "PtoPType") == 2)
gint64 max_frames;
max_frames = (gint64)duration * title->rate / title->rate_base;
job->frame_to_start = (int64_t)MIN(max_frames-1, start-1);
- job->frame_to_stop = (int64_t)MAX(start, end-1) -
+ job->frame_to_stop = (int64_t)MAX(start, end-1) -
job->frame_to_start;
}
if (job->chapter_start != job->chapter_end)
name = NULL;
chapter = ghb_array_get_nth(chapters, chap);
- name = ghb_value_string(chapter);
+ name = ghb_value_string(chapter);
if (name == NULL)
{
name = g_strdup_printf ("Chapter %2d", chap+1);
}
}
}
-
+
gboolean decomb_deint = ghb_settings_get_boolean(js, "PictureDecombDeinterlace");
gint decomb = ghb_settings_combo_int(js, "PictureDecomb");
gint deint = ghb_settings_combo_int(js, "PictureDeinterlace");
job->modulus = ghb_settings_combo_int(js, "PictureModulus");
if (job->anamorphic.mode)
{
- job->anamorphic.par_width =
+ job->anamorphic.par_width =
ghb_settings_get_int(js, "PicturePARWidth");
- job->anamorphic.par_height =
+ job->anamorphic.par_height =
ghb_settings_get_int(js, "PicturePARHeight");
job->anamorphic.dar_width = 0;
job->anamorphic.dar_height = 0;
crop[2] = ghb_settings_get_int(js, "PictureLeftCrop");
crop[3] = ghb_settings_get_int(js, "PictureRightCrop");
- filter_str = g_strdup_printf("%d:%d:%d:%d:%d:%d",
+ filter_str = g_strdup_printf("%d:%d:%d:%d:%d:%d",
width, height, crop[0], crop[1], crop[2], crop[3]);
filter = hb_filter_init(HB_FILTER_CROP_SCALE);
hb_add_filter( job, filter, filter_str );
const GValue *audio_list;
gint count, ii;
gint tcount = 0;
-
+
audio_list = ghb_settings_get_value(js, "audio_list");
count = ghb_array_len(audio_list);
for (ii = 0; ii < count; ii++)
char * aname = ghb_settings_get_string(asettings, "AudioTrackName");
if (aname && *aname)
{
- // This leaks, but there is no easy way to clean up
+ // This leaks, but there is no easy way to clean up
// presently
audio.out.name = aname;
}
gint copy_mask = ghb_get_copy_mask(js);
audio.out.codec = ghb_select_audio_codec(job->mux, aconfig, acodec, fallback, copy_mask);
- audio.out.gain =
+ audio.out.gain =
ghb_settings_get_double(asettings, "AudioTrackGain");
- audio.out.dynamic_range_compression =
+ audio.out.dynamic_range_compression =
ghb_settings_get_double(asettings, "AudioTrackDRCSlider");
if (audio.out.dynamic_range_compression < 1.0)
audio.out.dynamic_range_compression = 0.0;
{
audio.out.mixdown = ghb_settings_combo_int(asettings, "AudioMixdown");
// Make sure the mixdown is valid and pick a new one if not.
- audio.out.mixdown = ghb_get_best_mix(aconfig, audio.out.codec,
+ audio.out.mixdown = ghb_get_best_mix(aconfig, audio.out.codec,
audio.out.mixdown);
gint srate = ghb_settings_combo_int(asettings, "AudioSamplerate");
if (srate == 0) // 0 is same as source
else
{
audio.out.quality = HB_INVALID_AUDIO_QUALITY;
- audio.out.bitrate =
+ audio.out.bitrate =
ghb_settings_combo_int(asettings, "AudioBitrate");
audio.out.bitrate = hb_audio_bitrate_get_best(
- audio.out.codec, audio.out.bitrate,
+ audio.out.codec, audio.out.bitrate,
audio.out.samplerate, audio.out.mixdown);
}
}
const GValue *subtitle_list;
gint subtitle;
gboolean force, burned, def, one_burned = FALSE;
-
+
ghb_settings_set_boolean(js, "subtitle_scan", FALSE);
subtitle_list = ghb_settings_get_value(js, "subtitle_list");
count = ghb_array_len(subtitle_list);
{
// Add filter that renders vobsubs
filter = hb_filter_init(HB_FILTER_RENDER_SUB);
- filter_str = g_strdup_printf("%d:%d:%d:%d",
+ filter_str = g_strdup_printf("%d:%d:%d:%d",
crop[0], crop[1], crop[2], crop[3]);
hb_add_filter( job, filter, filter_str );
g_free(filter_str);
void
ghb_add_job(GValue *js, gint unique_id)
{
- // Since I'm doing a scan of the single title I want just prior
+ // Since I'm doing a scan of the single title I want just prior
// to adding the job, there is only the one title to choose from.
add_job(h_queue, js, unique_id, 0);
}
{
hb_job_t * job;
gint ii;
-
+
// Multiples passes all get the same id
// remove them all.
// Go backwards through list, so reordering doesn't screw me.
static void
vert_line(
- GdkPixbuf * pb,
- guint8 r,
- guint8 g,
- guint8 b,
- gint x,
- gint y,
- gint len,
+ GdkPixbuf * pb,
+ guint8 r,
+ guint8 g,
+ guint8 b,
+ gint x,
+ gint y,
+ gint len,
gint width)
{
guint8 *pixels = gdk_pixbuf_get_pixels (pb);
static void
horz_line(
- GdkPixbuf * pb,
- guint8 r,
- guint8 g,
- guint8 b,
- gint x,
- gint y,
+ GdkPixbuf * pb,
+ guint8 r,
+ guint8 g,
+ guint8 b,
+ gint x,
+ gint y,
gint len,
gint width)
{
guint8 r;
guint8 g;
guint8 b;
- } c[4] =
+ } c[4] =
{{0x80, 0x80, 0x80},{0xC0, 0x80, 0x70},{0x80, 0xA0, 0x80},{0x70, 0x80, 0xA0}};
if (!orientation)
GdkPixbuf*
ghb_get_preview_image(
- gint titleindex,
- gint index,
+ gint titleindex,
+ gint index,
signal_user_data_t *ud,
gint *out_width,
gint *out_height)
{
- GValue *settings;
hb_title_t *title;
hb_job_t *job;
-
- settings = ud->settings;
+
title = ghb_get_title_info( titleindex );
if( title == NULL ) return NULL;
job = hb_job_init( title );
if (job == NULL) return NULL;
- set_preview_job_settings(job, settings);
+ set_preview_job_settings(ud, job, ud->settings);
// hb_get_preview doesn't compensate for anamorphic, so lets
// calculate scale factors
gint width, height, par_width = 1, par_height = 1;
- gint pic_par = ghb_settings_combo_int(settings, "PicturePAR");
+ gint pic_par = ghb_settings_combo_int(ud->settings, "PicturePAR");
if (pic_par)
{
- hb_set_anamorphic_size( job, &width, &height,
+ hb_set_anamorphic_size( job, &width, &height,
&par_width, &par_height );
}
// Create an GdkPixbuf and copy the libhb image into it, converting it from
// libhb's format something suitable.
-
- // The image data returned by hb_get_preview is 4 bytes per pixel,
+
+ // The image data returned by hb_get_preview is 4 bytes per pixel,
// BGRA format. Alpha is ignored.
GdkPixbuf *preview = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, dstWidth, dstHeight);
guint8 *pixels = gdk_pixbuf_get_pixels (preview);
-
+
guint32 *src = (guint32*)buffer;
guint8 *dst = pixels;
}
dst += stride;
}
- gint w = ghb_settings_get_int(settings, "scale_width");
- gint h = ghb_settings_get_int(settings, "scale_height");
+ gint w = ghb_settings_get_int(ud->settings, "scale_width");
+ gint h = ghb_settings_get_int(ud->settings, "scale_height");
ghb_par_scale(ud, &w, &h, par_width, par_height);
gint c0, c1, c2, c3;
- c0 = ghb_settings_get_int(settings, "PictureTopCrop");
- c1 = ghb_settings_get_int(settings, "PictureBottomCrop");
- c2 = ghb_settings_get_int(settings, "PictureLeftCrop");
- c3 = ghb_settings_get_int(settings, "PictureRightCrop");
+ 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");
gdouble xscale = (gdouble)w / (gdouble)(title->width - c2 - c3);
gdouble yscale = (gdouble)h / (gdouble)(title->height - c0 - c1);
-
+
ghb_par_scale(ud, &dstWidth, &dstHeight, par_width, par_height);
*out_width = w;
*out_height = h;
- if (ghb_settings_get_boolean(settings, "reduce_hd_preview"))
+ if (ghb_settings_get_boolean(ud->prefs, "reduce_hd_preview"))
{
GdkScreen *ss;
gint s_w, s_h;
gint orig_w, orig_h;
gint factor = 80;
- if (ghb_settings_get_boolean(settings, "preview_fullscreen"))
+ if (ghb_settings_get_boolean(ud->prefs, "preview_fullscreen"))
{
factor = 100;
}
}
GdkPixbuf *scaled_preview;
scaled_preview = gdk_pixbuf_scale_simple(preview, dstWidth, dstHeight, GDK_INTERP_HYPER);
- if (ghb_settings_get_boolean(settings, "preview_show_crop"))
+ if (ghb_settings_get_boolean(ud->prefs, "preview_show_crop"))
{
c0 *= yscale;
c1 *= yscale;
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
*/
-
+
#if !defined(_HBBACKEND_H_)
#define _HBBACKEND_H_
const gchar* ghb_version(void);
void ghb_vquality_range(
- signal_user_data_t *ud,
- gdouble *min,
+ signal_user_data_t *ud,
+ gdouble *min,
gdouble *max,
gdouble *step,
gdouble *page,
void ghb_backend_scan_stop();
void ghb_backend_queue_scan(const gchar *path, gint titleindex);
hb_title_t* ghb_get_title_info(gint titleindex);
+hb_list_t * ghb_get_title_list();
void ghb_par_init(signal_user_data_t *ud);
void ghb_set_scale(signal_user_data_t *ud, gint mode);
void ghb_set_scale_settings(GValue *settings, gint mode);
GValue* ghb_get_chapters(gint titleindex);
-void ghb_get_chapter_duration(gint ti, gint ii, gint64 *dur);
+gint64 ghb_get_chapter_duration(gint ti, gint chap);
+gint64 ghb_get_chapter_start(gint ti, gint chap);
void ghb_part_duration(gint tt, gint sc, gint ec, gint *hh, gint *mm, gint *ss);
gint ghb_get_best_mix(hb_audio_config_t *aconfig, gint acodec, gint mix);
gboolean ghb_ac3_in_audio_list(const GValue *audio_list);
int ghb_lookup_audio_lang(const GValue *glang);
const iso639_lang_t* ghb_iso639_lookup_by_int(int idx);
+void ghb_update_display_aspect_label(signal_user_data_t *ud);
#endif // _HBBACKEND_H_
/*
* icon_tools.c
* Copyright (C) John Stebbins 2008-2013 <stebbins@stebbins>
- *
+ *
* icon_tools.c is free software.
- *
+ *
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
- *
+ *
*/
#include <glib.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
+ <key>Globals</key>
+ <dict>
+ <key>hide_settings</key>
+ <false />
+ <key>show_picture</key>
+ <false />
+ <key>scan_source</key>
+ <string></string>
+ </dict>
<key>Initialization</key>
<dict>
<key>AudioTrackName</key>
<integer>1</integer>
<key>angle</key>
<integer>1</integer>
- <key>anamorphic</key>
- <true />
<key>autoscale</key>
<false />
<key>dest_dir</key>
<string>new_video.mp4</string>
<key>end_point</key>
<integer>100</integer>
- <key>folder</key>
- <string></string>
<key>MetaName</key>
<string></string>
<key>MetaArtist</key>
<string></string>
<key>preset</key>
<array>
+ <string>Regular</string>
<string>Normal</string>
</array>
+ <key>preset_reload</key>
+ <false />
<key>preset_selection</key>
<array>
+ <string>Regular</string>
<string>Normal</string>
</array>
<key>PictureDisplayWidth</key>
<integer>0</integer>
<key>scale_width</key>
<integer>0</integer>
- <key>preview_show_crop</key>
- <false />
- <key>hide_settings</key>
- <false />
- <key>show_picture</key>
- <false />
<key>single_title</key>
<integer>1</integer>
<key>start_point</key>
<key>audio_list</key>
<array>
</array>
+ <key>chapter_list</key>
+ <array>
+ </array>
<key>subtitle_list</key>
<array>
</array>
<dict>
<key>HideAdvancedVideoSettings</key>
<false />
- <key>AdvancedAutoPassthru</key>
- <false />
<key>AutoScan</key>
<false />
<key>AddCC</key>
<string>1</string>
<key>LogLongevity</key>
<string>immortal</string>
- <key>nocheckvquality</key>
- <false />
<key>use_dvdnav</key>
<true />
<key>reduce_hd_preview</key>
<integer>10</integer>
<key>preview_fullscreen</key>
<false />
+ <key>preview_show_crop</key>
+ <false />
<key>preview_x</key>
<integer>-1</integer>
<key>preview_y</key>
<string>0.1</string>
<key>PreferredLanguage</key>
<string>und</string>
- <key>constant_rate_factor</key>
- <true />
<key>WhenComplete</key>
<string>notify</string>
<key>SrtDir</key>
/*
* main.c
* Copyright (C) John Stebbins 2008-2013 <stebbins@stebbins>
- *
+ *
* main.c is free software.
- *
+ *
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
- *
+ *
* main.c is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with main.c. If not, write to:
* The Free Software Foundation, Inc.,
ghb_ui = g_value_get_string(gval);
if (xml != NULL)
res = gtk_builder_add_from_string(xml, ghb_ui, -1, &error);
- if (!xml || !res)
+ if (!xml || !res)
{
GtkWidget *dialog = gtk_message_dialog_new_with_markup(NULL,
GTK_DIALOG_MODAL,
g_debug("handler_name %s", handler_name);
g_debug("signal_name %s", signal_name);
callback = self_symbol_lookup(handler_name);
- if (!callback)
+ if (!callback)
{
g_message("Signal handler (%s) not found", handler_name);
return;
}
- if (connect_object)
+ if (connect_object)
{
g_signal_connect_object(object, signal_name, callback, connect_object, flags);
}
- else
+ else
{
if (flags & G_CONNECT_AFTER)
{
gtk_tree_view_column_set_min_width(column, 24);
gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
- gtk_tree_view_enable_model_drag_dest(treeview, &SrcEntry, 1,
+ gtk_tree_view_enable_model_drag_dest(treeview, &SrcEntry, 1,
GDK_ACTION_MOVE);
- gtk_tree_view_enable_model_drag_source(treeview, GDK_BUTTON1_MASK,
+ gtk_tree_view_enable_model_drag_source(treeview, GDK_BUTTON1_MASK,
&SrcEntry, 1, GDK_ACTION_MOVE);
g_signal_connect(selection, "changed", queue_list_selection_changed_cb, ud);
g_signal_connect(cell, "clicked", queue_remove_clicked_cb, ud);
- g_signal_connect(treeview, "size-allocate", queue_list_size_allocate_cb,
+ g_signal_connect(treeview, "size-allocate", queue_list_size_allocate_cb,
textcell);
g_signal_connect(treeview, "drag_data_received", queue_drag_cb, ud);
g_signal_connect(treeview, "drag_motion", queue_drag_motion_cb, ud);
g_debug("bind_presets_tree_model()\n");
treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
selection = gtk_tree_view_get_selection(treeview);
- treestore = gtk_tree_store_new(6, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT,
+ treestore = gtk_tree_store_new(6, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(treestore));
cell = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes(_("Preset Name"), cell,
- "text", 0, "weight", 1, "style", 2,
+ column = gtk_tree_view_column_new_with_attributes(_("Preset Name"), cell,
+ "text", 0, "weight", 1, "style", 2,
"foreground", 3, "editable", 5, NULL);
g_signal_connect(cell, "edited", preset_edited_cb, ud);
gtk_tree_view_column_set_expand(column, TRUE);
gtk_tree_view_set_tooltip_column(treeview, 4);
- gtk_tree_view_enable_model_drag_dest(treeview, &SrcEntry, 1,
+ gtk_tree_view_enable_model_drag_dest(treeview, &SrcEntry, 1,
GDK_ACTION_MOVE);
- gtk_tree_view_enable_model_drag_source(treeview, GDK_BUTTON1_MASK,
+ gtk_tree_view_enable_model_drag_source(treeview, GDK_BUTTON1_MASK,
&SrcEntry, 1, GDK_ACTION_MOVE);
g_signal_connect(treeview, "drag_data_received", presets_drag_cb, ud);
static gchar *arg_preset = NULL;
static gboolean ghb_debug = FALSE;
-static GOptionEntry entries[] =
+static GOptionEntry entries[] =
{
{ "device", 'd', 0, G_OPTION_ARG_FILENAME, &dvd_device, N_("The device or file to encode"), NULL },
{ "preset", 'p', 0, G_OPTION_ARG_STRING, &arg_preset, N_("The preset values to use for encoding"), NULL },
{
dvd_device = argv[1];
}
-
+
gtk_init(&argc, &argv);
#if GTK_CHECK_VERSION(3, 0, 0)
g_log_set_handler(NULL, G_LOG_LEVEL_DEBUG, debug_log_handler, ud);
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->settings_array = ghb_array_value_new(1);
ud->settings = ghb_settings_new();
+ ghb_array_append(ud->settings_array, ud->settings);
+
ud->builder = create_builder_or_die(BUILDER_NAME);
// Enable events that alert us to media change events
watch_volumes(ud);
ghb_init_audio_defaults_ui(ud);
ghb_init_subtitle_defaults_ui(ud);
- // Load all internal settings
- ghb_settings_init(ud);
+ // Load all internal settings with default values
+ ghb_settings_init(ud->globals, "Globals");
+ ghb_settings_init(ud->prefs, "Preferences");
+ ghb_settings_init(ud->settings, "Initialization");
+ ghb_settings_init(ud->settings, "Presets");
+
// Load prefs before presets. Some preset defaults may depend
// on preference settings.
ghb_prefs_load(ud);
// Load the presets files
ghb_presets_load(ud);
+ ghb_globals_to_ui(ud);
ghb_prefs_to_ui(ud);
gint logLevel;
- logLevel = ghb_settings_get_int(ud->settings, "LoggingLevel");
+ logLevel = ghb_settings_get_int(ud->prefs, "LoggingLevel");
ghb_backend_init(logLevel);
- if (ghb_settings_get_boolean(ud->settings, "hbfd"))
+ if (ghb_settings_get_boolean(ud->prefs, "hbfd"))
{
ghb_hbfd(ud, TRUE);
}
- gchar *source = ghb_settings_get_string(ud->settings, "default_source");
+ gchar *source = ghb_settings_get_string(ud->prefs, "default_source");
ghb_dvd_set_current(source, ud);
g_free(source);
if (dvd_device != NULL)
{
// Source overridden from command line option
- ghb_settings_set_string(ud->settings, "scan_source", dvd_device);
+ ghb_settings_set_string(ud->globals, "scan_source", dvd_device);
g_idle_add((GSourceFunc)ghb_idle_scan, ud);
}
// Reload and check status of the last saved queue
ud->ai = app_indicator_new("HandBrake", "hb-icon", APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
app_indicator_set_menu( ud->ai, ai_menu );
app_indicator_set_label( ud->ai, "", "99.99%");
- if (ghb_settings_get_boolean(ud->settings, "show_status"))
+ if (ghb_settings_get_boolean(ud->prefs, "show_status"))
{
app_indicator_set_status( ud->ai, APP_INDICATOR_STATUS_ACTIVE );
}
si = GTK_STATUS_ICON(GHB_OBJECT(ud->builder, "hb_status"));
gtk_status_icon_set_visible(si,
- ghb_settings_get_boolean(ud->settings, "show_status"));
+ ghb_settings_get_boolean(ud->prefs, "show_status"));
#if GTK_CHECK_VERSION(2, 16, 0)
gtk_status_icon_set_has_tooltip(si, TRUE);
- g_signal_connect(si, "query-tooltip",
+ g_signal_connect(si, "query-tooltip",
status_icon_query_tooltip_cb, ud);
#else
gtk_status_icon_set_tooltip(si, "HandBrake");
gint width, height;
#if GTK_CHECK_VERSION(3, 0, 0)
GtkRequisition min_size, size;
-
+
widget = GHB_WIDGET(ud->builder, "SrtCodeset");
gtk_widget_get_preferred_size( widget, &min_size, &size );
height = MAX(min_size.height, size.height);
height += MAX(min_size.height, size.height);
#else
GtkRequisition size;
-
+
widget = GHB_WIDGET(ud->builder, "SrtCodeset");
gtk_widget_size_request( widget, &size );
height = size.height;
gtk_widget_size_request( widget, &size );
height += size.height;
#endif
-
+
widget = GHB_WIDGET(ud->builder, "hb_window");
- GdkGeometry geo = {
+ GdkGeometry geo = {
-1, -1, 1024, 768, -1, -1, 10, 10, 0, 0, GDK_GRAVITY_NORTH_WEST
};
GdkWindowHints geo_mask;
geo_mask = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE | GDK_HINT_BASE_SIZE;
gtk_window_set_geometry_hints( GTK_WINDOW(widget), widget, &geo, geo_mask);
- width = ghb_settings_get_int(ud->settings, "window_width");
- height = ghb_settings_get_int(ud->settings, "window_height");
+ width = ghb_settings_get_int(ud->prefs, "window_width");
+ height = ghb_settings_get_int(ud->prefs, "window_height");
gtk_window_resize(GTK_WINDOW(widget), width, height);
gtk_widget_show(widget);
PangoFontDescription *font_desc;
font_desc = pango_font_description_from_string("monospace 10");
textview = GTK_TEXT_VIEW(GHB_WIDGET(ud->builder, "activity_view"));
- gtk_widget_override_font(GTK_WIDGET(textview), font_desc);
- pango_font_description_free(font_desc);
+ gtk_widget_override_font(GTK_WIDGET(textview), font_desc);
+ pango_font_description_free(font_desc);
// Everything should be go-to-go. Lets rock!
DepEntry("x264_trellis", "x264_psy_trell", "0", True, False),
DepEntry("x264UseAdvancedOptions", "x264VideoSettingsTable", "TRUE", True, False),
DepEntry("x264UseAdvancedOptions", "x264_tab", "FALSE", True, False),
- DepEntry("HideAdvancedVideoSettings", "x264UseAdvancedOptions", "TRUE", True, True),
DepEntry("use_source_name", "chapters_in_destination", "TRUE", False, False),
DepEntry("use_source_name", "title_no_in_destination", "TRUE", False, False),
)
#define BUF_SZ (128*1024)
-static gchar *preamble =
+static gchar *preamble =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
"<plist version=\"1.0\">\n";
-static gchar *postfix =
+static gchar *postfix =
"</plist>\n";
enum
static void
start_element(
- GMarkupParseContext *ctx,
- const gchar *name,
+ GMarkupParseContext *ctx,
+ const gchar *name,
const gchar **attr_names,
const gchar **attr_values,
gpointer ud,
GError **error)
{
parse_data_t *pd = (parse_data_t*)ud;
- union
+ union
{
gint id;
gpointer pid;
static void
end_element(
- GMarkupParseContext *ctx,
- const gchar *name,
+ GMarkupParseContext *ctx,
+ const gchar *name,
gpointer ud,
GError **error)
{
parse_data_t *pd = (parse_data_t*)ud;
gint id;
- union
+ union
{
gint id;
gpointer pid;
static void
text_data(
- GMarkupParseContext *ctx,
- const gchar *text,
+ GMarkupParseContext *ctx,
+ const gchar *text,
gsize len,
gpointer ud,
GError **error)
static void
passthrough(
- GMarkupParseContext *ctx,
- const gchar *text,
+ GMarkupParseContext *ctx,
+ const gchar *text,
gsize len,
gpointer ud,
GError **error)
}
// This is required or the parser crashes
-static void
+static void
destroy_notify(gpointer data)
{ // Do nothing
//g_debug("destroy parser");
{
GDate *date;
date = g_value_get_boxed(gval);
- indent_fprintf(file, indent, "<date>%d-%d-%d</date>\n",
+ indent_fprintf(file, indent, "<date>%d-%d-%d</date>\n",
g_date_get_year(date),
g_date_get_month(date),
g_date_get_day(date)
#if 0
static value_map_t subtitle_xlat[] =
-{
+{
{ "None", "none" },
{ "Auto", "auto" },
{ "Any", "und" },
gboolean ignore;
} key_map_t;
-key_map_t key_map[] =
+key_map_t key_map[] =
{
{"Audio1Bitrate", NULL, NULL, FALSE, FALSE},
{"Audio1Encoder", NULL, NULL, FALSE, FALSE},
static GValue*
value_xlat(
- GValue *defaults,
- key_map_t *key_map,
- gint key_index,
+ GValue *defaults,
+ key_map_t *key_map,
+ gint key_index,
GValue *mac_val)
{
GValue *gval, *def_val;
for (ii = 0; ii < count; ii++)
{
mac_dict = ghb_array_get_nth(mac_array, ii);
-
+
// Only process builtin types
if (ghb_value_int(ghb_dict_lookup(mac_dict, "Type")) != 0)
continue;
gval = ghb_dict_lookup(mac_dict, "PresetName");
if (gval)
{
- ghb_dict_insert(lin_dict, g_strdup("PresetName"),
+ ghb_dict_insert(lin_dict, g_strdup("PresetName"),
ghb_value_dup(gval));
}
gval = ghb_dict_lookup(mac_dict, "PresetDescription");
if (gval)
{
- ghb_dict_insert(lin_dict, g_strdup("PresetDescription"),
+ ghb_dict_insert(lin_dict, g_strdup("PresetDescription"),
ghb_value_dup(gval));
}
gval = ghb_dict_lookup(mac_dict, "Folder");
mval = ghb_dict_lookup(mac_dict, "ChildrenArray");
lval = ghb_array_value_new(32);
ghb_dict_insert(lin_dict, g_strdup("ChildrenArray"), lval);
- ghb_dict_insert(lin_dict, g_strdup("Folder"),
+ ghb_dict_insert(lin_dict, g_strdup("Folder"),
ghb_boolean_value_new(TRUE));
- ghb_dict_insert(lin_dict, g_strdup("Type"),
+ ghb_dict_insert(lin_dict, g_strdup("Type"),
ghb_int_value_new(0));
parse_preset_array(mval, lval);
}
else
{ // Normal preset
- ghb_dict_insert(lin_dict, g_strdup("Type"),
+ ghb_dict_insert(lin_dict, g_strdup("Type"),
ghb_int_value_new(0));
parse_preset_dict(mac_dict, lin_dict);
}
/*
* presets.c
* Copyright (C) John Stebbins 2008-2013 <stebbins@stebbins>
- *
+ *
* presets.c is free software.
- *
+ *
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
- *
+ *
*/
#include <sys/types.h>
#include <sys/stat.h>
{
GValue *dict;
gint count;
-
+
if (presets == NULL || pos < 0) return;
count = ghb_array_len(presets);
if (pos >= count) return;
gboolean
ghb_presets_remove(
- GValue *presets,
+ GValue *presets,
gint *indices,
gint len)
{
static void
ghb_presets_replace(
- GValue *presets,
+ GValue *presets,
GValue *dict,
gint *indices,
gint len)
static void
ghb_presets_insert(
- GValue *presets,
+ GValue *presets,
GValue *dict,
gint *indices,
gint len)
{
GValue *dict;
gint count, ii;
-
+
g_debug("presets_find_element () (%s)", name);
if (presets == NULL || name == NULL) return -1;
count = ghb_array_len(presets);
{
GValue *dict;
gint count, ii, ptype, last;
-
+
if (presets == NULL || name == NULL) return -1;
last = count = ghb_array_len(presets);
for (ii = 0; ii < count; ii++)
{
if (preset_is_default(dict))
{
- ghb_dict_insert(dict, g_strdup("Default"),
+ ghb_dict_insert(dict, g_strdup("Default"),
ghb_boolean_value_new(FALSE));
}
}
ptype = ghb_value_int(preset_dict_get_value(dict, "Type"));
if (ptype != PRESETS_CUSTOM)
{
- ghb_dict_insert(dict, g_strdup("Type"),
+ ghb_dict_insert(dict, g_strdup("Type"),
ghb_int64_value_new(PRESETS_CUSTOM));
}
folder = ghb_value_boolean(preset_dict_get_value(dict, "Folder"));
gint*
ghb_preset_indices_from_path(
- GValue *presets,
+ GValue *presets,
const GValue *path,
gint *len)
{
static gint
ghb_presets_get_type(
- GValue *presets,
+ GValue *presets,
gint *indices,
gint len)
{
static gboolean
ghb_presets_get_folder(
- GValue *presets,
+ GValue *presets,
gint *indices,
gint len)
{
presets_set_default(gint *indices, gint len)
{
GValue *dict;
-
+
g_debug("presets_set_default ()");
presets_clear_default(presetsPlist);
dict = presets_get_dict(presetsPlist, indices, len);
presets_set_folder_open(gboolean open, gint *indices, gint len)
{
GValue *dict;
-
+
g_debug("presets_set_folder_open ()");
dict = presets_get_dict(presetsPlist, indices, len);
if (dict)
{
- ghb_dict_insert(dict, g_strdup("FolderOpen"),
+ ghb_dict_insert(dict, g_strdup("FolderOpen"),
ghb_boolean_value_new(open));
}
}
static void
init_settings_from_array(
- GValue *dest,
+ GValue *dest,
GValue *internal,
GValue *array)
{
GValue *gval, *val;
gint count, ii;
-
+
count = ghb_array_len(array);
- // The first element of the internal version is always the
+ // The first element of the internal version is always the
// template for the allowed values
gval = ghb_array_get_nth(internal, 0);
for (ii = 0; ii < count; ii++)
static void
init_settings_from_dict(
- GValue *dest,
+ GValue *dest,
GValue *internal,
GValue *dict)
{
init_settings_from_array(new_array, gval, val);
else
init_settings_from_array(new_array, gval, gval);
-
+
}
else
{
void
init_ui_from_dict(
- signal_user_data_t *ud,
+ signal_user_data_t *ud,
GValue *internal,
GValue *dict)
{
GHashTableIter iter;
gchar *key;
GValue *gval, *val;
-
- ghb_dict_iter_init(&iter, internal);
+ GValue *tmp = ghb_value_dup(internal);
+
+ ghb_dict_iter_init(&iter, tmp);
// middle (void*) cast prevents gcc warning "defreferencing type-punned
// pointer will break strict-aliasing rules"
while (g_hash_table_iter_next(
&iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval))
{
if (!strcmp(key, "x264Option"))
+ {
continue;
+ }
val = NULL;
if (dict)
val = ghb_dict_lookup(dict, key);
val = gval;
ghb_ui_update(ud, key, val);
}
+ ghb_value_free(tmp);
+
+ if (dict == NULL)
+ dict = internal;
if (ghb_value_boolean(preset_dict_get_value(dict, "x264UseAdvancedOptions")))
}
}
-static void
-preset_to_ui(signal_user_data_t *ud, GValue *dict)
+void
+ghb_preset_to_settings(GValue *settings, GValue *preset)
{
- g_debug("preset_to_ui()\n");
// Initialize the ui from presets file.
GValue *internal, *hidden;
internal = plist_get_dict(internalPlist, "Presets");
hidden = plist_get_dict(internalPlist, "XlatPresets");
// Setting a ui widget will cause the corresponding setting
- // to be set, but it also triggers a callback that can
+ // to be set, but it also triggers a callback that can
// have the side effect of using other settings values
// that have not yet been set. So set *all* settings first
// then update the ui.
- init_settings_from_dict(ud->settings, internal, dict);
- init_settings_from_dict(ud->settings, hidden, dict);
- init_ui_from_dict(ud, internal, dict);
- init_ui_from_dict(ud, hidden, dict);
+ init_settings_from_dict(settings, internal, preset);
+ init_settings_from_dict(settings, hidden, preset);
- if (dict != NULL)
- {
- GValue *val;
- gboolean dd;
+ if (preset == NULL)
+ preset = internal;
- val = ghb_dict_lookup(dict, "PictureDecombDeinterlace");
- if (val != NULL)
- {
- dd = ghb_value_boolean(val);
- ghb_ui_update(ud, "PictureDeinterlaceDecomb", ghb_boolean_value(!dd));
- }
- val = ghb_dict_lookup(dict, "PictureHeight");
- if (val != NULL)
- {
- ghb_ui_update(ud, "scale_height", val);
- }
- val = ghb_dict_lookup(dict, "PictureWidth");
- if (val != NULL)
- {
- ghb_ui_update(ud, "scale_width", val);
- }
+ GValue *val;
+ gboolean dd;
+
+ val = ghb_dict_lookup(preset, "PictureDecombDeinterlace");
+ if (val != NULL)
+ {
+ dd = ghb_value_boolean(val);
+ ghb_settings_set_boolean(settings, "PictureDeinterlaceDecomb", !dd);
+ }
+ val = ghb_dict_lookup(preset, "PictureHeight");
+ if (val != NULL)
+ {
+ ghb_settings_set_value(settings, "scale_height", val);
+ }
+ val = ghb_dict_lookup(preset, "PictureWidth");
+ if (val != NULL)
+ {
+ ghb_settings_set_value(settings, "scale_width", val);
}
+ ghb_settings_set_boolean(settings, "preset_modified", FALSE);
}
void
ghb_settings_to_ui(signal_user_data_t *ud, GValue *dict)
{
- init_ui_from_dict(ud, dict, dict);
+ init_ui_from_dict(ud, dict, NULL);
}
static GValue *current_preset = NULL;
}
void
-ghb_set_preset_from_indices(signal_user_data_t *ud, gint *indices, gint len)
+ghb_set_preset_settings_from_indices(
+ signal_user_data_t *ud,
+ gint *indices,
+ gint len)
{
GValue *dict = NULL;
gint fallback[2] = {0, -1};
}
if (dict == NULL)
{
- preset_to_ui(ud, NULL);
+ ghb_preset_to_settings(ud->settings, NULL);
current_preset = NULL;
}
else
current_preset = dict;
folder = ghb_value_boolean(preset_dict_get_value(dict, "Folder"));
if (folder)
- preset_to_ui(ud, NULL);
+ ghb_preset_to_settings(ud->settings, NULL);
else
- preset_to_ui(ud, dict);
+ ghb_preset_to_settings(ud->settings, dict);
path = preset_path_from_indices(presetsPlist, indices, len);
ghb_settings_set_value(ud->settings, "preset", path);
ghb_value_free(path);
void
ghb_update_from_preset(
- signal_user_data_t *ud,
+ signal_user_data_t *ud,
const gchar *key)
{
const GValue *gval;
-
+
g_debug("ghb_update_from_preset() %s", key);
gval = curr_preset_get_value(key);
if (gval != NULL)
static void
ghb_select_preset2(
- GtkBuilder *builder,
- gint *indices,
+ GtkBuilder *builder,
+ gint *indices,
gint len)
{
GtkTreeView *treeview;
GtkTreeModel *store;
GtkTreeIter iter;
GtkTreePath *path;
-
+
g_debug("ghb_select_preset2()");
treeview = GTK_TREE_VIEW(GHB_WIDGET(builder, "presets_list"));
selection = gtk_tree_view_get_selection (treeview);
static gboolean prefs_initializing = FALSE;
void
-ghb_prefs_to_ui(signal_user_data_t *ud)
+ghb_globals_to_ui(signal_user_data_t *ud)
{
const GValue *gval;
gchar *key;
- gchar *str;
- GValue *internal, *dict;
+ GValue *internal;
GHashTableIter iter;
-
- g_debug("ghb_prefs_to_ui");
- prefs_initializing = TRUE;
-
- // Setting a ui widget will cause the corresponding setting
- // to be set, but it also triggers a callback that can
- // have the side effect of using other settings values
- // that have not yet been set. So set *all* settings first
- // then update the ui.
internal = plist_get_dict(internalPlist, "Initialization");
ghb_dict_iter_init(&iter, internal);
// middle (void*) cast prevents gcc warning "defreferencing type-punned
while (g_hash_table_iter_next(
&iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval))
{
- ghb_ui_update(ud, key, gval);
+ ghb_ui_settings_update(ud, ud->settings, key, gval);
+ }
+
+ internal = plist_get_dict(internalPlist, "Globals");
+ ghb_dict_iter_init(&iter, internal);
+ // middle (void*) cast prevents gcc warning "defreferencing type-punned
+ // pointer will break strict-aliasing rules"
+ while (g_hash_table_iter_next(
+ &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval))
+ {
+ ghb_ui_settings_update(ud, ud->globals, key, gval);
}
+}
+void
+ghb_prefs_to_ui(signal_user_data_t *ud)
+{
+ const GValue *gval;
+ gchar *key;
+ GValue *internal, *dict;
+ GHashTableIter iter;
+
+
+ g_debug("ghb_prefs_to_ui");
+ prefs_initializing = TRUE;
+
+ // Setting a ui widget will cause the corresponding setting
+ // to be set, but it also triggers a callback that can
+ // have the side effect of using other settings values
+ // that have not yet been set. So set *all* settings first
+ // then update the ui.
dict = plist_get_dict(prefsPlist, "Preferences");
internal = plist_get_dict(internalPlist, "Preferences");
ghb_dict_iter_init(&iter, internal);
value = ghb_dict_lookup(dict, key);
if (value == NULL)
value = gval;
- ghb_settings_set_value(ud->settings, key, value);
+ ghb_settings_set_value(ud->prefs, key, value);
}
internal = plist_get_dict(internalPlist, "Preferences");
ghb_dict_iter_init(&iter, internal);
value = ghb_dict_lookup(dict, key);
if (value == NULL)
value = gval;
- ghb_ui_update(ud, key, value);
+ ghb_ui_settings_update(ud, ud->prefs, key, value);
}
+#if 0
const GValue *val;
- val = ghb_settings_get_value(ud->settings, "show_presets");
- ghb_ui_update(ud, "show_presets", val);
- if (ghb_settings_get_boolean(ud->settings, "hbfd_feature"))
+ val = ghb_settings_get_value(ud->prefs, "show_presets");
+ ghb_ui_settings_update(ud, ud->prefs, "show_presets", val);
+#endif
+ if (ghb_settings_get_boolean(ud->prefs, "hbfd_feature"))
{
GtkWidget *widget;
+#if 0
val = ghb_settings_get_value(ud->settings, "hbfd");
- ghb_ui_update(ud, "hbfd", val);
+ ghb_ui_settings_update(ud, ud->prefs, "hbfd", val);
+#endif
widget = GHB_WIDGET (ud->builder, "hbfd");
gtk_widget_set_visible(widget, TRUE);
}
else
{
- ghb_ui_update(ud, "hbfd", ghb_int64_value(0));
+ ghb_ui_settings_update(ud, ud->prefs, "hbfd", ghb_int64_value(0));
}
- gval = ghb_settings_get_value(ud->settings, "default_source");
- ghb_settings_set_value (ud->settings, "scan_source", gval);
+ gval = ghb_settings_get_value(ud->prefs, "default_source");
+ ghb_settings_set_value(ud->globals, "scan_source", gval);
- str = ghb_settings_get_string(ud->settings, "destination_dir");
- ghb_ui_update(ud, "dest_dir", ghb_string_value(str));
-
- gchar *file = g_strdup_printf ("new_video.mp4");
- ghb_ui_update(ud, "dest_file", ghb_string_value(file));
- g_free(str);
- g_free(file);
+ ghb_ui_settings_update(ud, ud->settings, "dest_dir",
+ ghb_settings_get_value(ud->prefs, "destination_dir"));
prefs_initializing = FALSE;
}
GHashTableIter iter;
gchar *key;
const GValue *value;
-
+
if (prefs_initializing) return;
dict = plist_get_dict(internalPlist, "Preferences");
if (dict == NULL) return;
}
void
-ghb_pref_set(GValue *settings, const gchar *key)
+ghb_pref_save(GValue *settings, const gchar *key)
{
const GValue *value, *value2;
-
+
if (prefs_initializing) return;
value = ghb_settings_get_value(settings, key);
if (value != NULL)
{
ghb_dict_insert(dict, g_strdup(key), ghb_value_dup(value));
store_prefs();
- prefs_modified = TRUE;
+ prefs_modified = FALSE;
}
}
}
void
-ghb_pref_save(GValue *settings, const gchar *key)
+ghb_pref_set(GValue *settings, const gchar *key)
{
const GValue *value, *value2;
-
+
if (prefs_initializing) return;
value = ghb_settings_get_value(settings, key);
if (value != NULL)
if (ghb_value_cmp(value, value2) != 0)
{
ghb_dict_insert(dict, g_strdup(key), ghb_value_dup(value));
- store_prefs();
- prefs_modified = FALSE;
+ prefs_modified = TRUE;
}
}
}
}
void
-ghb_settings_init(signal_user_data_t *ud)
+ghb_settings_init(GValue *settings, const char *name)
{
GValue *internal;
GHashTableIter iter;
gchar *key;
GValue *gval;
-
g_debug("ghb_settings_init");
- prefs_initializing = TRUE;
-
internalPlist = ghb_resource_get("internal-defaults");
// Setting a ui widget will cause the corresponding setting
- // to be set, but it also triggers a callback that can
+ // to be set, but it also triggers a callback that can
// have the side effect of using other settings values
// that have not yet been set. So set *all* settings first
// then update the ui.
- internal = plist_get_dict(internalPlist, "Initialization");
- ghb_dict_iter_init(&iter, internal);
- // middle (void*) cast prevents gcc warning "defreferencing type-punned
- // pointer will break strict-aliasing rules"
- while (g_hash_table_iter_next(
- &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval))
- {
- ghb_settings_set_value(ud->settings, key, gval);
- }
-
- internal = plist_get_dict(internalPlist, "Presets");
- ghb_dict_iter_init(&iter, internal);
- // middle (void*) cast prevents gcc warning "defreferencing type-punned
- // pointer will break strict-aliasing rules"
- while (g_hash_table_iter_next(
- &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval))
- {
- ghb_settings_set_value(ud->settings, key, gval);
- }
-
- internal = plist_get_dict(internalPlist, "Preferences");
+ internal = plist_get_dict(internalPlist, name);
ghb_dict_iter_init(&iter, internal);
// middle (void*) cast prevents gcc warning "defreferencing type-punned
// pointer will break strict-aliasing rules"
while (g_hash_table_iter_next(
&iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval))
{
- ghb_settings_set_value(ud->settings, key, gval);
+ ghb_settings_set_value(settings, key, gval);
}
- prefs_initializing = FALSE;
}
void
GHashTableIter iter;
gchar *key;
GValue *gval;
-
+
g_debug("ghb_prefs_load");
prefsPlist = load_plist("preferences");
if (prefsPlist == NULL)
dict = ghb_dict_value_new();
ghb_dict_insert(prefsPlist, g_strdup("Preferences"), dict);
- // Get defaults from internal defaults
+ // Get defaults from internal defaults
ghb_dict_iter_init(&iter, internal);
// middle (void*) cast prevents gcc warning "defreferencing type-punned
// pointer will break strict-aliasing rules"
{
dir = ".";
}
- ghb_dict_insert(dict,
+ ghb_dict_insert(dict,
g_strdup("ExportDirectory"), ghb_value_dup(ghb_string_value(dir)));
dir = g_get_user_special_dir (G_USER_DIRECTORY_VIDEOS);
{
dir = ".";
}
- ghb_dict_insert(dict,
+ ghb_dict_insert(dict,
g_strdup("destination_dir"), ghb_value_dup(ghb_string_value(dir)));
- ghb_dict_insert(dict,
+ ghb_dict_insert(dict,
g_strdup("SrtDir"), ghb_value_dup(ghb_string_value(dir)));
#if defined(_WIN32)
gchar *source;
{
source = g_strdup("C:" G_DIR_SEPARATOR_S);
}
- ghb_dict_insert(dict, g_strdup("default_source"),
+ ghb_dict_insert(dict, g_strdup("default_source"),
ghb_value_dup(ghb_string_value(source)));
g_free(source);
#endif
void
ghb_presets_list_init(
- signal_user_data_t *ud,
+ signal_user_data_t *ud,
gint *indices,
gint len)
{
GtkTreeView *treeview;
GtkTreeIter iter, titer, *piter;
-
+
GtkTreeStore *store;
const gchar *preset;
GtkTreePath *parent_path;
GValue *dict;
gint *more_indices;
GValue *presets = NULL;
-
+
g_debug("ghb_presets_list_init ()");
more_indices = g_malloc((len+1)*sizeof(gint));
memcpy(more_indices, indices, len*sizeof(gint));
type = ghb_preset_type(dict);
folder = ghb_preset_folder(dict);
color = get_preset_color(type, folder);
- gtk_tree_store_set(store, &iter, 0, preset,
- 1, def ? 800 : 400,
+ gtk_tree_store_set(store, &iter, 0, preset,
+ 1, def ? 800 : 400,
2, def ? 2 : 0,
- 3, color,
+ 3, color,
4, description,
5, type == PRESETS_BUILTIN ? 0 : 1,
-1);
static void
presets_list_update_item(
- signal_user_data_t *ud,
+ signal_user_data_t *ud,
gint *indices,
gint len,
gboolean recurse)
gboolean def, folder;
GValue *dict;
const gchar *color;
-
+
g_debug("presets_list_update_item ()");
dict = presets_get_dict(presetsPlist, indices, len);
if (dict == NULL)
type = ghb_preset_type(dict);
folder = ghb_preset_folder(dict);
color = get_preset_color(type, folder);
- gtk_tree_store_set(store, &iter, 0, name,
- 1, def ? 800 : 400,
+ gtk_tree_store_set(store, &iter, 0, name,
+ 1, def ? 800 : 400,
2, def ? 2 : 0,
3, color,
4, description,
static void
presets_list_insert(
- signal_user_data_t *ud,
+ signal_user_data_t *ud,
gint *indices,
gint len)
{
GtkTreePath *parent_path;
GValue *dict;
const gchar *color;
-
+
g_debug("presets_list_insert ()");
treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
type = ghb_preset_type(dict);
folder = ghb_preset_folder(dict);
color = get_preset_color(type, folder);
- gtk_tree_store_set(store, &iter, 0, preset,
- 1, def ? 800 : 400,
+ gtk_tree_store_set(store, &iter, 0, preset,
+ 1, def ? 800 : 400,
2, def ? 2 : 0,
3, color,
4, description,
static void
presets_list_remove(
- signal_user_data_t *ud,
+ signal_user_data_t *ud,
gint *indices,
gint len)
{
GtkTreePath *treepath;
GtkTreeIter iter;
GtkTreeStore *store;
-
+
g_debug("presets_list_remove ()");
treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
static GValue*
import_value_xlat2(
- GValue *defaults,
+ GValue *defaults,
value_map_t *value_map,
- const gchar *key,
+ const gchar *key,
GValue *mac_val)
{
GValue *gval, *def_val;
drc = ghb_value_double(mac_val);
if (drc < 1.0 && drc > 0.0)
{
- ghb_dict_insert(adict, g_strdup("AudioTrackDRCSlider"),
+ ghb_dict_insert(adict, g_strdup("AudioTrackDRCSlider"),
ghb_double_value_new(0.0));
}
}
if (uses_max || uses_pic == 2)
{
- ghb_dict_insert(dict, g_strdup("autoscale"),
+ ghb_dict_insert(dict, g_strdup("autoscale"),
ghb_boolean_value_new(TRUE));
}
switch (par)
case 0:
{
if (ghb_dict_lookup(dict, "PictureModulus") == NULL)
- ghb_dict_insert(dict, g_strdup("PictureModulus"),
+ ghb_dict_insert(dict, g_strdup("PictureModulus"),
ghb_int_value_new(16));
} break;
case 1:
{
- ghb_dict_insert(dict, g_strdup("PictureModulus"),
+ ghb_dict_insert(dict, g_strdup("PictureModulus"),
ghb_int_value_new(1));
} break;
case 2:
{
if (ghb_dict_lookup(dict, "PictureModulus") == NULL)
- ghb_dict_insert(dict, g_strdup("PictureModulus"),
+ ghb_dict_insert(dict, g_strdup("PictureModulus"),
ghb_int_value_new(16));
} break;
default:
{
if (ghb_dict_lookup(dict, "PictureModulus") == NULL)
- ghb_dict_insert(dict, g_strdup("PictureModulus"),
+ ghb_dict_insert(dict, g_strdup("PictureModulus"),
ghb_int_value_new(16));
} break;
}
{
case 0:
{
- ghb_dict_insert(dict, g_strdup("vquality_type_bitrate"),
+ ghb_dict_insert(dict, g_strdup("vquality_type_bitrate"),
ghb_boolean_value_new(TRUE));
- ghb_dict_insert(dict, g_strdup("vquality_type_constant"),
+ ghb_dict_insert(dict, g_strdup("vquality_type_constant"),
ghb_boolean_value_new(FALSE));
} break;
case 1:
{
- ghb_dict_insert(dict, g_strdup("vquality_type_bitrate"),
+ ghb_dict_insert(dict, g_strdup("vquality_type_bitrate"),
ghb_boolean_value_new(TRUE));
- ghb_dict_insert(dict, g_strdup("vquality_type_constant"),
+ ghb_dict_insert(dict, g_strdup("vquality_type_constant"),
ghb_boolean_value_new(FALSE));
} break;
case 2:
{
- ghb_dict_insert(dict, g_strdup("vquality_type_bitrate"),
+ ghb_dict_insert(dict, g_strdup("vquality_type_bitrate"),
ghb_boolean_value_new(FALSE));
- ghb_dict_insert(dict, g_strdup("vquality_type_constant"),
+ ghb_dict_insert(dict, g_strdup("vquality_type_constant"),
ghb_boolean_value_new(TRUE));
} break;
default:
{
- ghb_dict_insert(dict, g_strdup("vquality_type_bitrate"),
+ ghb_dict_insert(dict, g_strdup("vquality_type_bitrate"),
ghb_boolean_value_new(FALSE));
- ghb_dict_insert(dict, g_strdup("vquality_type_constant"),
+ ghb_dict_insert(dict, g_strdup("vquality_type_constant"),
ghb_boolean_value_new(TRUE));
} break;
}
GValue *val = ghb_dict_lookup(prefs, "AddCC");
if (val != NULL)
{
- ghb_dict_insert(dict, g_strdup("SubtitleAddCC"),
+ ghb_dict_insert(dict, g_strdup("SubtitleAddCC"),
ghb_value_dup(val));
}
}
str = ghb_value_string(fr);
if (strcmp(str, "source") == 0)
{
- ghb_dict_insert(dict, g_strdup("VideoFramerateCFR"),
+ ghb_dict_insert(dict, g_strdup("VideoFramerateCFR"),
ghb_boolean_value_new(FALSE));
- ghb_dict_insert(dict, g_strdup("VideoFramerateVFR"),
+ ghb_dict_insert(dict, g_strdup("VideoFramerateVFR"),
ghb_boolean_value_new(TRUE));
}
else if (!pfr)
{
- ghb_dict_insert(dict, g_strdup("VideoFramerateCFR"),
+ ghb_dict_insert(dict, g_strdup("VideoFramerateCFR"),
ghb_boolean_value_new(TRUE));
- ghb_dict_insert(dict, g_strdup("VideoFramerateVFR"),
+ ghb_dict_insert(dict, g_strdup("VideoFramerateVFR"),
ghb_boolean_value_new(FALSE));
}
else
{
- ghb_dict_insert(dict, g_strdup("VideoFramerateCFR"),
+ ghb_dict_insert(dict, g_strdup("VideoFramerateCFR"),
ghb_boolean_value_new(FALSE));
- ghb_dict_insert(dict, g_strdup("VideoFramerateVFR"),
+ ghb_dict_insert(dict, g_strdup("VideoFramerateVFR"),
ghb_boolean_value_new(FALSE));
}
g_free(str);
str = ghb_value_string(mode);
if (strcmp(str, "cfr") == 0)
{
- ghb_dict_insert(dict, g_strdup("VideoFramerateCFR"),
+ ghb_dict_insert(dict, g_strdup("VideoFramerateCFR"),
ghb_boolean_value_new(TRUE));
- ghb_dict_insert(dict, g_strdup("VideoFrameratePFR"),
+ ghb_dict_insert(dict, g_strdup("VideoFrameratePFR"),
ghb_boolean_value_new(FALSE));
- ghb_dict_insert(dict, g_strdup("VideoFramerateVFR"),
+ ghb_dict_insert(dict, g_strdup("VideoFramerateVFR"),
ghb_boolean_value_new(FALSE));
}
else if (strcmp(str, "pfr") == 0)
{
- ghb_dict_insert(dict, g_strdup("VideoFramerateCFR"),
+ ghb_dict_insert(dict, g_strdup("VideoFramerateCFR"),
ghb_boolean_value_new(FALSE));
- ghb_dict_insert(dict, g_strdup("VideoFrameratePFR"),
+ ghb_dict_insert(dict, g_strdup("VideoFrameratePFR"),
ghb_boolean_value_new(TRUE));
- ghb_dict_insert(dict, g_strdup("VideoFramerateVFR"),
+ ghb_dict_insert(dict, g_strdup("VideoFramerateVFR"),
ghb_boolean_value_new(FALSE));
}
else
{
- ghb_dict_insert(dict, g_strdup("VideoFramerateCFR"),
+ ghb_dict_insert(dict, g_strdup("VideoFramerateCFR"),
ghb_boolean_value_new(FALSE));
- ghb_dict_insert(dict, g_strdup("VideoFrameratePFR"),
+ ghb_dict_insert(dict, g_strdup("VideoFrameratePFR"),
ghb_boolean_value_new(FALSE));
- ghb_dict_insert(dict, g_strdup("VideoFramerateVFR"),
+ ghb_dict_insert(dict, g_strdup("VideoFramerateVFR"),
ghb_boolean_value_new(TRUE));
}
g_free(str);
preset_dict_get_value(dict, "vquality_type_constant"));
if (autoscale)
- ghb_dict_insert(dict, g_strdup("UsesPictureSettings"),
+ ghb_dict_insert(dict, g_strdup("UsesPictureSettings"),
ghb_int_value_new(2));
else
- ghb_dict_insert(dict, g_strdup("UsesPictureSettings"),
+ ghb_dict_insert(dict, g_strdup("UsesPictureSettings"),
ghb_int_value_new(1));
// VideoQualityType/0/1/2 - vquality_type_/target/bitrate/constant
// *note: target is no longer used
if (br)
{
- ghb_dict_insert(dict, g_strdup("VideoQualityType"),
+ ghb_dict_insert(dict, g_strdup("VideoQualityType"),
ghb_int_value_new(1));
}
else if (constant)
{
- ghb_dict_insert(dict, g_strdup("VideoQualityType"),
+ ghb_dict_insert(dict, g_strdup("VideoQualityType"),
ghb_int_value_new(2));
}
if (ghb_value_boolean(preset_dict_get_value(dict, "VideoFramerateCFR")))
{
- ghb_dict_insert(dict, g_strdup("VideoFramerateMode"),
+ ghb_dict_insert(dict, g_strdup("VideoFramerateMode"),
ghb_string_value_new("cfr"));
}
else if (ghb_value_boolean(preset_dict_get_value(dict, "VideoFrameratePFR")))
{
- ghb_dict_insert(dict, g_strdup("VideoFramerateMode"),
+ ghb_dict_insert(dict, g_strdup("VideoFramerateMode"),
ghb_string_value_new("pfr"));
}
else
{
- ghb_dict_insert(dict, g_strdup("VideoFramerateMode"),
+ ghb_dict_insert(dict, g_strdup("VideoFramerateMode"),
ghb_string_value_new("vfr"));
}
preset_dict_get_value(adict, "AudioTrackDRCSlider"));
if (drc < 1.0 && drc > 0.0)
{
- ghb_dict_insert(adict, g_strdup("AudioTrackDRCSlider"),
+ ghb_dict_insert(adict, g_strdup("AudioTrackDRCSlider"),
ghb_double_value_new(0.0));
}
}
g_string_append_printf(str, ",%s", "zerolatency");
}
tunes = g_string_free(str, FALSE);
- ghb_dict_insert(dict, g_strdup("x264Tune"),
+ ghb_dict_insert(dict, g_strdup("x264Tune"),
ghb_string_value_new(tunes));
g_free(tunes);
std_dict = ghb_array_get_nth(std_presets, ii);
copy_dict = ghb_value_dup(std_dict);
- ghb_dict_insert(copy_dict, g_strdup("PresetBuildNumber"),
+ ghb_dict_insert(copy_dict, g_strdup("PresetBuildNumber"),
ghb_int64_value_new(hb_get_build(NULL)));
ghb_presets_insert(presetsPlist, copy_dict, &indices, 1);
presets_list_insert(ud, &indices, 1);
std_dict = ghb_array_get_nth(std_presets, ii);
copy_dict = ghb_value_dup(std_dict);
- ghb_dict_insert(copy_dict, g_strdup("PresetBuildNumber"),
+ ghb_dict_insert(copy_dict, g_strdup("PresetBuildNumber"),
ghb_int64_value_new(hb_get_build(NULL)));
ghb_presets_insert(presetsPlist, copy_dict, &indices, 1);
}
replace_standard_presets();
return 1;
}
-
+
type = ghb_value_int(gval);
if (type == 0)
{
if (!update_standard_presets(ud))
import_xlat_presets(presetsPlist);
}
-
+
}
static void
if (replace)
{
def_indices = presets_find_default(presetsPlist, &def_len);
- if (def_indices != NULL &&
+ if (def_indices != NULL &&
preset_path_cmp(indices, len, def_indices, def_len) != 0)
{
- ghb_dict_insert(dict, g_strdup("Default"),
+ ghb_dict_insert(dict, g_strdup("Default"),
ghb_boolean_value_new(FALSE));
}
presets_list_update_item(ud, indices, len, FALSE);
}
else
{
- ghb_dict_insert(dict, g_strdup("Default"),
+ ghb_dict_insert(dict, g_strdup("Default"),
ghb_boolean_value_new(FALSE));
presets_list_insert(ud, indices, len);
}
{
ghb_dict_remove(dict, "PictureHeight");
}
- ghb_dict_insert(dict, g_strdup("autoscale"),
+ ghb_dict_insert(dict, g_strdup("autoscale"),
ghb_boolean_value_new(
!ghb_settings_get_boolean( ud->settings, "PictureWidthEnable") &&
!ghb_settings_get_boolean( ud->settings, "PictureHeightEnable")
}
// Already exists, update its description
dict = presets_get_dict(presetsPlist, indices, len);
- ghb_dict_insert(dict, g_strdup("PresetDescription"),
+ ghb_dict_insert(dict, g_strdup("PresetDescription"),
ghb_value_dup(preset_dict_get_value(
ud->settings, "PresetDescription")));
presets_list_update_item(ud, indices, len, FALSE);
return;
}
}
- ghb_dict_insert(dict, g_strdup("PresetDescription"),
+ ghb_dict_insert(dict, g_strdup("PresetDescription"),
ghb_value_dup(preset_dict_get_value(
ud->settings, "PresetDescription")));
ghb_dict_insert(dict, g_strdup("PresetName"), ghb_string_value_new(name));
}
void
-ghb_presets_list_default(signal_user_data_t *ud)
+ghb_presets_list_show_default(signal_user_data_t *ud)
{
GtkTreeView *treeview;
GtkTreePath *treepath;
GtkTreeIter iter;
GtkTreeStore *store;
gint *indices, len;
-
- g_debug("ghb_presets_list_default ()");
+
+ g_debug("ghb_presets_list_show_default()");
treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
indices = presets_find_default(presetsPlist, &len);
{
if (gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, treepath))
{
- gtk_tree_store_set(store, &iter,
- 1, 800,
+ gtk_tree_store_set(store, &iter,
+ 1, 800,
2, 2 ,
-1);
}
GtkTreeIter iter;
GtkTreeStore *store;
gint *indices, len;
-
+
g_debug("ghb_presets_list_clear_default ()");
treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
{
if (gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, treepath))
{
- gtk_tree_store_set(store, &iter,
- 1, 400,
+ gtk_tree_store_set(store, &iter,
+ 1, 400,
2, 0 ,
-1);
}
GtkMenu *menu;
menu = GTK_MENU(GHB_WIDGET(ud->builder, "presets_menu"));
- gtk_menu_popup(menu, NULL, NULL, NULL, NULL, 1,
+ gtk_menu_popup(menu, NULL, NULL, NULL, NULL, 1,
gtk_get_current_event_time());
}
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter);
gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(dialog), filter);
- exportDir = ghb_settings_get_string(ud->settings, "ExportDirectory");
+ exportDir = ghb_settings_get_string(ud->prefs, "ExportDirectory");
if (exportDir == NULL || exportDir[0] == '\0')
{
exportDir = g_strdup(".");
}
ghb_value_free(array);
- exportDir = ghb_settings_get_string(ud->settings, "ExportDirectory");
+ exportDir = ghb_settings_get_string(ud->prefs, "ExportDirectory");
dir = g_path_get_dirname(filename);
if (strcmp(dir, exportDir) != 0)
{
- ghb_settings_set_string(ud->settings, "ExportDirectory", dir);
- ghb_pref_save(ud->settings, "ExportDirectory");
+ ghb_settings_set_string(ud->prefs, "ExportDirectory", dir);
+ ghb_pref_save(ud->prefs, "ExportDirectory");
}
g_free(filename);
g_free(exportDir);
GHB_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
NULL);
- exportDir = ghb_settings_get_string(ud->settings, "ExportDirectory");
+ exportDir = ghb_settings_get_string(ud->prefs, "ExportDirectory");
if (exportDir == NULL || exportDir[0] == '\0')
{
exportDir = g_strdup(".");
}
ghb_value_free(array);
- exportDir = ghb_settings_get_string(ud->settings, "ExportDirectory");
+ exportDir = ghb_settings_get_string(ud->prefs, "ExportDirectory");
dir = g_path_get_dirname(filename);
if (strcmp(dir, exportDir) != 0)
{
- ghb_settings_set_string(ud->settings, "ExportDirectory", dir);
- ghb_pref_save(ud->settings, "ExportDirectory");
+ ghb_settings_set_string(ud->prefs, "ExportDirectory", dir);
+ ghb_pref_save(ud->prefs, "ExportDirectory");
}
g_free(exportDir);
g_free(dir);
gint count, *indices, len;
g_debug("presets_new_folder_clicked_cb ()");
- preset = ghb_settings_get_value (ud->settings, "preset_selection");
+ preset = ghb_settings_get_value(ud->settings, "preset_selection");
count = ghb_array_len(preset);
if (count > 0)
gint count, *indices, len;
g_debug("presets_save_clicked_cb ()");
- preset = ghb_settings_get_value (ud->settings, "preset_selection");
+ preset = ghb_settings_get_value(ud->settings, "preset_selection");
count = ghb_array_len(preset);
if (count > 0)
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");
- ghb_ui_update(ud, "PictureWidthEnable",
+ ghb_ui_update(ud, "PictureWidthEnable",
ghb_boolean_value(width!=0&&!autoscale));
- ghb_ui_update(ud, "PictureHeightEnable",
+ ghb_ui_update(ud, "PictureHeightEnable",
ghb_boolean_value(height!=0&&!autoscale));
if (!width)
{
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_settings_get_value(ud->settings, "preset");
ghb_select_preset(ud->builder, preset);
}
folder = ghb_presets_get_folder(presetsPlist, indices, len);
dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
- "Confirm deletion of %s:\n\n%s",
+ "Confirm deletion of %s:\n\n%s",
folder ? "folder" : "preset",
preset);
response = gtk_dialog_run(GTK_DIALOG(dialog));
// Only allow *drop into* for folders
if (!dst_folder)
- {
+ {
if (drop_pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE)
drop_pos = GTK_TREE_VIEW_DROP_BEFORE;
if (drop_pos == GTK_TREE_VIEW_DROP_INTO_OR_AFTER)
return TRUE;
}
-G_MODULE_EXPORT void
+G_MODULE_EXPORT void
presets_drag_cb(
- GtkTreeView *dstwidget,
- GdkDragContext *dc,
- gint x, gint y,
- GtkSelectionData *selection_data,
- guint info, guint t,
+ GtkTreeView *dstwidget,
+ GdkDragContext *dc,
+ gint x, gint y,
+ GtkSelectionData *selection_data,
+ guint info, guint t,
signal_user_data_t *ud)
{
GtkTreePath *path = NULL;
gint *dst_indices, dst_len, *src_indices, src_len;
gint src_ptype;
gboolean src_folder, dst_folder;
-
+
GtkTreeModel *dstmodel = gtk_tree_view_get_model(dstwidget);
-
+
g_debug("preset_drag_cb ()");
// This doesn't work here for some reason...
// gtk_tree_view_get_drag_dest_row(dstwidget, &path, &drop_pos);
dst_folder = ghb_presets_get_folder(presetsPlist, dst_indices, dst_len);
// Only allow *drop into* for folders
if (!dst_folder)
- {
+ {
if (drop_pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE)
drop_pos = GTK_TREE_VIEW_DROP_BEFORE;
if (drop_pos == GTK_TREE_VIEW_DROP_INTO_OR_AFTER)
switch (drop_pos)
{
case GTK_TREE_VIEW_DROP_BEFORE:
- gtk_tree_store_insert_before(GTK_TREE_STORE (dstmodel),
+ gtk_tree_store_insert_before(GTK_TREE_STORE (dstmodel),
&iter, NULL, &dstiter);
break;
case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
- gtk_tree_store_insert(GTK_TREE_STORE (dstmodel),
+ gtk_tree_store_insert(GTK_TREE_STORE (dstmodel),
&iter, &dstiter, 0);
break;
case GTK_TREE_VIEW_DROP_AFTER:
- gtk_tree_store_insert_after(GTK_TREE_STORE (dstmodel),
+ gtk_tree_store_insert_after(GTK_TREE_STORE (dstmodel),
&iter, NULL, &dstiter);
break;
case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
- gtk_tree_store_insert_after(GTK_TREE_STORE (dstmodel),
+ gtk_tree_store_insert_after(GTK_TREE_STORE (dstmodel),
&iter, &dstiter, 0);
break;
void
presets_row_expanded_cb(
- GtkTreeView *treeview,
- GtkTreeIter *iter,
- GtkTreePath *path,
+ GtkTreeView *treeview,
+ GtkTreeIter *iter,
+ GtkTreePath *path,
signal_user_data_t *ud)
{
gint *indices, len;
store_presets();
}
-static void
-preset_update_title_deps(signal_user_data_t *ud, hb_title_t *title)
+GValue*
+ghb_get_current_preset(signal_user_data_t *ud)
{
- GtkWidget *widget;
+ GtkTreeView *tv;
+ GtkTreeModel *tm;
+ GtkTreeSelection *ts;
+ GtkTreeIter ti;
+ GValue *preset = NULL;
+
+ tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
+ ts = gtk_tree_view_get_selection(tv);
+ if (gtk_tree_selection_get_selected(ts, &tm, &ti))
+ {
+ GtkTreePath *tp;
+ gint *indices, len;
- ghb_ui_update(ud, "scale_width",
- ghb_int64_value(title->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(ud->settings, "PictureKeepRatio");
- pic_par = ghb_settings_combo_int(ud->settings, "PicturePAR");
- if (!(keep_aspect || pic_par) || pic_par == 3)
- {
- ghb_ui_update(ud, "scale_height",
- ghb_int64_value(title->height - title->crop[0] - title->crop[1]));
- }
-
- // Set the limits of cropping. hb_set_anamorphic_size crashes if
- // you pass it a cropped width or height == 0.
- gint bound;
- bound = title->height / 2 - 2;
- widget = GHB_WIDGET (ud->builder, "PictureTopCrop");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 0, bound);
- widget = GHB_WIDGET (ud->builder, "PictureBottomCrop");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 0, bound);
- bound = title->width / 2 - 2;
- widget = GHB_WIDGET (ud->builder, "PictureLeftCrop");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 0, bound);
- widget = GHB_WIDGET (ud->builder, "PictureRightCrop");
- gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 0, bound);
- if (ghb_settings_get_boolean(ud->settings, "PictureAutoCrop"))
- {
- ghb_ui_update(ud, "PictureTopCrop", ghb_int64_value(title->crop[0]));
- ghb_ui_update(ud, "PictureBottomCrop", ghb_int64_value(title->crop[1]));
- ghb_ui_update(ud, "PictureLeftCrop", ghb_int64_value(title->crop[2]));
- ghb_ui_update(ud, "PictureRightCrop", ghb_int64_value(title->crop[3]));
+ tp = gtk_tree_model_get_path(tm, &ti);
+ indices = gtk_tree_path_get_indices(tp);
+ len = gtk_tree_path_get_depth(tp);
+ preset = presets_get_dict(presetsPlist, indices, len);
}
+ return preset;
}
-void
-ghb_refresh_preset(signal_user_data_t *ud)
+GValue*
+ghb_get_current_preset_path(signal_user_data_t *ud)
{
- GValue *preset;
- gint *indices, len;
+ GtkTreeView *tv;
+ GtkTreeModel *tm;
+ GtkTreeSelection *ts;
+ GtkTreeIter ti;
+ GValue *path = NULL;
- g_debug("ghb_refresh_preset ()");
- preset = ghb_settings_get_value(ud->settings, "preset_selection");
- indices = ghb_preset_indices_from_path(presetsPlist, preset, &len);
- if (indices)
+ tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
+ ts = gtk_tree_view_get_selection(tv);
+ if (gtk_tree_selection_get_selected(ts, &tm, &ti))
{
- gboolean folder;
+ GtkTreePath *tp;
+ gint *indices, len;
- folder = ghb_presets_get_folder(presetsPlist, indices, len);
- if (!folder)
- {
- ud->dont_clear_presets = TRUE;
- ud->scale_busy = TRUE;
- // Temporarily set the video_quality range to (0,100)
- // This is needed so the video_quality value does not get
- // truncated when set. The range will be readjusted below
- GtkWidget *qp = GHB_WIDGET(ud->builder, "VideoQualitySlider");
- gtk_range_set_range (GTK_RANGE(qp), 0, 100);
- gtk_scale_set_digits(GTK_SCALE(qp), 3);
- ghb_set_preset_from_indices(ud, indices, len);
- gint titleindex;
- titleindex = ghb_settings_combo_int(ud->settings, "title");
- ghb_audio_def_settings_init(ud);
- ghb_subtitle_def_settings_init(ud);
- ghb_set_pref_audio_settings(titleindex, ud->settings);
- ghb_set_pref_audio_from_settings(ud, ud->settings);
- ghb_set_pref_subtitle(titleindex, ud);
- ghb_settings_set_boolean(ud->settings, "preset_modified", FALSE);
- hb_title_t * title = ghb_get_title_info(titleindex);
- if (title != NULL)
- {
- preset_update_title_deps(ud, title);
- }
- ud->scale_busy = FALSE;
- ghb_set_scale (ud, GHB_PIC_KEEP_PAR|GHB_PIC_USE_MAX);
- ud->dont_clear_presets = FALSE;
-
- gdouble vqmin, vqmax, step, page;
- gint digits;
- gboolean inverted;
-
- ghb_vquality_range(ud, &vqmin, &vqmax, &step,
- &page, &digits, &inverted);
- gtk_range_set_range (GTK_RANGE(qp), vqmin, vqmax);
- gtk_range_set_increments (GTK_RANGE(qp), step, page);
- gtk_scale_set_digits(GTK_SCALE(qp), digits);
- gtk_range_set_inverted (GTK_RANGE(qp), inverted);
-
- gchar *text;
- gint crop[4];
- GtkWidget *crop_widget;
- 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_widget = GHB_WIDGET (ud->builder, "crop_values");
- text = g_strdup_printf("%d:%d:%d:%d",
- crop[0], crop[1], crop[2], crop[3]);
- gtk_label_set_text (GTK_LABEL(crop_widget), text);
- g_free(text);
- }
+ tp = gtk_tree_model_get_path(tm, &ti);
+ indices = gtk_tree_path_get_indices(tp);
+ len = gtk_tree_path_get_depth(tp);
+ path = preset_path_from_indices(presetsPlist, indices, len);
}
+ return path;
}
G_MODULE_EXPORT void
GtkTreeModel *store;
GtkTreeIter iter;
GtkWidget *widget;
-
+
g_debug("presets_list_selection_changed_cb ()");
widget = GHB_WIDGET (ud->builder, "presets_remove");
if (gtk_tree_selection_get_selected(selection, &store, &iter))
ghb_settings_take_value(ud->settings, "preset_selection", path);
folder = ghb_presets_get_folder(presetsPlist, indices, len);
- if (!folder)
+ if (!folder && !ghb_settings_get_boolean(ud->settings, "preset_reload"))
{
- ud->dont_clear_presets = TRUE;
- ud->scale_busy = TRUE;
- // Temporarily set the video_quality range to (0,100)
- // This is needed so the video_quality value does not get
- // truncated when set. The range will be readjusted below
- GtkWidget *qp = GHB_WIDGET(ud->builder, "VideoQualitySlider");
- gtk_range_set_range (GTK_RANGE(qp), 0, 100);
- gtk_scale_set_digits(GTK_SCALE(qp), 3);
- ghb_set_preset_from_indices(ud, indices, len);
- gint titleindex;
- titleindex = ghb_settings_combo_int(ud->settings, "title");
- ghb_audio_def_settings_init(ud);
- ghb_subtitle_def_settings_init(ud);
- ghb_set_pref_audio_settings(titleindex, ud->settings);
- ghb_set_pref_audio_from_settings(ud, ud->settings);
- ghb_set_pref_subtitle(titleindex, ud);
- ghb_settings_set_boolean(ud->settings, "preset_modified", FALSE);
- hb_title_t * title = ghb_get_title_info(titleindex);
- if (title != NULL)
- {
- preset_update_title_deps(ud, title);
- }
- ud->scale_busy = FALSE;
- ghb_set_scale (ud, GHB_PIC_KEEP_PAR|GHB_PIC_USE_MAX);
- ud->dont_clear_presets = FALSE;
-
- gdouble vqmin, vqmax, step, page;
- gint digits;
- gboolean inverted;
-
- ghb_vquality_range(ud, &vqmin, &vqmax, &step,
- &page, &digits, &inverted);
- gtk_range_set_range (GTK_RANGE(qp), vqmin, vqmax);
- gtk_range_set_increments (GTK_RANGE(qp), step, page);
- gtk_scale_set_digits(GTK_SCALE(qp), digits);
- gtk_range_set_inverted (GTK_RANGE(qp), inverted);
-
- gchar *text;
- gint crop[4];
- GtkWidget *crop_widget;
- 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_widget = GHB_WIDGET (ud->builder, "crop_values");
- text = g_strdup_printf("%d:%d:%d:%d",
- crop[0], crop[1], crop[2], crop[3]);
- gtk_label_set_text (GTK_LABEL(crop_widget), text);
- g_free(text);
+ ghb_set_preset_settings_from_indices(ud, indices, len);
+ ghb_set_current_title_settings(ud);
+ ghb_load_settings(ud);
}
+ ghb_settings_set_boolean(ud->settings, "preset_reload", FALSE);
+
gtk_tree_path_free(treepath);
gtk_widget_set_sensitive(widget, TRUE);
}
g_debug("No selection??? Perhaps unselected.");
gtk_widget_set_sensitive(widget, FALSE);
}
- if (ghb_settings_combo_int(ud->settings, "PtoPType") == 0)
- {
- gint start, end;
- start = ghb_settings_get_int(ud->settings, "start_point");
- end = ghb_settings_get_int(ud->settings, "end_point");
- widget = GHB_WIDGET (ud->builder, "ChapterMarkers");
- gtk_widget_set_sensitive(widget, TRUE);
- if (start == end)
- {
- ud->dont_clear_presets = TRUE;
- ghb_ui_update(ud, "ChapterMarkers", ghb_boolean_value(FALSE));
- ud->dont_clear_presets = FALSE;
- gtk_widget_set_sensitive(widget, FALSE);
- }
- }
}
void
{
GtkTreeView *treeview;
GtkTreeSelection *selection;
-
+
if (ud->dont_clear_presets) return;
g_debug("ghb_clear_presets_selection()");
treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
GtkTreeSelection *selection;
GtkTreeModel *store;
GtkTreeIter iter;
-
+
treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
selection = gtk_tree_view_get_selection(treeview);
if (gtk_tree_selection_get_selected(selection, &store, &iter))
{
ghb_presets_list_clear_default(ud);
presets_set_default(indices, len);
- ghb_presets_list_default(ud);
+ ghb_presets_list_show_default(ud);
}
g_free(indices);
}
G_MODULE_EXPORT void
preset_edited_cb(
- GtkCellRendererText *cell,
- gchar *path,
- gchar *text,
+ GtkCellRendererText *cell,
+ gchar *path,
+ gchar *text,
signal_user_data_t *ud)
{
GtkTreePath *treepath;
gint *indices, len, count;
GValue *dict;
GValue *preset, *dest;
-
+
g_debug("preset_edited_cb ()");
g_debug("path (%s)", path);
g_debug("text (%s)", text);
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
void ghb_settings_save(signal_user_data_t *ud, const gchar *name);
void ghb_presets_load(signal_user_data_t *ud);
void ghb_update_from_preset(signal_user_data_t *ud, const gchar *key);
-void ghb_prefs_load(signal_user_data_t *ud);
-void ghb_settings_init(signal_user_data_t *ud);
+void ghb_settings_init(GValue *settings, const char *name);
void ghb_settings_close();
+void ghb_globals_to_ui(signal_user_data_t *ud);
+void ghb_prefs_load(signal_user_data_t *ud);
void ghb_prefs_to_ui(signal_user_data_t *ud);
void ghb_prefs_save(GValue *settings);
void ghb_pref_save(GValue *settings, const gchar *key);
+void ghb_pref_set(GValue *settings, const gchar *key);
+void ghb_prefs_store(void);
void ghb_save_queue(GValue *queue);
GValue* ghb_load_queue();
GValue* ghb_load_old_queue(int pid);
gchar* ghb_get_user_config_dir(gchar *subdir);
void ghb_settings_to_ui(signal_user_data_t *ud, GValue *dict);
void ghb_clear_presets_selection(signal_user_data_t *ud);
-void ghb_select_preset(GtkBuilder *builder,
- const GValue *preset);
+void ghb_select_preset(GtkBuilder *builder, const GValue *preset);
void ghb_select_default_preset(GtkBuilder *builder);
void ghb_presets_list_init(signal_user_data_t *ud, gint *indices, gint len);
GValue* ghb_parse_preset_path(const gchar *path);
gchar* ghb_preset_path_string(const GValue *path);
gboolean ghb_preset_is_custom(void);
-void ghb_prefs_store(void);
-void ghb_pref_set(GValue *settings, const gchar *key);
gboolean ghb_lock_file(const gchar *name);
-void ghb_refresh_preset(signal_user_data_t *ud);
int ghb_find_pid_file();
void ghb_unlink_pid_file(int pid);
void ghb_write_pid_file();
+GValue* ghb_get_current_preset(signal_user_data_t *ud);
+GValue* ghb_get_current_preset_path(signal_user_data_t *ud);
+void ghb_preset_to_settings(GValue *settings, GValue *preset);
+void dump_preset_path(const gchar *msg, const GValue *path);
#endif // _GHB_PRESETS_H_
/*
* preview.c
* Copyright (C) John Stebbins 2008-2013 <stebbins@stebbins>
- *
+ *
* preview.c is free software.
- *
+ *
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
- *
+ *
*/
#include <unistd.h>
#include <glib.h>
#if defined(_ENABLE_GST)
G_MODULE_EXPORT gboolean live_preview_cb(GstBus *bus, GstMessage *msg, gpointer data);
-static GstBusSyncReply create_window(GstBus *bus, GstMessage *msg,
+static GstBusSyncReply create_window(GstBus *bus, GstMessage *msg,
gpointer data);
#endif
-G_MODULE_EXPORT gboolean preview_expose_cb(GtkWidget *widget, GdkEventExpose *event,
+G_MODULE_EXPORT gboolean preview_expose_cb(GtkWidget *widget, GdkEventExpose *event,
signal_user_data_t *ud);
void
ud->preview->live_id = -1;
widget = GHB_WIDGET (ud->builder, "preview_button_image");
gtk_widget_get_size_request(widget, &ud->preview->button_width, &ud->preview->button_height);
-
+
#if defined(_ENABLE_GST)
GstBus *bus;
GstElement *xover;
{
g_object_set(G_OBJECT(ud->preview->play), "video-sink", xover, NULL);
- g_object_set(ud->preview->play, "subtitle-font-desc",
+ g_object_set(ud->preview->play, "subtitle-font-desc",
"sans bold 20", NULL);
bus = gst_pipeline_get_bus(GST_PIPELINE(ud->preview->play));
else
height = gst_util_uint64_scale_int(width, den, num);
- if (ghb_settings_get_boolean(ud->settings, "reduce_hd_preview"))
+ if (ghb_settings_get_boolean(ud->prefs, "reduce_hd_preview"))
{
GdkScreen *ss;
gint s_w, s_h;
width = gst_util_uint64_scale_int(height, num, den);
}
}
-
+
if (width != ud->preview->width || height != ud->preview->height)
{
gtk_widget_set_size_request(ud->preview->view, width, height);
if (info_arr == NULL)
return NULL;
- for (ii = 0; ii < info_arr->n_values; ++ii)
+ for (ii = 0; ii < info_arr->n_values; ++ii)
{
GObject *info_obj;
GValue *val;
val = g_value_array_get_nth(info_arr, ii);
//val = &((GValue*)info_arr->values)[ii];
info_obj = g_value_get_object(val);
- if (info_obj)
+ if (info_obj)
{
GParamSpec *pspec;
GEnumValue *value;
G_OBJECT_GET_CLASS (info_obj), "type");
value = g_enum_get_value(
G_PARAM_SPEC_ENUM (pspec)->enum_class, type);
- if (value)
+ if (value)
{
if (g_ascii_strcasecmp (value->value_nick, typestr) == 0 ||
- g_ascii_strcasecmp (value->value_name, typestr) == 0)
+ g_ascii_strcasecmp (value->value_name, typestr) == 0)
{
ret = g_list_prepend (ret, g_object_ref (info_obj));
}
ud->preview->live_id = -1;
prog = GHB_WIDGET(ud->builder, "live_encode_progress");
- if (success &&
+ if (success &&
ud->preview->encode_frame == ud->preview->frame)
{
gtk_progress_bar_set_text(GTK_PROGRESS_BAR(prog), "Done");
if (ud->preview->pix != NULL)
g_object_unref(ud->preview->pix);
- ud->preview->pix =
- ghb_get_preview_image(titleindex, ud->preview->frame,
+ ud->preview->pix =
+ ghb_get_preview_image(titleindex, ud->preview->frame,
ud, &width, &height);
if (ud->preview->pix == NULL) return;
preview_width = gdk_pixbuf_get_width(ud->preview->pix);
preview_height = gdk_pixbuf_get_height(ud->preview->pix);
widget = GHB_WIDGET (ud->builder, "preview_image");
- if (preview_width != ud->preview->width ||
+ if (preview_width != ud->preview->width ||
preview_height != ud->preview->height)
{
gtk_widget_set_size_request(widget, preview_width, preview_height);
widget = GHB_WIDGET (ud->builder, "preview_dims");
gtk_label_set_text(GTK_LABEL(widget), text);
g_free(text);
-
+
g_debug("preview %d x %d", preview_width, preview_height);
target_height = MIN(ud->preview->button_height, 200);
height = target_height;
if ((height >= 16) && (width >= 16))
{
GdkPixbuf *scaled_preview;
- scaled_preview = gdk_pixbuf_scale_simple (ud->preview->pix, width,
+ scaled_preview = gdk_pixbuf_scale_simple (ud->preview->pix, width,
height, GDK_INTERP_NEAREST);
if (scaled_preview != NULL)
{
G_MODULE_EXPORT gboolean
position_overlay_cb(
GtkWidget *overlay,
- GtkWidget *widget,
- GdkRectangle *rect,
+ GtkWidget *widget,
+ GdkRectangle *rect,
signal_user_data_t *ud)
{
GtkRequisition min_size, size;
G_MODULE_EXPORT gboolean
preview_expose_cb(
- GtkWidget *widget,
- GdkEventExpose *event,
+ GtkWidget *widget,
+ GdkEventExpose *event,
signal_user_data_t *ud)
{
#if defined(_ENABLE_GST)
g_debug("nothing to do");
return;
}
- g_debug("prev allocate %d x %d", ud->preview->button_width,
+ g_debug("prev allocate %d x %d", ud->preview->button_width,
ud->preview->button_height);
ud->preview->button_width = allocation->width;
ud->preview->button_height = allocation->height;
ghb_set_preview_image(ud);
}
-static void
-set_visible(GtkWidget *widget, gboolean visible)
-{
- if (visible)
- {
- gtk_widget_show_now(widget);
- }
- else
- {
- gtk_widget_hide(widget);
- }
-}
-
void
ghb_preview_set_visible(signal_user_data_t *ud)
{
GtkWidget *widget;
gboolean settings_active;
- settings_active = ghb_settings_get_boolean(ud->settings, "show_picture");
- widget = GHB_WIDGET (ud->builder, "preview_window");
+ settings_active = ghb_settings_get_boolean(ud->globals, "show_picture");
+ widget = GHB_WIDGET(ud->builder, "preview_window");
titleindex = ghb_settings_combo_int(ud->settings, "title");
if (settings_active && titleindex >= 0)
{
gint x, y;
- x = ghb_settings_get_int(ud->settings, "preview_x");
- y = ghb_settings_get_int(ud->settings, "preview_y");
+ x = ghb_settings_get_int(ud->prefs, "preview_x");
+ y = ghb_settings_get_int(ud->prefs, "preview_y");
if (x >= 0 && y >= 0)
gtk_window_move(GTK_WINDOW(widget), x, y);
- set_visible(widget,
- ghb_settings_get_boolean(ud->settings, "show_preview"));
+ gtk_widget_set_visible(widget,
+ ghb_settings_get_boolean(ud->prefs, "show_preview"));
}
else
{
- set_visible(widget, FALSE);
+ gtk_widget_set_visible(widget, FALSE);
}
}
preview_button_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
g_debug("preview_button_clicked_cb()");
- ghb_widget_to_setting (ud->settings, xwidget);
+ ghb_widget_to_setting (ud->prefs, xwidget);
ghb_preview_set_visible(ud);
ghb_check_dependency(ud, xwidget, NULL);
const gchar *name = ghb_get_setting_key(xwidget);
- ghb_pref_save(ud->settings, name);
+ ghb_pref_save(ud->prefs, name);
}
G_MODULE_EXPORT void
gint x, y;
g_debug("picture_settings_clicked_cb()");
- ghb_widget_to_setting (ud->settings, xwidget);
+ ghb_widget_to_setting(ud->globals, xwidget);
- hide_settings = ghb_settings_get_boolean(ud->settings, "hide_settings");
+ hide_settings = ghb_settings_get_boolean(ud->globals, "hide_settings");
- active = ghb_settings_get_boolean(ud->settings, "show_picture");
+ active = ghb_settings_get_boolean(ud->globals, "show_picture");
widget = GHB_WIDGET (ud->builder, "settings_window");
- x = ghb_settings_get_int(ud->settings, "settings_x");
- y = ghb_settings_get_int(ud->settings, "settings_y");
+ x = ghb_settings_get_int(ud->prefs, "settings_x");
+ y = ghb_settings_get_int(ud->prefs, "settings_y");
if (x >= 0 && y >= 0)
gtk_window_move(GTK_WINDOW(widget), x, y);
- set_visible(widget, active && !hide_settings);
+ gtk_widget_set_visible(widget, active && !hide_settings);
ghb_preview_set_visible(ud);
}
GtkWindow *window;
g_debug("fullscreen_clicked_cb()");
- ghb_widget_to_setting (ud->settings, toggle);
+ ghb_widget_to_setting (ud->prefs, toggle);
ghb_check_dependency(ud, toggle, NULL);
const gchar *name = ghb_get_setting_key(toggle);
- ghb_pref_save(ud->settings, name);
+ ghb_pref_save(ud->prefs, name);
window = GTK_WINDOW(GHB_WIDGET (ud->builder, "preview_window"));
active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle));
GtkWidget *window;
g_debug("picture_settings_alt2_clicked_cb()");
- ghb_widget_to_setting (ud->settings, xwidget);
- active = ghb_settings_get_boolean(ud->settings, "hide_settings");
+ ghb_widget_to_setting(ud->globals, xwidget);
+ active = ghb_settings_get_boolean(ud->globals, "hide_settings");
- toggle = GHB_WIDGET (ud->builder, "hide_settings");
+ toggle = GHB_WIDGET(ud->builder, "hide_settings");
window = GHB_WIDGET(ud->builder, "settings_window");
if (!active)
{
gtk_button_set_label(GTK_BUTTON(toggle), _("Hide Settings"));
- gtk_widget_set_tooltip_text(toggle,
+ gtk_widget_set_tooltip_text(toggle,
_("Hide the picture settings window while "
"leaving the preview visible."));
gtk_widget_show(window);
G_MODULE_EXPORT gboolean
preview_window_delete_cb(
- GtkWidget *widget,
- GdkEvent *event,
+ GtkWidget *widget,
+ GdkEvent *event,
signal_user_data_t *ud)
{
live_preview_stop(ud);
- widget = GHB_WIDGET (ud->builder, "show_picture");
+ widget = GHB_WIDGET(ud->builder, "show_picture");
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), FALSE);
return TRUE;
}
G_MODULE_EXPORT gboolean
settings_window_delete_cb(
- GtkWidget *widget,
- GdkEvent *event,
+ GtkWidget *widget,
+ GdkEvent *event,
signal_user_data_t *ud)
{
live_preview_stop(ud);
- widget = GHB_WIDGET (ud->builder, "show_picture");
+ widget = GHB_WIDGET(ud->builder, "show_picture");
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), FALSE);
return TRUE;
{
g_debug("preview_duration_changed_cb ()");
ghb_live_reset(ud);
- ghb_widget_to_setting (ud->settings, widget);
+ ghb_widget_to_setting (ud->prefs, widget);
ghb_check_dependency(ud, widget, NULL);
const gchar *name = ghb_get_setting_key(widget);
- ghb_pref_save(ud->settings, name);
+ ghb_pref_save(ud->prefs, name);
}
static guint hud_timeout_id = 0;
//g_message("preview_hud_size_alloc_cb()");
if (gtk_widget_get_visible(widget) && allocation->height > 50)
{
- shape = ghb_curved_rect_mask(allocation->width,
+ shape = ghb_curved_rect_mask(allocation->width,
allocation->height, allocation->height/4);
if (shape != NULL)
{
if (gtk_widget_get_visible(widget))
{
gtk_window_get_position(GTK_WINDOW(widget), &x, &y);
- ghb_settings_set_int(ud->settings, "preview_x", x);
- ghb_settings_set_int(ud->settings, "preview_y", y);
- ghb_pref_set(ud->settings, "preview_x");
- ghb_pref_set(ud->settings, "preview_y");
+ ghb_settings_set_int(ud->prefs, "preview_x", x);
+ ghb_settings_set_int(ud->prefs, "preview_y", y);
+ ghb_pref_set(ud->prefs, "preview_x");
+ ghb_pref_set(ud->prefs, "preview_y");
ghb_prefs_store();
}
return FALSE;
if (gtk_widget_get_visible(widget))
{
gtk_window_get_position(GTK_WINDOW(widget), &x, &y);
- ghb_settings_set_int(ud->settings, "settings_x", x);
- ghb_settings_set_int(ud->settings, "settings_y", y);
- ghb_pref_set(ud->settings, "settings_x");
- ghb_pref_set(ud->settings, "settings_y");
+ ghb_settings_set_int(ud->prefs, "settings_x", x);
+ ghb_settings_set_int(ud->prefs, "settings_y", y);
+ ghb_pref_set(ud->prefs, "settings_x");
+ ghb_pref_set(ud->prefs, "settings_y");
ghb_prefs_store();
}
return FALSE;
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
/*
* callbacks.c
* Copyright (C) John Stebbins 2008-2013 <stebbins@stebbins>
- *
+ *
* callbacks.c is free software.
- *
+ *
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
{
GtkTreeModel *store;
GtkTreeIter iter, piter;
-
+
g_debug("queue_list_selection_changed_cb ()");
// A queue entry is made up of a parent and multiple
// children that are visible when expanded. When and entry
{
GtkTreePath *path;
GtkTreeView *treeview;
-
+
gtk_tree_selection_select_iter (selection, &piter);
path = gtk_tree_model_get_path (store, &piter);
treeview = gtk_tree_selection_get_tree_view (selection);
gboolean pass2 = FALSE, keep_aspect, vqtype, turbo;
gint pic_par;
gchar *escape, *escape2;
-
+
g_debug("update_queue_list ()");
if (settings == NULL) return;
treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "queue_list"));
store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
-
+
title = ghb_settings_get_int(settings, "titlenum");
start_point = ghb_settings_get_int(settings, "start_point");
end_point = ghb_settings_get_int(settings, "end_point");
points = _("Seconds");
else if (ghb_settings_combo_int(settings, "PtoPType") == 2)
points = _("Frames");
- info = g_strdup_printf
+ info = g_strdup_printf
(
"<big><b>%s</b></big> "
"<small>(Title %d, %s %d through %d, %d Video %s)"
" --> %s</small>",
- escape2, title, points, start_point, end_point,
+ escape2, title, points, start_point, end_point,
pass2 ? 2:1, pass2 ? "Passes":"Pass", escape
);
g_free(basename);
markers = ghb_settings_get_boolean(settings, "ChapterMarkers");
if (preset_modified)
- g_string_append_printf(str,
- "<b>Modified Preset Based On:</b> <small>%s</small>\n",
+ g_string_append_printf(str,
+ "<b>Modified Preset Based On:</b> <small>%s</small>\n",
preset);
else
- g_string_append_printf(str,
- "<b>Preset:</b> <small>%s</small>\n",
+ g_string_append_printf(str,
+ "<b>Preset:</b> <small>%s</small>\n",
preset);
if (markers)
{
- g_string_append_printf(str,
- "<b>Format:</b> <small>%s Container, Chapter Markers</small>\n",
+ g_string_append_printf(str,
+ "<b>Format:</b> <small>%s Container, Chapter Markers</small>\n",
container);
}
else
{
- g_string_append_printf(str,
+ g_string_append_printf(str,
"<b>Format:</b> <small>%s Container</small>\n", container);
}
if (mux & HB_MUX_MASK_MP4)
}
}
escape = g_markup_escape_text(dest, -1);
- g_string_append_printf(str,
+ g_string_append_printf(str,
"<b>Destination:</b> <small>%s</small>\n", escape);
width = ghb_settings_get_int(settings, "scale_width");
strcmp(vcodec_abbr, "ffmpeg") == 0)
{
gchar *opts = ghb_build_advanced_opts_string(settings);
- g_string_append_printf(str,
+ g_string_append_printf(str,
"<b>Advanced Options:</b> <small>%s</small>\n", opts);
g_free(opts);
}
{
g_string_append_printf(str,
"<small> %s%s%s%s</small>",
- track,
+ track,
force ? " (Force)":"",
burn ? " (Burn)":"",
def ? " (Default)":""
gchar *resolved = ghb_resolve_symlink(destdir);
gfile = g_file_new_for_path(resolved);
- info = g_file_query_filesystem_info(gfile,
+ info = g_file_query_filesystem_info(gfile,
G_FILE_ATTRIBUTE_FILESYSTEM_FREE, NULL, NULL);
if (info != NULL)
{
if (g_file_info_has_attribute(info, G_FILE_ATTRIBUTE_FILESYSTEM_FREE))
{
- size = g_file_info_get_attribute_uint64(info,
+ size = g_file_info_get_attribute_uint64(info,
G_FILE_ATTRIBUTE_FILESYSTEM_FREE);
-
+
gint64 fsize = (guint64)10 * 1024 * 1024 * 1024;
if (size < fsize)
{
// Add settings to the queue
gint titleindex;
gint titlenum;
-
+
g_debug("queue_add ()");
if (!validate_settings(ud, settings, batch))
{
if (ud->queue == NULL)
ud->queue = ghb_array_value_new(32);
+
+ // 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);
+
// 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_save_queue(ud->queue);
}
else
- {
+ {
gtk_tree_path_free (treepath);
}
ghb_update_pending(ud);
GValue *js;
gint ii, count;
gint status;
-
+
g_debug("find_last_finished");
count = ghb_array_len(queue);
for (ii = 0; ii < count; ii++)
gdk_drag_status(ctx, 0, time);
return TRUE;
}
- if (pos != GTK_TREE_VIEW_DROP_AFTER &&
+ if (pos != GTK_TREE_VIEW_DROP_AFTER &&
row == finished)
{
gtk_tree_path_free(path);
return TRUE;
}
-G_MODULE_EXPORT void
+G_MODULE_EXPORT void
queue_drag_cb(
- GtkTreeView *dstwidget,
- GdkDragContext *dc,
- gint x, gint y,
- GtkSelectionData *selection_data,
- guint info, guint t,
+ GtkTreeView *dstwidget,
+ GdkDragContext *dc,
+ gint x, gint y,
+ GtkSelectionData *selection_data,
+ guint info, guint t,
signal_user_data_t *ud)
{
GtkTreePath *path = NULL;
GtkTreeIter dstiter, srciter;
gint *indices, row;
GValue *js;
-
+
GtkTreeModel *dstmodel = gtk_tree_view_get_model(dstwidget);
-
+
g_debug("queue_drag_cb ()");
// This doesn't work here for some reason...
// gtk_tree_view_get_drag_dest_row(dstwidget, &path, &pos);
{
case GTK_TREE_VIEW_DROP_BEFORE:
case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
- gtk_tree_store_insert_before (GTK_TREE_STORE (dstmodel),
+ gtk_tree_store_insert_before (GTK_TREE_STORE (dstmodel),
&iter, NULL, &dstiter);
break;
case GTK_TREE_VIEW_DROP_AFTER:
case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
- gtk_tree_store_insert_after (GTK_TREE_STORE (dstmodel),
+ gtk_tree_store_insert_after (GTK_TREE_STORE (dstmodel),
&iter, NULL, &dstiter);
break;
queue_state = ghb_get_queue_state();
scan_state = ghb_get_scan_state();
- show_stop = queue_state &
- (GHB_STATE_WORKING | GHB_STATE_SEARCHING |
+ show_stop = queue_state &
+ (GHB_STATE_WORKING | GHB_STATE_SEARCHING |
GHB_STATE_SCANNING | GHB_STATE_MUXING);
- show_start = !(scan_state & GHB_STATE_SCANNING) &&
+ show_start = !(scan_state & GHB_STATE_SCANNING) &&
(titleindex >= 0 || queue_count > 0);
{
GtkTreeViewColumn *column;
gint width;
-
+
column = gtk_tree_view_get_column (GTK_TREE_VIEW(widget), 0);
width = gtk_tree_view_column_get_width(column);
g_debug("col width %d alloc width %d", width, allocation->width);
gint state;
state = ghb_get_queue_state();
- if (state & (GHB_STATE_WORKING | GHB_STATE_SEARCHING |
+ if (state & (GHB_STATE_WORKING | GHB_STATE_SEARCHING |
GHB_STATE_SCANNING | GHB_STATE_MUXING))
{
ghb_cancel_encode(ud, _("You are currently encoding. "
{
js = ghb_array_get_nth(ud->queue, ii);
status = ghb_settings_get_int(js, "job_status");
- if ((status == GHB_QUEUE_RUNNING) ||
+ if ((status == GHB_QUEUE_RUNNING) ||
(status == GHB_QUEUE_PENDING))
{
running = TRUE;
return FALSE;
}
-G_MODULE_EXPORT gboolean
+G_MODULE_EXPORT gboolean
queue_key_press_cb(
- GtkWidget *widget,
+ GtkWidget *widget,
GdkEventKey *event,
signal_user_data_t *ud)
{
/*
* queuehandler.h
* Copyright (C) John Stebbins 2008-2013 <stebbins@stebbins>
- *
+ *
* queuehandler.h is free software.
- *
+ *
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
- *
+ *
* callbacks.h is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with callbacks.h. If not, write to:
* The Free Software Foundation, Inc.,
/*
* resources.c
* Copyright (C) John Stebbins 2008-2013 <stebbins@stebbins>
- *
+ *
* resources.c is free software.
- *
+ *
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
- *
+ *
*/
#include <glib.h>
#include <glib-object.h>
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
/*
* settings.c
* Copyright (C) John Stebbins 2008-2013 <stebbins@stebbins>
- *
+ *
* settings.c is free software.
- *
+ *
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
- *
+ *
*/
#include <fcntl.h>
#include <unistd.h>
void
ghb_settings_set_value(
- GValue *settings,
- const gchar *key,
+ GValue *settings,
+ const gchar *key,
const GValue *value)
{
if (key == NULL || value == NULL)
void
ghb_settings_set_string(
- GValue *settings,
- const gchar *key,
+ GValue *settings,
+ const gchar *key,
const gchar *sval)
{
GValue *value;
ghb_get_setting_key(GtkWidget *widget)
{
const gchar *name;
-
+
g_debug("get_setting_key ()\n");
if (widget == NULL) return NULL;
name = gtk_buildable_get_name(GTK_BUILDABLE(widget));
-
+
if (name == NULL)
{
name = gtk_widget_get_name(widget);
GValue *value = NULL;
const gchar *name;
GType type;
-
+
if (widget == NULL)
{
g_debug("NULL widget\n");
{
GValue *value;
gchar *sval;
-
+
value = ghb_widget_value(widget);
sval = ghb_value_string(value);
ghb_value_free(value);
{
GValue *value;
gdouble dval;
-
+
value = ghb_widget_value(widget);
dval = ghb_value_double(value);
ghb_value_free(value);
{
GValue *value;
gint64 ival;
-
+
value = ghb_widget_value(widget);
ival = ghb_value_int64(value);
ghb_value_free(value);
{
GValue *value;
gint ival;
-
+
value = ghb_widget_value(widget);
ival = (gint)ghb_value_int64(value);
ghb_value_free(value);
{
GValue *value;
gboolean bval;
-
+
value = ghb_widget_value(widget);
bval = ghb_value_boolean(value);
ghb_value_free(value);
{
const gchar *key = NULL;
GValue *value;
-
+
if (widget == NULL) return;
g_debug("ghb_widget_to_setting");
// Find corresponding setting
else if (type == GTK_TYPE_RADIO_BUTTON)
{
g_debug("radio button");
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), !!ival);
+ if (ival)
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), !!ival);
}
else if (type == GTK_TYPE_CHECK_BUTTON)
{
}
int
-ghb_ui_update_from_settings(GtkBuilder *builder, const gchar *name, const GValue *settings)
+ghb_ui_update_from_settings(signal_user_data_t *ud, const gchar *name, const GValue *settings)
{
GObject *object;
GValue * value;
value = ghb_settings_get_value(settings, name);
if (value == NULL)
return 0;
- object = GHB_OBJECT(builder, name);
+ object = GHB_OBJECT(ud->builder, name);
if (object == NULL)
{
g_debug("Failed to find widget for key: %s\n", name);
return -1;
}
ghb_update_widget((GtkWidget*)object, value);
+ // Its possible the value hasn't changed. Since settings are only
+ // updated when the value changes, I'm initializing settings here as well.
+ ghb_widget_to_setting(ud->settings, (GtkWidget*)object);
return 0;
}
return 0;
}
+int
+ghb_ui_settings_update(
+ signal_user_data_t *ud,
+ GValue *settings,
+ const gchar *name,
+ const GValue *value)
+{
+ GObject *object;
+
+ g_debug("ghb_ui_update() %s", name);
+ if (name == NULL || value == NULL)
+ return 0;
+ object = GHB_OBJECT(ud->builder, name);
+ if (object == NULL)
+ {
+ g_debug("Failed to find widget for key: %s\n", name);
+ return -1;
+ }
+ ghb_update_widget((GtkWidget*)object, value);
+ // Its possible the value hasn't changed. Since settings are only
+ // updated when the value changes, I'm initializing settings here as well.
+ ghb_widget_to_setting(settings, (GtkWidget*)object);
+ return 0;
+}
+
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
gboolean scale_busy;
gint cancel_encode;
GtkBuilder *builder;
+ GValue *globals;
+ GValue *prefs;
GValue *settings;
+ GValue *settings_array;
GValue *queue;
GValue *current_job;
GIOChannel *activity_log;
int ghb_ui_update(
signal_user_data_t *ud, const gchar *name, const GValue *value);
int ghb_ui_update_from_settings(
- GtkBuilder *builder, const gchar *name, const GValue *settings);
+ signal_user_data_t *ud, const gchar *name, const GValue *settings);
+int ghb_ui_settings_update(
+ signal_user_data_t *ud, GValue *settings, const gchar *name,
+ const GValue *value);
const gchar* ghb_get_setting_key(GtkWidget *widget);
void ghb_update_widget(GtkWidget *widget, const GValue *value);
}
static void
-subtitle_refresh_list_ui(signal_user_data_t *ud)
+subtitle_refresh_list_ui_from_settings(signal_user_data_t *ud, GValue *settings)
{
GValue *subtitle_list;
GValue *subsettings;
tm_count = gtk_tree_model_iter_n_children(tm, NULL);
- subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
+ subtitle_list = ghb_settings_get_value(settings, "subtitle_list");
count = ghb_array_len(subtitle_list);
if (count != tm_count)
{
}
}
+static void
+subtitle_refresh_list_ui(signal_user_data_t *ud)
+{
+ subtitle_refresh_list_ui_from_settings(ud, ud->settings);
+}
+
void
ghb_subtitle_exclusive_burn_settings(GValue *settings, gint index)
{
}
static GValue* subtitle_add_track(
+ signal_user_data_t *ud,
GValue *settings,
hb_title_t *title,
int track,
ghb_settings_set_string(subsettings, "SrtCodeset", "UTF-8");
- dir = ghb_settings_get_string(settings, "SrtDir");
+ dir = ghb_settings_get_string(ud->prefs, "SrtDir");
filename = g_strdup_printf("%s/none", dir);
ghb_settings_set_string(subsettings, "SrtFile", filename);
g_free(dir);
}
void
-ghb_set_pref_subtitle_settings(hb_title_t *title, GValue *settings)
+ghb_set_pref_subtitle_settings(signal_user_data_t *ud, hb_title_t *title, GValue *settings)
{
gint track;
gboolean *used;
if (track > 0)
{
used[track] = TRUE;
- subtitle_add_track(settings, title, track, mux,
+ subtitle_add_track(ud, settings, title, track, mux,
TRUE, FALSE, &one_burned);
}
}
(audio_lang != NULL && !strncmp(audio_lang, pref_lang, 4)))
{
// Add search for foreign audio segments
- subtitle_add_track(settings, title, -1, mux, TRUE, FALSE, &one_burned);
+ subtitle_add_track(ud, settings, title, -1, mux,
+ TRUE, FALSE, &one_burned);
}
if (behavior != 0)
if (!used[track])
{
used[track] = TRUE;
- subtitle_add_track(settings, title, track, mux,
+ subtitle_add_track(ud, settings, title, track, mux,
FALSE, FALSE, &one_burned);
}
next_track = track + 1;
if (track < sub_count && !used[track])
{
used[track] = TRUE;
- subtitle_add_track(settings, title, track, mux,
+ subtitle_add_track(ud, settings, title, track, mux,
FALSE, FALSE, &one_burned);
}
}
widget = GHB_WIDGET(ud->builder, "SubtitleSrtDisable");
gtk_widget_set_sensitive(widget, TRUE);
}
- ghb_set_pref_subtitle_settings(title, ud->settings);
+ ghb_set_pref_subtitle_settings(ud, title, ud->settings);
subtitle_refresh_list_ui(ud);
}
if (subsettings != NULL)
{
// Update widgets with subsettings
- gchar *str, *track;
- gint offset;
gboolean burn, force, def;
int mux = ghb_settings_combo_int(ud->settings, "FileFormat");
int source = ghb_settings_get_int(subsettings, "SubtitleSource");
- track = ghb_settings_get_string(subsettings, "SubtitleTrack");
- ghb_ui_update(ud, "SubtitleTrack", ghb_string_value(track));
- g_free(track);
-
- str = ghb_settings_get_string(subsettings, "SrtLanguage");
- ghb_ui_update(ud, "SrtLanguage", ghb_string_value(str));
- g_free(str);
-
- str = ghb_settings_get_string(subsettings, "SrtCodeset");
- ghb_ui_update(ud, "SrtCodeset", ghb_string_value(str));
- g_free(str);
-
- str = ghb_settings_get_string(subsettings, "SrtFile");
- ghb_ui_update(ud, "SrtFile", ghb_string_value(str));
- g_free(str);
-
- offset = ghb_settings_get_int(subsettings, "SrtOffset");
- ghb_ui_update(ud, "SrtOffset", ghb_int_value(offset));
+ ghb_ui_update_from_settings(ud, "SubtitleTrack", subsettings);
+ ghb_ui_update_from_settings(ud, "SrtLanguage", subsettings);
+ ghb_ui_update_from_settings(ud, "SrtCodeset", subsettings);
+ ghb_ui_update_from_settings(ud, "SrtFile", subsettings);
+ ghb_ui_update_from_settings(ud, "SrtOffset", subsettings);
if (source == SRTSUB)
{
ghb_settings_set_boolean(subsettings, "SubtitleDefaultTrack", def);
ghb_ui_update(ud, "SubtitleDefaultTrack", ghb_boolean_value(def));
- if (source == SRTSUB)
- {
- // Hide regular subtitle widgets
- widget = GHB_WIDGET(ud->builder, "subtitle_track_box");
- gtk_widget_hide(widget);
-
- // Show SRT subitle widgets
- widget = GHB_WIDGET(ud->builder, "subtitle_srt_grid");
- gtk_widget_show(widget);
- }
- else
- {
- // Hide SRT subitle widgets
- widget = GHB_WIDGET(ud->builder, "subtitle_srt_grid");
- gtk_widget_hide(widget);
+ // Hide regular subtitle widgets
+ widget = GHB_WIDGET(ud->builder, "subtitle_track_box");
+ gtk_widget_set_visible(widget, source != SRTSUB);
- // Show regular subtitle widgets
- widget = GHB_WIDGET(ud->builder, "subtitle_track_box");
- gtk_widget_show(widget);
- }
+ // Show SRT subitle widgets
+ widget = GHB_WIDGET(ud->builder, "subtitle_srt_grid");
+ gtk_widget_set_visible(widget, source == SRTSUB);
}
else
{
// Hide SRT subitle widgets
widget = GHB_WIDGET(ud->builder, "subtitle_srt_grid");
- gtk_widget_hide(widget);
+ gtk_widget_set_visible(widget, FALSE);
// Show regular subtitle widgets
widget = GHB_WIDGET(ud->builder, "subtitle_track_box");
- gtk_widget_show(widget);
+ gtk_widget_set_visible(widget, TRUE);
}
}
filename = ghb_settings_get_string(subsettings, "SrtFile");
if (g_file_test(filename, G_FILE_TEST_IS_DIR))
{
- ghb_settings_set_string(ud->settings, "SrtDir", filename);
+ ghb_settings_set_string(ud->prefs, "SrtDir", filename);
}
else
{
dirname = g_path_get_dirname(filename);
- ghb_settings_set_string(ud->settings, "SrtDir", dirname);
+ ghb_settings_set_string(ud->prefs, "SrtDir", dirname);
g_free(dirname);
}
- ghb_pref_save(ud->settings, "SrtDir");
+ ghb_pref_save(ud->prefs, "SrtDir");
g_free(filename);
}
}
for (subsettings = NULL, track = 0;
subsettings == NULL && track < count; track++)
{
- subsettings = subtitle_add_track(ud->settings, title, track, mux,
+ subsettings = subtitle_add_track(ud, ud->settings, title, track, mux,
FALSE, FALSE, &one_burned);
}
if (subsettings == NULL)
{
- subsettings = subtitle_add_track(ud->settings, title, 0, mux,
+ subsettings = subtitle_add_track(ud, ud->settings, title, 0, mux,
FALSE, TRUE, &one_burned);
}
ghb_add_subtitle_to_ui(ud, subsettings);
int count = hb_list_count(title->list_subtitle);
for (track = 0; track < count; track++)
{
- subtitle_add_track(ud->settings, title, track, mux,
+ subtitle_add_track(ud, ud->settings, title, track, mux,
FALSE, FALSE, &one_burned);
}
subtitle_refresh_list_ui(ud);
}
}
-void ghb_subtitle_def_settings_init(signal_user_data_t *ud)
+void ghb_subtitle_defaults_to_ui(signal_user_data_t *ud)
{
subtitle_def_lang_list_init(ud);
}
/*
* subtitlehandler.h
* Copyright (C) John Stebbins 2008-2013 <stebbins@stebbins>
- *
+ *
* audiohandler.h is free software.
- *
+ *
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
- *
+ *
* callbacks.h is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with callbacks.h. If not, write to:
* The Free Software Foundation, Inc.,
#include "settings.h"
void ghb_set_pref_subtitle(gint titleindex, signal_user_data_t *ud);
-void ghb_set_pref_subtitle_settings(hb_title_t *title, GValue *settings);
+void ghb_set_pref_subtitle_settings(signal_user_data_t *ud, hb_title_t *title, GValue *settings);
void ghb_set_subtitle(signal_user_data_t *ud, gint track, GValue *settings);
void ghb_reset_subtitles(signal_user_data_t *ud, GValue *settings);
void ghb_subtitle_prune(signal_user_data_t *ud);
void ghb_subtitle_list_refresh_selected(signal_user_data_t *ud);
void ghb_subtitle_list_refresh_all(signal_user_data_t *ud);
void ghb_init_subtitle_defaults_ui(signal_user_data_t *ud);
-void ghb_subtitle_def_settings_init(signal_user_data_t *ud);
+void ghb_subtitle_defaults_to_ui(signal_user_data_t *ud);
void ghb_subtitle_title_change(signal_user_data_t *ud, gboolean show);
#endif // _SUBTITLEHANDLER_H_
/*
* presets.c
* Copyright (C) John Stebbins 2008-2013 <stebbins@stebbins>
- *
+ *
* presets.c is free software.
- *
+ *
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
- *
+ *
*/
#include <glib.h>
{
return 1;
}
-
+
if (typa == G_TYPE_STRING)
{
char *stra, *strb;
g_free(strb);
return res;
}
- else if (typa == G_TYPE_INT64 || typa == G_TYPE_INT ||
+ else if (typa == G_TYPE_INT64 || typa == G_TYPE_INT ||
typa == G_TYPE_BOOLEAN)
{
return ghb_value_int64(vala) - ghb_value_int64(valb);
g_value_take_boxed(gval, array);
}
-GValue*
+GValue*
ghb_date_value_new(GDate *date)
{
GValue *gval = ghb_value_new(g_date_get_type());
return gval;
}
-GValue*
+GValue*
ghb_rawdata_value_new(ghb_rawdata_t *data)
{
GValue *gval = ghb_value_new(ghb_rawdata_get_type());
void
ghb_register_transforms()
{
- g_value_register_transform_func(G_TYPE_STRING, G_TYPE_INT64,
+ g_value_register_transform_func(G_TYPE_STRING, G_TYPE_INT64,
xform_string_int64);
- g_value_register_transform_func(G_TYPE_STRING, G_TYPE_INT,
+ g_value_register_transform_func(G_TYPE_STRING, G_TYPE_INT,
xform_string_int);
- g_value_register_transform_func(G_TYPE_STRING, G_TYPE_DOUBLE,
+ g_value_register_transform_func(G_TYPE_STRING, G_TYPE_DOUBLE,
xform_string_double);
- g_value_register_transform_func(G_TYPE_BOOLEAN, G_TYPE_DOUBLE,
+ g_value_register_transform_func(G_TYPE_BOOLEAN, G_TYPE_DOUBLE,
xform_boolean_double);
- g_value_register_transform_func(G_TYPE_DOUBLE, G_TYPE_STRING,
+ g_value_register_transform_func(G_TYPE_DOUBLE, G_TYPE_STRING,
xform_double_string);
}
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
/*
* x264handler.c
* Copyright (C) John Stebbins 2008-2013 <stebbins@stebbins>
- *
+ *
* x264handler.c is free software.
- *
+ *
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
void ghb_show_hide_advanced_video( signal_user_data_t *ud )
{
- GtkWidget *nb = GHB_WIDGET(ud->builder, "SettingsNotebook");
- GtkWidget *at = GHB_WIDGET(ud->builder, "advanced_tab");
+ gboolean hide;
- int pgn = gtk_notebook_page_num(GTK_NOTEBOOK(nb), at);
-
- GtkWidget *pg;
- pg = gtk_notebook_get_nth_page(GTK_NOTEBOOK(nb), pgn);
- if (ghb_settings_get_boolean(ud->settings, "HideAdvancedVideoSettings"))
+ hide = ghb_settings_get_boolean(ud->prefs, "HideAdvancedVideoSettings");
+ if (hide)
{
- gtk_widget_hide(pg);
ghb_ui_update(ud, "x264UseAdvancedOptions", ghb_boolean_value(FALSE));
}
- else
- {
- gtk_widget_show(pg);
- }
+
+ GtkWidget *widget;
+ GtkWidget *nb = GHB_WIDGET(ud->builder, "SettingsNotebook");
+ GtkWidget *at = GHB_WIDGET(ud->builder, "advanced_tab");
+ int pgn = gtk_notebook_page_num(GTK_NOTEBOOK(nb), at);
+
+ widget = gtk_notebook_get_nth_page(GTK_NOTEBOOK(nb), pgn);
+ gtk_widget_set_visible(widget, !hide);
+ widget = GHB_WIDGET(ud->builder, "x264UseAdvancedOptions");
+ gtk_widget_set_visible(widget, !hide);
}
G_MODULE_EXPORT void
{
ghb_widget_to_setting(ud->settings, widget);
- if (ghb_settings_get_boolean(ud->settings, "HideAdvancedVideoSettings") &&
+ if (ghb_settings_get_boolean(ud->prefs, "HideAdvancedVideoSettings") &&
ghb_settings_get_boolean(ud->settings, "x264UseAdvancedOptions"))
{
ghb_ui_update(ud, "x264UseAdvancedOptions", ghb_boolean_value(FALSE));
}
G_MODULE_EXPORT gboolean
-x264_focus_out_cb(GtkWidget *widget, GdkEventFocus *event,
+x264_focus_out_cb(GtkWidget *widget, GdkEventFocus *event,
signal_user_data_t *ud)
{
gchar *options, *sopts;
static gchar *x264_ref_syns[] = {"ref", "frameref", NULL};
static gchar *x264_bframes_syns[] = {"bframes", NULL};
static gchar *x264_badapt_syns[] = {"b-adapt", "b_adapt", NULL};
-static gchar *x264_direct_syns[] =
+static gchar *x264_direct_syns[] =
{"direct", "direct-pred", "direct_pred", NULL};
static gchar *x264_weightp_syns[] = {"weightp", NULL};
static gchar *x264_bpyramid_syns[] = {"b-pyramid", "b_pyramid", NULL};
static gchar *x264_psy_syns[] = {"psy-rd", "psy_rd", NULL};
static gchar *x264_aq_strength_syns[] = {"aq-strength", "aq_strength", NULL};
static gchar *x264_mbtree_syns[] = {"mbtree", NULL};
-static gchar *x264_decimate_syns[] =
+static gchar *x264_decimate_syns[] =
{"no-dct-decimate", "no_dct_decimate", NULL};
static gchar *x264_cabac_syns[] = {"cabac", NULL};
NULL
};
-static gboolean
+static gboolean
str_is_true(const gchar *str)
{
gint ii;
if (xval == NULL) return;
val = g_strdup(xval);
bvalue = avalue = 0;
- if (val != NULL)
+ if (val != NULL)
{
gchar *pos = strchr(val, ',');
if (pos != NULL)
val = trans_x264_val(x264_opt_map[jj].translation, val);
if (val != NULL)
{
- do_update(ud, x264_opt_map[jj].name,
+ do_update(ud, x264_opt_map[jj].name,
x264_opt_map[jj].translation->ui_type, val);
// TODO un-grey the ui control
}
val = g_strdup(trans_x264_val(x264_opt_map[jj].translation, val));
if (val != NULL)
{
- do_update(ud, x264_opt_map[jj].name,
+ do_update(ud, x264_opt_map[jj].name,
x264_opt_map[jj].translation->ui_type, val);
// TODO un-grey the ui control
}
gint ret = 0;
gchar *result;
gchar **split;
-
+
if (options == NULL)
options = "";
gint ret = 0;
gchar *result;
gchar **split;
-
+
if (options == NULL)
options = "";
gint ret = 0;
gchar *result;
gchar **split;
-
+
if (options == NULL)
options = "";
gint ret = ghb_lookup_bframes(options) != 0;
gchar *result;
gchar **split;
-
+
if (options == NULL)
options = "";
}
G_MODULE_EXPORT gboolean
-lavc_focus_out_cb(GtkWidget *widget, GdkEventFocus *event,
+lavc_focus_out_cb(GtkWidget *widget, GdkEventFocus *event,
signal_user_data_t *ud)
{
ghb_widget_to_setting(ud->settings, widget);
/*
* x264handler.h
* Copyright (C) John Stebbins 2008-2013 <stebbins@stebbins>
- *
+ *
* x264handler.h is free software.
- *
+ *
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
- *
+ *
* callbacks.h is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with callbacks.h. If not, write to:
* The Free Software Foundation, Inc.,