summaryrefslogtreecommitdiffstats
path: root/gtk/src
diff options
context:
space:
mode:
Diffstat (limited to 'gtk/src')
-rw-r--r--gtk/src/callbacks.c27
-rw-r--r--gtk/src/hb-backend.c96
-rw-r--r--gtk/src/hb-backend.h1
-rw-r--r--gtk/src/main.c1
-rw-r--r--gtk/src/settings.c23
-rw-r--r--gtk/src/values.c99
-rw-r--r--gtk/src/values.h1
7 files changed, 215 insertions, 33 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c
index ebc592534..1b887bafc 100644
--- a/gtk/src/callbacks.c
+++ b/gtk/src/callbacks.c
@@ -34,6 +34,7 @@
#include "hb-backend.h"
#include "ghb-dvd.h"
#include "ghbcellrenderertext.h"
+#include "hb.h"
static void update_chapter_list(signal_user_data_t *ud);
static void clear_audio_list(signal_user_data_t *ud);
@@ -974,9 +975,10 @@ adjust_audio_rate_combos(signal_user_data_t *ud)
{
if (ghb_get_audio_info (&ainfo, titleindex, audioindex))
{
+ gint br = ainfo.bitrate / 1000;
// Set the values for bitrate and samplerate to the input rates
- ghb_set_passthru_rate_opts (ud->builder, ainfo.bitrate);
- ghb_ui_update(ud, "audio_bitrate", ghb_int64_value(ainfo.bitrate));
+ ghb_set_passthru_rate_opts (ud->builder, br);
+ ghb_ui_update(ud, "audio_bitrate", ghb_int64_value(br));
ghb_ui_update(ud, "audio_rate", ghb_int64_value(0));
ghb_ui_update(ud, "audio_mix", ghb_int64_value(0));
}
@@ -2427,9 +2429,11 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter)
GString *str = g_string_new("");
gboolean markers;
gboolean preset_modified;
+ gint mux;
gval = ghb_settings_get_value(settings, "container");
container = ghb_lookup_container_option(gval);
+ mux = ghb_lookup_container(gval);
dest = ghb_settings_get_string(settings, "destination");
preset_modified = ghb_settings_get_boolean(settings, "preset_modified");
preset = ghb_settings_get_string(settings, "preset");
@@ -2451,6 +2455,25 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter)
g_string_append_printf(str,
"<b>Format:</b> %s Container\n", container);
}
+ if (mux == HB_MUX_MP4)
+ {
+ gboolean ipod, http, large;
+
+ ipod = ghb_settings_get_boolean(settings, "ipod_file");
+ http = ghb_settings_get_boolean(settings, "http_optimize_mp4");
+ large = ghb_settings_get_boolean(settings, "large_mp4");
+ if (http || ipod || large)
+ {
+ g_string_append_printf(str, "<b>MP4 Options:</b>");
+ if (ipod)
+ g_string_append_printf(str, " - iPod Atom");
+ if (http)
+ g_string_append_printf(str, " - Http Optimized");
+ if (large)
+ g_string_append_printf(str, " - 64 Bit");
+ g_string_append_printf(str, "\n");
+ }
+ }
g_string_append_printf(str, "<b>Destination:</b> %s\n", dest);
width = ghb_settings_get_int(settings, "scale_width");
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index fb8c271a4..0a2fa6a64 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -502,6 +502,25 @@ ghb_lookup_vcodec_option(const GValue *vcodec)
return result;
}
+gint
+ghb_lookup_container(const GValue *container)
+{
+ gint ii;
+ gchar *str;
+ gint result = -1;
+
+ str = ghb_value_string(container);
+ for (ii = 0; ii < container_opts.count; ii++)
+ {
+ if (strcmp(container_opts.map[ii].shortOpt, str) == 0)
+ {
+ result = container_opts.map[ii].ivalue;
+ }
+ }
+ g_free(str);
+ return result;
+}
+
const gchar*
ghb_lookup_container_option(const GValue *container)
{
@@ -658,37 +677,41 @@ ghb_lookup_mix(const GValue *mix)
return result;
}
-#if 0
gint
-ghb_lookup_bitrate(const gchar *bitrate)
+ghb_lookup_rate(const GValue *rate)
{
gint ii;
+ gchar *str;
+ gint result = 0;
- for (ii = 0; ii < hb_audio_bitrates_count; ii++)
+ // Coincidentally, the string "source" will return 0
+ // which is our flag to use "same as source"
+ str = ghb_value_string(rate);
+ for (ii = 0; ii < hb_audio_rates_count; ii++)
{
- if (strcmp(hb_audio_bitrates[ii].string, bitrate) == 0)
+ if (strcmp(hb_audio_rates[ii].string, str) == 0)
{
- return hb_audio_bitrates[ii].rate * 1000;
+ result = hb_audio_rates[ii].rate;
}
}
- return 160 * 1000;
+ g_free(str);
+ return result;
}
+#if 0
gint
-ghb_lookup_rate(const gchar *rate)
+ghb_lookup_bitrate(const gchar *bitrate)
{
gint ii;
- for (ii = 0; ii < hb_audio_rates_count; ii++)
+ for (ii = 0; ii < hb_audio_bitrates_count; ii++)
{
- if (strcmp(hb_audio_rates[ii].string, rate) == 0)
+ if (strcmp(hb_audio_bitrates[ii].string, bitrate) == 0)
{
- return hb_audio_rates[ii].rate;
+ return hb_audio_bitrates[ii].rate;
}
}
- // Coincidentally, the string "source" will return 0
- // which is our flag to use "same as source"
- return 0;
+ return 160;
}
gdouble
@@ -725,6 +748,28 @@ get_acodec_value(gint val)
}
static GValue*
+get_abitrate_value(gint val)
+{
+ GValue *value = NULL;
+ gint ii;
+
+ for (ii = 0; ii < hb_audio_bitrates_count; ii++)
+ {
+ if (hb_audio_bitrates[ii].rate == val)
+ {
+ value = ghb_combo_value_new(
+ ii,
+ hb_audio_bitrates[ii].string,
+ hb_audio_bitrates[ii].string,
+ hb_audio_bitrates[ii].string,
+ hb_audio_bitrates[ii].rate);
+ break;
+ }
+ }
+ return value;
+}
+
+static GValue*
get_amix_value(gint val)
{
GValue *value = NULL;
@@ -1080,7 +1125,7 @@ audio_bitrate_opts_set(GtkBuilder *builder, const gchar *name, hb_rate_t *rates,
0, rates[ii].string,
1, TRUE,
2, rates[ii].string,
- 3, rates[ii].rate * 1000,
+ 3, rates[ii].rate,
4, rates[ii].string,
-1);
}
@@ -1102,7 +1147,7 @@ audio_bitrate_opts_clean(GtkBuilder *builder, const gchar *name, hb_rate_t *rate
do
{
gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 3, &ivalue, -1);
- if (search_rates(rates, ivalue/1000, count) < 0)
+ if (search_rates(rates, ivalue, count) < 0)
{
done = !gtk_list_store_remove(store, &iter);
changed = TRUE;
@@ -1340,7 +1385,7 @@ audio_rate_opts_add(GtkBuilder *builder, const gchar *name, gint rate)
store = get_combo_box_store(builder, name);
if (!find_combo_item_by_int(GTK_TREE_MODEL(store), rate, &iter))
{
- str = g_strdup_printf ("%.8g", (gdouble)rate/1000.0);
+ str = g_strdup_printf ("%d", rate);
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
0, str,
@@ -1394,15 +1439,19 @@ audio_track_opts_set(GtkBuilder *builder, const gchar *name, gint titleindex)
}
for (ii = 0; ii < count; ii++)
{
+ gchar *str;
+
audio = (hb_audio_config_t *) hb_list_audio_config_item( title->list_audio, ii );
gtk_list_store_append(store, &iter);
+ str = g_strdup_printf("%d", ii);
gtk_list_store_set(store, &iter,
0, audio->lang.description,
1, TRUE,
- 2, audio->lang.description,
+ 2, str,
3, ii,
- 4, audio->lang.description,
+ 4, str,
-1);
+ g_free(str);
}
}
@@ -2508,6 +2557,8 @@ ghb_validate_container(signal_user_data_t *ud)
GValue *value;
value = get_acodec_value(HB_ACODEC_FAAC);
ghb_settings_take_value(asettings, "audio_codec", value);
+ value = get_abitrate_value(160);
+ ghb_settings_take_value(asettings, "audio_bitrate", value);
}
}
}
@@ -2801,7 +2852,7 @@ ghb_add_job(GValue *js, gint unique_id)
job = title->job;
if (job == NULL) return;
- tweaks = ghb_settings_get_int(js, "allow_tweaks");
+ tweaks = ghb_settings_get_boolean(js, "allow_tweaks");
job->mux = ghb_lookup_mux(ghb_settings_get_value(js, "container"));
if (job->mux == HB_MUX_MP4)
{
@@ -3094,8 +3145,9 @@ ghb_add_job(GValue *js, gint unique_id)
audio.out.mixdown = ghb_get_best_mix(titleindex,
audio.in.track, audio.out.codec, audio.out.mixdown);
audio.out.bitrate =
- ghb_settings_get_int(asettings, "audio_bitrate") / 1000;
- gint srate = ghb_settings_get_int(asettings, "audio_rate");
+ ghb_settings_get_int(asettings, "audio_bitrate");
+ gint srate = ghb_lookup_rate(
+ ghb_settings_get_value(asettings, "audio_rate"));
if (srate == 0) // 0 is same as source
audio.out.samplerate = taudio->in.samplerate;
else
@@ -3136,7 +3188,7 @@ ghb_add_job(GValue *js, gint unique_id)
{
job->x264opts = NULL;
}
- gint subtitle = ghb_settings_get_int(js, "subtitle_lang");
+ gint subtitle;
gchar *slang = ghb_settings_get_string(js, "subtitle_lang");
subtitle = -2; // default to none
if (strcmp(slang, "auto") == 0)
diff --git a/gtk/src/hb-backend.h b/gtk/src/hb-backend.h
index 0f52355bc..a67bbb00c 100644
--- a/gtk/src/hb-backend.h
+++ b/gtk/src/hb-backend.h
@@ -136,6 +136,7 @@ const gchar* ghb_lookup_acodec_option(const GValue *acodec);
gint ghb_lookup_mix(const GValue *mix);
const gchar* ghb_lookup_mix_option(const GValue *mix);
const gchar* ghb_lookup_container_option(const GValue *container);
+gint ghb_lookup_container(const GValue *container);
const gchar* ghb_lookup_vcodec_option(const GValue *vcodec);
#if 0
gint ghb_lookup_bitrate(const gchar *bitrate);
diff --git a/gtk/src/main.c b/gtk/src/main.c
index 6dd4aa293..ed07b5ca3 100644
--- a/gtk/src/main.c
+++ b/gtk/src/main.c
@@ -475,6 +475,7 @@ main (int argc, char *argv[])
gtk_set_locale ();
gtk_init (&argc, &argv);
+ ghb_register_transforms();
ghb_resource_init();
ghb_load_icons();
diff --git a/gtk/src/settings.c b/gtk/src/settings.c
index d7b824bbb..4167a160f 100644
--- a/gtk/src/settings.c
+++ b/gtk/src/settings.c
@@ -456,6 +456,9 @@ update_widget(GtkWidget *widget, const GValue *value)
gint ival;
gdouble dval;
+ type = G_VALUE_TYPE(value);
+ if (type == ghb_array_get_type() || type == ghb_dict_get_type())
+ return;
if (value == NULL) return;
str = ghb_value_string(value);
ival = ghb_value_int(value);
@@ -642,22 +645,24 @@ struct x264_opt_map_s
};
static gchar *x264_ref_syns[] = {"ref", "frameref", NULL};
-static gchar *x264_mixed_syns[] = {"mixed-refs", NULL};
+static gchar *x264_mixed_syns[] = {"mixed-refs", "mixed_refs", NULL};
static gchar *x264_bframes_syns[] = {"bframes", NULL};
-static gchar *x264_direct_syns[] = {"direct", "direct-pred", NULL};
-static gchar *x264_weightb_syns[] = {"weightb", "weight-b", NULL};
-static gchar *x264_brdo_syns[] = {"brdo", "b-rdo", NULL};
+static gchar *x264_direct_syns[] =
+ {"direct", "direct-pred", "direct_pred", NULL};
+static gchar *x264_weightb_syns[] = {"weightb", "weight-b", "weight_b", NULL};
+static gchar *x264_brdo_syns[] = {"brdo", "b-rdo", "b_rdo", NULL};
static gchar *x264_bime_syns[] = {"bime", NULL};
-static gchar *x264_bpyramid_syns[] = {"b-pyramid", NULL};
+static gchar *x264_bpyramid_syns[] = {"b-pyramid", "b_pyramid", NULL};
static gchar *x264_me_syns[] = {"me", NULL};
-static gchar *x264_merange_syns[] = {"merange", "me-range", NULL};
+static gchar *x264_merange_syns[] = {"merange", "me-range", "me_range", NULL};
static gchar *x264_subme_syns[] = {"subme", "subq", NULL};
static gchar *x264_analyse_syns[] = {"analyse", "partitions", NULL};
static gchar *x264_8x8dct_syns[] = {"8x8dct", NULL};
static gchar *x264_deblock_syns[] = {"deblock", "filter", NULL};
static gchar *x264_trellis_syns[] = {"trellis", NULL};
-static gchar *x264_pskip_syns[] = {"no-fast-pskip", NULL};
-static gchar *x264_decimate_syns[] = {"no-dct-decimate", NULL};
+static gchar *x264_pskip_syns[] = {"no-fast-pskip", "no_fast_pskip", NULL};
+static gchar *x264_decimate_syns[] =
+ {"no-dct-decimate", "no_dct_decimate", NULL};
static gchar *x264_cabac_syns[] = {"cabac", NULL};
static gint
@@ -684,7 +689,7 @@ struct x264_opt_map_s x264_opt_map[] =
{x264_bpyramid_syns, "x264_bpyramid", "0", X264_OPT_BOOL},
{x264_me_syns, "x264_me", "hex", X264_OPT_COMBO},
{x264_merange_syns, "x264_merange", "16", X264_OPT_INT},
- {x264_subme_syns, "x264_subme", "5", X264_OPT_COMBO},
+ {x264_subme_syns, "x264_subme", "4", X264_OPT_COMBO},
{x264_analyse_syns, "x264_analyse", "some", X264_OPT_COMBO},
{x264_8x8dct_syns, "x264_8x8dct", "0", X264_OPT_BOOL},
{x264_deblock_syns, "x264_deblock_alpha", "0,0", X264_OPT_DEBLOCK},
diff --git a/gtk/src/values.c b/gtk/src/values.c
index 1d41d56a8..6e8a06e4c 100644
--- a/gtk/src/values.c
+++ b/gtk/src/values.c
@@ -45,6 +45,41 @@ ghb_value_dup(const GValue *val)
return copy;
}
+static void
+debug_show_type(GType tp)
+{
+ const gchar *str = "unknown";
+ if (tp == G_TYPE_STRING)
+ {
+ str ="string";
+ }
+ else if (tp == G_TYPE_INT)
+ {
+ str ="int";
+ }
+ else if (tp == G_TYPE_INT64)
+ {
+ str ="int64";
+ }
+ else if (tp == G_TYPE_BOOLEAN)
+ {
+ str ="bool";
+ }
+ else if (tp == ghb_combodata_get_type())
+ {
+ str ="combo";
+ }
+ else if (tp == ghb_array_get_type())
+ {
+ str ="array";
+ }
+ else if (tp == ghb_dict_get_type())
+ {
+ str ="dict";
+ }
+ g_debug("%s", str);
+}
+
gint
ghb_value_int(const GValue *val)
{
@@ -56,7 +91,11 @@ ghb_value_int(const GValue *val)
{
g_value_init(&xform, G_TYPE_INT64);
if (!g_value_transform(val, &xform))
+ {
+ debug_show_type(G_VALUE_TYPE(val));
+ g_warning("int can't transform");
return 0;
+ }
result = (gint)g_value_get_int64(&xform);
g_value_unset(&xform);
}
@@ -78,7 +117,11 @@ ghb_value_int64(const GValue *val)
{
g_value_init(&xform, G_TYPE_INT64);
if (!g_value_transform(val, &xform))
+ {
+ debug_show_type(G_VALUE_TYPE(val));
+ g_warning("int64 can't transform");
return 0;
+ }
result = g_value_get_int64(&xform);
g_value_unset(&xform);
}
@@ -100,7 +143,11 @@ ghb_value_double(const GValue *val)
{
g_value_init(&xform, G_TYPE_DOUBLE);
if (!g_value_transform(val, &xform))
+ {
+ debug_show_type(G_VALUE_TYPE(val));
+ g_warning("double can't transform");
return 0;
+ }
result = g_value_get_double(&xform);
g_value_unset(&xform);
}
@@ -122,7 +169,11 @@ ghb_value_string(const GValue *val)
{
g_value_init(&xform, G_TYPE_STRING);
if (!g_value_transform(val, &xform))
+ {
+ debug_show_type(G_VALUE_TYPE(val));
+ g_warning("string can't transform");
return NULL;
+ }
result = g_strdup(g_value_get_string(&xform));
g_value_unset(&xform);
}
@@ -144,7 +195,11 @@ ghb_value_boolean(const GValue *val)
{
g_value_init(&xform, G_TYPE_BOOLEAN);
if (!g_value_transform(val, &xform))
+ {
+ debug_show_type(G_VALUE_TYPE(val));
+ g_warning("boolean can't transform");
return FALSE;
+ }
result = g_value_get_boolean(&xform);
g_value_unset(&xform);
}
@@ -702,3 +757,47 @@ ghb_array_len(const GValue *gval)
return arr->len;
}
+static void
+xform_string_int(const GValue *sval, GValue *ival)
+{
+ const gchar *str = g_value_get_string(sval);
+ gint val = g_strtod(str, NULL);
+ g_value_set_int(ival, val);
+}
+
+static void
+xform_string_int64(const GValue *sval, GValue *ival)
+{
+ const gchar *str = g_value_get_string(sval);
+ gint64 val = g_strtod(str, NULL);
+ g_value_set_int64(ival, val);
+}
+
+static void
+xform_string_double(const GValue *sval, GValue *dval)
+{
+ const gchar *str = g_value_get_string(sval);
+ double val = g_strtod(str, NULL);
+ g_value_set_double(dval, val);
+}
+
+static void
+xform_boolean_double(const GValue *bval, GValue *dval)
+{
+ gboolean b = g_value_get_boolean(bval);
+ double val = b;
+ g_value_set_double(dval, val);
+}
+
+void
+ghb_register_transforms()
+{
+ g_value_register_transform_func(G_TYPE_STRING, G_TYPE_INT64,
+ xform_string_int64);
+ g_value_register_transform_func(G_TYPE_STRING, G_TYPE_INT,
+ xform_string_int);
+ g_value_register_transform_func(G_TYPE_STRING, G_TYPE_DOUBLE,
+ xform_string_double);
+ g_value_register_transform_func(G_TYPE_BOOLEAN, G_TYPE_DOUBLE,
+ xform_boolean_double);
+}
diff --git a/gtk/src/values.h b/gtk/src/values.h
index ceea09467..d184a5f86 100644
--- a/gtk/src/values.h
+++ b/gtk/src/values.h
@@ -91,6 +91,7 @@ void ghb_dict_insert(GValue *gval, gchar *key, GValue *val);
void ghb_dict_iter_init(GHashTableIter *iter, GValue *gval);
GValue* ghb_dict_lookup(GValue *gval, const gchar *key);
gboolean ghb_dict_remove(GValue *gval, const gchar *key);
+void ghb_register_transforms(void);
#endif // _GHB_VALUES_H_