From 008fe558dcf5c19a19809f0bbaa1763eb8261a51 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 25 Feb 2014 22:51:55 +0100 Subject: config: when writing resume config, read options, not properties This lowers the number of data stored in the resume config a bit further, because some properties can't be read at program start and when e.g. the VO wasn't created yet. Some fields still need to be read from a property (actually only "volume-restore-data", a hack to save the full volume information). So abuse the "options/" property, and make use of the fact that changing things at runtime also changes the options. --- player/configfiles.c | 66 ++++++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'player') diff --git a/player/configfiles.c b/player/configfiles.c index 3516544dd4..37cf76b5fc 100644 --- a/player/configfiles.c +++ b/player/configfiles.c @@ -196,39 +196,39 @@ exit: } static const char *backup_properties[] = { - "osd-level", + "options/osd-level", //"loop", - "speed", - "edition", - "pause", + "options/speed", + "options/edition", + "options/pause", "volume-restore-data", - "audio-delay", + "options/audio-delay", //"balance", - "fullscreen", - "colormatrix", - "colormatrix-input-range", - "colormatrix-output-range", - "ontop", - "border", - "gamma", - "brightness", - "contrast", - "saturation", - "hue", - "deinterlace", - "vf", - "af", - "panscan", - "aid", - "vid", - "sid", - "sub-delay", - "sub-pos", - "sub-visibility", - "sub-scale", - "ass-use-margins", - "ass-vsfilter-aspect-compat", - "ass-style-override", + "options/fullscreen", + "options/colormatrix", + "options/colormatrix-input-range", + "options/colormatrix-output-range", + "options/ontop", + "options/border", + "options/gamma", + "options/brightness", + "options/contrast", + "options/saturation", + "options/hue", + "options/deinterlace", + "options/vf", + "options/af", + "options/panscan", + "options/aid", + "options/vid", + "options/sid", + "options/sub-delay", + "options/sub-pos", + "options/sub-visibility", + "options/sub-scale", + "options/ass-use-margins", + "options/ass-vsfilter-aspect-compat", + "options/ass-style-override", 0 }; @@ -241,10 +241,8 @@ void mp_get_resume_defaults(struct MPContext *mpctx) talloc_zero_array(mpctx, char*, MP_ARRAY_SIZE(backup_properties)); for (int i = 0; backup_properties[i]; i++) { const char *pname = backup_properties[i]; - char name[80]; - snprintf(name, sizeof(name), "options/%s", pname); char *val = NULL; - int r = mp_property_do(name, M_PROPERTY_GET_STRING, &val, mpctx); + int r = mp_property_do(pname, M_PROPERTY_GET_STRING, &val, mpctx); if (r == M_PROPERTY_OK) list[i] = talloc_steal(list, val); } @@ -292,6 +290,8 @@ void mp_write_watch_later_conf(struct MPContext *mpctx) char *val = NULL; int r = mp_property_do(pname, M_PROPERTY_GET_STRING, &val, mpctx); if (r == M_PROPERTY_OK) { + if (strncmp(pname, "options/", 8) == 0) + pname += 8; // Only store it if it's different from the initial value. char *prev = mpctx->resume_defaults[i]; if (!prev || strcmp(prev, val) != 0) { -- cgit v1.2.3