summaryrefslogtreecommitdiffstats
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
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).
-rw-r--r--DOCS/encoding.rst11
-rw-r--r--etc/encoding-profiles.conf (renamed from etc/encoding-example-profiles.conf)7
-rw-r--r--old-makefile6
-rw-r--r--player/configfiles.c35
-rw-r--r--wscript_build.py2
5 files changed, 42 insertions, 19 deletions
diff --git a/DOCS/encoding.rst b/DOCS/encoding.rst
index 979bc0b322..f2d1b75ea0 100644
--- a/DOCS/encoding.rst
+++ b/DOCS/encoding.rst
@@ -43,7 +43,7 @@ One can then encode using this profile using the command::
mpv infile -o outfile.mp4 -profile myencprofile
Some example profiles are provided in a file
-etc/encoding-example-profiles.conf; as for this, see below.
+etc/encoding-profiles.conf; as for this, see below.
Encoding examples
@@ -89,13 +89,12 @@ Device targets
As the options for various devices can get complex, profiles can be used.
An example profile file for encoding is provided in
-etc/encoding-example-profiles.conf in the source tree. You can include it into
-your configuration by doing::
+etc/encoding-profiles.conf in the source tree. This file is installed and loaded
+by default (if libavfilter is enabled at compilation). If you want to modify
+it, you can replace and it with your own copy by doing::
mkdir -p ~/.mpv
- curl https://raw.github.com/mpv-player/mpv/master/etc/encoding-example-profiles.conf \
- > ~/.mpv/encoding-profiles.conf
- echo "include = $HOME/.mpv/encoding-profiles.conf" >> ~/.mpv/config
+ cp /etc/mpv/encoding-profiles.conf ~/.mpv/encoding-profiles.conf
Refer to the top of that file for more comments - in a nutshell, the following
options are added by it::
diff --git a/etc/encoding-example-profiles.conf b/etc/encoding-profiles.conf
index cedb8066a2..dfa1dc4871 100644
--- a/etc/encoding-example-profiles.conf
+++ b/etc/encoding-profiles.conf
@@ -6,9 +6,10 @@
# encoding profile file #
#########################
#
-# Usage of this file: copy/symlink it to a fixed location, and add
-# include = /path/to/this/encoding-example-profiles.conf
-# to your ~/.mpv/config
+# Note: by default, this file is installed to /etc/mpv/encoding-profiles.conf
+# (or a different location, depending on --prefix). mpv will load it by
+# default on program start. If ~/.mpv/encoding-profiles.conf exists, this file
+# will be loaded instead.
#
# Then, list all profiles by
# mpv -profile help | grep enc-
diff --git a/old-makefile b/old-makefile
index ac7fc98502..63e61bf683 100644
--- a/old-makefile
+++ b/old-makefile
@@ -517,7 +517,11 @@ install-mpv-desktop: etc/mpv.desktop
$(INSTALL) -d $(prefix)/share/applications
$(INSTALL) -m 644 etc/mpv.desktop $(prefix)/share/applications/
-install-data: install-mpv-icons install-mpv-desktop
+install-mpv-config: etc/encoding-profiles.conf
+ $(INSTALL) -d $(CONFDIR)
+ $(INSTALL) -m 644 etc/encoding-profiles.conf $(CONFDIR)
+
+install-data: install-mpv-icons install-mpv-desktop install-mpv-config
uninstall:
$(RM) $(BINDIR)/mpv$(EXESUF)
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)
diff --git a/wscript_build.py b/wscript_build.py
index f34f304f3a..cf3ccbfe45 100644
--- a/wscript_build.py
+++ b/wscript_build.py
@@ -473,6 +473,8 @@ def build(ctx):
ctx.env.DATADIR + '/applications',
['etc/mpv.desktop'] )
+ ctx.install_files(ctx.env.CONFDIR, ['etc/encoding-profiles.conf'] )
+
for size in '16x16 32x32 64x64'.split():
ctx.install_as(
ctx.env.DATADIR + '/icons/hicolor/' + size + '/apps/mpv.png',