summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gtk/src/callbacks.c22
-rw-r--r--gtk/src/ghb.ui2
-rw-r--r--gtk/src/hb-backend.c196
-rw-r--r--gtk/src/hb-backend.h1
-rw-r--r--gtk/src/internal_defaults1
-rw-r--r--gtk/src/internal_defaults.h1
6 files changed, 143 insertions, 80 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c
index ce40e2998..13b23f8ec 100644
--- a/gtk/src/callbacks.c
+++ b/gtk/src/callbacks.c
@@ -1212,6 +1212,19 @@ setting_widget_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
}
void
+vcodec_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
+{
+ gint vqmin, vqmax;
+
+ ghb_widget_to_setting(ud->settings, widget);
+ check_depencency(ud, widget);
+ clear_presets_selection(ud);
+ ghb_vquality_range(ud, &vqmin, &vqmax);
+ GtkWidget *qp = GHB_WIDGET(ud->builder, "video_quality");
+ gtk_range_set_range (GTK_RANGE(qp), vqmin, vqmax);
+}
+
+void
vfr_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
//const gchar *name = gtk_widget_get_name(widget);
@@ -1949,6 +1962,11 @@ presets_list_selection_changed_cb(GtkTreeSelection *selection, signal_user_data_
sensitive = TRUE;
}
ud->dont_clear_presets = 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, "video_quality");
+ gtk_range_set_range (GTK_RANGE(qp), 0, 100);
ghb_set_preset(ud, preset);
gint titleindex = ghb_settings_get_int(ud->settings, "title");
set_pref_audio(titleindex, ud);
@@ -1958,6 +1976,10 @@ presets_list_selection_changed_cb(GtkTreeSelection *selection, signal_user_data_
preset_update_title_deps(ud, &tinfo);
}
ghb_set_scale (ud, GHB_SCALE_KEEP_NONE);
+
+ gint vqmin, vqmax;
+ ghb_vquality_range(ud, &vqmin, &vqmax);
+ gtk_range_set_range (GTK_RANGE(qp), vqmin, vqmax);
}
else
{
diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui
index 64a25f6b4..9314684ea 100644
--- a/gtk/src/ghb.ui
+++ b/gtk/src/ghb.ui
@@ -1548,7 +1548,7 @@
<child>
<object class="GtkComboBox" id="video_codec">
<property name="visible">True</property>
- <signal handler="setting_widget_changed_cb" name="changed"/>
+ <signal handler="vcodec_changed_cb" name="changed"/>
</object>
</child>
</object>
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index c5c9b6285..c36e182ed 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -439,6 +439,36 @@ ghb_version()
return HB_VERSION;
}
+void
+ghb_vquality_range(signal_user_data_t *ud, gint *min, gint *max)
+{
+ if (ghb_settings_get_bool(ud->settings, "directqp"))
+ {
+ gint vcodec = ghb_settings_get_int(ud->settings, "video_codec");
+ // Only x264 and ffmpeg currently support direct qp/crf entry
+ if (vcodec == HB_VCODEC_X264)
+ {
+ *min = 0;
+ *max = 51;
+ }
+ else if (vcodec == HB_VCODEC_FFMPEG)
+ {
+ *min = 0;
+ *max = 31;
+ }
+ else
+ {
+ *min = 0;
+ *max = 100;
+ }
+ }
+ else
+ {
+ *min = 0;
+ *max = 100;
+ }
+}
+
static setting_value_t*
get_acodec_value(gint val)
{
@@ -1889,13 +1919,8 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
{
width = crop_width;
height = crop_height;
-#if defined(ALLOW_UPSCALE)
- max_width = 0;
- max_height = 0;
-#else
max_width = crop_width;
max_height = crop_height;
-#endif
}
else
{
@@ -1913,19 +1938,7 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
}
if (!max_width)
{
-#if defined(ALLOW_UPSCALE)
- if (anamorphic)
- {
- max_width = crop_width;
- }
- else
- {
- gdouble par = (gdouble)(title->height * aspect_n) / (title->width * aspect_d);
- max_width = (crop_width * ((gdouble)max_height/crop_height) * par);
- }
-#else
max_width = crop_width;
-#endif
}
height = MIN(height, max_height);
width = MIN(width, max_width);
@@ -2311,45 +2324,59 @@ ghb_validate_vquality(GHashTable *settings)
{
gint vcodec;
gchar *message;
+ gint min, max;
if (ghb_settings_get_bool(settings, "nocheckvquality")) return TRUE;
vcodec = ghb_settings_get_int(settings, "video_codec");
if (ghb_settings_get_bool(settings, "vquality_type_constant"))
{
- gint vquality = ghb_settings_get_dbl(settings, "video_quality");
- if (vcodec != HB_VCODEC_X264 || ghb_settings_get_bool(settings, "linear_vquality"))
+ if (!ghb_settings_get_bool(settings, "directqp"))
{
- if (vquality < 68 || vquality > 97)
+ if (vcodec != HB_VCODEC_X264 ||
+ ghb_settings_get_bool(settings, "linear_vquality"))
{
- message = g_strdup_printf(
- "Interesting video quality choise: %d\n\n"
- "Typical values range from 68 (low) to 97 (high).\n"
- "Are you sure you wish to use this setting?",
- vquality);
- if (!ghb_message_dialog(GTK_MESSAGE_QUESTION, message, "Cancel", "Continue"))
- {
- g_free(message);
- return FALSE;
- }
- g_free(message);
+ min = 68;
+ max = 97;
+ }
+ else if (vcodec == HB_VCODEC_X264)
+ {
+ min = 40;
+ max = 70;
}
}
- else if (vcodec == HB_VCODEC_X264)
+ else
{
- if (vquality < 40 || vquality > 70)
+ if (vcodec == HB_VCODEC_X264)
+ {
+ min = 16;
+ max = 30;
+ }
+ else if (vcodec == HB_VCODEC_FFMPEG)
+ {
+ min = 1;
+ max = 8;
+ }
+ else
+ {
+ min = 68;
+ max = 97;
+ }
+ }
+ gint vquality = ghb_settings_get_dbl(settings, "video_quality");
+ if (vquality < min || vquality > max)
+ {
+ message = g_strdup_printf(
+ "Interesting video quality choise: %d\n\n"
+ "Typical values range from %d to %d.\n"
+ "Are you sure you wish to use this setting?",
+ vquality, min, max);
+ if (!ghb_message_dialog(GTK_MESSAGE_QUESTION, message,
+ "Cancel", "Continue"))
{
- message = g_strdup_printf(
- "Interesting video quality choise: %d\n\n"
- "Typical values range from 40 (low) to 70 (high).\n"
- "Are you sure you wish to use this setting?",
- vquality);
- if (!ghb_message_dialog(GTK_MESSAGE_QUESTION, message, "Cancel", "Continue"))
- {
- g_free(message);
- return FALSE;
- }
g_free(message);
+ return FALSE;
}
+ g_free(message);
}
}
return TRUE;
@@ -2504,28 +2531,32 @@ ghb_add_job(job_settings_t *js, gint unique_id)
}
if (ghb_settings_get_bool(settings, "vquality_type_constant"))
{
- gdouble vquality = ghb_settings_get_dbl(settings, "video_quality") / 100.0;
- if (ghb_settings_get_bool(settings, "linear_vquality"))
+ gdouble vquality = ghb_settings_get_dbl(settings, "video_quality");
+ if (!ghb_settings_get_bool(settings, "directqp"))
{
- if (job->vcodec == HB_VCODEC_X264)
+ vquality /= 100.0;
+ if (ghb_settings_get_bool(settings, "linear_vquality"))
{
- // Adjust to same range as xvid and ffmpeg
- vquality = 31.0 - vquality * 31.0;
- if (vquality > 0)
+ if (job->vcodec == HB_VCODEC_X264)
{
- // Convert linear to log curve
- vquality = 12 + 6 * log2(vquality);
- if (vquality > 51) vquality = 51;
- if (vquality < 1) vquality = 1;
+ // Adjust to same range as xvid and ffmpeg
+ vquality = 31.0 - vquality * 31.0;
+ if (vquality > 0)
+ {
+ // Convert linear to log curve
+ vquality = 12 + 6 * log2(vquality);
+ if (vquality > 51) vquality = 51;
+ if (vquality < 1) vquality = 1;
+ }
+ else
+ vquality = 0;
}
- else
- vquality = 0;
}
- }
- else
- {
- if (vquality == 0.0) vquality = 0.01;
- if (vquality == 1.0) vquality = 0.0;
+ else
+ {
+ if (vquality == 0.0) vquality = 0.01;
+ if (vquality == 1.0) vquality = 0.0;
+ }
}
job->vquality = vquality;
job->vbitrate = 0;
@@ -2837,20 +2868,6 @@ ghb_get_preview_image(gint titleindex, gint index, GHashTable *settings, gboolea
if (title->job == NULL) return NULL;
set_job_picture_settings(title->job, settings);
-#if defined(ALLOW_UPSCALE)
- gdouble scale = 1;
- if (title->job->width > title->width)
- scale = (gdouble) title->job->width / title->width;
- if (title->job->height > title->height)
- {
- gdouble tmp;
- tmp = (gdouble) title->job->height / title->height;
- if (tmp > scale)
- scale = tmp;
- }
- title->job->width /= scale;
- title->job->height /= scale;
-#else
// hb_get_preview can't handle sizes that are larger than the original title
// dimensions
if (title->job->width > title->width)
@@ -2858,7 +2875,6 @@ ghb_get_preview_image(gint titleindex, gint index, GHashTable *settings, gboolea
if (title->job->height > title->height)
title->job->height = title->height;
-#endif
// And also creates artifacts if the width is not a multiple of 8
//title->job->width = ((title->job->width + 4) >> 3) << 3;
// And the height must be a multiple of 2
@@ -2967,10 +2983,6 @@ ghb_get_preview_image(gint titleindex, gint index, GHashTable *settings, gboolea
else
dstHeight = dstHeight * par_height / par_width;
}
-#if defined(ALLOW_UPSCALE)
- dstWidth = ((gdouble)dstWidth + scale/2) * scale;
- dstHeight = ((gdouble)dstHeight + scale/2) * scale;
-#endif
g_debug("scaled %d x %d\n", dstWidth, dstHeight);
GdkPixbuf *scaled_preview;
@@ -2979,6 +2991,31 @@ ghb_get_preview_image(gint titleindex, gint index, GHashTable *settings, gboolea
return scaled_preview;
}
+static void
+sanitize_volname(gchar *name)
+{
+ gchar *a, *b;
+
+ a = b = name;
+ while (*b)
+ {
+ switch(*b)
+ {
+ case '<':
+ b++;
+ break;
+ case '>':
+ b++;
+ break;
+ default:
+ *a = *b;
+ a++; b++;
+ break;
+ }
+ }
+ *a = 0;
+}
+
gchar*
ghb_dvd_volname(const gchar *device)
{
@@ -2986,6 +3023,7 @@ ghb_dvd_volname(const gchar *device)
name = hb_dvd_name((gchar*)device);
if (name != NULL)
{
+ sanitize_volname(name);
return g_strdup(name);
}
return name;
diff --git a/gtk/src/hb-backend.h b/gtk/src/hb-backend.h
index 0c8a021a8..9c723b7b6 100644
--- a/gtk/src/hb-backend.h
+++ b/gtk/src/hb-backend.h
@@ -60,6 +60,7 @@ typedef struct
#define GHB_FRAMERATE 3
const gchar* ghb_version();
+void ghb_vquality_range(signal_user_data_t *ud, gint *min, gint *max);
//const gchar* ghb_get_rate_string(gint rate, gint type);
void ghb_backend_init(GtkBuilder *builder, gint debug, gint update);
void ghb_add_job(job_settings_t *js, gint unique_id);
diff --git a/gtk/src/internal_defaults b/gtk/src/internal_defaults
index ca910ba9c..7966959cb 100644
--- a/gtk/src/internal_defaults
+++ b/gtk/src/internal_defaults
@@ -61,6 +61,7 @@ x264_me=umh
x264_deblock_alpha=0
x264_mixed_refs=disable
x264_trellis=off
+directqp=disable
[Initialization]
title=none
diff --git a/gtk/src/internal_defaults.h b/gtk/src/internal_defaults.h
index ff5b1f8de..4bb097a22 100644
--- a/gtk/src/internal_defaults.h
+++ b/gtk/src/internal_defaults.h
@@ -61,6 +61,7 @@
"x264_deblock_alpha=0\n"
"x264_mixed_refs=disable\n"
"x264_trellis=off\n"
+"directqp=disable\n"
"\n"
"[Initialization]\n"
"title=none\n"