mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
pipewire: expose pw_impl_module_schedule_destroy()
And then remove the custom code in the example sink/source.
This commit is contained in:
parent
164e343dbf
commit
ca1b32393d
4 changed files with 9 additions and 46 deletions
|
|
@ -126,7 +126,6 @@ struct impl {
|
|||
struct pw_properties *props;
|
||||
|
||||
struct pw_impl_module *module;
|
||||
struct pw_work_queue *work;
|
||||
|
||||
struct spa_hook module_listener;
|
||||
|
||||
|
|
@ -144,20 +143,6 @@ struct impl {
|
|||
unsigned int unloading:1;
|
||||
};
|
||||
|
||||
static void do_unload_module(void *obj, void *data, int res, uint32_t id)
|
||||
{
|
||||
struct impl *impl = data;
|
||||
pw_impl_module_destroy(impl->module);
|
||||
}
|
||||
|
||||
static void unload_module(struct impl *impl)
|
||||
{
|
||||
if (!impl->unloading) {
|
||||
impl->unloading = true;
|
||||
pw_work_queue_add(impl->work, impl, 0, do_unload_module, impl);
|
||||
}
|
||||
}
|
||||
|
||||
static void stream_destroy(void *d)
|
||||
{
|
||||
struct impl *impl = d;
|
||||
|
|
@ -172,7 +157,7 @@ static void stream_state_changed(void *d, enum pw_stream_state old,
|
|||
switch (state) {
|
||||
case PW_STREAM_STATE_ERROR:
|
||||
case PW_STREAM_STATE_UNCONNECTED:
|
||||
unload_module(impl);
|
||||
pw_impl_module_schedule_destroy(impl->module);
|
||||
break;
|
||||
case PW_STREAM_STATE_PAUSED:
|
||||
case PW_STREAM_STATE_STREAMING:
|
||||
|
|
@ -261,7 +246,7 @@ static void core_error(void *data, uint32_t id, int seq, int res, const char *me
|
|||
id, seq, res, spa_strerror(res), message);
|
||||
|
||||
if (id == PW_ID_CORE && res == -EPIPE)
|
||||
unload_module(impl);
|
||||
pw_impl_module_schedule_destroy(impl->module);
|
||||
}
|
||||
|
||||
static const struct pw_core_events core_events = {
|
||||
|
|
@ -274,7 +259,7 @@ static void core_destroy(void *d)
|
|||
struct impl *impl = d;
|
||||
spa_hook_remove(&impl->core_listener);
|
||||
impl->core = NULL;
|
||||
unload_module(impl);
|
||||
pw_impl_module_schedule_destroy(impl->module);
|
||||
}
|
||||
|
||||
static const struct pw_proxy_events core_proxy_events = {
|
||||
|
|
@ -291,8 +276,6 @@ static void impl_destroy(struct impl *impl)
|
|||
pw_properties_free(impl->stream_props);
|
||||
pw_properties_free(impl->props);
|
||||
|
||||
if (impl->work)
|
||||
pw_work_queue_cancel(impl->work, impl, SPA_ID_INVALID);
|
||||
free(impl);
|
||||
}
|
||||
|
||||
|
|
@ -448,7 +431,6 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
|
|||
|
||||
impl->module = module;
|
||||
impl->context = context;
|
||||
impl->work = pw_context_get_work_queue(context);
|
||||
|
||||
if (pw_properties_get(props, PW_KEY_NODE_VIRTUAL) == NULL)
|
||||
pw_properties_set(props, PW_KEY_NODE_VIRTUAL, "true");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue