diff --git a/src/modules/meson.build b/src/modules/meson.build index 54b4945ca..097d5c5e1 100644 --- a/src/modules/meson.build +++ b/src/modules/meson.build @@ -134,6 +134,7 @@ endif pipewire_module_protocol_pulse_sources = [ 'module-protocol-pulse.c', 'module-protocol-pulse/collect.c', + 'module-protocol-pulse/dbus-name.c', 'module-protocol-pulse/format.c', 'module-protocol-pulse/manager.c', 'module-protocol-pulse/pulse-server.c', diff --git a/src/modules/module-protocol-pulse/dbus-name.c b/src/modules/module-protocol-pulse/dbus-name.c index 4a34202a5..ffe7a2fad 100644 --- a/src/modules/module-protocol-pulse/dbus-name.c +++ b/src/modules/module-protocol-pulse/dbus-name.c @@ -1,4 +1,4 @@ -/* pulseaudio server +/* PipeWire * * Copyright © 2019 Wim Taymans * @@ -22,10 +22,18 @@ * DEALINGS IN THE SOFTWARE. */ -#include -#include +#include -static void *dbus_request_name(struct pw_context *context, const char *name) +#include + +#include +#include +#include +#include + +#include "dbus-name.h" + +void *dbus_request_name(struct pw_context *context, const char *name) { struct spa_dbus *dbus; struct spa_dbus_connection *conn; @@ -42,12 +50,12 @@ static void *dbus_request_name(struct pw_context *context, const char *name) return NULL; } - conn = spa_dbus_get_connection(dbus, SPA_DBUS_TYPE_SESSION); - if (conn == NULL) + conn = spa_dbus_get_connection(dbus, SPA_DBUS_TYPE_SESSION); + if (conn == NULL) return NULL; bus = spa_dbus_connection_get(conn); - if (bus == NULL) + if (bus == NULL) return NULL; dbus_error_init(&error); @@ -68,7 +76,7 @@ static void *dbus_request_name(struct pw_context *context, const char *name) return NULL; } -static void dbus_release_name(void *data) +void dbus_release_name(void *data) { struct spa_dbus_connection *conn = data; spa_dbus_connection_destroy(conn); diff --git a/src/modules/module-protocol-pulse/dbus-name.h b/src/modules/module-protocol-pulse/dbus-name.h new file mode 100644 index 000000000..a15fb80b2 --- /dev/null +++ b/src/modules/module-protocol-pulse/dbus-name.h @@ -0,0 +1,33 @@ +/* PipeWire + * + * Copyright © 2019 Wim Taymans + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef PULSE_SERVER_DBUS_NAME_H +#define PULSE_SERVER_DBUS_NAME_H + +struct pw_context; + +void *dbus_request_name(struct pw_context *context, const char *name); +void dbus_release_name(void *data); + +#endif /* PULSE_SERVER_DBUS_NAME_H */ diff --git a/src/modules/module-protocol-pulse/pulse-server.c b/src/modules/module-protocol-pulse/pulse-server.c index a66e0ae9c..8ca3dc2b5 100644 --- a/src/modules/module-protocol-pulse/pulse-server.c +++ b/src/modules/module-protocol-pulse/pulse-server.c @@ -82,6 +82,7 @@ #include "pulse-server.h" #include "collect.h" #include "commands.h" +#include "dbus-name.h" #include "defs.h" #include "format.h" #include "internal.h" @@ -103,7 +104,6 @@ #include "message.c" #include "manager.h" -#include "dbus-name.c" static bool debug_messages = false;