mirror of https://github.com/mpv-player/mpv
core: restore user-set video and audio filters with resume functionality
This requires adding a function that converts the filter list back to a string.
This commit is contained in:
parent
6cec60a454
commit
ea1200111d
|
@ -2403,11 +2403,48 @@ static int parse_obj_settings_list(const m_option_t *opt, struct bstr name,
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void append_param(char **res, char *param)
|
||||||
|
{
|
||||||
|
if (strspn(param, NAMECH) == strlen(param)) {
|
||||||
|
*res = talloc_strdup_append(*res, param);
|
||||||
|
} else {
|
||||||
|
// Simple escaping: %BYTECOUNT%STRING
|
||||||
|
*res = talloc_asprintf_append(*res, "%%%d%%%s", strlen(param), param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *print_obj_settings_list(const m_option_t *opt, const void *val)
|
||||||
|
{
|
||||||
|
m_obj_settings_t *list = VAL(val);
|
||||||
|
char *res = talloc_strdup(NULL, "");
|
||||||
|
for (int n = 0; list && list[n].name; n++) {
|
||||||
|
m_obj_settings_t *entry = &list[n];
|
||||||
|
if (n > 0)
|
||||||
|
res = talloc_strdup_append(res, ",");
|
||||||
|
// Assume labels and names don't need escaping
|
||||||
|
if (entry->label && entry->label[0])
|
||||||
|
res = talloc_asprintf_append(res, "@%s:", entry->label);
|
||||||
|
res = talloc_strdup_append(res, entry->name);
|
||||||
|
if (entry->attribs && entry->attribs[0]) {
|
||||||
|
res = talloc_strdup_append(res, "=");
|
||||||
|
for (int i = 0; entry->attribs[i * 2 + 0]; i++) {
|
||||||
|
if (i > 0)
|
||||||
|
res = talloc_strdup_append(res, ":");
|
||||||
|
append_param(&res, entry->attribs[i * 2 + 0]);
|
||||||
|
res = talloc_strdup_append(res, "=");
|
||||||
|
append_param(&res, entry->attribs[i * 2 + 1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
const m_option_type_t m_option_type_obj_settings_list = {
|
const m_option_type_t m_option_type_obj_settings_list = {
|
||||||
.name = "Object settings list",
|
.name = "Object settings list",
|
||||||
.size = sizeof(m_obj_settings_t *),
|
.size = sizeof(m_obj_settings_t *),
|
||||||
.flags = M_OPT_TYPE_DYNAMIC | M_OPT_TYPE_ALLOW_WILDCARD,
|
.flags = M_OPT_TYPE_DYNAMIC | M_OPT_TYPE_ALLOW_WILDCARD,
|
||||||
.parse = parse_obj_settings_list,
|
.parse = parse_obj_settings_list,
|
||||||
|
.print = print_obj_settings_list,
|
||||||
.copy = copy_obj_settings_list,
|
.copy = copy_obj_settings_list,
|
||||||
.free = free_obj_settings_list,
|
.free = free_obj_settings_list,
|
||||||
};
|
};
|
||||||
|
|
|
@ -841,6 +841,8 @@ static const char *backup_properties[] = {
|
||||||
"saturation",
|
"saturation",
|
||||||
"hue",
|
"hue",
|
||||||
"deinterlace",
|
"deinterlace",
|
||||||
|
"vf",
|
||||||
|
"af",
|
||||||
"panscan",
|
"panscan",
|
||||||
"aid",
|
"aid",
|
||||||
"vid",
|
"vid",
|
||||||
|
|
Loading…
Reference in New Issue