capture: Add the passthrough format negotiation to capture streams.

This helps to keep the API more symmetrical and also potentially
allows support for passthrough monitor sources at some point in the future.
This commit is contained in:
Colin Guthrie 2011-05-17 21:56:10 +01:00
parent 30597b7c27
commit 5d35375aa7
18 changed files with 406 additions and 104 deletions

View file

@ -1599,7 +1599,7 @@ int pa__init(pa_module*m) {
pa_source_output_new_data_init(&source_output_data);
source_output_data.driver = __FILE__;
source_output_data.module = m;
source_output_data.source = source_master;
pa_source_output_new_data_set_source(&source_output_data, source_master, FALSE);
source_output_data.destination_source = u->source;
/* FIXME
source_output_data.flags = PA_SOURCE_OUTPUT_DONT_INHIBIT_AUTO_SUSPEND; */

View file

@ -871,10 +871,9 @@ static pa_hook_result_t source_output_new_hook_callback(pa_core *c, pa_source_ou
if (PA_INVALID_INDEX != device_index) {
pa_source *source;
if ((source = pa_idxset_get_by_index(u->core->sources, device_index))) {
new_data->source = source;
new_data->save_source = FALSE;
}
if ((source = pa_idxset_get_by_index(u->core->sources, device_index)))
if (!pa_source_output_new_data_set_source(new_data, source, FALSE))
pa_log_debug("Not restoring device for stream because no supported format was found");
}
}
}

View file

@ -162,8 +162,7 @@ static pa_hook_result_t source_output_new_hook_callback(pa_core *c, pa_source_ou
/* Prefer the default source over any other source, just in case... */
if ((def = pa_namereg_get_default_source(c)))
if (role_match(def->proplist, role)) {
new_data->source = def;
new_data->save_source = FALSE;
pa_source_output_new_data_set_source(new_data, def, FALSE);
return PA_HOOK_OK;
}
@ -179,8 +178,7 @@ static pa_hook_result_t source_output_new_hook_callback(pa_core *c, pa_source_ou
/* @todo: favour the highest priority device, not the first one we find? */
if (role_match(s->proplist, role)) {
new_data->source = s;
new_data->save_source = FALSE;
pa_source_output_new_data_set_source(new_data, s, FALSE);
return PA_HOOK_OK;
}
}

View file

@ -755,7 +755,7 @@ int pa__init(pa_module *m) {
pa_source_output_new_data_init(&source_output_data);
source_output_data.driver = __FILE__;
source_output_data.module = m;
source_output_data.source = source;
pa_source_output_new_data_set_source(&source_output_data, source, FALSE);
if ((n = pa_modargs_get_value(ma, "source_output_name", NULL)))
pa_proplist_sets(source_output_data.proplist, PA_PROP_MEDIA_NAME, n);

View file

@ -1217,7 +1217,7 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
if (source_output->save_source) {
pa_strlcpy(entry.device, source_output->source->name, sizeof(entry.device));
entry.device_valid = source_output->save_source;
entry.device_valid = TRUE;
device_updated = !created_new_entry && (!old->device_valid || !pa_streq(entry.device, old->device));
@ -1399,8 +1399,7 @@ static pa_hook_result_t source_output_new_hook_callback(pa_core *c, pa_source_ou
interfere with that */
if (s && PA_SOURCE_IS_LINKED(pa_source_get_state(s))) {
pa_log_info("Restoring device for stream %s.", name);
new_data->source = s;
new_data->save_source = TRUE;
pa_source_output_new_data_set_source(new_data, s, TRUE);
}
pa_xfree(e);

View file

@ -630,7 +630,7 @@ int pa__init(pa_module*m) {
pa_source_output_new_data_init(&source_output_data);
source_output_data.driver = __FILE__;
source_output_data.module = m;
source_output_data.source = master;
pa_source_output_new_data_set_source(&source_output_data, master, FALSE);
source_output_data.destination_source = u->source;
/* FIXME
source_output_data.flags = PA_SOURCE_OUTPUT_DONT_INHIBIT_AUTO_SUSPEND; */

View file

@ -325,7 +325,7 @@ int pa__init(pa_module*m) {
pa_proplist_setf(data.proplist, "rtp.ttl", "%lu", (unsigned long) ttl);
data.driver = __FILE__;
data.module = m;
data.source = s;
pa_source_output_new_data_set_source(&data, s, FALSE);
pa_source_output_new_data_set_sample_spec(&data, &ss);
pa_source_output_new_data_set_channel_map(&data, &cm);
data.flags = PA_SOURCE_OUTPUT_DONT_INHIBIT_AUTO_SUSPEND;