rework subscription

Rework subscription so that we can use it for client and server.

Move source and source-output to client to allow client provided
sources. Still needs some work but registration seems to work partly.

Rework DBUS API: move CreateSourceOutput to Client1 interface, remove
Add/RemoveProvider and Device1 interface. Rework SourceOutput1 to
allow for reconfigure.

Add a client to test v4l2 source.
This commit is contained in:
Wim Taymans 2015-04-17 17:27:26 +02:00
parent 75d5fa91e2
commit 752494621c
19 changed files with 775 additions and 388 deletions

View file

@ -45,6 +45,7 @@ typedef struct {
guint id;
GHashTable *clients;
PvSubscribe *subscribe;
} SenderData;
static void
@ -72,6 +73,15 @@ client_name_vanished_handler (GDBusConnection *connection,
g_free (data);
}
static void
on_subscription_event (PvSubscribe *subscribe,
PvSubscriptionEvent event,
PvSubscriptionFlags flags,
const gchar *object_path)
{
g_print ("got event %d %d %s\n", event, flags, object_path);
}
static SenderData *
sender_data_new (PvDaemon *daemon, const gchar *sender)
{
@ -91,6 +101,16 @@ sender_data_new (PvDaemon *daemon, const gchar *sender)
data,
NULL);
data->subscribe = pv_subscribe_new ();
g_object_set (data->subscribe, "service", sender,
"subscription-mask", PV_SUBSCRIPTION_FLAGS_SOURCE,
"connection", priv->connection,
NULL);
g_signal_connect (data->subscribe,
"subscription-event",
(GCallback) on_subscription_event,
data);
g_hash_table_insert (priv->senders, data->sender, data);
return data;
@ -150,34 +170,6 @@ handle_disconnect_client (PvDaemon1 *interface,
return TRUE;
}
static gboolean
handle_add_provider (PvManager1 *interface,
GDBusMethodInvocation *invocation,
const gchar *arg_provider,
GVariant *arg_properties,
gpointer user_data)
{
g_print ("add provider\n");
g_dbus_method_invocation_return_dbus_error (invocation,
"org.pulseaudio.Error.NotImplemented",
"Operation add not yet implemented");
return TRUE;
}
static gboolean
handle_remove_provider (PvManager1 *interface,
GDBusMethodInvocation *invocation,
const gchar *arg_provider,
gpointer user_data)
{
g_print ("remove provider\n");
g_dbus_method_invocation_return_dbus_error (invocation,
"org.pulseaudio.Error.NotImplemented",
"Operation remove not yet implemented");
return TRUE;
}
static void
export_server_object (PvDaemon *daemon, GDBusObjectManagerServer *manager)
{
@ -197,16 +189,6 @@ export_server_object (PvDaemon *daemon, GDBusObjectManagerServer *manager)
g_dbus_object_skeleton_add_interface (skel, G_DBUS_INTERFACE_SKELETON (iface));
g_object_unref (iface);
}
{
PvManager1 *iface;
iface = pv_manager1_skeleton_new ();
g_signal_connect (iface, "handle-add-provider", (GCallback) handle_add_provider, daemon);
g_signal_connect (iface, "handle-remove-provider", (GCallback) handle_remove_provider, daemon);
g_dbus_object_skeleton_add_interface (skel, G_DBUS_INTERFACE_SKELETON (iface));
g_object_unref (iface);
}
g_dbus_object_manager_server_export (manager, skel);
g_object_unref (skel);
}
@ -315,7 +297,8 @@ pv_daemon_get_source (PvDaemon *daemon, const gchar *name)
priv = daemon->priv;
if (priv->source == NULL) {
priv->source = pv_v4l2_source_new (daemon);
priv->source = pv_v4l2_source_new ();
pv_source_set_manager (priv->source, priv->server_manager);
}
return priv->source;
}