summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-02-25 22:51:55 +0100
committerwm4 <wm4@nowhere>2014-02-25 22:51:55 +0100
commit008fe558dcf5c19a19809f0bbaa1763eb8261a51 (patch)
tree24824488b9b1b4fa1bbdc7e23fc8fc5ef5ee6bac /player
parent67f244c6d4b0ef9ad2e55483508efbf6fe40d03b (diff)
downloadmpv-008fe558dcf5c19a19809f0bbaa1763eb8261a51.tar.bz2
mpv-008fe558dcf5c19a19809f0bbaa1763eb8261a51.tar.xz
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.
Diffstat (limited to 'player')
-rw-r--r--player/configfiles.c66
1 files changed, 33 insertions, 33 deletions
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) {