diff options
author | Dudemanguy <random342@airmail.cc> | 2023-05-02 19:42:23 -0500 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-05-09 20:37:17 +0000 |
commit | 4502522a7aee093c923e79a65e4684ea2634af30 (patch) | |
tree | d7855be2c4cfb6a16edc784da0e6f3dad29ee667 /video/out/gpu/lcms.c | |
parent | 7c4c9bc86f55f4d1224814fbeafdee8f1c3c3108 (diff) | |
download | mpv-4502522a7aee093c923e79a65e4684ea2634af30.tar.bz2 mpv-4502522a7aee093c923e79a65e4684ea2634af30.tar.xz |
player: use XDG_CACHE_HOME by default
This adds cache as a possible path for mpv to internally pick
(~/.cache/mpv for non-darwin unix-like systems, the usual config
directory for everyone else). For gpu shader cache and icc cache,
controlling whether or not to write such files is done with the new
--gpu-shader-cache and --icc-cache options respectively. Additionally,
--cache-on-disk no longer requires explicitly setting the --cache-dir
option. The old options, --cache-dir, --gpu-shader-cache-dir, and
--icc-cache-dir simply set an override for the directory to save cache
files. If unset, then the cache is saved in XDG_CACHE_HOME.
Diffstat (limited to 'video/out/gpu/lcms.c')
-rw-r--r-- | video/out/gpu/lcms.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/video/out/gpu/lcms.c b/video/out/gpu/lcms.c index bbf857d968..be65dc965e 100644 --- a/video/out/gpu/lcms.c +++ b/video/out/gpu/lcms.c @@ -332,7 +332,7 @@ bool gl_lcms_get_lut3d(struct gl_lcms *p, struct lut3d **result_lut3d, cmsContext cms = NULL; char *cache_file = NULL; - if (p->opts->cache_dir && p->opts->cache_dir[0]) { + if (p->opts->cache) { // Gamma is included in the header to help uniquely identify it, // because we may change the parameter in the future or make it // customizable, same for the primaries. @@ -352,7 +352,13 @@ bool gl_lcms_get_lut3d(struct gl_lcms *p, struct lut3d **result_lut3d, av_sha_final(sha, hash); av_free(sha); - char *cache_dir = mp_get_user_path(tmp, p->global, p->opts->cache_dir); + char *cache_dir = p->opts->cache_dir; + if (cache_dir && cache_dir[0]) { + cache_dir = mp_get_user_path(NULL, p->global, cache_dir); + } else { + cache_dir = mp_find_user_file(NULL, p->global, "cache", ""); + } + cache_file = talloc_strdup(tmp, ""); for (int i = 0; i < sizeof(hash); i++) cache_file = talloc_asprintf_append(cache_file, "%02X", hash[i]); @@ -494,13 +500,13 @@ const struct m_sub_options mp_icc_conf = { {"use-embedded-icc-profile", OPT_BOOL(use_embedded)}, {"icc-profile", OPT_STRING(profile), .flags = M_OPT_FILE}, {"icc-profile-auto", OPT_BOOL(profile_auto)}, + {"icc-cache", OPT_BOOL(cache)}, {"icc-cache-dir", OPT_STRING(cache_dir), .flags = M_OPT_FILE}, {"icc-intent", OPT_INT(intent)}, {"icc-force-contrast", OPT_CHOICE(contrast, {"no", 0}, {"inf", -1}), M_RANGE(0, 1000000)}, {"icc-3dlut-size", OPT_STRING_VALIDATE(size_str, validate_3dlut_size_opt)}, {"3dlut-size", OPT_REPLACED("icc-3dlut-size")}, - {"icc-cache", OPT_REMOVED("see icc-cache-dir")}, {"icc-contrast", OPT_REMOVED("see icc-force-contrast")}, {0} }, |