pulse-server: split out D-Bus parts

Part of !776.
This commit is contained in:
Barnabás Pőcze 2021-06-18 22:14:05 +02:00
parent acffe1b90b
commit bc4370e195
4 changed files with 51 additions and 9 deletions

View file

@ -134,6 +134,7 @@ endif
pipewire_module_protocol_pulse_sources = [ pipewire_module_protocol_pulse_sources = [
'module-protocol-pulse.c', 'module-protocol-pulse.c',
'module-protocol-pulse/collect.c', 'module-protocol-pulse/collect.c',
'module-protocol-pulse/dbus-name.c',
'module-protocol-pulse/format.c', 'module-protocol-pulse/format.c',
'module-protocol-pulse/manager.c', 'module-protocol-pulse/manager.c',
'module-protocol-pulse/pulse-server.c', 'module-protocol-pulse/pulse-server.c',

View file

@ -1,4 +1,4 @@
/* pulseaudio server /* PipeWire
* *
* Copyright © 2019 Wim Taymans * Copyright © 2019 Wim Taymans
* *
@ -22,10 +22,18 @@
* DEALINGS IN THE SOFTWARE. * DEALINGS IN THE SOFTWARE.
*/ */
#include <dbus/dbus.h> #include <errno.h>
#include <spa/support/dbus.h>
static void *dbus_request_name(struct pw_context *context, const char *name) #include <dbus/dbus.h>
#include <spa/support/dbus.h>
#include <spa/support/plugin.h>
#include <pipewire/context.h>
#include <pipewire/log.h>
#include "dbus-name.h"
void *dbus_request_name(struct pw_context *context, const char *name)
{ {
struct spa_dbus *dbus; struct spa_dbus *dbus;
struct spa_dbus_connection *conn; struct spa_dbus_connection *conn;
@ -68,7 +76,7 @@ static void *dbus_request_name(struct pw_context *context, const char *name)
return NULL; return NULL;
} }
static void dbus_release_name(void *data) void dbus_release_name(void *data)
{ {
struct spa_dbus_connection *conn = data; struct spa_dbus_connection *conn = data;
spa_dbus_connection_destroy(conn); spa_dbus_connection_destroy(conn);

View file

@ -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 */

View file

@ -82,6 +82,7 @@
#include "pulse-server.h" #include "pulse-server.h"
#include "collect.h" #include "collect.h"
#include "commands.h" #include "commands.h"
#include "dbus-name.h"
#include "defs.h" #include "defs.h"
#include "format.h" #include "format.h"
#include "internal.h" #include "internal.h"
@ -103,7 +104,6 @@
#include "message.c" #include "message.c"
#include "manager.h" #include "manager.h"
#include "dbus-name.c"
static bool debug_messages = false; static bool debug_messages = false;