summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2018-06-27 11:06:02 -0700
committerJohn Stebbins <[email protected]>2018-06-27 11:06:02 -0700
commit12c76e91df09f7454726bf0628a66efbd75eb8f9 (patch)
treea294de4a4577869da9bb183cf3f2abd6083e50e9 /libhb
parentd444faf3c3cdfd888b209615d57855653c0e4732 (diff)
presets: fix importing file with "Official" presets
Convert any presets with "Type" official to custom before importing. This can happen if someone decides to try to import a full user presets file from a previous install of HandBrake.
Diffstat (limited to 'libhb')
-rw-r--r--libhb/preset.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libhb/preset.c b/libhb/preset.c
index 4a581e017..6a7f0d122 100644
--- a/libhb/preset.c
+++ b/libhb/preset.c
@@ -174,6 +174,12 @@ static int do_preset_clean(hb_value_t *preset, preset_do_context_t *do_ctx)
return PRESET_DO_NEXT;
}
+static int do_make_custom(hb_value_t *preset, preset_do_context_t *ctx)
+{
+ hb_dict_set_int(preset, "Type", HB_PRESET_TYPE_CUSTOM);
+ return PRESET_DO_NEXT;
+}
+
static int do_delete_builtin(hb_value_t *preset, preset_do_context_t *ctx)
{
if (hb_value_get_int(hb_dict_get(preset, "Type")) == HB_PRESET_TYPE_OFFICIAL)
@@ -3655,6 +3661,11 @@ int hb_presets_add_file(const char *filename)
if (preset == NULL)
return -1;
+ preset_do_context_t ctx;
+
+ ctx.path.depth = 1;
+ presets_do(do_make_custom, preset, &ctx);
+
int result = hb_presets_add(preset);
hb_value_free(&preset);