mirror of https://github.com/mpv-player/mpv
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).
This commit is contained in:
parent
a473739fbf
commit
fd4e3af740
|
@ -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::
|
||||
|
|
|
@ -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-
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Reference in New Issue