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:
wm4 2013-09-13 19:07:30 +02:00
parent 6cec60a454
commit ea1200111d
2 changed files with 39 additions and 0 deletions

View File

@ -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,
}; };

View File

@ -841,6 +841,8 @@ static const char *backup_properties[] = {
"saturation", "saturation",
"hue", "hue",
"deinterlace", "deinterlace",
"vf",
"af",
"panscan", "panscan",
"aid", "aid",
"vid", "vid",