GtkWidget *widget;
gchar *text;
+ ud->dont_clear_presets = TRUE;
widget = GHB_WIDGET (ud->builder, "title_duration");
if (tinfo->duration != 0)
{
ghb_ui_update(ud, "PictureLeftCrop", ghb_int64_value(tinfo->crop[2]));
ghb_ui_update(ud, "PictureRightCrop", ghb_int64_value(tinfo->crop[3]));
}
- ghb_set_scale (ud, GHB_SCALE_KEEP_NONE);
+ ghb_set_scale (ud, GHB_PIC_KEEP_PAR);
gint width, height, crop[4];
crop[0] = ghb_settings_get_int(ud->settings, "PictureTopCrop");
crop[1] = ghb_settings_get_int(ud->settings, "PictureBottomCrop");
widget = GHB_WIDGET (ud->builder, "start_chapter");
gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), 1);
gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, tinfo->num_chapters);
+ ud->dont_clear_presets = TRUE;
}
static gboolean update_preview = FALSE;
g_debug("scale_width_changed_cb ()");
ghb_widget_to_setting(ud->settings, widget);
ghb_check_dependency(ud, widget);
+ ghb_clear_presets_selection(ud);
if (GTK_WIDGET_SENSITIVE(widget))
- ghb_set_scale (ud, GHB_SCALE_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");
g_debug("scale_height_changed_cb ()");
ghb_widget_to_setting(ud->settings, widget);
ghb_check_dependency(ud, widget);
+ ghb_clear_presets_selection(ud);
if (GTK_WIDGET_SENSITIVE(widget))
- ghb_set_scale (ud, GHB_SCALE_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");
g_debug("crop_changed_cb ()");
ghb_widget_to_setting(ud->settings, widget);
ghb_check_dependency(ud, widget);
+ ghb_clear_presets_selection(ud);
if (GTK_WIDGET_SENSITIVE(widget))
- ghb_set_scale (ud, GHB_SCALE_KEEP_NONE);
+ ghb_set_scale (ud, 0);
crop[0] = ghb_settings_get_int(ud->settings, "PictureTopCrop");
crop[1] = ghb_settings_get_int(ud->settings, "PictureBottomCrop");
ghb_clear_presets_selection(ud);
ghb_live_reset(ud);
if (GTK_WIDGET_SENSITIVE(widget))
- ghb_set_scale (ud, GHB_SCALE_KEEP_NONE);
+ ghb_set_scale (ud, GHB_PIC_KEEP_DISPLAY_WIDTH);
+
+ gint pic_par;
+
+ pic_par = ghb_settings_combo_int(ud->settings, "PicturePAR");
+ if (pic_par == 3)
+ {
+ gint par_width, par_height;
+
+ par_width = ghb_settings_get_int(ud->settings, "par_width");
+ par_height = ghb_settings_get_int(ud->settings, "par_height");
+ ghb_settings_set_int(ud->settings, "PicturePARWidth", par_width);
+ ghb_settings_set_int(ud->settings, "PicturePARHeight", par_height);
+ }
update_preview = TRUE;
}
ghb_clear_presets_selection(ud);
ghb_live_reset(ud);
if (GTK_WIDGET_SENSITIVE(widget))
- ghb_set_scale (ud, GHB_SCALE_KEEP_NONE);
+ ghb_set_scale (ud, GHB_PIC_KEEP_DISPLAY_HEIGHT);
+
+ gint pic_par;
+
+ pic_par = ghb_settings_combo_int(ud->settings, "PicturePAR");
+ if (pic_par == 3)
+ {
+ gint par_width, par_height;
+
+ par_width = ghb_settings_get_int(ud->settings, "par_width");
+ par_height = ghb_settings_get_int(ud->settings, "par_height");
+ ghb_settings_set_int(ud->settings, "PicturePARWidth", par_width);
+ ghb_settings_set_int(ud->settings, "PicturePARHeight", par_height);
+ }
update_preview = TRUE;
}
ghb_clear_presets_selection(ud);
ghb_live_reset(ud);
if (GTK_WIDGET_SENSITIVE(widget))
- ghb_set_scale (ud, GHB_SCALE_KEEP_NONE);
+ ghb_set_scale (ud, 0);
update_preview = TRUE;
gchar *text;
</packing>
</child>
<child>
- <object class="GtkLabel" id="pixel_aspect">
+ <object class="GtkLabel" id="par_width">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">--:--</property>
+ <property name="label" translatable="yes">--</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <object class="GtkLabel" id="pixel_aspect">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label" translatable="yes">:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="par_height">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label" translatable="yes">--</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
static void
picture_settings_deps(signal_user_data_t *ud)
{
- gboolean autoscale, keep_aspect;
+ gboolean autoscale, keep_aspect, enable_keep_aspect;
gboolean enable_scale_width, enable_scale_height;
gboolean enable_disp_width, enable_disp_height;
gint pic_par, disp_width, disp_height, scale_width, scale_height;
enable_scale_height = !autoscale && (pic_par != 1);
enable_disp_width = (pic_par == 3) && !keep_aspect;
enable_disp_height = FALSE;
+ enable_keep_aspect = (pic_par != 1 && pic_par != 2);
GtkWidget *widget;
widget = GHB_WIDGET(ud->builder, "scale_width");
gtk_widget_set_sensitive(widget, enable_disp_width);
widget = GHB_WIDGET(ud->builder, "PictureDisplayHeight");
gtk_widget_set_sensitive(widget, enable_disp_height);
+ widget = GHB_WIDGET(ud->builder, "PictureKeepRatio");
+ gtk_widget_set_sensitive(widget, enable_keep_aspect);
+ widget = GHB_WIDGET(ud->builder, "autoscale");
+ gtk_widget_set_sensitive(widget, pic_par != 1);
+ if (!enable_keep_aspect)
+ {
+ ghb_ui_update(ud, "PictureKeepRatio", ghb_boolean_value(TRUE));
+ }
+ if (pic_par == 1)
+ {
+ ghb_ui_update(ud, "autoscale", ghb_boolean_value(TRUE));
+ }
}
void
gint crop[4], width, height, par_width, par_height;
gint crop_width, crop_height;
gint aspect_n, aspect_d;
- gboolean keep_width = (mode == GHB_SCALE_KEEP_WIDTH);
- gboolean keep_height = (mode == GHB_SCALE_KEEP_HEIGHT);
+ gboolean keep_width = (mode & GHB_PIC_KEEP_WIDTH);
+ gboolean keep_height = (mode & GHB_PIC_KEEP_HEIGHT);
gint step;
GtkWidget *widget;
gint mod;
if (job->anamorphic.mode == 3 && !keep_aspect)
{
gint dar_width, dar_height;
- dar_width = ghb_settings_get_int(ud->settings, "PictureDisplayWidth");
- dar_height = ghb_settings_get_int(ud->settings, "PictureDisplayHeight");
+ if (mode & GHB_PIC_KEEP_PAR)
+ {
+ par_width = ghb_settings_get_int(ud->settings,
+ "PicturePARWidth");
+ par_height = ghb_settings_get_int(ud->settings,
+ "PicturePARHeight");
+ dar_width = ((gdouble)width * par_width / par_height) + 0.5;
+ dar_height = height;
+ }
+ else
+ {
+ dar_width = ghb_settings_get_int(ud->settings,
+ "PictureDisplayWidth");
+ dar_height = ghb_settings_get_int(ud->settings,
+ "PictureDisplayHeight");
+ }
job->anamorphic.dar_width = dar_width;
job->anamorphic.dar_height = dar_height;
}
gdouble par;
gint new_width, new_height;
- g_debug("kw %s kh %s\n", keep_width ? "y":"n", keep_height ? "y":"n");
- g_debug("w %d h %d\n", width, height);
// Compute pixel aspect ration.
par = (gdouble)(title->height * aspect_n) / (title->width * aspect_d);
// Must scale so that par becomes 1:1
gint disp_width, dar_width, dar_height;
gchar *str;
- disp_width = par_width * width / par_height;
+ disp_width = (gdouble)(width * par_width / par_height) + 0.5;
hb_reduce(&dar_width, &dar_height, disp_width, 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);
+ 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);
+ str = g_strdup_printf("%d : %d", dar_width, dar_height);
}
ghb_ui_update(ud, "display_aspect", ghb_string_value(str));
g_free(str);
- str = g_strdup_printf("%d:%d", par_width, par_height);
- ghb_ui_update(ud, "pixel_aspect", ghb_string_value(str));
- g_free(str);
+ ghb_ui_update(ud, "par_width", ghb_int64_value(par_width));
+ ghb_ui_update(ud, "par_height", ghb_int64_value(par_height));
ghb_ui_update(ud, "PictureDisplayWidth", ghb_int64_value(disp_width));
ghb_ui_update(ud, "PictureDisplayHeight", ghb_int64_value(height));
picture_settings_deps(ud);
ghb_instance_status_t queue;
} ghb_status_t;
-#define GHB_SCALE_KEEP_NONE 0
-#define GHB_SCALE_KEEP_WIDTH 1
-#define GHB_SCALE_KEEP_HEIGHT 2
+#define GHB_PIC_KEEP_WIDTH 0x01
+#define GHB_PIC_KEEP_HEIGHT 0x02
+#define GHB_PIC_KEEP_DISPLAY_WIDTH 0x04
+#define GHB_PIC_KEEP_DISPLAY_HEIGHT 0x08
+#define GHB_PIC_KEEP_DAR 0x10
+#define GHB_PIC_KEEP_PAR 0x20
typedef struct
{
void ghb_backend_scan(const gchar *path, gint titleindex, gint preview_count);
void ghb_backend_queue_scan(const gchar *path, gint titleindex);
gboolean ghb_get_title_info(ghb_title_info_t *tinfo, gint titleindex);
+void ghb_par_init(signal_user_data_t *ud);
void ghb_set_scale(signal_user_data_t *ud, gint mode);
GValue* ghb_get_chapters(gint titleindex);
void ghb_get_chapter_duration(gint ti, gint ii, gint *hh, gint *mm, gint *ss);
<true />
<key>autoscale</key>
<false />
+ <key>par_width</key>
+ <integer>0</integer>
+ <key>par_height</key>
+ <integer>0</integer>
<key>vquality_type_bitrate</key>
<false />
<key>vquality_type_constant</key>
<string>none</string>
<key>PictureDetelecineCustom</key>
<string></string>
+ <key>PicturePAR</key>
+ <integer>2</integer>
+ <key>PicturePARWidth</key>
+ <integer>853</integer>
+ <key>PicturePARHeight</key>
+ <integer>720</integer>
+ <key>PictureHeight</key>
+ <integer>0</integer>
+ <key>PictureWidth</key>
+ <integer>0</integer>
<key>SubtitlesForced</key>
<true />
<key>VideoFramerate</key>
<true />
<key>Mp4LargeFile</key>
<false />
- <key>PicturePAR</key>
- <integer>2</integer>
- <key>PictureHeight</key>
- <integer>0</integer>
- <key>PictureWidth</key>
- <integer>0</integer>
<key>AudioList</key>
<array>
<dict>
static void store_presets(void);
static void store_prefs(void);
+gint
+preset_path_cmp(gint *indices1, gint len1, gint *indices2, gint len2)
+{
+ gint ii;
+ for (ii = 0; ii < len1 && ii < len2; ii++)
+ {
+ if (indices1[ii] != indices2[ii])
+ return indices1[ii] - indices2[ii];
+ }
+ return len1 - len2;
+}
+
// This only handle limited depth
GtkTreePath*
ghb_tree_path_new_from_indices(gint *indices, gint len)
{
gboolean uses_max;
gint uses_pic;
- gint par;
+ gint par, par_width, par_height;
gint vqtype;
g_debug("import_xlat_preset ()");
preset_dict_get_value(dict, "UsesPictureSettings"));
par = ghb_value_int(preset_dict_get_value(dict, "PicturePAR"));
vqtype = ghb_value_int(preset_dict_get_value(dict, "VideoQualityType"));
+ par_width = ghb_value_int(preset_dict_get_value(dict, "PicturePARWidth"));
+ par_height = ghb_value_int(preset_dict_get_value(dict, "PicturePARHeight"));
+ ghb_dict_insert(dict, g_strdup("par_width"),
+ ghb_int_value_new(par_width));
+ ghb_dict_insert(dict, g_strdup("par_height"),
+ ghb_int_value_new(par_height));
if (uses_max || uses_pic == 2)
{
export_xlat_preset(GValue *dict)
{
gboolean autoscale, target, br, constant;
+ gint par_width, par_height;
g_debug("export_xlat_prest ()");
autoscale = ghb_value_boolean(preset_dict_get_value(dict, "autoscale"));
preset_dict_get_value(dict, "vquality_type_bitrate"));
constant = ghb_value_boolean(
preset_dict_get_value(dict, "vquality_type_constant"));
+ par_width = ghb_value_int(
+ preset_dict_get_value(dict, "par_width"));
+ par_height = ghb_value_int(
+ preset_dict_get_value(dict, "par_height"));
if (autoscale)
ghb_dict_insert(dict, g_strdup("UsesPictureSettings"),
ghb_dict_insert(dict, g_strdup("VideoQualityType"),
ghb_int_value_new(2));
}
+ ghb_dict_insert(dict, g_strdup("PicturePARWidth"),
+ ghb_int_value_new(par_width));
+ ghb_dict_insert(dict, g_strdup("PicturePARHeight"),
+ ghb_int_value_new(par_height));
ghb_dict_remove(dict, "UsesMaxPictureSettings");
ghb_dict_remove(dict, "autoscale");
ghb_dict_remove(dict, "vquality_type_target");
ghb_dict_remove(dict, "vquality_type_bitrate");
ghb_dict_remove(dict, "vquality_type_constant");
+ ghb_dict_remove(dict, "par_width");
+ ghb_dict_remove(dict, "par_height");
export_value_xlat(dict);
}
GValue *value;
gboolean autoscale;
gint *indices, len, count;
+ gint *def_indices, def_len;
const gchar *name;
gboolean replace = FALSE;
}
ghb_dict_insert(dict, g_strdup("PresetName"), ghb_string_value_new(name));
if (replace)
+ {
+ def_indices = presets_find_default(presetsPlist, &def_len);
+ if (def_indices != NULL &&
+ preset_path_cmp(indices, len, def_indices, def_len) != 0)
+ {
+ ghb_dict_insert(dict, g_strdup("Default"),
+ ghb_boolean_value_new(FALSE));
+ }
presets_list_update_item(ud, indices, len);
+ }
else
{
ghb_dict_insert(dict, g_strdup("Default"),
{
gint *indices, len;
gboolean expanded, folder;
+ GValue *dict;
expanded = gtk_tree_view_row_expanded(treeview, path);
indices = gtk_tree_path_get_indices(path);
len = gtk_tree_path_get_depth(path);
+ dict = presets_get_dict(presetsPlist, indices, len);
+ if (preset_folder_is_open(dict))
+ {
+ if (expanded)
+ return;
+ }
+ else if (!expanded)
+ {
+ return;
+ }
folder = ghb_presets_get_folder(presetsPlist, indices, len);
if (folder)
{
if (!expanded)
{
GValue *presets = NULL;
- GValue *dict;
gint *more_indices, count, ii;
more_indices = g_malloc((len+1)*sizeof(gint));
titleindex = ghb_settings_combo_int(ud->settings, "title");
ghb_set_pref_audio(titleindex, ud);
ghb_settings_set_boolean(ud->settings, "preset_modified", FALSE);
- ud->dont_clear_presets = FALSE;
if (ghb_get_title_info (&tinfo, titleindex))
{
preset_update_title_deps(ud, &tinfo);
}
- ghb_set_scale (ud, GHB_SCALE_KEEP_NONE);
+ ghb_set_scale (ud, GHB_PIC_KEEP_PAR);
+ ud->dont_clear_presets = FALSE;
gdouble vqmin, vqmax, step, page;
gint digits;