summaryrefslogtreecommitdiffstats
path: root/libhb/preset.c
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2019-11-16 10:59:43 -0800
committerJohn Stebbins <[email protected]>2019-11-27 13:56:33 -0800
commit548fef8bb802d0995dcfa6d45373463f8ab51dea (patch)
tree955d21acfd2806c7ffc7385ebfb7cf410c2e4353 /libhb/preset.c
parenta5d359d79f28924fd0a57603793d6aa57499c49a (diff)
preset: fix import of Audio/SubTitle LanguageList "und"
"und" used to mean "match any" language. Now it means "match only undefined" language. Forgot to translate "und" to new "any" option on preset import which breaks presets that have a language list with "und" defined in it. Note that this *will* break anyones new presets where they explicitly wanted "undefined", but this is a much smaller population than those using "any".
Diffstat (limited to 'libhb/preset.c')
-rw-r--r--libhb/preset.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/libhb/preset.c b/libhb/preset.c
index 4f486ab01..7df3e3159 100644
--- a/libhb/preset.c
+++ b/libhb/preset.c
@@ -2515,6 +2515,36 @@ static hb_value_t * import_hierarchy_29_0_0(hb_value_t *presets)
return hb_value_dup(presets);
}
+static void und_to_any(hb_value_array_t * list)
+{
+ if (list == NULL)
+ {
+ return;
+ }
+
+ int count = hb_value_array_len(list);
+ int ii;
+ for (ii = 0; ii < count; ii++)
+ {
+ const char *lang;
+ lang = hb_value_get_string(hb_value_array_get(list, ii));
+ if (!strcasecmp(lang, "und"))
+ {
+ hb_value_array_set(list, ii, hb_value_string("any"));
+ }
+ }
+}
+
+static void import_lang_list_40_0_0(hb_value_t *preset)
+{
+ hb_value_array_t * lang_list;
+
+ lang_list = hb_dict_get(preset, "AudioLanguageList");
+ und_to_any(lang_list);
+ lang_list = hb_dict_get(preset, "SubtitleLanguageList");
+ und_to_any(lang_list);
+}
+
static void import_deblock_35_0_0(hb_value_t *preset)
{
int deblock = hb_dict_get_int(preset, "PictureDeblock");
@@ -3154,9 +3184,16 @@ static void import_video_0_0_0(hb_value_t *preset)
}
}
+static void import_40_0_0(hb_value_t *preset)
+{
+ import_lang_list_40_0_0(preset);
+}
+
static void import_35_0_0(hb_value_t *preset)
{
import_deblock_35_0_0(preset);
+
+ import_40_0_0(preset);
}
static void import_25_0_0(hb_value_t *preset)
@@ -3276,6 +3313,11 @@ static int preset_import(hb_value_t *preset, int major, int minor, int micro)
import_35_0_0(preset);
result = 1;
}
+ else if (cmpVersion(major, minor, micro, 40, 0, 0) <= 0)
+ {
+ import_40_0_0(preset);
+ result = 1;
+ }
preset_clean(preset, hb_preset_template);
}
return result;