2010-01-30 23:24:23 +00:00
|
|
|
/*
|
|
|
|
* This file is part of MPlayer.
|
|
|
|
*
|
|
|
|
* MPlayer is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* MPlayer is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
2008-02-22 09:09:46 +00:00
|
|
|
#ifndef MPLAYER_M_CONFIG_H
|
|
|
|
#define MPLAYER_M_CONFIG_H
|
2002-11-12 01:56:42 +00:00
|
|
|
|
2011-07-27 17:59:44 +00:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
2012-11-09 00:06:43 +00:00
|
|
|
#include "core/bstr.h"
|
2011-07-27 17:59:44 +00:00
|
|
|
|
2011-07-05 19:31:44 +00:00
|
|
|
// m_config provides an API to manipulate the config variables in MPlayer.
|
|
|
|
// It makes use of the Options API to provide a context stack that
|
|
|
|
// allows saving and later restoring the state of all variables.
|
|
|
|
|
2006-01-24 11:16:13 +00:00
|
|
|
typedef struct m_profile m_profile_t;
|
2002-11-12 01:56:42 +00:00
|
|
|
struct m_option;
|
|
|
|
struct m_option_type;
|
2012-08-06 15:45:17 +00:00
|
|
|
struct m_sub_options;
|
2002-11-12 01:56:42 +00:00
|
|
|
|
2011-07-05 19:31:44 +00:00
|
|
|
// Config option
|
2002-11-12 01:56:42 +00:00
|
|
|
struct m_config_option {
|
2011-07-05 19:31:44 +00:00
|
|
|
struct m_config_option *next;
|
options: drop --opt:subopt option names
For all suboptions, "flat" options were available by separating the
parent option and the sub option with ":", e.g. "--rawvideo:w=123". Drop
this syntax and use "-" as separator. This means even suboptions are
available as normal options now, e.g. "--rawvideo-w=123". The old syntax
doesn't work anymore.
Note that this is completely separate from actual suboptions. For
example, "-rawvideo w=123:h=123" still works. (Not that this syntax is
worth supporting, but it's needed anyway, for for other things like vf
and vo suboptions.)
As a consequence of this change, we also have to add new "no-" prefixed
options for flag suboptions, so that "--no-input-default-bindings"
works. ("--input-no-default-bindings" also works as a consequence of
allowing "-input no-default-bindings" - they are handled by the same
underlying option.)
For --input, always use the full syntax in the manpage. There exist
suboptions other than --input (like --tv, --rawvideo, etc.), but since
they might be handled differently in the future, don't touch these yet.
M_OPT_PREFIXED becomes the default, so remove it. As a minor unrelated
cleanup, get rid of M_OPT_MERGE too and use the OPT_SUBSTRUCT() macro in
some places.
Unrelated: remove the duplicated --tv:buffersize option, fix a typo in
changes.rst.
2013-02-21 21:10:21 +00:00
|
|
|
// Full name (ie option-subopt).
|
2011-07-05 19:31:44 +00:00
|
|
|
char *name;
|
|
|
|
// Option description.
|
|
|
|
const struct m_option *opt;
|
2012-08-06 15:45:17 +00:00
|
|
|
// Raw value of the option.
|
|
|
|
void *data;
|
mplayer: turn playtree into a list, and change per-file option handling
Summary:
- There is no playtree anymore. It's reduced to a simple list.
- Options are now always global. You can still have per-file options,
but these are optional and require special syntax.
- The slave command pt_step has been removed, and playlist_next
and playlist_prev added. (See etc/input.conf changes.)
This is a user visible incompatible change, and will break slave-mode
applications.
- The pt_clear slave command is renamed to playlist_clear.
- Playtree entries could have multiple files. This is not the case
anymore, and playlist entries have always exactly one entry. Whenever
something adds more than one file (like ASX playlists or dvd:// or
dvdnav:// on the command line), all files are added as separate
playlist entries.
Note that some of the changes are quite deep and violent. Expect
regressions.
The playlist parsing code in particular is of low quality. I didn't try
to improve it, and merely spent to least effort necessary to keep it
somehow working. (Especially ASX playlist handling.)
The playtree code was complicated and bloated. It was also barely used.
Most users don't even know that mplayer manages the playlist as tree,
or how to use it. The most obscure features was probably specifying a
tree on command line (with '{' and '}' to create/close tree nodes). It
filled the player code with complexity and confused users with weird
slave commands like pt_up.
Replace the playtree with a simple flat playlist. Playlist parsers that
actually return trees are changed to append all files to the playlist
pre-order.
It used to be the responsibility of the playtree code to change per-file
config options. Now this is done by the player core, and the playlist
code is free of such details.
Options are not per-file by default anymore. This was a very obscure and
complicated feature that confused even experienced users. Consider the
following command line:
mplayer file1.mkv file2.mkv --no-audio file3.mkv
This will disable the audio for file2.mkv only, because options are
per-file by default. To make the option affect all files, you're
supposed to put it before the first file.
This is bad, because normally you don't need per-file options. They are
very rarely needed, and the only reasonable use cases I can imagine are
use of the encode backend (mplayer encode branch), or for debugging. The
normal use case is made harder, and the feature is perceived as bug.
Even worse, correct usage is hard to explain for users.
Make all options global by default. The position of an option isn't
significant anymore (except for options that compensate each other,
consider --shuffle --no-shuffle).
One other important change is that no options are reset anymore if a
new file is started. If you change settings with slave mode commands,
they will not be changed by playing a new file. (Exceptions include
settings that are too file specific, like audio/subtitle stream
selection.)
There is still some need for per-file options. Debugging and encoding
are use cases that profit from per-file options. Per-file profiles (as
well as per-protocol and per-VO/AO options) need the implementation
related mechanisms to backup and restore options when the playback file
changes.
Simplify the save-slot stuff, which is possible because there is no
hierarchical play tree anymore. Now there's a simple backup field.
Add a way to specify per-file options on command line. Example:
mplayer f1.mkv -o0 --{ -o1 f2.mkv -o2 f3.mkv --} f4.mkv -o3
will have the following options per file set:
f1.mkv, f4.mkv: -o0 -o3
f2.mkv, f3.mkv: -o0 -o3 -o1 -o2
The options --{ and --} start and end per-file options. All files inside
the { } will be affected by the options equally (similar to how global
options and multiple files are handled). When playback of a file starts,
the per-file options are set according to the command line. When
playback ends, the per-file options are restored to the values when
playback started.
2012-07-31 19:33:26 +00:00
|
|
|
// Raw value of the backup of the global value (or NULL).
|
|
|
|
void *global_backup;
|
2012-08-06 15:42:53 +00:00
|
|
|
// If this is a suboption, the option that contains this option.
|
|
|
|
struct m_config_option *parent;
|
2012-09-19 23:41:45 +00:00
|
|
|
// If this option aliases another, more important option. The alias_owner
|
|
|
|
// option is the one that has the most correct option type for the data
|
|
|
|
// variable, and which is considered the original.
|
|
|
|
struct m_config_option *alias_owner;
|
2002-11-12 01:56:42 +00:00
|
|
|
};
|
|
|
|
|
2011-07-05 19:31:44 +00:00
|
|
|
// Profiles allow to predefine some sets of options that can then
|
|
|
|
// be applied later on with the internal -profile option.
|
2006-04-24 19:20:04 +00:00
|
|
|
|
2011-07-05 19:31:44 +00:00
|
|
|
// Config profile
|
2006-01-24 11:16:13 +00:00
|
|
|
struct m_profile {
|
2011-07-05 19:31:44 +00:00
|
|
|
struct m_profile *next;
|
|
|
|
char *name;
|
|
|
|
char *desc;
|
|
|
|
int num_opts;
|
|
|
|
// Option/value pair array.
|
|
|
|
char **opts;
|
2006-01-24 11:16:13 +00:00
|
|
|
};
|
|
|
|
|
2011-07-05 19:31:44 +00:00
|
|
|
// Config object
|
2006-04-24 19:20:04 +00:00
|
|
|
/** \ingroup Config */
|
2002-11-12 01:56:42 +00:00
|
|
|
typedef struct m_config {
|
2011-07-05 19:31:44 +00:00
|
|
|
// Registered options.
|
|
|
|
/** This contains all options and suboptions.
|
|
|
|
*/
|
|
|
|
struct m_config_option *opts;
|
mplayer: turn playtree into a list, and change per-file option handling
Summary:
- There is no playtree anymore. It's reduced to a simple list.
- Options are now always global. You can still have per-file options,
but these are optional and require special syntax.
- The slave command pt_step has been removed, and playlist_next
and playlist_prev added. (See etc/input.conf changes.)
This is a user visible incompatible change, and will break slave-mode
applications.
- The pt_clear slave command is renamed to playlist_clear.
- Playtree entries could have multiple files. This is not the case
anymore, and playlist entries have always exactly one entry. Whenever
something adds more than one file (like ASX playlists or dvd:// or
dvdnav:// on the command line), all files are added as separate
playlist entries.
Note that some of the changes are quite deep and violent. Expect
regressions.
The playlist parsing code in particular is of low quality. I didn't try
to improve it, and merely spent to least effort necessary to keep it
somehow working. (Especially ASX playlist handling.)
The playtree code was complicated and bloated. It was also barely used.
Most users don't even know that mplayer manages the playlist as tree,
or how to use it. The most obscure features was probably specifying a
tree on command line (with '{' and '}' to create/close tree nodes). It
filled the player code with complexity and confused users with weird
slave commands like pt_up.
Replace the playtree with a simple flat playlist. Playlist parsers that
actually return trees are changed to append all files to the playlist
pre-order.
It used to be the responsibility of the playtree code to change per-file
config options. Now this is done by the player core, and the playlist
code is free of such details.
Options are not per-file by default anymore. This was a very obscure and
complicated feature that confused even experienced users. Consider the
following command line:
mplayer file1.mkv file2.mkv --no-audio file3.mkv
This will disable the audio for file2.mkv only, because options are
per-file by default. To make the option affect all files, you're
supposed to put it before the first file.
This is bad, because normally you don't need per-file options. They are
very rarely needed, and the only reasonable use cases I can imagine are
use of the encode backend (mplayer encode branch), or for debugging. The
normal use case is made harder, and the feature is perceived as bug.
Even worse, correct usage is hard to explain for users.
Make all options global by default. The position of an option isn't
significant anymore (except for options that compensate each other,
consider --shuffle --no-shuffle).
One other important change is that no options are reset anymore if a
new file is started. If you change settings with slave mode commands,
they will not be changed by playing a new file. (Exceptions include
settings that are too file specific, like audio/subtitle stream
selection.)
There is still some need for per-file options. Debugging and encoding
are use cases that profit from per-file options. Per-file profiles (as
well as per-protocol and per-VO/AO options) need the implementation
related mechanisms to backup and restore options when the playback file
changes.
Simplify the save-slot stuff, which is possible because there is no
hierarchical play tree anymore. Now there's a simple backup field.
Add a way to specify per-file options on command line. Example:
mplayer f1.mkv -o0 --{ -o1 f2.mkv -o2 f3.mkv --} f4.mkv -o3
will have the following options per file set:
f1.mkv, f4.mkv: -o0 -o3
f2.mkv, f3.mkv: -o0 -o3 -o1 -o2
The options --{ and --} start and end per-file options. All files inside
the { } will be affected by the options equally (similar to how global
options and multiple files are handled). When playback of a file starts,
the per-file options are set according to the command line. When
playback ends, the per-file options are restored to the values when
playback started.
2012-07-31 19:33:26 +00:00
|
|
|
// When options are set (via m_config_set_option or m_config_set_profile),
|
|
|
|
// back up the old value (unless it's already backed up). Used for restoring
|
|
|
|
// global options when per-file options are set.
|
|
|
|
bool file_local_mode;
|
|
|
|
|
2011-07-05 19:31:44 +00:00
|
|
|
// List of defined profiles.
|
|
|
|
struct m_profile *profiles;
|
|
|
|
// Depth when recursively including profiles.
|
|
|
|
int profile_depth;
|
|
|
|
|
|
|
|
void *optstruct; // struct mpopts or other
|
2012-05-07 23:10:39 +00:00
|
|
|
int (*includefunc)(struct m_config *conf, char *filename);
|
2002-11-12 01:56:42 +00:00
|
|
|
} m_config_t;
|
|
|
|
|
2011-07-05 19:31:44 +00:00
|
|
|
// Create a new config object.
|
|
|
|
struct m_config *
|
2008-04-26 07:44:59 +00:00
|
|
|
m_config_new(void *optstruct,
|
2012-05-07 23:10:39 +00:00
|
|
|
int includefunc(struct m_config *conf, char *filename));
|
2002-11-12 01:56:42 +00:00
|
|
|
|
2012-08-04 09:33:24 +00:00
|
|
|
struct m_config *m_config_simple(void *optstruct);
|
2012-05-17 00:31:11 +00:00
|
|
|
|
2011-07-05 19:31:44 +00:00
|
|
|
// Free a config object.
|
|
|
|
void m_config_free(struct m_config *config);
|
2002-11-12 01:56:42 +00:00
|
|
|
|
mplayer: turn playtree into a list, and change per-file option handling
Summary:
- There is no playtree anymore. It's reduced to a simple list.
- Options are now always global. You can still have per-file options,
but these are optional and require special syntax.
- The slave command pt_step has been removed, and playlist_next
and playlist_prev added. (See etc/input.conf changes.)
This is a user visible incompatible change, and will break slave-mode
applications.
- The pt_clear slave command is renamed to playlist_clear.
- Playtree entries could have multiple files. This is not the case
anymore, and playlist entries have always exactly one entry. Whenever
something adds more than one file (like ASX playlists or dvd:// or
dvdnav:// on the command line), all files are added as separate
playlist entries.
Note that some of the changes are quite deep and violent. Expect
regressions.
The playlist parsing code in particular is of low quality. I didn't try
to improve it, and merely spent to least effort necessary to keep it
somehow working. (Especially ASX playlist handling.)
The playtree code was complicated and bloated. It was also barely used.
Most users don't even know that mplayer manages the playlist as tree,
or how to use it. The most obscure features was probably specifying a
tree on command line (with '{' and '}' to create/close tree nodes). It
filled the player code with complexity and confused users with weird
slave commands like pt_up.
Replace the playtree with a simple flat playlist. Playlist parsers that
actually return trees are changed to append all files to the playlist
pre-order.
It used to be the responsibility of the playtree code to change per-file
config options. Now this is done by the player core, and the playlist
code is free of such details.
Options are not per-file by default anymore. This was a very obscure and
complicated feature that confused even experienced users. Consider the
following command line:
mplayer file1.mkv file2.mkv --no-audio file3.mkv
This will disable the audio for file2.mkv only, because options are
per-file by default. To make the option affect all files, you're
supposed to put it before the first file.
This is bad, because normally you don't need per-file options. They are
very rarely needed, and the only reasonable use cases I can imagine are
use of the encode backend (mplayer encode branch), or for debugging. The
normal use case is made harder, and the feature is perceived as bug.
Even worse, correct usage is hard to explain for users.
Make all options global by default. The position of an option isn't
significant anymore (except for options that compensate each other,
consider --shuffle --no-shuffle).
One other important change is that no options are reset anymore if a
new file is started. If you change settings with slave mode commands,
they will not be changed by playing a new file. (Exceptions include
settings that are too file specific, like audio/subtitle stream
selection.)
There is still some need for per-file options. Debugging and encoding
are use cases that profit from per-file options. Per-file profiles (as
well as per-protocol and per-VO/AO options) need the implementation
related mechanisms to backup and restore options when the playback file
changes.
Simplify the save-slot stuff, which is possible because there is no
hierarchical play tree anymore. Now there's a simple backup field.
Add a way to specify per-file options on command line. Example:
mplayer f1.mkv -o0 --{ -o1 f2.mkv -o2 f3.mkv --} f4.mkv -o3
will have the following options per file set:
f1.mkv, f4.mkv: -o0 -o3
f2.mkv, f3.mkv: -o0 -o3 -o1 -o2
The options --{ and --} start and end per-file options. All files inside
the { } will be affected by the options equally (similar to how global
options and multiple files are handled). When playback of a file starts,
the per-file options are set according to the command line. When
playback ends, the per-file options are restored to the values when
playback started.
2012-07-31 19:33:26 +00:00
|
|
|
void m_config_enter_file_local(struct m_config *config);
|
|
|
|
void m_config_leave_file_local(struct m_config *config);
|
2013-04-10 19:06:00 +00:00
|
|
|
void m_config_mark_file_local(struct m_config *config, const char *opt);
|
|
|
|
void m_config_mark_all_file_local(struct m_config *config);
|
2002-11-12 01:56:42 +00:00
|
|
|
|
2011-07-05 19:31:44 +00:00
|
|
|
/* Register some options to be used.
|
|
|
|
* \param config The config object.
|
2006-04-24 19:20:04 +00:00
|
|
|
* \param args An array of \ref m_option struct.
|
|
|
|
* \return 1 on success, 0 on failure.
|
|
|
|
*/
|
2011-07-05 19:31:44 +00:00
|
|
|
int m_config_register_options(struct m_config *config,
|
|
|
|
const struct m_option *args);
|
2002-11-12 01:56:42 +00:00
|
|
|
|
2012-09-21 07:22:25 +00:00
|
|
|
enum {
|
|
|
|
M_SETOPT_PRE_PARSE_ONLY = 1, // Silently ignore non-M_OPT_PRE_PARSE opt.
|
|
|
|
M_SETOPT_CHECK_ONLY = 2, // Don't set, just check name/value
|
|
|
|
M_SETOPT_FROM_CONFIG_FILE = 4, // Reject M_OPT_NOCFG opt. (print error)
|
|
|
|
};
|
|
|
|
|
|
|
|
// Set the named option to the given string.
|
|
|
|
// flags: combination of M_SETOPT_* flags (0 for normal operation)
|
|
|
|
// Returns >= 0 on success, otherwise see OptionParserReturn.
|
|
|
|
int m_config_set_option_ext(struct m_config *config, struct bstr name,
|
|
|
|
struct bstr param, int flags);
|
|
|
|
|
|
|
|
/* Set an option. (Like: m_config_set_option_ext(config, name, param, 0))
|
2011-07-05 19:31:44 +00:00
|
|
|
* \param config The config object.
|
2011-07-28 08:07:47 +00:00
|
|
|
* \param name The option's name.
|
2006-04-24 19:20:04 +00:00
|
|
|
* \param param The value of the option, can be NULL.
|
|
|
|
* \return See \ref OptionParserReturn.
|
|
|
|
*/
|
2011-07-28 08:07:47 +00:00
|
|
|
int m_config_set_option(struct m_config *config, struct bstr name,
|
2012-08-05 21:34:28 +00:00
|
|
|
struct bstr param);
|
2011-07-28 08:07:47 +00:00
|
|
|
|
|
|
|
static inline int m_config_set_option0(struct m_config *config,
|
2012-08-05 21:34:28 +00:00
|
|
|
const char *name, const char *param)
|
2011-07-28 08:07:47 +00:00
|
|
|
{
|
2012-08-05 21:34:28 +00:00
|
|
|
return m_config_set_option(config, bstr0(name), bstr0(param));
|
2011-07-28 08:07:47 +00:00
|
|
|
}
|
2002-11-12 01:56:42 +00:00
|
|
|
|
mplayer: turn playtree into a list, and change per-file option handling
Summary:
- There is no playtree anymore. It's reduced to a simple list.
- Options are now always global. You can still have per-file options,
but these are optional and require special syntax.
- The slave command pt_step has been removed, and playlist_next
and playlist_prev added. (See etc/input.conf changes.)
This is a user visible incompatible change, and will break slave-mode
applications.
- The pt_clear slave command is renamed to playlist_clear.
- Playtree entries could have multiple files. This is not the case
anymore, and playlist entries have always exactly one entry. Whenever
something adds more than one file (like ASX playlists or dvd:// or
dvdnav:// on the command line), all files are added as separate
playlist entries.
Note that some of the changes are quite deep and violent. Expect
regressions.
The playlist parsing code in particular is of low quality. I didn't try
to improve it, and merely spent to least effort necessary to keep it
somehow working. (Especially ASX playlist handling.)
The playtree code was complicated and bloated. It was also barely used.
Most users don't even know that mplayer manages the playlist as tree,
or how to use it. The most obscure features was probably specifying a
tree on command line (with '{' and '}' to create/close tree nodes). It
filled the player code with complexity and confused users with weird
slave commands like pt_up.
Replace the playtree with a simple flat playlist. Playlist parsers that
actually return trees are changed to append all files to the playlist
pre-order.
It used to be the responsibility of the playtree code to change per-file
config options. Now this is done by the player core, and the playlist
code is free of such details.
Options are not per-file by default anymore. This was a very obscure and
complicated feature that confused even experienced users. Consider the
following command line:
mplayer file1.mkv file2.mkv --no-audio file3.mkv
This will disable the audio for file2.mkv only, because options are
per-file by default. To make the option affect all files, you're
supposed to put it before the first file.
This is bad, because normally you don't need per-file options. They are
very rarely needed, and the only reasonable use cases I can imagine are
use of the encode backend (mplayer encode branch), or for debugging. The
normal use case is made harder, and the feature is perceived as bug.
Even worse, correct usage is hard to explain for users.
Make all options global by default. The position of an option isn't
significant anymore (except for options that compensate each other,
consider --shuffle --no-shuffle).
One other important change is that no options are reset anymore if a
new file is started. If you change settings with slave mode commands,
they will not be changed by playing a new file. (Exceptions include
settings that are too file specific, like audio/subtitle stream
selection.)
There is still some need for per-file options. Debugging and encoding
are use cases that profit from per-file options. Per-file profiles (as
well as per-protocol and per-VO/AO options) need the implementation
related mechanisms to backup and restore options when the playback file
changes.
Simplify the save-slot stuff, which is possible because there is no
hierarchical play tree anymore. Now there's a simple backup field.
Add a way to specify per-file options on command line. Example:
mplayer f1.mkv -o0 --{ -o1 f2.mkv -o2 f3.mkv --} f4.mkv -o3
will have the following options per file set:
f1.mkv, f4.mkv: -o0 -o3
f2.mkv, f3.mkv: -o0 -o3 -o1 -o2
The options --{ and --} start and end per-file options. All files inside
the { } will be affected by the options equally (similar to how global
options and multiple files are handled). When playback of a file starts,
the per-file options are set according to the command line. When
playback ends, the per-file options are restored to the values when
playback started.
2012-07-31 19:33:26 +00:00
|
|
|
int m_config_parse_suboptions(struct m_config *config, char *name,
|
|
|
|
char *subopts);
|
2012-05-17 00:31:11 +00:00
|
|
|
|
2002-11-12 01:56:42 +00:00
|
|
|
|
2011-07-05 19:31:44 +00:00
|
|
|
/* Get the option matching the given name.
|
|
|
|
* \param config The config object.
|
2011-07-28 08:07:47 +00:00
|
|
|
* \param name The option's name.
|
2006-04-24 19:20:04 +00:00
|
|
|
*/
|
2011-07-05 19:31:44 +00:00
|
|
|
const struct m_option *m_config_get_option(const struct m_config *config,
|
2011-07-28 08:07:47 +00:00
|
|
|
struct bstr name);
|
2002-11-12 01:56:42 +00:00
|
|
|
|
2012-09-18 18:07:24 +00:00
|
|
|
struct m_config_option *m_config_get_co(const struct m_config *config,
|
|
|
|
struct bstr name);
|
|
|
|
|
options: change handling of "no-" options yet again
Commit 4a40eed "options: change handling of "no-" options" generally
improved the handling of automatically added negation options
(recognizing "--no-opt", even though only "--opt" is declared in the
option list).
Unfortunately, one corner case was missed, which broke the option
"--input=no-default-bindings" (other suboptions, e.g. VO suboptions,
were not affected, and this is the only option where this mattered).
Instead of increasing the complexity further, use a completely different
approach: add the "--no-" options at runtime, and make them behave like
real options. This approach could be considered slightly less elegant,
because the code now has to worry about some option implementation
details rather than leaving it to the parser, but all in all the new
code is simpler and there are less weird corner cases to worry about.
2013-02-16 18:57:57 +00:00
|
|
|
// Return a hint to the option parser whether a parameter is/may be required.
|
|
|
|
// The option may still accept empty/non-empty parameters independent from
|
|
|
|
// this, and this function is useful only for handling ambiguous options like
|
|
|
|
// flags (e.g. "--a" is ok, "--a=yes" is also ok).
|
|
|
|
// Returns: error code (<0), or number of expected params (0, 1)
|
|
|
|
int m_config_option_requires_param(struct m_config *config, bstr name);
|
2012-09-20 01:32:01 +00:00
|
|
|
|
2011-07-05 19:31:44 +00:00
|
|
|
/* Print a list of all registered options.
|
|
|
|
* \param config The config object.
|
2006-04-24 19:20:04 +00:00
|
|
|
*/
|
2011-07-05 19:31:44 +00:00
|
|
|
void m_config_print_option_list(const struct m_config *config);
|
2002-11-12 12:39:05 +00:00
|
|
|
|
2006-04-24 19:20:04 +00:00
|
|
|
|
2011-07-05 19:31:44 +00:00
|
|
|
/* Find the profile with the given name.
|
|
|
|
* \param config The config object.
|
2006-04-24 19:20:04 +00:00
|
|
|
* \param arg The profile's name.
|
|
|
|
* \return The profile object or NULL.
|
|
|
|
*/
|
2011-07-05 19:31:44 +00:00
|
|
|
struct m_profile *m_config_get_profile(const struct m_config *config,
|
|
|
|
char *name);
|
2006-01-24 11:16:13 +00:00
|
|
|
|
2011-07-05 19:31:44 +00:00
|
|
|
/* Get the profile with the given name, creating it if necessary.
|
|
|
|
* \param config The config object.
|
2006-04-24 19:20:04 +00:00
|
|
|
* \param arg The profile's name.
|
|
|
|
* \return The profile object.
|
|
|
|
*/
|
2011-07-05 19:31:44 +00:00
|
|
|
struct m_profile *m_config_add_profile(struct m_config *config, char *name);
|
2006-01-24 11:16:13 +00:00
|
|
|
|
2011-07-05 19:31:44 +00:00
|
|
|
/* Set the description of a profile.
|
|
|
|
* Used by the config file parser when defining a profile.
|
2009-07-06 23:26:13 +00:00
|
|
|
*
|
2006-04-24 19:20:04 +00:00
|
|
|
* \param p The profile object.
|
|
|
|
* \param arg The profile's name.
|
|
|
|
*/
|
2011-07-05 19:31:44 +00:00
|
|
|
void m_profile_set_desc(struct m_profile *p, char *desc);
|
2006-01-24 11:16:13 +00:00
|
|
|
|
2011-07-05 19:31:44 +00:00
|
|
|
/* Add an option to a profile.
|
|
|
|
* Used by the config file parser when defining a profile.
|
2009-07-06 23:26:13 +00:00
|
|
|
*
|
2006-04-24 19:20:04 +00:00
|
|
|
* \param config The config object.
|
|
|
|
* \param p The profile object.
|
|
|
|
* \param name The option's name.
|
|
|
|
* \param val The option's value.
|
|
|
|
*/
|
2011-07-05 19:31:44 +00:00
|
|
|
int m_config_set_profile_option(struct m_config *config, struct m_profile *p,
|
2012-09-21 07:22:25 +00:00
|
|
|
bstr name, bstr val);
|
2006-01-24 11:16:13 +00:00
|
|
|
|
2011-07-05 19:31:44 +00:00
|
|
|
/* Enables profile usage
|
|
|
|
* Used by the config file parser when loading a profile.
|
2009-07-06 23:26:13 +00:00
|
|
|
*
|
2008-01-10 18:41:21 +00:00
|
|
|
* \param config The config object.
|
|
|
|
* \param p The profile object.
|
|
|
|
*/
|
2011-07-05 19:31:44 +00:00
|
|
|
void m_config_set_profile(struct m_config *config, struct m_profile *p);
|
2006-04-24 19:20:04 +00:00
|
|
|
|
2012-08-06 15:45:17 +00:00
|
|
|
void *m_config_alloc_struct(void *talloc_parent,
|
|
|
|
const struct m_sub_options *subopts);
|
|
|
|
|
2008-02-22 09:09:46 +00:00
|
|
|
#endif /* MPLAYER_M_CONFIG_H */
|