mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-19 07:00:10 -05:00
filter: add support for TRIGGER
This commit is contained in:
parent
7fb7c679d0
commit
52bc7451fd
2 changed files with 16 additions and 4 deletions
|
|
@ -151,6 +151,7 @@ struct filter {
|
||||||
unsigned int warn_mlock:1;
|
unsigned int warn_mlock:1;
|
||||||
unsigned int process_rt:1;
|
unsigned int process_rt:1;
|
||||||
unsigned int driving:1;
|
unsigned int driving:1;
|
||||||
|
unsigned int trigger:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int get_param_index(uint32_t id)
|
static int get_param_index(uint32_t id)
|
||||||
|
|
@ -1601,6 +1602,10 @@ pw_filter_connect(struct pw_filter *filter,
|
||||||
pw_properties_set(filter->properties, PW_KEY_NODE_DRIVER, "true");
|
pw_properties_set(filter->properties, PW_KEY_NODE_DRIVER, "true");
|
||||||
if ((pw_properties_get(filter->properties, PW_KEY_NODE_WANT_DRIVER) == NULL))
|
if ((pw_properties_get(filter->properties, PW_KEY_NODE_WANT_DRIVER) == NULL))
|
||||||
pw_properties_set(filter->properties, PW_KEY_NODE_WANT_DRIVER, "true");
|
pw_properties_set(filter->properties, PW_KEY_NODE_WANT_DRIVER, "true");
|
||||||
|
if (flags & PW_FILTER_FLAG_TRIGGER) {
|
||||||
|
pw_properties_set(filter->properties, PW_KEY_NODE_TRIGGER, "true");
|
||||||
|
impl->trigger = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (filter->core == NULL) {
|
if (filter->core == NULL) {
|
||||||
filter->core = pw_context_connect(impl->context,
|
filter->core = pw_context_connect(impl->context,
|
||||||
|
|
@ -2049,12 +2054,14 @@ int pw_filter_trigger_process(struct pw_filter *filter)
|
||||||
|
|
||||||
pw_log_trace_fp("%p: driving:%d", impl, impl->driving);
|
pw_log_trace_fp("%p: driving:%d", impl, impl->driving);
|
||||||
|
|
||||||
if (!impl->driving) {
|
if (impl->trigger) {
|
||||||
res = pw_loop_invoke(impl->main_loop,
|
pw_impl_node_trigger(filter->node);
|
||||||
do_trigger_request_process, 1, NULL, 0, false, impl);
|
} else if (impl->driving) {
|
||||||
} else {
|
|
||||||
res = pw_loop_invoke(impl->data_loop,
|
res = pw_loop_invoke(impl->data_loop,
|
||||||
do_trigger_process, 1, NULL, 0, false, impl);
|
do_trigger_process, 1, NULL, 0, false, impl);
|
||||||
|
} else {
|
||||||
|
res = pw_loop_invoke(impl->main_loop,
|
||||||
|
do_trigger_request_process, 1, NULL, 0, false, impl);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,11 @@ enum pw_filter_flags {
|
||||||
PW_FILTER_FLAG_CUSTOM_LATENCY = (1 << 3), /**< don't call the default latency algorithm
|
PW_FILTER_FLAG_CUSTOM_LATENCY = (1 << 3), /**< don't call the default latency algorithm
|
||||||
* but emit the param_changed event for the
|
* but emit the param_changed event for the
|
||||||
* ports when Latency params are received. */
|
* ports when Latency params are received. */
|
||||||
|
PW_FILTER_FLAG_TRIGGER = (1 << 4), /**< the filter will not be scheduled
|
||||||
|
* automatically but _trigger_process()
|
||||||
|
* needs to be called. This can be used
|
||||||
|
* when the filter depends on processing
|
||||||
|
* of other filters. */
|
||||||
};
|
};
|
||||||
|
|
||||||
enum pw_filter_port_flags {
|
enum pw_filter_port_flags {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue