Directly mark jpeg_buf_src() as void instead of using some indirection marcro.
[mplayer.git] / m_config.h
blob2805c40fd0771a17b3e67a1dee6ab1c7f0be1ccd
1 /*
2 * This file is part of MPlayer.
4 * MPlayer is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * MPlayer is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #ifndef MPLAYER_M_CONFIG_H
20 #define MPLAYER_M_CONFIG_H
22 /// \defgroup Config Config manager
23 ///
24 /// m_config provides an API to manipulate the config variables in MPlayer.
25 /// It makes use of the \ref Options API to provide a context stack that
26 /// allows saving and later restoring the state of all variables.
27 ///@{
29 /// \file
31 typedef struct m_config_option m_config_option_t;
32 typedef struct m_config_save_slot m_config_save_slot_t;
33 /// \ingroup ConfigProfiles
34 typedef struct m_profile m_profile_t;
35 struct m_option;
36 struct m_option_type;
38 /// Config option save slot
39 struct m_config_save_slot {
40 /// Previous level slot.
41 m_config_save_slot_t* prev;
42 /// Level at which the save was made.
43 int lvl;
44 // We have to store other datatypes in this as well,
45 // so make sure we get properly aligned addresses.
46 unsigned char data[0] __attribute__ ((aligned (8)));
49 /// Config option
50 struct m_config_option {
51 m_config_option_t* next;
52 /// Full name (ie option:subopt).
53 char* name;
54 /// Option description.
55 const struct m_option* opt;
56 /// Save slot stack.
57 m_config_save_slot_t* slots;
58 /// See \ref ConfigOptionFlags.
59 unsigned int flags;
62 /// \defgroup ConfigProfiles Config profiles
63 /// \ingroup Config
64 ///
65 /// Profiles allow to predefine some sets of options that can then
66 /// be applied later on with the internal -profile option.
67 ///
68 ///@{
70 /// Config profile
71 struct m_profile {
72 m_profile_t* next;
73 char* name;
74 char* desc;
75 int num_opts;
76 /// Option/value pair array.
77 char** opts;
80 ///@}
82 /// Config object
83 /** \ingroup Config */
84 typedef struct m_config {
85 /// Registered options.
86 /** This contains all options and suboptions.
88 m_config_option_t* opts;
89 /// Current stack level.
90 int lvl;
91 /// \ref OptionParserModes
92 int mode;
93 /// List of defined profiles.
94 m_profile_t* profiles;
95 /// Depth when recursively including profiles.
96 int profile_depth;
97 /// Options defined by the config itself.
98 struct m_option* self_opts;
99 } m_config_t;
101 /// \defgroup ConfigOptionFlags Config option flags
102 /// \ingroup Config
103 ///@{
105 /// Set if an option has been set at the current level.
106 #define M_CFG_OPT_SET (1<<0)
108 /// Set if another option already uses the same variable.
109 #define M_CFG_OPT_ALIAS (1<<1)
111 ///@}
113 /// Create a new config object.
114 /** \ingroup Config
116 m_config_t*
117 m_config_new(void);
119 /// Free a config object.
120 void
121 m_config_free(m_config_t* config);
123 /// Push a new context.
124 /** \param config The config object.
126 void
127 m_config_push(m_config_t* config);
129 /// Pop the current context restoring the previous context state.
130 /** \param config The config object.
132 void
133 m_config_pop(m_config_t* config);
135 /// Register some options to be used.
136 /** \param config The config object.
137 * \param args An array of \ref m_option struct.
138 * \return 1 on success, 0 on failure.
141 m_config_register_options(m_config_t *config, const struct m_option *args);
143 /// Set an option.
144 /** \param config The config object.
145 * \param arg The option's name.
146 * \param param The value of the option, can be NULL.
147 * \return See \ref OptionParserReturn.
150 m_config_set_option(m_config_t *config, char* arg, char* param);
152 /// Check if an option setting is valid.
153 /** \param config The config object.
154 * \param arg The option's name.
155 * \param param The value of the option, can be NULL.
156 * \return See \ref OptionParserReturn.
159 m_config_check_option(m_config_t *config, char* arg, char* param);
161 /// Get the option matching the given name.
162 /** \param config The config object.
163 * \param arg The option's name.
165 const struct m_option*
166 m_config_get_option(m_config_t *config, char* arg);
168 /// Print a list of all registered options.
169 /** \param config The config object.
171 void
172 m_config_print_option_list(m_config_t *config);
174 /// \addtogroup ConfigProfiles
175 ///@{
177 /// Find the profile with the given name.
178 /** \param config The config object.
179 * \param arg The profile's name.
180 * \return The profile object or NULL.
182 m_profile_t*
183 m_config_get_profile(m_config_t* config, char* name);
185 /// Get the profile with the given name, creating it if necessary.
186 /** \param config The config object.
187 * \param arg The profile's name.
188 * \return The profile object.
190 m_profile_t*
191 m_config_add_profile(m_config_t* config, char* name);
193 /// Set the description of a profile.
194 /** Used by the config file parser when defining a profile.
196 * \param p The profile object.
197 * \param arg The profile's name.
199 void
200 m_profile_set_desc(m_profile_t* p, char* desc);
202 /// Add an option to a profile.
203 /** Used by the config file parser when defining a profile.
205 * \param config The config object.
206 * \param p The profile object.
207 * \param name The option's name.
208 * \param val The option's value.
211 m_config_set_profile_option(m_config_t* config, m_profile_t* p,
212 char* name, char* val);
214 /// Enables profile usage
215 /** Used by the config file parser when loading a profile.
217 * \param config The config object.
218 * \param p The profile object.
220 void
221 m_config_set_profile(m_config_t* config, m_profile_t* p);
223 ///@}
225 ///@}
227 #endif /* MPLAYER_M_CONFIG_H */