comparison Output/esd/init.c @ 0:cb178e5ad177 trunk

[svn] Import audacious source.
author nenolod
date Mon, 24 Oct 2005 03:06:47 -0700
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:cb178e5ad177
1 /* xmms - esound output plugin
2 * Copyright (C) 1999 Galex Yen
3 *
4 * this program is free software
5 *
6 * Description:
7 * This program is an output plugin for xmms v0.9 or greater.
8 * The program uses the esound daemon to output audio in order
9 * to allow more than one program to play audio on the same
10 * device at the same time.
11 *
12 * Contains code Copyright (C) 1998-1999 Mikael Alm, Olle Hallnas,
13 * Thomas Nillson and 4Front Technologies
14 *
15 */
16
17 #include <glib.h>
18 #include <stdlib.h>
19 #include <string.h>
20 #include <esd.h>
21
22 #include <libaudacious/configdb.h>
23
24 #include "esdout.h"
25
26
27 ESDConfig esd_cfg;
28 esd_info_t *all_info;
29 esd_player_info_t *player_info;
30
31
32 void
33 esdout_init(void)
34 {
35 ConfigDb *db;
36 char *env;
37
38 memset(&esd_cfg, 0, sizeof(ESDConfig));
39 esd_cfg.port = ESD_DEFAULT_PORT;
40 esd_cfg.buffer_size = 3000;
41 esd_cfg.prebuffer = 25;
42
43 db = bmp_cfg_db_open();
44
45 if ((env = getenv("ESPEAKER")) != NULL) {
46 char *temp;
47 esd_cfg.use_remote = TRUE;
48 esd_cfg.server = g_strdup(env);
49 temp = strchr(esd_cfg.server, ':');
50 if (temp != NULL) {
51 *temp = '\0';
52 esd_cfg.port = atoi(temp + 1);
53 if (esd_cfg.port == 0)
54 esd_cfg.port = ESD_DEFAULT_PORT;
55 }
56 }
57 else {
58 bmp_cfg_db_get_bool(db, "ESD", "use_remote", &esd_cfg.use_remote);
59 bmp_cfg_db_get_string(db, "ESD", "remote_host", &esd_cfg.server);
60 bmp_cfg_db_get_int(db, "ESD", "remote_port", &esd_cfg.port);
61 }
62 bmp_cfg_db_get_bool(db, "ESD", "use_oss_mixer", &esd_cfg.use_oss_mixer);
63 bmp_cfg_db_get_int(db, "ESD", "buffer_size", &esd_cfg.buffer_size);
64 bmp_cfg_db_get_int(db, "ESD", "prebuffer", &esd_cfg.prebuffer);
65 bmp_cfg_db_close(db);
66
67 if (!esd_cfg.server)
68 esd_cfg.server = g_strdup("localhost");
69 }