mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	support new channel_map argument in sink/source modules
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@803 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
		
							parent
							
								
									fbb0d1436c
								
							
						
					
					
						commit
						185a57cadd
					
				
					 11 changed files with 158 additions and 49 deletions
				
			
		| 
						 | 
					@ -50,7 +50,15 @@
 | 
				
			||||||
PA_MODULE_AUTHOR("Lennart Poettering")
 | 
					PA_MODULE_AUTHOR("Lennart Poettering")
 | 
				
			||||||
PA_MODULE_DESCRIPTION("ALSA Sink")
 | 
					PA_MODULE_DESCRIPTION("ALSA Sink")
 | 
				
			||||||
PA_MODULE_VERSION(PACKAGE_VERSION)
 | 
					PA_MODULE_VERSION(PACKAGE_VERSION)
 | 
				
			||||||
PA_MODULE_USAGE("sink_name=<name for the sink> device=<ALSA device> format=<sample format> channels=<number of channels> rate=<sample rate> fragments=<number of fragments> fragment_size=<fragment size>")
 | 
					PA_MODULE_USAGE(
 | 
				
			||||||
 | 
					        "sink_name=<name for the sink> "
 | 
				
			||||||
 | 
					        "device=<ALSA device> "
 | 
				
			||||||
 | 
					        "format=<sample format> "
 | 
				
			||||||
 | 
					        "channels=<number of channels> "
 | 
				
			||||||
 | 
					        "rate=<sample rate> "
 | 
				
			||||||
 | 
					        "fragments=<number of fragments> "
 | 
				
			||||||
 | 
					        "fragment_size=<fragment size> "
 | 
				
			||||||
 | 
					        "channel_map=<channel map>")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct userdata {
 | 
					struct userdata {
 | 
				
			||||||
    snd_pcm_t *pcm_handle;
 | 
					    snd_pcm_t *pcm_handle;
 | 
				
			||||||
| 
						 | 
					@ -74,6 +82,7 @@ static const char* const valid_modargs[] = {
 | 
				
			||||||
    "rate",
 | 
					    "rate",
 | 
				
			||||||
    "fragments",
 | 
					    "fragments",
 | 
				
			||||||
    "fragment_size",
 | 
					    "fragment_size",
 | 
				
			||||||
 | 
					    "channel_map",
 | 
				
			||||||
    NULL
 | 
					    NULL
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -299,6 +308,7 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
    struct userdata *u = NULL;
 | 
					    struct userdata *u = NULL;
 | 
				
			||||||
    const char *dev;
 | 
					    const char *dev;
 | 
				
			||||||
    pa_sample_spec ss;
 | 
					    pa_sample_spec ss;
 | 
				
			||||||
 | 
					    pa_channel_map map;
 | 
				
			||||||
    uint32_t periods, fragsize;
 | 
					    uint32_t periods, fragsize;
 | 
				
			||||||
    snd_pcm_uframes_t period_size;
 | 
					    snd_pcm_uframes_t period_size;
 | 
				
			||||||
    size_t frame_size;
 | 
					    size_t frame_size;
 | 
				
			||||||
| 
						 | 
					@ -311,7 +321,7 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ss = c->default_sample_spec;
 | 
					    ss = c->default_sample_spec;
 | 
				
			||||||
    if (pa_modargs_get_sample_spec(ma, &ss) < 0) {
 | 
					    if (pa_modargs_get_sample_spec_and_channel_map(ma, &ss, &map) < 0) {
 | 
				
			||||||
        pa_log(__FILE__": failed to parse sample specification");
 | 
					        pa_log(__FILE__": failed to parse sample specification");
 | 
				
			||||||
        goto fail;
 | 
					        goto fail;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -357,7 +367,7 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
        u->mixer_handle = NULL;
 | 
					        u->mixer_handle = NULL;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, NULL);
 | 
					    u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, &map);
 | 
				
			||||||
    assert(u->sink);
 | 
					    assert(u->sink);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    u->sink->get_latency = sink_get_latency_cb;
 | 
					    u->sink->get_latency = sink_get_latency_cb;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -50,7 +50,15 @@
 | 
				
			||||||
PA_MODULE_AUTHOR("Lennart Poettering")
 | 
					PA_MODULE_AUTHOR("Lennart Poettering")
 | 
				
			||||||
PA_MODULE_DESCRIPTION("ALSA Source")
 | 
					PA_MODULE_DESCRIPTION("ALSA Source")
 | 
				
			||||||
PA_MODULE_VERSION(PACKAGE_VERSION)
 | 
					PA_MODULE_VERSION(PACKAGE_VERSION)
 | 
				
			||||||
PA_MODULE_USAGE("source_name=<name for the source> device=<ALSA device> format=<sample format> channels=<number of channels> rate=<sample rate> fragments=<number of fragments> fragment_size=<fragment size>")
 | 
					PA_MODULE_USAGE(
 | 
				
			||||||
 | 
					        "source_name=<name for the source> "
 | 
				
			||||||
 | 
					        "device=<ALSA device> "
 | 
				
			||||||
 | 
					        "format=<sample format> "
 | 
				
			||||||
 | 
					        "channels=<number of channels> "
 | 
				
			||||||
 | 
					        "rate=<sample rate> "
 | 
				
			||||||
 | 
					        "fragments=<number of fragments> "
 | 
				
			||||||
 | 
					        "fragment_size=<fragment size> "
 | 
				
			||||||
 | 
					        "channel_map=<channel map>")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct userdata {
 | 
					struct userdata {
 | 
				
			||||||
    snd_pcm_t *pcm_handle;
 | 
					    snd_pcm_t *pcm_handle;
 | 
				
			||||||
| 
						 | 
					@ -74,6 +82,7 @@ static const char* const valid_modargs[] = {
 | 
				
			||||||
    "format",
 | 
					    "format",
 | 
				
			||||||
    "fragments",
 | 
					    "fragments",
 | 
				
			||||||
    "fragment_size",
 | 
					    "fragment_size",
 | 
				
			||||||
 | 
					    "channel_map",
 | 
				
			||||||
    NULL
 | 
					    NULL
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -287,6 +296,7 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
    struct userdata *u = NULL;
 | 
					    struct userdata *u = NULL;
 | 
				
			||||||
    const char *dev;
 | 
					    const char *dev;
 | 
				
			||||||
    pa_sample_spec ss;
 | 
					    pa_sample_spec ss;
 | 
				
			||||||
 | 
					    pa_channel_map map;
 | 
				
			||||||
    unsigned periods, fragsize;
 | 
					    unsigned periods, fragsize;
 | 
				
			||||||
    snd_pcm_uframes_t period_size;
 | 
					    snd_pcm_uframes_t period_size;
 | 
				
			||||||
    size_t frame_size;
 | 
					    size_t frame_size;
 | 
				
			||||||
| 
						 | 
					@ -299,7 +309,7 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ss = c->default_sample_spec;
 | 
					    ss = c->default_sample_spec;
 | 
				
			||||||
    if (pa_modargs_get_sample_spec(ma, &ss) < 0) {
 | 
					    if (pa_modargs_get_sample_spec_and_channel_map(ma, &ss, &map) < 0) {
 | 
				
			||||||
        pa_log(__FILE__": failed to parse sample specification");
 | 
					        pa_log(__FILE__": failed to parse sample specification");
 | 
				
			||||||
        goto fail;
 | 
					        goto fail;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -345,7 +355,7 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
        u->mixer_handle = NULL;
 | 
					        u->mixer_handle = NULL;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    u->source = pa_source_new(c, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss, NULL);
 | 
					    u->source = pa_source_new(c, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss, &map);
 | 
				
			||||||
    assert(u->source);
 | 
					    assert(u->source);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    u->source->userdata = u;
 | 
					    u->source->userdata = u;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -42,7 +42,16 @@
 | 
				
			||||||
PA_MODULE_AUTHOR("Lennart Poettering")
 | 
					PA_MODULE_AUTHOR("Lennart Poettering")
 | 
				
			||||||
PA_MODULE_DESCRIPTION("Combine multiple sinks to one")
 | 
					PA_MODULE_DESCRIPTION("Combine multiple sinks to one")
 | 
				
			||||||
PA_MODULE_VERSION(PACKAGE_VERSION)
 | 
					PA_MODULE_VERSION(PACKAGE_VERSION)
 | 
				
			||||||
PA_MODULE_USAGE("sink_name=<name for the sink> master=<master sink> slaves=<slave sinks> adjust_time=<seconds> resample_method=<method>")
 | 
					PA_MODULE_USAGE(
 | 
				
			||||||
 | 
					        "sink_name=<name for the sink> "
 | 
				
			||||||
 | 
					        "master=<master sink> "
 | 
				
			||||||
 | 
					        "slaves=<slave sinks> "
 | 
				
			||||||
 | 
					        "adjust_time=<seconds> "
 | 
				
			||||||
 | 
					        "resample_method=<method> "
 | 
				
			||||||
 | 
					        "format=<sample format> "
 | 
				
			||||||
 | 
					        "channels=<number of channels> "
 | 
				
			||||||
 | 
					        "rate=<sample rate> "
 | 
				
			||||||
 | 
					        "channel_map=<channel map> ")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DEFAULT_SINK_NAME "combined"
 | 
					#define DEFAULT_SINK_NAME "combined"
 | 
				
			||||||
#define MEMBLOCKQ_MAXLENGTH (1024*170)
 | 
					#define MEMBLOCKQ_MAXLENGTH (1024*170)
 | 
				
			||||||
| 
						 | 
					@ -56,6 +65,10 @@ static const char* const valid_modargs[] = {
 | 
				
			||||||
    "slaves",
 | 
					    "slaves",
 | 
				
			||||||
    "adjust_time",
 | 
					    "adjust_time",
 | 
				
			||||||
    "resample_method",
 | 
					    "resample_method",
 | 
				
			||||||
 | 
					    "format",
 | 
				
			||||||
 | 
					    "channels",
 | 
				
			||||||
 | 
					    "rate",
 | 
				
			||||||
 | 
					    "channel_map",
 | 
				
			||||||
    NULL
 | 
					    NULL
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -296,6 +309,9 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
    const char*split_state;
 | 
					    const char*split_state;
 | 
				
			||||||
    struct timeval tv;
 | 
					    struct timeval tv;
 | 
				
			||||||
    int resample_method = -1;
 | 
					    int resample_method = -1;
 | 
				
			||||||
 | 
					    pa_sample_spec ss;
 | 
				
			||||||
 | 
					    pa_channel_map map;
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    assert(c && m);
 | 
					    assert(c && m);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
 | 
					    if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
 | 
				
			||||||
| 
						 | 
					@ -310,7 +326,7 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    u = pa_xmalloc(sizeof(struct userdata));
 | 
					    u = pa_xnew(struct userdata, 1);
 | 
				
			||||||
    m->userdata = u;
 | 
					    m->userdata = u;
 | 
				
			||||||
    u->sink = NULL;
 | 
					    u->sink = NULL;
 | 
				
			||||||
    u->n_outputs = 0;
 | 
					    u->n_outputs = 0;
 | 
				
			||||||
| 
						 | 
					@ -336,7 +352,23 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
        goto fail;
 | 
					        goto fail;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &master_sink->sample_spec, &master_sink->channel_map))) {
 | 
					    ss = master_sink->sample_spec;
 | 
				
			||||||
 | 
					    if ((pa_modargs_get_sample_spec(ma, &ss) < 0)) {
 | 
				
			||||||
 | 
					        pa_log(__FILE__": invalid sample specification.");
 | 
				
			||||||
 | 
					        goto fail;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (ss.channels == master_sink->sample_spec.channels)
 | 
				
			||||||
 | 
					        map = master_sink->channel_map;
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        pa_channel_map_init_auto(&map, ss.channels);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if ((pa_modargs_get_channel_map(ma, &map) < 0)) {
 | 
				
			||||||
 | 
					        pa_log(__FILE__": invalid channel map.");
 | 
				
			||||||
 | 
					        goto fail;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, &map))) {
 | 
				
			||||||
        pa_log(__FILE__": failed to create sink");
 | 
					        pa_log(__FILE__": failed to create sink");
 | 
				
			||||||
        goto fail;
 | 
					        goto fail;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -56,7 +56,7 @@ PA_MODULE_USAGE(
 | 
				
			||||||
        "client_name=<jack client name> "
 | 
					        "client_name=<jack client name> "
 | 
				
			||||||
        "channels=<number of channels> "
 | 
					        "channels=<number of channels> "
 | 
				
			||||||
        "connect=<connect ports?> "
 | 
					        "connect=<connect ports?> "
 | 
				
			||||||
)
 | 
					        "channel_map=<channel map>")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DEFAULT_SINK_NAME "jack_out"
 | 
					#define DEFAULT_SINK_NAME "jack_out"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -91,6 +91,7 @@ static const char* const valid_modargs[] = {
 | 
				
			||||||
    "client_name",
 | 
					    "client_name",
 | 
				
			||||||
    "channels",
 | 
					    "channels",
 | 
				
			||||||
    "connect",
 | 
					    "connect",
 | 
				
			||||||
 | 
					    "channel_map",
 | 
				
			||||||
    NULL
 | 
					    NULL
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -233,7 +234,7 @@ static void jack_error_func(const char*t) {
 | 
				
			||||||
int pa__init(pa_core *c, pa_module*m) {
 | 
					int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
    struct userdata *u = NULL;
 | 
					    struct userdata *u = NULL;
 | 
				
			||||||
    pa_sample_spec ss;
 | 
					    pa_sample_spec ss;
 | 
				
			||||||
    pa_channel_map cm;
 | 
					    pa_channel_map map;
 | 
				
			||||||
    pa_modargs *ma = NULL;
 | 
					    pa_modargs *ma = NULL;
 | 
				
			||||||
    jack_status_t status;
 | 
					    jack_status_t status;
 | 
				
			||||||
    const char *server_name, *client_name;
 | 
					    const char *server_name, *client_name;
 | 
				
			||||||
| 
						 | 
					@ -295,6 +296,12 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
        goto fail;
 | 
					        goto fail;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    pa_channel_map_init_auto(&map, channels);
 | 
				
			||||||
 | 
					    if (pa_modargs_get_channel_map(ma, &map) < 0 || map.channels != channels) {
 | 
				
			||||||
 | 
					        pa_log(__FILE__": failed to parse channel_map= argument.");
 | 
				
			||||||
 | 
					        goto fail;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    pa_log_info(__FILE__": Successfully connected as '%s'", jack_get_client_name(u->client));
 | 
					    pa_log_info(__FILE__": Successfully connected as '%s'", jack_get_client_name(u->client));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ss.channels = u->channels = channels;
 | 
					    ss.channels = u->channels = channels;
 | 
				
			||||||
| 
						 | 
					@ -303,16 +310,14 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert(pa_sample_spec_valid(&ss));
 | 
					    assert(pa_sample_spec_valid(&ss));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_channel_map_init_auto(&cm, channels);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    for (i = 0; i < ss.channels; i++) {
 | 
					    for (i = 0; i < ss.channels; i++) {
 | 
				
			||||||
        if (!(u->port[i] = jack_port_register(u->client, pa_channel_position_to_string(cm.map[i]), JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput|JackPortIsTerminal, 0))) {
 | 
					        if (!(u->port[i] = jack_port_register(u->client, pa_channel_position_to_string(map.map[i]), JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput|JackPortIsTerminal, 0))) {
 | 
				
			||||||
            pa_log(__FILE__": jack_port_register() failed.");
 | 
					            pa_log(__FILE__": jack_port_register() failed.");
 | 
				
			||||||
            goto fail;
 | 
					            goto fail;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, &cm))) {
 | 
					    if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, &map))) {
 | 
				
			||||||
        pa_log(__FILE__": failed to create sink.");
 | 
					        pa_log(__FILE__": failed to create sink.");
 | 
				
			||||||
        goto fail;
 | 
					        goto fail;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -56,7 +56,7 @@ PA_MODULE_USAGE(
 | 
				
			||||||
        "client_name=<jack client name> "
 | 
					        "client_name=<jack client name> "
 | 
				
			||||||
        "channels=<number of channels> "
 | 
					        "channels=<number of channels> "
 | 
				
			||||||
        "connect=<connect ports?>"
 | 
					        "connect=<connect ports?>"
 | 
				
			||||||
)
 | 
					        "channel_map=<channel map>")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DEFAULT_SOURCE_NAME "jack_in"
 | 
					#define DEFAULT_SOURCE_NAME "jack_in"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -91,6 +91,7 @@ static const char* const valid_modargs[] = {
 | 
				
			||||||
    "client_name",
 | 
					    "client_name",
 | 
				
			||||||
    "channels",
 | 
					    "channels",
 | 
				
			||||||
    "connect",
 | 
					    "connect",
 | 
				
			||||||
 | 
					    "channel_map",
 | 
				
			||||||
    NULL
 | 
					    NULL
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -231,7 +232,7 @@ static void jack_error_func(const char*t) {
 | 
				
			||||||
int pa__init(pa_core *c, pa_module*m) {
 | 
					int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
    struct userdata *u = NULL;
 | 
					    struct userdata *u = NULL;
 | 
				
			||||||
    pa_sample_spec ss;
 | 
					    pa_sample_spec ss;
 | 
				
			||||||
    pa_channel_map cm;
 | 
					    pa_channel_map map;
 | 
				
			||||||
    pa_modargs *ma = NULL;
 | 
					    pa_modargs *ma = NULL;
 | 
				
			||||||
    jack_status_t status;
 | 
					    jack_status_t status;
 | 
				
			||||||
    const char *server_name, *client_name;
 | 
					    const char *server_name, *client_name;
 | 
				
			||||||
| 
						 | 
					@ -293,6 +294,12 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
        goto fail;
 | 
					        goto fail;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    pa_channel_map_init_auto(&map, channels);
 | 
				
			||||||
 | 
					    if (pa_modargs_get_channel_map(ma, &map) < 0 || map.channels != channels) {
 | 
				
			||||||
 | 
					        pa_log(__FILE__": failed to parse channel_map= argument.");
 | 
				
			||||||
 | 
					        goto fail;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    pa_log_info(__FILE__": Successfully connected as '%s'", jack_get_client_name(u->client));
 | 
					    pa_log_info(__FILE__": Successfully connected as '%s'", jack_get_client_name(u->client));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ss.channels = u->channels = channels;
 | 
					    ss.channels = u->channels = channels;
 | 
				
			||||||
| 
						 | 
					@ -301,16 +308,14 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert(pa_sample_spec_valid(&ss));
 | 
					    assert(pa_sample_spec_valid(&ss));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_channel_map_init_auto(&cm, channels);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    for (i = 0; i < ss.channels; i++) {
 | 
					    for (i = 0; i < ss.channels; i++) {
 | 
				
			||||||
        if (!(u->port[i] = jack_port_register(u->client, pa_channel_position_to_string(cm.map[i]), JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput|JackPortIsTerminal, 0))) {
 | 
					        if (!(u->port[i] = jack_port_register(u->client, pa_channel_position_to_string(map.map[i]), JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput|JackPortIsTerminal, 0))) {
 | 
				
			||||||
            pa_log(__FILE__": jack_port_register() failed.");
 | 
					            pa_log(__FILE__": jack_port_register() failed.");
 | 
				
			||||||
            goto fail;
 | 
					            goto fail;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!(u->source = pa_source_new(c, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss, &cm))) {
 | 
					    if (!(u->source = pa_source_new(c, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss, &map))) {
 | 
				
			||||||
        pa_log(__FILE__": failed to create source.");
 | 
					        pa_log(__FILE__": failed to create source.");
 | 
				
			||||||
        goto fail;
 | 
					        goto fail;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -46,7 +46,12 @@
 | 
				
			||||||
PA_MODULE_AUTHOR("Lennart Poettering")
 | 
					PA_MODULE_AUTHOR("Lennart Poettering")
 | 
				
			||||||
PA_MODULE_DESCRIPTION("Clocked NULL sink")
 | 
					PA_MODULE_DESCRIPTION("Clocked NULL sink")
 | 
				
			||||||
PA_MODULE_VERSION(PACKAGE_VERSION)
 | 
					PA_MODULE_VERSION(PACKAGE_VERSION)
 | 
				
			||||||
PA_MODULE_USAGE("format=<sample format> channels=<number of channels> rate=<sample rate> sink_name=<name of sink>")
 | 
					PA_MODULE_USAGE(
 | 
				
			||||||
 | 
					        "format=<sample format> "
 | 
				
			||||||
 | 
					        "channels=<number of channels> "
 | 
				
			||||||
 | 
					        "rate=<sample rate> "
 | 
				
			||||||
 | 
					        "sink_name=<name of sink>"
 | 
				
			||||||
 | 
					        "channel_map=<channel map>")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DEFAULT_SINK_NAME "null"
 | 
					#define DEFAULT_SINK_NAME "null"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -63,6 +68,7 @@ static const char* const valid_modargs[] = {
 | 
				
			||||||
    "format",
 | 
					    "format",
 | 
				
			||||||
    "channels",
 | 
					    "channels",
 | 
				
			||||||
    "sink_name",
 | 
					    "sink_name",
 | 
				
			||||||
 | 
					    "channel_map", 
 | 
				
			||||||
    NULL
 | 
					    NULL
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -87,6 +93,7 @@ static void time_callback(pa_mainloop_api *m, pa_time_event*e, const struct time
 | 
				
			||||||
int pa__init(pa_core *c, pa_module*m) {
 | 
					int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
    struct userdata *u = NULL;
 | 
					    struct userdata *u = NULL;
 | 
				
			||||||
    pa_sample_spec ss;
 | 
					    pa_sample_spec ss;
 | 
				
			||||||
 | 
					    pa_channel_map map;
 | 
				
			||||||
    pa_modargs *ma = NULL;
 | 
					    pa_modargs *ma = NULL;
 | 
				
			||||||
    struct timeval tv;
 | 
					    struct timeval tv;
 | 
				
			||||||
    assert(c && m);
 | 
					    assert(c && m);
 | 
				
			||||||
| 
						 | 
					@ -97,8 +104,8 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ss = c->default_sample_spec;
 | 
					    ss = c->default_sample_spec;
 | 
				
			||||||
    if (pa_modargs_get_sample_spec(ma, &ss) < 0) {
 | 
					    if (pa_modargs_get_sample_spec_and_channel_map(ma, &ss, &map) < 0) {
 | 
				
			||||||
        pa_log(__FILE__": invalid sample format specification.");
 | 
					        pa_log(__FILE__": invalid sample format specification or channel map.");
 | 
				
			||||||
        goto fail;
 | 
					        goto fail;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
| 
						 | 
					@ -107,7 +114,7 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
    u->module = m;
 | 
					    u->module = m;
 | 
				
			||||||
    m->userdata = u;
 | 
					    m->userdata = u;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, NULL))) {
 | 
					    if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, &map))) {
 | 
				
			||||||
        pa_log(__FILE__": failed to create sink.");
 | 
					        pa_log(__FILE__": failed to create sink.");
 | 
				
			||||||
        goto fail;
 | 
					        goto fail;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -62,7 +62,8 @@ PA_MODULE_USAGE(
 | 
				
			||||||
        "channels=<number of channels> "
 | 
					        "channels=<number of channels> "
 | 
				
			||||||
        "rate=<sample rate> "
 | 
					        "rate=<sample rate> "
 | 
				
			||||||
        "fragments=<number of fragments> "
 | 
					        "fragments=<number of fragments> "
 | 
				
			||||||
        "fragment_size=<fragment size>")
 | 
					        "fragment_size=<fragment size> "
 | 
				
			||||||
 | 
					        "channel_map=<channel map>")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct userdata {
 | 
					struct userdata {
 | 
				
			||||||
    pa_sink *sink;
 | 
					    pa_sink *sink;
 | 
				
			||||||
| 
						 | 
					@ -97,6 +98,7 @@ static const char* const valid_modargs[] = {
 | 
				
			||||||
    "format",
 | 
					    "format",
 | 
				
			||||||
    "rate",
 | 
					    "rate",
 | 
				
			||||||
    "channels",
 | 
					    "channels",
 | 
				
			||||||
 | 
					    "channel_map",
 | 
				
			||||||
    NULL
 | 
					    NULL
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -346,6 +348,7 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
    int playback = 1, record = 1;
 | 
					    int playback = 1, record = 1;
 | 
				
			||||||
    pa_modargs *ma = NULL;
 | 
					    pa_modargs *ma = NULL;
 | 
				
			||||||
    char hwdesc[64];
 | 
					    char hwdesc[64];
 | 
				
			||||||
 | 
					    pa_channel_map map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert(c);
 | 
					    assert(c);
 | 
				
			||||||
    assert(m);
 | 
					    assert(m);
 | 
				
			||||||
| 
						 | 
					@ -380,8 +383,8 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    u->sample_spec = c->default_sample_spec;
 | 
					    u->sample_spec = c->default_sample_spec;
 | 
				
			||||||
    if (pa_modargs_get_sample_spec(ma, &u->sample_spec) < 0) {
 | 
					    if (pa_modargs_get_sample_spec_and_channel_map(ma, &u->sample_spec, &map) < 0) {
 | 
				
			||||||
        pa_log(__FILE__": failed to parse sample specification");
 | 
					        pa_log(__FILE__": failed to parse sample specification or channel map");
 | 
				
			||||||
        goto fail;
 | 
					        goto fail;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -426,7 +429,7 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
            if (!(u->source = pa_source_new(c, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &u->sample_spec, NULL)))
 | 
					            if (!(u->source = pa_source_new(c, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &u->sample_spec, &map)))
 | 
				
			||||||
                goto fail;
 | 
					                goto fail;
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            u->source->userdata = u;
 | 
					            u->source->userdata = u;
 | 
				
			||||||
| 
						 | 
					@ -466,7 +469,7 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            pa_silence_memory(u->out_mmap, u->out_mmap_length, &u->sample_spec);
 | 
					            pa_silence_memory(u->out_mmap, u->out_mmap_length, &u->sample_spec);
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &u->sample_spec, NULL)))
 | 
					            if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &u->sample_spec, &map)))
 | 
				
			||||||
                goto fail;
 | 
					                goto fail;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            u->sink->get_latency = sink_get_latency_cb;
 | 
					            u->sink->get_latency = sink_get_latency_cb;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -61,7 +61,8 @@ PA_MODULE_USAGE(
 | 
				
			||||||
        "channels=<number of channels> "
 | 
					        "channels=<number of channels> "
 | 
				
			||||||
        "rate=<sample rate> "
 | 
					        "rate=<sample rate> "
 | 
				
			||||||
        "fragments=<number of fragments> "
 | 
					        "fragments=<number of fragments> "
 | 
				
			||||||
        "fragment_size=<fragment size>")
 | 
					        "fragment_size=<fragment size> "
 | 
				
			||||||
 | 
					        "channel_map=<channel map>")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct userdata {
 | 
					struct userdata {
 | 
				
			||||||
    pa_sink *sink;
 | 
					    pa_sink *sink;
 | 
				
			||||||
| 
						 | 
					@ -89,6 +90,7 @@ static const char* const valid_modargs[] = {
 | 
				
			||||||
    "format",
 | 
					    "format",
 | 
				
			||||||
    "rate",
 | 
					    "rate",
 | 
				
			||||||
    "channels",
 | 
					    "channels",
 | 
				
			||||||
 | 
					    "channel_map",
 | 
				
			||||||
    NULL
 | 
					    NULL
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -322,6 +324,7 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
    int mode;
 | 
					    int mode;
 | 
				
			||||||
    int record = 1, playback = 1;
 | 
					    int record = 1, playback = 1;
 | 
				
			||||||
    pa_sample_spec ss;
 | 
					    pa_sample_spec ss;
 | 
				
			||||||
 | 
					    pa_channel_map map;
 | 
				
			||||||
    pa_modargs *ma = NULL;
 | 
					    pa_modargs *ma = NULL;
 | 
				
			||||||
    char hwdesc[64];
 | 
					    char hwdesc[64];
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
| 
						 | 
					@ -353,8 +356,8 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ss = c->default_sample_spec;
 | 
					    ss = c->default_sample_spec;
 | 
				
			||||||
    if (pa_modargs_get_sample_spec(ma, &ss) < 0) {
 | 
					    if (pa_modargs_get_sample_spec_and_channel_map(ma, &ss, &map) < 0) {
 | 
				
			||||||
        pa_log(__FILE__": failed to parse sample specification");
 | 
					        pa_log(__FILE__": failed to parse sample specification or channel map");
 | 
				
			||||||
        goto fail;
 | 
					        goto fail;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
| 
						 | 
					@ -399,7 +402,7 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (mode != O_WRONLY) {
 | 
					    if (mode != O_WRONLY) {
 | 
				
			||||||
        if (!(u->source = pa_source_new(c, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss, NULL)))
 | 
					        if (!(u->source = pa_source_new(c, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss, &map)))
 | 
				
			||||||
            goto fail;
 | 
					            goto fail;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        u->source->userdata = u;
 | 
					        u->source->userdata = u;
 | 
				
			||||||
| 
						 | 
					@ -417,7 +420,7 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
        u->source = NULL;
 | 
					        u->source = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (mode != O_RDONLY) {
 | 
					    if (mode != O_RDONLY) {
 | 
				
			||||||
        if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, NULL)))
 | 
					        if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, &map)))
 | 
				
			||||||
            goto fail;
 | 
					            goto fail;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        u->sink->get_latency = sink_get_latency_cb;
 | 
					        u->sink->get_latency = sink_get_latency_cb;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -46,7 +46,13 @@
 | 
				
			||||||
PA_MODULE_AUTHOR("Lennart Poettering")
 | 
					PA_MODULE_AUTHOR("Lennart Poettering")
 | 
				
			||||||
PA_MODULE_DESCRIPTION("UNIX pipe sink")
 | 
					PA_MODULE_DESCRIPTION("UNIX pipe sink")
 | 
				
			||||||
PA_MODULE_VERSION(PACKAGE_VERSION)
 | 
					PA_MODULE_VERSION(PACKAGE_VERSION)
 | 
				
			||||||
PA_MODULE_USAGE("sink_name=<name for the sink> file=<path of the FIFO> format=<sample format> channels=<number of channels> rate=<sample rate>")
 | 
					PA_MODULE_USAGE(
 | 
				
			||||||
 | 
					        "sink_name=<name for the sink> "
 | 
				
			||||||
 | 
					        "file=<path of the FIFO> "
 | 
				
			||||||
 | 
					        "format=<sample format> "
 | 
				
			||||||
 | 
					        "channels=<number of channels> "
 | 
				
			||||||
 | 
					        "rate=<sample rate>"
 | 
				
			||||||
 | 
					        "channel_map=<channel map>")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DEFAULT_FIFO_NAME "/tmp/music.output"
 | 
					#define DEFAULT_FIFO_NAME "/tmp/music.output"
 | 
				
			||||||
#define DEFAULT_SINK_NAME "fifo_output"
 | 
					#define DEFAULT_SINK_NAME "fifo_output"
 | 
				
			||||||
| 
						 | 
					@ -70,6 +76,7 @@ static const char* const valid_modargs[] = {
 | 
				
			||||||
    "format",
 | 
					    "format",
 | 
				
			||||||
    "channels",
 | 
					    "channels",
 | 
				
			||||||
    "sink_name",
 | 
					    "sink_name",
 | 
				
			||||||
 | 
					    "channel_map",
 | 
				
			||||||
    NULL
 | 
					    NULL
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -137,6 +144,7 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
    const char *p;
 | 
					    const char *p;
 | 
				
			||||||
    int fd = -1;
 | 
					    int fd = -1;
 | 
				
			||||||
    pa_sample_spec ss;
 | 
					    pa_sample_spec ss;
 | 
				
			||||||
 | 
					    pa_channel_map map;
 | 
				
			||||||
    pa_modargs *ma = NULL;
 | 
					    pa_modargs *ma = NULL;
 | 
				
			||||||
    assert(c && m);
 | 
					    assert(c && m);
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
| 
						 | 
					@ -146,7 +154,7 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ss = c->default_sample_spec;
 | 
					    ss = c->default_sample_spec;
 | 
				
			||||||
    if (pa_modargs_get_sample_spec(ma, &ss) < 0) {
 | 
					    if (pa_modargs_get_sample_spec_and_channel_map(ma, &ss, &map) < 0) {
 | 
				
			||||||
        pa_log(__FILE__": invalid sample format specification");
 | 
					        pa_log(__FILE__": invalid sample format specification");
 | 
				
			||||||
        goto fail;
 | 
					        goto fail;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -176,7 +184,7 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
    u->module = m;
 | 
					    u->module = m;
 | 
				
			||||||
    m->userdata = u;
 | 
					    m->userdata = u;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, NULL))) {
 | 
					    if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, &map))) {
 | 
				
			||||||
        pa_log(__FILE__": failed to create sink.");
 | 
					        pa_log(__FILE__": failed to create sink.");
 | 
				
			||||||
        goto fail;
 | 
					        goto fail;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -46,7 +46,13 @@
 | 
				
			||||||
PA_MODULE_AUTHOR("Lennart Poettering")
 | 
					PA_MODULE_AUTHOR("Lennart Poettering")
 | 
				
			||||||
PA_MODULE_DESCRIPTION("UNIX pipe source")
 | 
					PA_MODULE_DESCRIPTION("UNIX pipe source")
 | 
				
			||||||
PA_MODULE_VERSION(PACKAGE_VERSION)
 | 
					PA_MODULE_VERSION(PACKAGE_VERSION)
 | 
				
			||||||
PA_MODULE_USAGE("source_name=<name for the source> file=<path of the FIFO> format=<sample format> channels=<number of channels> rate=<sample rate>")
 | 
					PA_MODULE_USAGE(
 | 
				
			||||||
 | 
					        "source_name=<name for the source> "
 | 
				
			||||||
 | 
					        "file=<path of the FIFO> "
 | 
				
			||||||
 | 
					        "format=<sample format> "
 | 
				
			||||||
 | 
					        "channels=<number of channels> "
 | 
				
			||||||
 | 
					        "rate=<sample rate> "
 | 
				
			||||||
 | 
					        "channel_map=<channel map>")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DEFAULT_FIFO_NAME "/tmp/music.input"
 | 
					#define DEFAULT_FIFO_NAME "/tmp/music.input"
 | 
				
			||||||
#define DEFAULT_SOURCE_NAME "fifo_input"
 | 
					#define DEFAULT_SOURCE_NAME "fifo_input"
 | 
				
			||||||
| 
						 | 
					@ -68,6 +74,7 @@ static const char* const valid_modargs[] = {
 | 
				
			||||||
    "channels",
 | 
					    "channels",
 | 
				
			||||||
    "format",
 | 
					    "format",
 | 
				
			||||||
    "source_name",
 | 
					    "source_name",
 | 
				
			||||||
 | 
					    "channel_map",
 | 
				
			||||||
    NULL
 | 
					    NULL
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -115,6 +122,7 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
    const char *p;
 | 
					    const char *p;
 | 
				
			||||||
    int fd = -1;
 | 
					    int fd = -1;
 | 
				
			||||||
    pa_sample_spec ss;
 | 
					    pa_sample_spec ss;
 | 
				
			||||||
 | 
					    pa_channel_map map;
 | 
				
			||||||
    pa_modargs *ma = NULL;
 | 
					    pa_modargs *ma = NULL;
 | 
				
			||||||
    assert(c && m);
 | 
					    assert(c && m);
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
| 
						 | 
					@ -124,8 +132,8 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ss = c->default_sample_spec;
 | 
					    ss = c->default_sample_spec;
 | 
				
			||||||
    if (pa_modargs_get_sample_spec(ma, &ss) < 0) {
 | 
					    if (pa_modargs_get_sample_spec_and_channel_map(ma, &ss, &map) < 0) {
 | 
				
			||||||
        pa_log(__FILE__": invalid sample format specification");
 | 
					        pa_log(__FILE__": invalid sample format specification or channel map");
 | 
				
			||||||
        goto fail;
 | 
					        goto fail;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
| 
						 | 
					@ -153,7 +161,7 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
    u->filename = pa_xstrdup(p);
 | 
					    u->filename = pa_xstrdup(p);
 | 
				
			||||||
    u->core = c;
 | 
					    u->core = c;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    if (!(u->source = pa_source_new(c, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss, NULL))) {
 | 
					    if (!(u->source = pa_source_new(c, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss, &map))) {
 | 
				
			||||||
        pa_log(__FILE__": failed to create source.");
 | 
					        pa_log(__FILE__": failed to create source.");
 | 
				
			||||||
        goto fail;
 | 
					        goto fail;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -51,11 +51,27 @@
 | 
				
			||||||
#ifdef TUNNEL_SINK
 | 
					#ifdef TUNNEL_SINK
 | 
				
			||||||
#include "module-tunnel-sink-symdef.h"
 | 
					#include "module-tunnel-sink-symdef.h"
 | 
				
			||||||
PA_MODULE_DESCRIPTION("Tunnel module for sinks")
 | 
					PA_MODULE_DESCRIPTION("Tunnel module for sinks")
 | 
				
			||||||
PA_MODULE_USAGE("server=<address> sink=<remote sink name> cookie=<filename> format=<sample format> channels=<number of channels> rate=<sample rate> sink_name=<name for the local sink>")
 | 
					PA_MODULE_USAGE(
 | 
				
			||||||
 | 
					        "server=<address> "
 | 
				
			||||||
 | 
					        "sink=<remote sink name> "
 | 
				
			||||||
 | 
					        "cookie=<filename> "
 | 
				
			||||||
 | 
					        "format=<sample format> "
 | 
				
			||||||
 | 
					        "channels=<number of channels> "
 | 
				
			||||||
 | 
					        "rate=<sample rate> "
 | 
				
			||||||
 | 
					        "sink_name=<name for the local sink> "
 | 
				
			||||||
 | 
					        "channel_map=<channel map>")
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#include "module-tunnel-source-symdef.h"
 | 
					#include "module-tunnel-source-symdef.h"
 | 
				
			||||||
PA_MODULE_DESCRIPTION("Tunnel module for sources")
 | 
					PA_MODULE_DESCRIPTION("Tunnel module for sources")
 | 
				
			||||||
PA_MODULE_USAGE("server=<address> source=<remote source name> cookie=<filename> format=<sample format> channels=<number of channels> rate=<sample rate> source_name=<name for the local source>")
 | 
					PA_MODULE_USAGE(
 | 
				
			||||||
 | 
					        "server=<address> "
 | 
				
			||||||
 | 
					        "source=<remote source name> "
 | 
				
			||||||
 | 
					        "cookie=<filename> "
 | 
				
			||||||
 | 
					        "format=<sample format> "
 | 
				
			||||||
 | 
					        "channels=<number of channels> "
 | 
				
			||||||
 | 
					        "rate=<sample rate> "
 | 
				
			||||||
 | 
					        "source_name=<name for the local source> "
 | 
				
			||||||
 | 
					        "channel_map=<channel map>")
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
PA_MODULE_AUTHOR("Lennart Poettering")
 | 
					PA_MODULE_AUTHOR("Lennart Poettering")
 | 
				
			||||||
| 
						 | 
					@ -87,6 +103,7 @@ static const char* const valid_modargs[] = {
 | 
				
			||||||
    "source_name",
 | 
					    "source_name",
 | 
				
			||||||
    "source",
 | 
					    "source",
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					    "channel_map",
 | 
				
			||||||
    NULL,
 | 
					    NULL,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -838,6 +855,7 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
    pa_modargs *ma = NULL;
 | 
					    pa_modargs *ma = NULL;
 | 
				
			||||||
    struct userdata *u = NULL;
 | 
					    struct userdata *u = NULL;
 | 
				
			||||||
    pa_sample_spec ss;
 | 
					    pa_sample_spec ss;
 | 
				
			||||||
 | 
					    pa_channel_map map;
 | 
				
			||||||
    struct timeval ntv;
 | 
					    struct timeval ntv;
 | 
				
			||||||
    assert(c && m);
 | 
					    assert(c && m);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -877,7 +895,7 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ss = c->default_sample_spec;
 | 
					    ss = c->default_sample_spec;
 | 
				
			||||||
    if (pa_modargs_get_sample_spec(ma, &ss) < 0) {
 | 
					    if (pa_modargs_get_sample_spec_and_channel_map(ma, &ss, &map) < 0) {
 | 
				
			||||||
        pa_log(__FILE__": invalid sample format specification");
 | 
					        pa_log(__FILE__": invalid sample format specification");
 | 
				
			||||||
        goto fail;
 | 
					        goto fail;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -893,7 +911,7 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
    pa_socket_client_set_callback(u->client, on_connection, u);
 | 
					    pa_socket_client_set_callback(u->client, on_connection, u);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef TUNNEL_SINK
 | 
					#ifdef TUNNEL_SINK
 | 
				
			||||||
    if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, NULL))) {
 | 
					    if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, &map))) {
 | 
				
			||||||
        pa_log(__FILE__": failed to create sink.");
 | 
					        pa_log(__FILE__": failed to create sink.");
 | 
				
			||||||
        goto fail;
 | 
					        goto fail;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -909,7 +927,7 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_sink_set_owner(u->sink, m);
 | 
					    pa_sink_set_owner(u->sink, m);
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
    if (!(u->source = pa_source_new(c, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss, NULL))) {
 | 
					    if (!(u->source = pa_source_new(c, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss, &map))) {
 | 
				
			||||||
        pa_log(__FILE__": failed to create source.");
 | 
					        pa_log(__FILE__": failed to create source.");
 | 
				
			||||||
        goto fail;
 | 
					        goto fail;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue