MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / ptop_widget_changed_cb

Function ptop_widget_changed_cb

gtk/src/callbacks.c:2925–2976  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2923}
2924
2925G_MODULE_EXPORT void
2926ptop_widget_changed_cb (GtkWidget *widget, gpointer data)
2927{
2928 gint title_id, titleindex;
2929 const hb_title_t * title;
2930 gboolean numeric = TRUE;
2931 GtkSpinButton *spin;
2932 GhbValue *range;
2933 signal_user_data_t *ud = ghb_ud();
2934
2935 ghb_widget_to_setting(ud->settings, widget);
2936 ghb_live_reset(ud);
2937
2938 // Update type in Job
2939 range = ghb_get_job_range_settings(ud->settings);
2940 ghb_dict_set_string(range, "Type",
2941 ghb_dict_get_string(ud->settings, "PtoPType"));
2942
2943 title_id = ghb_dict_get_int(ud->settings, "title");
2944 title = ghb_lookup_title(title_id, &titleindex);
2945 if (title == NULL)
2946 return;
2947
2948 if (ghb_settings_combo_int(ud->settings, "PtoPType") == 1)
2949 numeric = FALSE;
2950
2951 spin = GTK_SPIN_BUTTON(ghb_builder_widget("start_point"));
2952 gtk_spin_button_set_numeric(spin, numeric);
2953 spin = GTK_SPIN_BUTTON(ghb_builder_widget("end_point"));
2954 gtk_spin_button_set_numeric(spin, numeric);
2955
2956 gint duration = title->duration / 90000;
2957 if (ghb_settings_combo_int(ud->settings, "PtoPType") == 0)
2958 {
2959 GhbValue *chapter_list = ghb_get_job_chapter_list(ud->settings);
2960 gint num_chapters = ghb_array_len(chapter_list);
2961 spin_configure(ud, "start_point", 1, 1, num_chapters);
2962 spin_configure(ud, "end_point", num_chapters, 1, num_chapters);
2963 }
2964 else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 1)
2965 {
2966 spin_configure(ud, "start_point", 0, 0, duration * 2 - 1);
2967 spin_configure(ud, "end_point", duration, 0, duration * 2);
2968 }
2969 else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 2)
2970 {
2971 gdouble max_frames = (gdouble)duration *
2972 title->vrate.num / title->vrate.den;
2973 spin_configure(ud, "start_point", 1, 1, max_frames * 2);
2974 spin_configure(ud, "end_point", max_frames, 1, max_frames * 2);
2975 }
2976}
2977
2978G_MODULE_EXPORT void
2979setting_widget_changed_cb (GtkWidget *widget, gpointer data)

Callers

nothing calls this directly

Calls 12

ghb_udFunction · 0.85
ghb_widget_to_settingFunction · 0.85
ghb_live_resetFunction · 0.85
ghb_dict_set_stringFunction · 0.85
ghb_dict_get_stringFunction · 0.85
ghb_dict_get_intFunction · 0.85
ghb_lookup_titleFunction · 0.85
ghb_settings_combo_intFunction · 0.85
ghb_builder_widgetFunction · 0.85
ghb_get_job_chapter_listFunction · 0.85
spin_configureFunction · 0.85

Tested by

no test coverage detected