Exemplo n.º 1
0
static void
ao_reopen(struct audio_output *ao)
{
    if (!audio_format_fully_defined(&ao->config_audio_format)) {
        if (ao->open) {
            const struct music_pipe *mp = ao->pipe;
            ao_close(ao, true);
            ao->pipe = mp;
        }

        /* no audio format is configured: copy in->out, let
           the output's open() method determine the effective
           out_audio_format */
        ao->out_audio_format = ao->in_audio_format;
        audio_format_mask_apply(&ao->out_audio_format,
                                &ao->config_audio_format);
    }

    if (ao->open)
        /* the audio format has changed, and all filters have
           to be reconfigured */
        ao_reopen_filter(ao);
    else
        ao_open(ao);
}
Exemplo n.º 2
0
static void *
my_shout_init_driver(const struct audio_format *audio_format,
		     const struct config_param *param,
		     GError **error)
{
	struct shout_data *sd;
	char *test;
	unsigned port;
	char *host;
	char *mount;
	char *passwd;
	const char *encoding;
	const struct encoder_plugin *encoder_plugin;
	unsigned shout_format;
	unsigned protocol;
	const char *user;
	char *name;
	const char *value;
	struct block_param *block_param;
	int public;

	if (audio_format == NULL ||
	    !audio_format_fully_defined(audio_format)) {
		g_set_error(error, shout_output_quark(), 0,
			    "Need full audio format specification");
		return NULL;
	}

	sd = new_shout_data();

	if (shout_init_count == 0)
		shout_init();

	shout_init_count++;

	check_block_param("host");
	host = block_param->value;

	check_block_param("mount");
	mount = block_param->value;

	port = config_get_block_unsigned(param, "port", 0);
	if (port == 0) {
		g_set_error(error, shout_output_quark(), 0,
			    "shout port must be configured");
		return NULL;
	}

	check_block_param("password");
	passwd = block_param->value;

	check_block_param("name");
	name = block_param->value;

	public = config_get_block_bool(param, "public", false);