annotate Plugins/Output/esd/init.c @ 555:c4d4bf876e3f trunk

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