Apply .editorconfig

This commit is contained in:
Frank Krick 2025-08-16 21:30:43 -04:00
parent 255bf4cdb4
commit 5783cf865f

View file

@ -1110,20 +1110,25 @@ static const struct spa_dict_item module_props[] = {
{PW_KEY_MODULE_DESCRIPTION, "Create filter chain streams"},
{
PW_KEY_MODULE_USAGE,
" ( remote.name=<remote> ) " "( node.latency=<latency as fraction> ) "
" ( remote.name=<remote> ) "
"( node.latency=<latency as fraction> ) "
"( node.description=<description of the nodes> ) "
"( audio.rate=<sample rate> ) " "( audio.channels=<number of channels> ) "
"( audio.position=<channel map> ) " "filter.graph = [ " " nodes = [ "
" { " " type = <ladspa | lv2 | builtin | sofa> "
"( audio.rate=<sample rate> ) "
"( audio.channels=<number of channels> ) "
"( audio.position=<channel map> ) " "filter.graph = [ "
" nodes = [ " " { "
" type = <ladspa | lv2 | builtin | sofa> "
" name = <name> " " plugin = <plugin> "
" label = <label> " " config = { "
" <configkey> = <value> ... " " } "
" control = { "
" <controlname|controlindex> = <value> ... " " } "
" } " " ] " " links = [ "
" { output = <portname> input = <portname> } ... " " ] "
" inputs = [ <portname> ... ] " " outputs = [ <portname> ... ] " "] "
"( capture.props=<properties> ) " "( playback.props=<properties> ) "
" <controlname|controlindex> = <value> ... "
" } " " } " " ] " " links = [ "
" { output = <portname> input = <portname> } ... "
" ] " " inputs = [ <portname> ... ] "
" outputs = [ <portname> ... ] " "] "
"( capture.props=<properties> ) "
"( playback.props=<properties> ) "
},
{PW_KEY_MODULE_VERSION, PACKAGE_VERSION},
};
@ -1204,7 +1209,8 @@ static void capture_process(void *d) {
pw_log_debug("playback trigger error: %s", spa_strerror(res));
while (true) {
struct pw_buffer *t;
if ((t = pw_stream_dequeue_buffer(impl->capture)) == NULL) break;
if ((t = pw_stream_dequeue_buffer(impl->capture)) ==
NULL) break;
/* playback part is not ready, consume, discard and recycle
* the capture buffers */
pw_stream_queue_buffer(impl->capture, t);
@ -1226,22 +1232,29 @@ static void control_process(void *d) {
struct pw_buffer *control = pw_stream_dequeue_buffer(impl->control);
if (control == NULL) goto done;
if (control->buffer->n_datas > 0) {
struct spa_pod *pod = spa_pod_from_data(control->buffer->datas[0].data,
struct spa_pod *pod = spa_pod_from_data(
control->buffer->datas[0].data,
control->buffer->datas[0].maxsize,
control->buffer->datas[0].chunk->
offset,
control->buffer->datas[0].chunk->
size);
control->buffer->datas[0].chunk->offset,
control->buffer->datas[0].chunk->size);
if (spa_pod_is_sequence(pod)) {
struct spa_pod_sequence *sequence = (struct spa_pod_sequence*)pod;
struct spa_pod_sequence *sequence = (struct
spa_pod_sequence*)pod;
struct spa_pod_control *pod_control;
SPA_POD_SEQUENCE_FOREACH(sequence, pod_control) {
if (pod_control->type == SPA_CONTROL_Properties) {
struct pw_loop *loop = pw_context_get_main_loop(impl->context);
pw_loop_invoke(loop, apply_props, 0, &pod_control->value,
SPA_POD_SIZE(&pod_control->value), false, impl);
if (pod_control->type ==
SPA_CONTROL_Properties) {
struct pw_loop *loop =
pw_context_get_main_loop(
impl->context);
pw_loop_invoke(
loop, apply_props, 0,
&pod_control->value,
SPA_POD_SIZE(
&pod_control->value),
false, impl);
}
}
}
@ -1263,7 +1276,8 @@ static void playback_process(void *d) {
in = NULL;
while (true) {
struct pw_buffer *t;
if ((t = pw_stream_dequeue_buffer(impl->capture)) == NULL) break;
if ((t = pw_stream_dequeue_buffer(impl->capture)) == NULL) break
;
if (in) pw_stream_queue_buffer(impl->capture, in);
in = t;
}
@ -1303,11 +1317,13 @@ static void playback_process(void *d) {
}
for (; i < impl->n_outputs; i++) cout[i] = NULL;
pw_log_trace_fp("%p: stride:%d size:%d requested:%"PRIu64" (%"PRIu64")", impl,
stride, data_size, out->requested, out->requested * stride);
pw_log_trace_fp("%p: stride:%d size:%d requested:%"PRIu64" (%"PRIu64")",
impl, stride, data_size, out->requested,
out->requested * stride);
if (impl->graph_active) spa_filter_graph_process(
impl->graph, cin, cout, data_size / sizeof(float));
if (impl->graph_active)
spa_filter_graph_process(impl->graph, cin, cout,
data_size / sizeof(float));
done:
if (in != NULL) pw_stream_queue_buffer(impl->capture, in);
@ -1323,10 +1339,12 @@ static int activate_graph(struct impl *impl) {
snprintf(rate, sizeof(rate), "%lu", impl->rate);
res = spa_filter_graph_activate(impl->graph,
&SPA_DICT_ITEMS(
SPA_DICT_ITEM(SPA_KEY_AUDIO_RATE, rate)));
SPA_DICT_ITEM(SPA_KEY_AUDIO_RATE
, rate)));
if (res >= 0) {
struct pw_loop *data_loop = pw_stream_get_data_loop(impl->playback);
struct pw_loop *data_loop = pw_stream_get_data_loop(
impl->playback);
pw_loop_lock(data_loop);
impl->graph_active = true;
pw_loop_unlock(data_loop);
@ -1413,8 +1431,8 @@ static void param_process_latency_changed(struct impl *impl,
if (param == NULL)
spa_zero(process_latency);
else if (spa_process_latency_parse(param, &process_latency) < 0) return;
if (spa_process_latency_info_compare(&impl->process_latency, &process_latency)
== 0) return;
if (spa_process_latency_info_compare(&impl->process_latency,
&process_latency) == 0) return;
impl->process_latency = process_latency;
update_latencies(impl, true);
@ -1428,8 +1446,8 @@ static void param_tag_changed(struct impl *impl, const struct spa_pod *param,
if (param == 0 || spa_tag_parse(param, &tag, &state) < 0) return;
if (tag.direction == SPA_DIRECTION_INPUT) pw_stream_update_params(
impl->capture, params, 1);
if (tag.direction == SPA_DIRECTION_INPUT)
pw_stream_update_params(impl->capture, params, 1);
else pw_stream_update_params(impl->playback, params, 1);
}
@ -1442,10 +1460,12 @@ static void capture_state_changed(void *data, enum pw_stream_state old,
case PW_STREAM_STATE_PAUSED:
pw_stream_flush(impl->capture, false);
break;
case PW_STREAM_STATE_UNCONNECTED: pw_log_info("module %p: unconnected", impl);
case PW_STREAM_STATE_UNCONNECTED: pw_log_info(
"module %p: unconnected", impl);
pw_impl_module_schedule_destroy(impl->module);
break;
case PW_STREAM_STATE_ERROR: pw_log_info("module %p: error: %s", impl, error);
case PW_STREAM_STATE_ERROR: pw_log_info("module %p: error: %s", impl,
error);
break;
case PW_STREAM_STATE_STREAMING: default:
break;
@ -1476,18 +1496,21 @@ static void param_changed(struct impl *impl, uint32_t id,
struct spa_audio_info_raw info;
spa_zero(info);
if (param == NULL) {
pw_log_info("module %p: filter deactivate", impl);
if (direction == SPA_DIRECTION_OUTPUT) deactivate_graph(impl);
pw_log_info("module %p: filter deactivate",
impl);
if (direction == SPA_DIRECTION_OUTPUT)
deactivate_graph(impl);
impl->rate = 0;
} else {
if ((res = spa_format_audio_raw_parse(param, &info)) < 0) goto error;
if ((res = spa_format_audio_raw_parse(
param, &info)) < 0) goto error;
}
impl->info = info;
break;
}
case SPA_PARAM_Props:
if (param != NULL)
spa_filter_graph_set_props(impl->graph, direction, param);
if (param != NULL) spa_filter_graph_set_props(
impl->graph, direction, param);
break;
case SPA_PARAM_Latency:
param_latency_changed(impl, param, direction);
@ -1503,8 +1526,10 @@ static void param_changed(struct impl *impl, uint32_t id,
error:
pw_stream_set_error(
direction == SPA_DIRECTION_INPUT ? impl->capture : impl->playback, res,
"can't start graph: %s", spa_strerror(res));
direction == SPA_DIRECTION_INPUT
? impl->capture
: impl->playback, res, "can't start graph: %s",
spa_strerror(res));
}
static void capture_param_changed(void *data, uint32_t id,
@ -1517,7 +1542,8 @@ static void capture_param_changed(void *data, uint32_t id,
static const struct pw_stream_events in_stream_events = {
PW_VERSION_STREAM_EVENTS, .destroy = capture_destroy,
.process = capture_process, .io_changed = io_changed,
.state_changed = capture_state_changed, .param_changed = capture_param_changed
.state_changed = capture_state_changed,
.param_changed = capture_param_changed
};
static void playback_state_changed(void *data, enum pw_stream_state old,
@ -1531,17 +1557,20 @@ static void playback_state_changed(void *data, enum pw_stream_state old,
pw_stream_flush(impl->playback, false);
reset_graph(impl);
break;
case PW_STREAM_STATE_UNCONNECTED: pw_log_info("module %p: unconnected", impl);
case PW_STREAM_STATE_UNCONNECTED: pw_log_info(
"module %p: unconnected", impl);
pw_impl_module_schedule_destroy(impl->module);
break;
case PW_STREAM_STATE_ERROR: pw_log_info("module %p: error: %s", impl, error);
case PW_STREAM_STATE_ERROR: pw_log_info("module %p: error: %s", impl,
error);
break;
case PW_STREAM_STATE_STREAMING:
{
uint32_t target = impl->info.rate;
if (target == 0)
target = impl->position
? impl->position->clock.target_rate.denom
? impl->position->clock.
target_rate.denom
: DEFAULT_RATE;
if (target == 0) {
res = -EINVAL;
@ -1598,7 +1627,8 @@ static void control_state_changed(void *data, enum pw_stream_state old,
case PW_STREAM_STATE_PAUSED:
pw_stream_flush(impl->control, false);
break;
case PW_STREAM_STATE_ERROR: pw_log_info("module %p: error: %s", impl, error);
case PW_STREAM_STATE_ERROR: pw_log_info("module %p: error: %s", impl,
error);
break;
case PW_STREAM_STATE_STREAMING: default:
break;
@ -1630,18 +1660,20 @@ static int setup_streams(struct impl *impl) {
&control_stream_events, impl);
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];
param[0] = spa_pod_builder_add_object(&bt, SPA_TYPE_OBJECT_Format,
SPA_PARAM_EnumFormat,
param[0] = spa_pod_builder_add_object(
&bt, SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat,
SPA_FORMAT_mediaType,
SPA_POD_Id(SPA_MEDIA_TYPE_application
), SPA_FORMAT_mediaSubtype,
SPA_POD_Id(SPA_MEDIA_TYPE_application ),
SPA_FORMAT_mediaSubtype,
SPA_POD_Id(SPA_MEDIA_SUBTYPE_control));
pw_stream_connect(impl->control, PW_DIRECTION_INPUT, PW_ID_ANY,
PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_MAP_BUFFERS |
PW_STREAM_FLAG_AUTOCONNECT |
PW_STREAM_FLAG_MAP_BUFFERS |
PW_STREAM_FLAG_RT_PROCESS, param, 1);
}
@ -1669,20 +1701,23 @@ static int setup_streams(struct impl *impl) {
goto done;
}
*offs = b.b.state.offset;
spa_format_audio_raw_build(&b.b, SPA_PARAM_EnumFormat, &impl->capture_info);
spa_format_audio_raw_build(&b.b, SPA_PARAM_EnumFormat,
&impl->capture_info);
for (i = 0;; i++) {
uint32_t save = b.b.state.offset;
if (spa_filter_graph_enum_prop_info(graph, i, &b.b, NULL) != 1) break;
if ((offs = pw_array_add(&offsets, sizeof(uint32_t))) != NULL) *offs = save;
if (spa_filter_graph_enum_prop_info(graph, i, &b.b, NULL) != 1)
break;
if ((offs = pw_array_add(&offsets, sizeof(uint32_t))) != NULL) *
offs = save;
}
if ((offs = pw_array_add(&offsets, sizeof(uint32_t))) != NULL) *offs = b.b.
state.offset;
if ((offs = pw_array_add(&offsets, sizeof(uint32_t))) != NULL)
*offs = b.b.state.offset;
spa_filter_graph_get_props(graph, &b.b, NULL);
if ((offs = pw_array_add(&offsets, sizeof(uint32_t))) != NULL) *offs = b.b.
state.offset;
if ((offs = pw_array_add(&offsets, sizeof(uint32_t))) != NULL)
*offs = b.b.state.offset;
spa_process_latency_build(&b.b, SPA_PARAM_ProcessLatency,
&impl->process_latency);
@ -1697,13 +1732,14 @@ static int setup_streams(struct impl *impl) {
}
offs = offsets.data;
for (i = 0; i < n_params; i++) params[i] = spa_pod_builder_deref(
&b.b, offs[i]);
for (i = 0; i < n_params; i++)
params[i] = spa_pod_builder_deref(&b.b, offs[i]);
res = pw_stream_connect(impl->capture, PW_DIRECTION_INPUT, PW_ID_ANY,
PW_STREAM_FLAG_AUTOCONNECT |
PW_STREAM_FLAG_MAP_BUFFERS | PW_STREAM_FLAG_RT_PROCESS
| PW_STREAM_FLAG_ASYNC, params, n_params);
PW_STREAM_FLAG_MAP_BUFFERS |
PW_STREAM_FLAG_RT_PROCESS |
PW_STREAM_FLAG_ASYNC, params, n_params);
spa_pod_dynamic_builder_clean(&b);
if (res < 0) goto done;
@ -1715,8 +1751,9 @@ static int setup_streams(struct impl *impl) {
res = pw_stream_connect(impl->playback, PW_DIRECTION_OUTPUT, PW_ID_ANY,
PW_STREAM_FLAG_AUTOCONNECT |
PW_STREAM_FLAG_MAP_BUFFERS | PW_STREAM_FLAG_RT_PROCESS
| PW_STREAM_FLAG_TRIGGER, params, n_params);
PW_STREAM_FLAG_MAP_BUFFERS |
PW_STREAM_FLAG_RT_PROCESS |
PW_STREAM_FLAG_TRIGGER, params, n_params);
spa_pod_dynamic_builder_clean(&b);
done:
@ -1730,8 +1767,8 @@ static void copy_position(struct spa_audio_info_raw *dst,
const struct spa_audio_info_raw *src) {
if (SPA_FLAG_IS_SET(dst->flags, SPA_AUDIO_FLAG_UNPOSITIONED) && !
SPA_FLAG_IS_SET(src->flags, SPA_AUDIO_FLAG_UNPOSITIONED)) {
for (uint32_t i = 0; i < src->channels; i++) dst->position[i] = src->
position[i];
for (uint32_t i = 0; i < src->channels; i++)
dst->position[i] = src->position[i];
SPA_FLAG_CLEAR(dst->flags, SPA_AUDIO_FLAG_UNPOSITIONED);
}
}
@ -1741,10 +1778,10 @@ static void graph_info(void *object, const struct spa_filter_graph_info *info) {
struct spa_dict *props = info->props;
uint32_t i;
if (impl->capture_info.channels == 0) impl->capture_info.channels = info->
n_inputs;
if (impl->playback_info.channels == 0) impl->playback_info.channels = info->
n_outputs;
if (impl->capture_info.channels == 0)
impl->capture_info.channels = info->n_inputs;
if (impl->playback_info.channels == 0)
impl->playback_info.channels = info->n_outputs;
impl->n_inputs = info->n_inputs;
impl->n_outputs = info->n_outputs;
@ -1760,8 +1797,10 @@ static void graph_info(void *object, const struct spa_filter_graph_info *info) {
if (spa_streq(k, "latency")) {
double latency;
if (spa_atod(s, &latency)) {
if (impl->process_latency.rate != (int32_t)latency) {
impl->process_latency.rate = (int32_t)latency;
if (impl->process_latency.rate != (int32_t)
latency) {
impl->process_latency.rate = (int32_t)
latency;
update_latencies(impl, true);
}
}
@ -1773,8 +1812,9 @@ static void graph_apply_props(void *object, enum spa_direction direction,
const struct spa_pod *props) {
struct impl *impl = object;
pw_stream_set_param(
direction == SPA_DIRECTION_INPUT ? impl->capture : impl->playback,
SPA_PARAM_Props, props);
direction == SPA_DIRECTION_INPUT
? impl->capture
: impl->playback, SPA_PARAM_Props, props);
}
static void graph_props_changed(void *object, enum spa_direction direction) {
@ -1801,15 +1841,15 @@ static void core_error(void *data, uint32_t id, int seq, int res,
struct impl *impl = data;
if (res == -ENOENT) {
pw_log_info("message id:%u seq:%d res:%d (%s): %s", id, seq, res,
spa_strerror(res), message);
pw_log_info("message id:%u seq:%d res:%d (%s): %s", id, seq,
res, spa_strerror(res), message);
} else {
pw_log_warn("error id:%u seq:%d res:%d (%s): %s", id, seq, res,
spa_strerror(res), message);
}
if (id == PW_ID_CORE && res == -EPIPE) pw_impl_module_schedule_destroy(
impl->module);
if (id == PW_ID_CORE && res == -EPIPE)
pw_impl_module_schedule_destroy(impl->module);
}
static const struct pw_core_events core_events = {
@ -1859,7 +1899,8 @@ static const struct pw_impl_module_events module_events = {
static void parse_audio_info(struct pw_properties *props,
struct spa_audio_info_raw *info) {
spa_audio_info_raw_init_dict_keys(
info, &SPA_DICT_ITEMS(SPA_DICT_ITEM(SPA_KEY_AUDIO_FORMAT, "F32P")),
info,
&SPA_DICT_ITEMS(SPA_DICT_ITEM(SPA_KEY_AUDIO_FORMAT, "F32P")),
&props->dict, SPA_KEY_AUDIO_RATE, SPA_KEY_AUDIO_CHANNELS,
SPA_KEY_AUDIO_POSITION, NULL);
}
@ -1868,10 +1909,10 @@ static void copy_props(struct impl *impl, struct pw_properties *props,
const char *key) {
const char *str;
if ((str = pw_properties_get(props, key)) != NULL) {
if (pw_properties_get(impl->capture_props, key) == NULL) pw_properties_set(
impl->capture_props, key, str);
if (pw_properties_get(impl->playback_props, key) == NULL) pw_properties_set(
impl->playback_props, key, str);
if (pw_properties_get(impl->capture_props, key) == NULL)
pw_properties_set(impl->capture_props, key, str);
if (pw_properties_get(impl->playback_props, key) == NULL)
pw_properties_set(impl->playback_props, key, str);
}
}
@ -1907,8 +1948,8 @@ SPA_EXPORT int pipewire__module_init(struct pw_impl_module *module,
impl->capture_props = pw_properties_new(NULL, NULL);
impl->playback_props = pw_properties_new(NULL, NULL);
impl->control_props = pw_properties_new(NULL, NULL);
if (impl->capture_props == NULL || impl->playback_props == NULL || impl->
control_props == NULL) {
if (impl->capture_props == NULL || impl->playback_props == NULL || impl
->control_props == NULL) {
res = -errno;
pw_log_error("can't create properties: %m");
goto error;
@ -1916,28 +1957,34 @@ SPA_EXPORT int pipewire__module_init(struct pw_impl_module *module,
impl->module = module;
impl->context = context;
impl->latency[SPA_DIRECTION_INPUT] = SPA_LATENCY_INFO(SPA_DIRECTION_INPUT);
impl->latency[SPA_DIRECTION_OUTPUT] = SPA_LATENCY_INFO(SPA_DIRECTION_OUTPUT);
impl->latency[SPA_DIRECTION_INPUT] = SPA_LATENCY_INFO(
SPA_DIRECTION_INPUT);
impl->latency[SPA_DIRECTION_OUTPUT] = SPA_LATENCY_INFO(
SPA_DIRECTION_OUTPUT);
if (pw_properties_get(props, PW_KEY_NODE_GROUP) == NULL) pw_properties_setf(
props, PW_KEY_NODE_GROUP, "filter-chain-%u-%u", pid, id);
if (pw_properties_get(props, PW_KEY_NODE_GROUP) == NULL)
pw_properties_setf(props, PW_KEY_NODE_GROUP,
"filter-chain-%u-%u", pid, id);
if (pw_properties_get(props, PW_KEY_NODE_LINK_GROUP) == NULL)
pw_properties_setf(props, PW_KEY_NODE_LINK_GROUP, "filter-chain-%u-%u", pid,
id);
if (pw_properties_get(props, PW_KEY_NODE_VIRTUAL) == NULL) pw_properties_set(
props, PW_KEY_NODE_VIRTUAL, "true");
if (pw_properties_get(props, "resample.prefill") == NULL) pw_properties_set(
props, "resample.prefill", "true");
pw_properties_setf(props, PW_KEY_NODE_LINK_GROUP,
"filter-chain-%u-%u", pid, id);
if (pw_properties_get(props, PW_KEY_NODE_VIRTUAL) == NULL)
pw_properties_set(props, PW_KEY_NODE_VIRTUAL, "true");
if (pw_properties_get(props, "resample.prefill") == NULL)
pw_properties_set(props, "resample.prefill", "true");
if (pw_properties_get(props, PW_KEY_NODE_DESCRIPTION) == NULL)
pw_properties_setf(props, PW_KEY_NODE_DESCRIPTION, "filter-chain-%u-%u",
pid, id);
pw_properties_setf(props, PW_KEY_NODE_DESCRIPTION,
"filter-chain-%u-%u", pid, id);
if ((str = pw_properties_get(props, "capture.props")) != NULL)
pw_properties_update_string(impl->capture_props, str, strlen(str));
pw_properties_update_string(impl->capture_props, str,
strlen(str));
if ((str = pw_properties_get(props, "playback.props")) != NULL)
pw_properties_update_string(impl->playback_props, str, strlen(str));
pw_properties_update_string(impl->playback_props, str,
strlen(str));
if ((str = pw_properties_get(props, "control.props")) != NULL)
pw_properties_update_string(impl->control_props, str, strlen(str));
pw_properties_update_string(impl->control_props, str,
strlen(str));
copy_props(impl, props, PW_KEY_AUDIO_RATE);
copy_props(impl, props, PW_KEY_AUDIO_CHANNELS);
@ -1954,14 +2001,16 @@ SPA_EXPORT int pipewire__module_init(struct pw_impl_module *module,
parse_audio_info(impl->playback_props, &impl->playback_info);
if (!impl->capture_info.rate && !impl->playback_info.rate) {
if (pw_properties_get(impl->playback_props, "resample.disable") == NULL)
pw_properties_set(impl->playback_props, "resample.disable", "true");
if (pw_properties_get(impl->capture_props, "resample.disable") == NULL)
pw_properties_set(impl->capture_props, "resample.disable", "true");
} else if (impl->capture_info.rate && !impl->playback_info.rate) impl->
playback_info.rate = impl->capture_info.rate;
else if (impl->playback_info.rate && !impl->capture_info.rate) impl->
capture_info.rate = !impl->playback_info.rate;
if (pw_properties_get(impl->playback_props, "resample.disable")
== NULL) pw_properties_set(
impl->playback_props, "resample.disable", "true");
if (pw_properties_get(impl->capture_props, "resample.disable")
== NULL) pw_properties_set(
impl->capture_props, "resample.disable", "true");
} else if (impl->capture_info.rate && !impl->playback_info.rate)
impl->playback_info.rate = impl->capture_info.rate;
else if (impl->playback_info.rate && !impl->capture_info.rate)
impl->capture_info.rate = !impl->playback_info.rate;
else if (impl->capture_info.rate != impl->playback_info.rate) {
pw_log_warn(
"Both capture and playback rate are set, but"
@ -1972,21 +2021,25 @@ SPA_EXPORT int pipewire__module_init(struct pw_impl_module *module,
}
if ((str = pw_properties_get(props, PW_KEY_NODE_NAME)) == NULL) {
pw_properties_setf(props, PW_KEY_NODE_NAME, "filter-chain-%u-%u", pid, id);
pw_properties_setf(props, PW_KEY_NODE_NAME,
"filter-chain-%u-%u", pid, id);
str = pw_properties_get(props, PW_KEY_NODE_NAME);
}
if (pw_properties_get(impl->capture_props, PW_KEY_NODE_NAME) == NULL)
pw_properties_setf(impl->capture_props, PW_KEY_NODE_NAME, "input.%s", str);
pw_properties_setf(impl->capture_props, PW_KEY_NODE_NAME,
"input.%s", str);
if (pw_properties_get(impl->playback_props, PW_KEY_NODE_NAME) == NULL)
pw_properties_setf(impl->playback_props, PW_KEY_NODE_NAME, "output.%s",
str);
pw_properties_setf(impl->playback_props, PW_KEY_NODE_NAME,
"output.%s", str);
if (pw_properties_get(impl->capture_props, PW_KEY_MEDIA_NAME) == NULL)
pw_properties_setf(impl->capture_props, PW_KEY_MEDIA_NAME, "%s input",
pw_properties_setf(impl->capture_props, PW_KEY_MEDIA_NAME,
"%s input",
pw_properties_get(impl->capture_props,
PW_KEY_NODE_DESCRIPTION));
if (pw_properties_get(impl->playback_props, PW_KEY_MEDIA_NAME) == NULL)
pw_properties_setf(impl->playback_props, PW_KEY_MEDIA_NAME, "%s output",
pw_properties_setf(impl->playback_props, PW_KEY_MEDIA_NAME,
"%s output",
pw_properties_get(impl->playback_props,
PW_KEY_NODE_DESCRIPTION));
@ -2008,8 +2061,8 @@ SPA_EXPORT int pipewire__module_init(struct pw_impl_module *module,
goto error;
}
res = spa_handle_get_interface(impl->handle, SPA_TYPE_INTERFACE_FilterGraph,
&iface);
res = spa_handle_get_interface(impl->handle,
SPA_TYPE_INTERFACE_FilterGraph, &iface);
if (res < 0 || iface == NULL) goto error;
impl->graph = iface;
@ -2017,12 +2070,14 @@ SPA_EXPORT int pipewire__module_init(struct pw_impl_module *module,
spa_filter_graph_add_listener(impl->graph, &impl->graph_listener,
&graph_events, impl);
impl->core = pw_context_get_object(impl->context, PW_TYPE_INTERFACE_Core);
impl->core = pw_context_get_object(impl->context,
PW_TYPE_INTERFACE_Core);
if (impl->core == NULL) {
str = pw_properties_get(props, PW_KEY_REMOTE_NAME);
impl->core = pw_context_connect(impl->context,
pw_properties_new(
PW_KEY_REMOTE_NAME, str, NULL), 0);
PW_KEY_REMOTE_NAME, str,
NULL), 0);
impl->do_disconnect = true;
}
if (impl->core == NULL) {
@ -2032,25 +2087,28 @@ SPA_EXPORT int pipewire__module_init(struct pw_impl_module *module,
}
pw_proxy_add_listener((struct pw_proxy*)impl->core,
&impl->core_proxy_listener, &core_proxy_events, impl);
pw_core_add_listener(impl->core, &impl->core_listener, &core_events, impl);
&impl->core_proxy_listener, &core_proxy_events,
impl);
pw_core_add_listener(impl->core, &impl->core_listener, &core_events,
impl);
if (pw_properties_get(impl->control_props, "enabled") == NULL) {
impl->control_stream_active = false;
} else if (strcmp(pw_properties_get(impl->control_props, "enabled"), "true")
== 0) {
} else if (strcmp(pw_properties_get(impl->control_props, "enabled"),
"true") == 0) {
impl->control_stream_active = true;
} else if (strcmp(pw_properties_get(impl->control_props, "enabled"), "false")
== 0) {
} else if (strcmp(pw_properties_get(impl->control_props, "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);
pw_impl_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props));
pw_impl_module_update_properties(
module, &SPA_DICT_INIT_ARRAY(module_props));
return 0;