gmerlin
Main Page
Related Pages
Modules
Data Structures
Files
File List
include
gmerlin
parameter.h
1
/*****************************************************************
2
* gmerlin - a general purpose multimedia framework and applications
3
*
4
* Copyright (c) 2001 - 2011 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
{
55
BG_PARAMETER_SECTION
,
56
BG_PARAMETER_CHECKBUTTON
,
57
BG_PARAMETER_INT
,
58
BG_PARAMETER_FLOAT
,
59
BG_PARAMETER_SLIDER_INT
,
60
BG_PARAMETER_SLIDER_FLOAT
,
61
BG_PARAMETER_STRING
,
62
BG_PARAMETER_STRING_HIDDEN
,
63
BG_PARAMETER_STRINGLIST
,
64
BG_PARAMETER_COLOR_RGB
,
65
BG_PARAMETER_COLOR_RGBA
,
66
BG_PARAMETER_FONT
,
67
BG_PARAMETER_DEVICE
,
68
BG_PARAMETER_FILE
,
69
BG_PARAMETER_DIRECTORY
,
70
BG_PARAMETER_MULTI_MENU
,
71
BG_PARAMETER_MULTI_LIST
,
72
BG_PARAMETER_MULTI_CHAIN
,
73
BG_PARAMETER_TIME
,
74
BG_PARAMETER_POSITION
,
75
BG_PARAMETER_BUTTON
,
76
}
bg_parameter_type_t
;
77
82
typedef
union
83
{
84
double
val_f
;
85
int
val_i
;
86
char
*
val_str
;
87
float
val_color[4];
88
gavl_time_t
val_time
;
89
double
val_pos[2];
90
}
bg_parameter_value_t
;
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
126
typedef
struct
bg_parameter_info_s
bg_parameter_info_t
;
127
134
struct
bg_parameter_info_s
135
{
136
char
*
name
;
137
char
*
long_name
;
138
char
*
opt
;
139
140
char
*
gettext_domain
;
141
char
*
gettext_directory
;
142
143
bg_parameter_type_t
type
;
144
145
int
flags
;
146
147
bg_parameter_value_t
val_default
;
148
bg_parameter_value_t
val_min
;
149
bg_parameter_value_t
val_max
;
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
169
int
num_digits
;
170
171
char
*
help_string
;
172
173
char
*
preset_path
;
174
175
char
**
multi_names_nc
;
176
177
char
**
multi_labels_nc
;
178
179
char
**
multi_descriptions_nc
;
180
181
struct
bg_parameter_info_s
**
multi_parameters_nc
;
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
,
222
bg_parameter_value_t
* v);
223
230
void
bg_parameter_info_copy
(
bg_parameter_info_t
* dst,
231
const
bg_parameter_info_t
* src);
232
242
bg_parameter_info_t
*
243
bg_parameter_info_copy_array
(
const
bg_parameter_info_t
* src);
244
253
void
254
bg_parameter_info_set_const_ptrs
(
bg_parameter_info_t
* info);
255
261
void
bg_parameter_info_destroy_array
(
bg_parameter_info_t
* info);
262
273
void
bg_parameter_value_copy
(
bg_parameter_value_t
* dst,
274
const
bg_parameter_value_t
* src,
275
const
bg_parameter_info_t
* info);
276
283
void
bg_parameter_value_free
(
bg_parameter_value_t
* val,
284
bg_parameter_type_t
type
);
285
286
294
bg_parameter_info_t
*
295
bg_parameter_info_concat_arrays
(
bg_parameter_info_t
const
** srcs);
296
307
int
bg_parameter_get_selected
(
const
bg_parameter_info_t
* info,
308
const
char
* val);
309
310
322
const
bg_parameter_info_t
*
323
bg_parameter_find
(
const
bg_parameter_info_t
* info,
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
Generated by
1.8.1