summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-12-28 16:32:49 +0100
committerwm4 <wm4@nowhere>2013-12-28 16:33:21 +0100
commitfd4e3af740fc00804e3f1b932462b44f795b1095 (patch)
treec3dfbb67dc09e76a3126c693033194d3fd71834e /player
parenta473739fbfcba5fded59eaa35342127728774490 (diff)
downloadmpv-fd4e3af740fc00804e3f1b932462b44f795b1095.tar.bz2
mpv-fd4e3af740fc00804e3f1b932462b44f795b1095.tar.xz
Install encoding-profiles.conf by default
This is probably useful. Note that this includes a small, stupid hack to prevent loading of the config file if vf_lavfi is not available. The profile by default uses vf_lavfi, and the config parser will output errors if vf_lavfi is not available. As another caveat, we install the example profile even if encoding is disabled (though we don't load it, since this would print errors).
Diffstat (limited to 'player')
-rw-r--r--player/configfiles.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/player/configfiles.c b/player/configfiles.c
index 7edbb65078..88e7a71d40 100644
--- a/player/configfiles.c
+++ b/player/configfiles.c
@@ -49,14 +49,20 @@
bool mp_parse_cfgfiles(struct MPContext *mpctx)
{
struct MPOpts *opts = mpctx->opts;
- m_config_t *conf = mpctx->mconfig;
- char *conffile;
if (!opts->load_config)
return true;
- if (m_config_parse_config_file(conf, MPLAYER_CONFDIR "/mpv.conf", 0) < 0)
- return false;
+
+ m_config_t *conf = mpctx->mconfig;
+ void *tmp = talloc_new(NULL);
+ bool r = true;
+ char *conffile;
+
+ if (m_config_parse_config_file(conf, MPLAYER_CONFDIR "/mpv.conf", 0) < 0) {
+ r = false;
+ goto done;
+ }
mp_mk_config_dir(mpctx->global, NULL);
- if (!(conffile = mp_find_user_config_file(NULL, mpctx->global, "config")))
+ if (!(conffile = mp_find_user_config_file(tmp, mpctx->global, "config")))
MP_ERR(mpctx, "mp_find_user_config_file(\"config\") problem\n");
else {
int fd = open(conffile, O_CREAT | O_EXCL | O_WRONLY | O_CLOEXEC, 0666);
@@ -65,11 +71,22 @@ bool mp_parse_cfgfiles(struct MPContext *mpctx)
write(fd, DEF_CONFIG, sizeof(DEF_CONFIG) - 1);
close(fd);
}
- if (m_config_parse_config_file(conf, conffile, 0) < 0)
- return false;
- talloc_free(conffile);
+ if (m_config_parse_config_file(conf, conffile, 0) < 0) {
+ r = false;
+ goto done;
+ }
}
- return true;
+
+ // The #if is a stupid hack to avoid errors if libavfilter is not available.
+#if HAVE_VF_LAVFI && HAVE_ENCODING
+ conffile = mp_find_config_file(tmp, mpctx->global, "encoding-profiles.conf");
+ if (conffile && mp_path_exists(conffile))
+ m_config_parse_config_file(mpctx->mconfig, conffile, 0);
+#endif
+
+done:
+ talloc_free(tmp);
+ return r;
}
static int try_load_config(struct MPContext *mpctx, const char *file, int flags)