diff --git a/pipewire-alsa b/pipewire-alsa index 3d9fab3aa..5a8c6d457 160000 --- a/pipewire-alsa +++ b/pipewire-alsa @@ -1 +1 @@ -Subproject commit 3d9fab3aaf1e52c2481a445255841675e75def0c +Subproject commit 5a8c6d457e846639e4e949461ecf3f494cabba39 diff --git a/pipewire-jack b/pipewire-jack index 25b8a7919..a8fb217eb 160000 --- a/pipewire-jack +++ b/pipewire-jack @@ -1 +1 @@ -Subproject commit 25b8a7919f021e5b6354febe37e320adc8b9a297 +Subproject commit a8fb217ebac920a8fd545dc182b3f292e4599002 diff --git a/pipewire-pulseaudio b/pipewire-pulseaudio index ac4ad7c8f..5680e2971 160000 --- a/pipewire-pulseaudio +++ b/pipewire-pulseaudio @@ -1 +1 @@ -Subproject commit ac4ad7c8f1e36e178b7d4a230b50fd5aafba5524 +Subproject commit 5680e29716f3d621fa25b26bfd60234778ec02b9 diff --git a/src/daemon/main.c b/src/daemon/main.c index 70f0c2f85..3388c4235 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -104,7 +104,7 @@ int main(int argc, char *argv[]) pw_loop_add_signal(pw_main_loop_get_loop(loop), SIGINT, do_quit, loop); pw_loop_add_signal(pw_main_loop_get_loop(loop), SIGTERM, do_quit, loop); - core = pw_core_new(pw_main_loop_get_loop(loop), props); + core = pw_core_new(pw_main_loop_get_loop(loop), props, 0); if (pw_daemon_config_run_commands(config, core) < 0) { pw_log_error("failed to run config commands"); diff --git a/src/examples/export-sink.c b/src/examples/export-sink.c index 8db418987..86391cdbf 100644 --- a/src/examples/export-sink.c +++ b/src/examples/export-sink.c @@ -555,7 +555,7 @@ int main(int argc, char *argv[]) pw_init(&argc, &argv); data.loop = pw_main_loop_new(NULL); - data.core = pw_core_new(pw_main_loop_get_loop(data.loop), NULL); + data.core = pw_core_new(pw_main_loop_get_loop(data.loop), NULL, 0); data.remote = pw_remote_new(data.core, NULL, 0); data.path = argc > 1 ? argv[1] : NULL; diff --git a/src/examples/export-source.c b/src/examples/export-source.c index 0459a0c66..d6f7453c8 100644 --- a/src/examples/export-source.c +++ b/src/examples/export-source.c @@ -542,7 +542,7 @@ int main(int argc, char *argv[]) pw_init(&argc, &argv); data.loop = pw_main_loop_new(NULL); - data.core = pw_core_new(pw_main_loop_get_loop(data.loop), NULL); + data.core = pw_core_new(pw_main_loop_get_loop(data.loop), NULL, 0); data.remote = pw_remote_new(data.core, NULL, 0); data.path = argc > 1 ? argv[1] : NULL; diff --git a/src/examples/export-spa.c b/src/examples/export-spa.c index 13229c5b5..afd01e99b 100644 --- a/src/examples/export-spa.c +++ b/src/examples/export-spa.c @@ -129,7 +129,7 @@ int main(int argc, char *argv[]) l = pw_main_loop_get_loop(data.loop); pw_loop_add_signal(l, SIGINT, do_quit, &data); pw_loop_add_signal(l, SIGTERM, do_quit, &data); - data.core = pw_core_new(l, NULL); + data.core = pw_core_new(l, NULL, 0); data.remote = pw_remote_new(data.core, NULL, 0); data.library = argv[1]; data.factory = argv[2]; diff --git a/src/examples/local-v4l2.c b/src/examples/local-v4l2.c index 90f26b485..5b2ffb46d 100644 --- a/src/examples/local-v4l2.c +++ b/src/examples/local-v4l2.c @@ -385,7 +385,7 @@ int main(int argc, char *argv[]) pw_init(&argc, &argv); data.loop = pw_main_loop_new(NULL); - data.core = pw_core_new(pw_main_loop_get_loop(data.loop), NULL); + data.core = pw_core_new(pw_main_loop_get_loop(data.loop), NULL, 0); pw_module_load(data.core, "libpipewire-module-spa-node-factory", NULL, NULL, NULL, NULL); diff --git a/src/examples/media-session.c b/src/examples/media-session.c index ac256b31d..c2a200722 100644 --- a/src/examples/media-session.c +++ b/src/examples/media-session.c @@ -1329,7 +1329,7 @@ int main(int argc, char *argv[]) pw_init(&argc, &argv); impl.loop = pw_main_loop_new(NULL); - impl.core = pw_core_new(pw_main_loop_get_loop(impl.loop), NULL); + impl.core = pw_core_new(pw_main_loop_get_loop(impl.loop), NULL, 0); impl.remote = pw_remote_new(impl.core, NULL, 0); pw_map_init(&impl.globals, 64, 64); diff --git a/src/examples/video-src.c b/src/examples/video-src.c index 7124054b1..c5154a223 100644 --- a/src/examples/video-src.c +++ b/src/examples/video-src.c @@ -351,7 +351,7 @@ int main(int argc, char *argv[]) pw_init(&argc, &argv); data.loop = pw_main_loop_new(NULL); - data.core = pw_core_new(pw_main_loop_get_loop(data.loop), NULL); + data.core = pw_core_new(pw_main_loop_get_loop(data.loop), NULL, 0); data.remote = pw_remote_new(data.core, NULL, 0); data.timer = pw_loop_add_timer(pw_main_loop_get_loop(data.loop), on_timeout, &data); diff --git a/src/gst/gstpipewiredeviceprovider.c b/src/gst/gstpipewiredeviceprovider.c index fd9da13a0..9ba63cb58 100644 --- a/src/gst/gstpipewiredeviceprovider.c +++ b/src/gst/gstpipewiredeviceprovider.c @@ -533,7 +533,7 @@ gst_pipewire_device_provider_probe (GstDeviceProvider * provider) if (!(l = pw_loop_new (NULL))) return NULL; - if (!(c = pw_core_new (l, NULL))) + if (!(c = pw_core_new (l, NULL, 0))) return NULL; if (!(r = pw_remote_new (c, NULL, sizeof(*data)))) @@ -619,7 +619,7 @@ gst_pipewire_device_provider_start (GstDeviceProvider * provider) goto failed_main_loop; } - if (!(self->core = pw_core_new (self->loop, NULL))) { + if (!(self->core = pw_core_new (self->loop, NULL, 0))) { GST_ERROR_OBJECT (self, "Could not create PipeWire core"); goto failed_core; } diff --git a/src/gst/gstpipewiresink.c b/src/gst/gstpipewiresink.c index 66ebc30c4..62d803ea3 100644 --- a/src/gst/gstpipewiresink.c +++ b/src/gst/gstpipewiresink.c @@ -277,7 +277,7 @@ gst_pipewire_sink_init (GstPipeWireSink * sink) sink->loop = pw_loop_new (NULL); sink->main_loop = pw_thread_loop_new (sink->loop, "pipewire-sink-loop"); - sink->core = pw_core_new (sink->loop, NULL); + sink->core = pw_core_new (sink->loop, NULL, 0); GST_DEBUG ("loop %p %p", sink->loop, sink->main_loop); } diff --git a/src/gst/gstpipewiresrc.c b/src/gst/gstpipewiresrc.c index 91bdb0d72..0d40cce77 100644 --- a/src/gst/gstpipewiresrc.c +++ b/src/gst/gstpipewiresrc.c @@ -329,7 +329,7 @@ gst_pipewire_src_init (GstPipeWireSrc * src) src->pool = gst_pipewire_pool_new (); src->loop = pw_loop_new (NULL); src->main_loop = pw_thread_loop_new (src->loop, "pipewire-main-loop"); - src->core = pw_core_new (src->loop, NULL); + src->core = pw_core_new (src->loop, NULL, 0); GST_DEBUG ("loop %p, mainloop %p", src->loop, src->main_loop); } diff --git a/src/pipewire/core.c b/src/pipewire/core.c index 60e4a20b7..5f5a34ca0 100644 --- a/src/pipewire/core.c +++ b/src/pipewire/core.c @@ -396,13 +396,15 @@ static const struct pw_global_events global_events = { * * \memberof pw_core */ -struct pw_core *pw_core_new(struct pw_loop *main_loop, struct pw_properties *properties) +struct pw_core *pw_core_new(struct pw_loop *main_loop, + struct pw_properties *properties, + size_t user_data_size) { struct impl *impl; struct pw_core *this; const char *name; - impl = calloc(1, sizeof(struct impl)); + impl = calloc(1, sizeof(struct impl) + user_data_size); if (impl == NULL) return NULL; @@ -410,6 +412,9 @@ struct pw_core *pw_core_new(struct pw_loop *main_loop, struct pw_properties *pro pw_log_debug("core %p: new", this); + if (user_data_size > 0) + this->user_data = SPA_MEMBER(impl, sizeof(struct impl), void); + if (properties == NULL) properties = pw_properties_new(NULL, NULL); if (properties == NULL) @@ -545,6 +550,11 @@ void pw_core_destroy(struct pw_core *core) free(core); } +void *pw_core_get_user_data(struct pw_core *core) +{ + return core->user_data; +} + const struct pw_core_info *pw_core_get_info(struct pw_core *core) { return &core->info; diff --git a/src/pipewire/core.h b/src/pipewire/core.h index 005e02a7c..cfae245f7 100644 --- a/src/pipewire/core.h +++ b/src/pipewire/core.h @@ -109,11 +109,16 @@ struct pw_core_events { #define PW_CORE_PROP_DAEMON "pipewire.daemon" /** Make a new core object for a given main_loop. Ownership of the properties is taken */ -struct pw_core * pw_core_new(struct pw_loop *main_loop, struct pw_properties *props); +struct pw_core * pw_core_new(struct pw_loop *main_loop, /**< a main loop to run in */ + struct pw_properties *props, /**< extra properties */ + size_t user_data_size /**< extra user data size */); /** destroy a core object, all resources except the main_loop will be destroyed */ void pw_core_destroy(struct pw_core *core); +/** Get the core user data */ +void *pw_core_get_user_data(struct pw_core *core); + /** Add a new event listener to a core */ void pw_core_add_listener(struct pw_core *core, struct spa_hook *listener, diff --git a/src/pipewire/private.h b/src/pipewire/private.h index 64875f480..a8a6a29e0 100644 --- a/src/pipewire/private.h +++ b/src/pipewire/private.h @@ -192,6 +192,8 @@ struct pw_core { struct pw_client *current_client; /**< client currently executing code in mainloop */ long sc_pagesize; + + void *user_data; /**< extra user data */ }; #define pw_data_loop_events_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_data_loop_events, m, v, ##__VA_ARGS__) diff --git a/src/pipewire/stream.c b/src/pipewire/stream.c index 497fdcf4f..c68549de6 100644 --- a/src/pipewire/stream.c +++ b/src/pipewire/stream.c @@ -940,7 +940,7 @@ pw_stream_new_simple(struct pw_loop *loop, struct pw_core *core; struct pw_remote *remote; - core = pw_core_new(loop, NULL); + core = pw_core_new(loop, NULL, 0); remote = pw_remote_new(core, NULL, 0); stream = pw_stream_new(remote, name, props); diff --git a/src/tools/pipewire-cli.c b/src/tools/pipewire-cli.c index ac3a6fb07..505a2ebab 100644 --- a/src/tools/pipewire-cli.c +++ b/src/tools/pipewire-cli.c @@ -1332,7 +1332,7 @@ int main(int argc, char *argv[]) spa_list_init(&data.remotes); pw_map_init(&data.vars, 64, 16); - data.core = pw_core_new(l, pw_properties_new(PW_CORE_PROP_DAEMON, "1", NULL)); + data.core = pw_core_new(l, pw_properties_new(PW_CORE_PROP_DAEMON, "1", NULL), 0); info = pw_core_get_info(data.core); pw_module_load(data.core, "libpipewire-module-link-factory", NULL, NULL, NULL, NULL); diff --git a/src/tools/pipewire-monitor.c b/src/tools/pipewire-monitor.c index 9d75f8176..2ed211872 100644 --- a/src/tools/pipewire-monitor.c +++ b/src/tools/pipewire-monitor.c @@ -675,7 +675,7 @@ int main(int argc, char *argv[]) pw_loop_add_signal(l, SIGINT, do_quit, &data); pw_loop_add_signal(l, SIGTERM, do_quit, &data); - data.core = pw_core_new(l, NULL); + data.core = pw_core_new(l, NULL, 0); if (data.core == NULL) return -1;