annotate src/esd/init.c @ 3203:f5456241bff9 default tip

changed include path from audacious to audlegacy.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 10 Nov 2009 05:19:25 +0900
parents 4434b4c4a715
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1 /* xmms - esound output plugin
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
2 * Copyright (C) 1999 Galex Yen
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
3 *
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
4 * this program is free software
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
5 *
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
6 * Description:
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
7 * This program is an output plugin for xmms v0.9 or greater.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
8 * The program uses the esound daemon to output audio in order
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
9 * to allow more than one program to play audio on the same
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
10 * device at the same time.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
11 *
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
12 * Contains code Copyright (C) 1998-1999 Mikael Alm, Olle Hallnas,
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
13 * Thomas Nillson and 4Front Technologies
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
14 *
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
15 */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
16
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
17 #include <glib.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
18 #include <stdlib.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
19 #include <string.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
20 #include <esd.h>
2971
3134a0987162 - changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2523
diff changeset
21 #include <audlegacy/plugin.h>
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
22 #include "esdout.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
23
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
24
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
25 ESDConfig esd_cfg;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
26 esd_info_t *all_info;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
27 esd_player_info_t *player_info;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
28
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
29
3047
4434b4c4a715 ported EsounD plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2971
diff changeset
30 OutputPluginInitStatus
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
31 esdout_init(void)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
32 {
2523
769e17da93dd Replaced s/ConfigDb/mcs_handle_t/g, as per changes in the core.
Matti Hamalainen <ccr@tnsp.org>
parents: 2501
diff changeset
33 mcs_handle_t *db;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
34 char *env;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
35 int lp = 80 , rp = 80;
3047
4434b4c4a715 ported EsounD plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2971
diff changeset
36 int fd;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
37
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
38 memset(&esd_cfg, 0, sizeof(ESDConfig));
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
39 esd_cfg.port = ESD_DEFAULT_PORT;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
40 esd_cfg.buffer_size = 3000;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
41 esd_cfg.prebuffer = 25;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
42
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
43 db = aud_cfg_db_open();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
44
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
45 if ((env = getenv("ESPEAKER")) != NULL) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
46 char *temp;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
47 esd_cfg.use_remote = TRUE;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
48 esd_cfg.server = g_strdup(env);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
49 temp = strchr(esd_cfg.server, ':');
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
50 if (temp != NULL) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
51 *temp = '\0';
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
52 esd_cfg.port = atoi(temp + 1);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
53 if (esd_cfg.port == 0)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
54 esd_cfg.port = ESD_DEFAULT_PORT;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
55 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
56 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
57 else {
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
58 aud_cfg_db_get_bool(db, "ESD", "use_remote", &esd_cfg.use_remote);
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
59 aud_cfg_db_get_string(db, "ESD", "remote_host", &esd_cfg.server);
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
60 aud_cfg_db_get_int(db, "ESD", "remote_port", &esd_cfg.port);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
61 }
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
62 aud_cfg_db_get_bool(db, "ESD", "use_oss_mixer", &esd_cfg.use_oss_mixer);
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
63 aud_cfg_db_get_int(db, "ESD", "buffer_size", &esd_cfg.buffer_size);
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
64 aud_cfg_db_get_int(db, "ESD", "prebuffer", &esd_cfg.prebuffer);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
65
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
66 /* restore volume levels */
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
67 aud_cfg_db_get_int(db, "ESD", "volume_left", &lp);
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
68 aud_cfg_db_get_int(db, "ESD", "volume_right", &rp);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
69 esdout_set_volume(lp, rp);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
70
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
71 aud_cfg_db_close(db);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
72
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
73 if (!esd_cfg.server)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
74 esd_cfg.server = g_strdup("localhost");
3047
4434b4c4a715 ported EsounD plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2971
diff changeset
75
4434b4c4a715 ported EsounD plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2971
diff changeset
76 fd = esd_open_sound(esd_cfg.hostname);
4434b4c4a715 ported EsounD plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2971
diff changeset
77 if (fd >= 0)
4434b4c4a715 ported EsounD plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2971
diff changeset
78 {
4434b4c4a715 ported EsounD plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2971
diff changeset
79 esd_close(fd);
4434b4c4a715 ported EsounD plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2971
diff changeset
80 return OUTPUT_PLUGIN_INIT_FOUND_DEVICES;
4434b4c4a715 ported EsounD plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2971
diff changeset
81 }
4434b4c4a715 ported EsounD plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2971
diff changeset
82 else
4434b4c4a715 ported EsounD plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2971
diff changeset
83 return OUTPUT_PLUGIN_INIT_NO_DEVICES;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
84 }