Esempio n. 1
0
static void
roar_configure(struct roar * self, const struct config_param *param)
{
	self->host = config_dup_block_string(param, "server", NULL);
	self->name = config_dup_block_string(param, "name", "MPD");
	char *role = config_dup_block_string(param, "role", "music");
	if (role != NULL)
	{
		self->role = roar_str2role(role);
		g_free(role);
	}
	else
		self->role = ROAR_ROLE_MUSIC;
}
static void *
fifo_output_init(G_GNUC_UNUSED const struct audio_format *audio_format,
		 const struct config_param *param,
		 GError **error)
{
	struct fifo_data *fd;
	char *value, *path;

	value = config_dup_block_string(param, "path", NULL);
	if (value == NULL) {
		g_set_error(error, fifo_output_quark(), errno,
			    "No \"path\" parameter specified");
		return NULL;
	}

	path = parsePath(value);
	g_free(value);
	if (!path) {
		g_set_error(error, fifo_output_quark(), errno,
			    "Could not parse \"path\" parameter");
		return NULL;
	}

	fd = fifo_data_new();
	fd->path = path;

	if (!fifo_open(fd, error)) {
		fifo_data_free(fd);
		return NULL;
	}

	return fd;
}
Esempio n. 3
0
static void
alsa_configure(struct alsa_data *ad, const struct config_param *param)
{
	ad->device = config_dup_block_string(param, "device", NULL);

	ad->use_mmap = config_get_block_bool(param, "use_mmap", false);

	ad->buffer_time = config_get_block_unsigned(param, "buffer_time",
			MPD_ALSA_BUFFER_TIME_US);
	ad->period_time = config_get_block_unsigned(param, "period_time", 0);

#ifdef SND_PCM_NO_AUTO_RESAMPLE
	if (!config_get_block_bool(param, "auto_resample", true))
		ad->mode |= SND_PCM_NO_AUTO_RESAMPLE;
#endif

#ifdef SND_PCM_NO_AUTO_CHANNELS
	if (!config_get_block_bool(param, "auto_channels", true))
		ad->mode |= SND_PCM_NO_AUTO_CHANNELS;
#endif

#ifdef SND_PCM_NO_AUTO_FORMAT
	if (!config_get_block_bool(param, "auto_format", true))
		ad->mode |= SND_PCM_NO_AUTO_FORMAT;
#endif
}
Esempio n. 4
0
static bool
soundcloud_init(const struct config_param *param)
{
	soundcloud_config.apikey =
		config_dup_block_string(param, "apikey", NULL);
	if (soundcloud_config.apikey == NULL) {
		g_debug("disabling the soundcloud playlist plugin "
			"because API key is not set");
		return false;
	}

	return true;
}
Esempio n. 5
0
static void *
pipe_output_init(G_GNUC_UNUSED const struct audio_format *audio_format,
                 const struct config_param *param,
                 GError **error)
{
    struct pipe_output *pd = g_new(struct pipe_output, 1);

    pd->cmd = config_dup_block_string(param, "command", NULL);
    if (pd->cmd == NULL) {
        g_set_error(error, pipe_output_quark(), 0,
                    "No \"command\" parameter specified");
        return NULL;
    }

    return pd;
}
Esempio n. 6
0
static struct audio_output *
pipe_output_init(const struct config_param *param,
		 GError **error)
{
	struct pipe_output *pd = g_new(struct pipe_output, 1);

	if (!ao_base_init(&pd->base, &pipe_output_plugin, param, error)) {
		g_free(pd);
		return NULL;
	}

	pd->cmd = config_dup_block_string(param, "command", NULL);
	if (pd->cmd == NULL) {
		g_set_error(error, pipe_output_quark(), 0,
			    "No \"command\" parameter specified");
		return NULL;
	}

	return &pd->base;
}