mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-16 07:00:00 -05:00
Attribute in config to enable control port. Disable by default
This commit is contained in:
parent
6a154a0be0
commit
4c65f04337
1 changed files with 37 additions and 24 deletions
|
|
@ -1182,6 +1182,7 @@ struct impl {
|
||||||
struct pw_properties *control_props;
|
struct pw_properties *control_props;
|
||||||
struct pw_stream *control;
|
struct pw_stream *control;
|
||||||
struct spa_hook control_listener;
|
struct spa_hook control_listener;
|
||||||
|
bool control_stream_active;
|
||||||
|
|
||||||
struct spa_audio_info_raw info;
|
struct spa_audio_info_raw info;
|
||||||
|
|
||||||
|
|
@ -1669,33 +1670,35 @@ static int setup_streams(struct impl *impl)
|
||||||
struct spa_pod_dynamic_builder b;
|
struct spa_pod_dynamic_builder b;
|
||||||
struct spa_filter_graph *graph = impl->graph;
|
struct spa_filter_graph *graph = impl->graph;
|
||||||
|
|
||||||
impl->control = pw_stream_new(impl->core,
|
if (impl->control_stream_active) {
|
||||||
"filter control", impl->control_props);
|
impl->control = pw_stream_new(impl->core,
|
||||||
impl->control_props = NULL;
|
"filter control", impl->control_props);
|
||||||
if (impl->control == NULL)
|
impl->control_props = NULL;
|
||||||
return -errno;
|
if (impl->control == NULL)
|
||||||
|
return -errno;
|
||||||
|
|
||||||
pw_stream_add_listener(impl->control,
|
pw_stream_add_listener(impl->control,
|
||||||
&impl->control_listener,
|
&impl->control_listener,
|
||||||
&control_stream_events, impl);
|
&control_stream_events, impl);
|
||||||
|
|
||||||
uint8_t buffer[256];
|
uint8_t buffer[256];
|
||||||
struct spa_pod_builder bt = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
|
struct spa_pod_builder bt = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
|
||||||
const struct spa_pod *param[1];
|
const struct spa_pod *param[1];
|
||||||
|
|
||||||
param[0] = spa_pod_builder_add_object(&bt,
|
param[0] = spa_pod_builder_add_object(&bt,
|
||||||
SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat,
|
SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat,
|
||||||
SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_application),
|
SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_application),
|
||||||
SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_control)
|
SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_control)
|
||||||
);
|
);
|
||||||
|
|
||||||
pw_stream_connect(impl->control,
|
pw_stream_connect(impl->control,
|
||||||
PW_DIRECTION_INPUT,
|
PW_DIRECTION_INPUT,
|
||||||
PW_ID_ANY,
|
PW_ID_ANY,
|
||||||
PW_STREAM_FLAG_AUTOCONNECT |
|
PW_STREAM_FLAG_AUTOCONNECT |
|
||||||
PW_STREAM_FLAG_MAP_BUFFERS |
|
PW_STREAM_FLAG_MAP_BUFFERS |
|
||||||
PW_STREAM_FLAG_RT_PROCESS,
|
PW_STREAM_FLAG_RT_PROCESS,
|
||||||
param, 1);
|
param, 1);
|
||||||
|
}
|
||||||
|
|
||||||
impl->capture = pw_stream_new(impl->core,
|
impl->capture = pw_stream_new(impl->core,
|
||||||
"filter capture", impl->capture_props);
|
"filter capture", impl->capture_props);
|
||||||
|
|
@ -2119,7 +2122,17 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
|
||||||
&impl->core_listener,
|
&impl->core_listener,
|
||||||
&core_events, impl);
|
&core_events, impl);
|
||||||
|
|
||||||
setup_streams(impl);
|
if (pw_properties_get(props, "controlStream.enabled") == NULL) {
|
||||||
|
impl->control_stream_active = false;
|
||||||
|
} else if (strcmp(pw_properties_get(props, "controlStream.enabled"), "true")
|
||||||
|
== 0) {
|
||||||
|
impl->control_stream_active = true;
|
||||||
|
} else if (strcmp(pw_properties_get(props, "controlStream.enabled"), "false")
|
||||||
|
== 0) {
|
||||||
|
impl->control_stream_active = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
setup_streams(impl);
|
||||||
|
|
||||||
pw_impl_module_add_listener(module, &impl->module_listener, &module_events, impl);
|
pw_impl_module_add_listener(module, &impl->module_listener, &module_events, impl);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue