summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-09-13 19:07:30 +0200
committerwm4 <wm4@nowhere>2013-09-13 21:32:28 +0200
commitea1200111d984e697b5b9d789d23db3f8f73e209 (patch)
treec75044e07b17ff4b151dda124902e8a9004af8dc
parent6cec60a454889907df46bf37adddfd874884b24d (diff)
downloadmpv-ea1200111d984e697b5b9d789d23db3f8f73e209.tar.bz2
mpv-ea1200111d984e697b5b9d789d23db3f8f73e209.tar.xz
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.
-rw-r--r--mpvcore/m_option.c37
-rw-r--r--mpvcore/mplayer.c2
2 files changed, 39 insertions, 0 deletions
diff --git a/mpvcore/m_option.c b/mpvcore/m_option.c
index f538816ea7..8b33d56dc5 100644
--- a/mpvcore/m_option.c
+++ b/mpvcore/m_option.c
@@ -2403,11 +2403,48 @@ static int parse_obj_settings_list(const m_option_t *opt, struct bstr name,
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 = {
.name = "Object settings list",
.size = sizeof(m_obj_settings_t *),
.flags = M_OPT_TYPE_DYNAMIC | M_OPT_TYPE_ALLOW_WILDCARD,
.parse = parse_obj_settings_list,
+ .print = print_obj_settings_list,
.copy = copy_obj_settings_list,
.free = free_obj_settings_list,
};
diff --git a/mpvcore/mplayer.c b/mpvcore/mplayer.c
index d20f321042..542098b5e3 100644
--- a/mpvcore/mplayer.c
+++ b/mpvcore/mplayer.c
@@ -841,6 +841,8 @@ static const char *backup_properties[] = {
"saturation",
"hue",
"deinterlace",
+ "vf",
+ "af",
"panscan",
"aid",
"vid",