summaryrefslogtreecommitdiffstats
path: root/options/parse_configfile.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-04-19 22:05:17 +0200
committerwm4 <wm4@nowhere>2014-04-19 22:05:17 +0200
commitb85983a4a6f52c85651f916bfedb8234c9424634 (patch)
tree8d25ec8de84ad597e12c1e7596253739ea951cc8 /options/parse_configfile.c
parent85998f6121edb44672f51c4745fb243f3c567d3f (diff)
downloadmpv-b85983a4a6f52c85651f916bfedb8234c9424634.tar.bz2
mpv-b85983a4a6f52c85651f916bfedb8234c9424634.tar.xz
encode: don't apply default config options
Often, user configs set options that are not suitable for encoding. Usually, playback and encoding are pretty different things, so it makes sense to keep them strictly separate. There are several possible solutions. The approach taken by this commit is to basically ignore the default config settings, and switch to an [encoding] config profile section instead. This also makes it impossible to have --o in a config file, because --o enables encode mode. See github issue #727 for discussion.
Diffstat (limited to 'options/parse_configfile.c')
-rw-r--r--options/parse_configfile.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/options/parse_configfile.c b/options/parse_configfile.c
index 184bc1769a..5418082d03 100644
--- a/options/parse_configfile.c
+++ b/options/parse_configfile.c
@@ -38,14 +38,13 @@
/// Current include depth.
static int recursion_depth = 0;
-/// Setup the \ref Config from a config file.
-/** \param config The config object.
- * \param conffile Path to the config file.
- * \param flags M_SETOPT_* bits
- * \return 1 on sucess, -1 on error, 0 if file not accessible.
- */
+// Load options and profiles from from a config file.
+// conffile: path to the config file
+// initial_section: default section where to add normal options
+// flags: M_SETOPT_* bits
+// returns: 1 on sucess, -1 on error, 0 if file not accessible.
int m_config_parse_config_file(m_config_t *config, const char *conffile,
- int flags)
+ char *initial_section, int flags)
{
#define PRINT_LINENUM MP_ERR(config, "%s:%d: ", conffile, line_num)
#define MAX_LINE_LEN 10000
@@ -63,7 +62,7 @@ int m_config_parse_config_file(m_config_t *config, const char *conffile,
int param_pos; /* param pos */
int ret = 1;
int errors = 0;
- m_profile_t *profile = NULL;
+ m_profile_t *profile = m_config_add_profile(config, initial_section);
flags = flags | M_SETOPT_FROM_CONFIG_FILE;
@@ -132,10 +131,7 @@ int m_config_parse_config_file(m_config_t *config, const char *conffile,
/* Profile declaration */
if (opt_pos > 2 && opt[0] == '[' && opt[opt_pos - 1] == ']') {
opt[opt_pos - 1] = '\0';
- if (strcmp(opt + 1, "default"))
- profile = m_config_add_profile(config, opt + 1);
- else
- profile = NULL;
+ profile = m_config_add_profile(config, opt + 1);
continue;
}