mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
module-roc: fix properties
Actually set the right properties on the source and sink. Not quite right because the pulseaudio ROC has a sink-input or a playback stream in pipewire. See #1538
This commit is contained in:
parent
9f57341699
commit
d34c4facc0
3 changed files with 50 additions and 20 deletions
|
|
@ -157,8 +157,8 @@ struct module *create_module_roc_source(struct impl *impl, const char *argument)
|
|||
}
|
||||
|
||||
if ((str = pw_properties_get(props, PW_KEY_MEDIA_CLASS)) == NULL) {
|
||||
pw_properties_set(props, PW_KEY_MEDIA_CLASS, "Audio/Sink");
|
||||
pw_properties_set(source_props, PW_KEY_MEDIA_CLASS, "Audio/Sink");
|
||||
pw_properties_set(props, PW_KEY_MEDIA_CLASS, "Audio/Source");
|
||||
pw_properties_set(source_props, PW_KEY_MEDIA_CLASS, "Audio/Source");
|
||||
}
|
||||
|
||||
if ((str = pw_properties_get(props, "local_ip")) != NULL) {
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@
|
|||
* Options specific to the behavior of this module
|
||||
*
|
||||
* - `sink.props = {}`: properties to be passed to the sink stream
|
||||
* - `sink.name = <str>`: node.name of the sink
|
||||
* - `local.ip = <str>`: local sender ip
|
||||
* - `remote.ip = <str>`: remote receiver ip
|
||||
* - `remote.source.port = <str>`: remote receiver TCP/UDP port for source packets
|
||||
|
|
@ -61,6 +62,8 @@
|
|||
* Options with well-known behavior:
|
||||
*
|
||||
* - \ref PW_KEY_NODE_NAME
|
||||
* - \ref PW_KEY_NODE_DESCRIPTION
|
||||
* - \ref PW_KEY_MEDIA_NAME
|
||||
*
|
||||
* ## Example configuration
|
||||
*\code{.unparsed}
|
||||
|
|
@ -71,6 +74,7 @@
|
|||
* remote.ip = 192.168.0.244
|
||||
* remote.source.port = 10001
|
||||
* remote.repair.port = 10002
|
||||
* sink.name = "ROC Sink"
|
||||
* sink.props = {
|
||||
* node.name = "roc-sink"
|
||||
* }
|
||||
|
|
@ -306,6 +310,8 @@ static int roc_sink_setup(struct module_roc_sink_data *data)
|
|||
info.rate = 44100;
|
||||
info.channels = 2;
|
||||
info.format = SPA_AUDIO_FORMAT_F32_LE;
|
||||
info.position[0] = SPA_AUDIO_CHANNEL_FL;
|
||||
info.position[1] = SPA_AUDIO_CHANNEL_FR;
|
||||
|
||||
data->sender = roc_sender_open(data->context, &sender_config);
|
||||
if (!data->sender) {
|
||||
|
|
@ -348,7 +354,6 @@ static int roc_sink_setup(struct module_roc_sink_data *data)
|
|||
if ((res = pw_stream_connect(data->capture,
|
||||
PW_DIRECTION_INPUT,
|
||||
PW_ID_ANY,
|
||||
PW_STREAM_FLAG_AUTOCONNECT |
|
||||
PW_STREAM_FLAG_MAP_BUFFERS |
|
||||
PW_STREAM_FLAG_RT_PROCESS,
|
||||
params, n_params)) < 0)
|
||||
|
|
@ -364,7 +369,8 @@ static const struct spa_dict_item module_roc_sink_info[] = {
|
|||
"local.ip=<local sender ip> "
|
||||
"remote.ip=<remote receiver ip> "
|
||||
"remote.source.port=<remote receiver port for source packets> "
|
||||
"remote.repair.port=<remote receiver port for repair packets> " },
|
||||
"remote.repair.port=<remote receiver port for repair packets> "
|
||||
"sink.props= { key=val ... } " },
|
||||
{ PW_KEY_MODULE_VERSION, PACKAGE_VERSION },
|
||||
};
|
||||
|
||||
|
|
@ -415,12 +421,21 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
|
|||
pw_properties_set(props, "sink.name", NULL);
|
||||
}
|
||||
|
||||
if (pw_properties_get(props, PW_KEY_NODE_GROUP) == NULL)
|
||||
pw_properties_set(props, PW_KEY_NODE_GROUP, "pipewire.dummy");
|
||||
if (pw_properties_get(props, PW_KEY_NODE_VIRTUAL) == NULL)
|
||||
pw_properties_set(props, PW_KEY_NODE_VIRTUAL, "true");
|
||||
if ((str = pw_properties_get(props, PW_KEY_MEDIA_CLASS)) == NULL)
|
||||
pw_properties_set(props, PW_KEY_MEDIA_CLASS, "Audio/Sink");
|
||||
if ((str = pw_properties_get(props, "sink.props")) != NULL)
|
||||
pw_properties_update_string(capture_props, str, strlen(str));
|
||||
|
||||
if (pw_properties_get(capture_props, PW_KEY_NODE_NAME) == NULL)
|
||||
pw_properties_set(capture_props, PW_KEY_NODE_NAME, "roc-sink");
|
||||
if (pw_properties_get(capture_props, PW_KEY_NODE_DESCRIPTION) == NULL)
|
||||
pw_properties_set(capture_props, PW_KEY_NODE_DESCRIPTION, "ROC Sink");
|
||||
if (pw_properties_get(capture_props, PW_KEY_NODE_GROUP) == NULL)
|
||||
pw_properties_set(capture_props, PW_KEY_NODE_GROUP, "pipewire.dummy");
|
||||
if (pw_properties_get(capture_props, PW_KEY_NODE_VIRTUAL) == NULL)
|
||||
pw_properties_set(capture_props, PW_KEY_NODE_VIRTUAL, "true");
|
||||
if (pw_properties_get(capture_props, PW_KEY_NODE_PASSIVE) == NULL)
|
||||
pw_properties_set(capture_props, PW_KEY_NODE_PASSIVE, "true");
|
||||
if ((str = pw_properties_get(capture_props, PW_KEY_MEDIA_CLASS)) == NULL)
|
||||
pw_properties_set(capture_props, PW_KEY_MEDIA_CLASS, "Audio/Sink");
|
||||
|
||||
if ((str = pw_properties_get(props, "remote.ip")) != NULL) {
|
||||
remote_ip = strdup(str);
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@
|
|||
* Options specific to the behavior of this module
|
||||
*
|
||||
* - `source.props = {}`: properties to be passed to the source stream
|
||||
* - `source.name = <str>`: node.name of the source
|
||||
* - `local.ip = <str>`: local sender ip
|
||||
* - `local.source.port = <str>`: local receiver TCP/UDP port for source packets
|
||||
* - `local.repair.port = <str>`: local receiver TCP/UDP port for receiver packets
|
||||
|
|
@ -63,6 +64,8 @@
|
|||
* Options with well-known behavior:
|
||||
*
|
||||
* - \ref PW_KEY_NODE_NAME
|
||||
* - \ref PW_KEY_NODE_DESCRIPTION
|
||||
* - \ref PW_KEY_MEDIA_NAME
|
||||
*
|
||||
* ## Example configuration
|
||||
*\code{.unparsed}
|
||||
|
|
@ -74,6 +77,7 @@
|
|||
* sess.latency.msec = 5000
|
||||
* local.source.port = 10001
|
||||
* local.repair.port = 10002
|
||||
* source.name = "ROC Source"
|
||||
* source.props = {
|
||||
* node.name = "roc-source"
|
||||
* }
|
||||
|
|
@ -336,6 +340,8 @@ static int roc_source_setup(struct module_roc_source_data *data)
|
|||
info.rate = 44100;
|
||||
info.channels = 2;
|
||||
info.format = SPA_AUDIO_FORMAT_F32_LE;
|
||||
info.position[0] = SPA_AUDIO_CHANNEL_FL;
|
||||
info.position[1] = SPA_AUDIO_CHANNEL_FR;
|
||||
|
||||
if (roc_parse_resampler_profile(&receiver_config.resampler_profile,
|
||||
data->resampler_profile)) {
|
||||
|
|
@ -392,7 +398,6 @@ static int roc_source_setup(struct module_roc_source_data *data)
|
|||
if ((res = pw_stream_connect(data->playback,
|
||||
PW_DIRECTION_OUTPUT,
|
||||
PW_ID_ANY,
|
||||
PW_STREAM_FLAG_AUTOCONNECT |
|
||||
PW_STREAM_FLAG_MAP_BUFFERS |
|
||||
PW_STREAM_FLAG_RT_PROCESS,
|
||||
params, n_params)) < 0)
|
||||
|
|
@ -409,7 +414,8 @@ static const struct spa_dict_item module_roc_source_info[] = {
|
|||
"sess.latency.msec=<target network latency in milliseconds> "
|
||||
"local.ip=<local receiver ip> "
|
||||
"local.source.port=<local receiver port for source packets> "
|
||||
"local.repair.port=<local receiver port for repair packets> " },
|
||||
"local.repair.port=<local receiver port for repair packets> "
|
||||
"source.props= { key=value ... }" },
|
||||
{ PW_KEY_MODULE_VERSION, PACKAGE_VERSION },
|
||||
};
|
||||
|
||||
|
|
@ -460,12 +466,21 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
|
|||
pw_properties_set(props, "source.name", NULL);
|
||||
}
|
||||
|
||||
if (pw_properties_get(props, PW_KEY_NODE_GROUP) == NULL)
|
||||
pw_properties_set(props, PW_KEY_NODE_GROUP, "pipewire.dummy");
|
||||
if (pw_properties_get(props, PW_KEY_NODE_VIRTUAL) == NULL)
|
||||
pw_properties_set(props, PW_KEY_NODE_VIRTUAL, "true");
|
||||
if ((str = pw_properties_get(props, PW_KEY_MEDIA_CLASS)) == NULL)
|
||||
pw_properties_set(props, PW_KEY_MEDIA_CLASS, "Audio/Source");
|
||||
if ((str = pw_properties_get(props, "source.props")) != NULL)
|
||||
pw_properties_update_string(playback_props, str, strlen(str));
|
||||
|
||||
if (pw_properties_get(playback_props, PW_KEY_NODE_NAME) == NULL)
|
||||
pw_properties_set(playback_props, PW_KEY_NODE_NAME, "roc-source");
|
||||
if (pw_properties_get(playback_props, PW_KEY_NODE_DESCRIPTION) == NULL)
|
||||
pw_properties_set(playback_props, PW_KEY_NODE_DESCRIPTION, "ROC Source");
|
||||
if (pw_properties_get(playback_props, PW_KEY_NODE_GROUP) == NULL)
|
||||
pw_properties_set(playback_props, PW_KEY_NODE_GROUP, "pipewire.dummy");
|
||||
if (pw_properties_get(playback_props, PW_KEY_NODE_VIRTUAL) == NULL)
|
||||
pw_properties_set(playback_props, PW_KEY_NODE_VIRTUAL, "true");
|
||||
if (pw_properties_get(playback_props, PW_KEY_NODE_PASSIVE) == NULL)
|
||||
pw_properties_set(playback_props, PW_KEY_NODE_PASSIVE, "true");
|
||||
if ((str = pw_properties_get(playback_props, PW_KEY_MEDIA_CLASS)) == NULL)
|
||||
pw_properties_set(playback_props, PW_KEY_MEDIA_CLASS, "Audio/Source");
|
||||
|
||||
if ((str = pw_properties_get(props, "local.ip")) != NULL) {
|
||||
local_ip = strdup(str);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue