Mercurial > audlegacy
comparison Plugins/Input/flac/plugin.c @ 303:57d01c5bd39f trunk
[svn] Convert to configdb usage.
author | chainsaw |
---|---|
date | Sat, 17 Dec 2005 08:42:26 -0800 |
parents | 6bdc6841b0a9 |
children | fb59081b528f |
comparison
equal
deleted
inserted
replaced
302:baee45e12cd6 | 303:57d01c5bd39f |
---|---|
24 #include <sys/types.h> | 24 #include <sys/types.h> |
25 #include <unistd.h> | 25 #include <unistd.h> |
26 | 26 |
27 #include <audacious/plugin.h> | 27 #include <audacious/plugin.h> |
28 #include <libaudacious/util.h> | 28 #include <libaudacious/util.h> |
29 #include <libaudacious/configfile.h> | 29 #include <libaudacious/configdb.h> |
30 #include <libaudacious/titlestring.h> | 30 #include <libaudacious/titlestring.h> |
31 | 31 |
32 #ifdef HAVE_CONFIG_H | 32 #ifdef HAVE_CONFIG_H |
33 #include <config.h> | 33 #include <config.h> |
34 #endif | 34 #endif |
211 return result; | 211 return result; |
212 } | 212 } |
213 | 213 |
214 void FLAC_XMMS__init() | 214 void FLAC_XMMS__init() |
215 { | 215 { |
216 ConfigFile *cfg; | 216 ConfigDb *db; |
217 FLAC__uint32 test = 1; | 217 FLAC__uint32 test = 1; |
218 | 218 |
219 is_big_endian_host_ = (*((FLAC__byte*)(&test)))? false : true; | 219 is_big_endian_host_ = (*((FLAC__byte*)(&test)))? false : true; |
220 | 220 |
221 flac_cfg.title.tag_override = FALSE; | 221 flac_cfg.title.tag_override = FALSE; |
222 g_free(flac_cfg.title.tag_format); | 222 g_free(flac_cfg.title.tag_format); |
223 flac_cfg.title.convert_char_set = FALSE; | 223 flac_cfg.title.convert_char_set = FALSE; |
224 | 224 |
225 cfg = xmms_cfg_open_default_file(); | 225 db = bmp_cfg_db_open(); |
226 | 226 |
227 /* title */ | 227 /* title */ |
228 | 228 |
229 xmms_cfg_read_boolean(cfg, "flac", "title.tag_override", &flac_cfg.title.tag_override); | 229 bmp_cfg_db_get_bool(db, "flac", "title.tag_override", &flac_cfg.title.tag_override); |
230 | 230 |
231 if(!xmms_cfg_read_string(cfg, "flac", "title.tag_format", &flac_cfg.title.tag_format)) | 231 if(!bmp_cfg_db_get_string(db, "flac", "title.tag_format", &flac_cfg.title.tag_format)) |
232 flac_cfg.title.tag_format = g_strdup("%p - %t"); | 232 flac_cfg.title.tag_format = g_strdup("%p - %t"); |
233 | 233 |
234 xmms_cfg_read_boolean(cfg, "flac", "title.convert_char_set", &flac_cfg.title.convert_char_set); | 234 bmp_cfg_db_get_bool(db, "flac", "title.convert_char_set", &flac_cfg.title.convert_char_set); |
235 | 235 |
236 if(!xmms_cfg_read_string(cfg, "flac", "title.user_char_set", &flac_cfg.title.user_char_set)) | 236 if(!bmp_cfg_db_get_string(db, "flac", "title.user_char_set", &flac_cfg.title.user_char_set)) |
237 flac_cfg.title.user_char_set = FLAC_plugin__charset_get_current(); | 237 flac_cfg.title.user_char_set = FLAC_plugin__charset_get_current(); |
238 | 238 |
239 /* replaygain */ | 239 /* replaygain */ |
240 | 240 |
241 xmms_cfg_read_boolean(cfg, "flac", "output.replaygain.enable", &flac_cfg.output.replaygain.enable); | 241 bmp_cfg_db_get_bool(db, "flac", "output.replaygain.enable", &flac_cfg.output.replaygain.enable); |
242 | 242 |
243 xmms_cfg_read_boolean(cfg, "flac", "output.replaygain.album_mode", &flac_cfg.output.replaygain.album_mode); | 243 bmp_cfg_db_get_bool(db, "flac", "output.replaygain.album_mode", &flac_cfg.output.replaygain.album_mode); |
244 | 244 |
245 if(!xmms_cfg_read_int(cfg, "flac", "output.replaygain.preamp", &flac_cfg.output.replaygain.preamp)) | 245 if(!bmp_cfg_db_get_int(db, "flac", "output.replaygain.preamp", &flac_cfg.output.replaygain.preamp)) |
246 flac_cfg.output.replaygain.preamp = 0; | 246 flac_cfg.output.replaygain.preamp = 0; |
247 | 247 |
248 xmms_cfg_read_boolean(cfg, "flac", "output.replaygain.hard_limit", &flac_cfg.output.replaygain.hard_limit); | 248 bmp_cfg_db_get_bool(db, "flac", "output.replaygain.hard_limit", &flac_cfg.output.replaygain.hard_limit); |
249 | 249 |
250 xmms_cfg_read_boolean(cfg, "flac", "output.resolution.normal.dither_24_to_16", &flac_cfg.output.resolution.normal.dither_24_to_16); | 250 bmp_cfg_db_get_bool(db, "flac", "output.resolution.normal.dither_24_to_16", &flac_cfg.output.resolution.normal.dither_24_to_16); |
251 xmms_cfg_read_boolean(cfg, "flac", "output.resolution.replaygain.dither", &flac_cfg.output.resolution.replaygain.dither); | 251 bmp_cfg_db_get_bool(db, "flac", "output.resolution.replaygain.dither", &flac_cfg.output.resolution.replaygain.dither); |
252 | 252 |
253 if(!xmms_cfg_read_int(cfg, "flac", "output.resolution.replaygain.noise_shaping", &flac_cfg.output.resolution.replaygain.noise_shaping)) | 253 if(!bmp_cfg_db_get_int(db, "flac", "output.resolution.replaygain.noise_shaping", &flac_cfg.output.resolution.replaygain.noise_shaping)) |
254 flac_cfg.output.resolution.replaygain.noise_shaping = 1; | 254 flac_cfg.output.resolution.replaygain.noise_shaping = 1; |
255 | 255 |
256 if(!xmms_cfg_read_int(cfg, "flac", "output.resolution.replaygain.bps_out", &flac_cfg.output.resolution.replaygain.bps_out)) | 256 if(!bmp_cfg_db_get_int(db, "flac", "output.resolution.replaygain.bps_out", &flac_cfg.output.resolution.replaygain.bps_out)) |
257 flac_cfg.output.resolution.replaygain.bps_out = 16; | 257 flac_cfg.output.resolution.replaygain.bps_out = 16; |
258 | 258 |
259 /* stream */ | 259 /* stream */ |
260 | 260 |
261 xmms_cfg_read_int(cfg, "flac", "stream.http_buffer_size", &flac_cfg.stream.http_buffer_size); | 261 bmp_cfg_db_get_int(db, "flac", "stream.http_buffer_size", &flac_cfg.stream.http_buffer_size); |
262 xmms_cfg_read_int(cfg, "flac", "stream.http_prebuffer", &flac_cfg.stream.http_prebuffer); | 262 bmp_cfg_db_get_int(db, "flac", "stream.http_prebuffer", &flac_cfg.stream.http_prebuffer); |
263 xmms_cfg_read_boolean(cfg, "flac", "stream.use_proxy", &flac_cfg.stream.use_proxy); | 263 bmp_cfg_db_get_bool(db, "flac", "stream.use_proxy", &flac_cfg.stream.use_proxy); |
264 xmms_cfg_read_string(cfg, "flac", "stream.proxy_host", &flac_cfg.stream.proxy_host); | 264 bmp_cfg_db_get_string(db, "flac", "stream.proxy_host", &flac_cfg.stream.proxy_host); |
265 xmms_cfg_read_int(cfg, "flac", "stream.proxy_port", &flac_cfg.stream.proxy_port); | 265 bmp_cfg_db_get_int(db, "flac", "stream.proxy_port", &flac_cfg.stream.proxy_port); |
266 xmms_cfg_read_boolean(cfg, "flac", "stream.proxy_use_auth", &flac_cfg.stream.proxy_use_auth); | 266 bmp_cfg_db_get_bool(db, "flac", "stream.proxy_use_auth", &flac_cfg.stream.proxy_use_auth); |
267 xmms_cfg_read_string(cfg, "flac", "stream.proxy_user", &flac_cfg.stream.proxy_user); | 267 bmp_cfg_db_get_string(db, "flac", "stream.proxy_user", &flac_cfg.stream.proxy_user); |
268 xmms_cfg_read_string(cfg, "flac", "stream.proxy_pass", &flac_cfg.stream.proxy_pass); | 268 bmp_cfg_db_get_string(db, "flac", "stream.proxy_pass", &flac_cfg.stream.proxy_pass); |
269 xmms_cfg_read_boolean(cfg, "flac", "stream.save_http_stream", &flac_cfg.stream.save_http_stream); | 269 bmp_cfg_db_get_bool(db, "flac", "stream.save_http_stream", &flac_cfg.stream.save_http_stream); |
270 if (!xmms_cfg_read_string(cfg, "flac", "stream.save_http_path", &flac_cfg.stream.save_http_path) || | 270 if (!bmp_cfg_db_get_string(db, "flac", "stream.save_http_path", &flac_cfg.stream.save_http_path) || |
271 ! *flac_cfg.stream.save_http_path) { | 271 ! *flac_cfg.stream.save_http_path) { |
272 /* TODO: Is this a memory leak ?? */ | 272 /* TODO: Is this a memory leak ?? */ |
273 /* | 273 /* |
274 if (flac_cfg.stream.save_http_path) | 274 if (flac_cfg.stream.save_http_path) |
275 g_free (flac_cfg.stream.save_http_path); | 275 g_free (flac_cfg.stream.save_http_path); |
276 */ | 276 */ |
277 flac_cfg.stream.save_http_path = homedir(); | 277 flac_cfg.stream.save_http_path = homedir(); |
278 } | 278 } |
279 xmms_cfg_read_boolean(cfg, "flac", "stream.cast_title_streaming", &flac_cfg.stream.cast_title_streaming); | 279 bmp_cfg_db_get_bool(db, "flac", "stream.cast_title_streaming", &flac_cfg.stream.cast_title_streaming); |
280 xmms_cfg_read_boolean(cfg, "flac", "stream.use_udp_channel", &flac_cfg.stream.use_udp_channel); | 280 bmp_cfg_db_get_bool(db, "flac", "stream.use_udp_channel", &flac_cfg.stream.use_udp_channel); |
281 | 281 |
282 init_decoder_func_tables(); | 282 init_decoder_func_tables(); |
283 decoder_func_table_ = DECODER_FUNCS [DECODER_FILE]; | 283 decoder_func_table_ = DECODER_FUNCS [DECODER_FILE]; |
284 decoder_ = decoder_func_table_ -> new_decoder(); | 284 decoder_ = decoder_func_table_ -> new_decoder(); |
285 | 285 |
286 xmms_cfg_free(cfg); | 286 bmp_cfg_db_close(db); |
287 } | 287 } |
288 | 288 |
289 int FLAC_XMMS__is_our_file(char *filename) | 289 int FLAC_XMMS__is_our_file(char *filename) |
290 { | 290 { |
291 char *ext; | 291 char *ext; |