summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gtk/src/ghb.ui23
-rw-r--r--gtk/src/hb-backend.c18
-rw-r--r--gtk/src/internal_defaults.xml2
-rw-r--r--gtk/src/presets.c29
-rw-r--r--gtk/src/resource_data.h34
-rw-r--r--gtk/src/resources.plist25
6 files changed, 119 insertions, 12 deletions
diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui
index ce1db677d..ba66bcb13 100644
--- a/gtk/src/ghb.ui
+++ b/gtk/src/ghb.ui
@@ -3421,6 +3421,21 @@ auto-generated destination name.</property>
</packing>
</child>
<child>
+ <object class="GtkCheckButton" id="reduce_hd_preview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text"> Automatically reduce the size of High Definition previews.
+This is helpfull when working on laptops or similar
+non-hidef screens. </property>
+ <property name="label" translatable="yes">Scale down High Definition previews</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="pref_changed_cb"/>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkCheckButton" id="noscale">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -3434,7 +3449,7 @@ the required multiple.</property>
<signal name="toggled" handler="pref_changed_cb"/>
</object>
<packing>
- <property name="position">2</property>
+ <property name="position">3</property>
</packing>
</child>
<child>
@@ -3453,7 +3468,7 @@ this setting.</property>
<signal name="toggled" handler="vcodec_changed_cb"/>
</object>
<packing>
- <property name="position">3</property>
+ <property name="position">4</property>
</packing>
</child>
<child>
@@ -3464,7 +3479,7 @@ this setting.</property>
<signal name="toggled" handler="tweaks_changed_cb"/>
</object>
<packing>
- <property name="position">4</property>
+ <property name="position">5</property>
</packing>
</child>
<child>
@@ -3475,7 +3490,7 @@ this setting.</property>
<signal name="toggled" handler="hbfd_feature_changed_cb"/>
</object>
<packing>
- <property name="position">5</property>
+ <property name="position">6</property>
</packing>
</child>
</object>
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index b69083818..98c27dc20 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -3453,6 +3453,9 @@ ghb_pause_queue()
}
}
+#define RED_HEIGHT 720.0
+#define RED_WIDTH 1280.0
+
GdkPixbuf*
ghb_get_preview_image(
gint titleindex,
@@ -3589,6 +3592,21 @@ ghb_get_preview_image(
else
dstHeight = dstHeight * par_height / par_width;
}
+ if (ghb_settings_get_boolean(settings, "reduce_hd_preview"))
+ {
+ gdouble factor = 1.0;
+
+ if (dstHeight > RED_HEIGHT)
+ {
+ factor = RED_HEIGHT / (gdouble)dstHeight;
+ }
+ if (dstWidth * factor > RED_WIDTH)
+ {
+ factor = RED_WIDTH / (gdouble)dstWidth;
+ }
+ dstHeight = dstHeight * factor + 0.5;
+ dstWidth = dstWidth * factor + 0.5;
+ }
g_debug("scaled %d x %d\n", dstWidth, dstHeight);
GdkPixbuf *scaled_preview;
diff --git a/gtk/src/internal_defaults.xml b/gtk/src/internal_defaults.xml
index c445cdddf..282000051 100644
--- a/gtk/src/internal_defaults.xml
+++ b/gtk/src/internal_defaults.xml
@@ -98,6 +98,8 @@
<false />
<key>nocheckvquality</key>
<false />
+ <key>reduce_hd_preview</key>
+ <true />
<key>noscale</key>
<false />
<key>show_presets</key>
diff --git a/gtk/src/presets.c b/gtk/src/presets.c
index bb5e2e70f..cfea98699 100644
--- a/gtk/src/presets.c
+++ b/gtk/src/presets.c
@@ -1723,6 +1723,7 @@ export_subtitle_xlat2(GValue *lin_val)
gchar *str;
GValue *gval;
+ if (lin_val == NULL) return NULL;
str = ghb_value_string(lin_val);
if (strcmp(str, "none") == 0)
{
@@ -1770,6 +1771,7 @@ import_subtitle_xlat2(GValue *mac_val)
gchar *str;
GValue *gval;
+ if (mac_val == NULL) return NULL;
str = ghb_value_string(mac_val);
if (strcmp(str, "None") == 0)
{
@@ -1793,6 +1795,7 @@ export_audio_track_xlat2(GValue *lin_val)
gchar *str;
GValue *gval = NULL;
+ if (lin_val == NULL) return NULL;
str = ghb_value_string(lin_val);
if (strcmp(str, "none") == 0)
{
@@ -1814,6 +1817,7 @@ import_audio_track_xlat2(GValue *mac_val)
gchar *str;
GValue *gval;
+ if (mac_val == NULL) return NULL;
val = ghb_value_int(mac_val);
if (val <= 0)
{
@@ -2323,6 +2327,25 @@ ghb_presets_reload(signal_user_data_t *ud)
store_presets();
}
+static gboolean
+check_old_presets()
+{
+ gint count, ii;
+
+ count = ghb_array_len(presetsPlist);
+ for (ii = count-1; ii >= 0; ii--)
+ {
+ GValue *dict;
+ GValue *type;
+
+ dict = ghb_array_get_nth(presetsPlist, ii);
+ type = ghb_dict_lookup(dict, "Type");
+ if (type == NULL)
+ return TRUE;
+ }
+ return FALSE;
+}
+
void
ghb_presets_load()
{
@@ -2338,6 +2361,12 @@ ghb_presets_load()
presetsPlist = ghb_value_dup(ghb_resource_get("standard-presets"));
store_presets();
}
+ else if (check_old_presets())
+ {
+ ghb_value_free(presetsPlist);
+ presetsPlist = ghb_value_dup(ghb_resource_get("standard-presets"));
+ store_presets();
+ }
import_xlat_presets(presetsPlist);
}
diff --git a/gtk/src/resource_data.h b/gtk/src/resource_data.h
index a54b4ffa1..c6f06f6f9 100644
--- a/gtk/src/resource_data.h
+++ b/gtk/src/resource_data.h
@@ -5620,6 +5620,30 @@
" &lt;/child&gt;\n"
" &lt;child&gt;\n"
" &lt;object class=&quot;GtkCheckButton&quot; i"
+"d=&quot;reduce_hd_preview&quot;&gt;\n"
+" &lt;property name=&quot;visible&quot;&gt;Tr"
+"ue&lt;/property&gt;\n"
+" &lt;property name=&quot;can_focus&quot;&gt;"
+"True&lt;/property&gt;\n"
+" &lt;property name=&quot;tooltip_text&quot;&"
+"gt; Automatically reduce the size of High Definition previews.\n"
+"This is helpfull when working on laptops or similar\n"
+"non-hidef screens. &lt;/property&gt;\n"
+" &lt;property name=&quot;label&quot; transla"
+"table=&quot;yes&quot;&gt;Scale down High Definition previews&lt;/proper"
+"ty&gt;\n"
+" &lt;property name=&quot;draw_indicator&quot"
+";&gt;True&lt;/property&gt;\n"
+" &lt;signal name=&quot;toggled&quot; handler"
+"=&quot;pref_changed_cb&quot;/&gt;\n"
+" &lt;/object&gt;\n"
+" &lt;packing&gt;\n"
+" &lt;property name=&quot;position&quot;&gt;2"
+"&lt;/property&gt;\n"
+" &lt;/packing&gt;\n"
+" &lt;/child&gt;\n"
+" &lt;child&gt;\n"
+" &lt;object class=&quot;GtkCheckButton&quot; i"
"d=&quot;noscale&quot;&gt;\n"
" &lt;property name=&quot;visible&quot;&gt;Tr"
"ue&lt;/property&gt;\n"
@@ -5639,7 +5663,7 @@
"=&quot;pref_changed_cb&quot;/&gt;\n"
" &lt;/object&gt;\n"
" &lt;packing&gt;\n"
-" &lt;property name=&quot;position&quot;&gt;2"
+" &lt;property name=&quot;position&quot;&gt;3"
"&lt;/property&gt;\n"
" &lt;/packing&gt;\n"
" &lt;/child&gt;\n"
@@ -5666,7 +5690,7 @@
"=&quot;vcodec_changed_cb&quot;/&gt;\n"
" &lt;/object&gt;\n"
" &lt;packing&gt;\n"
-" &lt;property name=&quot;position&quot;&gt;3"
+" &lt;property name=&quot;position&quot;&gt;4"
"&lt;/property&gt;\n"
" &lt;/packing&gt;\n"
" &lt;/child&gt;\n"
@@ -5683,7 +5707,7 @@
"=&quot;tweaks_changed_cb&quot;/&gt;\n"
" &lt;/object&gt;\n"
" &lt;packing&gt;\n"
-" &lt;property name=&quot;position&quot;&gt;4"
+" &lt;property name=&quot;position&quot;&gt;5"
"&lt;/property&gt;\n"
" &lt;/packing&gt;\n"
" &lt;/child&gt;\n"
@@ -5700,7 +5724,7 @@
"=&quot;hbfd_feature_changed_cb&quot;/&gt;\n"
" &lt;/object&gt;\n"
" &lt;packing&gt;\n"
-" &lt;property name=&quot;position&quot;&gt;5"
+" &lt;property name=&quot;position&quot;&gt;6"
"&lt;/property&gt;\n"
" &lt;/packing&gt;\n"
" &lt;/child&gt;\n"
@@ -10114,6 +10138,8 @@
" <false />\n"
" <key>noscale</key>\n"
" <false />\n"
+" <key>reduce_hd_preview</key>\n"
+" <true />\n"
" <key>show_presets</key>\n"
" <true />\n"
" <key>use_source_name</key>\n"
diff --git a/gtk/src/resources.plist b/gtk/src/resources.plist
index 0dc6536a2..dccb730d1 100644
--- a/gtk/src/resources.plist
+++ b/gtk/src/resources.plist
@@ -3426,6 +3426,21 @@ auto-generated destination name.&lt;/property&gt;
&lt;/packing&gt;
&lt;/child&gt;
&lt;child&gt;
+ &lt;object class=&quot;GtkCheckButton&quot; id=&quot;reduce_hd_preview&quot;&gt;
+ &lt;property name=&quot;visible&quot;&gt;True&lt;/property&gt;
+ &lt;property name=&quot;can_focus&quot;&gt;True&lt;/property&gt;
+ &lt;property name=&quot;tooltip_text&quot;&gt; Automatically reduce the size of High Definition previews.
+This is helpfull when working on laptops or similar
+non-hidef screens. &lt;/property&gt;
+ &lt;property name=&quot;label&quot; translatable=&quot;yes&quot;&gt;Scale down High Definition previews&lt;/property&gt;
+ &lt;property name=&quot;draw_indicator&quot;&gt;True&lt;/property&gt;
+ &lt;signal name=&quot;toggled&quot; handler=&quot;pref_changed_cb&quot;/&gt;
+ &lt;/object&gt;
+ &lt;packing&gt;
+ &lt;property name=&quot;position&quot;&gt;2&lt;/property&gt;
+ &lt;/packing&gt;
+ &lt;/child&gt;
+ &lt;child&gt;
&lt;object class=&quot;GtkCheckButton&quot; id=&quot;noscale&quot;&gt;
&lt;property name=&quot;visible&quot;&gt;True&lt;/property&gt;
&lt;property name=&quot;can_focus&quot;&gt;True&lt;/property&gt;
@@ -3439,7 +3454,7 @@ the required multiple.&lt;/property&gt;
&lt;signal name=&quot;toggled&quot; handler=&quot;pref_changed_cb&quot;/&gt;
&lt;/object&gt;
&lt;packing&gt;
- &lt;property name=&quot;position&quot;&gt;2&lt;/property&gt;
+ &lt;property name=&quot;position&quot;&gt;3&lt;/property&gt;
&lt;/packing&gt;
&lt;/child&gt;
&lt;child&gt;
@@ -3458,7 +3473,7 @@ this setting.&lt;/property&gt;
&lt;signal name=&quot;toggled&quot; handler=&quot;vcodec_changed_cb&quot;/&gt;
&lt;/object&gt;
&lt;packing&gt;
- &lt;property name=&quot;position&quot;&gt;3&lt;/property&gt;
+ &lt;property name=&quot;position&quot;&gt;4&lt;/property&gt;
&lt;/packing&gt;
&lt;/child&gt;
&lt;child&gt;
@@ -3469,7 +3484,7 @@ this setting.&lt;/property&gt;
&lt;signal name=&quot;toggled&quot; handler=&quot;tweaks_changed_cb&quot;/&gt;
&lt;/object&gt;
&lt;packing&gt;
- &lt;property name=&quot;position&quot;&gt;4&lt;/property&gt;
+ &lt;property name=&quot;position&quot;&gt;5&lt;/property&gt;
&lt;/packing&gt;
&lt;/child&gt;
&lt;child&gt;
@@ -3480,7 +3495,7 @@ this setting.&lt;/property&gt;
&lt;signal name=&quot;toggled&quot; handler=&quot;hbfd_feature_changed_cb&quot;/&gt;
&lt;/object&gt;
&lt;packing&gt;
- &lt;property name=&quot;position&quot;&gt;5&lt;/property&gt;
+ &lt;property name=&quot;position&quot;&gt;6&lt;/property&gt;
&lt;/packing&gt;
&lt;/child&gt;
&lt;/object&gt;
@@ -4931,6 +4946,8 @@ R2RrUAAABBgBAQACAAAAQAAAABAAAAAQ////AP///wD///8A////AP///wD///8A////AP///wD///8A
<false />
<key>noscale</key>
<false />
+ <key>reduce_hd_preview</key>
+ <true />
<key>show_presets</key>
<true />
<key>use_source_name</key>