Browse Source

pulse-server: split out D-Bus parts

Part of !776.
lines
Barnabás Pőcze 1 year ago
parent
commit
bc4370e195
4 changed files with 49 additions and 7 deletions
  1. +1
    -0
      src/modules/meson.build
  2. +14
    -6
      src/modules/module-protocol-pulse/dbus-name.c
  3. +33
    -0
      src/modules/module-protocol-pulse/dbus-name.h
  4. +1
    -1
      src/modules/module-protocol-pulse/pulse-server.c

+ 1
- 0
src/modules/meson.build View File

@ -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',


+ 14
- 6
src/modules/module-protocol-pulse/dbus-name.c View File

@ -1,4 +1,4 @@
/* pulseaudio server
/* PipeWire
*
* Copyright © 2019 Wim Taymans
*
@ -22,10 +22,18 @@
* DEALINGS IN THE SOFTWARE.
*/
#include <errno.h>
#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"
static void *dbus_request_name(struct pw_context *context, const char *name)
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);


+ 33
- 0
src/modules/module-protocol-pulse/dbus-name.h 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 */

+ 1
- 1
src/modules/module-protocol-pulse/pulse-server.c View File

@ -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;


Loading…
Cancel
Save