gmerlin
parameter.h
1 /*****************************************************************
2  * gmerlin - a general purpose multimedia framework and applications
3  *
4  * Copyright (c) 2001 - 2012 Members of the Gmerlin project
5  * gmerlin-general@lists.sourceforge.net
6  * http://gmerlin.sourceforge.net
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  * *****************************************************************/
21 
22 #ifndef __BG_PARAMETER_H_
23 #define __BG_PARAMETER_H_
24 
25 #include <libxml/tree.h>
26 #include <libxml/parser.h>
27 
28 #include <gavl/gavl.h>
29 
44 /* Universal Parameter setting mechanism */
45 
53 typedef enum
54  {
77 
82 typedef union
83  {
84  double val_f;
85  int val_i;
86  char * val_str;
87  float val_color[4];
89  double val_pos[2];
91 
92 /* Flags */
93 
97 #define BG_PARAMETER_SYNC (1<<0)
98 
99 
102 #define BG_PARAMETER_HIDE_DIALOG (1<<1)
103 
104 
107 #define BG_PARAMETER_NO_SORT (1<<2)
108 
109 
112 #define BG_PARAMETER_PLUGIN (1<<3)
113 
114 
117 #define BG_PARAMETER_OWN_SECTION (1<<4)
118 
119 
123 #define BG_PARAMETER_GLOBAL_PRESET (1<<5)
124 
125 
127 
135  {
136  char * name;
137  char * long_name;
138  char * opt;
139 
140  char * gettext_domain;
142 
144 
145  int flags;
146 
150 
151  /* Names which can be passed to set_parameter (NULL terminated) */
152 
153  char const * const * multi_names;
154 
155  /* Long names are optional, if they are NULL,
156  the short names are used */
157 
158  char const * const * multi_labels;
159  char const * const * multi_descriptions;
160 
161  /*
162  * These are parameters for each codec.
163  * The name members of these MUST be unique with respect to the rest
164  * of the parameters passed to the same set_parameter func
165  */
166 
167  struct bg_parameter_info_s const * const * multi_parameters;
168 
170 
171  char * help_string;
172 
173  char * preset_path;
174 
175  char ** multi_names_nc;
176 
177  char ** multi_labels_nc;
178 
180 
182 
183  };
184 
185 /* Prototype for setting/getting parameters */
186 
187 /*
188  * NOTE: All applications MUST call a bg_set_parameter_func with
189  * a NULL name argument to signal, that all parameters are set now
190  */
191 
205 typedef void (*bg_set_parameter_func_t)(void * data, const char * name,
206  const bg_parameter_value_t * v);
207 
221 typedef int (*bg_get_parameter_func_t)(void * data, const char * name,
223 
231  const bg_parameter_info_t * src);
232 
244 
253 void
255 
262 
274  const bg_parameter_value_t * src,
275  const bg_parameter_info_t * info);
276 
285 
286 
296 
308  const char * val);
309 
310 
322 const bg_parameter_info_t *
324  const char * name);
325 
326 
337 bg_parameter_info_t * bg_xml_2_parameters(xmlDocPtr xml_doc,
338  xmlNodePtr xml_parameters);
339 
349 void
350 bg_parameters_2_xml(const bg_parameter_info_t * info, xmlNodePtr xml_parameters);
351 
360 void
361 bg_parameters_dump(const bg_parameter_info_t * info, const char * filename);
362 
363 
364 #endif /* __BG_PARAMETER_H_ */
365