summaryrefslogtreecommitdiffstats
path: root/options
diff options
context:
space:
mode:
Diffstat (limited to 'options')
-rw-r--r--options/m_config.c2
-rw-r--r--options/options.c2
-rw-r--r--options/parse_configfile.c20
-rw-r--r--options/parse_configfile.h2
4 files changed, 12 insertions, 14 deletions
diff --git a/options/m_config.c b/options/m_config.c
index ac3ccc3640..59e8cb779e 100644
--- a/options/m_config.c
+++ b/options/m_config.c
@@ -758,6 +758,8 @@ struct m_profile *m_config_get_profile0(const struct m_config *config,
struct m_profile *m_config_add_profile(struct m_config *config, char *name)
{
+ if (!name || !name[0] || strcmp(name, "default") == 0)
+ return NULL; // never a real profile
struct m_profile *p = m_config_get_profile0(config, name);
if (p)
return p;
diff --git a/options/options.c b/options/options.c
index 509e8a7e2b..646ebc490f 100644
--- a/options/options.c
+++ b/options/options.c
@@ -619,7 +619,7 @@ const m_option_t mp_opts[] = {
OPT_PRINT("V", print_version),
#if HAVE_ENCODING
- OPT_STRING("o", encode_output.file, CONF_GLOBAL),
+ OPT_STRING("o", encode_output.file, CONF_GLOBAL | CONF_NOCFG | CONF_PRE_PARSE),
OPT_STRING("of", encode_output.format, CONF_GLOBAL),
OPT_STRINGLIST("ofopts*", encode_output.fopts, CONF_GLOBAL),
OPT_FLOATRANGE("ofps", encode_output.fps, CONF_GLOBAL, 0.0, 1000000.0),
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;
}
diff --git a/options/parse_configfile.h b/options/parse_configfile.h
index 65a4b49496..4a42cee001 100644
--- a/options/parse_configfile.h
+++ b/options/parse_configfile.h
@@ -22,6 +22,6 @@
#include "m_config.h"
int m_config_parse_config_file(m_config_t* config, const char *conffile,
- int flags);
+ char *initial_section, int flags);
#endif /* MPLAYER_PARSER_CFG_H */