mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
improve introspection
Small cleanups
This commit is contained in:
parent
ab0537305f
commit
bdbddaf75b
15 changed files with 117 additions and 688 deletions
|
|
@ -148,9 +148,8 @@ pinos_context_finalize (GObject * object)
|
||||||
pinos_properties_free (priv->properties);
|
pinos_properties_free (priv->properties);
|
||||||
|
|
||||||
g_list_free (priv->nodes);
|
g_list_free (priv->nodes);
|
||||||
g_list_free (priv->ports);
|
g_list_free (priv->links);
|
||||||
g_list_free (priv->clients);
|
g_list_free (priv->clients);
|
||||||
g_list_free (priv->channels);
|
|
||||||
g_clear_object (&priv->subscribe);
|
g_clear_object (&priv->subscribe);
|
||||||
g_clear_error (&priv->error);
|
g_clear_error (&priv->error);
|
||||||
|
|
||||||
|
|
@ -417,18 +416,11 @@ subscription_cb (PinosSubscribe *subscribe,
|
||||||
priv->nodes = g_list_remove (priv->nodes, object);
|
priv->nodes = g_list_remove (priv->nodes, object);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PINOS_SUBSCRIPTION_FLAG_PORT:
|
case PINOS_SUBSCRIPTION_FLAG_LINK:
|
||||||
if (event == PINOS_SUBSCRIPTION_EVENT_NEW)
|
if (event == PINOS_SUBSCRIPTION_EVENT_NEW)
|
||||||
priv->ports = g_list_prepend (priv->ports, object);
|
priv->links = g_list_prepend (priv->links, object);
|
||||||
else if (event == PINOS_SUBSCRIPTION_EVENT_REMOVE)
|
else if (event == PINOS_SUBSCRIPTION_EVENT_REMOVE)
|
||||||
priv->ports = g_list_remove (priv->ports, object);
|
priv->links = g_list_remove (priv->links, object);
|
||||||
break;
|
|
||||||
|
|
||||||
case PINOS_SUBSCRIPTION_FLAG_CHANNEL:
|
|
||||||
if (event == PINOS_SUBSCRIPTION_EVENT_NEW)
|
|
||||||
priv->channels = g_list_prepend (priv->channels, object);
|
|
||||||
else if (event == PINOS_SUBSCRIPTION_EVENT_REMOVE)
|
|
||||||
priv->channels = g_list_remove (priv->channels, object);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -434,54 +434,41 @@ pinos_direction_as_string (PinosDirection direction)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
port_fill_info (PinosPortInfo *info, GDBusProxy *proxy)
|
link_fill_info (PinosLinkInfo *info, GDBusProxy *proxy)
|
||||||
{
|
{
|
||||||
GHashTable *changed = g_object_get_data (G_OBJECT (proxy), "pinos-changed-properties");
|
GHashTable *changed = g_object_get_data (G_OBJECT (proxy), "pinos-changed-properties");
|
||||||
|
|
||||||
info->id = proxy;
|
info->id = proxy;
|
||||||
info->port_path = g_dbus_proxy_get_object_path (proxy);
|
info->link_path = g_dbus_proxy_get_object_path (proxy);
|
||||||
SET_UINT32 ("Direction", direction, 0, PINOS_DIRECTION_INVALID);
|
|
||||||
SET_STRING ("Node", node_path, 0);
|
|
||||||
|
|
||||||
info->change_mask = 0;
|
info->change_mask = 0;
|
||||||
SET_STRING ("Name", name, 0);
|
SET_STRING ("SrcPort", source_port_path, 0);
|
||||||
SET_OBJV ("Peers", peers, 1);
|
SET_STRING ("DestPort", destination_port_path, 1);
|
||||||
SET_PROPERTIES ("Properties", properties, 2);
|
|
||||||
SET_BYTES ("PossibleFormats", possible_formats, 3);
|
|
||||||
SET_BYTES ("Format", format, 4);
|
|
||||||
|
|
||||||
if (changed)
|
if (changed)
|
||||||
g_hash_table_remove_all (changed);
|
g_hash_table_remove_all (changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
port_clear_info (PinosPortInfo *info)
|
link_clear_info (PinosLinkInfo *info)
|
||||||
{
|
{
|
||||||
if (info->peers)
|
|
||||||
g_strfreev (info->peers);
|
|
||||||
if (info->properties)
|
|
||||||
pinos_properties_free (info->properties);
|
|
||||||
if (info->possible_formats)
|
|
||||||
g_bytes_unref (info->possible_formats);
|
|
||||||
if (info->format)
|
|
||||||
g_bytes_unref (info->format);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pinos_context_list_port_info:
|
* pinos_context_list_link_info:
|
||||||
* @context: a connected #PinosContext
|
* @context: a connected #PinosContext
|
||||||
* @flags: extra #PinosPortInfoFlags
|
* @flags: extra #PinosLinkInfoFlags
|
||||||
* @cb: a #PinosPortInfoCallback
|
* @cb: a #PinosLinkInfoCallback
|
||||||
* @cancelable: a #GCancellable
|
* @cancelable: a #GCancellable
|
||||||
* @callback: a #GAsyncReadyCallback to call when the operation is finished
|
* @callback: a #GAsyncReadyCallback to call when the operation is finished
|
||||||
* @user_data: user data passed to @cb
|
* @user_data: user data passed to @cb
|
||||||
*
|
*
|
||||||
* Call @cb for each port.
|
* Call @cb for each link.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pinos_context_list_port_info (PinosContext *context,
|
pinos_context_list_link_info (PinosContext *context,
|
||||||
PinosPortInfoFlags flags,
|
PinosLinkInfoFlags flags,
|
||||||
PinosPortInfoCallback cb,
|
PinosLinkInfoCallback cb,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
|
|
@ -497,13 +484,13 @@ pinos_context_list_port_info (PinosContext *context,
|
||||||
|
|
||||||
priv = context->priv;
|
priv = context->priv;
|
||||||
|
|
||||||
for (walk = priv->ports; walk; walk = g_list_next (walk)) {
|
for (walk = priv->links; walk; walk = g_list_next (walk)) {
|
||||||
GDBusProxy *proxy = walk->data;
|
GDBusProxy *proxy = walk->data;
|
||||||
PinosPortInfo info;
|
PinosLinkInfo info;
|
||||||
|
|
||||||
port_fill_info (&info, proxy);
|
link_fill_info (&info, proxy);
|
||||||
cb (context, &info, user_data);
|
cb (context, &info, user_data);
|
||||||
port_clear_info (&info);
|
link_clear_info (&info);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_task_return_boolean (task, TRUE);
|
g_task_return_boolean (task, TRUE);
|
||||||
|
|
@ -511,27 +498,27 @@ pinos_context_list_port_info (PinosContext *context,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pinos_context_get_port_info_by_id:
|
* pinos_context_get_link_info_by_id:
|
||||||
* @context: a connected #PinosContext
|
* @context: a connected #PinosContext
|
||||||
* @id: a port id
|
* @id: a link id
|
||||||
* @flags: extra #PinosPortInfoFlags
|
* @flags: extra #PinosLinkInfoFlags
|
||||||
* @cb: a #PinosPortInfoCallback
|
* @cb: a #PinosLinkInfoCallback
|
||||||
* @cancelable: a #GCancellable
|
* @cancelable: a #GCancellable
|
||||||
* @callback: a #GAsyncReadyCallback to call when the operation is finished
|
* @callback: a #GAsyncReadyCallback to call when the operation is finished
|
||||||
* @user_data: user data passed to @cb
|
* @user_data: user data passed to @cb
|
||||||
*
|
*
|
||||||
* Call @cb for the port with @id.
|
* Call @cb for the link with @id.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pinos_context_get_port_info_by_id (PinosContext *context,
|
pinos_context_get_link_info_by_id (PinosContext *context,
|
||||||
gpointer id,
|
gpointer id,
|
||||||
PinosPortInfoFlags flags,
|
PinosLinkInfoFlags flags,
|
||||||
PinosPortInfoCallback cb,
|
PinosLinkInfoCallback cb,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
PinosPortInfo info;
|
PinosLinkInfo info;
|
||||||
GDBusProxy *proxy;
|
GDBusProxy *proxy;
|
||||||
GTask *task;
|
GTask *task;
|
||||||
|
|
||||||
|
|
@ -543,270 +530,9 @@ pinos_context_get_port_info_by_id (PinosContext *context,
|
||||||
|
|
||||||
proxy = G_DBUS_PROXY (id);
|
proxy = G_DBUS_PROXY (id);
|
||||||
|
|
||||||
port_fill_info (&info, proxy);
|
link_fill_info (&info, proxy);
|
||||||
cb (context, &info, user_data);
|
cb (context, &info, user_data);
|
||||||
port_clear_info (&info);
|
link_clear_info (&info);
|
||||||
|
|
||||||
g_task_return_boolean (task, TRUE);
|
|
||||||
g_object_unref (task);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* pinos_port_state_as_string:
|
|
||||||
* @state: a #PinosPortState
|
|
||||||
*
|
|
||||||
* Return the string representation of @state.
|
|
||||||
*
|
|
||||||
* Returns: the string representation of @state.
|
|
||||||
*/
|
|
||||||
const gchar *
|
|
||||||
pinos_port_state_as_string (PinosPortState state)
|
|
||||||
{
|
|
||||||
GEnumValue *val;
|
|
||||||
|
|
||||||
val = g_enum_get_value (G_ENUM_CLASS (g_type_class_ref (PINOS_TYPE_PORT_STATE)),
|
|
||||||
state);
|
|
||||||
|
|
||||||
return val == NULL ? "invalid-state" : val->value_nick;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* pinos_channel_state_as_string:
|
|
||||||
* @state: a #PinosChannelState
|
|
||||||
*
|
|
||||||
* Return the string representation of @state.
|
|
||||||
*
|
|
||||||
* Returns: the string representation of @state.
|
|
||||||
*/
|
|
||||||
const gchar *
|
|
||||||
pinos_channel_state_as_string (PinosChannelState state)
|
|
||||||
{
|
|
||||||
GEnumValue *val;
|
|
||||||
|
|
||||||
val = g_enum_get_value (G_ENUM_CLASS (g_type_class_ref (PINOS_TYPE_CHANNEL_STATE)),
|
|
||||||
state);
|
|
||||||
|
|
||||||
return val == NULL ? "invalid-state" : val->value_nick;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
channel_fill_info (PinosChannelInfo *info, GDBusProxy *proxy)
|
|
||||||
{
|
|
||||||
GHashTable *changed = g_object_get_data (G_OBJECT (proxy), "pinos-changed-properties");
|
|
||||||
|
|
||||||
info->id = proxy;
|
|
||||||
info->channel_path = g_dbus_proxy_get_object_path (proxy);
|
|
||||||
SET_UINT32 ("Direction", direction, 2, PINOS_DIRECTION_INVALID);
|
|
||||||
SET_STRING ("Client", client_path, 0);
|
|
||||||
|
|
||||||
info->change_mask = 0;
|
|
||||||
SET_STRING ("Port", port_path, 0);
|
|
||||||
SET_PROPERTIES ("Properties", properties, 1);
|
|
||||||
SET_UINT32 ("State", state, 2, PINOS_CHANNEL_STATE_ERROR);
|
|
||||||
SET_BYTES ("PossibleFormats", possible_formats, 3);
|
|
||||||
SET_BYTES ("Format", format, 4);
|
|
||||||
|
|
||||||
if (changed)
|
|
||||||
g_hash_table_remove_all (changed);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
channel_clear_info (PinosChannelInfo *info)
|
|
||||||
{
|
|
||||||
if (info->possible_formats)
|
|
||||||
g_bytes_unref (info->possible_formats);
|
|
||||||
if (info->format)
|
|
||||||
g_bytes_unref (info->format);
|
|
||||||
if (info->properties)
|
|
||||||
pinos_properties_free (info->properties);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* pinos_context_list_channel_info:
|
|
||||||
* @context: a connected #PinosContext
|
|
||||||
* @flags: extra #PinosChannelInfoFlags
|
|
||||||
* @cb: a #PinosChannelInfoCallback
|
|
||||||
* @cancelable: a #GCancellable
|
|
||||||
* @callback: a #GAsyncReadyCallback to call when the operation is finished
|
|
||||||
* @user_data: user data passed to @cb
|
|
||||||
*
|
|
||||||
* Call @cb for each channel.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
pinos_context_list_channel_info (PinosContext *context,
|
|
||||||
PinosChannelInfoFlags flags,
|
|
||||||
PinosChannelInfoCallback cb,
|
|
||||||
GCancellable *cancellable,
|
|
||||||
GAsyncReadyCallback callback,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
PinosContextPrivate *priv;
|
|
||||||
GList *walk;
|
|
||||||
GTask *task;
|
|
||||||
|
|
||||||
g_return_if_fail (PINOS_IS_CONTEXT (context));
|
|
||||||
g_return_if_fail (cb != NULL);
|
|
||||||
|
|
||||||
task = g_task_new (context, cancellable, callback, user_data);
|
|
||||||
|
|
||||||
priv = context->priv;
|
|
||||||
|
|
||||||
for (walk = priv->channels; walk; walk = g_list_next (walk)) {
|
|
||||||
GDBusProxy *proxy = walk->data;
|
|
||||||
PinosChannelInfo info;
|
|
||||||
|
|
||||||
channel_fill_info (&info, proxy);
|
|
||||||
cb (context, &info, user_data);
|
|
||||||
channel_clear_info (&info);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_task_return_boolean (task, TRUE);
|
|
||||||
g_object_unref (task);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* pinos_context_get_channel_info_by_id:
|
|
||||||
* @context: a connected #PinosContext
|
|
||||||
* @id: a channel id
|
|
||||||
* @flags: extra #PinosChannelInfoFlags
|
|
||||||
* @cb: a #PinosChannelInfoCallback
|
|
||||||
* @cancelable: a #GCancellable
|
|
||||||
* @callback: a #GAsyncReadyCallback to call when the operation is finished
|
|
||||||
* @user_data: user data passed to @cb
|
|
||||||
*
|
|
||||||
* Call @cb for the channel with @id.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
pinos_context_get_channel_info_by_id (PinosContext *context,
|
|
||||||
gpointer id,
|
|
||||||
PinosChannelInfoFlags flags,
|
|
||||||
PinosChannelInfoCallback cb,
|
|
||||||
GCancellable *cancellable,
|
|
||||||
GAsyncReadyCallback callback,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
PinosChannelInfo info;
|
|
||||||
GDBusProxy *proxy;
|
|
||||||
GTask *task;
|
|
||||||
|
|
||||||
g_return_if_fail (PINOS_IS_CONTEXT (context));
|
|
||||||
g_return_if_fail (id != NULL);
|
|
||||||
g_return_if_fail (cb != NULL);
|
|
||||||
|
|
||||||
task = g_task_new (context, cancellable, callback, user_data);
|
|
||||||
|
|
||||||
proxy = G_DBUS_PROXY (id);
|
|
||||||
|
|
||||||
channel_fill_info (&info, proxy);
|
|
||||||
cb (context, &info, user_data);
|
|
||||||
channel_clear_info (&info);
|
|
||||||
|
|
||||||
g_task_return_boolean (task, TRUE);
|
|
||||||
g_object_unref (task);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
connection_fill_info (PinosConnectionInfo *info, GDBusProxy *proxy)
|
|
||||||
{
|
|
||||||
GHashTable *changed = g_object_get_data (G_OBJECT (proxy), "pinos-changed-properties");
|
|
||||||
|
|
||||||
info->id = proxy;
|
|
||||||
info->connection_path = g_dbus_proxy_get_object_path (proxy);
|
|
||||||
|
|
||||||
info->change_mask = 0;
|
|
||||||
SET_STRING ("SourcePort", source_port_path, 0);
|
|
||||||
SET_STRING ("DestinationPort", destination_port_path, 1);
|
|
||||||
|
|
||||||
if (changed)
|
|
||||||
g_hash_table_remove_all (changed);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
connection_clear_info (PinosConnectionInfo *info)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* pinos_context_list_connection_info:
|
|
||||||
* @context: a connected #PinosContext
|
|
||||||
* @flags: extra #PinosConnectionInfoFlags
|
|
||||||
* @cb: a #PinosConnectionInfoCallback
|
|
||||||
* @cancelable: a #GCancellable
|
|
||||||
* @callback: a #GAsyncReadyCallback to call when the operation is finished
|
|
||||||
* @user_data: user data passed to @cb
|
|
||||||
*
|
|
||||||
* Call @cb for each connection.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
pinos_context_list_connection_info (PinosContext *context,
|
|
||||||
PinosConnectionInfoFlags flags,
|
|
||||||
PinosConnectionInfoCallback cb,
|
|
||||||
GCancellable *cancellable,
|
|
||||||
GAsyncReadyCallback callback,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
PinosContextPrivate *priv;
|
|
||||||
GList *walk;
|
|
||||||
GTask *task;
|
|
||||||
|
|
||||||
g_return_if_fail (PINOS_IS_CONTEXT (context));
|
|
||||||
g_return_if_fail (cb != NULL);
|
|
||||||
|
|
||||||
task = g_task_new (context, cancellable, callback, user_data);
|
|
||||||
|
|
||||||
priv = context->priv;
|
|
||||||
|
|
||||||
for (walk = priv->connections; walk; walk = g_list_next (walk)) {
|
|
||||||
GDBusProxy *proxy = walk->data;
|
|
||||||
PinosConnectionInfo info;
|
|
||||||
|
|
||||||
connection_fill_info (&info, proxy);
|
|
||||||
cb (context, &info, user_data);
|
|
||||||
connection_clear_info (&info);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_task_return_boolean (task, TRUE);
|
|
||||||
g_object_unref (task);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* pinos_context_get_connection_info_by_id:
|
|
||||||
* @context: a connected #PinosContext
|
|
||||||
* @id: a connection id
|
|
||||||
* @flags: extra #PinosConnectionInfoFlags
|
|
||||||
* @cb: a #PinosConnectionInfoCallback
|
|
||||||
* @cancelable: a #GCancellable
|
|
||||||
* @callback: a #GAsyncReadyCallback to call when the operation is finished
|
|
||||||
* @user_data: user data passed to @cb
|
|
||||||
*
|
|
||||||
* Call @cb for the connection with @id.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
pinos_context_get_connection_info_by_id (PinosContext *context,
|
|
||||||
gpointer id,
|
|
||||||
PinosConnectionInfoFlags flags,
|
|
||||||
PinosConnectionInfoCallback cb,
|
|
||||||
GCancellable *cancellable,
|
|
||||||
GAsyncReadyCallback callback,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
PinosConnectionInfo info;
|
|
||||||
GDBusProxy *proxy;
|
|
||||||
GTask *task;
|
|
||||||
|
|
||||||
g_return_if_fail (PINOS_IS_CONTEXT (context));
|
|
||||||
g_return_if_fail (id != NULL);
|
|
||||||
g_return_if_fail (cb != NULL);
|
|
||||||
|
|
||||||
task = g_task_new (context, cancellable, callback, user_data);
|
|
||||||
|
|
||||||
proxy = G_DBUS_PROXY (id);
|
|
||||||
|
|
||||||
connection_fill_info (&info, proxy);
|
|
||||||
cb (context, &info, user_data);
|
|
||||||
connection_clear_info (&info);
|
|
||||||
|
|
||||||
g_task_return_boolean (task, TRUE);
|
g_task_return_boolean (task, TRUE);
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
|
|
|
||||||
|
|
@ -64,24 +64,6 @@ typedef enum {
|
||||||
|
|
||||||
const gchar * pinos_direction_as_string (PinosDirection direction);
|
const gchar * pinos_direction_as_string (PinosDirection direction);
|
||||||
|
|
||||||
/**
|
|
||||||
* PinosPortState:
|
|
||||||
* @PINOS_PORT_STATE_ERROR: the port is in error
|
|
||||||
* @PINOS_PORT_STATE_STOPPED: the port is stopped
|
|
||||||
* @PINOS_PORT_STATE_STARTING: the port is starting
|
|
||||||
* @PINOS_PORT_STATE_STREAMING: the port is streaming
|
|
||||||
*
|
|
||||||
* The different port states
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
PINOS_PORT_STATE_ERROR = -1,
|
|
||||||
PINOS_PORT_STATE_STOPPED = 0,
|
|
||||||
PINOS_PORT_STATE_STARTING = 1,
|
|
||||||
PINOS_PORT_STATE_STREAMING = 2,
|
|
||||||
} PinosPortState;
|
|
||||||
|
|
||||||
const gchar * pinos_port_state_as_string (PinosPortState state);
|
|
||||||
|
|
||||||
#include <pinos/client/context.h>
|
#include <pinos/client/context.h>
|
||||||
#include <pinos/client/properties.h>
|
#include <pinos/client/properties.h>
|
||||||
|
|
||||||
|
|
@ -261,214 +243,57 @@ void pinos_context_get_node_info_by_id (PinosContext *context,
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PinosPortInfo:
|
* PinosLinkInfo:
|
||||||
* @id: generic id of the port
|
* @id: generic id of the link
|
||||||
* @port_path: the unique path of the port, suitable for connecting
|
* @link_path: the unique path of the link
|
||||||
* @node_path: the node path of the port
|
|
||||||
* @direction: the direction of the port
|
|
||||||
* @change_mask: bitfield of changed fields since last call
|
|
||||||
* @name: name the port, suitable for display
|
|
||||||
* @peers: paths to peer ports
|
|
||||||
* @properties: the properties of the port
|
|
||||||
* @possible_formats: the possible formats this port can consume
|
|
||||||
* @format: the current format on this port
|
|
||||||
*
|
|
||||||
* The port information. Extra information can be added in later
|
|
||||||
* versions.
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
gpointer id;
|
|
||||||
const char *port_path;
|
|
||||||
const char *node_path;
|
|
||||||
PinosDirection direction;
|
|
||||||
guint64 change_mask;
|
|
||||||
const char *name;
|
|
||||||
PinosProperties *properties;
|
|
||||||
gchar **peers;
|
|
||||||
GBytes *possible_formats;
|
|
||||||
GBytes *format;
|
|
||||||
} PinosPortInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PinosPortInfoFlags:
|
|
||||||
* @PINOS_PORT_INFO_FLAGS_NONE: no flags
|
|
||||||
* @PINOS_PORT_INFO_FLAGS_FORMATS: include formats
|
|
||||||
*
|
|
||||||
* Extra flags to pass to pinos_context_get_port_info_list.
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
PINOS_PORT_INFO_FLAGS_NONE = 0,
|
|
||||||
PINOS_PORT_INFO_FLAGS_FORMATS = (1 << 0)
|
|
||||||
} PinosPortInfoFlags;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PinosPortInfoCallback:
|
|
||||||
* @c: a #PinosContext
|
|
||||||
* @info: a #PinosPortInfo
|
|
||||||
* @user_data: user data
|
|
||||||
*
|
|
||||||
* Callback with information about the Pinos port in @info.
|
|
||||||
*/
|
|
||||||
typedef void (*PinosPortInfoCallback) (PinosContext *c,
|
|
||||||
const PinosPortInfo *info,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
void pinos_context_list_port_info (PinosContext *context,
|
|
||||||
PinosPortInfoFlags flags,
|
|
||||||
PinosPortInfoCallback cb,
|
|
||||||
GCancellable *cancellable,
|
|
||||||
GAsyncReadyCallback callback,
|
|
||||||
gpointer user_data);
|
|
||||||
void pinos_context_get_port_info_by_id (PinosContext *context,
|
|
||||||
gpointer id,
|
|
||||||
PinosPortInfoFlags flags,
|
|
||||||
PinosPortInfoCallback cb,
|
|
||||||
GCancellable *cancellable,
|
|
||||||
GAsyncReadyCallback callback,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PinosChannelState:
|
|
||||||
* @PINOS_CHANNEL_STATE_ERROR: the channel is in error
|
|
||||||
* @PINOS_CHANNEL_STATE_STOPPED: the channel is stopped
|
|
||||||
* @PINOS_CHANNEL_STATE_STARTING: the channel is starting
|
|
||||||
* @PINOS_CHANNEL_STATE_STREAMING: the channel is streaming
|
|
||||||
*
|
|
||||||
* The different channel states
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
PINOS_CHANNEL_STATE_ERROR = -1,
|
|
||||||
PINOS_CHANNEL_STATE_STOPPED = 0,
|
|
||||||
PINOS_CHANNEL_STATE_STARTING = 1,
|
|
||||||
PINOS_CHANNEL_STATE_STREAMING = 2,
|
|
||||||
} PinosChannelState;
|
|
||||||
|
|
||||||
const gchar * pinos_channel_state_as_string (PinosChannelState state);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PinosChannelInfo:
|
|
||||||
* @id: generic id of the channel_
|
|
||||||
* @channel_path: the unique path of the channel
|
|
||||||
* @direction: the channel direction
|
|
||||||
* @client_path: the owner client
|
|
||||||
* @change_mask: bitfield of changed fields since last call
|
|
||||||
* @port_path: the owner port
|
|
||||||
* @properties: the properties of the channel
|
|
||||||
* @state: the state
|
|
||||||
* @possible_formats: the possible formats
|
|
||||||
* @format: when streaming, the current format
|
|
||||||
*
|
|
||||||
* The channel information. Extra information can be added in later
|
|
||||||
* versions.
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
gpointer id;
|
|
||||||
const char *channel_path;
|
|
||||||
PinosDirection direction;
|
|
||||||
const char *client_path;
|
|
||||||
guint64 change_mask;
|
|
||||||
const char *port_path;
|
|
||||||
PinosProperties *properties;
|
|
||||||
PinosChannelState state;
|
|
||||||
GBytes *possible_formats;
|
|
||||||
GBytes *format;
|
|
||||||
} PinosChannelInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PinosChannelInfoFlags:
|
|
||||||
* @PINOS_CHANNEL_INFO_FLAGS_NONE: no flags
|
|
||||||
* @PINOS_CHANNEL_INFO_FLAGS_NO_INPUT: don't list input channels
|
|
||||||
* @PINOS_CHANNEL_INFO_FLAGS_NO_OUTPUT: don't list output channels
|
|
||||||
*
|
|
||||||
* Extra flags to pass to pinos_context_list_channel_info() and
|
|
||||||
* pinos_context_get_channel_info_by_id().
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
PINOS_CHANNEL_INFO_FLAGS_NONE = 0,
|
|
||||||
PINOS_CHANNEL_INFO_FLAGS_NO_INPUT = (1 << 0),
|
|
||||||
PINOS_CHANNEL_INFO_FLAGS_NO_OUTPUT = (1 << 1),
|
|
||||||
} PinosChannelInfoFlags;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PinosChannelInfoCallback:
|
|
||||||
* @c: a #PinosContext
|
|
||||||
* @info: a #PinosChannelInfo
|
|
||||||
* @user_data: user data
|
|
||||||
*
|
|
||||||
* Callback with information about the Pinos channel in @info.
|
|
||||||
*/
|
|
||||||
typedef void (*PinosChannelInfoCallback) (PinosContext *c,
|
|
||||||
const PinosChannelInfo *info,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
void pinos_context_list_channel_info (PinosContext *context,
|
|
||||||
PinosChannelInfoFlags flags,
|
|
||||||
PinosChannelInfoCallback cb,
|
|
||||||
GCancellable *cancellable,
|
|
||||||
GAsyncReadyCallback callback,
|
|
||||||
gpointer user_data);
|
|
||||||
void pinos_context_get_channel_info_by_id (PinosContext *context,
|
|
||||||
gpointer id,
|
|
||||||
PinosChannelInfoFlags flags,
|
|
||||||
PinosChannelInfoCallback cb,
|
|
||||||
GCancellable *cancellable,
|
|
||||||
GAsyncReadyCallback callback,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PinosConnectionInfo:
|
|
||||||
* @id: generic id of the connection
|
|
||||||
* @connection_path: the unique path of the connection
|
|
||||||
* @change_mask: bitfield of changed fields since last call
|
* @change_mask: bitfield of changed fields since last call
|
||||||
* @source_port_path: the source port
|
* @source_port_path: the source port
|
||||||
* @destination_port_path: the destination port
|
* @destination_port_path: the destination port
|
||||||
*
|
*
|
||||||
* The connection information. Extra information can be added in later
|
* The link information. Extra information can be added in later
|
||||||
* versions.
|
* versions.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
gpointer id;
|
gpointer id;
|
||||||
const char *connection_path;
|
const char *link_path;
|
||||||
guint64 change_mask;
|
guint64 change_mask;
|
||||||
const char *source_port_path;
|
const char *source_port_path;
|
||||||
const char *destination_port_path;
|
const char *destination_port_path;
|
||||||
} PinosConnectionInfo;
|
} PinosLinkInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PinosConnectionInfoFlags:
|
* PinosLinkInfoFlags:
|
||||||
* @PINOS_CONNECTION_INFO_FLAGS_NONE: no flags
|
* @PINOS_LINK_INFO_FLAGS_NONE: no flags
|
||||||
*
|
*
|
||||||
* Extra flags to pass to pinos_context_list_connection_info() and
|
* Extra flags to pass to pinos_context_list_link_info() and
|
||||||
* pinos_context_get_connection_info_by_id().
|
* pinos_context_get_link_info_by_id().
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
PINOS_CONNECTION_INFO_FLAGS_NONE = 0,
|
PINOS_LINK_INFO_FLAGS_NONE = 0,
|
||||||
} PinosConnectionInfoFlags;
|
} PinosLinkInfoFlags;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PinosConnectionInfoCallback:
|
* PinosLinkInfoCallback:
|
||||||
* @c: a #PinosContext
|
* @c: a #PinosContext
|
||||||
* @info: a #PinosConnectionInfo
|
* @info: a #PinosLinkInfo
|
||||||
* @user_data: user data
|
* @user_data: user data
|
||||||
*
|
*
|
||||||
* Callback with information about the Pinos connection in @info.
|
* Callback with information about the Pinos link in @info.
|
||||||
*/
|
*/
|
||||||
typedef void (*PinosConnectionInfoCallback) (PinosContext *c,
|
typedef void (*PinosLinkInfoCallback) (PinosContext *c,
|
||||||
const PinosConnectionInfo *info,
|
const PinosLinkInfo *info,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
void pinos_context_list_connection_info (PinosContext *context,
|
void pinos_context_list_link_info (PinosContext *context,
|
||||||
PinosConnectionInfoFlags flags,
|
PinosLinkInfoFlags flags,
|
||||||
PinosConnectionInfoCallback cb,
|
PinosLinkInfoCallback cb,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
void pinos_context_get_connection_info_by_id (PinosContext *context,
|
void pinos_context_get_link_info_by_id (PinosContext *context,
|
||||||
gpointer id,
|
gpointer id,
|
||||||
PinosConnectionInfoFlags flags,
|
PinosLinkInfoFlags flags,
|
||||||
PinosConnectionInfoCallback cb,
|
PinosLinkInfoCallback cb,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
|
||||||
|
|
@ -40,9 +40,7 @@ struct _PinosContextPrivate
|
||||||
|
|
||||||
GList *clients;
|
GList *clients;
|
||||||
GList *nodes;
|
GList *nodes;
|
||||||
GList *ports;
|
GList *links;
|
||||||
GList *connections;
|
|
||||||
GList *channels;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void pinos_subscribe_get_proxy (PinosSubscribe *subscribe,
|
void pinos_subscribe_get_proxy (PinosSubscribe *subscribe,
|
||||||
|
|
|
||||||
|
|
@ -240,14 +240,14 @@ subscription_cb (PinosSubscribe *subscribe,
|
||||||
PinosStreamPrivate *priv = stream->priv;
|
PinosStreamPrivate *priv = stream->priv;
|
||||||
|
|
||||||
switch (flags) {
|
switch (flags) {
|
||||||
case PINOS_SUBSCRIPTION_FLAG_CHANNEL:
|
case PINOS_SUBSCRIPTION_FLAG_NODE:
|
||||||
if (event == PINOS_SUBSCRIPTION_EVENT_REMOVE) {
|
if (event == PINOS_SUBSCRIPTION_EVENT_REMOVE) {
|
||||||
if (object == priv->node && !priv->disconnecting) {
|
if (object == priv->node && !priv->disconnecting) {
|
||||||
stream_set_state (stream,
|
stream_set_state (stream,
|
||||||
PINOS_STREAM_STATE_ERROR,
|
PINOS_STREAM_STATE_ERROR,
|
||||||
g_error_new_literal (G_IO_ERROR,
|
g_error_new_literal (G_IO_ERROR,
|
||||||
G_IO_ERROR_CLOSED,
|
G_IO_ERROR_CLOSED,
|
||||||
"Channel disappeared"));
|
"Node disappeared"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -888,7 +888,7 @@ do_node_init (PinosStream *stream)
|
||||||
|
|
||||||
pu.direction = priv->direction;
|
pu.direction = priv->direction;
|
||||||
pu.n_possible_formats = priv->possible_formats->len;
|
pu.n_possible_formats = priv->possible_formats->len;
|
||||||
pu.possible_formats = (const SpaFormat **)priv->possible_formats->pdata;
|
pu.possible_formats = (SpaFormat **)priv->possible_formats->pdata;
|
||||||
pu.props = NULL;
|
pu.props = NULL;
|
||||||
pu.info = &priv->port_info;
|
pu.info = &priv->port_info;
|
||||||
priv->port_info.flags = SPA_PORT_INFO_FLAG_NONE |
|
priv->port_info.flags = SPA_PORT_INFO_FLAG_NONE |
|
||||||
|
|
|
||||||
|
|
@ -108,11 +108,8 @@ notify_event (PinosSubscribe *subscribe,
|
||||||
else if (g_strcmp0 (interface_name, "org.pinos.Node1") == 0) {
|
else if (g_strcmp0 (interface_name, "org.pinos.Node1") == 0) {
|
||||||
flags = PINOS_SUBSCRIPTION_FLAG_NODE;
|
flags = PINOS_SUBSCRIPTION_FLAG_NODE;
|
||||||
}
|
}
|
||||||
else if (g_strcmp0 (interface_name, "org.pinos.Port1") == 0) {
|
else if (g_strcmp0 (interface_name, "org.pinos.Link1") == 0) {
|
||||||
flags = PINOS_SUBSCRIPTION_FLAG_PORT;
|
flags = PINOS_SUBSCRIPTION_FLAG_LINK;
|
||||||
}
|
|
||||||
else if (g_strcmp0 (interface_name, "org.pinos.Channel1") == 0) {
|
|
||||||
flags = PINOS_SUBSCRIPTION_FLAG_CHANNEL;
|
|
||||||
}
|
}
|
||||||
g_signal_emit (subscribe, signals[SIGNAL_SUBSCRIPTION_EVENT], 0,
|
g_signal_emit (subscribe, signals[SIGNAL_SUBSCRIPTION_EVENT], 0,
|
||||||
event, flags, data->proxy);
|
event, flags, data->proxy);
|
||||||
|
|
|
||||||
|
|
@ -48,11 +48,10 @@ typedef enum {
|
||||||
PINOS_SUBSCRIPTION_FLAG_DAEMON = (1 << 0),
|
PINOS_SUBSCRIPTION_FLAG_DAEMON = (1 << 0),
|
||||||
PINOS_SUBSCRIPTION_FLAG_CLIENT = (1 << 1),
|
PINOS_SUBSCRIPTION_FLAG_CLIENT = (1 << 1),
|
||||||
PINOS_SUBSCRIPTION_FLAG_NODE = (1 << 2),
|
PINOS_SUBSCRIPTION_FLAG_NODE = (1 << 2),
|
||||||
PINOS_SUBSCRIPTION_FLAG_PORT = (1 << 3),
|
PINOS_SUBSCRIPTION_FLAG_LINK = (1 << 3)
|
||||||
PINOS_SUBSCRIPTION_FLAG_CHANNEL = (1 << 4)
|
|
||||||
} PinosSubscriptionFlags;
|
} PinosSubscriptionFlags;
|
||||||
|
|
||||||
#define PINOS_SUBSCRIPTION_FLAGS_ALL 0x1f
|
#define PINOS_SUBSCRIPTION_FLAGS_ALL 0x0f
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
PINOS_SUBSCRIPTION_EVENT_NEW = 0,
|
PINOS_SUBSCRIPTION_EVENT_NEW = 0,
|
||||||
|
|
|
||||||
|
|
@ -53,8 +53,8 @@
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
<method name='LinkNodes'>
|
<method name='LinkNodes'>
|
||||||
<arg type='o' name='src_node' direction='in' />
|
<arg type='s' name='src_port' direction='in' />
|
||||||
<arg type='o' name='dest_node' direction='in' />
|
<arg type='s' name='dest_port' direction='in' />
|
||||||
<arg type='s' name='format_filter' direction='in'/>
|
<arg type='s' name='format_filter' direction='in'/>
|
||||||
<arg type='a{sv}' name='properties' direction='in'/>
|
<arg type='a{sv}' name='properties' direction='in'/>
|
||||||
<arg type='o' name='link' direction='out' />
|
<arg type='o' name='link' direction='out' />
|
||||||
|
|
@ -132,8 +132,8 @@
|
||||||
<!-- Owner: the owner path of this link -->
|
<!-- Owner: the owner path of this link -->
|
||||||
<property name='Owner' type='s' access='read' />
|
<property name='Owner' type='s' access='read' />
|
||||||
|
|
||||||
<property name='SrcNode' type='o' access='read' />
|
<property name='SrcPort' type='s' access='read' />
|
||||||
<property name='DestNode' type='o' access='read' />
|
<property name='DestPort' type='s' access='read' />
|
||||||
|
|
||||||
<property name='Properties' type='a{sv}' access='read' />
|
<property name='Properties' type='a{sv}' access='read' />
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -358,6 +358,29 @@ on_deactivate (PinosPort *port, gpointer user_data)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
on_property_notify (GObject *obj,
|
||||||
|
GParamSpec *pspec,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
PinosLink *link = user_data;
|
||||||
|
PinosLinkPrivate *priv = link->priv;
|
||||||
|
|
||||||
|
if (pspec == NULL || strcmp (g_param_spec_get_name (pspec), "output") == 0) {
|
||||||
|
gchar *port = g_strdup_printf ("%s:%d", pinos_node_get_object_path (priv->output->node),
|
||||||
|
priv->output->id);
|
||||||
|
pinos_link1_set_src_port (priv->iface, port);
|
||||||
|
g_free (port);
|
||||||
|
}
|
||||||
|
if (pspec == NULL || strcmp (g_param_spec_get_name (pspec), "input") == 0) {
|
||||||
|
gchar *port = g_strdup_printf ("%s:%d", pinos_node_get_object_path (priv->input->node),
|
||||||
|
priv->input->id);
|
||||||
|
pinos_link1_set_dest_port (priv->iface, port);
|
||||||
|
g_free (port);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pinos_link_constructed (GObject * object)
|
pinos_link_constructed (GObject * object)
|
||||||
{
|
{
|
||||||
|
|
@ -380,10 +403,13 @@ pinos_link_constructed (GObject * object)
|
||||||
g_signal_connect (priv->output, "activate", (GCallback) on_activate, link);
|
g_signal_connect (priv->output, "activate", (GCallback) on_activate, link);
|
||||||
g_signal_connect (priv->output, "deactivate", (GCallback) on_deactivate, link);
|
g_signal_connect (priv->output, "deactivate", (GCallback) on_deactivate, link);
|
||||||
|
|
||||||
g_debug ("link %p: constructed", link);
|
g_signal_connect (link, "notify", (GCallback) on_property_notify, link);
|
||||||
link_register_object (link);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (pinos_link_parent_class)->constructed (object);
|
G_OBJECT_CLASS (pinos_link_parent_class)->constructed (object);
|
||||||
|
|
||||||
|
on_property_notify (G_OBJECT (link), NULL, link);
|
||||||
|
g_debug ("link %p: constructed", link);
|
||||||
|
link_register_object (link);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
|
|
@ -374,8 +374,8 @@ pinos_node_constructed (GObject * obj)
|
||||||
|
|
||||||
if (priv->sender == NULL) {
|
if (priv->sender == NULL) {
|
||||||
priv->sender = g_strdup (pinos_daemon_get_sender (priv->daemon));
|
priv->sender = g_strdup (pinos_daemon_get_sender (priv->daemon));
|
||||||
pinos_node1_set_owner (priv->iface, priv->sender);
|
|
||||||
}
|
}
|
||||||
|
on_property_notify (G_OBJECT (node), NULL, node);
|
||||||
|
|
||||||
node_register_object (node);
|
node_register_object (node);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,60 +23,6 @@
|
||||||
|
|
||||||
static GMainLoop *loop;
|
static GMainLoop *loop;
|
||||||
|
|
||||||
static gboolean
|
|
||||||
print_field (GQuark field, const GValue * value, gpointer user_data)
|
|
||||||
{
|
|
||||||
gchar *mark = user_data;
|
|
||||||
gchar *str = gst_value_serialize (value);
|
|
||||||
|
|
||||||
g_print ("%c\t\t%15s: %s\n", *mark, g_quark_to_string (field), str);
|
|
||||||
g_free (str);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
print_formats (const gchar *name, GBytes *formats, gchar mark)
|
|
||||||
{
|
|
||||||
GstCaps *caps = NULL;
|
|
||||||
guint i;
|
|
||||||
|
|
||||||
if (formats == NULL)
|
|
||||||
goto done;
|
|
||||||
|
|
||||||
caps = gst_caps_from_string (g_bytes_get_data (formats, NULL));
|
|
||||||
g_print ("%c\t%s:\n", mark, name);
|
|
||||||
|
|
||||||
if (gst_caps_is_any (caps)) {
|
|
||||||
g_print ("%c\t\tANY\n", mark);
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
if (gst_caps_is_empty (caps)) {
|
|
||||||
g_print ("%c\t\tEMPTY\n", mark);
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
for (i = 0; i < gst_caps_get_size (caps); i++) {
|
|
||||||
GstStructure *structure = gst_caps_get_structure (caps, i);
|
|
||||||
GstCapsFeatures *features = gst_caps_get_features (caps, i);
|
|
||||||
|
|
||||||
if (features && (gst_caps_features_is_any (features) ||
|
|
||||||
!gst_caps_features_is_equal (features,
|
|
||||||
GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY))) {
|
|
||||||
gchar *features_string = gst_caps_features_to_string (features);
|
|
||||||
|
|
||||||
g_print ("%c\t\t%s(%s)\n", mark, gst_structure_get_name (structure),
|
|
||||||
features_string);
|
|
||||||
g_free (features_string);
|
|
||||||
} else {
|
|
||||||
g_print ("%c\t\t%s\n", mark, gst_structure_get_name (structure));
|
|
||||||
}
|
|
||||||
gst_structure_foreach (structure, print_field, &mark);
|
|
||||||
}
|
|
||||||
|
|
||||||
done:
|
|
||||||
if (caps)
|
|
||||||
gst_caps_unref (caps);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_properties (PinosProperties *props, gchar mark)
|
print_properties (PinosProperties *props, gchar mark)
|
||||||
{
|
{
|
||||||
|
|
@ -92,32 +38,6 @@ print_properties (PinosProperties *props, gchar mark)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
print_peers (gchar **peers, gchar mark)
|
|
||||||
{
|
|
||||||
GValue list = G_VALUE_INIT;
|
|
||||||
gint idx = 0;
|
|
||||||
gchar *str;
|
|
||||||
|
|
||||||
g_value_init (&list, GST_TYPE_LIST);
|
|
||||||
|
|
||||||
if (peers != NULL) {
|
|
||||||
while (peers[idx]) {
|
|
||||||
GValue peer = G_VALUE_INIT;
|
|
||||||
|
|
||||||
g_value_init (&peer, G_TYPE_STRING);
|
|
||||||
g_value_set_string (&peer, peers[idx]);
|
|
||||||
gst_value_list_append_and_take_value (&list, &peer);
|
|
||||||
idx++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
str = gst_value_serialize (&list);
|
|
||||||
g_print ("%c\tpeers: %s\n", mark, str);
|
|
||||||
g_free (str);
|
|
||||||
g_value_unset (&list);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
info_ready (GObject *o, GAsyncResult *res, gpointer user_data)
|
info_ready (GObject *o, GAsyncResult *res, gpointer user_data)
|
||||||
{
|
{
|
||||||
|
|
@ -182,56 +102,17 @@ dump_node_info (PinosContext *c, const PinosNodeInfo *info, gpointer user_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_port_info (PinosContext *c, const PinosPortInfo *info, gpointer user_data)
|
dump_link_info (PinosContext *c, const PinosLinkInfo *info, gpointer user_data)
|
||||||
{
|
{
|
||||||
DumpData *data = user_data;
|
DumpData *data = user_data;
|
||||||
|
|
||||||
g_print ("\tid: %p\n", info->id);
|
g_print ("\tid: %p\n", info->id);
|
||||||
g_print ("\tport-path: \"%s\"\n", info->port_path);
|
g_print ("\tlink-path: \"%s\"\n", info->link_path);
|
||||||
if (data->print_all) {
|
|
||||||
g_print ("\tnode-path: \"%s\"\n", info->node_path);
|
|
||||||
g_print ("\tdirection: \"%s\"\n", pinos_direction_as_string (info->direction));
|
|
||||||
g_print ("%c\tname: \"%s\"\n", MARK_CHANGE (0), info->name);
|
|
||||||
print_peers (info->peers, MARK_CHANGE (1));
|
|
||||||
print_properties (info->properties, MARK_CHANGE (2));
|
|
||||||
print_formats ("possible formats", info->possible_formats, MARK_CHANGE (3));
|
|
||||||
print_formats ("format", info->format, MARK_CHANGE (4));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
dump_channel_info (PinosContext *c, const PinosChannelInfo *info, gpointer user_data)
|
|
||||||
{
|
|
||||||
DumpData *data = user_data;
|
|
||||||
|
|
||||||
g_print ("\tid: %p\n", info->id);
|
|
||||||
g_print ("\tchannel-path: \"%s\"\n", info->channel_path);
|
|
||||||
if (data->print_all) {
|
|
||||||
g_print ("\tdirection: \"%s\"\n", pinos_direction_as_string (info->direction));
|
|
||||||
g_print ("\tclient-path: \"%s\"\n", info->client_path);
|
|
||||||
|
|
||||||
g_print ("%c\tnode-path: \"%s\"\n", MARK_CHANGE (0), info->port_path);
|
|
||||||
print_properties (info->properties, MARK_CHANGE (1));
|
|
||||||
g_print ("%c\tstate: \"%s\"\n", MARK_CHANGE (2), pinos_channel_state_as_string (info->state));
|
|
||||||
print_formats ("possible formats", info->possible_formats, MARK_CHANGE (3));
|
|
||||||
print_formats ("format", info->format, MARK_CHANGE (4));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
static void
|
|
||||||
dump_connection_info (PinosContext *c, const PinosConnectionInfo *info, gpointer user_data)
|
|
||||||
{
|
|
||||||
DumpData *data = user_data;
|
|
||||||
|
|
||||||
g_print ("\tid: %p\n", info->id);
|
|
||||||
g_print ("\tconnection-path: \"%s\"\n", info->connection_path);
|
|
||||||
if (data->print_all) {
|
if (data->print_all) {
|
||||||
g_print ("%c\tsource-port-path: \"%s\"\n", MARK_CHANGE (0), info->source_port_path);
|
g_print ("%c\tsource-port-path: \"%s\"\n", MARK_CHANGE (0), info->source_port_path);
|
||||||
g_print ("%c\tdestination-port-path: \"%s\"\n", MARK_CHANGE (1), info->destination_port_path);
|
g_print ("%c\tdestination-port-path: \"%s\"\n", MARK_CHANGE (1), info->destination_port_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_object (PinosContext *context, gpointer id, PinosSubscriptionFlags flags,
|
dump_object (PinosContext *context, gpointer id, PinosSubscriptionFlags flags,
|
||||||
|
|
@ -263,20 +144,11 @@ dump_object (PinosContext *context, gpointer id, PinosSubscriptionFlags flags,
|
||||||
info_ready,
|
info_ready,
|
||||||
data);
|
data);
|
||||||
}
|
}
|
||||||
else if (flags & PINOS_SUBSCRIPTION_FLAG_PORT) {
|
else if (flags & PINOS_SUBSCRIPTION_FLAG_LINK) {
|
||||||
pinos_context_get_port_info_by_id (context,
|
pinos_context_get_link_info_by_id (context,
|
||||||
id,
|
id,
|
||||||
PINOS_PORT_INFO_FLAGS_FORMATS,
|
PINOS_LINK_INFO_FLAGS_NONE,
|
||||||
dump_port_info,
|
dump_link_info,
|
||||||
NULL,
|
|
||||||
info_ready,
|
|
||||||
data);
|
|
||||||
}
|
|
||||||
else if (flags & PINOS_SUBSCRIPTION_FLAG_CHANNEL) {
|
|
||||||
pinos_context_get_channel_info_by_id (context,
|
|
||||||
id,
|
|
||||||
PINOS_CHANNEL_INFO_FLAGS_NONE,
|
|
||||||
dump_channel_info,
|
|
||||||
NULL,
|
NULL,
|
||||||
info_ready,
|
info_ready,
|
||||||
data);
|
data);
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,6 @@ typedef enum {
|
||||||
SPA_PROP_ID_MEDIA_CUSTOM_START = 200,
|
SPA_PROP_ID_MEDIA_CUSTOM_START = 200,
|
||||||
} SpaFormatProps;
|
} SpaFormatProps;
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -118,6 +118,7 @@ typedef enum {
|
||||||
* @buffer_id: a buffer id will be set
|
* @buffer_id: a buffer id will be set
|
||||||
* @offset: offset to get
|
* @offset: offset to get
|
||||||
* @size: size to get
|
* @size: size to get
|
||||||
|
* @event: output event
|
||||||
* @status: a status
|
* @status: a status
|
||||||
*
|
*
|
||||||
* Output information for a node.
|
* Output information for a node.
|
||||||
|
|
@ -128,6 +129,7 @@ typedef struct {
|
||||||
uint32_t buffer_id;
|
uint32_t buffer_id;
|
||||||
off_t offset;
|
off_t offset;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
SpaEvent *event;
|
||||||
SpaResult status;
|
SpaResult status;
|
||||||
} SpaOutputInfo;
|
} SpaOutputInfo;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,5 @@ spa_format_to_string (const SpaFormat *format, char **result)
|
||||||
if (format == NULL || result == NULL)
|
if (format == NULL || result == NULL)
|
||||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,7 @@ spa_props_set_prop (SpaProps *props,
|
||||||
if (info->maxsize < value->size)
|
if (info->maxsize < value->size)
|
||||||
return SPA_RESULT_WRONG_PROPERTY_SIZE;
|
return SPA_RESULT_WRONG_PROPERTY_SIZE;
|
||||||
|
|
||||||
if (info->offset != 0)
|
memcpy (SPA_MEMBER (props, info->offset, void), value->value, value->size);
|
||||||
memcpy ((uint8_t*)props + info->offset, value->value, value->size);
|
|
||||||
|
|
||||||
props->unset_mask &= ~(1u << index);
|
props->unset_mask &= ~(1u << index);
|
||||||
|
|
||||||
|
|
@ -74,8 +73,7 @@ spa_props_get_prop (const SpaProps *props,
|
||||||
|
|
||||||
value->type = info->type;
|
value->type = info->type;
|
||||||
value->size = info->maxsize;
|
value->size = info->maxsize;
|
||||||
if (info->offset != 0)
|
value->value = SPA_MEMBER (props, info->offset, void);
|
||||||
value->value = (uint8_t*)props + info->offset;
|
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -103,8 +101,7 @@ spa_props_copy (const SpaProps *src,
|
||||||
if (value.size > info->maxsize)
|
if (value.size > info->maxsize)
|
||||||
return SPA_RESULT_WRONG_PROPERTY_SIZE;
|
return SPA_RESULT_WRONG_PROPERTY_SIZE;
|
||||||
|
|
||||||
if (info->offset)
|
memcpy (SPA_MEMBER (dest, info->offset, void), value.value, value.size);
|
||||||
memcpy ((uint8_t*)dest + info->offset, value.value, value.size);
|
|
||||||
|
|
||||||
dest->unset_mask &= ~(1u << i);
|
dest->unset_mask &= ~(1u << i);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue