Пример #1
0
void osx_init(void)
{
	left_volume = 1.0;
	right_volume = 1.0;

#if 0
	ConfigFile *cfgfile;

	memset(&osx_cfg, 0, sizeof (OSXConfig));

	osx_cfg.audio_device = 0;
	osx_cfg.mixer_device = 0;
	osx_cfg.buffer_size = 3000;
	osx_cfg.prebuffer = 25;
	osx_cfg.use_alt_audio_device = FALSE;
	osx_cfg.alt_audio_device = NULL;
	osx_cfg.use_master=0;
	
	if ((cfgfile = xmms_cfg_open_default_file()))
	{
		xmms_cfg_read_int(cfgfile, "OSX", "audio_device", &osx_cfg.audio_device);
		xmms_cfg_read_int(cfgfile, "OSX", "mixer_device", &osx_cfg.mixer_device);
		xmms_cfg_read_int(cfgfile, "OSX", "buffer_size", &osx_cfg.buffer_size);
		xmms_cfg_read_int(cfgfile, "OSX", "prebuffer", &osx_cfg.prebuffer);
		xmms_cfg_read_boolean(cfgfile, "OSX", "use_master", &osx_cfg.use_master);
		xmms_cfg_read_boolean(cfgfile, "OSX", "use_alt_audio_device", &osx_cfg.use_alt_audio_device);
		xmms_cfg_read_string(cfgfile, "OSX", "alt_audio_device", &osx_cfg.alt_audio_device);
		xmms_cfg_read_boolean(cfgfile, "OSX", "use_alt_mixer_device", &osx_cfg.use_alt_mixer_device);
		xmms_cfg_read_string(cfgfile, "OSX", "alt_mixer_device", &osx_cfg.alt_mixer_device);
		xmms_cfg_free(cfgfile);
	}
#endif
}
Пример #2
0
static void read_config(void)
{
	ConfigFile *cfgfile;

	g_free(cmd_line);
	g_free(cmd_line_after);
	g_free(cmd_line_end);
	cmd_line = NULL;
	cmd_line_after = NULL;
	cmd_line_end = NULL;

	if ((cfgfile = xmms_cfg_open_default_file()) != NULL)
	{
		xmms_cfg_read_string(cfgfile, "song_change", "cmd_line", &cmd_line);
		xmms_cfg_read_string(cfgfile, "song_change", "cmd_line_after", &cmd_line_after);
		xmms_cfg_read_string(cfgfile, "song_change", "cmd_line_end", &cmd_line_end);
		xmms_cfg_free(cfgfile);
	}
	if (!cmd_line)
		cmd_line = g_strdup("");
	if (!cmd_line_after)
		cmd_line_after = g_strdup("");
	if (!cmd_line_end)
		cmd_line_end = g_strdup("");
}
Пример #3
0
/*
 * Read configuration and initialize variables.
 */
static void read_config (void)
{

  ConfigFile *cfgfile;

  show_volume = 1;
  show_balance = 1;
  show_pause = 1;
  show_trackname = 1;
  show_stop = 1;
  show_repeat = 1;
  show_shuffle = 1;

  g_free (colour);
  g_free (font);
  colour = NULL;
  font = NULL;
  timeout = 3;
  offset = 50;
  shadow_offset = 1;
  pos = XOSD_bottom;

  DEBUG("read config");
  if ((cfgfile = xmms_cfg_open_default_file ()) != NULL)
    {
      xmms_cfg_read_string (cfgfile, "osd", "font", &font);
      xmms_cfg_read_string (cfgfile, "osd", "colour", &colour);
      xmms_cfg_read_int (cfgfile, "osd", "timeout", &timeout);
      xmms_cfg_read_int (cfgfile, "osd", "offset", &offset);
      xmms_cfg_read_int (cfgfile, "osd", "pos", &pos);
      xmms_cfg_read_int (cfgfile, "osd", "shadow_offset", &shadow_offset);
      xmms_cfg_read_int (cfgfile, "osd", "show_volume", &show_volume );
      xmms_cfg_read_int (cfgfile, "osd", "show_balance", &show_balance );
      xmms_cfg_read_int (cfgfile, "osd", "show_pause", &show_pause );
      xmms_cfg_read_int (cfgfile, "osd", "show_trackname", &show_trackname );
      xmms_cfg_read_int (cfgfile, "osd", "show_stop", &show_stop );
      xmms_cfg_read_int (cfgfile, "osd", "show_repeat", &show_repeat );
      xmms_cfg_read_int (cfgfile, "osd", "show_shuffle", &show_shuffle );
      xmms_cfg_free(cfgfile);
    }

  if (font == NULL)
    font = g_strdup ("fixed");
  if (colour == NULL)
    colour = g_strdup ("green");
}
Пример #4
0
static void
op_init (void)
{
	ConfigFile *cfgfile;

	cfgfile = xmms_cfg_open_default_file();
	xmms_cfg_read_string(cfgfile, "sndio", "audiodev", &audiodev);
	xmms_cfg_free(cfgfile);

	if (!audiodev)
		audiodev = g_strdup("");
}
Пример #5
0
gboolean cdda_cdinfo_read_file(guint32 cddb_discid, cdinfo_t *cdinfo)
{
	gchar *filename;
	ConfigFile *cfg;
	gchar sectionname[10], trackstr[16];
	gint i, numtracks = CLAMP(cddb_discid & 0xff, 0, 99);
	gboolean track_found;

	sprintf(sectionname, "%08x", cddb_discid);
	
	filename = g_strconcat(g_get_home_dir(), "/.xmms/cdinfo", NULL);
	if ((cfg = xmms_cfg_open_file(filename)) == NULL)
	{
		g_free(filename);
		return FALSE;
	}
	g_free(filename);

	if (!xmms_cfg_read_string(cfg, sectionname, "Albumname", &cdinfo->albname))
		return FALSE;

	xmms_cfg_read_string(cfg, sectionname, "Artistname", &cdinfo->artname);

	for (i = 1; i <= numtracks; i++)
	{
		track_found = FALSE;
		sprintf(trackstr, "track_artist%d", i);
		if (xmms_cfg_read_string(cfg, sectionname, trackstr, &cdinfo->tracks[i].artist))
			track_found = TRUE;
		sprintf(trackstr, "track_title%d", i);
		if (xmms_cfg_read_string(cfg, sectionname, trackstr, &cdinfo->tracks[i].title))
			track_found = TRUE;
		if (track_found)
			cdinfo->tracks[i].num = i;
	}
	cdinfo->is_valid = TRUE;
	xmms_cfg_free(cfg);
	return TRUE;
}
Пример #6
0
/* ---------------------------------------------------------------------- */
void joyapp_read_config(void)
{
	ConfigFile *cfile;

	joy_cfg.device_1 = g_strdup("/dev/js0");
	joy_cfg.device_2 = g_strdup("/dev/js1");

	cfile = xmms_cfg_open_default_file();

	xmms_cfg_read_string(cfile, "joystick", "device1", &joy_cfg.device_1);
	xmms_cfg_read_string(cfile, "joystick", "device2", &joy_cfg.device_2);
	xmms_cfg_read_int(cfile, "joystick", "sensitivity", &joy_cfg.sens);
	xmms_cfg_read_int(cfile, "joystick", "up", &joy_cfg.up);
	xmms_cfg_read_int(cfile, "joystick", "down", &joy_cfg.down);
	xmms_cfg_read_int(cfile, "joystick", "left", &joy_cfg.left);
	xmms_cfg_read_int(cfile, "joystick", "right", &joy_cfg.right);
	xmms_cfg_read_int(cfile, "joystick", "alt_up", &joy_cfg.alt_up);
	xmms_cfg_read_int(cfile, "joystick", "alt_down", &joy_cfg.alt_down);
	xmms_cfg_read_int(cfile, "joystick", "alt_left", &joy_cfg.alt_left);
	xmms_cfg_read_int(cfile, "joystick", "alt_right", &joy_cfg.alt_right);

	xmms_cfg_free(cfile);
}
Пример #7
0
gboolean xmms_cfg_read_int(ConfigFile * cfg, gchar * section, gchar * key, gint * value)
{
	char *str;

	g_return_val_if_fail(cfg != NULL, FALSE);
	g_return_val_if_fail(section != NULL, FALSE);
	g_return_val_if_fail(key != NULL, FALSE);
	g_return_val_if_fail(value != NULL, FALSE);

	if (!xmms_cfg_read_string(cfg, section, key, &str))
		return FALSE;
	*value = atoi(str);
	g_free(str);

	return TRUE;
}
Пример #8
0
static void playerout_init(void)
{
	ConfigFile *cfgfile;

	cfgfile = xmms_cfg_open_default_file();
	if (cfgfile)
	{
		xmms_cfg_read_string(cfgfile, "playerout", "server_address", &server_address);
		xmms_cfg_read_int(cfgfile, "playerout", "server_port", &server_port);
		xmms_cfg_read_int(cfgfile, "playerout", "server_index", &server_index);
		xmms_cfg_read_int (cfgfile, "playerout", "buffer_time", &bufferTime);
		xmms_cfg_free(cfgfile);
	}

	if (!server_address)
		server_address = g_strdup ("localhost");
}
Пример #9
0
gboolean xmms_cfg_read_boolean(ConfigFile * cfg, gchar * section, gchar * key, gboolean * value)
{
	char *str;

	g_return_val_if_fail(cfg != NULL, FALSE);
	g_return_val_if_fail(section != NULL, FALSE);
	g_return_val_if_fail(key != NULL, FALSE);
	g_return_val_if_fail(value != NULL, FALSE);

	if (!xmms_cfg_read_string(cfg, section, key, &str))
		return FALSE;
	if (!strcasecmp(str, "TRUE"))
		*value = TRUE;
	else
		*value = FALSE;
	g_free(str);
	return TRUE;
}
Пример #10
0
gboolean xmms_cfg_read_double(ConfigFile * cfg, gchar * section, gchar * key, gdouble * value)
{
	char *str, *locale;

	g_return_val_if_fail(cfg != NULL, FALSE);
	g_return_val_if_fail(section != NULL, FALSE);
	g_return_val_if_fail(key != NULL, FALSE);
	g_return_val_if_fail(value != NULL, FALSE);

	if (!xmms_cfg_read_string(cfg, section, key, &str))
		return FALSE;

	locale = g_strdup(setlocale(LC_NUMERIC, NULL));
	setlocale(LC_NUMERIC, "C");
	*value = strtod(str, NULL);
	setlocale(LC_NUMERIC, locale);
	g_free(locale);
	g_free(str);

	return TRUE;
}
Пример #11
0
/* Read xmms config file and load irman specific information */
void irapp_read_config(void)
{
	ConfigFile *cfgfile;
	gchar *filename, buttontext[20];
	gint i;

	ircfg.device = g_strdup("/dev/ttyS1");
	ircfg.codelen = 6;
	for (i = 0; i < 10; i++)
	{
		ircfg.button[i] = g_strdup("");
		ircfg.playlist[i] = g_strdup("");
	}
	for (i = 10; i < 100; i++)
		ircfg.playlist[i] = g_strdup("");

	ircfg.button_play = g_strdup("");
	ircfg.button_stop = g_strdup("");
	ircfg.button_next = g_strdup("");
	ircfg.button_prev = g_strdup("");
	ircfg.button_pause = g_strdup("");
	ircfg.button_seekf = g_strdup("");
	ircfg.button_seekb = g_strdup("");
	ircfg.button_volup = g_strdup("");
	ircfg.button_voldown = g_strdup("");
	ircfg.button_shuffle = g_strdup("");
	ircfg.button_repeat = g_strdup("");
	ircfg.button_playlist = g_strdup("");
	ircfg.button_plus100 = g_strdup("");

	filename = g_strconcat(g_get_home_dir(), "/.xmms/config", NULL);
	cfgfile = xmms_cfg_open_file(filename);
	if (cfgfile)
	{
		xmms_cfg_read_string(cfgfile, "irman", "device", &ircfg.device);
		xmms_cfg_read_int(cfgfile, "irman", "codelen", &ircfg.codelen);
		for (i = 0; i < 10; i++)
		{
			sprintf(buttontext, "button%d", i);
			xmms_cfg_read_string(cfgfile, "irman", buttontext, &ircfg.button[i]);
			sprintf(buttontext, "playlist%d", i);
			xmms_cfg_read_string(cfgfile, "irman", buttontext, &ircfg.playlist[i]);
		}
		for (i = 10; i < 100; i++)
		{
			sprintf(buttontext, "playlist%d", i);
			xmms_cfg_read_string(cfgfile, "irman", buttontext, &ircfg.playlist[i]);
		}
		xmms_cfg_read_string(cfgfile, "irman", "button_play", &ircfg.button_play);
		xmms_cfg_read_string(cfgfile, "irman", "button_stop", &ircfg.button_stop);
		xmms_cfg_read_string(cfgfile, "irman", "button_next", &ircfg.button_next);
		xmms_cfg_read_string(cfgfile, "irman", "button_prev", &ircfg.button_prev);
		xmms_cfg_read_string(cfgfile, "irman", "button_pause", &ircfg.button_pause);
		xmms_cfg_read_string(cfgfile, "irman", "button_seekf", &ircfg.button_seekf);
		xmms_cfg_read_string(cfgfile, "irman", "button_seekb", &ircfg.button_seekb);
		xmms_cfg_read_string(cfgfile, "irman", "button_volup", &ircfg.button_volup);
		xmms_cfg_read_string(cfgfile, "irman", "button_voldown", &ircfg.button_voldown);
		xmms_cfg_read_string(cfgfile, "irman", "button_shuffle", &ircfg.button_shuffle);
		xmms_cfg_read_string(cfgfile, "irman", "button_repeat", &ircfg.button_repeat);
		xmms_cfg_read_string(cfgfile, "irman", "button_playlist", &ircfg.button_playlist);
		xmms_cfg_read_string(cfgfile, "irman", "button_plus100", &ircfg.button_plus100);
		xmms_cfg_free(cfgfile);
	}
	g_free(filename);
}
Пример #12
0
static void cdda_init(void)
{
	ConfigFile *cfgfile;
	struct driveinfo *drive = g_malloc0(sizeof(struct driveinfo));
	int ndrives = 1, i;

	cdda_playing.fd = -1;
	memset(&cdda_cfg, 0, sizeof(CDDAConfig));

#ifdef HAVE_OSS
  	drive->mixer = CDDA_MIXER_OSS;
	drive->oss_mixer = SOUND_MIXER_CD;
#endif

	cfgfile = xmms_cfg_open_default_file();

	/* These names are used for backwards compatibility */
	xmms_cfg_read_string(cfgfile, "CDDA", "device", &drive->device);
	xmms_cfg_read_string(cfgfile, "CDDA", "directory", &drive->directory);
	xmms_cfg_read_int(cfgfile, "CDDA", "mixer", &drive->mixer);
	xmms_cfg_read_int(cfgfile, "CDDA", "readmode", &drive->dae);

	if (!drive->device)
		drive->device = g_strdup(CDDA_DEVICE);
	if (!drive->directory)
		drive->directory = g_strdup(CDDA_DIRECTORY);

	cdda_cfg.drives = g_list_append(cdda_cfg.drives, drive);

	xmms_cfg_read_int(cfgfile, "CDDA", "num_drives", &ndrives);
  	for (i = 1; i < ndrives; i++)
	{
		char label[20];
		drive = g_malloc0(sizeof(struct driveinfo));

		sprintf(label, "device%d", i);
		xmms_cfg_read_string(cfgfile, "CDDA", label, &drive->device);
		
		sprintf(label, "directory%d", i);
		xmms_cfg_read_string(cfgfile, "CDDA", label, &drive->directory);

		sprintf(label, "mixer%d", i);
		xmms_cfg_read_int(cfgfile, "CDDA", label, &drive->mixer);

		sprintf(label, "readmode%d", i);
		xmms_cfg_read_int(cfgfile, "CDDA", label, &drive->dae);

		cdda_cfg.drives = g_list_append(cdda_cfg.drives, drive);
	}
	xmms_cfg_read_boolean(cfgfile, "CDDA", "title_override", &cdda_cfg.title_override);
	xmms_cfg_read_string(cfgfile, "CDDA", "name_format", &cdda_cfg.name_format);
	xmms_cfg_read_boolean(cfgfile, "CDDA", "use_cddb", &cdda_cfg.use_cddb);
	xmms_cfg_read_string(cfgfile, "CDDA", "cddb_server", &cdda_cfg.cddb_server);
#ifdef WITH_CDINDEX
	xmms_cfg_read_boolean(cfgfile, "CDDA", "use_cdin", &cdda_cfg.use_cdin);
#else
	cdda_cfg.use_cdin = FALSE;
#endif
	xmms_cfg_read_string(cfgfile, "CDDA", "cdin_server", &cdda_cfg.cdin_server);
	xmms_cfg_free(cfgfile);

	if (!cdda_cfg.cdin_server)
		cdda_cfg.cdin_server = g_strdup("www.cdindex.org");
	if (!cdda_cfg.cddb_server)
		cdda_cfg.cddb_server = g_strdup(CDDB_DEFAULT_SERVER);
	if (!cdda_cfg.name_format)
		cdda_cfg.name_format = g_strdup("%p - %t");
}
Пример #13
0
void FLAC_XMMS__init(void)
{
	ConfigFile *cfg;
	FLAC__uint32 test = 1;

	is_big_endian_host_ = (*((FLAC__byte*)(&test)))? false : true;

	flac_cfg.title.tag_override = FALSE;
	if (flac_cfg.title.tag_format)
		g_free(flac_cfg.title.tag_format);
	flac_cfg.title.convert_char_set = FALSE;

	cfg = xmms_cfg_open_default_file();

	/* title */

	xmms_cfg_read_boolean(cfg, "flac", "title.tag_override", &flac_cfg.title.tag_override);

	if(!xmms_cfg_read_string(cfg, "flac", "title.tag_format", &flac_cfg.title.tag_format))
		flac_cfg.title.tag_format = g_strdup("%p - %t");

	xmms_cfg_read_boolean(cfg, "flac", "title.convert_char_set", &flac_cfg.title.convert_char_set);

	if(!xmms_cfg_read_string(cfg, "flac", "title.user_char_set", &flac_cfg.title.user_char_set))
		flac_cfg.title.user_char_set = FLAC_plugin__charset_get_current();

	/* replaygain */

	xmms_cfg_read_boolean(cfg, "flac", "output.replaygain.enable", &flac_cfg.output.replaygain.enable);

	xmms_cfg_read_boolean(cfg, "flac", "output.replaygain.album_mode", &flac_cfg.output.replaygain.album_mode);

	if(!xmms_cfg_read_int(cfg, "flac", "output.replaygain.preamp", &flac_cfg.output.replaygain.preamp))
		flac_cfg.output.replaygain.preamp = 0;

	xmms_cfg_read_boolean(cfg, "flac", "output.replaygain.hard_limit", &flac_cfg.output.replaygain.hard_limit);

	xmms_cfg_read_boolean(cfg, "flac", "output.resolution.normal.dither_24_to_16", &flac_cfg.output.resolution.normal.dither_24_to_16);
	xmms_cfg_read_boolean(cfg, "flac", "output.resolution.replaygain.dither", &flac_cfg.output.resolution.replaygain.dither);

	if(!xmms_cfg_read_int(cfg, "flac", "output.resolution.replaygain.noise_shaping", &flac_cfg.output.resolution.replaygain.noise_shaping))
		flac_cfg.output.resolution.replaygain.noise_shaping = 1;

	if(!xmms_cfg_read_int(cfg, "flac", "output.resolution.replaygain.bps_out", &flac_cfg.output.resolution.replaygain.bps_out))
		flac_cfg.output.resolution.replaygain.bps_out = 16;

	/* stream */

	xmms_cfg_read_int(cfg, "flac", "stream.http_buffer_size", &flac_cfg.stream.http_buffer_size);
	xmms_cfg_read_int(cfg, "flac", "stream.http_prebuffer", &flac_cfg.stream.http_prebuffer);
	xmms_cfg_read_boolean(cfg, "flac", "stream.use_proxy", &flac_cfg.stream.use_proxy);
	if(flac_cfg.stream.proxy_host)
		g_free(flac_cfg.stream.proxy_host);
	if(!xmms_cfg_read_string(cfg, "flac", "stream.proxy_host", &flac_cfg.stream.proxy_host))
		flac_cfg.stream.proxy_host = g_strdup("");
	xmms_cfg_read_int(cfg, "flac", "stream.proxy_port", &flac_cfg.stream.proxy_port);
	xmms_cfg_read_boolean(cfg, "flac", "stream.proxy_use_auth", &flac_cfg.stream.proxy_use_auth);
	if(flac_cfg.stream.proxy_user)
		g_free(flac_cfg.stream.proxy_user);
	flac_cfg.stream.proxy_user = NULL;
	xmms_cfg_read_string(cfg, "flac", "stream.proxy_user", &flac_cfg.stream.proxy_user);
	if(flac_cfg.stream.proxy_pass)
		g_free(flac_cfg.stream.proxy_pass);
	flac_cfg.stream.proxy_pass = NULL;
	xmms_cfg_read_string(cfg, "flac", "stream.proxy_pass", &flac_cfg.stream.proxy_pass);
	xmms_cfg_read_boolean(cfg, "flac", "stream.save_http_stream", &flac_cfg.stream.save_http_stream);
	if (flac_cfg.stream.save_http_path)
		g_free (flac_cfg.stream.save_http_path);
	if (!xmms_cfg_read_string(cfg, "flac", "stream.save_http_path", &flac_cfg.stream.save_http_path) || ! *flac_cfg.stream.save_http_path) {
		if (flac_cfg.stream.save_http_path)
			g_free (flac_cfg.stream.save_http_path);
		flac_cfg.stream.save_http_path = homedir();
	}
	xmms_cfg_read_boolean(cfg, "flac", "stream.cast_title_streaming", &flac_cfg.stream.cast_title_streaming);
	xmms_cfg_read_boolean(cfg, "flac", "stream.use_udp_channel", &flac_cfg.stream.use_udp_channel);

	decoder_ = FLAC__stream_decoder_new();

	xmms_cfg_free(cfg);
}