G_MODULE_EXPORT void video_preset_slider_changed_cb(GtkWidget *widget, signal_user_data_t *ud) { ghb_widget_to_setting(ud->settings, widget); int presetIndex = ghb_dict_get_int(ud->settings, "VideoPresetSlider"); const char * const *video_presets; const char *preset = "medium"; int count; int encoder = ghb_get_video_encoder(ud->settings); video_presets = hb_video_encoder_get_presets(encoder); if (video_presets != NULL) { for (count = 0; video_presets[count]; count++); if (presetIndex < count) { preset = video_presets[presetIndex]; } } ghb_set_video_preset(ud->settings, encoder, preset); GhbValue *gval = ghb_dict_get_value(ud->settings, "VideoPresetSlider"); ghb_ui_settings_update(ud, ud->settings, "VideoPresetSlider", gval); ghb_check_dependency(ud, widget, NULL); ghb_clear_presets_selection(ud); update_adv_settings_tooltip(ud); }
G_MODULE_EXPORT void x264_use_advanced_options_changed_cb(GtkWidget *widget, signal_user_data_t *ud) { ghb_widget_to_setting(ud->settings, widget); if (ghb_dict_get_bool(ud->prefs, "HideAdvancedVideoSettings") && ghb_dict_get_bool(ud->settings, "x264UseAdvancedOptions")) { ghb_ui_update(ud, "x264UseAdvancedOptions", ghb_boolean_value(FALSE)); return; } if (ghb_dict_get_bool(ud->settings, "x264UseAdvancedOptions")) { ghb_ui_update(ud, "VideoPresetSlider", ghb_int_value(5)); ghb_ui_update(ud, "VideoTune", ghb_string_value("none")); ghb_ui_update(ud, "VideoProfile", ghb_string_value("auto")); ghb_ui_update(ud, "VideoLevel", ghb_string_value("auto")); const char *options = ghb_dict_get_string(ud->settings, "x264Option"); ghb_ui_update(ud, "VideoOptionExtra", ghb_string_value(options)); } ghb_check_dependency(ud, widget, NULL); ghb_clear_presets_selection(ud); }
G_MODULE_EXPORT void x264_me_changed_cb(GtkWidget *widget, signal_user_data_t *ud) { gint me; ghb_widget_to_setting(ud->x264_priv, widget); if (!ignore_options_update) { ignore_options_update = TRUE; x264_opt_update(ud, widget); ignore_options_update = FALSE; } ghb_check_dependency(ud, widget, NULL); ghb_clear_presets_selection(ud); widget = GHB_WIDGET(ud->builder, "x264_merange"); me = ghb_settings_combo_int(ud->x264_priv, "x264_me"); if (me < 2) { // me < umh // me_range 4 - 16 gtk_spin_button_set_range(GTK_SPIN_BUTTON(widget), 4, 16); } else { // me_range 4 - 64 gtk_spin_button_set_range(GTK_SPIN_BUTTON(widget), 4, 64); } }
G_MODULE_EXPORT void framerate_mode_changed_cb(GtkWidget *widget, signal_user_data_t *ud) { ghb_widget_to_setting(ud->settings, widget); ghb_update_summary_info(ud); ghb_check_dependency(ud, widget, NULL); ghb_clear_presets_selection(ud); ghb_live_reset(ud); }
void ghb_video_setting_changed(GtkWidget *widget, signal_user_data_t *ud) { ghb_widget_to_setting(ud->settings, widget); update_adv_settings_tooltip(ud); ghb_check_dependency(ud, widget, NULL); ghb_clear_presets_selection(ud); }
G_MODULE_EXPORT void x264_widget_changed_cb(GtkWidget *widget, signal_user_data_t *ud) { ghb_widget_to_setting(ud->x264_priv, widget); if (!ignore_options_update) { ignore_options_update = TRUE; x264_opt_update(ud, widget); ignore_options_update = FALSE; } ghb_check_dependency(ud, widget, NULL); ghb_clear_presets_selection(ud); }
G_MODULE_EXPORT void vcodec_changed_cb(GtkWidget *widget, signal_user_data_t *ud) { float val, vqmin, vqmax, step, page; int inverted, digits; ghb_widget_to_setting(ud->settings, widget); ghb_check_dependency(ud, widget, NULL); ghb_show_container_options(ud); ghb_update_summary_info(ud); ghb_clear_presets_selection(ud); ghb_live_reset(ud); // Set the range of the video quality slider val = ghb_vquality_default(ud); ghb_vquality_range(ud, &vqmin, &vqmax, &step, &page, &digits, &inverted); ghb_scale_configure(ud, "VideoQualitySlider", val, vqmin, vqmax, step, page, digits, inverted); ghb_update_ui_combo_box(ud, "VideoTune", NULL, FALSE); ghb_update_ui_combo_box(ud, "VideoProfile", NULL, FALSE); ghb_update_ui_combo_box(ud, "VideoLevel", NULL, FALSE); ghb_ui_update(ud, "VideoTune", ghb_int_value(0)); ghb_ui_update(ud, "VideoProfile", ghb_int_value(0)); ghb_ui_update(ud, "VideoLevel", ghb_int_value(0)); ghb_ui_update(ud, "VideoOptionExtra", ghb_string_value("")); // Set the range of the preset slider int encoder = ghb_get_video_encoder(ud->settings); GtkWidget *presetSlider = GHB_WIDGET(ud->builder, "VideoPresetSlider"); GtkWidget *presetLabel = GHB_WIDGET(ud->builder, "VideoPresetLabel"); const char * const *video_presets; int count = 0; video_presets = hb_video_encoder_get_presets(encoder); while (video_presets && video_presets[count]) count++; gtk_widget_set_visible(presetSlider, count > 0); gtk_widget_set_visible(presetLabel, count > 0); if (count) { gtk_range_set_range(GTK_RANGE(presetSlider), 0, count-1); } ghb_set_video_preset(ud->settings, encoder, "medium"); GhbValue *gval = ghb_dict_get_value(ud->settings, "VideoPresetSlider"); ghb_ui_settings_update(ud, ud->settings, "VideoPresetSlider", gval); // Advanced options are only for x264 if (!(encoder & HB_VCODEC_X264_MASK)) { ghb_ui_update(ud, "x264UseAdvancedOptions", ghb_boolean_value(FALSE)); } }
G_MODULE_EXPORT void subtitle_remove_lang_clicked_cb(GtkWidget *widget, signal_user_data_t *ud) { GtkListBox *avail, *selected; GtkListBoxRow *row; GtkWidget *label; avail = GTK_LIST_BOX(GHB_WIDGET(ud->builder, "subtitle_avail_lang")); selected = GTK_LIST_BOX(GHB_WIDGET(ud->builder, "subtitle_selected_lang")); row = gtk_list_box_get_selected_row(selected); if (row != NULL) { gint index; GValue *lang_list; index = gtk_list_box_row_get_index(row); // Remove from UI selected language list box label = gtk_bin_get_child(GTK_BIN(row)); g_object_ref(G_OBJECT(label)); int idx = (intptr_t)g_object_get_data(G_OBJECT(label), "lang_idx"); gtk_widget_destroy(GTK_WIDGET(row)); gtk_widget_show(label); // Add to UI available language list box gtk_list_box_insert(avail, label, idx); // Remove from preset language list lang_list = ghb_settings_get_value(ud->settings, "SubtitleLanguageList"); GValue *glang = ghb_array_get_nth(lang_list, index); ghb_array_remove(lang_list, index); ghb_value_free(glang); ghb_clear_presets_selection(ud); if (ghb_array_len(lang_list) > 0) { const iso639_lang_t *lang; GValue *entry = ghb_array_get_nth(lang_list, 0); lang = ghb_iso639_lookup_by_int(ghb_lookup_audio_lang(entry)); subtitle_update_pref_lang(ud, lang); } else { subtitle_update_pref_lang(ud, NULL); } } }
G_MODULE_EXPORT void framerate_changed_cb(GtkWidget *widget, signal_user_data_t *ud) { ghb_widget_to_setting(ud->settings, widget); ghb_update_summary_info(ud); if (ghb_settings_video_framerate_rate(ud->settings, "VideoFramerate") != 0) { if (!ghb_dict_get_bool(ud->settings, "VideoFrameratePFR")) { ghb_ui_update(ud, "VideoFramerateCFR", ghb_boolean_value(TRUE)); } } if (ghb_settings_video_framerate_rate(ud->settings, "VideoFramerate") == 0 && ghb_dict_get_bool(ud->settings, "VideoFrameratePFR")) { ghb_ui_update(ud, "VideoFramerateVFR", ghb_boolean_value(TRUE)); } ghb_check_dependency(ud, widget, NULL); ghb_clear_presets_selection(ud); ghb_live_reset(ud); }
G_MODULE_EXPORT void subtitle_add_lang_clicked_cb(GtkWidget *widget, signal_user_data_t *ud) { GtkListBox *avail = GTK_LIST_BOX(GHB_WIDGET(ud->builder, "subtitle_avail_lang")); GtkListBox *selected = GTK_LIST_BOX(GHB_WIDGET(ud->builder, "subtitle_selected_lang")); GtkListBoxRow *row; GtkWidget *label; row = gtk_list_box_get_selected_row(avail); if (row != NULL) { int idx; const iso639_lang_t *lang; GValue *glang, *lang_list; // Remove from UI available language list box label = gtk_bin_get_child(GTK_BIN(row)); g_object_ref(G_OBJECT(label)); gtk_widget_destroy(GTK_WIDGET(row)); gtk_widget_show(label); // Add to UI selected language list box gtk_list_box_insert(selected, label, -1); // Add to preset language list idx = (intptr_t)g_object_get_data(G_OBJECT(label), "lang_idx"); lang = ghb_iso639_lookup_by_int(idx); glang = ghb_string_value_new(lang->iso639_2); lang_list = ghb_settings_get_value(ud->settings, "SubtitleLanguageList"); if (ghb_array_len(lang_list) == 0) { subtitle_update_pref_lang(ud, lang); } ghb_array_append(lang_list, glang); ghb_clear_presets_selection(ud); } }
G_MODULE_EXPORT void x264_slider_changed_cb(GtkWidget *widget, signal_user_data_t *ud) { ghb_widget_to_setting(ud->x264_priv, widget); // Lock slider values to multiples of step_increment GtkAdjustment * adj = gtk_range_get_adjustment(GTK_RANGE(widget)); gdouble step = gtk_adjustment_get_step_increment(adj); gdouble val = gtk_range_get_value(GTK_RANGE(widget)); gdouble new_val = ((int)((val + step / 2) / step)) * step; gdouble diff = val - new_val; if ( diff > 0.0001 || diff < -0.0001 ) { gtk_range_set_value(GTK_RANGE(widget), new_val); } else if (!ignore_options_update) { ignore_options_update = TRUE; x264_opt_update(ud, widget); ignore_options_update = FALSE; } ghb_check_dependency(ud, widget, NULL); ghb_clear_presets_selection(ud); }
G_MODULE_EXPORT void subtitle_def_widget_changed_cb(GtkWidget *widget, signal_user_data_t *ud) { ghb_widget_to_setting(ud->settings, widget); ghb_clear_presets_selection(ud); }
G_MODULE_EXPORT void x264_setting_changed_cb(GtkWidget *widget, signal_user_data_t *ud) { static char *tt = NULL; if (tt == NULL) { GtkWidget *eo = GTK_WIDGET(GHB_WIDGET(ud->builder, "x264OptionExtra")); tt = gtk_widget_get_tooltip_text(eo); } ghb_widget_to_setting(ud->settings, widget); int x264Preset = ghb_settings_get_int(ud->settings, "x264PresetSlider"); const char *preset; preset = hb_video_encoder_get_presets(HB_VCODEC_X264)[x264Preset]; ghb_settings_set_string(ud->settings, "x264Preset", preset); if (!ghb_settings_get_boolean(ud->settings, "x264UseAdvancedOptions")) { GString *str = g_string_new(""); char *preset; char *tune; char *profile; char *level; char *opts; char *tunes; preset = ghb_settings_get_string(ud->settings, "x264Preset"); tune = ghb_settings_get_string(ud->settings, "x264Tune"); profile = ghb_settings_get_string(ud->settings, "h264Profile"); level = ghb_settings_get_string(ud->settings, "h264Level"); opts = ghb_settings_get_string(ud->settings, "x264OptionExtra"); if (tune[0] && strcmp(tune, "none")) { g_string_append_printf(str, "%s", tune); } if (ghb_settings_get_boolean(ud->settings, "x264FastDecode")) { g_string_append_printf(str, "%s%s", str->str[0] ? "," : "", "fastdecode"); } if (ghb_settings_get_boolean(ud->settings, "x264ZeroLatency")) { g_string_append_printf(str, "%s%s", str->str[0] ? "," : "", "zerolatency"); } tunes = g_string_free(str, FALSE); char * new_opts; int w = ghb_settings_get_int(ud->settings, "scale_width"); int h = ghb_settings_get_int(ud->settings, "scale_height"); if (w == 0 || h == 0) { if (!ghb_settings_get_boolean(ud->settings, "autoscale")) { w = ghb_settings_get_int(ud->settings, "PictureWidth"); h = ghb_settings_get_int(ud->settings, "PictureHeight"); if (h == 0 && w != 0) { h = w * 9 / 16; } if (w == 0 && h != 0) { w = h * 16 / 9; } } if (w == 0 || h == 0) { w = 1280; h = 720; } } if (!strcasecmp(profile, "auto")) { profile[0] = 0; } if (!strcasecmp(level, "auto")) { level[0] = 0; } new_opts = hb_x264_param_unparse( preset, tunes, opts, profile, level, w, h); if (new_opts) ghb_ui_update(ud, "x264Option", ghb_string_value(new_opts)); else ghb_ui_update(ud, "x264Option", ghb_string_value("")); GtkWidget *eo = GTK_WIDGET(GHB_WIDGET(ud->builder, "x264OptionExtra")); char * new_tt; if (new_opts) new_tt = g_strdup_printf("%s\n\nExpanded Options:\n\"%s\"", tt, new_opts); else new_tt = g_strdup_printf("%s\n\nExpanded Options:\n\"\"", tt); gtk_widget_set_tooltip_text(eo, new_tt); g_free(new_tt); g_free(new_opts); g_free(preset); g_free(tune); g_free(profile); g_free(level); g_free(opts); g_free(tunes); } else { char *opts = ghb_settings_get_string(ud->settings, "x264Option"); GtkWidget *eo = GTK_WIDGET(GHB_WIDGET(ud->builder, "x264OptionExtra")); char * new_tt; if (opts) new_tt = g_strdup_printf("%s\n\nExpanded Options:\n\"%s\"", tt, opts); else new_tt = g_strdup_printf("%s\n\nExpanded Options:\n\"\"", tt); gtk_widget_set_tooltip_text(eo, new_tt); g_free(new_tt); g_free(opts); } ghb_check_dependency(ud, widget, NULL); ghb_clear_presets_selection(ud); }