summaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2014-08-12 18:46:41 +0000
committerjstebbins <[email protected]>2014-08-12 18:46:41 +0000
commitff76bd13570c15142cff445dbdcb3cd64a2838a0 (patch)
tree09963d99906b830908e7505b09a0a90d886cd6b1 /gtk
parentc89c057ec2e7601f885aafb830732385ece5c59d (diff)
LinGui: generalize video preset/tune/profile/level handling
This generalization enables x265 preset/tune/profile/level which did not work previously. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6293 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk')
-rw-r--r--gtk/src/Makefile.am2
-rw-r--r--gtk/src/callbacks.c38
-rw-r--r--gtk/src/callbacks.h4
-rw-r--r--gtk/src/ghb.ui151
-rw-r--r--gtk/src/hb-backend.c91
-rw-r--r--gtk/src/internal_defaults.xml14
-rw-r--r--gtk/src/main.c13
-rw-r--r--gtk/src/makedeps.py19
-rw-r--r--gtk/src/presets.c76
-rw-r--r--gtk/src/queuehandler.c82
-rw-r--r--gtk/src/standard_presets.xml144
-rw-r--r--gtk/src/x264handler.c212
12 files changed, 293 insertions, 553 deletions
diff --git a/gtk/src/Makefile.am b/gtk/src/Makefile.am
index 2ad120755..ee61e2122 100644
--- a/gtk/src/Makefile.am
+++ b/gtk/src/Makefile.am
@@ -37,6 +37,8 @@ ghb_SOURCES = \
callbacks.h \
queuehandler.c \
queuehandler.h \
+ videohandler.c \
+ videohandler.h \
audiohandler.c \
audiohandler.h \
subtitlehandler.c \
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c
index 7475f478d..ce29afac4 100644
--- a/gtk/src/callbacks.c
+++ b/gtk/src/callbacks.c
@@ -981,7 +981,7 @@ update_title_duration(signal_user_data_t *ud)
g_free(text);
}
-static void show_container_options(signal_user_data_t *ud)
+void ghb_show_container_options(signal_user_data_t *ud)
{
GtkWidget *w1, *w2, *w3;
w1 = GHB_WIDGET(ud->builder, "Mp4LargeFile");
@@ -1029,8 +1029,8 @@ spin_configure(signal_user_data_t *ud, char *name, double val, double min, doubl
adjustment_configure(adj, val, min, max, step, page, page_sz);
}
-static void
-scale_configure(
+void
+ghb_scale_configure(
signal_user_data_t *ud,
char *name,
double val, double min, double max,
@@ -1122,8 +1122,8 @@ ghb_set_widget_ranges(signal_user_data_t *ud, GValue *settings)
ghb_vquality_range(ud, &vqmin, &vqmax, &step, &page, &digits, &inverted);
val = ghb_settings_get_double(ud->settings, "VideoQualitySlider");
- scale_configure(ud, "VideoQualitySlider", val, vqmin, vqmax,
- step, page, digits, inverted);
+ ghb_scale_configure(ud, "VideoQualitySlider", val, vqmin, vqmax,
+ step, page, digits, inverted);
}
static void
@@ -1191,7 +1191,7 @@ ghb_load_settings(signal_user_data_t * ud)
ghb_set_widget_ranges(ud, ud->settings);
ghb_check_all_depencencies(ud);
- show_container_options(ud);
+ ghb_show_container_options(ud);
check_chapter_markers(ud);
ghb_settings_to_ui(ud, ud->settings);
@@ -1634,7 +1634,7 @@ container_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
g_debug("container_changed_cb ()");
ghb_widget_to_setting(ud->settings, widget);
ghb_check_dependency(ud, widget, NULL);
- show_container_options(ud);
+ ghb_show_container_options(ud);
update_acodec(ud);
ghb_update_destination_extension(ud);
ghb_clear_presets_selection(ud);
@@ -2136,7 +2136,7 @@ vquality_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
double vquality = ghb_settings_get_double(ud->settings, "VideoQualitySlider");
if (vquality < 1.0)
{
- ghb_ui_update(ud, "h264Profile", ghb_string_value("auto"));
+ ghb_ui_update(ud, "VideoProfile", ghb_string_value("auto"));
}
gint vcodec;
@@ -2168,24 +2168,6 @@ http_opt_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
ghb_grey_combo_options (ud);
}
-G_MODULE_EXPORT void
-vcodec_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
-{
- float val, vqmin, vqmax, step, page;
- int inverted, digits;
-
- ghb_widget_to_setting(ud->settings, widget);
- ghb_check_dependency(ud, widget, NULL);
- show_container_options(ud);
- ghb_clear_presets_selection(ud);
- ghb_live_reset(ud);
-
- val = ghb_vquality_default(ud);
- ghb_vquality_range(ud, &vqmin, &vqmax, &step, &page, &digits, &inverted);
- scale_configure(ud, "VideoQualitySlider", val, vqmin, vqmax,
- step, page, digits, inverted);
-}
-
G_MODULE_EXPORT gboolean
ptop_input_cb(GtkWidget *widget, gdouble *val, signal_user_data_t *ud)
{
@@ -4063,8 +4045,8 @@ vqual_granularity_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
ghb_vquality_range(ud, &vqmin, &vqmax, &step, &page, &digits, &inverted);
val = ghb_settings_get_double(ud->settings, "VideoQualitySlider");
- scale_configure(ud, "VideoQualitySlider", val, vqmin, vqmax,
- step, page, digits, inverted);
+ ghb_scale_configure(ud, "VideoQualitySlider", val, vqmin, vqmax,
+ step, page, digits, inverted);
}
G_MODULE_EXPORT void
diff --git a/gtk/src/callbacks.h b/gtk/src/callbacks.h
index b2adb0687..ce5ae3b9b 100644
--- a/gtk/src/callbacks.h
+++ b/gtk/src/callbacks.h
@@ -82,6 +82,10 @@ void ghb_chapter_list_refresh_all(signal_user_data_t *ud);
void ghb_load_settings(signal_user_data_t * ud);
void ghb_set_current_title_settings(signal_user_data_t *ud);
void ghb_container_empty(GtkContainer *c);
+void ghb_show_container_options(signal_user_data_t *ud);
+void ghb_scale_configure(signal_user_data_t *ud, char *name, double val,
+ double min, double max, double step, double page,
+ int digits, gboolean inverted);
#endif // _CALLBACKS_H_
diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui
index 3a2563f7b..e61d2b0a3 100644
--- a/gtk/src/ghb.ui
+++ b/gtk/src/ghb.ui
@@ -1378,6 +1378,7 @@ This is often the feature title of a DVD.</property>
<object class="GtkGrid" id="table4">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="margin-bottom">6</property>
<child>
<object class="GtkLabel" id="label18">
<property name="visible">True</property>
@@ -3726,7 +3727,7 @@ This allows a player to initiate playback before downloading the entire file.</p
<property name="left_padding">24</property>
<property name="right_padding">24</property>
<child>
- <object class="GtkBox" id="x264VideoSettings">
+ <object class="GtkBox" id="VideoSettings">
<property name="orientation">vertical</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -3753,25 +3754,19 @@ This allows a player to initiate playback before downloading the entire file.</p
</packing>
</child>
<child>
- <object class="GtkGrid" id="x264VideoSettingsTable">
+ <object class="GtkGrid" id="VideoSettingsTable">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="column_spacing">5</property>
<property name="row_spacing">2</property>
<child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <object class="GtkLabel" id="x264PresetLabel">
+ <object class="GtkLabel" id="VideoPresetLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">x264 Preset:</property>
+ <property name="label" translatable="yes">Preset:</property>
</object>
<packing>
<property name="top_attach">0</property>
@@ -3781,7 +3776,7 @@ This allows a player to initiate playback before downloading the entire file.</p
</packing>
</child>
<child>
- <object class="GtkScale" id="x264PresetSlider">
+ <object class="GtkScale" id="VideoPresetSlider">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
@@ -3791,12 +3786,12 @@ This allows a player to initiate playback before downloading the entire file.</p
Tunes, profiles, levels and advanced option string will be applied to this.
You should generally set this option to the slowest you can bear since slower
settings will result in better quality or smaller files.</property>
- <property name="adjustment">x264PresetRange</property>
+ <property name="adjustment">VideoPresetRange</property>
<property name="digits">0</property>
<property name="value_pos">right</property>
<property name="hexpand">True</property>
- <signal name="format-value" handler="format_x264_preset_cb" swapped="no"/>
- <signal name="value-changed" handler="x264_setting_changed_cb" swapped="no"/>
+ <signal name="format-value" handler="format_video_preset_cb" swapped="no"/>
+ <signal name="value-changed" handler="video_setting_changed_cb" swapped="no"/>
</object>
<packing>
<property name="top_attach">0</property>
@@ -3806,12 +3801,14 @@ This allows a player to initiate playback before downloading the entire file.</p
</packing>
</child>
<child>
- <object class="GtkLabel" id="x264TuneLabel">
+ <object class="GtkLabel" id="VideoTuneLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">x264 Tune:</property>
+ <property name="label" translatable="yes">Tune:</property>
+ <property name="margin_top">8</property>
+ <property name="margin_bottom">8</property>
</object>
<packing>
<property name="top_attach">1</property>
@@ -3821,7 +3818,7 @@ This allows a player to initiate playback before downloading the entire file.</p
</packing>
</child>
<child>
- <object class="GtkComboBox" id="x264Tune">
+ <object class="GtkComboBox" id="VideoTune">
<property name="visible">True</property>
<property name="valign">GTK_ALIGN_CENTER</property>
<property name="can_focus">False</property>
@@ -3831,7 +3828,7 @@ This allows a player to initiate playback before downloading the entire file.</p
This can improve effeciency for particular source characteristics or set
characteristics of the output file. Changes will be applied after the
preset but before all other parameters.</property>
- <signal name="changed" handler="x264_setting_changed_cb" swapped="no"/>
+ <signal name="changed" handler="video_setting_changed_cb" swapped="no"/>
</object>
<packing>
<property name="top_attach">1</property>
@@ -3851,9 +3848,9 @@ This allows a player to initiate playback before downloading the entire file.</p
Set this if your device is struggling to play the output (dropped frames).</property>
<property name="xalign">0</property>
- <property name="margin_left">20</property>
+ <property name="margin_left">2</property>
<property name="draw_indicator">True</property>
- <signal name="toggled" handler="x264_setting_changed_cb" swapped="no"/>
+ <signal name="toggled" handler="video_setting_changed_cb" swapped="no"/>
</object>
<packing>
<property name="top_attach">1</property>
@@ -3864,6 +3861,7 @@ This allows a player to initiate playback before downloading the entire file.</p
</child>
<child>
<object class="GtkCheckButton" id="x264ZeroLatency">
+ <property name="visible">False</property>
<property name="label" translatable="yes">Zero Latency</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -3875,9 +3873,9 @@ This allows a player to initiate playback before downloading the entire file.</p
Since HandBrake is not suitable for live stream broadcast purposes,
this setting is of little value here.</property>
<property name="xalign">0</property>
- <property name="margin_left">20</property>
+ <property name="margin_left">2</property>
<property name="draw_indicator">True</property>
- <signal name="toggled" handler="x264_setting_changed_cb" swapped="no"/>
+ <signal name="toggled" handler="video_setting_changed_cb" swapped="no"/>
</object>
<packing>
<property name="top_attach">1</property>
@@ -3887,12 +3885,14 @@ This allows a player to initiate playback before downloading the entire file.</p
</packing>
</child>
<child>
- <object class="GtkLabel" id="h264ProfileLabel">
+ <object class="GtkLabel" id="VideoProfileLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">H.264 Profile:</property>
+ <property name="label" translatable="yes">Profile:</property>
+ <property name="margin_top">8</property>
+ <property name="margin_bottom">8</property>
</object>
<packing>
<property name="top_attach">2</property>
@@ -3902,7 +3902,7 @@ This allows a player to initiate playback before downloading the entire file.</p
</packing>
</child>
<child>
- <object class="GtkComboBox" id="h264Profile">
+ <object class="GtkComboBox" id="VideoProfile">
<property name="visible">True</property>
<property name="valign">GTK_ALIGN_CENTER</property>
<property name="can_focus">False</property>
@@ -3910,7 +3910,7 @@ This allows a player to initiate playback before downloading the entire file.</p
<property name="tooltip_text" translatable="yes">Limit the H.264 profile of the output stream.
Overrides all other settings.</property>
- <signal name="changed" handler="x264_setting_changed_cb" swapped="no"/>
+ <signal name="changed" handler="video_setting_changed_cb" swapped="no"/>
</object>
<packing>
<property name="top_attach">2</property>
@@ -3920,12 +3920,14 @@ This allows a player to initiate playback before downloading the entire file.</p
</packing>
</child>
<child>
- <object class="GtkLabel" id="h264LevelLabel">
+ <object class="GtkLabel" id="VideoLevelLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">H.264 Level:</property>
+ <property name="label" translatable="yes">Level:</property>
+ <property name="margin_top">8</property>
+ <property name="margin_bottom">8</property>
</object>
<packing>
<property name="top_attach">3</property>
@@ -3935,7 +3937,7 @@ This allows a player to initiate playback before downloading the entire file.</p
</packing>
</child>
<child>
- <object class="GtkComboBox" id="h264Level">
+ <object class="GtkComboBox" id="VideoLevel">
<property name="visible">True</property>
<property name="valign">GTK_ALIGN_CENTER</property>
<property name="can_focus">False</property>
@@ -3943,7 +3945,7 @@ This allows a player to initiate playback before downloading the entire file.</p
<property name="tooltip_text" translatable="yes">Sets and ensures compliance with the specified H.264 level.
Overrides all other settings.</property>
- <signal name="changed" handler="x264_setting_changed_cb" swapped="no"/>
+ <signal name="changed" handler="video_setting_changed_cb" swapped="no"/>
</object>
<packing>
<property name="top_attach">3</property>
@@ -3960,7 +3962,7 @@ This allows a player to initiate playback before downloading the entire file.</p
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="spacing">5</property>
<child>
- <object class="GtkLabel" id="x264OptionExtraLabel">
+ <object class="GtkLabel" id="VideoOptionExtraLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
@@ -3975,13 +3977,13 @@ This allows a player to initiate playback before downloading the entire file.</p
</packing>
</child>
<child>
- <object class="GtkScrolledWindow" id="scrolledwindow8">
+ <object class="GtkScrolledWindow" id="VideoOptionExtraWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">etched-in</property>
<property name="hexpand">True</property>
<child>
- <object class="GtkTextView" id="x264OptionExtra">
+ <object class="GtkTextView" id="VideoOptionExtra">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Additional x264 settings.
@@ -6046,87 +6048,6 @@ This allows a player to initiate playback before downloading the entire file.</p
<property name="position">0</property>
</packing>
</child>
- <child>
- <object class="GtkBox" id="lavc_mpeg4_box">
- <property name="orientation">vertical</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <child>
- <object class="GtkBox" id="hbox86">
- <property name="orientation">horizontal</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="spacing">2</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkFrame" id="frame18">
- <property name="visible">True</property>
- <property name="can_focus">False</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_xalign">0</property>
- <property name="shadow_type">none</property>
- <child>
- <object class="GtkAlignment" id="alignment33">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="top_padding">6</property>
- <property name="bottom_padding">2</property>
- <property name="left_padding">12</property>
- <property name="right_padding">2</property>
- <child>
- <object class="GtkScrolledWindow" id="scrolledwindow7">
- <property name="height_request">40</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="shadow_type">etched-in</property>
- <child>
- <object class="GtkTextView" id="lavcOption">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="tooltip_text" translatable="yes">Your selected options will appear here.
- You can edit these and add additional options.</property>
- <property name="wrap_mode">char</property>
- <property name="accepts_tab">False</property>
- <signal name="focus-out-event" handler="lavc_focus_out_cb" swapped="no"/>
- </object>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="label75">
- <property name="visible">True</property>
- <property name="can_focus">False</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">&lt;small&gt;&lt;b&gt;Current FFMpeg Advanced Option String&lt;/b&gt;&lt;/small&gt;</property>
- <property name="use_markup">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="padding">2</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
</object>
<packing>
<property name="position">7</property>
@@ -9883,7 +9804,7 @@ DRC allows you to 'compress' the range by making loud sounds softer and soft sou
<action-widget response="0">update_remind</action-widget>
</action-widgets>
</object>
- <object class="GtkAdjustment" id="x264PresetRange">
+ <object class="GtkAdjustment" id="VideoPresetRange">
<property name="upper">1</property>
<property name="step_increment">1</property>
<property name="page_increment">1</property>
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index 8b234c7c0..95266122a 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -33,6 +33,7 @@
#include "callbacks.h"
#include "subtitlehandler.h"
#include "audiohandler.h"
+#include "videohandler.h"
#include "x264handler.h"
#include "preview.h"
#include "values.h"
@@ -2012,18 +2013,26 @@ ghb_lookup_queue_title(int title_id, int *index)
}
static void
-x264_tune_opts_set(GtkBuilder *builder, const gchar *name)
+video_tune_opts_set(signal_user_data_t *ud, const gchar *name)
{
GtkTreeIter iter;
GtkListStore *store;
gint ii, count = 0;
+ // Check if encoder has been set yet.
+ // If not, bail
+ GValue *value = ghb_dict_lookup(ud->settings, "VideoEncoder");
+ if (value == NULL) return;
+
+ int encoder = ghb_get_video_encoder(ud->settings);
const char * const *tunes;
- tunes = hb_video_encoder_get_tunes(HB_VCODEC_X264);
+ tunes = hb_video_encoder_get_tunes(encoder);
+
while (tunes && tunes[count]) count++;
+ if (count == 0) return;
- g_debug("x264_tune_opts_set ()\n");
- GtkComboBox *combo = GTK_COMBO_BOX(GHB_WIDGET(builder, name));
+ g_debug("video_tune_opts_set ()\n");
+ GtkComboBox *combo = GTK_COMBO_BOX(GHB_WIDGET(ud->builder, name));
store = GTK_LIST_STORE(gtk_combo_box_get_model (combo));
gtk_list_store_clear(store);
@@ -2053,18 +2062,26 @@ x264_tune_opts_set(GtkBuilder *builder, const gchar *name)
}
static void
-h264_profile_opts_set(GtkBuilder *builder, const gchar *name)
+video_profile_opts_set(signal_user_data_t *ud, const gchar *name)
{
GtkTreeIter iter;
GtkListStore *store;
gint ii, count = 0;
+ // Check if encoder has been set yet.
+ // If not, bail
+ GValue *value = ghb_dict_lookup(ud->settings, "VideoEncoder");
+ if (value == NULL) return;
+
+ int encoder = ghb_get_video_encoder(ud->settings);
const char * const *profiles;
- profiles = hb_video_encoder_get_profiles(HB_VCODEC_X264);
+ profiles = hb_video_encoder_get_profiles(encoder);
+
while (profiles && profiles[count]) count++;
+ if (count == 0) return;
- g_debug("h264_profile_opts_set ()\n");
- GtkComboBox *combo = GTK_COMBO_BOX(GHB_WIDGET(builder, name));
+ g_debug("video_profile_opts_set ()\n");
+ GtkComboBox *combo = GTK_COMBO_BOX(GHB_WIDGET(ud->builder, name));
store = GTK_LIST_STORE(gtk_combo_box_get_model (combo));
gtk_list_store_clear(store);
@@ -2082,18 +2099,26 @@ h264_profile_opts_set(GtkBuilder *builder, const gchar *name)
}
static void
-h264_level_opts_set(GtkBuilder *builder, const gchar *name)
+video_level_opts_set(signal_user_data_t *ud, const gchar *name)
{
GtkTreeIter iter;
GtkListStore *store;
gint ii, count = 0;
+ // Check if encoder has been set yet.
+ // If not, bail
+ GValue *value = ghb_dict_lookup(ud->settings, "VideoEncoder");
+ if (value == NULL) return;
+
+ int encoder = ghb_get_video_encoder(ud->settings);
const char * const *levels;
- levels = hb_video_encoder_get_levels(HB_VCODEC_X264);
+ levels = hb_video_encoder_get_levels(encoder);
+
while (levels && levels[count]) count++;
+ if (count == 0) return;
- g_debug("h264_level_opts_set ()\n");
- GtkComboBox *combo = GTK_COMBO_BOX(GHB_WIDGET(builder, name));
+ g_debug("video_level_opts_set ()\n");
+ GtkComboBox *combo = GTK_COMBO_BOX(GHB_WIDGET(ud->builder, name));
store = GTK_LIST_STORE(gtk_combo_box_get_model (combo));
gtk_list_store_clear(store);
@@ -2565,9 +2590,9 @@ ghb_update_ui_combo_box(
small_opts_set(ud->builder, "x264_subme", &subme_opts);
small_opts_set(ud->builder, "x264_analyse", &analyse_opts);
small_opts_set(ud->builder, "x264_trellis", &trellis_opts);
- x264_tune_opts_set(ud->builder, "x264Tune");
- h264_profile_opts_set(ud->builder, "h264Profile");
- h264_level_opts_set(ud->builder, "h264Level");
+ video_tune_opts_set(ud, "VideoTune");
+ video_profile_opts_set(ud, "VideoProfile");
+ video_level_opts_set(ud, "VideoLevel");
container_opts_set(ud->builder, "FileFormat");
}
else
@@ -2596,12 +2621,12 @@ ghb_update_ui_combo_box(
subtitle_track_opts_set(ud->builder, "SubtitleTrack", user_data);
else if (strcmp(name, "AudioTrack") == 0)
audio_track_opts_set(ud->builder, "AudioTrack", user_data);
- else if (strcmp(name, "x264Tune") == 0)
- x264_tune_opts_set(ud->builder, "x264Tune");
- else if (strcmp(name, "h264Profile") == 0)
- h264_profile_opts_set(ud->builder, "h264Profile");
- else if (strcmp(name, "h264Level") == 0)
- h264_level_opts_set(ud->builder, "h264Level");
+ else if (strcmp(name, "VideoTune") == 0)
+ video_tune_opts_set(ud, "VideoTune");
+ else if (strcmp(name, "VideoProfile") == 0)
+ video_profile_opts_set(ud, "VideoProfile");
+ else if (strcmp(name, "VideoLevel") == 0)
+ video_level_opts_set(ud, "VideoLevel");
else if (strcmp(name, "FileFormat") == 0)
container_opts_set(ud->builder, "FileFormat");
else
@@ -2630,9 +2655,9 @@ init_ui_combo_boxes(GtkBuilder *builder)
init_combo_box(builder, "VideoEncoder");
init_combo_box(builder, "AudioEncoder");
init_combo_box(builder, "AudioEncoderFallback");
- init_combo_box(builder, "x264Tune");
- init_combo_box(builder, "h264Profile");
- init_combo_box(builder, "h264Level");
+ init_combo_box(builder, "VideoTune");
+ init_combo_box(builder, "VideoProfile");
+ init_combo_box(builder, "VideoLevel");
init_combo_box(builder, "FileFormat");
for (ii = 0; combo_name_map[ii].name != NULL; ii++)
{
@@ -2652,10 +2677,6 @@ ghb_build_advanced_opts_string(GValue *settings)
case HB_VCODEC_X264:
return ghb_settings_get_string(settings, "x264Option");
- case HB_VCODEC_FFMPEG_MPEG2:
- case HB_VCODEC_FFMPEG_MPEG4:
- return ghb_settings_get_string(settings, "lavcOption");
-
default:
return NULL;
}
@@ -2678,11 +2699,11 @@ void ghb_set_video_encoder_opts(hb_job_t *job, GValue *js)
else
{
GString *str = g_string_new("");
- char *preset = ghb_settings_get_string(js, "x264Preset");
- char *tune = ghb_settings_get_string(js, "x264Tune");
- char *profile = ghb_settings_get_string(js, "h264Profile");
- char *level = ghb_settings_get_string(js, "h264Level");
- char *opts = ghb_settings_get_string(js, "x264OptionExtra");
+ char *preset = ghb_settings_get_string(js, "VideoPreset");
+ char *tune = ghb_settings_get_string(js, "VideoTune");
+ char *profile = ghb_settings_get_string(js, "VideoProfile");
+ char *level = ghb_settings_get_string(js, "VideoLevel");
+ char *opts = ghb_settings_get_string(js, "VideoOptionExtra");
char *tunes;
g_string_append_printf(str, "%s", tune);
@@ -2721,7 +2742,7 @@ void ghb_set_video_encoder_opts(hb_job_t *job, GValue *js)
case HB_VCODEC_FFMPEG_MPEG2:
case HB_VCODEC_FFMPEG_MPEG4:
{
- gchar *opts = ghb_settings_get_string(js, "lavcOption");
+ gchar *opts = ghb_settings_get_string(js, "VideoOptionExtra");
if (opts != NULL && opts[0])
{
hb_job_set_encoder_options(job, opts);
@@ -4198,7 +4219,7 @@ ghb_validate_vquality(GValue *settings)
return FALSE;
}
g_free(message);
- ghb_settings_set_string(settings, "h264Profile", "auto");
+ ghb_settings_set_string(settings, "VideoProfile", "auto");
}
else if (vquality < min || vquality > max)
{
diff --git a/gtk/src/internal_defaults.xml b/gtk/src/internal_defaults.xml
index 6cf0feb83..70a1155f6 100644
--- a/gtk/src/internal_defaults.xml
+++ b/gtk/src/internal_defaults.xml
@@ -126,7 +126,7 @@
<true />
<key>PictureDeinterlaceDecomb</key>
<false />
- <key>x264PresetSlider</key>
+ <key>VideoPresetSlider</key>
<integer>0</integer>
<key>x264ZeroLatency</key>
<false />
@@ -359,21 +359,19 @@
<integer>2</integer>
<key>VideoQualitySlider</key>
<real>0.60</real>
- <key>lavcOption</key>
- <string></string>
<key>x264Option</key>
<string></string>
- <key>x264Preset</key>
+ <key>VideoPreset</key>
<string>custom</string>
- <key>x264Tune</key>
+ <key>VideoTune</key>
<string></string>
- <key>h264Profile</key>
+ <key>VideoProfile</key>
<string></string>
- <key>h264Level</key>
+ <key>VideoLevel</key>
<string></string>
<key>x264UseAdvancedOptions</key>
<false />
- <key>x264OptionExtra</key>
+ <key>VideoOptionExtra</key>
<string></string>
</dict>
</dict>
diff --git a/gtk/src/main.c b/gtk/src/main.c
index 249a8b43d..e209fe7a5 100644
--- a/gtk/src/main.c
+++ b/gtk/src/main.c
@@ -700,7 +700,7 @@ watch_volumes(signal_user_data_t *ud)
}
G_MODULE_EXPORT void x264_entry_changed_cb(GtkWidget *widget, signal_user_data_t *ud);
-G_MODULE_EXPORT void x264_option_changed_cb(GtkWidget *widget, signal_user_data_t *ud);
+G_MODULE_EXPORT void video_option_changed_cb(GtkWidget *widget, signal_user_data_t *ud);
G_MODULE_EXPORT void position_overlay_cb(GtkWidget *widget, signal_user_data_t *ud);
G_MODULE_EXPORT void preview_hud_size_alloc_cb(GtkWidget *widget, signal_user_data_t *ud);
@@ -943,9 +943,9 @@ main(int argc, char *argv[])
buffer = gtk_text_view_get_buffer(textview);
g_signal_connect(buffer, "changed", (GCallback)x264_entry_changed_cb, ud);
- textview = GTK_TEXT_VIEW(GHB_WIDGET(ud->builder, "x264OptionExtra"));
+ textview = GTK_TEXT_VIEW(GHB_WIDGET(ud->builder, "VideoOptionExtra"));
buffer = gtk_text_view_get_buffer(textview);
- g_signal_connect(buffer, "changed", (GCallback)x264_option_changed_cb, ud);
+ g_signal_connect(buffer, "changed", (GCallback)video_option_changed_cb, ud);
ghb_combo_init(ud);
@@ -962,13 +962,6 @@ main(int argc, char *argv[])
// to the callbacks. Builder's standard autoconnect doesn't all this.
gtk_builder_connect_signals_full(ud->builder, MyConnect, ud);
- GtkWidget *presetSlider = GHB_WIDGET(ud->builder, "x264PresetSlider");
- const char * const *x264_presets;
- int count = 0;
- x264_presets = hb_video_encoder_get_presets(HB_VCODEC_X264);
- while (x264_presets && x264_presets[count]) count++;
- gtk_range_set_range(GTK_RANGE(presetSlider), 0, count-1);
-
ghb_init_audio_defaults_ui(ud);
ghb_init_subtitle_defaults_ui(ud);
diff --git a/gtk/src/makedeps.py b/gtk/src/makedeps.py
index c4944d786..52d39eb18 100644
--- a/gtk/src/makedeps.py
+++ b/gtk/src/makedeps.py
@@ -51,9 +51,6 @@ dep_map = (
DepEntry("PictureAutoCrop", "PictureBottomCrop", "FALSE", False, False),
DepEntry("PictureAutoCrop", "PictureLeftCrop", "FALSE", False, False),
DepEntry("PictureAutoCrop", "PictureRightCrop", "FALSE", False, False),
- DepEntry("VideoEncoder", "x264_box", "x264", False, True),
- DepEntry("VideoEncoder", "x264VideoSettings", "x264", False, True),
- DepEntry("VideoEncoder", "lavc_mpeg4_box", "mpeg4|mpeg2", False, True),
DepEntry("AudioTrackQualityEnable", "AudioBitrate", "TRUE", True, True),
DepEntry("AudioTrackQualityEnable", "AudioTrackQualityBox", "FALSE", True, True),
DepEntry("AudioEncoder", "AudioBitrateLabel", "copy:mp3|copy:aac|copy:ac3|copy:dts|copy:dtshd", True, False),
@@ -71,7 +68,21 @@ dep_map = (
DepEntry("x264_subme", "x264_psy_rd", "<6", True, False),
DepEntry("x264_subme", "x264_psy_trell", "<6", True, False),
DepEntry("x264_trellis", "x264_psy_trell", "0", True, False),
- DepEntry("x264UseAdvancedOptions", "x264VideoSettingsTable", "TRUE", True, False),
+ DepEntry("VideoEncoder", "VideoPresetSlider", "x264|x265", False, True),
+ DepEntry("VideoEncoder", "VideoPresetLabel", "x264|x265", False, True),
+ DepEntry("VideoEncoder", "VideoTune", "x264|x265", False, True),
+ DepEntry("VideoEncoder", "VideoTuneLabel", "x264|x265", False, True),
+ DepEntry("VideoEncoder", "VideoProfile", "x264|x265", False, True),
+ DepEntry("VideoEncoder", "VideoProfileLabel", "x264|x265", False, True),
+ DepEntry("VideoEncoder", "VideoLevel", "x264|x265", False, True),
+ DepEntry("VideoEncoder", "VideoLevelLabel", "x264|x265", False, True),
+ DepEntry("VideoEncoder", "x264FastDecode", "x264", False, True),
+ DepEntry("VideoEncoder", "x264UseAdvancedOptions", "x264", False, True),
+ DepEntry("HideAdvancedVideoSettings", "x264UseAdvancedOptions", "TRUE", True, True),
+ DepEntry("VideoEncoder", "VideoOptionExtraWindow", "x264|x265|mpeg4|mpeg2", False, True),
+ DepEntry("VideoEncoder", "VideoOptionExtraLabel", "x264|x265|mpeg4|mpeg2", False, True),
+ DepEntry("x264UseAdvancedOptions", "VideoSettingsTable", "TRUE", True, False),
+ DepEntry("VideoEncoder", "x264_box", "x264", False, True),
DepEntry("x264UseAdvancedOptions", "x264_box", "FALSE", True, False),
DepEntry("auto_name", "autoname_box", "TRUE", False, False),
)
diff --git a/gtk/src/presets.c b/gtk/src/presets.c
index f2749e8df..6e17d6a95 100644
--- a/gtk/src/presets.c
+++ b/gtk/src/presets.c
@@ -31,6 +31,7 @@
#include "presets.h"
#include "values.h"
#include "lang.h"
+#include "videohandler.h"
#define MAX_NESTED_PRESET 3
@@ -2661,11 +2662,11 @@ import_xlat_preset(GValue *user_preset)
if (ghb_settings_get_boolean(dict, "x264UseAdvancedOptions"))
{
// Force preset/tune/profile/level/opts to conform to option string
- ghb_settings_set_string(dict, "x264Preset", "medium");
- ghb_settings_set_string(dict, "x264Tune", "none");
- ghb_settings_set_string(dict, "h264Profile", "auto");
- ghb_settings_set_string(dict, "h264Level", "auto");
- ghb_settings_set_value(dict, "x264OptionExtra",
+ ghb_settings_set_string(dict, "VideoPreset", "medium");
+ ghb_settings_set_string(dict, "VideoTune", "none");
+ ghb_settings_set_string(dict, "VideoProfile", "auto");
+ ghb_settings_set_string(dict, "VideoLevel", "auto");
+ ghb_settings_set_value(dict, "VideoOptionExtra",
ghb_settings_get_value(dict, "x264Option"));
}
else
@@ -2673,23 +2674,35 @@ import_xlat_preset(GValue *user_preset)
ghb_dict_remove(dict, "x264Option");
}
- const char * const *x264presets;
- x264presets = hb_video_encoder_get_presets(HB_VCODEC_X264);
- char *x264Preset = ghb_settings_get_string(dict, "x264Preset");
+ int encoder = ghb_get_video_encoder(dict);
+ const char * const *videoPresets;
+ videoPresets = hb_video_encoder_get_presets(encoder);
+ const char *videoPreset;
+ if (ghb_dict_lookup(user_preset, "x264Preset") != NULL)
+ videoPreset = ghb_settings_get_const_string(dict, "x264Preset");
+ else
+ videoPreset = ghb_settings_get_const_string(dict, "VideoPreset");
int ii;
- for (ii = 0; x264presets[ii]; ii++)
+ for (ii = 0; videoPreset && videoPresets && videoPresets[ii]; ii++)
{
- if (!strcasecmp(x264Preset, x264presets[ii]))
+ if (!strcasecmp(videoPreset, videoPresets[ii]))
{
- ghb_settings_set_int(dict, "x264PresetSlider", ii);
+ ghb_settings_set_int(dict, "VideoPresetSlider", ii);
}
}
- g_free(x264Preset);
+ if (videoPreset != NULL)
+ ghb_settings_set_string(dict, "VideoPreset", videoPreset);
- char *x264Tune = ghb_settings_get_string(dict, "x264Tune");
+ char *videoTune;
+ if (ghb_dict_lookup(user_preset, "x264Tune") != NULL)
+ videoTune = ghb_settings_get_string(dict, "x264Tune");
+ else
+ videoTune = ghb_settings_get_string(dict, "VideoTune");
char *tune = NULL;
char *saveptr;
- char * tok = strtok_r(x264Tune, ",./-+", &saveptr);
+ char * tok = strtok_r(videoTune, ",./-+", &saveptr);
+ ghb_settings_set_boolean(dict, "x264FastDecode", FALSE);
+ ghb_settings_set_boolean(dict, "x264ZeroLatency", FALSE);
while (tok != NULL)
{
if (!strcasecmp(tok, "fastdecode"))
@@ -2710,12 +2723,29 @@ import_xlat_preset(GValue *user_preset)
}
tok = strtok_r(NULL, ",./-+", &saveptr);
}
- g_free(x264Tune);
+ g_free(videoTune);
if (tune != NULL)
{
- ghb_settings_set_string(dict, "x264Tune", tune);
+ ghb_settings_set_string(dict, "VideoTune", tune);
g_free(tune);
}
+
+ char *videoProfile;
+ if (ghb_dict_lookup(user_preset, "x264Profile") != NULL)
+ videoProfile = ghb_settings_get_string(dict, "x264Profile");
+ else
+ videoProfile = ghb_settings_get_string(dict, "VideoProfile");
+ if (videoProfile != NULL)
+ ghb_settings_set_string(dict, "VideoProfile", videoProfile);
+
+ char *videoLevel;
+ if (ghb_dict_lookup(user_preset, "x264Level") != NULL)
+ videoLevel = ghb_settings_get_string(dict, "x264Level");
+ else
+ videoLevel = ghb_settings_get_string(dict, "VideoLevel");
+ if (videoLevel != NULL)
+ ghb_settings_set_string(dict, "VideoLevel", videoLevel);
+
return dict;
}
@@ -2827,13 +2857,13 @@ export_xlat_preset(GValue *dict)
if (ghb_value_boolean(preset_dict_get_value(dict, "x264UseAdvancedOptions")))
{
- ghb_dict_remove(dict, "x264Preset");
- ghb_dict_remove(dict, "x264Tune");
- ghb_dict_remove(dict, "h264Profile");
- ghb_dict_remove(dict, "h264Level");
- ghb_dict_remove(dict, "x264OptionExtra");
+ ghb_dict_remove(dict, "VideoPreset");
+ ghb_dict_remove(dict, "VideoTune");
+ ghb_dict_remove(dict, "VideoProfile");
+ ghb_dict_remove(dict, "VideoLevel");
+ ghb_dict_remove(dict, "VideoOptionExtra");
}
- const char *tune = dict_get_string(dict, "x264Tune");
+ const char *tune = dict_get_string(dict, "VideoTune");
if (tune != NULL)
{
GString *str = g_string_new("");
@@ -2849,7 +2879,7 @@ export_xlat_preset(GValue *dict)
g_string_append_printf(str, ",%s", "zerolatency");
}
tunes = g_string_free(str, FALSE);
- ghb_dict_insert(dict, g_strdup("x264Tune"),
+ ghb_dict_insert(dict, g_strdup("VideoTune"),
ghb_string_value_new(tunes));
g_free(tunes);
diff --git a/gtk/src/queuehandler.c b/gtk/src/queuehandler.c
index 6ad412a08..f2d40d3eb 100644
--- a/gtk/src/queuehandler.c
+++ b/gtk/src/queuehandler.c
@@ -472,49 +472,58 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter)
if (video_encoder->codec == HB_VCODEC_X264 &&
!ghb_settings_get_boolean(settings, "x264UseAdvancedOptions"))
{
- const gchar *preset_opt, *tune_opt;
- const gchar *profile_opt, *level_opt, *extra_opt;
- gboolean fastdecode, zerolatency;
-
- preset_opt = ghb_settings_get_const_string(settings, "x264Preset");
- tune_opt = ghb_settings_get_const_string(settings, "x264Tune");
- fastdecode = ghb_settings_get_boolean(settings, "x264FastDecode");
- zerolatency = ghb_settings_get_boolean(settings, "x264ZeroLatency");
- profile_opt = ghb_settings_get_const_string(settings, "h264Profile");
- level_opt = ghb_settings_get_const_string(settings, "h264Level");
- extra_opt = ghb_settings_get_const_string(settings, "x264OptionExtra");
-
- XPRINT("<b>Video Options:</b> <small>Preset: %s</small>", preset_opt);
- if ((tune_opt != NULL && tune_opt[0] != 0) || zerolatency || fastdecode)
+ const gchar *extra_opt;
+
+ // If the encoder supports presets...
+ if (hb_video_encoder_get_presets(video_encoder->codec) != NULL)
{
- const char *prefix = "";
- XPRINT("<small> - Tune: ");
- if (tune_opt != NULL && tune_opt[0] != 0)
+ const gchar *preset_opt, *tune_opt;
+ const gchar *profile_opt, *level_opt;
+ gboolean fastdecode, zerolatency;
+
+ preset_opt = ghb_settings_get_const_string(settings, "VideoPreset");
+ tune_opt = ghb_settings_get_const_string(settings, "VideoTune");
+ fastdecode = ghb_settings_get_boolean(settings, "x264FastDecode");
+ zerolatency = ghb_settings_get_boolean(settings, "x264ZeroLatency");
+ profile_opt = ghb_settings_get_const_string(settings, "VideoProfile");
+ level_opt = ghb_settings_get_const_string(settings, "VideoLevel");
+ extra_opt = ghb_settings_get_const_string(settings, "VideoOptionExtra");
+
+ XPRINT("<b>Video Options:</b> <small>Preset: %s</small>", preset_opt);
+ if ((tune_opt != NULL && tune_opt[0] != 0) || zerolatency || fastdecode)
{
- XPRINT("%s%s", prefix, tune_opt);
- prefix = ",";
+ const char *prefix = "";
+ XPRINT("<small> - Tune: ");
+ if (tune_opt != NULL && tune_opt[0] != 0)
+ {
+ XPRINT("%s%s", prefix, tune_opt);
+ prefix = ",";
+ }
+ if (video_encoder->codec == HB_VCODEC_X264)
+ {
+ if (fastdecode)
+ {
+ XPRINT("%sfastdecode", prefix);
+ prefix = ",";
+ }
+ if (zerolatency)
+ {
+ XPRINT("%szerolatency", prefix);
+ prefix = ",";
+ }
+ }
+ XPRINT("</small>");
}
- if (fastdecode)
+ if (profile_opt != NULL && profile_opt[0] != 0)
{
- XPRINT("%sfastdecode", prefix);
- prefix = ",";
+ XPRINT("<small> - Profile: %s</small>", profile_opt);
}
- if (zerolatency)
+ if (level_opt != NULL && level_opt[0] != 0)
{
- XPRINT("%szerolatency", prefix);
- prefix = ",";
+ XPRINT("<small> - Level: %s</small>", level_opt);
}
- XPRINT("</small>");
- }
- if (profile_opt != NULL && profile_opt[0] != 0)
- {
- XPRINT("<small> - Profile: %s</small>", profile_opt);
- }
- if (level_opt != NULL && level_opt[0] != 0)
- {
- XPRINT("<small> - Level: %s</small>", level_opt);
+ XPRINT("\n");
}
- XPRINT("\n");
// Next line in the display (Video Encoder Options)
// Video Advanced Options: detailed settings
@@ -523,8 +532,7 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter)
XPRINT("<b>Advanced Options:</b> <small>%s</small>\n", extra_opt);
}
}
- else if (video_encoder->codec == HB_VCODEC_X264 ||
- (video_encoder->codec | HB_VCODEC_FFMPEG_MASK))
+ else if (video_encoder->codec == HB_VCODEC_X264)
{
// Next line in the display (Video Encoder Options)
// Video Advanced Options: detailed settings
diff --git a/gtk/src/standard_presets.xml b/gtk/src/standard_presets.xml
index b438ff3ed..ed6ceafea 100644
--- a/gtk/src/standard_presets.xml
+++ b/gtk/src/standard_presets.xml
@@ -137,19 +137,17 @@
<integer>0</integer>
<key>VideoTwoPass</key>
<integer>0</integer>
- <key>h264Level</key>
+ <key>VideoLevel</key>
<string>3.0</string>
- <key>h264Profile</key>
+ <key>VideoProfile</key>
<string>baseline</string>
- <key>lavcOption</key>
- <string></string>
<key>x264Option</key>
<string></string>
- <key>x264OptionExtra</key>
+ <key>VideoOptionExtra</key>
<string></string>
- <key>x264Preset</key>
+ <key>VideoPreset</key>
<string>fast</string>
- <key>x264Tune</key>
+ <key>VideoTune</key>
<string></string>
<key>x264UseAdvancedOptions</key>
<integer>0</integer>
@@ -270,19 +268,17 @@
<integer>0</integer>
<key>VideoTwoPass</key>
<integer>0</integer>
- <key>h264Level</key>
+ <key>VideoLevel</key>
<string>1.3</string>
- <key>h264Profile</key>
+ <key>VideoProfile</key>
<string>baseline</string>
- <key>lavcOption</key>
- <string></string>
<key>x264Option</key>
<string></string>
- <key>x264OptionExtra</key>
+ <key>VideoOptionExtra</key>
<string></string>
- <key>x264Preset</key>
+ <key>VideoPreset</key>
<string>medium</string>
- <key>x264Tune</key>
+ <key>VideoTune</key>
<string></string>
<key>x264UseAdvancedOptions</key>
<integer>0</integer>
@@ -403,19 +399,17 @@
<integer>0</integer>
<key>VideoTwoPass</key>
<integer>0</integer>
- <key>h264Level</key>
+ <key>VideoLevel</key>
<string>3.1</string>
- <key>h264Profile</key>
+ <key>VideoProfile</key>
<string>high</string>
- <key>lavcOption</key>
- <string></string>
<key>x264Option</key>
<string></string>
- <key>x264OptionExtra</key>
+ <key>VideoOptionExtra</key>
<string></string>
- <key>x264Preset</key>
+ <key>VideoPreset</key>
<string>medium</string>
- <key>x264Tune</key>
+ <key>VideoTune</key>
<string></string>
<key>x264UseAdvancedOptions</key>
<integer>0</integer>
@@ -536,19 +530,17 @@
<integer>0</integer>
<key>VideoTwoPass</key>
<integer>0</integer>
- <key>h264Level</key>
+ <key>VideoLevel</key>
<string>3.1</string>
- <key>h264Profile</key>
+ <key>VideoProfile</key>
<string>high</string>
- <key>lavcOption</key>
- <string></string>
<key>x264Option</key>
<string></string>
- <key>x264OptionExtra</key>
+ <key>VideoOptionExtra</key>
<string></string>
- <key>x264Preset</key>
+ <key>VideoPreset</key>
<string>medium</string>
- <key>x264Tune</key>
+ <key>VideoTune</key>
<string></string>
<key>x264UseAdvancedOptions</key>
<integer>0</integer>
@@ -685,19 +677,17 @@
<integer>0</integer>
<key>VideoTwoPass</key>
<integer>0</integer>
- <key>h264Level</key>
+ <key>VideoLevel</key>
<string>3.1</string>
- <key>h264Profile</key>
+ <key>VideoProfile</key>
<string>high</string>
- <key>lavcOption</key>
- <string></string>
<key>x264Option</key>
<string></string>
- <key>x264OptionExtra</key>
+ <key>VideoOptionExtra</key>
<string>qpmin=4:cabac=0:ref=2:b-pyramid=none:weightb=0:weightp=0:vbv-maxrate=9500:vbv-bufsize=9500</string>
- <key>x264Preset</key>
+ <key>VideoPreset</key>
<string>medium</string>
- <key>x264Tune</key>
+ <key>VideoTune</key>
<string></string>
<key>x264UseAdvancedOptions</key>
<integer>0</integer>
@@ -834,19 +824,17 @@
<integer>0</integer>
<key>VideoTwoPass</key>
<integer>0</integer>
- <key>h264Level</key>
+ <key>VideoLevel</key>
<string>3.1</string>
- <key>h264Profile</key>
+ <key>VideoProfile</key>
<string>high</string>
- <key>lavcOption</key>
- <string></string>
<key>x264Option</key>
<string></string>
- <key>x264OptionExtra</key>
+ <key>VideoOptionExtra</key>
<string></string>
- <key>x264Preset</key>
+ <key>VideoPreset</key>
<string>medium</string>
- <key>x264Tune</key>
+ <key>VideoTune</key>
<string></string>
<key>x264UseAdvancedOptions</key>
<integer>0</integer>
@@ -983,19 +971,17 @@
<integer>0</integer>
<key>VideoTwoPass</key>
<integer>0</integer>
- <key>h264Level</key>
+ <key>VideoLevel</key>
<string>4.0</string>
- <key>h264Profile</key>
+ <key>VideoProfile</key>
<string>high</string>
- <key>lavcOption</key>
- <string></string>
<key>x264Option</key>
<string></string>
- <key>x264OptionExtra</key>
+ <key>VideoOptionExtra</key>
<string></string>
- <key>x264Preset</key>
+ <key>VideoPreset</key>
<string>medium</string>
- <key>x264Tune</key>
+ <key>VideoTune</key>
<string></string>
<key>x264UseAdvancedOptions</key>
<integer>0</integer>
@@ -1116,19 +1102,17 @@
<integer>0</integer>
<key>VideoTwoPass</key>
<integer>0</integer>
- <key>h264Level</key>
+ <key>VideoLevel</key>
<string>3.0</string>
- <key>h264Profile</key>
+ <key>VideoProfile</key>
<string>main</string>
- <key>lavcOption</key>
- <string></string>
<key>x264Option</key>
<string></string>
- <key>x264OptionExtra</key>
+ <key>VideoOptionExtra</key>
<string></string>
- <key>x264Preset</key>
+ <key>VideoPreset</key>
<string>medium</string>
- <key>x264Tune</key>
+ <key>VideoTune</key>
<string></string>
<key>x264UseAdvancedOptions</key>
<integer>0</integer>
@@ -1249,19 +1233,17 @@
<integer>0</integer>
<key>VideoTwoPass</key>
<integer>0</integer>
- <key>h264Level</key>
+ <key>VideoLevel</key>
<string>3.1</string>
- <key>h264Profile</key>
+ <key>VideoProfile</key>
<string>main</string>
- <key>lavcOption</key>
- <string></string>
<key>x264Option</key>
<string></string>
- <key>x264OptionExtra</key>
+ <key>VideoOptionExtra</key>
<string></string>
- <key>x264Preset</key>
+ <key>VideoPreset</key>
<string>medium</string>
- <key>x264Tune</key>
+ <key>VideoTune</key>
<string></string>
<key>x264UseAdvancedOptions</key>
<integer>0</integer>
@@ -1382,19 +1364,17 @@
<integer>0</integer>
<key>VideoTwoPass</key>
<integer>0</integer>
- <key>h264Level</key>
+ <key>VideoLevel</key>
<string>3.1</string>
- <key>h264Profile</key>
+ <key>VideoProfile</key>
<string>main</string>
- <key>lavcOption</key>
- <string></string>
<key>x264Option</key>
<string></string>
- <key>x264OptionExtra</key>
+ <key>VideoOptionExtra</key>
<string></string>
- <key>x264Preset</key>
+ <key>VideoPreset</key>
<string>medium</string>
- <key>x264Tune</key>
+ <key>VideoTune</key>
<string></string>
<key>x264UseAdvancedOptions</key>
<integer>0</integer>
@@ -1530,19 +1510,17 @@
<integer>0</integer>
<key>VideoTwoPass</key>
<integer>0</integer>
- <key>h264Level</key>
+ <key>VideoLevel</key>
<string>4.0</string>
- <key>h264Profile</key>
+ <key>VideoProfile</key>
<string>main</string>
- <key>lavcOption</key>
- <string></string>
<key>x264Option</key>
<string></string>
- <key>x264OptionExtra</key>
+ <key>VideoOptionExtra</key>
<string></string>
- <key>x264Preset</key>
+ <key>VideoPreset</key>
<string>veryfast</string>
- <key>x264Tune</key>
+ <key>VideoTune</key>
<string></string>
<key>x264UseAdvancedOptions</key>
<integer>0</integer>
@@ -1679,19 +1657,17 @@
<integer>0</integer>
<key>VideoTwoPass</key>
<integer>0</integer>
- <key>h264Level</key>
+ <key>VideoLevel</key>
<string>4.1</string>
- <key>h264Profile</key>
+ <key>VideoProfile</key>
<string>high</string>
- <key>lavcOption</key>
- <string></string>
<key>x264Option</key>
<string></string>
- <key>x264OptionExtra</key>
+ <key>VideoOptionExtra</key>
<string></string>
- <key>x264Preset</key>
+ <key>VideoPreset</key>
<string>medium</string>
- <key>x264Tune</key>
+ <key>VideoTune</key>
<string></string>
<key>x264UseAdvancedOptions</key>
<integer>0</integer>
diff --git a/gtk/src/x264handler.c b/gtk/src/x264handler.c
index 0f3341b95..800478215 100644
--- a/gtk/src/x264handler.c
+++ b/gtk/src/x264handler.c
@@ -19,6 +19,7 @@
#include "presets.h"
#include "hb-backend.h"
#include "x264handler.h"
+#include "videohandler.h"
gint ghb_lookup_bframes(const gchar *options);
static void x264_opt_update(signal_user_data_t *ud, GtkWidget *widget);
@@ -46,174 +47,6 @@ void ghb_show_hide_advanced_video( signal_user_data_t *ud )
}
G_MODULE_EXPORT void
-x264_use_advanced_options_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
-{
- ghb_widget_to_setting(ud->settings, widget);
-
- if (ghb_settings_get_boolean(ud->prefs, "HideAdvancedVideoSettings") &&
- ghb_settings_get_boolean(ud->settings, "x264UseAdvancedOptions"))
- {
- ghb_ui_update(ud, "x264UseAdvancedOptions", ghb_boolean_value(FALSE));
- return;
- }
-
- if (ghb_settings_get_boolean(ud->settings, "x264UseAdvancedOptions"))
- {
- ghb_ui_update(ud, "x264PresetSlider", ghb_int_value(5));
- ghb_ui_update(ud, "x264Tune", ghb_string_value("none"));
- ghb_ui_update(ud, "h264Profile", ghb_string_value("auto"));
- ghb_ui_update(ud, "h264Level", ghb_string_value("auto"));
-
- char *options = ghb_settings_get_string(ud->settings, "x264Option");
- ghb_ui_update(ud, "x264OptionExtra", ghb_string_value(options));
- g_free(options);
- }
-
- ghb_check_dependency(ud, widget, NULL);
- ghb_clear_presets_selection(ud);
-}
-
-G_MODULE_EXPORT void
-x264_setting_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
-{
- static char *tt = NULL;
-
-
- if (tt == NULL)
- {
- GtkWidget *eo = GTK_WIDGET(GHB_WIDGET(ud->builder, "x264OptionExtra"));
- tt = gtk_widget_get_tooltip_text(eo);
- }
-
- ghb_widget_to_setting(ud->settings, widget);
-
- int x264Preset = ghb_settings_get_int(ud->settings, "x264PresetSlider");
- const char *preset;
- preset = hb_video_encoder_get_presets(HB_VCODEC_X264)[x264Preset];
- ghb_settings_set_string(ud->settings, "x264Preset", preset);
-
- if (!ghb_settings_get_boolean(ud->settings, "x264UseAdvancedOptions"))
- {
- GString *str = g_string_new("");
- char *preset;
- char *tune;
- char *profile;
- char *level;
- char *opts;
- char *tunes;
-
- preset = ghb_settings_get_string(ud->settings, "x264Preset");
- tune = ghb_settings_get_string(ud->settings, "x264Tune");
- profile = ghb_settings_get_string(ud->settings, "h264Profile");
- level = ghb_settings_get_string(ud->settings, "h264Level");
- opts = ghb_settings_get_string(ud->settings, "x264OptionExtra");
-
- if (tune[0] && strcmp(tune, "none"))
- {
- g_string_append_printf(str, "%s", tune);
- }
- if (ghb_settings_get_boolean(ud->settings, "x264FastDecode"))
- {
- g_string_append_printf(str, "%s%s", str->str[0] ? "," : "", "fastdecode");
- }
- if (ghb_settings_get_boolean(ud->settings, "x264ZeroLatency"))
- {
- g_string_append_printf(str, "%s%s", str->str[0] ? "," : "", "zerolatency");
- }
- tunes = g_string_free(str, FALSE);
-
- char * new_opts;
-
- int w = ghb_settings_get_int(ud->settings, "scale_width");
- int h = ghb_settings_get_int(ud->settings, "scale_height");
-
- if (w == 0 || h == 0)
- {
- if (!ghb_settings_get_boolean(ud->settings, "autoscale"))
- {
- w = ghb_settings_get_int(ud->settings, "PictureWidth");
- h = ghb_settings_get_int(ud->settings, "PictureHeight");
-
- if (h == 0 && w != 0)
- {
- h = w * 9 / 16;
- }
- if (w == 0 && h != 0)
- {
- w = h * 16 / 9;
- }
- }
- if (w == 0 || h == 0)
- {
- w = 1280;
- h = 720;
- }
- }
-
- if (!strcasecmp(profile, "auto"))
- {
- profile[0] = 0;
- }
- if (!strcasecmp(level, "auto"))
- {
- level[0] = 0;
- }
- new_opts = hb_x264_param_unparse(
- preset, tunes, opts, profile, level, w, h);
- if (new_opts)
- ghb_ui_update(ud, "x264Option", ghb_string_value(new_opts));
- else
- ghb_ui_update(ud, "x264Option", ghb_string_value(""));
-
- GtkWidget *eo = GTK_WIDGET(GHB_WIDGET(ud->builder, "x264OptionExtra"));
-
- char * new_tt;
- if (new_opts)
- new_tt = g_strdup_printf("%s\n\nExpanded Options:\n\"%s\"", tt, new_opts);
- else
- new_tt = g_strdup_printf("%s\n\nExpanded Options:\n\"\"", tt);
- gtk_widget_set_tooltip_text(eo, new_tt);
-
- g_free(new_tt);
- g_free(new_opts);
-
- g_free(preset);
- g_free(tune);
- g_free(profile);
- g_free(level);
- g_free(opts);
- g_free(tunes);
- }
- else
- {
- char *opts = ghb_settings_get_string(ud->settings, "x264Option");
-
- GtkWidget *eo = GTK_WIDGET(GHB_WIDGET(ud->builder, "x264OptionExtra"));
- char * new_tt;
- if (opts)
- new_tt = g_strdup_printf("%s\n\nExpanded Options:\n\"%s\"", tt, opts);
- else
- new_tt = g_strdup_printf("%s\n\nExpanded Options:\n\"\"", tt);
- gtk_widget_set_tooltip_text(eo, new_tt);
- g_free(new_tt);
-
- g_free(opts);
- }
-
- ghb_check_dependency(ud, widget, NULL);
- ghb_clear_presets_selection(ud);
-}
-
-G_MODULE_EXPORT void
-x264_option_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
-{
- GtkWidget *textview;
-
- textview = GTK_WIDGET(GHB_WIDGET(ud->builder, "x264OptionExtra"));
- x264_setting_changed_cb(textview, ud);
-}
-
-G_MODULE_EXPORT void
x264_widget_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
ghb_widget_to_setting(ud->x264_priv, widget);
@@ -296,7 +129,7 @@ x264_entry_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
if (tt == NULL)
{
- GtkWidget *eo = GTK_WIDGET(GHB_WIDGET(ud->builder, "x264OptionExtra"));
+ GtkWidget *eo = GTK_WIDGET(GHB_WIDGET(ud->builder, "VideoOptionExtra"));
tt = gtk_widget_get_tooltip_text(eo);
}
@@ -319,7 +152,7 @@ x264_entry_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
ghb_ui_update(ud, "x264Option", ghb_string_value(sopts));
ghb_x264_parse_options(ud, sopts);
- GtkWidget *eo = GTK_WIDGET(GHB_WIDGET(ud->builder, "x264OptionExtra"));
+ GtkWidget *eo = GTK_WIDGET(GHB_WIDGET(ud->builder, "VideoOptionExtra"));
char * new_tt;
if (sopts)
new_tt = g_strdup_printf("%s\n\nExpanded Options:\n\"%s\"", tt, sopts);
@@ -1221,45 +1054,6 @@ sanitize_x264opts(signal_user_data_t *ud, const gchar *options)
return result;
}
-G_MODULE_EXPORT gboolean
-lavc_focus_out_cb(GtkWidget *widget, GdkEventFocus *event,
- signal_user_data_t *ud)
-{
- ghb_widget_to_setting(ud->settings, widget);
-
-#if 0
- gchar *options, *sopts;
- ****************************************************************
- When there are lavc widget in the future, this will be populated
- ****************************************************************
- options = ghb_settings_get_string(ud->settings, "x264Option");
- sopts = sanitize_x264opts(ud, options);
- ignore_options_update = TRUE;
- if (sopts != NULL && strcmp(sopts, options) != 0)
- {
- ghb_ui_update(ud, "x264Option", ghb_string_value(sopts));
- ghb_x264_parse_options(ud, sopts);
- }
- g_free(options);
- g_free(sopts);
- ignore_options_update = FALSE;
-#endif
- return FALSE;
-}
-
-G_MODULE_EXPORT gchar*
-format_x264_preset_cb(GtkScale *scale, gdouble val, signal_user_data_t *ud)
-{
- const char * const *x264_presets;
- const char *preset = "medium";
-
- x264_presets = hb_video_encoder_get_presets(HB_VCODEC_X264);
-
- preset = x264_presets[(int)val];
-
- return g_strdup_printf(" %-12s", preset);
-}
-
void
ghb_x264_init(signal_user_data_t *ud)
{