summaryrefslogtreecommitdiffstats
path: root/gtk/src/x264handler.c
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/src/x264handler.c
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/src/x264handler.c')
-rw-r--r--gtk/src/x264handler.c212
1 files changed, 3 insertions, 209 deletions
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)
{