mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	Beginnings of dbus based control
This commit is contained in:
		
							parent
							
								
									becae3e7fa
								
							
						
					
					
						commit
						ee202e13e9
					
				
					 19 changed files with 2086 additions and 28 deletions
				
			
		| 
						 | 
				
			
			@ -20,6 +20,7 @@ pinos_sources = [
 | 
			
		|||
  'pinos.c',
 | 
			
		||||
  'ringbuffer.c',
 | 
			
		||||
  'subscribe.c',
 | 
			
		||||
  gdbus_target,
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
install_headers(pinos_headers, subdir : 'pinos/client')
 | 
			
		||||
| 
						 | 
				
			
			@ -44,7 +45,6 @@ enumtypes_c = custom_target('enumtypes_c',
 | 
			
		|||
libpinos_c_args = [
 | 
			
		||||
  '-DHAVE_CONFIG_H',
 | 
			
		||||
  '-D_GNU_SOURCE',
 | 
			
		||||
  '-DG_LOG_DOMAIN=g_log_domain_pinos',
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,6 +29,7 @@
 | 
			
		|||
#include <gio/gunixfdlist.h>
 | 
			
		||||
#include <gio/gunixfdmessage.h>
 | 
			
		||||
 | 
			
		||||
#include "pinos/dbus/org-pinos.h"
 | 
			
		||||
#include "pinos/server/daemon.h"
 | 
			
		||||
#include "pinos/client/pinos.h"
 | 
			
		||||
#include "pinos/client/context.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -1431,6 +1432,60 @@ 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, priv->fd);
 | 
			
		||||
 | 
			
		||||
  return;
 | 
			
		||||
 | 
			
		||||
  /* ERRORS */
 | 
			
		||||
create_failed:
 | 
			
		||||
  {
 | 
			
		||||
    g_warning ("failed to connect: %s", error->message);
 | 
			
		||||
    goto exit_error;
 | 
			
		||||
  }
 | 
			
		||||
fd_failed:
 | 
			
		||||
  {
 | 
			
		||||
    g_warning ("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)
 | 
			
		||||
| 
						 | 
				
			
			@ -1444,16 +1499,38 @@ do_connect (PinosStream *stream)
 | 
			
		|||
    pinos_properties_set (priv->properties,
 | 
			
		||||
                          "pinos.target.node", priv->path);
 | 
			
		||||
 | 
			
		||||
  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);
 | 
			
		||||
  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);
 | 
			
		||||
  }
 | 
			
		||||
  return FALSE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -52,6 +52,12 @@
 | 
			
		|||
      <arg type='h' name='fd' direction='out'/>
 | 
			
		||||
    </method>
 | 
			
		||||
 | 
			
		||||
    <method name='RegisterClientNode'>
 | 
			
		||||
      <arg type='a{sv}' name='properties' direction='in'/>
 | 
			
		||||
      <arg type='o' name='node' direction='in'/>
 | 
			
		||||
      <arg type='h' name='fd' direction='out'/>
 | 
			
		||||
    </method>
 | 
			
		||||
 | 
			
		||||
  </interface>
 | 
			
		||||
 | 
			
		||||
  <interface name='org.pinos.Client1'>
 | 
			
		||||
| 
						 | 
				
			
			@ -112,6 +118,79 @@
 | 
			
		|||
    <method name='Remove'/>
 | 
			
		||||
  </interface>
 | 
			
		||||
 | 
			
		||||
  <interface name='org.pinos.ClientNode1'>
 | 
			
		||||
    <!-- Info: extra node info -->
 | 
			
		||||
    <property name='Info' type='a{sv}' access='read' />
 | 
			
		||||
    <!-- State: the node state -->
 | 
			
		||||
    <property name='State' type='u' access='read' />
 | 
			
		||||
 | 
			
		||||
    <property type='a{sv}' name='props' access='read'/>
 | 
			
		||||
 | 
			
		||||
    <property type='u' name='max_input_ports' access='read'/>
 | 
			
		||||
    <property type='au' name='input_ports' access='read'/>
 | 
			
		||||
    <property type='u' name='max_output_ports' access='read'/>
 | 
			
		||||
    <property type='uau' name='output_ports' access='read'/>
 | 
			
		||||
 | 
			
		||||
    <method name='SetProps'>
 | 
			
		||||
      <arg type='a{sv}' name='props' direction='in'/>
 | 
			
		||||
    </method>
 | 
			
		||||
 | 
			
		||||
    <method name='SendCommand'>
 | 
			
		||||
      <arg type='sv' name='command' direction='in'/>
 | 
			
		||||
    </method>
 | 
			
		||||
 | 
			
		||||
    <signal name='Event'>
 | 
			
		||||
      <arg type='sv' name='event'/>
 | 
			
		||||
    </signal>
 | 
			
		||||
 | 
			
		||||
    <method name='AddPort'>
 | 
			
		||||
      <arg type='uu' name='port' direction='in'/>
 | 
			
		||||
    </method>
 | 
			
		||||
    <method name='RemovePort'>
 | 
			
		||||
      <arg type='uu' name='port' direction='in'/>
 | 
			
		||||
    </method>
 | 
			
		||||
 | 
			
		||||
    <method name='GetPortInfo'>
 | 
			
		||||
      <arg type='uu' name='port' direction='in'/>
 | 
			
		||||
      <arg type='a{sv}' name='props' direction='out'/>
 | 
			
		||||
      <arg type='ay' name='format' direction='out'/>
 | 
			
		||||
      <arg type='ay' name='info' direction='out'/>
 | 
			
		||||
    </method>
 | 
			
		||||
 | 
			
		||||
    <method name='PortEnumFormats'>
 | 
			
		||||
      <arg type='uu' name='port' direction='in'/>
 | 
			
		||||
      <arg type='ay' name='filter' direction='in'/>
 | 
			
		||||
      <arg type='x' name='state' direction='in'/>
 | 
			
		||||
      <arg type='ay' name='format' direction='out'/>
 | 
			
		||||
      <arg type='x' name='new_state' direction='out'/>
 | 
			
		||||
    </method>
 | 
			
		||||
 | 
			
		||||
    <method name='PortSetFormat'>
 | 
			
		||||
      <arg type='uu' name='port' direction='in'/>
 | 
			
		||||
      <arg type='u' name='flags' direction='in'/>
 | 
			
		||||
      <arg type='ay' name='format' direction='in'/>
 | 
			
		||||
    </method>
 | 
			
		||||
 | 
			
		||||
    <signal name='PortChanged'>
 | 
			
		||||
      <arg type='uu' name='port'/>
 | 
			
		||||
      <arg type='u' name='mask'/>
 | 
			
		||||
      <arg type='a{sv}' name='props'/>
 | 
			
		||||
      <arg type='ay' name='format'/>
 | 
			
		||||
      <arg type='ay' name='info'/>
 | 
			
		||||
    </signal>
 | 
			
		||||
 | 
			
		||||
    <method name='PortSetProps'>
 | 
			
		||||
      <arg type='uu' name='port' direction='in'/>
 | 
			
		||||
      <arg type='a{sv}' name='props' direction='in'/>
 | 
			
		||||
    </method>
 | 
			
		||||
 | 
			
		||||
    <method name='PortUseBuffers'>
 | 
			
		||||
      <arg type='uu' name='port' direction='in'/>
 | 
			
		||||
      <arg type='ah' name='mem' direction='in'/>
 | 
			
		||||
      <arg type='ay' name='buffers' direction='in'/>
 | 
			
		||||
    </method>
 | 
			
		||||
  </interface>
 | 
			
		||||
 | 
			
		||||
  <interface name='org.pinos.Link1'>
 | 
			
		||||
    <!-- Owner: the owner path of this link -->
 | 
			
		||||
    <property name='Owner' type='s' access='read' />
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,9 +33,6 @@
 | 
			
		|||
 | 
			
		||||
#include "pinos/server/daemon.h"
 | 
			
		||||
#include "pinos/server/client-node.h"
 | 
			
		||||
#include "pinos/server/link.h"
 | 
			
		||||
 | 
			
		||||
#include "pinos/dbus/org-pinos.h"
 | 
			
		||||
 | 
			
		||||
#include "spa/include/spa/control.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -30,6 +30,7 @@
 | 
			
		|||
#include "pinos/server/daemon.h"
 | 
			
		||||
#include "pinos/server/node.h"
 | 
			
		||||
#include "pinos/server/client-node.h"
 | 
			
		||||
#include "pinos/server/dbus-client-node.h"
 | 
			
		||||
#include "pinos/server/client.h"
 | 
			
		||||
#include "pinos/server/link.h"
 | 
			
		||||
#include "pinos/server/rt-loop.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -426,6 +427,66 @@ exit_error:
 | 
			
		|||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
handle_register_client_node (PinosDaemon1           *interface,
 | 
			
		||||
                             GDBusMethodInvocation  *invocation,
 | 
			
		||||
                             GVariant               *arg_properties,
 | 
			
		||||
                             const gchar            *arg_path,
 | 
			
		||||
                             gpointer                user_data)
 | 
			
		||||
{
 | 
			
		||||
  PinosDaemon *daemon = user_data;
 | 
			
		||||
  PinosNode *node;
 | 
			
		||||
  PinosClient *client;
 | 
			
		||||
  const gchar *sender;
 | 
			
		||||
  PinosProperties *props;
 | 
			
		||||
  GError *error = NULL;
 | 
			
		||||
  GUnixFDList *fdlist;
 | 
			
		||||
  gint fdidx;
 | 
			
		||||
  GSocket *socket;
 | 
			
		||||
 | 
			
		||||
  sender = g_dbus_method_invocation_get_sender (invocation);
 | 
			
		||||
  client = sender_get_client (daemon, sender, TRUE);
 | 
			
		||||
 | 
			
		||||
  g_debug ("daemon %p: register client-node: %s", daemon, sender);
 | 
			
		||||
  props = pinos_properties_from_variant (arg_properties);
 | 
			
		||||
 | 
			
		||||
  node =  pinos_dbus_client_node_new (daemon,
 | 
			
		||||
                                      client,
 | 
			
		||||
                                      arg_path,
 | 
			
		||||
                                      props);
 | 
			
		||||
  pinos_properties_free (props);
 | 
			
		||||
 | 
			
		||||
  socket = pinos_dbus_client_node_get_socket_pair (PINOS_DBUS_CLIENT_NODE (node), &error);
 | 
			
		||||
  if (socket == NULL)
 | 
			
		||||
    goto no_socket;
 | 
			
		||||
 | 
			
		||||
  pinos_client_add_object (client, G_OBJECT (node));
 | 
			
		||||
  g_object_unref (node);
 | 
			
		||||
 | 
			
		||||
  fdlist = g_unix_fd_list_new ();
 | 
			
		||||
  fdidx = g_unix_fd_list_append (fdlist, g_socket_get_fd (socket), &error);
 | 
			
		||||
  g_object_unref (socket);
 | 
			
		||||
 | 
			
		||||
  g_dbus_method_invocation_return_value_with_unix_fd_list (invocation,
 | 
			
		||||
           g_variant_new ("(h)", fdidx), fdlist);
 | 
			
		||||
  g_object_unref (fdlist);
 | 
			
		||||
 | 
			
		||||
  return TRUE;
 | 
			
		||||
 | 
			
		||||
no_socket:
 | 
			
		||||
  {
 | 
			
		||||
    g_debug ("daemon %p: could not create socket %s", daemon, error->message);
 | 
			
		||||
    g_object_unref (node);
 | 
			
		||||
    goto exit_error;
 | 
			
		||||
  }
 | 
			
		||||
exit_error:
 | 
			
		||||
  {
 | 
			
		||||
    g_dbus_method_invocation_return_gerror (invocation, error);
 | 
			
		||||
    g_clear_error (&error);
 | 
			
		||||
    return TRUE;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
export_server_object (PinosDaemon              *daemon,
 | 
			
		||||
                      GDBusObjectManagerServer *manager)
 | 
			
		||||
| 
						 | 
				
			
			@ -941,6 +1002,7 @@ pinos_daemon_init (PinosDaemon * daemon)
 | 
			
		|||
  priv->iface = pinos_daemon1_skeleton_new ();
 | 
			
		||||
  g_signal_connect (priv->iface, "handle-create-node", (GCallback) handle_create_node, daemon);
 | 
			
		||||
  g_signal_connect (priv->iface, "handle-create-client-node", (GCallback) handle_create_client_node, daemon);
 | 
			
		||||
  g_signal_connect (priv->iface, "handle-register-client-node", (GCallback) handle_register_client_node, daemon);
 | 
			
		||||
 | 
			
		||||
  priv->server_manager = g_dbus_object_manager_server_new (PINOS_DBUS_OBJECT_PREFIX);
 | 
			
		||||
  priv->clients = g_hash_table_new (g_str_hash, g_str_equal);
 | 
			
		||||
| 
						 | 
				
			
			@ -950,7 +1012,6 @@ pinos_daemon_init (PinosDaemon * daemon)
 | 
			
		|||
                                                g_object_unref);
 | 
			
		||||
  priv->loop = pinos_rtloop_new();
 | 
			
		||||
 | 
			
		||||
  priv->main_loop.handle = NULL;
 | 
			
		||||
  priv->main_loop.size = sizeof (SpaPoll);
 | 
			
		||||
  priv->main_loop.info = NULL;
 | 
			
		||||
  priv->main_loop.info = NULL;
 | 
			
		||||
| 
						 | 
				
			
			@ -958,7 +1019,6 @@ pinos_daemon_init (PinosDaemon * daemon)
 | 
			
		|||
  priv->main_loop.update_item = do_update_item;
 | 
			
		||||
  priv->main_loop.remove_item = do_remove_item;
 | 
			
		||||
 | 
			
		||||
  priv->log.handle = NULL;
 | 
			
		||||
  priv->log.size = sizeof (SpaLog);
 | 
			
		||||
  priv->log.info = NULL;
 | 
			
		||||
  priv->log.level = SPA_LOG_LEVEL_INFO;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										334
									
								
								pinos/server/dbus-client-node.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										334
									
								
								pinos/server/dbus-client-node.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,334 @@
 | 
			
		|||
/* 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <sys/socket.h>
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include <sys/mman.h>
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
#include <fcntl.h>
 | 
			
		||||
#include <dlfcn.h>
 | 
			
		||||
#include <poll.h>
 | 
			
		||||
#include <sys/eventfd.h>
 | 
			
		||||
 | 
			
		||||
#include "pinos/client/pinos.h"
 | 
			
		||||
#include "pinos/client/enumtypes.h"
 | 
			
		||||
#include "pinos/client/private.h"
 | 
			
		||||
 | 
			
		||||
#include "pinos/server/daemon.h"
 | 
			
		||||
#include "pinos/server/dbus-client-node.h"
 | 
			
		||||
 | 
			
		||||
#include "pinos/dbus/org-pinos.h"
 | 
			
		||||
 | 
			
		||||
#include "spa/include/spa/control.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
struct _PinosDBusClientNodePrivate
 | 
			
		||||
{
 | 
			
		||||
  int fd;
 | 
			
		||||
  GSocket *sockets[2];
 | 
			
		||||
  SpaHandle *handle;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define PINOS_DBUS_CLIENT_NODE_GET_PRIVATE(obj)  \
 | 
			
		||||
   (G_TYPE_INSTANCE_GET_PRIVATE ((obj), PINOS_TYPE_DBUS_CLIENT_NODE, PinosDBusClientNodePrivate))
 | 
			
		||||
 | 
			
		||||
G_DEFINE_TYPE (PinosDBusClientNode, pinos_dbus_client_node, PINOS_TYPE_NODE);
 | 
			
		||||
 | 
			
		||||
enum
 | 
			
		||||
{
 | 
			
		||||
  PROP_0,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum
 | 
			
		||||
{
 | 
			
		||||
  SIGNAL_NONE,
 | 
			
		||||
  LAST_SIGNAL
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
//static guint signals[LAST_SIGNAL] = { 0 };
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
pinos_dbus_client_node_get_property (GObject    *_object,
 | 
			
		||||
                                  guint       prop_id,
 | 
			
		||||
                                  GValue     *value,
 | 
			
		||||
                                  GParamSpec *pspec)
 | 
			
		||||
{
 | 
			
		||||
  PinosDBusClientNode *node = PINOS_DBUS_CLIENT_NODE (_object);
 | 
			
		||||
 | 
			
		||||
  switch (prop_id) {
 | 
			
		||||
    default:
 | 
			
		||||
      G_OBJECT_WARN_INVALID_PROPERTY_ID (node, prop_id, pspec);
 | 
			
		||||
      break;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
pinos_dbus_client_node_set_property (GObject      *_object,
 | 
			
		||||
                            guint         prop_id,
 | 
			
		||||
                            const GValue *value,
 | 
			
		||||
                            GParamSpec   *pspec)
 | 
			
		||||
{
 | 
			
		||||
  PinosDBusClientNode *node = PINOS_DBUS_CLIENT_NODE (_object);
 | 
			
		||||
 | 
			
		||||
  switch (prop_id) {
 | 
			
		||||
    default:
 | 
			
		||||
      G_OBJECT_WARN_INVALID_PROPERTY_ID (node, prop_id, pspec);
 | 
			
		||||
      break;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * pinos_dbus_client_node_get_socket_pair:
 | 
			
		||||
 * @node: a #PinosDBusClientNode
 | 
			
		||||
 * @error: a #GError
 | 
			
		||||
 *
 | 
			
		||||
 * Create or return a previously create socket pair for @node. The
 | 
			
		||||
 * Socket for the other end is returned.
 | 
			
		||||
 *
 | 
			
		||||
 * Returns: a #GSocket that can be used to send/receive buffers to node.
 | 
			
		||||
 */
 | 
			
		||||
GSocket *
 | 
			
		||||
pinos_dbus_client_node_get_socket_pair (PinosDBusClientNode  *this,
 | 
			
		||||
                                   GError          **error)
 | 
			
		||||
{
 | 
			
		||||
  PinosNode *node;
 | 
			
		||||
  PinosDBusClientNodePrivate *priv;
 | 
			
		||||
 | 
			
		||||
  g_return_val_if_fail (PINOS_IS_DBUS_CLIENT_NODE (this), FALSE);
 | 
			
		||||
  node = PINOS_NODE (this);
 | 
			
		||||
  priv = this->priv;
 | 
			
		||||
 | 
			
		||||
  if (priv->sockets[1] == NULL) {
 | 
			
		||||
    SpaProps *props;
 | 
			
		||||
    SpaPropValue value;
 | 
			
		||||
    int fd[2];
 | 
			
		||||
 | 
			
		||||
    if (socketpair (AF_UNIX, SOCK_STREAM, 0, fd) != 0)
 | 
			
		||||
      goto no_sockets;
 | 
			
		||||
 | 
			
		||||
    priv->sockets[0] = g_socket_new_from_fd (fd[0], error);
 | 
			
		||||
    if (priv->sockets[0] == NULL)
 | 
			
		||||
      goto create_failed;
 | 
			
		||||
 | 
			
		||||
    priv->sockets[1] = g_socket_new_from_fd (fd[1], error);
 | 
			
		||||
    if (priv->sockets[1] == NULL)
 | 
			
		||||
      goto create_failed;
 | 
			
		||||
 | 
			
		||||
    priv->fd = g_socket_get_fd (priv->sockets[0]);
 | 
			
		||||
 | 
			
		||||
    spa_node_get_props (node->node, &props);
 | 
			
		||||
    value.value = &priv->fd;
 | 
			
		||||
    value.size = sizeof (int);
 | 
			
		||||
    spa_props_set_value (props, spa_props_index_for_name (props, "socket"), &value);
 | 
			
		||||
    spa_node_set_props (node->node, props);
 | 
			
		||||
  }
 | 
			
		||||
  return g_object_ref (priv->sockets[1]);
 | 
			
		||||
 | 
			
		||||
  /* ERRORS */
 | 
			
		||||
no_sockets:
 | 
			
		||||
  {
 | 
			
		||||
    g_set_error (error,
 | 
			
		||||
                 G_IO_ERROR,
 | 
			
		||||
                 g_io_error_from_errno (errno),
 | 
			
		||||
                 "could not create socketpair: %s", strerror (errno));
 | 
			
		||||
    return NULL;
 | 
			
		||||
  }
 | 
			
		||||
create_failed:
 | 
			
		||||
  {
 | 
			
		||||
    g_clear_object (&priv->sockets[0]);
 | 
			
		||||
    g_clear_object (&priv->sockets[1]);
 | 
			
		||||
    return NULL;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
pinos_dbus_client_node_dispose (GObject * object)
 | 
			
		||||
{
 | 
			
		||||
  PinosDBusClientNode *this = PINOS_DBUS_CLIENT_NODE (object);
 | 
			
		||||
  PinosNode *node = PINOS_NODE (this);
 | 
			
		||||
  SpaProps *props;
 | 
			
		||||
  SpaPropValue value;
 | 
			
		||||
  int fd = -1;
 | 
			
		||||
 | 
			
		||||
  g_debug ("client-node %p: dispose", this);
 | 
			
		||||
 | 
			
		||||
  spa_node_get_props (node->node, &props);
 | 
			
		||||
  value.value = &fd;
 | 
			
		||||
  value.size = sizeof (int);
 | 
			
		||||
  spa_props_set_value (props, spa_props_index_for_name (props, "socket"), &value);
 | 
			
		||||
 | 
			
		||||
  value.value = NULL;
 | 
			
		||||
  value.size = sizeof (void *);
 | 
			
		||||
  spa_props_set_value (props, spa_props_index_for_name (props, "connection"), &value);
 | 
			
		||||
  spa_node_set_props (node->node, props);
 | 
			
		||||
 | 
			
		||||
  G_OBJECT_CLASS (pinos_dbus_client_node_parent_class)->dispose (object);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
pinos_dbus_client_node_finalize (GObject * object)
 | 
			
		||||
{
 | 
			
		||||
  PinosDBusClientNode *this = PINOS_DBUS_CLIENT_NODE (object);
 | 
			
		||||
  PinosDBusClientNodePrivate *priv = this->priv;
 | 
			
		||||
 | 
			
		||||
  g_debug ("client-node %p: finalize", this);
 | 
			
		||||
 | 
			
		||||
  g_clear_object (&priv->sockets[0]);
 | 
			
		||||
  g_clear_object (&priv->sockets[1]);
 | 
			
		||||
  spa_handle_clear (priv->handle);
 | 
			
		||||
  g_free (priv->handle);
 | 
			
		||||
 | 
			
		||||
  G_OBJECT_CLASS (pinos_dbus_client_node_parent_class)->finalize (object);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
pinos_dbus_client_node_constructed (GObject * object)
 | 
			
		||||
{
 | 
			
		||||
  PinosDBusClientNode *this = PINOS_DBUS_CLIENT_NODE (object);
 | 
			
		||||
 | 
			
		||||
  g_debug ("client-node %p: constructed", this);
 | 
			
		||||
 | 
			
		||||
  G_OBJECT_CLASS (pinos_dbus_client_node_parent_class)->constructed (object);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
pinos_dbus_client_node_class_init (PinosDBusClientNodeClass * klass)
 | 
			
		||||
{
 | 
			
		||||
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 | 
			
		||||
 | 
			
		||||
  g_type_class_add_private (klass, sizeof (PinosDBusClientNodePrivate));
 | 
			
		||||
 | 
			
		||||
  gobject_class->constructed = pinos_dbus_client_node_constructed;
 | 
			
		||||
  gobject_class->dispose = pinos_dbus_client_node_dispose;
 | 
			
		||||
  gobject_class->finalize = pinos_dbus_client_node_finalize;
 | 
			
		||||
  gobject_class->set_property = pinos_dbus_client_node_set_property;
 | 
			
		||||
  gobject_class->get_property = pinos_dbus_client_node_get_property;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
pinos_dbus_client_node_init (PinosDBusClientNode * node)
 | 
			
		||||
{
 | 
			
		||||
  node->priv = PINOS_DBUS_CLIENT_NODE_GET_PRIVATE (node);
 | 
			
		||||
 | 
			
		||||
  g_debug ("client-node %p: new", node);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static SpaResult
 | 
			
		||||
make_node (PinosDaemon *daemon, SpaHandle **handle, SpaNode **node, const char *lib, const char *name)
 | 
			
		||||
{
 | 
			
		||||
  SpaResult res;
 | 
			
		||||
  void *hnd, *state = NULL;
 | 
			
		||||
  SpaEnumHandleFactoryFunc enum_func;
 | 
			
		||||
 | 
			
		||||
  if ((hnd = dlopen (lib, RTLD_NOW)) == NULL) {
 | 
			
		||||
    g_error ("can't load %s: %s", lib, dlerror());
 | 
			
		||||
    return SPA_RESULT_ERROR;
 | 
			
		||||
  }
 | 
			
		||||
  if ((enum_func = dlsym (hnd, "spa_enum_handle_factory")) == NULL) {
 | 
			
		||||
    g_error ("can't find enum function");
 | 
			
		||||
    return SPA_RESULT_ERROR;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  while (true) {
 | 
			
		||||
    const SpaHandleFactory *factory;
 | 
			
		||||
    void *iface;
 | 
			
		||||
 | 
			
		||||
    if ((res = enum_func (&factory, &state)) < 0) {
 | 
			
		||||
      if (res != SPA_RESULT_ENUM_END)
 | 
			
		||||
        g_error ("can't enumerate factories: %d", res);
 | 
			
		||||
      break;
 | 
			
		||||
    }
 | 
			
		||||
    if (strcmp (factory->name, name))
 | 
			
		||||
      continue;
 | 
			
		||||
 | 
			
		||||
    *handle = calloc (1, factory->size);
 | 
			
		||||
    if ((res = factory->init (factory,
 | 
			
		||||
                              *handle,
 | 
			
		||||
                              NULL,
 | 
			
		||||
                              daemon->support,
 | 
			
		||||
                              daemon->n_support)) < 0) {
 | 
			
		||||
      g_error ("can't make factory instance: %d", res);
 | 
			
		||||
      return res;
 | 
			
		||||
    }
 | 
			
		||||
    if ((res = spa_handle_get_interface (*handle,
 | 
			
		||||
                                      spa_id_map_get_id (daemon->map, SPA_NODE_URI),
 | 
			
		||||
                                      &iface)) < 0) {
 | 
			
		||||
      g_error ("can't get interface %d", res);
 | 
			
		||||
      return res;
 | 
			
		||||
    }
 | 
			
		||||
    *node = iface;
 | 
			
		||||
    return SPA_RESULT_OK;
 | 
			
		||||
  }
 | 
			
		||||
  return SPA_RESULT_ERROR;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * pinos_dbus_client_node_new:
 | 
			
		||||
 * @daemon: a #PinosDaemon
 | 
			
		||||
 * @client: the client owner
 | 
			
		||||
 * @path: a dbus path
 | 
			
		||||
 * @properties: extra properties
 | 
			
		||||
 *
 | 
			
		||||
 * Create a new #PinosNode.
 | 
			
		||||
 *
 | 
			
		||||
 * Returns: a new #PinosNode
 | 
			
		||||
 */
 | 
			
		||||
PinosNode *
 | 
			
		||||
pinos_dbus_client_node_new (PinosDaemon     *daemon,
 | 
			
		||||
                            PinosClient     *client,
 | 
			
		||||
                            const gchar     *path,
 | 
			
		||||
                            PinosProperties *properties)
 | 
			
		||||
{
 | 
			
		||||
  SpaNode *n;
 | 
			
		||||
  SpaResult res;
 | 
			
		||||
  SpaHandle *handle;
 | 
			
		||||
  PinosNode *node;
 | 
			
		||||
  SpaProps *props;
 | 
			
		||||
  SpaPropValue value;
 | 
			
		||||
 | 
			
		||||
  g_return_val_if_fail (PINOS_IS_DAEMON (daemon), NULL);
 | 
			
		||||
 | 
			
		||||
  if ((res = make_node (daemon,
 | 
			
		||||
                        &handle,
 | 
			
		||||
                        &n,
 | 
			
		||||
                        "build/spa/plugins/remote/libspa-remote.so",
 | 
			
		||||
                        "dbus-proxy")) < 0) {
 | 
			
		||||
    g_error ("can't create proxy: %d", res);
 | 
			
		||||
    return NULL;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  spa_node_get_props (n, &props);
 | 
			
		||||
  g_object_get (daemon, "connection", &value.value, NULL);
 | 
			
		||||
  value.size = sizeof (void *);
 | 
			
		||||
  spa_props_set_value (props, spa_props_index_for_name (props, "connection"), &value);
 | 
			
		||||
  spa_node_set_props (n, props);
 | 
			
		||||
 | 
			
		||||
  node =  g_object_new (PINOS_TYPE_DBUS_CLIENT_NODE,
 | 
			
		||||
                       "daemon", daemon,
 | 
			
		||||
                       "client", client,
 | 
			
		||||
                       "name", path,
 | 
			
		||||
                       "properties", properties,
 | 
			
		||||
                       "node", n,
 | 
			
		||||
                       NULL);
 | 
			
		||||
 | 
			
		||||
  PINOS_DBUS_CLIENT_NODE (node)->priv->handle = handle;
 | 
			
		||||
 | 
			
		||||
  return node;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										75
									
								
								pinos/server/dbus-client-node.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										75
									
								
								pinos/server/dbus-client-node.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,75 @@
 | 
			
		|||
/* 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_DBUS_CLIENT_NODE_H__
 | 
			
		||||
#define __PINOS_DBUS_CLIENT_NODE_H__
 | 
			
		||||
 | 
			
		||||
#include <glib-object.h>
 | 
			
		||||
 | 
			
		||||
#include <pinos/server/node.h>
 | 
			
		||||
 | 
			
		||||
G_BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
#define PINOS_TYPE_DBUS_CLIENT_NODE                 (pinos_dbus_client_node_get_type ())
 | 
			
		||||
#define PINOS_IS_DBUS_CLIENT_NODE(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PINOS_TYPE_DBUS_CLIENT_NODE))
 | 
			
		||||
#define PINOS_IS_DBUS_CLIENT_NODE_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), PINOS_TYPE_DBUS_CLIENT_NODE))
 | 
			
		||||
#define PINOS_DBUS_CLIENT_NODE_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), PINOS_TYPE_DBUS_CLIENT_NODE, PinosDBusClientNodeClass))
 | 
			
		||||
#define PINOS_DBUS_CLIENT_NODE(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), PINOS_TYPE_DBUS_CLIENT_NODE, PinosDBusClientNode))
 | 
			
		||||
#define PINOS_DBUS_CLIENT_NODE_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), PINOS_TYPE_DBUS_CLIENT_NODE, PinosDBusClientNodeClass))
 | 
			
		||||
#define PINOS_DBUS_CLIENT_NODE_CAST(obj)            ((PinosDBusClientNode*)(obj))
 | 
			
		||||
#define PINOS_DBUS_CLIENT_NODE_CLASS_CAST(klass)    ((PinosDBusClientNodeClass*)(klass))
 | 
			
		||||
 | 
			
		||||
typedef struct _PinosDBusClientNode PinosDBusClientNode;
 | 
			
		||||
typedef struct _PinosDBusClientNodeClass PinosDBusClientNodeClass;
 | 
			
		||||
typedef struct _PinosDBusClientNodePrivate PinosDBusClientNodePrivate;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * PinosDBusClientNode:
 | 
			
		||||
 *
 | 
			
		||||
 * Pinos client node object class.
 | 
			
		||||
 */
 | 
			
		||||
struct _PinosDBusClientNode {
 | 
			
		||||
  PinosNode object;
 | 
			
		||||
 | 
			
		||||
  PinosDBusClientNodePrivate *priv;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * PinosDBusClientNodeClass:
 | 
			
		||||
 *
 | 
			
		||||
 * Pinos client node object class.
 | 
			
		||||
 */
 | 
			
		||||
struct _PinosDBusClientNodeClass {
 | 
			
		||||
  PinosNodeClass parent_class;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/* normal GObject stuff */
 | 
			
		||||
GType              pinos_dbus_client_node_get_type        (void);
 | 
			
		||||
 | 
			
		||||
PinosNode *        pinos_dbus_client_node_new             (PinosDaemon     *daemon,
 | 
			
		||||
                                                           PinosClient     *client,
 | 
			
		||||
                                                           const gchar     *path,
 | 
			
		||||
                                                           PinosProperties *properties);
 | 
			
		||||
 | 
			
		||||
GSocket *          pinos_dbus_client_node_get_socket_pair (PinosDBusClientNode  *node,
 | 
			
		||||
                                                           GError              **error);
 | 
			
		||||
 | 
			
		||||
G_END_DECLS
 | 
			
		||||
 | 
			
		||||
#endif /* __PINOS_DBUS_CLIENT_NODE_H__ */
 | 
			
		||||
| 
						 | 
				
			
			@ -3,6 +3,7 @@ pinoscore_headers = [
 | 
			
		|||
  'client-node.h',
 | 
			
		||||
  'command.h',
 | 
			
		||||
  'daemon.h',
 | 
			
		||||
  'dbus-client-node.h',
 | 
			
		||||
  'link.h',
 | 
			
		||||
  'module.h',
 | 
			
		||||
  'node.h',
 | 
			
		||||
| 
						 | 
				
			
			@ -16,6 +17,7 @@ pinoscore_sources = [
 | 
			
		|||
  'client-node.c',
 | 
			
		||||
  'command.c',
 | 
			
		||||
  'daemon.c',
 | 
			
		||||
  'dbus-client-node.c',
 | 
			
		||||
  'link.c',
 | 
			
		||||
  'module.c',
 | 
			
		||||
  'node.c',
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -328,7 +328,6 @@ pinos_rtloop_init (PinosRTLoop * this)
 | 
			
		|||
 | 
			
		||||
  g_debug ("rt-loop %p: new", this);
 | 
			
		||||
 | 
			
		||||
  this->poll.handle = NULL;
 | 
			
		||||
  this->poll.size = sizeof (SpaPoll);
 | 
			
		||||
  this->poll.info = NULL;
 | 
			
		||||
  this->poll.add_item = do_add_item;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,8 +37,6 @@ typedef struct _SpaIDMap SpaIDMap;
 | 
			
		|||
 * Maps between uri and its id
 | 
			
		||||
 */
 | 
			
		||||
struct _SpaIDMap {
 | 
			
		||||
  /* pointer to the handle owning this interface */
 | 
			
		||||
  SpaHandle *handle;
 | 
			
		||||
  /* the total size of this structure. This can be used to expand this
 | 
			
		||||
   * structure in the future */
 | 
			
		||||
  size_t size;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -50,8 +50,6 @@ typedef enum
 | 
			
		|||
 * The Log interface
 | 
			
		||||
 */
 | 
			
		||||
struct _SpaLog {
 | 
			
		||||
  /* pointer to the handle owning this interface */
 | 
			
		||||
  SpaHandle *handle;
 | 
			
		||||
  /* the total size of this log. This can be used to expand this
 | 
			
		||||
   * structure in the future */
 | 
			
		||||
  size_t size;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -92,8 +92,6 @@ typedef struct {
 | 
			
		|||
 * Register poll events
 | 
			
		||||
 */
 | 
			
		||||
struct _SpaPoll {
 | 
			
		||||
  /* pointer to the handle owning this interface */
 | 
			
		||||
  SpaHandle *handle;
 | 
			
		||||
  /* the total size of this structure. This can be used to expand this
 | 
			
		||||
   * structure in the future */
 | 
			
		||||
  size_t size;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -78,7 +78,6 @@ id_map_get_uri (SpaIDMap *map, uint32_t id)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
static const SpaIDMap default_map = {
 | 
			
		||||
  NULL,
 | 
			
		||||
  sizeof (SpaIDMap),
 | 
			
		||||
  NULL,
 | 
			
		||||
  id_map_get_id,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										1439
									
								
								spa/plugins/remote/dbus-proxy.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1439
									
								
								spa/plugins/remote/dbus-proxy.c
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
				
			
			@ -1,4 +1,6 @@
 | 
			
		|||
remote_sources = ['proxy.c', 'plugin.c']
 | 
			
		||||
remote_sources = ['proxy.c',
 | 
			
		||||
                  'dbus-proxy.c',
 | 
			
		||||
                  'plugin.c']
 | 
			
		||||
 | 
			
		||||
remotelib = shared_library('spa-remote',
 | 
			
		||||
                           remote_sources,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,6 +21,7 @@
 | 
			
		|||
#include <spa/node.h>
 | 
			
		||||
 | 
			
		||||
extern const SpaHandleFactory spa_proxy_factory;
 | 
			
		||||
extern const SpaHandleFactory spa_dbus_proxy_factory;
 | 
			
		||||
 | 
			
		||||
SpaResult
 | 
			
		||||
spa_enum_handle_factory (const SpaHandleFactory **factory,
 | 
			
		||||
| 
						 | 
				
			
			@ -37,6 +38,9 @@ spa_enum_handle_factory (const SpaHandleFactory **factory,
 | 
			
		|||
    case 0:
 | 
			
		||||
     *factory = &spa_proxy_factory;
 | 
			
		||||
      break;
 | 
			
		||||
    case 1:
 | 
			
		||||
     *factory = &spa_dbus_proxy_factory;
 | 
			
		||||
      break;
 | 
			
		||||
    default:
 | 
			
		||||
      return SPA_RESULT_ENUM_END;
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -360,7 +360,6 @@ main (int argc, char *argv[])
 | 
			
		|||
  SpaResult res;
 | 
			
		||||
 | 
			
		||||
  data.map = spa_id_map_get_default();
 | 
			
		||||
  data.data_loop.handle = NULL;
 | 
			
		||||
  data.data_loop.size = sizeof (SpaPoll);
 | 
			
		||||
  data.data_loop.info = NULL;
 | 
			
		||||
  data.data_loop.add_item = do_add_item;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -455,7 +455,6 @@ main (int argc, char *argv[])
 | 
			
		|||
 | 
			
		||||
  data.map = spa_id_map_get_default ();
 | 
			
		||||
 | 
			
		||||
  data.data_loop.handle = NULL;
 | 
			
		||||
  data.data_loop.size = sizeof (SpaPoll);
 | 
			
		||||
  data.data_loop.info = NULL;
 | 
			
		||||
  data.data_loop.add_item = do_add_item;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -200,7 +200,6 @@ main (int argc, char *argv[])
 | 
			
		|||
 | 
			
		||||
  data.map = spa_id_map_get_default ();
 | 
			
		||||
  data.log = NULL;
 | 
			
		||||
  data.main_loop.handle = NULL;
 | 
			
		||||
  data.main_loop.size = sizeof (SpaPoll);
 | 
			
		||||
  data.main_loop.info = NULL;
 | 
			
		||||
  data.main_loop.add_item = do_add_item;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue