summaryrefslogtreecommitdiffstats
path: root/gtk/src
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2010-06-26 22:54:36 +0000
committerjstebbins <[email protected]>2010-06-26 22:54:36 +0000
commitc1d1825e1c8ecf71c70af93faa6431fbc6e4a059 (patch)
tree5c31f7357970b8ec7229eb7bf6fcaab3c1f72888 /gtk/src
parent1658fac57fd999452af0ab4f45c023c615783766 (diff)
LinGui: fix some issues with loading custom anamorphic settings from preset.
as the settings were incrementally loaded, each changing widget triggered updates that could conflict with the preset values being loaded. fix an issue with hight getting stuck at certain values. Incorrect rounding caused a recalculation that put height back to it's previous value. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3412 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src')
-rw-r--r--gtk/src/callbacks.c2
-rw-r--r--gtk/src/hb-backend.c29
-rw-r--r--gtk/src/presets.c4
-rw-r--r--gtk/src/settings.h1
4 files changed, 22 insertions, 14 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c
index 200e77f3d..0f2343f55 100644
--- a/gtk/src/callbacks.c
+++ b/gtk/src/callbacks.c
@@ -1408,6 +1408,7 @@ show_title_info(signal_user_data_t *ud, ghb_title_info_t *tinfo)
}
}
ud->dont_clear_presets = TRUE;
+ ud->scale_busy = TRUE;
update_title_duration(ud);
widget = GHB_WIDGET (ud->builder, "source_dimensions");
text = g_strdup_printf ("%d x %d", tinfo->width, tinfo->height);
@@ -1458,6 +1459,7 @@ show_title_info(signal_user_data_t *ud, ghb_title_info_t *tinfo)
ghb_ui_update(ud, "PictureLeftCrop", ghb_int64_value(tinfo->crop[2]));
ghb_ui_update(ud, "PictureRightCrop", ghb_int64_value(tinfo->crop[3]));
}
+ ud->scale_busy = FALSE;
ghb_set_scale (ud, GHB_PIC_KEEP_PAR);
gint width, height, crop[4];
crop[0] = ghb_settings_get_int(ud->settings, "PictureTopCrop");
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index 71b6850e7..81742f2ee 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -3579,7 +3579,6 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
gint mod;
gint max_width = 0;
gint max_height = 0;
- static gboolean busy = FALSE;
g_debug("ghb_set_scale ()\n");
picture_settings_deps(ud);
@@ -3593,13 +3592,13 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
gint titleindex;
titleindex = ghb_settings_combo_int(ud->settings, "title");
- title = hb_list_item( list, titleindex );
+ title = hb_list_item( list, titleindex );
if (title == NULL) return;
job = title->job;
if (job == NULL) return;
- if (busy) return;
- busy = TRUE;
+ if (ud->scale_busy) return;
+ ud->scale_busy = TRUE;
if (!ud->dont_clear_presets && (keep_width || keep_height))
{
@@ -3724,15 +3723,9 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
width = MOD_ROUND(width, mod);
height = MOD_ROUND(height, mod);
- // Adjust dims according to max values
- if (max_height)
- height = MIN(height, max_height);
- if (max_width)
- width = MIN(width, max_width);
-
+ job->anamorphic.mode = pic_par;
if (pic_par)
{
- job->anamorphic.mode = pic_par;
// The scaler crashes if the dimensions are not divisible by 2
// Align mod 2. And so does something in x264_encoder_headers()
job->modulus = mod;
@@ -3742,7 +3735,7 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
job->anamorphic.dar_height = 0;
if (keep_height && pic_par == 2)
- width = ((double)height * crop_width / crop_height) + mod / 2;
+ width = ((double)height * crop_width / crop_height);
job->width = width;
job->height = height;
job->maxWidth = max_width;
@@ -3771,6 +3764,9 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
{
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
+ // maxWidth and maxHeight
hb_set_anamorphic_size( job, &width, &height,
&par_width, &par_height );
if (job->anamorphic.mode == 3 && !keep_aspect &&
@@ -3787,7 +3783,12 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
}
else
{
- job->anamorphic.mode = pic_par;
+ // Adjust dims according to max values
+ if (max_height)
+ height = MIN(height, max_height);
+ if (max_width)
+ width = MIN(width, max_width);
+
if (keep_aspect)
{
gdouble par;
@@ -3866,7 +3867,7 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
ghb_ui_update(ud, "PicturePARHeight", ghb_int64_value(par_height));
ghb_ui_update(ud, "PictureDisplayWidth", ghb_int64_value(disp_width));
ghb_ui_update(ud, "PictureDisplayHeight", ghb_int64_value(height));
- busy = FALSE;
+ ud->scale_busy = FALSE;
}
static void
diff --git a/gtk/src/presets.c b/gtk/src/presets.c
index 3ac4606f3..1cb2b416b 100644
--- a/gtk/src/presets.c
+++ b/gtk/src/presets.c
@@ -4114,6 +4114,7 @@ ghb_refresh_preset(signal_user_data_t *ud)
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
@@ -4134,6 +4135,7 @@ ghb_refresh_preset(signal_user_data_t *ud)
{
preset_update_title_deps(ud, &tinfo);
}
+ ud->scale_busy = FALSE;
ghb_set_scale (ud, GHB_PIC_KEEP_PAR);
ud->dont_clear_presets = FALSE;
@@ -4192,6 +4194,7 @@ presets_list_selection_changed_cb(GtkTreeSelection *selection, signal_user_data_
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
@@ -4212,6 +4215,7 @@ presets_list_selection_changed_cb(GtkTreeSelection *selection, signal_user_data_
{
preset_update_title_deps(ud, &tinfo);
}
+ ud->scale_busy = FALSE;
ghb_set_scale (ud, GHB_PIC_KEEP_PAR);
ud->dont_clear_presets = FALSE;
diff --git a/gtk/src/settings.h b/gtk/src/settings.h
index 5ec717f0c..2f9640375 100644
--- a/gtk/src/settings.h
+++ b/gtk/src/settings.h
@@ -52,6 +52,7 @@ typedef struct
gchar *current_dvd_device;
gboolean debug;
gboolean dont_clear_presets;
+ gboolean scale_busy;
gint cancel_encode;
GtkBuilder *builder;
GValue *settings;