From 025ec4178852643d51df2003d23a21bd74206a26 Mon Sep 17 00:00:00 2001 From: jstebbins Date: Thu, 11 Jun 2009 18:49:59 +0000 Subject: LinGui: per irc discussion with D_S, in turbo 1st pass, leave weightb alone if b-adapt=2. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2520 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- gtk/src/x264handler.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'gtk/src/x264handler.c') diff --git a/gtk/src/x264handler.c b/gtk/src/x264handler.c index ff2338f19..17c67db36 100644 --- a/gtk/src/x264handler.c +++ b/gtk/src/x264handler.c @@ -651,6 +651,56 @@ x264_remove_opt(gchar **opts, gchar **opt_syns) } } +static gchar* +x264_lookup_value(gchar **opts, gchar **opt_syns) +{ + gchar *ret = NULL; + gint pos; + + const gchar *def_val = x264_opt_get_default(opt_syns[0]); + + pos = x264_find_opt(opts, opt_syns); + if (pos >= 0) + { + gchar *cpos = strchr(opts[pos], '='); + if (cpos != NULL) + { + ret = g_strdup(cpos+1); + } + else + { + ret = g_strdup(""); + } + } + else if (def_val != NULL) + { + ret = g_strdup(def_val); + } + return ret; +} + +gint +ghb_lookup_badapt(gchar *options) +{ + gint ret = 0; + gchar *result; + gchar **split; + + if (options == NULL) + options = ""; + + split = g_strsplit(options, ":", -1); + + result = x264_lookup_value(split, x264_badapt_syns); + g_strfreev(split); + if (result != NULL) + { + ret = g_strtod(result, NULL); + g_free(result); + } + return ret; +} + // Construct the x264 options string // The result is allocated, so someone must free it at some point. static gchar* -- cgit v1.2.3