xine-lib  1.2.9
configfile.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2000-2017 the xine project
3  *
4  * This file is part of xine, a free video player.
5  *
6  * xine is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * xine is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19  *
20  * config file management
21  */
22 
23 #ifndef HAVE_CONFIGFILE_H
24 #define HAVE_CONFIGFILE_H
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 #include <pthread.h>
31 
32 #include <xine.h>
33 
34 #define CONFIG_FILE_VERSION 2
35 
40 #define XINE_CONFIG_SECURITY 30
41 
42 
43 typedef struct cfg_entry_s cfg_entry_t;
45 
46 struct cfg_entry_s {
49 
50  char *key;
51  int type;
52 
54  int exp_level;
55 
58 
60  char *str_value;
61  char *str_default;
62 
64  int num_value;
66 
68  int range_min;
69  int range_max; /* also used for enum */
70 
72  char **enum_values;
73 
75  char *description;
76  char *help;
77 
81 };
82 
84 
85  /*
86  * register config values
87  *
88  * these functions return the current value of the
89  * registered item, i.e. the default value if it was
90  * not found in the config file or the current value
91  * from the config file otherwise
92  */
93 
94  char* (*register_string) (config_values_t *self,
95  const char *key,
96  const char *def_value,
97  const char *description,
98  const char *help,
99  int exp_level,
100  xine_config_cb_t changed_cb,
101  void *cb_data);
102 
103  char* (*register_filename) (config_values_t *self,
104  const char *key,
105  const char *def_value,
106  int req_type,
107  const char *description,
108  const char *help,
109  int exp_level,
110  xine_config_cb_t changed_cb,
111  void *cb_data);
112 
114  const char *key,
115  int def_value,
116  int min, int max,
117  const char *description,
118  const char *help,
119  int exp_level,
120  xine_config_cb_t changed_cb,
121  void *cb_data);
122 
124  const char *key,
125  int def_value,
126  char **values,
127  const char *description,
128  const char *help,
129  int exp_level,
130  xine_config_cb_t changed_cb,
131  void *cb_data);
132 
134  const char *key,
135  int def_value,
136  const char *description,
137  const char *help,
138  int exp_level,
139  xine_config_cb_t changed_cb,
140  void *cb_data);
141 
143  const char *key,
144  int def_value,
145  const char *description,
146  const char *help,
147  int exp_level,
148  xine_config_cb_t changed_cb,
149  void *cb_data);
150 
151  void (*register_entry) (config_values_t *self, cfg_entry_t* entry);
152 
154  void (*update_num) (config_values_t *self, const char *key, int value);
155 
157  void (*update_string) (config_values_t *self, const char *key, const char *value);
158 
160  int (*parse_enum) (const char *str, const char **values);
161 
169  cfg_entry_t* (*lookup_entry) (config_values_t *self, const char *key);
170 
174  void (*unregister_callback) (config_values_t *self, const char *key);
175 
179  void (*dispose) (config_values_t *self);
180 
185 
190 
195  char* (*get_serialized_entry) (config_values_t *self, const char *key);
196 
202  char* (*register_serialized_entry) (config_values_t *self, const char *value);
203 
208 
214 
218  pthread_mutex_t config_lock;
219 
224 };
225 
231 
237 int _x_config_change_opt(config_values_t *config, const char *opt);
238 
239 void _x_config_unregister_cb_class_d (config_values_t *config, void *callback_data) XINE_PROTECTED;
240 
241 #ifdef __cplusplus
242 }
243 #endif
244 
245 #endif
246 
cfg_entry_t * next
Definition: configfile.h:47
char * unknown_value
Definition: configfile.h:57
#define XINE_MALLOC
Definition: attributes.h:119
int(* register_bool)(config_values_t *self, const char *key, int def_value, const char *description, const char *help, int exp_level, xine_config_cb_t changed_cb, void *cb_data)
Definition: configfile.h:142
int range_max
Definition: configfile.h:69
int(* register_range)(config_values_t *self, const char *key, int def_value, int min, int max, const char *description, const char *help, int exp_level, xine_config_cb_t changed_cb, void *cb_data)
Definition: configfile.h:113
char * key
Definition: configfile.h:50
cfg_entry_t * cur
Definition: configfile.h:207
xine_config_cb_t callback
Definition: configfile.h:79
Definition: configfile.h:83
int(* register_num)(config_values_t *self, const char *key, int def_value, const char *description, const char *help, int exp_level, xine_config_cb_t changed_cb, void *cb_data)
Definition: configfile.h:133
char * str_value
Definition: configfile.h:60
char * help
Definition: configfile.h:76
char key[16]
Definition: xine_speex_decoder.c:98
int type
Definition: configfile.h:51
void(* dispose)(config_values_t *self)
Definition: configfile.h:179
xine_config_cb_t new_entry_cb
Definition: configfile.h:212
int exp_level
Definition: configfile.h:54
void(* update_string)(config_values_t *self, const char *key, const char *value)
Definition: configfile.h:157
void(* update_num)(config_values_t *self, const char *key, int value)
Definition: configfile.h:154
void * callback_data
Definition: configfile.h:80
int range_min
Definition: configfile.h:68
char * description
Definition: configfile.h:75
config_values_t * _x_config_init(void)
allocate and init a new xine config object
Definition: configfile.c:1590
#define XINE_PROTECTED
Definition: attributes.h:73
cfg_entry_t * first
Definition: configfile.h:207
int num_value
Definition: configfile.h:64
cfg_entry_t * last
Definition: configfile.h:207
void(* unregister_callback)(config_values_t *self, const char *key)
Definition: configfile.h:174
void(* unset_new_entry_callback)(config_values_t *self)
Definition: configfile.h:189
int _x_config_change_opt(config_values_t *config, const char *opt)
interpret stream_setup part of mrls for config value changes
Definition: configfile.c:1635
config_values_t * config
Definition: configfile.h:48
void _x_config_unregister_cb_class_d(config_values_t *config, void *callback_data)
Definition: configfile.c:1243
Definition: configfile.h:46
void(* register_entry)(config_values_t *self, cfg_entry_t *entry)
Definition: configfile.h:151
int(* register_enum)(config_values_t *self, const char *key, int def_value, char **values, const char *description, const char *help, int exp_level, xine_config_cb_t changed_cb, void *cb_data)
Definition: configfile.h:123
int(* parse_enum)(const char *str, const char **values)
Definition: configfile.h:160
char ** enum_values
Definition: configfile.h:72
char * str_default
Definition: configfile.h:61
void(* xine_config_cb_t)(void *user_data, xine_cfg_entry_t *entry)
Definition: xine.h:1593
pthread_mutex_t config_lock
Definition: configfile.h:218
int num_default
Definition: configfile.h:65
int current_version
Definition: configfile.h:223
void(* set_new_entry_callback)(config_values_t *self, xine_config_cb_t new_entry_cb, void *cb_data)
Definition: configfile.h:184
void * new_entry_cbdata
Definition: configfile.h:213