1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
4 * Copyright (C) John Stebbins 2008 <stebbins@stebbins>
6 * x264handler.c is free software.
8 * You may redistribute it and/or modify it under the terms of the
9 * GNU General Public License, as published by the Free Software
10 * Foundation; either version 2 of the License, or (at your option)
18 #include "callbacks.h"
20 #include "hb-backend.h"
21 #include "x264handler.h"
23 gint ghb_lookup_bframes(const gchar *options);
24 static void x264_opt_update(signal_user_data_t *ud, GtkWidget *widget);
25 static gchar* sanitize_x264opts(signal_user_data_t *ud, const gchar *options);
27 // Flag needed to prevent x264 options processing from chasing its tail
28 static gboolean ignore_options_update = FALSE;
31 x264_widget_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
33 ghb_widget_to_setting(ud->settings, widget);
34 if (!ignore_options_update)
36 ignore_options_update = TRUE;
37 x264_opt_update(ud, widget);
38 ignore_options_update = FALSE;
40 ghb_check_dependency(ud, widget, NULL);
41 ghb_clear_presets_selection(ud);
45 x264_slider_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
47 ghb_widget_to_setting(ud->settings, widget);
49 // Lock slider values to multiples of step_increment
50 GtkAdjustment * adj = gtk_range_get_adjustment(GTK_RANGE(widget));
51 gdouble step = gtk_adjustment_get_step_increment(adj);
52 gdouble val = gtk_range_get_value(GTK_RANGE(widget));
53 gdouble new_val = ((int)((val + step / 2) / step)) * step;
54 gdouble diff = val - new_val;
55 if ( diff > 0.0001 || diff < -0.0001 )
57 gtk_range_set_value(GTK_RANGE(widget), new_val);
59 else if (!ignore_options_update)
61 ignore_options_update = TRUE;
62 x264_opt_update(ud, widget);
63 ignore_options_update = FALSE;
65 ghb_check_dependency(ud, widget, NULL);
66 ghb_clear_presets_selection(ud);
69 G_MODULE_EXPORT gchar*
70 x264_format_slider_cb(GtkScale *scale, gdouble val, signal_user_data_t *ud)
72 return g_strdup_printf("%-6.6g", val);
77 x264_me_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
81 ghb_widget_to_setting(ud->settings, widget);
82 if (!ignore_options_update)
84 ignore_options_update = TRUE;
85 x264_opt_update(ud, widget);
86 ignore_options_update = FALSE;
88 ghb_check_dependency(ud, widget, NULL);
89 ghb_clear_presets_selection(ud);
90 widget = GHB_WIDGET(ud->builder, "x264_merange");
91 me = ghb_settings_combo_int(ud->settings, "x264_me");
95 gtk_spin_button_set_range(GTK_SPIN_BUTTON(widget), 4, 16);
100 gtk_spin_button_set_range(GTK_SPIN_BUTTON(widget), 4, 64);
105 x264_entry_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
107 g_debug("x264_entry_changed_cb ()");
108 if (!ignore_options_update)
113 textview = GTK_WIDGET(GHB_WIDGET(ud->builder, "x264Option"));
114 ghb_widget_to_setting(ud->settings, textview);
115 options = ghb_settings_get_string(ud->settings, "x264Option");
116 ignore_options_update = TRUE;
117 ghb_x264_parse_options(ud, options);
118 if (!GTK_WIDGET_HAS_FOCUS(textview))
122 sopts = sanitize_x264opts(ud, options);
123 ghb_ui_update(ud, "x264Option", ghb_string_value(sopts));
124 ghb_x264_parse_options(ud, sopts);
128 ignore_options_update = FALSE;
132 G_MODULE_EXPORT gboolean
133 x264_focus_out_cb(GtkWidget *widget, GdkEventFocus *event,
134 signal_user_data_t *ud)
136 gchar *options, *sopts;
138 ghb_widget_to_setting(ud->settings, widget);
139 options = ghb_settings_get_string(ud->settings, "x264Option");
140 sopts = sanitize_x264opts(ud, options);
141 ignore_options_update = TRUE;
142 if (sopts != NULL && strcmp(sopts, options) != 0)
144 ghb_ui_update(ud, "x264Option", ghb_string_value(sopts));
145 ghb_x264_parse_options(ud, sopts);
149 ignore_options_update = FALSE;
182 trans_x264_val(trans_table_t *trans, char *val)
188 for (ii = 0; ii < trans->count; ii++)
190 if (strcmp(val, trans->map[ii].x264_val) == 0)
192 return trans->map[ii].ui_val;
199 trans_ui_val(trans_table_t *trans, char *val)
205 for (ii = 0; ii < trans->count; ii++)
207 if (strcmp(val, trans->map[ii].ui_val) == 0)
209 return trans->map[ii].x264_val;
215 struct x264_opt_map_s
221 trans_table_t *translation;
225 static gchar *x264_ref_syns[] = {"ref", "frameref", NULL};
226 static gchar *x264_bframes_syns[] = {"bframes", NULL};
227 static gchar *x264_badapt_syns[] = {"b-adapt", "b_adapt", NULL};
228 static gchar *x264_direct_syns[] =
229 {"direct", "direct-pred", "direct_pred", NULL};
230 static gchar *x264_weightp_syns[] = {"weightp", NULL};
231 static gchar *x264_bpyramid_syns[] = {"b-pyramid", "b_pyramid", NULL};
232 static gchar *x264_me_syns[] = {"me", NULL};
233 static gchar *x264_merange_syns[] = {"merange", "me-range", "me_range", NULL};
234 static gchar *x264_subme_syns[] = {"subme", "subq", NULL};
235 static gchar *x264_aqmode_syns[] = {"aq-mode", NULL};
236 static gchar *x264_analyse_syns[] = {"partitions", "analyse", NULL};
237 static gchar *x264_8x8dct_syns[] = {"8x8dct", NULL};
238 static gchar *x264_deblock_syns[] = {"deblock", "filter", NULL};
239 static gchar *x264_trellis_syns[] = {"trellis", NULL};
240 static gchar *x264_pskip_syns[] = {"no-fast-pskip", "no_fast_pskip", NULL};
241 static gchar *x264_psy_syns[] = {"psy-rd", "psy_rd", NULL};
242 static gchar *x264_aq_strength_syns[] = {"aq-strength", "aq_strength", NULL};
243 static gchar *x264_mbtree_syns[] = {"mbtree", NULL};
244 static gchar *x264_decimate_syns[] =
245 {"no-dct-decimate", "no_dct_decimate", NULL};
246 static gchar *x264_cabac_syns[] = {"cabac", NULL};
249 find_syn_match(const gchar *opt, gchar **syns)
252 for (ii = 0; syns[ii] != NULL; ii++)
254 if (strcmp(opt, syns[ii]) == 0)
260 struct x264_opt_map_s x264_opt_map[] =
262 {x264_ref_syns, "x264_refs", "3", X264_OPT_INT},
263 {x264_bframes_syns, "x264_bframes", "3", X264_OPT_INT},
264 {x264_direct_syns, "x264_direct", "spatial", X264_OPT_COMBO},
265 {x264_badapt_syns, "x264_b_adapt", "1", X264_OPT_COMBO},
266 {x264_weightp_syns, "x264_weighted_pframes", "2", X264_OPT_COMBO},
267 {x264_bpyramid_syns, "x264_bpyramid", "normal", X264_OPT_COMBO},
268 {x264_me_syns, "x264_me", "hex", X264_OPT_COMBO},
269 {x264_merange_syns, "x264_merange", "16", X264_OPT_INT},
270 {x264_subme_syns, "x264_subme", "7", X264_OPT_COMBO},
271 {x264_aqmode_syns, "x264_aqmode", "1", X264_OPT_INT_NONE},
272 {x264_analyse_syns, "x264_analyse", "p8x8,b8x8,i8x8,i4x4", X264_OPT_COMBO},
273 {x264_8x8dct_syns, "x264_8x8dct", "1", X264_OPT_BOOL},
274 {x264_deblock_syns, "x264_deblock_alpha", "0,0", X264_OPT_DEBLOCK},
275 {x264_deblock_syns, "x264_deblock_beta", "0,0", X264_OPT_DEBLOCK},
276 {x264_trellis_syns, "x264_trellis", "1", X264_OPT_COMBO},
277 {x264_pskip_syns, "x264_no_fast_pskip", "0", X264_OPT_BOOL},
278 {x264_decimate_syns, "x264_no_dct_decimate", "0", X264_OPT_BOOL},
279 {x264_cabac_syns, "x264_cabac", "1", X264_OPT_BOOL},
280 {x264_aq_strength_syns, "x264_aq_strength", "1", X264_OPT_DOUBLE},
281 {x264_psy_syns, "x264_psy_rd", "1|0", X264_OPT_PSY},
282 {x264_psy_syns, "x264_psy_trell", "1|0", X264_OPT_PSY},
283 {x264_mbtree_syns, "x264_mbtree", "1", X264_OPT_BOOL_NONE},
285 #define X264_OPT_MAP_SIZE (sizeof(x264_opt_map)/sizeof(struct x264_opt_map_s))
288 x264_opt_get_default(const gchar *opt)
291 for (jj = 0; jj < X264_OPT_MAP_SIZE; jj++)
293 if (find_syn_match(opt, x264_opt_map[jj].opt_syns) >= 0)
295 return x264_opt_map[jj].def_val;
302 x264_update_double(signal_user_data_t *ud, const gchar *name, const gchar *val)
306 if (val == NULL) return;
307 dval = g_strtod (val, NULL);
308 ghb_ui_update(ud, name, ghb_double_value(dval));
312 x264_update_int(signal_user_data_t *ud, const gchar *name, const gchar *val)
316 if (val == NULL) return;
317 ival = g_strtod (val, NULL);
318 ghb_ui_update(ud, name, ghb_int64_value(ival));
322 x264_update_int_setting(signal_user_data_t *ud, const gchar *name, const gchar *val)
326 if (val == NULL) return;
327 ival = g_strtod (val, NULL);
328 ghb_settings_set_value(ud->settings, name, ghb_int64_value(ival));
329 ghb_check_dependency(ud, NULL, name);
332 static gchar *true_str[] =
341 str_is_true(const gchar *str)
344 for (ii = 0; true_str[ii]; ii++)
346 if (g_ascii_strcasecmp(str, true_str[ii]) == 0)
353 x264_update_bool(signal_user_data_t *ud, const gchar *name, const gchar *val)
356 ghb_ui_update(ud, name, ghb_boolean_value(1));
358 ghb_ui_update(ud, name, ghb_boolean_value(str_is_true(val)));
362 x264_update_bool_setting(signal_user_data_t *ud, const gchar *name, const gchar *val)
365 ghb_settings_set_value(ud->settings, name, ghb_boolean_value(1));
367 ghb_settings_set_value(ud->settings, name, ghb_boolean_value(str_is_true(val)));
369 ghb_check_dependency(ud, NULL, name);
373 x264_update_combo(signal_user_data_t *ud, const gchar *name, const gchar *val)
379 gboolean foundit = FALSE;
382 if (val == NULL) return;
383 widget = GHB_WIDGET(ud->builder, name);
386 g_debug("Failed to find widget for key: %s\n", name);
389 store = gtk_combo_box_get_model(GTK_COMBO_BOX(widget));
390 if (gtk_tree_model_get_iter_first (store, &iter))
394 gtk_tree_model_get(store, &iter, 2, &shortOpt, 3, &ivalue, -1);
395 if (strcmp(shortOpt, val) == 0)
397 gtk_combo_box_set_active_iter (GTK_COMBO_BOX(widget), &iter);
403 } while (gtk_tree_model_iter_next (store, &iter));
407 if (gtk_tree_model_get_iter_first (store, &iter))
411 gtk_tree_model_get(store, &iter, 2, &shortOpt, 3, &ivalue, -1);
412 if (strcmp(shortOpt, "custom") == 0)
414 gtk_list_store_set(GTK_LIST_STORE(store), &iter, 4, val, -1);
415 gtk_combo_box_set_active_iter (GTK_COMBO_BOX(widget), &iter);
421 } while (gtk_tree_model_iter_next (store, &iter));
424 // Its possible the value hasn't changed. Since settings are only
425 // updated when the value changes, I'm initializing settings here as well.
426 ghb_widget_to_setting(ud->settings, widget);
430 x264_update_deblock(signal_user_data_t *ud, const gchar *xval)
432 gdouble avalue, bvalue;
437 if (xval == NULL) return;
438 val = g_strdup(xval);
442 gchar *pos = strchr(val, ',');
448 avalue = g_strtod (val, &end);
451 bvalue = g_strtod (bval, &end);
455 ghb_ui_update(ud, "x264_deblock_alpha", ghb_int64_value(avalue));
456 ghb_ui_update(ud, "x264_deblock_beta", ghb_int64_value(bvalue));
460 x264_parse_psy(const gchar *psy, gdouble *psy_rd, gdouble *psy_trell)
464 if (psy == NULL) return;
465 if (2 == sscanf(psy, "%lf|%lf", psy_rd, psy_trell) ||
466 2 == sscanf(psy, "%lf,%lf", psy_rd, psy_trell))
472 x264_update_psy(signal_user_data_t *ud, const gchar *xval)
474 gdouble rd_value, trell_value;
476 if (xval == NULL) return;
477 x264_parse_psy(xval, &rd_value, &trell_value);
478 ghb_ui_update(ud, "x264_psy_rd", ghb_double_value(rd_value));
479 ghb_ui_update(ud, "x264_psy_trell", ghb_double_value(trell_value));
482 static void do_update(signal_user_data_t *ud, char *name, gint type, char *val)
487 x264_update_int(ud, name, val);
489 case X264_OPT_DOUBLE:
490 x264_update_double(ud, name, val);
493 x264_update_bool(ud, name, val);
496 x264_update_combo(ud, name, val);
498 case X264_OPT_BOOL_NONE:
499 x264_update_bool_setting(ud, name, val);
501 case X264_OPT_INT_NONE:
502 x264_update_int_setting(ud, name, val);
508 ghb_x264_parse_options(signal_user_data_t *ud, const gchar *options)
510 gchar **split = g_strsplit(options, ":", -1);
511 if (split == NULL) return;
516 for (jj = 0; jj < X264_OPT_MAP_SIZE; jj++)
517 x264_opt_map[jj].found = FALSE;
519 for (ii = 0; split[ii] != NULL; ii++)
522 gchar *pos = strchr(split[ii], '=');
528 for (jj = 0; jj < X264_OPT_MAP_SIZE; jj++)
530 if (find_syn_match(split[ii], x264_opt_map[jj].opt_syns) >= 0)
532 x264_opt_map[jj].found = TRUE;
533 switch(x264_opt_map[jj].type)
536 x264_update_int(ud, x264_opt_map[jj].name, val);
538 case X264_OPT_DOUBLE:
539 x264_update_double(ud, x264_opt_map[jj].name, val);
542 x264_update_bool(ud, x264_opt_map[jj].name, val);
545 x264_update_combo(ud, x264_opt_map[jj].name, val);
547 case X264_OPT_DEBLOCK:
548 // dirty little hack. mark deblock_beta found as well
549 x264_opt_map[jj+1].found = TRUE;
550 x264_update_deblock(ud, val);
553 // dirty little hack. mark psy_trell found as well
554 x264_opt_map[jj+1].found = TRUE;
555 x264_update_psy(ud, val);
557 case X264_OPT_BOOL_NONE:
558 x264_update_bool_setting(ud, x264_opt_map[jj].name, val);
560 case X264_OPT_INT_NONE:
561 x264_update_int_setting(ud, x264_opt_map[jj].name, val);
564 if (x264_opt_map[jj].translation == NULL)
566 val = trans_x264_val(x264_opt_map[jj].translation, val);
569 do_update(ud, x264_opt_map[jj].name,
570 x264_opt_map[jj].translation->ui_type, val);
571 // TODO un-grey the ui control
575 // TODO grey out the ui control
583 // For any options not found in the option string, set ui to
585 for (jj = 0; jj < X264_OPT_MAP_SIZE; jj++)
587 if (!x264_opt_map[jj].found)
589 gchar *val = strdup(x264_opt_map[jj].def_val);
590 switch(x264_opt_map[jj].type)
593 x264_update_int(ud, x264_opt_map[jj].name, val);
595 case X264_OPT_DOUBLE:
596 x264_update_double(ud, x264_opt_map[jj].name, val);
599 x264_update_bool(ud, x264_opt_map[jj].name, val);
602 x264_update_combo(ud, x264_opt_map[jj].name, val);
604 case X264_OPT_DEBLOCK:
605 x264_update_deblock(ud, val);
608 x264_update_psy(ud, val);
610 case X264_OPT_BOOL_NONE:
611 x264_update_bool_setting(ud, x264_opt_map[jj].name, val);
613 case X264_OPT_INT_NONE:
614 x264_update_int_setting(ud, x264_opt_map[jj].name, val);
617 if (x264_opt_map[jj].translation == NULL)
619 val = g_strdup(trans_x264_val(x264_opt_map[jj].translation, val));
622 do_update(ud, x264_opt_map[jj].name,
623 x264_opt_map[jj].translation->ui_type, val);
624 // TODO un-grey the ui control
628 // TODO grey out the ui control
632 x264_opt_map[jj].found = TRUE;
640 get_deblock_val(signal_user_data_t *ud)
644 alpha = ghb_settings_get_string(ud->settings, "x264_deblock_alpha");
645 beta = ghb_settings_get_string(ud->settings, "x264_deblock_beta");
646 result = g_strdup_printf("%s,%s", alpha, beta);
653 get_psy_val(signal_user_data_t *ud)
657 rd = ghb_settings_get_double(ud->settings, "x264_psy_rd");
658 trell = ghb_settings_get_double(ud->settings, "x264_psy_trell");
659 result = g_strdup_printf("%g|%g", rd, trell);
664 x264_opt_update(signal_user_data_t *ud, GtkWidget *widget)
667 const gchar *name = ghb_get_setting_key(widget);
668 gchar **opt_syns = NULL;
669 const gchar *def_val = NULL;
671 trans_table_t *trans;
673 for (jj = 0; jj < X264_OPT_MAP_SIZE; jj++)
675 if (strcmp(name, x264_opt_map[jj].name) == 0)
677 // found the options that needs updating
678 opt_syns = x264_opt_map[jj].opt_syns;
679 def_val = x264_opt_map[jj].def_val;
680 type = x264_opt_map[jj].type;
681 trans = x264_opt_map[jj].translation;
685 if (opt_syns != NULL)
687 GString *x264opts = g_string_new("");
689 gchar **split = NULL;
691 gboolean foundit = FALSE;
693 options = ghb_settings_get_string(ud->settings, "x264Option");
696 split = g_strsplit(options, ":", -1);
699 for (ii = 0; split && split[ii] != NULL; ii++)
703 gchar *pos = strchr(split[ii], '=');
709 syn = find_syn_match(split[ii], opt_syns);
711 { // Updating this option
714 if (type == X264_OPT_DEBLOCK)
715 val = get_deblock_val(ud);
716 else if (type == X264_OPT_PSY)
717 val = get_psy_val(ud);
721 gval = ghb_widget_value(widget);
722 if (G_VALUE_TYPE(gval) == G_TYPE_BOOLEAN)
724 if (ghb_value_boolean(gval))
731 val = ghb_widget_string(widget);
733 ghb_value_free(gval);
735 if (type == X264_OPT_TRANS)
738 tmp = g_strdup(trans_ui_val(trans, val));
745 if (strcmp(def_val, val) != 0)
747 g_string_append_printf(x264opts, "%s=%s:", opt_syns[syn], val);
751 else if (val != NULL)
752 g_string_append_printf(x264opts, "%s=%s:", split[ii], val);
754 g_string_append_printf(x264opts, "%s:", split[ii]);
757 if (split) g_strfreev(split);
761 if (type == X264_OPT_DEBLOCK)
762 val = get_deblock_val(ud);
763 else if (type == X264_OPT_PSY)
764 val = get_psy_val(ud);
768 gval = ghb_widget_value(widget);
769 if (G_VALUE_TYPE(gval) == G_TYPE_BOOLEAN)
771 if (ghb_value_boolean(gval))
778 val = ghb_widget_string(widget);
780 ghb_value_free(gval);
782 if (type == X264_OPT_TRANS)
785 tmp = g_strdup(trans_ui_val(trans, val));
792 if (strcmp(def_val, val) != 0)
794 g_string_append_printf(x264opts, "%s=%s:", opt_syns[0], val);
798 // Update the options value
799 // strip the trailing ":"
802 result = g_string_free(x264opts, FALSE);
803 len = strlen(result);
804 if (len > 0) result[len - 1] = 0;
806 sopts = sanitize_x264opts(ud, result);
807 ghb_ui_update(ud, "x264Option", ghb_string_value(sopts));
808 ghb_x264_parse_options(ud, sopts);
815 x264_find_opt(gchar **opts, gchar **opt_syns)
818 for (ii = 0; opts[ii] != NULL; ii++)
821 opt = g_strdup(opts[ii]);
822 gchar *pos = strchr(opt, '=');
827 if (find_syn_match(opt, opt_syns) >= 0)
838 x264_remove_opt(gchar **opts, gchar **opt_syns)
841 for (ii = 0; opts[ii] != NULL; ii++)
844 opt = g_strdup(opts[ii]);
845 gchar *pos = strchr(opt, '=');
850 if (find_syn_match(opt, opt_syns) >= 0)
860 x264_lookup_value(gchar **opts, gchar **opt_syns)
865 const gchar *def_val = x264_opt_get_default(opt_syns[0]);
867 pos = x264_find_opt(opts, opt_syns);
870 gchar *cpos = strchr(opts[pos], '=');
873 ret = g_strdup(cpos+1);
880 else if (def_val != NULL)
882 ret = g_strdup(def_val);
888 ghb_lookup_badapt(const gchar *options)
897 split = g_strsplit(options, ":", -1);
899 result = x264_lookup_value(split, x264_badapt_syns);
903 ret = g_strtod(result, NULL);
910 ghb_lookup_aqmode(const gchar *options)
919 split = g_strsplit(options, ":", -1);
921 result = x264_lookup_value(split, x264_aqmode_syns);
925 ret = g_strtod(result, NULL);
932 ghb_lookup_bframes(const gchar *options)
941 split = g_strsplit(options, ":", -1);
943 result = x264_lookup_value(split, x264_bframes_syns);
947 ret = g_strtod(result, NULL);
954 ghb_lookup_mbtree(const gchar *options)
956 gint ret = ghb_lookup_bframes(options) != 0;
963 split = g_strsplit(options, ":", -1);
965 result = x264_lookup_value(split, x264_mbtree_syns);
969 ret = g_strtod(result, NULL);
975 // Construct the x264 options string
976 // The result is allocated, so someone must free it at some point.
978 sanitize_x264opts(signal_user_data_t *ud, const gchar *options)
980 GString *x264opts = g_string_new("");
981 gchar **split = g_strsplit(options, ":", -1);
984 // Fix up option dependencies
985 gint subme = ghb_settings_combo_int(ud->settings, "x264_subme");
988 x264_remove_opt(split, x264_psy_syns);
990 gint trell = ghb_settings_combo_int(ud->settings, "x264_trellis");
993 gint aqmode = ghb_lookup_aqmode(options);
994 if (trell != 2 || aqmode == 0)
996 gint pos = x264_find_opt(split, x264_subme_syns);
998 split[pos] = g_strdup_printf("subme=9");
1004 gdouble psy_rd = 0., psy_trell;
1006 psy = x264_find_opt(split, x264_psy_syns);
1009 gchar *pos = strchr(split[psy], '=');
1012 x264_parse_psy(pos+1, &psy_rd, &psy_trell);
1015 split[psy] = g_strdup_printf("psy-rd=%g|0", psy_rd);
1018 gint bframes = ghb_settings_get_int(ud->settings, "x264_bframes");
1021 x264_remove_opt(split, x264_direct_syns);
1022 x264_remove_opt(split, x264_badapt_syns);
1026 x264_remove_opt(split, x264_bpyramid_syns);
1028 // Remove entries that match the defaults
1029 for (ii = 0; split[ii] != NULL; ii++)
1032 gchar *opt = g_strdup(split[ii]);
1033 gchar *pos = strchr(opt, '=');
1043 const gchar *def_val;
1044 def_val = x264_opt_get_default(opt);
1045 if (strcmp(val, def_val) == 0)
1047 // Matches the default, so remove it
1052 for (ii = 0; split[ii] != NULL; ii++)
1054 if (split[ii][0] != 0)
1055 g_string_append_printf(x264opts, "%s:", split[ii]);
1058 // strip the trailing ":"
1061 result = g_string_free(x264opts, FALSE);
1062 len = strlen(result);
1063 if (len > 0) result[len - 1] = 0;