mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
add get_proxy_finish
Fix some compilation issues
This commit is contained in:
parent
0a9f79b675
commit
1b89f2f8ad
6 changed files with 47 additions and 22 deletions
|
|
@ -321,7 +321,6 @@ on_client_connected (GObject *source_object,
|
||||||
g_variant_get (ret, "(o)", &priv->client_path);
|
g_variant_get (ret, "(o)", &priv->client_path);
|
||||||
g_print ("got client %s\n", priv->client_path);
|
g_print ("got client %s\n", priv->client_path);
|
||||||
g_variant_unref (ret);
|
g_variant_unref (ret);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
|
|
@ -138,6 +138,8 @@ handle_create_source_output (PvSource1 *interface,
|
||||||
const gchar *object_path;
|
const gchar *object_path;
|
||||||
|
|
||||||
output = pv_source_create_source_output (source, arg_properties, priv->object_path);
|
output = pv_source_create_source_output (source, arg_properties, priv->object_path);
|
||||||
|
if (output == NULL)
|
||||||
|
goto no_output;
|
||||||
|
|
||||||
object_path = pv_source_output_get_object_path (output);
|
object_path = pv_source_output_get_object_path (output);
|
||||||
|
|
||||||
|
|
@ -145,6 +147,14 @@ handle_create_source_output (PvSource1 *interface,
|
||||||
invocation,
|
invocation,
|
||||||
object_path);
|
object_path);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
/* ERRORS */
|
||||||
|
no_output:
|
||||||
|
{
|
||||||
|
g_dbus_method_invocation_return_dbus_error (invocation,
|
||||||
|
"org.pulsevideo.Error", "Can't create output");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
|
||||||
|
|
@ -340,8 +340,12 @@ on_source_output_proxy (GObject *source_object,
|
||||||
{
|
{
|
||||||
PvStream *stream = user_data;
|
PvStream *stream = user_data;
|
||||||
PvStreamPrivate *priv = stream->priv;
|
PvStreamPrivate *priv = stream->priv;
|
||||||
|
PvContext *context = priv->context;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
|
priv->source_output = pv_subscribe_get_proxy_finish (context->priv->subscribe,
|
||||||
|
res,
|
||||||
|
&error);
|
||||||
if (priv->source_output == NULL)
|
if (priv->source_output == NULL)
|
||||||
goto source_output_failed;
|
goto source_output_failed;
|
||||||
|
|
||||||
|
|
@ -384,13 +388,13 @@ on_source_output_created (GObject *source_object,
|
||||||
g_print ("got source-output %s\n", priv->source_output_path);
|
g_print ("got source-output %s\n", priv->source_output_path);
|
||||||
g_variant_unref (ret);
|
g_variant_unref (ret);
|
||||||
|
|
||||||
priv->source_output = pv_subscribe_get_proxy (context->priv->subscribe,
|
pv_subscribe_get_proxy (context->priv->subscribe,
|
||||||
PV_DBUS_SERVICE,
|
PV_DBUS_SERVICE,
|
||||||
priv->source_output_path,
|
priv->source_output_path,
|
||||||
"org.pulsevideo.SourceOutput1",
|
"org.pulsevideo.SourceOutput1",
|
||||||
NULL,
|
NULL,
|
||||||
on_source_ouput_proxy,
|
on_source_output_proxy,
|
||||||
stream);
|
stream);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -115,9 +115,9 @@ on_proxy_properties_changed (GDBusProxy *proxy,
|
||||||
GStrv invalidated_properties,
|
GStrv invalidated_properties,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
ProxyData *data = user_data;
|
PvObjectData *data = user_data;
|
||||||
|
|
||||||
notify_event (subscribe, data->proxy, PV_SUBSCRIPTION_EVENT_CHANGE);
|
notify_event (data->subscribe, data, PV_SUBSCRIPTION_EVENT_CHANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -125,12 +125,14 @@ on_proxy_created (GObject *source_object,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
ProxyData *data = user_data;
|
PvObjectData *data = user_data;
|
||||||
PvSubscribe *subscribe = data->subscribe;
|
PvSubscribe *subscribe = data->subscribe;
|
||||||
PvSubscribePrivate *priv = subscribe->priv;
|
PvSubscribePrivate *priv = subscribe->priv;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GList *walk;
|
GList *walk;
|
||||||
|
|
||||||
|
data->pending = FALSE;
|
||||||
|
|
||||||
data->proxy = g_dbus_proxy_new_finish (res, &error);
|
data->proxy = g_dbus_proxy_new_finish (res, &error);
|
||||||
if (data->proxy == NULL) {
|
if (data->proxy == NULL) {
|
||||||
priv->objects = g_list_remove (priv->objects, data);
|
priv->objects = g_list_remove (priv->objects, data);
|
||||||
|
|
@ -166,13 +168,14 @@ add_interface (PvSubscribe *subscribe,
|
||||||
GVariant *properties)
|
GVariant *properties)
|
||||||
{
|
{
|
||||||
PvSubscribePrivate *priv = subscribe->priv;
|
PvSubscribePrivate *priv = subscribe->priv;
|
||||||
ProxyData *data;
|
PvObjectData *data;
|
||||||
|
|
||||||
data = g_new0 (ProxyData, 1);
|
data = g_new0 (PvObjectData, 1);
|
||||||
data->subscribe = subscribe;
|
data->subscribe = subscribe;
|
||||||
data->sender_name = g_strdup (priv->service);
|
data->sender_name = g_strdup (priv->service);
|
||||||
data->object_path = g_strdup (object_path);
|
data->object_path = g_strdup (object_path);
|
||||||
data->interface_name = g_strdup (interface_name);
|
data->interface_name = g_strdup (interface_name);
|
||||||
|
data->pending = TRUE;
|
||||||
|
|
||||||
priv->objects = g_list_prepend (priv->objects, data);
|
priv->objects = g_list_prepend (priv->objects, data);
|
||||||
priv->pending_proxies++;
|
priv->pending_proxies++;
|
||||||
|
|
@ -647,8 +650,6 @@ compare_data (PvObjectData *data, const gchar *name,
|
||||||
|
|
||||||
void
|
void
|
||||||
pv_subscribe_get_proxy (PvSubscribe *subscribe,
|
pv_subscribe_get_proxy (PvSubscribe *subscribe,
|
||||||
GDBusProxyFlags flags,
|
|
||||||
GDBusInterfaceInfo *info,
|
|
||||||
const gchar *name,
|
const gchar *name,
|
||||||
const gchar *object_path,
|
const gchar *object_path,
|
||||||
const gchar *interface_name,
|
const gchar *interface_name,
|
||||||
|
|
@ -657,10 +658,9 @@ pv_subscribe_get_proxy (PvSubscribe *subscribe,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
PvSubscribePrivate *priv;
|
PvSubscribePrivate *priv;
|
||||||
GDBusProxy *res = NULL;
|
|
||||||
GList *walk;
|
GList *walk;
|
||||||
|
|
||||||
g_return_val_if_fail (PV_IS_SUBSCRIBE (subscribe), NULL);
|
g_return_if_fail (PV_IS_SUBSCRIBE (subscribe));
|
||||||
priv = subscribe->priv;
|
priv = subscribe->priv;
|
||||||
|
|
||||||
for (walk = priv->objects; walk; walk = g_list_next (walk)) {
|
for (walk = priv->objects; walk; walk = g_list_next (walk)) {
|
||||||
|
|
@ -675,7 +675,6 @@ pv_subscribe_get_proxy (PvSubscribe *subscribe,
|
||||||
user_data);
|
user_data);
|
||||||
|
|
||||||
if (data->pending) {
|
if (data->pending) {
|
||||||
g_task_set_task_data (task, data, NULL);
|
|
||||||
data->tasks = g_list_prepend (data->tasks, task);
|
data->tasks = g_list_prepend (data->tasks, task);
|
||||||
} else if (data->proxy) {
|
} else if (data->proxy) {
|
||||||
g_task_return_pointer (task, g_object_ref (data->proxy), g_object_unref);
|
g_task_return_pointer (task, g_object_ref (data->proxy), g_object_unref);
|
||||||
|
|
@ -687,3 +686,11 @@ pv_subscribe_get_proxy (PvSubscribe *subscribe,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GDBusProxy *
|
||||||
|
pv_subscribe_get_proxy_finish (PvSubscribe *subscribe,
|
||||||
|
GAsyncResult *res,
|
||||||
|
GError **error)
|
||||||
|
{
|
||||||
|
return g_task_propagate_pointer (G_TASK (res), error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,13 +87,17 @@ PvSubscribe * pv_subscribe_new (void);
|
||||||
PvSubscriptionState pv_subscribe_get_state (PvSubscribe *subscribe);
|
PvSubscriptionState pv_subscribe_get_state (PvSubscribe *subscribe);
|
||||||
GError * pv_subscribe_get_error (PvSubscribe *subscribe);
|
GError * pv_subscribe_get_error (PvSubscribe *subscribe);
|
||||||
|
|
||||||
GDBusProxy * pv_subscribe_get_proxy (PvSubscribe *subscribe,
|
void pv_subscribe_get_proxy (PvSubscribe *subscribe,
|
||||||
const gchar *name,
|
const gchar *name,
|
||||||
const gchar *object_path,
|
const gchar *object_path,
|
||||||
const gchar *interface_name,
|
const gchar *interface_name,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
GDBusProxy * pv_subscribe_get_proxy_finish (PvSubscribe *subscribe,
|
||||||
|
GAsyncResult *res,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
|
||||||
|
|
@ -80,9 +80,12 @@ client_name_appeared_handler (GDBusConnection *connection,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
SenderData *data = user_data;
|
SenderData *data = user_data;
|
||||||
|
PvDaemonPrivate *priv = data->daemon->priv;
|
||||||
|
|
||||||
g_print ("client name appeared def: %p\n", g_main_context_get_thread_default ());
|
g_print ("client name appeared def: %p\n", g_main_context_get_thread_default ());
|
||||||
|
|
||||||
|
g_hash_table_insert (priv->senders, data->sender, data);
|
||||||
|
|
||||||
if (!g_strcmp0 (name, g_dbus_connection_get_unique_name (connection)))
|
if (!g_strcmp0 (name, g_dbus_connection_get_unique_name (connection)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -112,7 +115,6 @@ data_free (SenderData *data)
|
||||||
g_free (data);
|
g_free (data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static SenderData *
|
static SenderData *
|
||||||
sender_data_new (PvDaemon *daemon, const gchar *sender)
|
sender_data_new (PvDaemon *daemon, const gchar *sender)
|
||||||
{
|
{
|
||||||
|
|
@ -134,7 +136,6 @@ sender_data_new (PvDaemon *daemon, const gchar *sender)
|
||||||
data,
|
data,
|
||||||
(GDestroyNotify) data_free);
|
(GDestroyNotify) data_free);
|
||||||
|
|
||||||
g_hash_table_insert (priv->senders, data->sender, data);
|
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
@ -395,7 +396,7 @@ pv_daemon_init (PvDaemon * daemon)
|
||||||
PvDaemonPrivate *priv = daemon->priv = PV_DAEMON_GET_PRIVATE (daemon);
|
PvDaemonPrivate *priv = daemon->priv = PV_DAEMON_GET_PRIVATE (daemon);
|
||||||
|
|
||||||
priv->server_manager = g_dbus_object_manager_server_new (PV_DBUS_OBJECT_PREFIX);
|
priv->server_manager = g_dbus_object_manager_server_new (PV_DBUS_OBJECT_PREFIX);
|
||||||
priv->senders = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
|
priv->senders = g_hash_table_new (g_str_hash, g_str_equal);
|
||||||
|
|
||||||
priv->subscribe = pv_subscribe_new ();
|
priv->subscribe = pv_subscribe_new ();
|
||||||
g_signal_connect (priv->subscribe,
|
g_signal_connect (priv->subscribe,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue