annotate Output/esd/init.c @ 53:710d8b266d7e trunk

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