OSDN Git Service

LinGui: Picture Filter enhancements
[handbrake-jp/handbrake-jp-git.git] / gtk / src / presets.c
index 0e40e6d..5cbab83 100644 (file)
@@ -555,7 +555,7 @@ presets_find_default2(GValue *presets, gint *len)
                {
                        if (preset_is_default(dict))
                        {
-                               indices = malloc(MAX_NESTED_PRESET * sizeof(gint));
+                               indices = g_malloc(MAX_NESTED_PRESET * sizeof(gint));
                                indices[*len] = ii;
                                (*len)++;
                                return indices;
@@ -861,21 +861,6 @@ preset_to_ui(signal_user_data_t *ud, GValue *dict)
        init_settings_from_dict(ud->settings, hidden, dict);
        init_ui_from_dict(ud, internal, dict);
        init_ui_from_dict(ud, hidden, dict);
-
-       if (ghb_settings_get_boolean(ud->settings, "allow_tweaks"))
-       {
-               const GValue *gval;
-               gval = preset_dict_get_value(dict, "PictureDeinterlace");
-               if (gval)
-               {
-                       ghb_ui_update(ud, "tweak_PictureDeinterlace", gval);
-               }
-               gval = preset_dict_get_value(dict, "PictureDenoise");
-               if (gval)
-               {
-                       ghb_ui_update(ud, "tweak_PictureDenoise", gval);
-               }
-       }
 }
 
 void
@@ -1177,12 +1162,14 @@ ghb_prefs_to_ui(signal_user_data_t *ud)
        }
        gval = ghb_settings_get_value(ud->settings, "default_source");
        ghb_settings_set_value (ud->settings, "source", gval);
+
        str = ghb_settings_get_string(ud->settings, "destination_dir");
+       ghb_ui_update(ud, "dest_dir", ghb_string_value(str));
 
-       gchar *path = g_strdup_printf ("%s/new_video.mp4", str);
-       ghb_ui_update(ud, "destination", ghb_string_value(path));
+       gchar *file = g_strdup_printf ("new_video.mp4");
+       ghb_ui_update(ud, "dest_file", ghb_string_value(file));
        g_free(str);
-       g_free(path);
+       g_free(file);
 
        prefs_initializing = FALSE;
 }
@@ -1719,18 +1706,36 @@ value_map_t mix_xlat[] =
 value_map_t deint_xlat[] =
 {
        {"0", "none"},
-       {"1", "fast"},
-       {"2", "slow"},
-       {"3", "slower"},
+       {"1", "custom"},
+       {"2", "fast"},
+       {"3", "slow"},
+       {"4", "slower"},
        {NULL, NULL}
 };
 
 value_map_t denoise_xlat[] =
 {
        {"0", "none"},
-       {"1", "weak"},
-       {"2", "medium"},
-       {"3", "strong"},
+       {"1", "custom"},
+       {"2", "weak"},
+       {"3", "medium"},
+       {"4", "strong"},
+       {NULL, NULL}
+};
+
+value_map_t detel_xlat[] =
+{
+       {"0", "none"},
+       {"1", "custom"},
+       {"2", "default"},
+       {NULL, NULL}
+};
+
+value_map_t decomb_xlat[] =
+{
+       {"0", "none"},
+       {"1", "custom"},
+       {"2", "default"},
        {NULL, NULL}
 };
 
@@ -1931,6 +1936,20 @@ export_value_xlat(GValue *dict)
        gval = export_value_xlat2(framerate_xlat, lin_val, G_TYPE_STRING);
        if (gval)
                ghb_dict_insert(dict, g_strdup(key), gval);
+       key = "PictureDetelecine";
+       lin_val = ghb_dict_lookup(dict, key);
+       gval = export_value_xlat2(detel_xlat, lin_val, G_TYPE_INT);
+       if (gval)
+               ghb_dict_insert(dict, g_strdup(key), gval);
+       else
+               ghb_dict_insert(dict, g_strdup(key), ghb_value_dup(lin_val));
+       key = "PictureDecomb";
+       lin_val = ghb_dict_lookup(dict, key);
+       gval = export_value_xlat2(decomb_xlat, lin_val, G_TYPE_INT);
+       if (gval)
+               ghb_dict_insert(dict, g_strdup(key), gval);
+       else
+               ghb_dict_insert(dict, g_strdup(key), ghb_value_dup(lin_val));
        key = "PictureDeinterlace";
        lin_val = ghb_dict_lookup(dict, key);
        gval = export_value_xlat2(deint_xlat, lin_val, G_TYPE_INT);
@@ -2053,6 +2072,16 @@ import_value_xlat(GValue *dict)
        gval = import_value_xlat2(defaults, framerate_xlat, key, mac_val);
        if (gval)
                ghb_dict_insert(dict, g_strdup(key), gval);
+       key = "PictureDetelecine";
+       mac_val = ghb_dict_lookup(dict, key);
+       gval = import_value_xlat2(defaults, detel_xlat, key, mac_val);
+       if (gval)
+               ghb_dict_insert(dict, g_strdup(key), gval);
+       key = "PictureDecomb";
+       mac_val = ghb_dict_lookup(dict, key);
+       gval = import_value_xlat2(defaults, decomb_xlat, key, mac_val);
+       if (gval)
+               ghb_dict_insert(dict, g_strdup(key), gval);
        key = "PictureDeinterlace";
        mac_val = ghb_dict_lookup(dict, key);
        gval = import_value_xlat2(defaults, deint_xlat, key, mac_val);
@@ -2285,6 +2314,7 @@ export_xlat_preset(GValue *dict)
                ghb_dict_insert(dict, g_strdup("VideoQualityType"), 
                                                ghb_int_value_new(2));
        }
+       ghb_dict_remove(dict, "UsesMaxPictureSettings");
        ghb_dict_remove(dict, "autoscale");
        ghb_dict_remove(dict, "anamorphic");
        ghb_dict_remove(dict, "vquality_type_target");
@@ -2392,18 +2422,21 @@ ghb_presets_load()
        if (presetsPlist == NULL)
        {
                presetsPlist = ghb_value_dup(ghb_resource_get("standard-presets"));
+               import_xlat_presets(presetsPlist);
                store_presets();
        }
        else if (G_VALUE_TYPE(presetsPlist) == ghb_dict_get_type())
        { // Presets is older dictionary format. Convert to array
                ghb_value_free(presetsPlist);
                presetsPlist = ghb_value_dup(ghb_resource_get("standard-presets"));
+               import_xlat_presets(presetsPlist);
                store_presets();
        }
        else if (check_old_presets())
        {
                ghb_value_free(presetsPlist);
                presetsPlist = ghb_value_dup(ghb_resource_get("standard-presets"));
+               import_xlat_presets(presetsPlist);
                store_presets();
        }
        import_xlat_presets(presetsPlist);
@@ -2457,23 +2490,7 @@ settings_save(signal_user_data_t *ud, const GValue *path)
                        return;
                }
        }
-
-       if (ghb_settings_get_boolean(ud->settings, "allow_tweaks"))
-       {
-               gchar *str;
-               str = ghb_settings_get_string(ud->settings, "tweak_PictureDeinterlace");
-               if (str)
-               {
-                       ghb_settings_set_string(ud->settings, "PictureDeinterlace", str);
-                       g_free(str);
-               }
-               str = ghb_settings_get_string(ud->settings, "tweak_PictureDenoise");
-               if (str)
-               {
-                       ghb_settings_set_string(ud->settings, "PictureDenoise", str);
-                       g_free(str);
-               }
-       }
+       current_preset = dict;
        autoscale = ghb_settings_get_boolean(ud->settings, "autoscale");
        ghb_settings_set_int64(ud->settings, "Type", PRESETS_CUSTOM);