mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-24 07:00:05 -05:00
Cleanups
Hide GDBus from RTKit API Remove register node from dbus API Add signal Add object and register objects in the registry Add some preregistered types to the registry Let the daemon listen to the registry
This commit is contained in:
parent
e88a376d7c
commit
89bc235924
27 changed files with 568 additions and 462 deletions
|
|
@ -42,7 +42,7 @@ struct _PinosArray {
|
|||
#define pinos_array_get_unchecked(a,idx,t) pinos_array_get_unchecked_s(a,idx,sizeof(t),t)
|
||||
#define pinos_array_check_index(a,idx,t) pinos_array_check_index_s(a,idx,sizeof(t))
|
||||
|
||||
#define pinos_array_for_each(pos, array) \
|
||||
#define PINOS_ARRAY_FOREACH(pos, array) \
|
||||
for (pos = (array)->data; \
|
||||
(const char *) pos < ((const char *) (array)->data + (array)->size); \
|
||||
(pos)++)
|
||||
|
|
@ -67,7 +67,7 @@ pinos_array_ensure_size (PinosArray *arr,
|
|||
size_t alloc, need;
|
||||
|
||||
alloc = arr->alloc;
|
||||
need = alloc + size;
|
||||
need = arr->size + size;
|
||||
|
||||
if (SPA_UNLIKELY (alloc < need)) {
|
||||
void *data;
|
||||
|
|
@ -97,6 +97,21 @@ pinos_array_add (PinosArray *arr,
|
|||
return p;
|
||||
}
|
||||
|
||||
static inline void *
|
||||
pinos_array_add_fixed (PinosArray *arr,
|
||||
size_t size)
|
||||
{
|
||||
void *p;
|
||||
|
||||
if (SPA_UNLIKELY (arr->alloc < arr->size + size))
|
||||
return NULL;
|
||||
|
||||
p = arr->data + arr->size;
|
||||
arr->size += size;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
|
|
|||
83
pinos/client/list.h
Normal file
83
pinos/client/list.h
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
/* Simple Plugin API
|
||||
* Copyright (C) 2016 Wim Taymans <wim.taymans@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __PINOS_LIST_H__
|
||||
#define __PINOS_LIST_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _PinosList PinosList;
|
||||
|
||||
#include <spa/defs.h>
|
||||
|
||||
struct _PinosList {
|
||||
PinosList *next;
|
||||
PinosList *prev;
|
||||
};
|
||||
|
||||
static inline void
|
||||
pinos_list_init (PinosList *list)
|
||||
{
|
||||
list->next = list;
|
||||
list->prev = list;
|
||||
}
|
||||
|
||||
static inline void
|
||||
pinos_list_insert (PinosList *list,
|
||||
PinosList *elem)
|
||||
{
|
||||
elem->prev = list;
|
||||
elem->next = list->next;
|
||||
list->next = elem;
|
||||
elem->next->prev = elem;
|
||||
}
|
||||
|
||||
static inline void
|
||||
pinos_list_remove (PinosList *elem)
|
||||
{
|
||||
elem->prev->next = elem->next;
|
||||
elem->next->prev = elem->prev;
|
||||
elem->next = NULL;
|
||||
elem->prev = NULL;
|
||||
}
|
||||
|
||||
#define PINOS_CONTAINER_OF(ptr, sample, member) \
|
||||
(__typeof__(sample))((char *)(ptr) - \
|
||||
offsetof(__typeof__(*sample), member))
|
||||
|
||||
#define PINOS_LIST_FOREACH(pos, head, member) \
|
||||
for (pos = PINOS_CONTAINER_OF((head)->next, pos, member); \
|
||||
&pos->member != (head); \
|
||||
pos = PINOS_CONTAINER_OF(pos->member.next, pos, member))
|
||||
|
||||
#define PINOS_LIST_FOREACH_SAFE(pos, tmp, head, member) \
|
||||
for (pos = PINOS_CONTAINER_OF((head)->next, pos, member), \
|
||||
tmp = PINOS_CONTAINER_OF((pos)->member.next, tmp, member); \
|
||||
&pos->member != (head); \
|
||||
pos = tmp, \
|
||||
tmp = PINOS_CONTAINER_OF(pos->member.next, tmp, member))
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* __PINOS_LIST_H__ */
|
||||
67
pinos/client/object.h
Normal file
67
pinos/client/object.h
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
/* Pinos
|
||||
* Copyright (C) 2015 Wim Taymans <wim.taymans@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __PINOS_OBJECT_H__
|
||||
#define __PINOS_OBJECT_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <pinos/client/signal.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _PinosObject PinosObject;
|
||||
|
||||
typedef enum {
|
||||
PINOS_OBJECT_FLAG_NONE = 0,
|
||||
PINOS_OBJECT_FLAG_DESTROYING = (1 << 0),
|
||||
} PinosObjectFlags;
|
||||
|
||||
typedef void (*PinosDestroyFunc) (PinosObject *object);
|
||||
|
||||
struct _PinosObject {
|
||||
uint32_t type;
|
||||
uint32_t id;
|
||||
void *implementation;
|
||||
PinosObjectFlags flags;
|
||||
PinosDestroyFunc destroy;
|
||||
PinosSignal destroy_signal;
|
||||
};
|
||||
|
||||
static inline void
|
||||
pinos_object_init (PinosObject *object,
|
||||
uint32_t type,
|
||||
void *implementation,
|
||||
PinosDestroyFunc destroy)
|
||||
{
|
||||
object->type = type;
|
||||
object->id = SPA_ID_INVALID;
|
||||
object->implementation = implementation;
|
||||
object->destroy = destroy;
|
||||
pinos_signal_init (&object->destroy_signal);
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __PINOS_OBJECT_H__ */
|
||||
|
|
@ -18,25 +18,68 @@
|
|||
*/
|
||||
|
||||
#include <sys/syscall.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "rtkit.h"
|
||||
|
||||
#include <gio/gio.h>
|
||||
|
||||
struct _PinosRTKitBus {
|
||||
GDBusConnection *bus;
|
||||
};
|
||||
|
||||
static pid_t _gettid(void) {
|
||||
return (pid_t) syscall(SYS_gettid);
|
||||
}
|
||||
|
||||
gboolean
|
||||
pinos_rtkit_make_realtime (GDBusConnection *system_bus,
|
||||
static int
|
||||
translate_error (GError *error)
|
||||
{
|
||||
const gchar *name = g_dbus_error_get_remote_error (error);
|
||||
|
||||
if (strcmp (name, "org.freedesktop.DBus.Error.NoMemory") == 0)
|
||||
return -ENOMEM;
|
||||
if (strcmp (name, "org.freedesktop.DBus.Error.ServiceUnknown") == 0 ||
|
||||
strcmp (name, "org.freedesktop.DBus.Error.NameHasNoOwner") == 0)
|
||||
return -ENOENT;
|
||||
if (strcmp (name, "org.freedesktop.DBus.Error.AccessDenied") == 0 ||
|
||||
strcmp (name, "org.freedesktop.DBus.Error.AuthFailed") == 0)
|
||||
return -EACCES;
|
||||
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
PinosRTKitBus *
|
||||
pinos_rtkit_bus_get_system (void)
|
||||
{
|
||||
PinosRTKitBus *bus;
|
||||
|
||||
bus = g_slice_new (PinosRTKitBus);
|
||||
bus->bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL);
|
||||
|
||||
return bus;
|
||||
}
|
||||
|
||||
void
|
||||
pinos_rtkit_bus_free (PinosRTKitBus *system_bus)
|
||||
{
|
||||
g_object_unref (system_bus->bus);
|
||||
g_slice_free (PinosRTKitBus, system_bus);
|
||||
}
|
||||
|
||||
int
|
||||
pinos_rtkit_make_realtime (PinosRTKitBus *system_bus,
|
||||
pid_t thread,
|
||||
gint priority,
|
||||
GError **error)
|
||||
int priority)
|
||||
{
|
||||
GVariant *v;
|
||||
GError *error = NULL;
|
||||
|
||||
if (thread == 0)
|
||||
thread = _gettid();
|
||||
|
||||
v = g_dbus_connection_call_sync (system_bus,
|
||||
v = g_dbus_connection_call_sync (system_bus->bus,
|
||||
RTKIT_SERVICE_NAME,
|
||||
RTKIT_OBJECT_PATH,
|
||||
"org.freedesktop.RealtimeKit1",
|
||||
|
|
@ -48,25 +91,27 @@ pinos_rtkit_make_realtime (GDBusConnection *system_bus,
|
|||
G_DBUS_CALL_FLAGS_NONE,
|
||||
-1,
|
||||
NULL,
|
||||
error);
|
||||
if (v)
|
||||
g_variant_unref (v);
|
||||
&error);
|
||||
if (v == NULL)
|
||||
return translate_error (error);
|
||||
|
||||
return v != NULL;
|
||||
g_variant_unref (v);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
gboolean
|
||||
pinos_rtkit_make_high_priority (GDBusConnection *system_bus,
|
||||
int
|
||||
pinos_rtkit_make_high_priority (PinosRTKitBus *system_bus,
|
||||
pid_t thread,
|
||||
gint nice_level,
|
||||
GError **error)
|
||||
int nice_level)
|
||||
{
|
||||
GVariant *v;
|
||||
GError *error = NULL;
|
||||
|
||||
if (thread == 0)
|
||||
thread = _gettid();
|
||||
|
||||
v = g_dbus_connection_call_sync (system_bus,
|
||||
v = g_dbus_connection_call_sync (system_bus->bus,
|
||||
RTKIT_SERVICE_NAME,
|
||||
RTKIT_OBJECT_PATH,
|
||||
"org.freedesktop.RealtimeKit1",
|
||||
|
|
@ -78,19 +123,20 @@ pinos_rtkit_make_high_priority (GDBusConnection *system_bus,
|
|||
G_DBUS_CALL_FLAGS_NONE,
|
||||
-1,
|
||||
NULL,
|
||||
error);
|
||||
if (v)
|
||||
g_variant_unref (v);
|
||||
&error);
|
||||
if (v == NULL)
|
||||
return translate_error (error);
|
||||
g_variant_unref (v);
|
||||
|
||||
return v != NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pinos_rtkit_get_max_realtime_priority (GDBusConnection *system_bus)
|
||||
int pinos_rtkit_get_max_realtime_priority (PinosRTKitBus *system_bus)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pinos_rtkit_get_min_nice_level (GDBusConnection *system_bus, int* min_nice_level)
|
||||
int pinos_rtkit_get_min_nice_level (PinosRTKitBus *system_bus, int* min_nice_level)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -98,7 +144,7 @@ int pinos_rtkit_get_min_nice_level (GDBusConnection *system_bus, int* min_nice_l
|
|||
/* Return the maximum value of RLIMIT_RTTIME to set before attempting a
|
||||
* realtime request. A negative value is an errno style error code.
|
||||
*/
|
||||
long long rtkit_get_rttime_usec_max (GDBusConnection *system_bus)
|
||||
long long pinos_rtkit_get_rttime_usec_max (PinosRTKitBus *system_bus)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,49 +20,59 @@
|
|||
#ifndef __PINOS_RTKIT_H__
|
||||
#define __PINOS_RTKIT_H__
|
||||
|
||||
#include <gio/gio.h>
|
||||
#include <glib-object.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define RTKIT_SERVICE_NAME "org.freedesktop.RealtimeKit1"
|
||||
#define RTKIT_OBJECT_PATH "/org/freedesktop/RealtimeKit1"
|
||||
|
||||
typedef struct _PinosRTKitBus PinosRTKitBus;
|
||||
|
||||
PinosRTKitBus * pinos_rtkit_bus_get_system (void);
|
||||
void pinos_rtkit_bus_free (PinosRTKitBus *system_bus);
|
||||
|
||||
|
||||
/* This is mostly equivalent to sched_setparam(thread, SCHED_RR, {
|
||||
* .sched_priority = priority }). 'thread' needs to be a kernel thread
|
||||
* id as returned by gettid(), not a pthread_t! If 'thread' is 0 the
|
||||
* current thread is used.
|
||||
*/
|
||||
gboolean pinos_rtkit_make_realtime (GDBusConnection *system_bus,
|
||||
pid_t thread,
|
||||
gint priority,
|
||||
GError **error);
|
||||
* current thread is used. The returned value is a negative errno
|
||||
* style error code, or 0 on success. */
|
||||
int pinos_rtkit_make_realtime (PinosRTKitBus *system_bus,
|
||||
pid_t thread,
|
||||
int priority);
|
||||
|
||||
|
||||
/* This is mostly equivalent to setpriority(PRIO_PROCESS, thread,
|
||||
* nice_level). 'thread' needs to be a kernel thread id as returned by
|
||||
* gettid(), not a pthread_t! If 'thread' is 0 the current thread is
|
||||
* used. */
|
||||
gboolean pinos_rtkit_make_high_priority (GDBusConnection *system_bus,
|
||||
pid_t thread,
|
||||
gint nice_level,
|
||||
GError **error);
|
||||
* used. The returned value is a negative errno style error code, or
|
||||
* 0 on success. */
|
||||
int pinos_rtkit_make_high_priority (PinosRTKitBus *system_bus,
|
||||
pid_t thread,
|
||||
int nice_level);
|
||||
|
||||
/* Return the maximum value of realtime priority available. Realtime requests
|
||||
* above this value will fail. A negative value is an errno style error code.
|
||||
*/
|
||||
int pinos_rtkit_get_max_realtime_priority (GDBusConnection *system_bus);
|
||||
int pinos_rtkit_get_max_realtime_priority (PinosRTKitBus *system_bus);
|
||||
|
||||
/* Retreive the minimum value of nice level available. High prio requests
|
||||
* below this value will fail. The returned value is a negative errno
|
||||
* style error code, or 0 on success.*/
|
||||
int pinos_rtkit_get_min_nice_level (GDBusConnection *system_bus, int* min_nice_level);
|
||||
int pinos_rtkit_get_min_nice_level (PinosRTKitBus *system_bus,
|
||||
int *min_nice_level);
|
||||
|
||||
/* Return the maximum value of RLIMIT_RTTIME to set before attempting a
|
||||
* realtime request. A negative value is an errno style error code.
|
||||
*/
|
||||
long long rtkit_get_rttime_usec_max (GDBusConnection *system_bus);
|
||||
long long pinos_rtkit_get_rttime_usec_max (PinosRTKitBus *system_bus);
|
||||
|
||||
G_END_DECLS
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __PINOS_RTKIT_H__ */
|
||||
|
|
|
|||
69
pinos/client/signal.h
Normal file
69
pinos/client/signal.h
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
/* Pinos
|
||||
* Copyright (C) 2015 Wim Taymans <wim.taymans@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __PINOS_SIGNAL_H__
|
||||
#define __PINOS_SIGNAL_H__
|
||||
|
||||
#include <pinos/client/list.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _PinosSignal PinosSignal;
|
||||
typedef struct _PinosListener PinosListener;
|
||||
|
||||
struct _PinosListener {
|
||||
PinosList link;
|
||||
void (*notify) (PinosListener *listener, void *data);
|
||||
void *user_data;
|
||||
};
|
||||
|
||||
struct _PinosSignal {
|
||||
PinosList listeners;
|
||||
};
|
||||
|
||||
static inline void
|
||||
pinos_signal_init (PinosSignal *signal)
|
||||
{
|
||||
pinos_list_init (&signal->listeners);
|
||||
}
|
||||
|
||||
static inline void
|
||||
pinos_signal_add (PinosSignal *signal,
|
||||
PinosListener *listener)
|
||||
{
|
||||
pinos_list_insert (signal->listeners.prev, &listener->link);
|
||||
}
|
||||
|
||||
static inline void
|
||||
pinos_signal_emit (PinosSignal *signal,
|
||||
void *data)
|
||||
{
|
||||
PinosListener *l, *next;
|
||||
|
||||
PINOS_LIST_FOREACH_SAFE (l, next, &signal->listeners, link)
|
||||
l->notify (l, data);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __PINOS_SIGNAL_H__ */
|
||||
|
|
@ -142,7 +142,7 @@ clear_buffers (PinosStream *stream)
|
|||
PinosStreamPrivate *priv = stream->priv;
|
||||
BufferId *bid;
|
||||
|
||||
pinos_array_for_each (bid, &priv->buffer_ids) {
|
||||
PINOS_ARRAY_FOREACH (bid, &priv->buffer_ids) {
|
||||
g_signal_emit (stream, signals[SIGNAL_REMOVE_BUFFER], 0, bid->id);
|
||||
bid->buf = NULL;
|
||||
}
|
||||
|
|
@ -730,7 +730,7 @@ find_mem (PinosStream *stream, uint32_t id)
|
|||
PinosStreamPrivate *priv = stream->priv;
|
||||
MemId *mid;
|
||||
|
||||
pinos_array_for_each (mid, &priv->mem_ids) {
|
||||
PINOS_ARRAY_FOREACH (mid, &priv->mem_ids) {
|
||||
if (mid->id == id)
|
||||
return mid;
|
||||
}
|
||||
|
|
@ -747,7 +747,7 @@ find_buffer (PinosStream *stream, uint32_t id)
|
|||
} else {
|
||||
BufferId *bid;
|
||||
|
||||
pinos_array_for_each (bid, &priv->buffer_ids) {
|
||||
PINOS_ARRAY_FOREACH (bid, &priv->buffer_ids) {
|
||||
if (bid->id == id)
|
||||
return bid;
|
||||
}
|
||||
|
|
@ -1378,61 +1378,6 @@ exit_error:
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
on_node_registered (GObject *source_object,
|
||||
GAsyncResult *res,
|
||||
gpointer user_data)
|
||||
{
|
||||
PinosStream *stream = user_data;
|
||||
PinosStreamPrivate *priv = stream->priv;
|
||||
PinosContext *context = priv->context;
|
||||
GVariant *ret;
|
||||
GError *error = NULL;
|
||||
GUnixFDList *fd_list;
|
||||
gint fd_idx, fd;
|
||||
|
||||
g_assert (context->priv->daemon == G_DBUS_PROXY (source_object));
|
||||
|
||||
ret = g_dbus_proxy_call_with_unix_fd_list_finish (context->priv->daemon,
|
||||
&fd_list,
|
||||
res, &error);
|
||||
if (ret == NULL)
|
||||
goto create_failed;
|
||||
|
||||
g_variant_get (ret, "(h)", &fd_idx);
|
||||
g_variant_unref (ret);
|
||||
|
||||
if ((fd = g_unix_fd_list_get (fd_list, fd_idx, &error)) < 0)
|
||||
goto fd_failed;
|
||||
|
||||
priv->fd = fd;
|
||||
g_object_unref (fd_list);
|
||||
|
||||
handle_socket (stream, -1, priv->fd);
|
||||
|
||||
return;
|
||||
|
||||
/* ERRORS */
|
||||
create_failed:
|
||||
{
|
||||
pinos_log_warn ("failed to connect: %s", error->message);
|
||||
goto exit_error;
|
||||
}
|
||||
fd_failed:
|
||||
{
|
||||
pinos_log_warn ("failed to get FD: %s", error->message);
|
||||
g_object_unref (fd_list);
|
||||
goto exit_error;
|
||||
}
|
||||
exit_error:
|
||||
{
|
||||
stream_set_state (stream, PINOS_STREAM_STATE_ERROR, error);
|
||||
g_object_unref (stream);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
do_connect (PinosStream *stream)
|
||||
{
|
||||
|
|
@ -1445,38 +1390,16 @@ do_connect (PinosStream *stream)
|
|||
pinos_properties_set (priv->properties,
|
||||
"pinos.target.node", priv->path);
|
||||
|
||||
if (FALSE) {
|
||||
PinosClientNode1 *iface;
|
||||
|
||||
iface = pinos_client_node1_skeleton_new ();
|
||||
|
||||
g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (iface),
|
||||
priv->context->priv->connection,
|
||||
"/org/pinos/stream",
|
||||
NULL);
|
||||
|
||||
g_dbus_proxy_call (context->priv->daemon,
|
||||
"RegisterClientNode",
|
||||
g_variant_new ("(@a{sv}o)",
|
||||
pinos_properties_to_variant (priv->properties),
|
||||
"/org/pinos/stream"),
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
-1,
|
||||
NULL, /* GCancellable *cancellable */
|
||||
on_node_registered,
|
||||
stream);
|
||||
} else {
|
||||
g_dbus_proxy_call (context->priv->daemon,
|
||||
"CreateClientNode",
|
||||
g_variant_new ("(s@a{sv})",
|
||||
"client-node",
|
||||
pinos_properties_to_variant (priv->properties)),
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
-1,
|
||||
NULL, /* GCancellable *cancellable */
|
||||
on_node_created,
|
||||
stream);
|
||||
}
|
||||
g_dbus_proxy_call (context->priv->daemon,
|
||||
"CreateClientNode",
|
||||
g_variant_new ("(s@a{sv})",
|
||||
"client-node",
|
||||
pinos_properties_to_variant (priv->properties)),
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
-1,
|
||||
NULL, /* GCancellable *cancellable */
|
||||
on_node_created,
|
||||
stream);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -1783,7 +1706,7 @@ pinos_stream_get_empty_buffer (PinosStream *stream)
|
|||
priv = stream->priv;
|
||||
g_return_val_if_fail (priv->direction == SPA_DIRECTION_OUTPUT, FALSE);
|
||||
|
||||
pinos_array_for_each (bid, &priv->buffer_ids) {
|
||||
PINOS_ARRAY_FOREACH (bid, &priv->buffer_ids) {
|
||||
if (!bid->used)
|
||||
return bid->id;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue