mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
Cleanups
spa_serialize -> pinos_serialize Improve PinosPort, move links to the object and make it part of PinosNode Work on improving signals to react to changes in the graph Error when a client-node becomes unlinked, like when removing a camera.
This commit is contained in:
parent
70fb53cdc6
commit
98dbb6424d
13 changed files with 350 additions and 339 deletions
|
|
@ -84,7 +84,7 @@ connection_parse_node_update (PinosConnection *conn, PinosControlCmdNodeUpdate *
|
|||
{
|
||||
memcpy (nu, conn->in.data, sizeof (PinosControlCmdNodeUpdate));
|
||||
if (nu->props)
|
||||
nu->props = spa_serialize_props_deserialize (conn->in.data, SPA_PTR_TO_INT (nu->props));
|
||||
nu->props = pinos_serialize_props_deserialize (conn->in.data, SPA_PTR_TO_INT (nu->props));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -102,16 +102,16 @@ connection_parse_port_update (PinosConnection *conn, PinosControlCmdPortUpdate *
|
|||
SPA_PTR_TO_INT (pu->possible_formats), SpaFormat *);
|
||||
for (i = 0; i < pu->n_possible_formats; i++) {
|
||||
if (pu->possible_formats[i]) {
|
||||
pu->possible_formats[i] = spa_serialize_format_deserialize (p,
|
||||
pu->possible_formats[i] = pinos_serialize_format_deserialize (p,
|
||||
SPA_PTR_TO_INT (pu->possible_formats[i]));
|
||||
}
|
||||
}
|
||||
if (pu->format)
|
||||
pu->format = spa_serialize_format_deserialize (p, SPA_PTR_TO_INT (pu->format));
|
||||
pu->format = pinos_serialize_format_deserialize (p, SPA_PTR_TO_INT (pu->format));
|
||||
if (pu->props)
|
||||
pu->props = spa_serialize_props_deserialize (p, SPA_PTR_TO_INT (pu->props));
|
||||
pu->props = pinos_serialize_props_deserialize (p, SPA_PTR_TO_INT (pu->props));
|
||||
if (pu->info)
|
||||
pu->info = spa_serialize_port_info_deserialize (p, SPA_PTR_TO_INT (pu->info));
|
||||
pu->info = pinos_serialize_port_info_deserialize (p, SPA_PTR_TO_INT (pu->info));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -119,7 +119,7 @@ connection_parse_set_format (PinosConnection *conn, PinosControlCmdSetFormat *cm
|
|||
{
|
||||
memcpy (cmd, conn->in.data, sizeof (PinosControlCmdSetFormat));
|
||||
if (cmd->format)
|
||||
cmd->format = spa_serialize_format_deserialize (conn->in.data, SPA_PTR_TO_INT (cmd->format));
|
||||
cmd->format = pinos_serialize_format_deserialize (conn->in.data, SPA_PTR_TO_INT (cmd->format));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -161,7 +161,7 @@ connection_ensure_size (PinosConnection *conn, ConnectionBuffer *buf, size_t siz
|
|||
if (buf->buffer_size + size > buf->buffer_maxsize) {
|
||||
buf->buffer_maxsize = buf->buffer_size + MAX_BUFFER_SIZE * ((size + MAX_BUFFER_SIZE-1) / MAX_BUFFER_SIZE);
|
||||
buf->buffer_data = realloc (buf->buffer_data, buf->buffer_maxsize);
|
||||
g_warning ("connection %p: resize buffer to %zd\n", conn, buf->buffer_maxsize);
|
||||
g_debug ("connection %p: resize buffer to %zd", conn, buf->buffer_maxsize);
|
||||
}
|
||||
return (uint8_t *) buf->buffer_data + buf->buffer_size;
|
||||
}
|
||||
|
|
@ -202,7 +202,7 @@ connection_add_node_update (PinosConnection *conn, PinosControlCmdNodeUpdate *nu
|
|||
|
||||
/* calc len */
|
||||
len = sizeof (PinosControlCmdNodeUpdate);
|
||||
len += spa_serialize_props_get_size (nu->props);
|
||||
len += pinos_serialize_props_get_size (nu->props);
|
||||
|
||||
p = connection_add_cmd (conn, PINOS_CONTROL_CMD_NODE_UPDATE, len);
|
||||
memcpy (p, nu, sizeof (PinosControlCmdNodeUpdate));
|
||||
|
|
@ -210,7 +210,7 @@ connection_add_node_update (PinosConnection *conn, PinosControlCmdNodeUpdate *nu
|
|||
|
||||
p = SPA_MEMBER (d, sizeof (PinosControlCmdNodeUpdate), void);
|
||||
if (nu->props) {
|
||||
len = spa_serialize_props_serialize (p, nu->props);
|
||||
len = pinos_serialize_props_serialize (p, nu->props);
|
||||
d->props = SPA_INT_TO_PTR (SPA_PTRDIFF (p, d));
|
||||
} else {
|
||||
d->props = 0;
|
||||
|
|
@ -230,12 +230,12 @@ connection_add_port_update (PinosConnection *conn, PinosControlCmdPortUpdate *pu
|
|||
len = sizeof (PinosControlCmdPortUpdate);
|
||||
len += pu->n_possible_formats * sizeof (SpaFormat *);
|
||||
for (i = 0; i < pu->n_possible_formats; i++) {
|
||||
len += spa_serialize_format_get_size (pu->possible_formats[i]);
|
||||
len += pinos_serialize_format_get_size (pu->possible_formats[i]);
|
||||
}
|
||||
len += spa_serialize_format_get_size (pu->format);
|
||||
len += spa_serialize_props_get_size (pu->props);
|
||||
len += pinos_serialize_format_get_size (pu->format);
|
||||
len += pinos_serialize_props_get_size (pu->props);
|
||||
if (pu->info)
|
||||
len += spa_serialize_port_info_get_size (pu->info);
|
||||
len += pinos_serialize_port_info_get_size (pu->info);
|
||||
|
||||
p = connection_add_cmd (conn, PINOS_CONTROL_CMD_PORT_UPDATE, len);
|
||||
memcpy (p, pu, sizeof (PinosControlCmdPortUpdate));
|
||||
|
|
@ -251,26 +251,26 @@ connection_add_port_update (PinosConnection *conn, PinosControlCmdPortUpdate *pu
|
|||
p = SPA_MEMBER (p, sizeof (SpaFormat*) * pu->n_possible_formats, void);
|
||||
|
||||
for (i = 0; i < pu->n_possible_formats; i++) {
|
||||
len = spa_serialize_format_serialize (p, pu->possible_formats[i]);
|
||||
len = pinos_serialize_format_serialize (p, pu->possible_formats[i]);
|
||||
bfa[i] = SPA_INT_TO_PTR (SPA_PTRDIFF (p, d));
|
||||
p = SPA_MEMBER (p, len, void);
|
||||
}
|
||||
if (pu->format) {
|
||||
len = spa_serialize_format_serialize (p, pu->format);
|
||||
len = pinos_serialize_format_serialize (p, pu->format);
|
||||
d->format = SPA_INT_TO_PTR (SPA_PTRDIFF (p, d));
|
||||
p = SPA_MEMBER (p, len, void);
|
||||
} else {
|
||||
d->format = 0;
|
||||
}
|
||||
if (pu->props) {
|
||||
len = spa_serialize_props_serialize (p, pu->props);
|
||||
len = pinos_serialize_props_serialize (p, pu->props);
|
||||
d->props = SPA_INT_TO_PTR (SPA_PTRDIFF (p, d));
|
||||
p = SPA_MEMBER (p, len, void);
|
||||
} else {
|
||||
d->props = 0;
|
||||
}
|
||||
if (pu->info) {
|
||||
len = spa_serialize_port_info_serialize (p, pu->info);
|
||||
len = pinos_serialize_port_info_serialize (p, pu->info);
|
||||
d->info = SPA_INT_TO_PTR (SPA_PTRDIFF (p, d));
|
||||
p = SPA_MEMBER (p, len, void);
|
||||
} else {
|
||||
|
|
@ -286,14 +286,14 @@ connection_add_set_format (PinosConnection *conn, PinosControlCmdSetFormat *sf)
|
|||
|
||||
/* calculate length */
|
||||
/* port_id + format + mask */
|
||||
len = sizeof (PinosControlCmdSetFormat) + spa_serialize_format_get_size (sf->format);
|
||||
len = sizeof (PinosControlCmdSetFormat) + pinos_serialize_format_get_size (sf->format);
|
||||
p = connection_add_cmd (conn, PINOS_CONTROL_CMD_SET_FORMAT, len);
|
||||
memcpy (p, sf, sizeof (PinosControlCmdSetFormat));
|
||||
sf = p;
|
||||
|
||||
p = SPA_MEMBER (sf, sizeof (PinosControlCmdSetFormat), void);
|
||||
if (sf->format) {
|
||||
len = spa_serialize_format_serialize (p, sf->format);
|
||||
len = pinos_serialize_format_serialize (p, sf->format);
|
||||
sf->format = SPA_INT_TO_PTR (SPA_PTRDIFF (p, sf));
|
||||
} else
|
||||
sf->format = 0;
|
||||
|
|
@ -428,7 +428,7 @@ refill_buffer (PinosConnection *conn, ConnectionBuffer *buf)
|
|||
/* ERRORS */
|
||||
recv_error:
|
||||
{
|
||||
g_warning ("could not recvmsg on fd %d: %s\n", conn->fd, strerror (errno));
|
||||
g_warning ("could not recvmsg on fd %d: %s", conn->fd, strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
|
@ -557,7 +557,7 @@ pinos_connection_parse_cmd (PinosConnection *conn,
|
|||
break;
|
||||
|
||||
case PINOS_CONTROL_CMD_PORT_STATUS_CHANGE:
|
||||
g_warning ("implement iter of %d\n", conn->in.cmd);
|
||||
g_warning ("implement iter of %d", conn->in.cmd);
|
||||
break;
|
||||
|
||||
case PINOS_CONTROL_CMD_NODE_STATE_CHANGE:
|
||||
|
|
@ -584,7 +584,7 @@ pinos_connection_parse_cmd (PinosConnection *conn,
|
|||
break;
|
||||
|
||||
case PINOS_CONTROL_CMD_SET_PROPERTY:
|
||||
g_warning ("implement iter of %d\n", conn->in.cmd);
|
||||
g_warning ("implement iter of %d", conn->in.cmd);
|
||||
break;
|
||||
|
||||
/* bidirectional */
|
||||
|
|
@ -739,7 +739,7 @@ pinos_connection_add_cmd (PinosConnection *conn,
|
|||
break;
|
||||
|
||||
case PINOS_CONTROL_CMD_SET_PROPERTY:
|
||||
g_warning ("implement builder of %d\n", cmd);
|
||||
g_warning ("implement builder of %d", cmd);
|
||||
break;
|
||||
|
||||
/* bidirectional */
|
||||
|
|
@ -837,7 +837,7 @@ pinos_connection_flush (PinosConnection *conn)
|
|||
/* ERRORS */
|
||||
send_error:
|
||||
{
|
||||
g_warning ("could not sendmsg: %s\n", strerror (errno));
|
||||
g_warning ("could not sendmsg: %s", strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@ format_copy (SpaFormat *format)
|
|||
if (format == NULL)
|
||||
return NULL;
|
||||
|
||||
size = spa_serialize_format_get_size (format);
|
||||
size = pinos_serialize_format_get_size (format);
|
||||
p = malloc (size);
|
||||
return spa_serialize_format_copy_into (p, format);
|
||||
return pinos_serialize_format_copy_into (p, format);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
#include "serialize.h"
|
||||
|
||||
size_t
|
||||
spa_serialize_buffer_get_size (const SpaBuffer *buffer)
|
||||
pinos_serialize_buffer_get_size (const SpaBuffer *buffer)
|
||||
{
|
||||
size_t size;
|
||||
unsigned int i;
|
||||
|
|
@ -37,7 +37,7 @@ spa_serialize_buffer_get_size (const SpaBuffer *buffer)
|
|||
}
|
||||
|
||||
size_t
|
||||
spa_serialize_buffer_serialize (void *dest, const SpaBuffer *buffer)
|
||||
pinos_serialize_buffer_serialize (void *dest, const SpaBuffer *buffer)
|
||||
{
|
||||
SpaBuffer *tb;
|
||||
SpaMeta *mp;
|
||||
|
|
@ -70,7 +70,7 @@ spa_serialize_buffer_serialize (void *dest, const SpaBuffer *buffer)
|
|||
}
|
||||
|
||||
SpaBuffer *
|
||||
spa_serialize_buffer_deserialize (void *src, off_t offset)
|
||||
pinos_serialize_buffer_deserialize (void *src, off_t offset)
|
||||
{
|
||||
SpaBuffer *b;
|
||||
unsigned int i;
|
||||
|
|
@ -91,16 +91,16 @@ spa_serialize_buffer_deserialize (void *src, off_t offset)
|
|||
|
||||
|
||||
size_t
|
||||
spa_serialize_format_get_size (const SpaFormat *format)
|
||||
pinos_serialize_format_get_size (const SpaFormat *format)
|
||||
{
|
||||
if (format == NULL)
|
||||
return 0;
|
||||
|
||||
return spa_serialize_props_get_size (&format->props) - sizeof (SpaProps) + sizeof (SpaFormat);
|
||||
return pinos_serialize_props_get_size (&format->props) - sizeof (SpaProps) + sizeof (SpaFormat);
|
||||
}
|
||||
|
||||
size_t
|
||||
spa_serialize_format_serialize (void *dest, const SpaFormat *format)
|
||||
pinos_serialize_format_serialize (void *dest, const SpaFormat *format)
|
||||
{
|
||||
SpaFormat *tf;
|
||||
size_t size;
|
||||
|
|
@ -113,34 +113,34 @@ spa_serialize_format_serialize (void *dest, const SpaFormat *format)
|
|||
tf->media_subtype = format->media_subtype;
|
||||
|
||||
dest = SPA_MEMBER (tf, offsetof (SpaFormat, props), void);
|
||||
size = spa_serialize_props_serialize (dest, &format->props) - sizeof (SpaProps) + sizeof (SpaFormat);
|
||||
size = pinos_serialize_props_serialize (dest, &format->props) - sizeof (SpaProps) + sizeof (SpaFormat);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
SpaFormat *
|
||||
spa_serialize_format_deserialize (void *src, off_t offset)
|
||||
pinos_serialize_format_deserialize (void *src, off_t offset)
|
||||
{
|
||||
SpaFormat *f;
|
||||
|
||||
f = SPA_MEMBER (src, offset, SpaFormat);
|
||||
spa_serialize_props_deserialize (f, offsetof (SpaFormat, props));
|
||||
pinos_serialize_props_deserialize (f, offsetof (SpaFormat, props));
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
SpaFormat *
|
||||
spa_serialize_format_copy_into (void *dest, const SpaFormat *format)
|
||||
pinos_serialize_format_copy_into (void *dest, const SpaFormat *format)
|
||||
{
|
||||
if (format == NULL)
|
||||
return NULL;
|
||||
|
||||
spa_serialize_format_serialize (dest, format);
|
||||
return spa_serialize_format_deserialize (dest, 0);
|
||||
pinos_serialize_format_serialize (dest, format);
|
||||
return pinos_serialize_format_deserialize (dest, 0);
|
||||
}
|
||||
|
||||
size_t
|
||||
spa_serialize_port_info_get_size (const SpaPortInfo *info)
|
||||
pinos_serialize_port_info_get_size (const SpaPortInfo *info)
|
||||
{
|
||||
size_t len;
|
||||
unsigned int i;
|
||||
|
|
@ -157,7 +157,7 @@ spa_serialize_port_info_get_size (const SpaPortInfo *info)
|
|||
}
|
||||
|
||||
size_t
|
||||
spa_serialize_port_info_serialize (void *p, const SpaPortInfo *info)
|
||||
pinos_serialize_port_info_serialize (void *p, const SpaPortInfo *info)
|
||||
{
|
||||
SpaPortInfo *pi;
|
||||
SpaAllocParam **ap;
|
||||
|
|
@ -189,7 +189,7 @@ spa_serialize_port_info_serialize (void *p, const SpaPortInfo *info)
|
|||
}
|
||||
|
||||
SpaPortInfo *
|
||||
spa_serialize_port_info_deserialize (void *p, off_t offset)
|
||||
pinos_serialize_port_info_deserialize (void *p, off_t offset)
|
||||
{
|
||||
SpaPortInfo *pi;
|
||||
unsigned int i;
|
||||
|
|
@ -204,17 +204,17 @@ spa_serialize_port_info_deserialize (void *p, off_t offset)
|
|||
}
|
||||
|
||||
SpaPortInfo *
|
||||
spa_serialize_port_info_copy_into (void *dest, const SpaPortInfo *info)
|
||||
pinos_serialize_port_info_copy_into (void *dest, const SpaPortInfo *info)
|
||||
{
|
||||
if (info == NULL)
|
||||
return NULL;
|
||||
|
||||
spa_serialize_port_info_serialize (dest, info);
|
||||
return spa_serialize_port_info_deserialize (dest, 0);
|
||||
pinos_serialize_port_info_serialize (dest, info);
|
||||
return pinos_serialize_port_info_deserialize (dest, 0);
|
||||
}
|
||||
|
||||
size_t
|
||||
spa_serialize_props_get_size (const SpaProps *props)
|
||||
pinos_serialize_props_get_size (const SpaProps *props)
|
||||
{
|
||||
size_t len;
|
||||
unsigned int i, j;
|
||||
|
|
@ -243,7 +243,7 @@ spa_serialize_props_get_size (const SpaProps *props)
|
|||
}
|
||||
|
||||
size_t
|
||||
spa_serialize_props_serialize (void *p, const SpaProps *props)
|
||||
pinos_serialize_props_serialize (void *p, const SpaProps *props)
|
||||
{
|
||||
size_t len, slen;
|
||||
unsigned int i, j, c;
|
||||
|
|
@ -314,7 +314,7 @@ spa_serialize_props_serialize (void *p, const SpaProps *props)
|
|||
}
|
||||
|
||||
SpaProps *
|
||||
spa_serialize_props_deserialize (void *p, off_t offset)
|
||||
pinos_serialize_props_deserialize (void *p, off_t offset)
|
||||
{
|
||||
SpaProps *tp;
|
||||
unsigned int i, j;
|
||||
|
|
@ -344,11 +344,11 @@ spa_serialize_props_deserialize (void *p, off_t offset)
|
|||
}
|
||||
|
||||
SpaProps *
|
||||
spa_serialize_props_copy_into (void *dest, const SpaProps *props)
|
||||
pinos_serialize_props_copy_into (void *dest, const SpaProps *props)
|
||||
{
|
||||
if (props == NULL)
|
||||
return NULL;
|
||||
|
||||
spa_serialize_props_serialize (dest, props);
|
||||
return spa_serialize_props_deserialize (dest, 0);
|
||||
pinos_serialize_props_serialize (dest, props);
|
||||
return pinos_serialize_props_deserialize (dest, 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,39 +17,37 @@
|
|||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SPA_SERIALIZE_H__
|
||||
#define __SPA_SERIALIZE_H__
|
||||
#ifndef __PINOS_SERIALIZE_H__
|
||||
#define __PINOS_SERIALIZE_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include <glib-object.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#include <spa/include/spa/buffer.h>
|
||||
#include <spa/include/spa/format.h>
|
||||
#include <spa/include/spa/props.h>
|
||||
#include <spa/include/spa/port.h>
|
||||
|
||||
size_t spa_serialize_buffer_get_size (const SpaBuffer *buffer);
|
||||
size_t spa_serialize_buffer_serialize (void *dest, const SpaBuffer *buffer);
|
||||
SpaBuffer * spa_serialize_buffer_deserialize (void *src, off_t offset);
|
||||
size_t pinos_serialize_buffer_get_size (const SpaBuffer *buffer);
|
||||
size_t pinos_serialize_buffer_serialize (void *dest, const SpaBuffer *buffer);
|
||||
SpaBuffer * pinos_serialize_buffer_deserialize (void *src, off_t offset);
|
||||
|
||||
size_t spa_serialize_format_get_size (const SpaFormat *format);
|
||||
size_t spa_serialize_format_serialize (void *dest, const SpaFormat *format);
|
||||
SpaFormat * spa_serialize_format_deserialize (void *src, off_t offset);
|
||||
SpaFormat * spa_serialize_format_copy_into (void *dest, const SpaFormat *format);
|
||||
size_t pinos_serialize_format_get_size (const SpaFormat *format);
|
||||
size_t pinos_serialize_format_serialize (void *dest, const SpaFormat *format);
|
||||
SpaFormat * pinos_serialize_format_deserialize (void *src, off_t offset);
|
||||
SpaFormat * pinos_serialize_format_copy_into (void *dest, const SpaFormat *format);
|
||||
|
||||
size_t spa_serialize_port_info_get_size (const SpaPortInfo *info);
|
||||
size_t spa_serialize_port_info_serialize (void *dest, const SpaPortInfo *info);
|
||||
SpaPortInfo * spa_serialize_port_info_deserialize (void *src, off_t offset);
|
||||
SpaPortInfo * spa_serialize_port_info_copy_into (void *dest, const SpaPortInfo *info);
|
||||
size_t pinos_serialize_port_info_get_size (const SpaPortInfo *info);
|
||||
size_t pinos_serialize_port_info_serialize (void *dest, const SpaPortInfo *info);
|
||||
SpaPortInfo * pinos_serialize_port_info_deserialize (void *src, off_t offset);
|
||||
SpaPortInfo * pinos_serialize_port_info_copy_into (void *dest, const SpaPortInfo *info);
|
||||
|
||||
size_t spa_serialize_props_get_size (const SpaProps *props);
|
||||
size_t spa_serialize_props_serialize (void *dest, const SpaProps *props);
|
||||
SpaProps * spa_serialize_props_deserialize (void *src, off_t offset);
|
||||
SpaProps * spa_serialize_props_copy_into (void *dest, const SpaProps *props);
|
||||
size_t pinos_serialize_props_get_size (const SpaProps *props);
|
||||
size_t pinos_serialize_props_serialize (void *dest, const SpaProps *props);
|
||||
SpaProps * pinos_serialize_props_deserialize (void *src, off_t offset);
|
||||
SpaProps * pinos_serialize_props_copy_into (void *dest, const SpaProps *props);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __SPA_SERIALIZE_H__ */
|
||||
#endif /* __PINOS_SERIALIZE_H__ */
|
||||
|
|
|
|||
|
|
@ -656,7 +656,6 @@ add_port_update (PinosStream *stream, uint32_t change_mask)
|
|||
pu.props = NULL;
|
||||
if (change_mask & PINOS_CONTROL_CMD_PORT_UPDATE_INFO) {
|
||||
pu.info = &priv->port_info;
|
||||
spa_debug_port_info (pu.info);
|
||||
}
|
||||
pinos_connection_add_cmd (priv->conn, PINOS_CONTROL_CMD_PORT_UPDATE, &pu);
|
||||
}
|
||||
|
|
@ -978,10 +977,9 @@ parse_connection (PinosStream *stream)
|
|||
|
||||
if (priv->format)
|
||||
g_free (priv->format);
|
||||
mem = malloc (spa_serialize_format_get_size (p.format));
|
||||
priv->format = spa_serialize_format_copy_into (mem, p.format);
|
||||
mem = malloc (pinos_serialize_format_get_size (p.format));
|
||||
priv->format = pinos_serialize_format_copy_into (mem, p.format);
|
||||
|
||||
spa_debug_format (p.format);
|
||||
priv->pending_seq = p.seq;
|
||||
g_object_notify (G_OBJECT (stream), "format");
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -146,13 +146,13 @@ handle_video_format (ConvertData *d)
|
|||
*sv = gst_video_format_from_string (g_value_get_string (val));
|
||||
d->p = ++sv;
|
||||
} else if (G_VALUE_TYPE (val) == GST_TYPE_LIST) {
|
||||
fprintf (stderr, "implement me\n");
|
||||
g_debug ("implement me");
|
||||
SPA_PROPS_INDEX_UNSET (&d->f->props, d->pi);
|
||||
} else if (G_VALUE_TYPE (val) == GST_TYPE_ARRAY) {
|
||||
fprintf (stderr, "implement me\n");
|
||||
g_debug ("implement me");
|
||||
SPA_PROPS_INDEX_UNSET (&d->f->props, d->pi);
|
||||
} else {
|
||||
fprintf (stderr, "implement me\n");
|
||||
g_debug ("implement me");
|
||||
SPA_PROPS_INDEX_UNSET (&d->f->props, d->pi);
|
||||
}
|
||||
d->pi++;
|
||||
|
|
@ -204,13 +204,13 @@ handle_video_size (ConvertData *d)
|
|||
|
||||
SPA_PROPS_INDEX_UNSET (&d->f->props, d->pi);
|
||||
} else if (G_VALUE_TYPE (val) == GST_TYPE_LIST) {
|
||||
fprintf (stderr, "implement me\n");
|
||||
g_debug ("implement me");
|
||||
SPA_PROPS_INDEX_UNSET (&d->f->props, d->pi);
|
||||
} else if (G_VALUE_TYPE (val) == GST_TYPE_ARRAY) {
|
||||
fprintf (stderr, "implement me\n");
|
||||
g_debug ("implement me");
|
||||
SPA_PROPS_INDEX_UNSET (&d->f->props, d->pi);
|
||||
} else {
|
||||
fprintf (stderr, "implement me\n");
|
||||
g_debug ("implement me");
|
||||
SPA_PROPS_INDEX_UNSET (&d->f->props, d->pi);
|
||||
}
|
||||
}
|
||||
|
|
@ -266,13 +266,13 @@ handle_video_framerate (ConvertData *d)
|
|||
|
||||
SPA_PROPS_INDEX_UNSET (&d->f->props, d->pi);
|
||||
} else if (G_VALUE_TYPE (val) == GST_TYPE_LIST) {
|
||||
fprintf (stderr, "implement me\n");
|
||||
g_debug ("implement me");
|
||||
SPA_PROPS_INDEX_UNSET (&d->f->props, d->pi);
|
||||
} else if (G_VALUE_TYPE (val) == GST_TYPE_ARRAY) {
|
||||
fprintf (stderr, "implement me\n");
|
||||
g_debug ("implement me");
|
||||
SPA_PROPS_INDEX_UNSET (&d->f->props, d->pi);
|
||||
} else {
|
||||
fprintf (stderr, "implement me\n");
|
||||
g_debug ("implement me");
|
||||
SPA_PROPS_INDEX_UNSET (&d->f->props, d->pi);
|
||||
}
|
||||
d->pi++;
|
||||
|
|
@ -329,13 +329,13 @@ convert_1 (GstCapsFeatures *cf, GstStructure *cs)
|
|||
*sv = gst_audio_format_from_string (g_value_get_string (val));
|
||||
d.p = ++sv;
|
||||
} else if (G_VALUE_TYPE (val) == GST_TYPE_LIST) {
|
||||
fprintf (stderr, "implement me\n");
|
||||
g_debug ("implement me");
|
||||
SPA_PROPS_INDEX_UNSET (&d.f->props, d.pi);
|
||||
} else if (G_VALUE_TYPE (val) == GST_TYPE_ARRAY) {
|
||||
fprintf (stderr, "implement me\n");
|
||||
g_debug ("implement me");
|
||||
SPA_PROPS_INDEX_UNSET (&d.f->props, d.pi);
|
||||
} else {
|
||||
fprintf (stderr, "implement me\n");
|
||||
g_debug ("implement me");
|
||||
SPA_PROPS_INDEX_UNSET (&d.f->props, d.pi);
|
||||
}
|
||||
d.pi++;
|
||||
|
|
@ -356,13 +356,13 @@ convert_1 (GstCapsFeatures *cf, GstStructure *cs)
|
|||
*sv = SPA_AUDIO_LAYOUT_NON_INTERLEAVED;
|
||||
d.p = ++sv;
|
||||
} else if (G_VALUE_TYPE (val) == GST_TYPE_LIST) {
|
||||
fprintf (stderr, "implement me\n");
|
||||
g_debug ("implement me");
|
||||
SPA_PROPS_INDEX_UNSET (&d.f->props, d.pi);
|
||||
} else if (G_VALUE_TYPE (val) == GST_TYPE_ARRAY) {
|
||||
fprintf (stderr, "implement me\n");
|
||||
g_debug ("implement me");
|
||||
SPA_PROPS_INDEX_UNSET (&d.f->props, d.pi);
|
||||
} else {
|
||||
fprintf (stderr, "implement me\n");
|
||||
g_debug ("implement me");
|
||||
SPA_PROPS_INDEX_UNSET (&d.f->props, d.pi);
|
||||
}
|
||||
d.pi++;
|
||||
|
|
@ -379,13 +379,13 @@ convert_1 (GstCapsFeatures *cf, GstStructure *cs)
|
|||
*sv = g_value_get_int (val);
|
||||
d.p = ++sv;
|
||||
} else if (G_VALUE_TYPE (val) == GST_TYPE_LIST) {
|
||||
fprintf (stderr, "implement me\n");
|
||||
g_debug ("implement me");
|
||||
SPA_PROPS_INDEX_UNSET (&d.f->props, d.pi);
|
||||
} else if (G_VALUE_TYPE (val) == GST_TYPE_ARRAY) {
|
||||
fprintf (stderr, "implement me\n");
|
||||
g_debug ("implement me");
|
||||
SPA_PROPS_INDEX_UNSET (&d.f->props, d.pi);
|
||||
} else {
|
||||
fprintf (stderr, "implement me\n");
|
||||
g_debug ("implement me");
|
||||
SPA_PROPS_INDEX_UNSET (&d.f->props, d.pi);
|
||||
}
|
||||
d.pi++;
|
||||
|
|
@ -402,13 +402,13 @@ convert_1 (GstCapsFeatures *cf, GstStructure *cs)
|
|||
*sv = g_value_get_int (val);
|
||||
d.p = ++sv;
|
||||
} else if (G_VALUE_TYPE (val) == GST_TYPE_LIST) {
|
||||
fprintf (stderr, "implement me\n");
|
||||
g_debug ("implement me");
|
||||
SPA_PROPS_INDEX_UNSET (&d.f->props, d.pi);
|
||||
} else if (G_VALUE_TYPE (val) == GST_TYPE_ARRAY) {
|
||||
fprintf (stderr, "implement me\n");
|
||||
g_debug ("implement me");
|
||||
SPA_PROPS_INDEX_UNSET (&d.f->props, d.pi);
|
||||
} else {
|
||||
fprintf (stderr, "implement me\n");
|
||||
g_debug ("implement me");
|
||||
SPA_PROPS_INDEX_UNSET (&d.f->props, d.pi);
|
||||
}
|
||||
d.pi++;
|
||||
|
|
|
|||
|
|
@ -334,15 +334,15 @@ do_update_port (SpaProxy *this,
|
|||
port->n_formats = pu->n_possible_formats;
|
||||
port->formats = realloc (port->formats, port->n_formats * sizeof (SpaFormat *));
|
||||
for (i = 0; i < port->n_formats; i++) {
|
||||
size = spa_serialize_format_get_size (pu->possible_formats[i]);
|
||||
port->formats[i] = spa_serialize_format_copy_into (malloc (size), pu->possible_formats[i]);
|
||||
size = pinos_serialize_format_get_size (pu->possible_formats[i]);
|
||||
port->formats[i] = pinos_serialize_format_copy_into (malloc (size), pu->possible_formats[i]);
|
||||
}
|
||||
}
|
||||
if (pu->change_mask & PINOS_CONTROL_CMD_PORT_UPDATE_FORMAT) {
|
||||
if (port->format)
|
||||
free (port->format);
|
||||
size = spa_serialize_format_get_size (pu->format);
|
||||
port->format = spa_serialize_format_copy_into (malloc (size), pu->format);
|
||||
size = pinos_serialize_format_get_size (pu->format);
|
||||
port->format = pinos_serialize_format_copy_into (malloc (size), pu->format);
|
||||
}
|
||||
|
||||
if (pu->change_mask & PINOS_CONTROL_CMD_PORT_UPDATE_PROPS) {
|
||||
|
|
@ -351,8 +351,8 @@ do_update_port (SpaProxy *this,
|
|||
if (pu->change_mask & PINOS_CONTROL_CMD_PORT_UPDATE_INFO && pu->info) {
|
||||
if (port->info)
|
||||
free (port->info);
|
||||
size = spa_serialize_port_info_get_size (pu->info);
|
||||
port->info = spa_serialize_port_info_copy_into (malloc (size), pu->info);
|
||||
size = pinos_serialize_port_info_get_size (pu->info);
|
||||
port->info = pinos_serialize_port_info_copy_into (malloc (size), pu->info);
|
||||
}
|
||||
|
||||
if (!port->valid) {
|
||||
|
|
@ -654,7 +654,7 @@ spa_proxy_node_port_use_buffers (SpaNode *node,
|
|||
b->buffer.datas = b->datas;
|
||||
b->buffer.metas = b->metas;
|
||||
|
||||
b->size = spa_serialize_buffer_get_size (buffers[i]);
|
||||
b->size = pinos_serialize_buffer_get_size (buffers[i]);
|
||||
b->offset = size;
|
||||
|
||||
for (j = 0; j < buffers[i]->n_metas; j++) {
|
||||
|
|
@ -724,7 +724,7 @@ spa_proxy_node_port_use_buffers (SpaNode *node,
|
|||
SpaMeta *sbm;
|
||||
SpaData *sbd;
|
||||
|
||||
spa_serialize_buffer_serialize (p, &b->buffer);
|
||||
pinos_serialize_buffer_serialize (p, &b->buffer);
|
||||
|
||||
sb = p;
|
||||
b->buffer.datas = SPA_MEMBER (sb, SPA_PTR_TO_INT (sb->datas), SpaData);
|
||||
|
|
|
|||
|
|
@ -152,20 +152,14 @@ handle_create_node (PinosDaemon1 *interface,
|
|||
props = pinos_properties_from_variant (arg_properties);
|
||||
|
||||
factory = g_hash_table_lookup (priv->node_factories, arg_factory_name);
|
||||
if (factory != NULL) {
|
||||
if (factory == NULL)
|
||||
goto no_factory;
|
||||
|
||||
node = pinos_node_factory_create_node (factory,
|
||||
daemon,
|
||||
client,
|
||||
arg_name,
|
||||
props);
|
||||
} else {
|
||||
node = pinos_node_new (daemon,
|
||||
client,
|
||||
arg_name,
|
||||
props,
|
||||
NULL);
|
||||
}
|
||||
|
||||
pinos_properties_free (props);
|
||||
|
||||
if (node == NULL)
|
||||
|
|
@ -187,6 +181,13 @@ handle_create_node (PinosDaemon1 *interface,
|
|||
return TRUE;
|
||||
|
||||
/* ERRORS */
|
||||
no_factory:
|
||||
{
|
||||
g_debug ("daemon %p: could find factory named %s", daemon, arg_factory_name);
|
||||
g_dbus_method_invocation_return_dbus_error (invocation,
|
||||
"org.pinos.Error", "can't find factory");
|
||||
return TRUE;
|
||||
}
|
||||
no_node:
|
||||
{
|
||||
g_debug ("daemon %p: could create node named %s from factory %s", daemon, arg_name, arg_factory_name);
|
||||
|
|
@ -196,6 +197,29 @@ no_node:
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
on_node_remove_signal (PinosNode *node,
|
||||
PinosDaemon *daemon)
|
||||
{
|
||||
g_debug ("daemon %p: node %p remove", daemon, node);
|
||||
}
|
||||
|
||||
static void
|
||||
on_link_input_unlinked (PinosLink *link,
|
||||
PinosPort *port,
|
||||
PinosDaemon *daemon)
|
||||
{
|
||||
g_debug ("daemon %p: link %p: input unlinked", daemon, link);
|
||||
}
|
||||
|
||||
static void
|
||||
on_link_output_unlinked (PinosLink *link,
|
||||
PinosPort *port,
|
||||
PinosDaemon *daemon)
|
||||
{
|
||||
g_debug ("daemon %p: link %p: output unlinked", daemon, link);
|
||||
}
|
||||
|
||||
static void
|
||||
on_link_state_notify (GObject *obj,
|
||||
GParamSpec *pspec,
|
||||
|
|
@ -209,20 +233,29 @@ on_link_state_notify (GObject *obj,
|
|||
switch (state) {
|
||||
case PINOS_LINK_STATE_ERROR:
|
||||
{
|
||||
g_warning ("daemon %p: link %p: state error: %s", daemon, link, error->message);
|
||||
g_debug ("daemon %p: link %p: state error: %s", daemon, link, error->message);
|
||||
|
||||
if (link->input->node) {
|
||||
if (link->input && link->input->node)
|
||||
pinos_node_report_error (link->input->node, g_error_copy (error));
|
||||
}
|
||||
if (link->output->node) {
|
||||
if (link->output && link->output->node)
|
||||
pinos_node_report_error (link->output->node, g_error_copy (error));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case PINOS_LINK_STATE_UNLINKED:
|
||||
g_warning ("daemon %p: link %p: unlinked", daemon, link);
|
||||
g_debug ("daemon %p: link %p: unlinked", daemon, link);
|
||||
|
||||
g_set_error (&error,
|
||||
PINOS_ERROR,
|
||||
PINOS_ERROR_NODE_LINK,
|
||||
"error node unlinked");
|
||||
|
||||
if (link->input && link->input->node)
|
||||
pinos_node_report_error (link->input->node, g_error_copy (error));
|
||||
if (link->output && link->output->node)
|
||||
pinos_node_report_error (link->output->node, g_error_copy (error));
|
||||
break;
|
||||
|
||||
case PINOS_LINK_STATE_INIT:
|
||||
case PINOS_LINK_STATE_NEGOTIATING:
|
||||
case PINOS_LINK_STATE_ALLOCATING:
|
||||
|
|
@ -233,14 +266,14 @@ on_link_state_notify (GObject *obj,
|
|||
}
|
||||
|
||||
static void
|
||||
on_port_added (PinosNode *node, PinosDirection direction, PinosDaemon *this)
|
||||
on_port_added (PinosNode *node, PinosPort *port, PinosDaemon *this)
|
||||
{
|
||||
PinosClient *client;
|
||||
PinosProperties *props;
|
||||
PinosNode *target;
|
||||
const gchar *path;
|
||||
GError *error = NULL;
|
||||
PinosLink *link;
|
||||
PinosDirection direction = port->direction;
|
||||
|
||||
props = pinos_node_get_properties (node);
|
||||
if (props == NULL)
|
||||
|
|
@ -249,10 +282,9 @@ on_port_added (PinosNode *node, PinosDirection direction, PinosDaemon *this)
|
|||
path = pinos_properties_get (props, "pinos.target.node");
|
||||
|
||||
if (path) {
|
||||
guint target_port;
|
||||
guint node_port;
|
||||
PinosPort *target;
|
||||
|
||||
target = pinos_daemon_find_node (this,
|
||||
target = pinos_daemon_find_port (this,
|
||||
pinos_direction_reverse (direction),
|
||||
path,
|
||||
NULL,
|
||||
|
|
@ -262,36 +294,21 @@ on_port_added (PinosNode *node, PinosDirection direction, PinosDaemon *this)
|
|||
if (target == NULL)
|
||||
goto error;
|
||||
|
||||
target_port = pinos_node_get_free_port (target, pinos_direction_reverse (direction));
|
||||
if (target_port == SPA_ID_INVALID) {
|
||||
g_set_error (&error,
|
||||
PINOS_ERROR,
|
||||
PINOS_ERROR_NODE_PORT,
|
||||
"can't get free port from target %s", pinos_node_get_object_path (target));
|
||||
goto error;
|
||||
}
|
||||
node_port = pinos_node_get_free_port (node, direction);
|
||||
if (node_port == SPA_ID_INVALID) {
|
||||
g_set_error (&error,
|
||||
PINOS_ERROR,
|
||||
PINOS_ERROR_NODE_PORT,
|
||||
"can't get free port from node %s", pinos_node_get_object_path (node));
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (direction == PINOS_DIRECTION_OUTPUT)
|
||||
link = pinos_node_link (node, node_port, target, target_port, NULL, NULL, &error);
|
||||
link = pinos_node_link (node, port, target, NULL, NULL, &error);
|
||||
else
|
||||
link = pinos_node_link (target, target_port, node, node_port, NULL, NULL, &error);
|
||||
link = pinos_node_link (target->node, target, port, NULL, NULL, &error);
|
||||
|
||||
if (link == NULL)
|
||||
goto error;
|
||||
|
||||
client = pinos_node_get_client (node);
|
||||
if (client) {
|
||||
if (client)
|
||||
pinos_client_add_object (client, G_OBJECT (link));
|
||||
}
|
||||
|
||||
g_signal_connect (target->node, "remove", (GCallback) on_node_remove_signal, daemon);
|
||||
g_signal_connect (link, "input-unlinked", (GCallback) on_link_input_unlinked, daemon);
|
||||
g_signal_connect (link, "output-unlinked", (GCallback) on_link_output_unlinked, daemon);
|
||||
g_signal_connect (link, "notify::state", (GCallback) on_link_state_notify, daemon);
|
||||
pinos_link_activate (link);
|
||||
|
||||
|
|
@ -307,21 +324,29 @@ error:
|
|||
}
|
||||
|
||||
static void
|
||||
on_port_removed (PinosNode *node, PinosDaemon *daemon)
|
||||
on_port_removed (PinosNode *node, PinosPort *port, PinosDaemon *daemon)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
handle_node_connections (PinosDaemon *daemon,
|
||||
PinosNode *node)
|
||||
on_node_created (PinosNode *node,
|
||||
PinosDaemon *daemon)
|
||||
{
|
||||
PinosDirection direction;
|
||||
GList *ports, *walk;
|
||||
|
||||
direction = node->have_inputs ? PINOS_DIRECTION_INPUT : PINOS_DIRECTION_OUTPUT;
|
||||
ports = pinos_node_get_ports (node, PINOS_DIRECTION_INPUT);
|
||||
for (walk = ports; walk; walk = g_list_next (walk))
|
||||
on_port_added (node, walk->data, daemon);
|
||||
|
||||
on_port_added (node, direction, daemon);
|
||||
ports = pinos_node_get_ports (node, PINOS_DIRECTION_OUTPUT);
|
||||
for (walk = ports; walk; walk = g_list_next (walk))
|
||||
on_port_added (node, walk->data, daemon);
|
||||
|
||||
g_signal_connect (node, "port-added", (GCallback) on_port_added, daemon);
|
||||
g_signal_connect (node, "port-removed", (GCallback) on_port_removed, daemon);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
on_node_state_change (PinosNode *node,
|
||||
PinosNodeState old,
|
||||
|
|
@ -333,7 +358,7 @@ on_node_state_change (PinosNode *node,
|
|||
pinos_node_state_as_string (state));
|
||||
|
||||
if (old == PINOS_NODE_STATE_CREATING && state == PINOS_NODE_STATE_SUSPENDED)
|
||||
handle_node_connections (daemon, node);
|
||||
on_node_created (node, daemon);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -350,17 +375,14 @@ on_node_added (PinosDaemon *daemon, PinosNode *node)
|
|||
|
||||
state = pinos_node_get_state (node);
|
||||
if (state > PINOS_NODE_STATE_CREATING) {
|
||||
handle_node_connections (daemon, node);
|
||||
on_node_created (node, daemon);
|
||||
}
|
||||
g_signal_connect (node, "port-added", (GCallback) on_port_added, daemon);
|
||||
g_signal_connect (node, "port-removed", (GCallback) on_port_removed, daemon);
|
||||
}
|
||||
|
||||
static void
|
||||
on_node_removed (PinosDaemon *daemon, PinosNode *node)
|
||||
{
|
||||
g_debug ("daemon %p: node %p removed", daemon, node);
|
||||
|
||||
g_signal_handlers_disconnect_by_data (node, daemon);
|
||||
}
|
||||
|
||||
|
|
@ -703,7 +725,7 @@ pinos_daemon_remove_node (PinosDaemon *daemon,
|
|||
}
|
||||
|
||||
/**
|
||||
* pinos_daemon_find_node:
|
||||
* pinos_daemon_find_port:
|
||||
* @daemon: a #PinosDaemon
|
||||
* @name: a port name
|
||||
* @props: port properties
|
||||
|
|
@ -714,8 +736,8 @@ pinos_daemon_remove_node (PinosDaemon *daemon,
|
|||
*
|
||||
* Returns: a #PinosPort or %NULL when no port could be found.
|
||||
*/
|
||||
PinosNode *
|
||||
pinos_daemon_find_node (PinosDaemon *daemon,
|
||||
PinosPort *
|
||||
pinos_daemon_find_port (PinosDaemon *daemon,
|
||||
PinosDirection direction,
|
||||
const gchar *name,
|
||||
PinosProperties *props,
|
||||
|
|
@ -724,7 +746,7 @@ pinos_daemon_find_node (PinosDaemon *daemon,
|
|||
GError **error)
|
||||
{
|
||||
PinosDaemonPrivate *priv;
|
||||
PinosNode *best = NULL;
|
||||
PinosPort *best = NULL;
|
||||
GList *nodes;
|
||||
gboolean have_name;
|
||||
|
||||
|
|
@ -740,12 +762,16 @@ pinos_daemon_find_node (PinosDaemon *daemon,
|
|||
|
||||
g_debug ("node path \"%s\"", pinos_node_get_object_path (n));
|
||||
|
||||
if (have_name && g_str_has_suffix (pinos_node_get_object_path (n), name)) {
|
||||
if (have_name) {
|
||||
if (g_str_has_suffix (pinos_node_get_object_path (n), name)) {
|
||||
g_debug ("name \"%s\" matches node %p", name, n);
|
||||
best = n;
|
||||
|
||||
best = pinos_node_get_free_port (n, direction);
|
||||
if (best)
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
}
|
||||
}
|
||||
if (best == NULL) {
|
||||
g_set_error (error,
|
||||
|
|
@ -1025,7 +1051,6 @@ pinos_daemon_init (PinosDaemon * daemon)
|
|||
|
||||
priv->main_loop.size = sizeof (SpaPoll);
|
||||
priv->main_loop.info = NULL;
|
||||
priv->main_loop.info = NULL;
|
||||
priv->main_loop.add_item = do_add_item;
|
||||
priv->main_loop.update_item = do_update_item;
|
||||
priv->main_loop.remove_item = do_remove_item;
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ void pinos_daemon_unexport (PinosDaemon *daemon, const gch
|
|||
void pinos_daemon_add_node (PinosDaemon *daemon, PinosNode *node);
|
||||
void pinos_daemon_remove_node (PinosDaemon *daemon, PinosNode *node);
|
||||
|
||||
PinosNode * pinos_daemon_find_node (PinosDaemon *daemon,
|
||||
PinosPort * pinos_daemon_find_port (PinosDaemon *daemon,
|
||||
PinosDirection direction,
|
||||
const gchar *name,
|
||||
PinosProperties *props,
|
||||
|
|
|
|||
|
|
@ -74,6 +74,8 @@ enum
|
|||
enum
|
||||
{
|
||||
SIGNAL_REMOVE,
|
||||
SIGNAL_INPUT_UNLINKED,
|
||||
SIGNAL_OUTPUT_UNLINKED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
|
|
@ -735,12 +737,22 @@ on_property_notify (GObject *obj,
|
|||
PinosLinkPrivate *priv = this->priv;
|
||||
|
||||
if (pspec == NULL || strcmp (g_param_spec_get_name (pspec), "output-port") == 0) {
|
||||
if (this->output) {
|
||||
pinos_link1_set_output_node (priv->iface, pinos_node_get_object_path (this->output->node));
|
||||
pinos_link1_set_output_port (priv->iface, this->output->port);
|
||||
} else {
|
||||
pinos_link1_set_output_node (priv->iface, "/");
|
||||
pinos_link1_set_output_port (priv->iface, -1);
|
||||
}
|
||||
}
|
||||
if (pspec == NULL || strcmp (g_param_spec_get_name (pspec), "input-port") == 0) {
|
||||
if (this->input) {
|
||||
pinos_link1_set_input_node (priv->iface, pinos_node_get_object_path (this->input->node));
|
||||
pinos_link1_set_input_port (priv->iface, this->input->port);
|
||||
} else {
|
||||
pinos_link1_set_input_node (priv->iface, "/");
|
||||
pinos_link1_set_input_port (priv->iface, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -756,14 +768,19 @@ on_node_remove (PinosNode *node, PinosLink *this)
|
|||
priv->n_buffers = 0;
|
||||
}
|
||||
this->input = NULL;
|
||||
g_object_notify (G_OBJECT (this), "input-port");
|
||||
g_signal_emit (this, signals[SIGNAL_INPUT_UNLINKED], 0, node);
|
||||
} else {
|
||||
if (this->output->allocated) {
|
||||
priv->buffers = NULL;
|
||||
priv->n_buffers = 0;
|
||||
}
|
||||
this->output = NULL;
|
||||
g_object_notify (G_OBJECT (this), "output-port");
|
||||
g_signal_emit (this, signals[SIGNAL_OUTPUT_UNLINKED], 0, node);
|
||||
}
|
||||
|
||||
if (this->input == NULL || this->output == NULL)
|
||||
pinos_link_update_state (this, PINOS_LINK_STATE_UNLINKED);
|
||||
}
|
||||
|
||||
|
|
@ -796,9 +813,9 @@ pinos_link_dispose (GObject * object)
|
|||
|
||||
g_debug ("link %p: dispose", this);
|
||||
|
||||
if (this->input->node)
|
||||
if (this->input && this->input->node)
|
||||
g_signal_handlers_disconnect_by_data (this->input->node, this);
|
||||
if (this->output->node)
|
||||
if (this->output && this->output->node)
|
||||
g_signal_handlers_disconnect_by_data (this->output->node, this);
|
||||
|
||||
g_signal_emit (this, signals[SIGNAL_REMOVE], 0, NULL);
|
||||
|
|
@ -929,6 +946,26 @@ pinos_link_class_init (PinosLinkClass * klass)
|
|||
G_TYPE_NONE,
|
||||
0,
|
||||
G_TYPE_NONE);
|
||||
signals[SIGNAL_INPUT_UNLINKED] = g_signal_new ("input-unlinked",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
g_cclosure_marshal_generic,
|
||||
G_TYPE_NONE,
|
||||
1,
|
||||
G_TYPE_POINTER);
|
||||
signals[SIGNAL_OUTPUT_UNLINKED] = g_signal_new ("output-unlinked",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
g_cclosure_marshal_generic,
|
||||
G_TYPE_NONE,
|
||||
1,
|
||||
G_TYPE_POINTER);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -41,15 +41,6 @@ typedef struct _PinosLinkPrivate PinosLinkPrivate;
|
|||
#define PINOS_LINK_CAST(obj) ((PinosLink*)(obj))
|
||||
#define PINOS_LINK_CLASS_CAST(klass)((PinosLinkClass*)(klass))
|
||||
|
||||
typedef struct {
|
||||
PinosNode *node;
|
||||
uint32_t port;
|
||||
gboolean allocated;
|
||||
PinosMemblock buffer_mem;
|
||||
SpaBuffer **buffers;
|
||||
guint n_buffers;
|
||||
} PinosPort;
|
||||
|
||||
/**
|
||||
* PinosLink:
|
||||
*
|
||||
|
|
|
|||
|
|
@ -33,36 +33,32 @@
|
|||
#define PINOS_NODE_GET_PRIVATE(node) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((node), PINOS_TYPE_NODE, PinosNodePrivate))
|
||||
|
||||
typedef struct {
|
||||
PinosPort port;
|
||||
GPtrArray *links;
|
||||
} NodePort;
|
||||
|
||||
static NodePort *
|
||||
new_node_port (PinosNode *node, uint32_t port)
|
||||
static PinosPort *
|
||||
new_pinos_port (PinosNode *node, PinosDirection direction, uint32_t port)
|
||||
{
|
||||
NodePort *np;
|
||||
np = g_slice_new0 (NodePort);
|
||||
np->port.node = node;
|
||||
np->port.port = port;
|
||||
PinosPort *np;
|
||||
np = g_slice_new0 (PinosPort);
|
||||
np->node = node;
|
||||
np->direction = direction;
|
||||
np->port = port;
|
||||
np->links = g_ptr_array_new ();
|
||||
return np;
|
||||
}
|
||||
|
||||
static void
|
||||
free_node_port (NodePort *np)
|
||||
free_node_port (PinosPort *np)
|
||||
{
|
||||
g_ptr_array_free (np->links, TRUE);
|
||||
g_slice_free (NodePort, np);
|
||||
g_slice_free (PinosPort, np);
|
||||
}
|
||||
|
||||
static NodePort *
|
||||
static PinosPort *
|
||||
find_node_port (GList *ports, PinosNode *node, uint32_t port)
|
||||
{
|
||||
GList *walk;
|
||||
for (walk = ports; walk; walk = g_list_next (walk)) {
|
||||
NodePort *np = walk->data;
|
||||
if (np->port.node == node && np->port.port == port)
|
||||
PinosPort *np = walk->data;
|
||||
if (np->node == node && np->port == port)
|
||||
return np;
|
||||
}
|
||||
return NULL;
|
||||
|
|
@ -162,33 +158,33 @@ update_port_ids (PinosNode *node, gboolean create)
|
|||
i = 0;
|
||||
ports = priv->input_ports;
|
||||
while (true) {
|
||||
NodePort *p = (ports ? ports->data : NULL);
|
||||
PinosPort *p = (ports ? ports->data : NULL);
|
||||
|
||||
if (p && i < n_input_ports && p->port.port == input_port_ids[i]) {
|
||||
if (p && i < n_input_ports && p->port == input_port_ids[i]) {
|
||||
i++;
|
||||
ports = g_list_next (ports);
|
||||
} else if ((p && i < n_input_ports && input_port_ids[i] < p->port.port) || i < n_input_ports) {
|
||||
NodePort *np;
|
||||
} else if ((p && i < n_input_ports && input_port_ids[i] < p->port) || i < n_input_ports) {
|
||||
PinosPort *np;
|
||||
g_debug ("node %p: input port added %d", node, input_port_ids[i]);
|
||||
|
||||
np = new_node_port (node, input_port_ids[i]);
|
||||
np = new_pinos_port (node, PINOS_DIRECTION_INPUT, input_port_ids[i]);
|
||||
priv->input_ports = g_list_insert_before (priv->input_ports, ports, np);
|
||||
|
||||
if (!priv->async_init)
|
||||
g_signal_emit (node, signals[SIGNAL_PORT_ADDED], 0, PINOS_DIRECTION_INPUT);
|
||||
g_signal_emit (node, signals[SIGNAL_PORT_ADDED], 0, np);
|
||||
i++;
|
||||
} else if (p) {
|
||||
GList *next;
|
||||
g_debug ("node %p: input port removed %d", node, p->port.port);
|
||||
g_debug ("node %p: input port removed %d", node, p->port);
|
||||
|
||||
next = g_list_next (ports);
|
||||
priv->input_ports = g_list_delete_link (priv->input_ports, ports);
|
||||
ports = next;
|
||||
|
||||
free_node_port (p);
|
||||
|
||||
if (!priv->async_init)
|
||||
g_signal_emit (node, signals[SIGNAL_PORT_REMOVED], 0, PINOS_DIRECTION_INPUT);
|
||||
g_signal_emit (node, signals[SIGNAL_PORT_REMOVED], 0, p);
|
||||
|
||||
free_node_port (p);
|
||||
} else
|
||||
break;
|
||||
}
|
||||
|
|
@ -196,33 +192,33 @@ update_port_ids (PinosNode *node, gboolean create)
|
|||
i = 0;
|
||||
ports = priv->output_ports;
|
||||
while (true) {
|
||||
NodePort *p = (ports ? ports->data : NULL);
|
||||
PinosPort *p = (ports ? ports->data : NULL);
|
||||
|
||||
if (p && i < n_output_ports && p->port.port == output_port_ids[i]) {
|
||||
if (p && i < n_output_ports && p->port == output_port_ids[i]) {
|
||||
i++;
|
||||
ports = g_list_next (ports);
|
||||
} else if ((p && i < n_output_ports && output_port_ids[i] < p->port.port) || i < n_output_ports) {
|
||||
NodePort *np;
|
||||
} else if ((p && i < n_output_ports && output_port_ids[i] < p->port) || i < n_output_ports) {
|
||||
PinosPort *np;
|
||||
g_debug ("node %p: output port added %d", node, output_port_ids[i]);
|
||||
|
||||
np = new_node_port (node, output_port_ids[i]);
|
||||
np = new_pinos_port (node, PINOS_DIRECTION_OUTPUT, output_port_ids[i]);
|
||||
priv->output_ports = g_list_insert_before (priv->output_ports, ports, np);
|
||||
|
||||
if (!priv->async_init)
|
||||
g_signal_emit (node, signals[SIGNAL_PORT_ADDED], 0, PINOS_DIRECTION_INPUT);
|
||||
g_signal_emit (node, signals[SIGNAL_PORT_ADDED], 0, np);
|
||||
i++;
|
||||
} else if (p) {
|
||||
GList *next;
|
||||
g_debug ("node %p: output port removed %d", node, p->port.port);
|
||||
g_debug ("node %p: output port removed %d", node, p->port);
|
||||
|
||||
next = g_list_next (ports);
|
||||
priv->output_ports = g_list_delete_link (priv->output_ports, ports);
|
||||
ports = next;
|
||||
|
||||
free_node_port (p);
|
||||
|
||||
if (!priv->async_init)
|
||||
g_signal_emit (node, signals[SIGNAL_PORT_REMOVED], 0, PINOS_DIRECTION_INPUT);
|
||||
g_signal_emit (node, signals[SIGNAL_PORT_REMOVED], 0, p);
|
||||
|
||||
free_node_port (p);
|
||||
} else
|
||||
break;
|
||||
}
|
||||
|
|
@ -281,24 +277,24 @@ suspend_node (PinosNode *this)
|
|||
g_debug ("node %p: suspend node", this);
|
||||
|
||||
for (walk = priv->input_ports; walk; walk = g_list_next (walk)) {
|
||||
NodePort *p = walk->data;
|
||||
if ((res = spa_node_port_set_format (this->node, SPA_DIRECTION_INPUT, p->port.port, 0, NULL)) < 0)
|
||||
PinosPort *p = walk->data;
|
||||
if ((res = spa_node_port_set_format (this->node, SPA_DIRECTION_INPUT, p->port, 0, NULL)) < 0)
|
||||
g_warning ("error unset format output: %d", res);
|
||||
p->port.buffers = NULL;
|
||||
p->port.n_buffers = 0;
|
||||
if (p->port.allocated)
|
||||
pinos_memblock_free (&p->port.buffer_mem);
|
||||
p->port.allocated = FALSE;
|
||||
p->buffers = NULL;
|
||||
p->n_buffers = 0;
|
||||
if (p->allocated)
|
||||
pinos_memblock_free (&p->buffer_mem);
|
||||
p->allocated = FALSE;
|
||||
}
|
||||
for (walk = priv->output_ports; walk; walk = g_list_next (walk)) {
|
||||
NodePort *p = walk->data;
|
||||
if ((res = spa_node_port_set_format (this->node, SPA_DIRECTION_OUTPUT, p->port.port, 0, NULL)) < 0)
|
||||
PinosPort *p = walk->data;
|
||||
if ((res = spa_node_port_set_format (this->node, SPA_DIRECTION_OUTPUT, p->port, 0, NULL)) < 0)
|
||||
g_warning ("error unset format output: %d", res);
|
||||
p->port.buffers = NULL;
|
||||
p->port.n_buffers = 0;
|
||||
if (p->port.allocated)
|
||||
pinos_memblock_free (&p->port.buffer_mem);
|
||||
p->port.allocated = FALSE;
|
||||
p->buffers = NULL;
|
||||
p->n_buffers = 0;
|
||||
if (p->allocated)
|
||||
pinos_memblock_free (&p->buffer_mem);
|
||||
p->allocated = FALSE;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
@ -457,7 +453,7 @@ on_node_event (SpaNode *node, SpaNodeEvent *event, void *user_data)
|
|||
case SPA_NODE_EVENT_TYPE_NEED_INPUT:
|
||||
{
|
||||
SpaNodeEventNeedInput *ni = event->data;
|
||||
NodePort *p;
|
||||
PinosPort *p;
|
||||
guint i;
|
||||
|
||||
if (!(p = find_node_port (priv->input_ports, this, ni->port_id)))
|
||||
|
|
@ -477,7 +473,7 @@ on_node_event (SpaNode *node, SpaNodeEvent *event, void *user_data)
|
|||
SpaPortOutputInfo oinfo[1] = { 0, };
|
||||
SpaResult res;
|
||||
gboolean pushed = FALSE;
|
||||
NodePort *p;
|
||||
PinosPort *p;
|
||||
guint i;
|
||||
|
||||
oinfo[0].port_id = ho->port_id;
|
||||
|
|
@ -513,7 +509,7 @@ on_node_event (SpaNode *node, SpaNodeEvent *event, void *user_data)
|
|||
{
|
||||
SpaResult res;
|
||||
SpaNodeEventReuseBuffer *rb = event->data;
|
||||
NodePort *p;
|
||||
PinosPort *p;
|
||||
guint i;
|
||||
|
||||
if (!(p = find_node_port (priv->input_ports, this, rb->port_id)))
|
||||
|
|
@ -912,7 +908,7 @@ pinos_node_class_init (PinosNodeClass * klass)
|
|||
g_cclosure_marshal_generic,
|
||||
G_TYPE_NONE,
|
||||
1,
|
||||
PINOS_TYPE_DIRECTION);
|
||||
G_TYPE_POINTER);
|
||||
signals[SIGNAL_PORT_REMOVED] = g_signal_new ("port-removed",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
|
|
@ -922,7 +918,7 @@ pinos_node_class_init (PinosNodeClass * klass)
|
|||
g_cclosure_marshal_generic,
|
||||
G_TYPE_NONE,
|
||||
1,
|
||||
PINOS_TYPE_DIRECTION);
|
||||
G_TYPE_POINTER);
|
||||
signals[SIGNAL_ASYNC_COMPLETE] = g_signal_new ("async-complete",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
|
|
@ -953,35 +949,6 @@ pinos_node_init (PinosNode * node)
|
|||
pinos_node1_set_state (priv->iface, priv->state);
|
||||
}
|
||||
|
||||
/**
|
||||
* pinos_node_new:
|
||||
* @daemon: a #PinosDaemon
|
||||
* @client: the client owner
|
||||
* @name: a name
|
||||
* @properties: extra properties
|
||||
*
|
||||
* Create a new #PinosNode.
|
||||
*
|
||||
* Returns: a new #PinosNode
|
||||
*/
|
||||
PinosNode *
|
||||
pinos_node_new (PinosDaemon *daemon,
|
||||
PinosClient *client,
|
||||
const gchar *name,
|
||||
PinosProperties *properties,
|
||||
SpaNode *node)
|
||||
{
|
||||
g_return_val_if_fail (PINOS_IS_DAEMON (daemon), NULL);
|
||||
|
||||
return g_object_new (PINOS_TYPE_NODE,
|
||||
"daemon", daemon,
|
||||
"client", client,
|
||||
"name", name,
|
||||
"properties", properties,
|
||||
"node", node,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* pinos_node_get_name:
|
||||
* @node: a #PinosNode
|
||||
|
|
@ -1120,15 +1087,16 @@ pinos_node_remove (PinosNode *node)
|
|||
*
|
||||
* Returns: the new port id or %SPA_ID_INVALID on error
|
||||
*/
|
||||
guint
|
||||
PinosPort *
|
||||
pinos_node_get_free_port (PinosNode *node,
|
||||
PinosDirection direction)
|
||||
{
|
||||
PinosNodePrivate *priv;
|
||||
guint free_port, n_ports, max_ports;
|
||||
GList *ports, *walk;
|
||||
PinosPort *port = NULL;
|
||||
|
||||
g_return_val_if_fail (PINOS_IS_NODE (node), SPA_ID_INVALID);
|
||||
g_return_val_if_fail (PINOS_IS_NODE (node), NULL);
|
||||
priv = node->priv;
|
||||
|
||||
if (direction == PINOS_DIRECTION_INPUT) {
|
||||
|
|
@ -1147,26 +1115,25 @@ pinos_node_get_free_port (PinosNode *node,
|
|||
for (walk = ports; walk; walk = g_list_next (walk)) {
|
||||
PinosPort *p = walk->data;
|
||||
|
||||
if (free_port < p->port)
|
||||
if (free_port < p->port) {
|
||||
port = p;
|
||||
break;
|
||||
|
||||
}
|
||||
free_port = p->port + 1;
|
||||
}
|
||||
if (free_port >= max_ports && ports) {
|
||||
PinosPort *p = ports->data;
|
||||
|
||||
free_port = p->port;
|
||||
port = ports->data;
|
||||
} else
|
||||
return SPA_ID_INVALID;
|
||||
return NULL;
|
||||
|
||||
return free_port;
|
||||
return port;
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
do_remove_link (PinosLink *link, PinosNode *node)
|
||||
{
|
||||
NodePort *p;
|
||||
PinosPort *p;
|
||||
PinosNode *n;
|
||||
|
||||
if (link->output) {
|
||||
|
|
@ -1195,13 +1162,12 @@ do_remove_link (PinosLink *link, PinosNode *node)
|
|||
* pinos_node_link:
|
||||
* @output_node: a #PinosNode
|
||||
* @output_port: an output port
|
||||
* @input_node: a #PinosNode
|
||||
* @input_port: an input port
|
||||
* @format_filter: a format filter
|
||||
* @properties: extra properties
|
||||
* @error: an error or %NULL
|
||||
*
|
||||
* Make a link between @output_node and @input_node with the given ids
|
||||
* Make a link between @output_port and @input_port with the given ids
|
||||
*
|
||||
* If the ports were already linked, the existing links will be returned.
|
||||
*
|
||||
|
|
@ -1212,47 +1178,41 @@ do_remove_link (PinosLink *link, PinosNode *node)
|
|||
*/
|
||||
PinosLink *
|
||||
pinos_node_link (PinosNode *output_node,
|
||||
guint output_port,
|
||||
PinosNode *input_node,
|
||||
guint input_port,
|
||||
PinosPort *output_port,
|
||||
PinosPort *input_port,
|
||||
GPtrArray *format_filter,
|
||||
PinosProperties *properties,
|
||||
GError **error)
|
||||
{
|
||||
PinosNodePrivate *priv;
|
||||
NodePort *onp, *inp;
|
||||
PinosNode *input_node;
|
||||
PinosLink *link = NULL;
|
||||
guint i;
|
||||
|
||||
g_return_val_if_fail (PINOS_IS_NODE (output_node), NULL);
|
||||
g_return_val_if_fail (PINOS_IS_NODE (input_node), NULL);
|
||||
g_return_val_if_fail (output_port != NULL, NULL);
|
||||
g_return_val_if_fail (input_port != NULL, NULL);
|
||||
|
||||
priv = output_node->priv;
|
||||
input_node = input_port->node;
|
||||
|
||||
g_debug ("node %p: link %u %p:%u", output_node, output_port, input_node, input_port);
|
||||
g_debug ("node %p: link %u %p:%u", output_node, output_port->port, input_node, input_port->port);
|
||||
|
||||
if (output_node == input_node)
|
||||
goto same_node;
|
||||
|
||||
onp = find_node_port (priv->output_ports, output_node, output_port);
|
||||
if (onp == NULL)
|
||||
goto no_output_ports;
|
||||
|
||||
for (i = 0; i < onp->links->len; i++) {
|
||||
PinosLink *pl = g_ptr_array_index (onp->links, i);
|
||||
if (pl->input->node == input_node && pl->input->port == input_port) {
|
||||
for (i = 0; i < output_port->links->len; i++) {
|
||||
PinosLink *pl = g_ptr_array_index (output_port->links, i);
|
||||
if (pl->input->node == input_node && pl->input == input_port) {
|
||||
link = pl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
inp = find_node_port (input_node->priv->input_ports, input_node, input_port);
|
||||
if (inp == NULL)
|
||||
goto no_input_ports;
|
||||
|
||||
if (link) {
|
||||
/* FIXME */
|
||||
link->input->node = input_node;
|
||||
link->input->port = input_port;
|
||||
link->input = input_port;
|
||||
g_object_ref (link);
|
||||
} else {
|
||||
input_node->live = output_node->live;
|
||||
|
|
@ -1262,14 +1222,14 @@ pinos_node_link (PinosNode *output_node,
|
|||
|
||||
link = g_object_new (PINOS_TYPE_LINK,
|
||||
"daemon", priv->daemon,
|
||||
"output-port", &onp->port,
|
||||
"input-port", &inp->port,
|
||||
"output-port", output_port,
|
||||
"input-port", input_port,
|
||||
"format-filter", format_filter,
|
||||
"properties", properties,
|
||||
NULL);
|
||||
|
||||
g_ptr_array_add (onp->links, link);
|
||||
g_ptr_array_add (inp->links, link);
|
||||
g_ptr_array_add (output_port->links, link);
|
||||
g_ptr_array_add (input_port->links, link);
|
||||
|
||||
g_signal_connect (link,
|
||||
"remove",
|
||||
|
|
@ -1289,37 +1249,32 @@ same_node:
|
|||
"can't link a node to itself");
|
||||
return NULL;
|
||||
}
|
||||
no_input_ports:
|
||||
{
|
||||
g_set_error (error,
|
||||
PINOS_ERROR,
|
||||
PINOS_ERROR_NODE_LINK,
|
||||
"can't get an input port to link to");
|
||||
return NULL;
|
||||
}
|
||||
no_output_ports:
|
||||
{
|
||||
g_set_error (error,
|
||||
PINOS_ERROR,
|
||||
PINOS_ERROR_NODE_LINK,
|
||||
"can't get an output port to link to");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* pinos_node_get_links:
|
||||
* pinos_node_get_ports:
|
||||
* @node: a #PinosNode
|
||||
* @direction: a #PinosDirection
|
||||
*
|
||||
* Get the links in @node.
|
||||
* Get the port in @node.
|
||||
*
|
||||
* Returns: a #GList of #PinosLink g_list_free after usage.
|
||||
* Returns: a #GList of #PinosPort g_list_free after usage.
|
||||
*/
|
||||
GList *
|
||||
pinos_node_get_links (PinosNode *node)
|
||||
pinos_node_get_ports (PinosNode *node, PinosDirection direction)
|
||||
{
|
||||
GList *ports;
|
||||
PinosNodePrivate *priv;
|
||||
|
||||
g_return_val_if_fail (PINOS_IS_NODE (node), NULL);
|
||||
return NULL;
|
||||
priv = node->priv;
|
||||
|
||||
if (direction == PINOS_DIRECTION_INPUT) {
|
||||
ports = priv->input_ports;
|
||||
} else {
|
||||
ports = priv->output_ports;
|
||||
}
|
||||
return ports;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _PinosPort PinosPort;
|
||||
typedef struct _PinosNode PinosNode;
|
||||
typedef struct _PinosNodeClass PinosNodeClass;
|
||||
typedef struct _PinosNodePrivate PinosNodePrivate;
|
||||
|
|
@ -34,6 +35,18 @@ typedef struct _PinosNodePrivate PinosNodePrivate;
|
|||
#include <pinos/server/daemon.h>
|
||||
#include <pinos/server/link.h>
|
||||
#include <pinos/server/client.h>
|
||||
#include <pinos/server/utils.h>
|
||||
|
||||
struct _PinosPort {
|
||||
PinosNode *node;
|
||||
PinosDirection direction;
|
||||
uint32_t port;
|
||||
gboolean allocated;
|
||||
PinosMemblock buffer_mem;
|
||||
SpaBuffer **buffers;
|
||||
guint n_buffers;
|
||||
GPtrArray *links;
|
||||
};
|
||||
|
||||
#define PINOS_TYPE_NODE (pinos_node_get_type ())
|
||||
#define PINOS_IS_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PINOS_TYPE_NODE))
|
||||
|
|
@ -79,11 +92,6 @@ struct _PinosNodeClass {
|
|||
/* normal GObject stuff */
|
||||
GType pinos_node_get_type (void);
|
||||
|
||||
PinosNode * pinos_node_new (PinosDaemon *daemon,
|
||||
PinosClient *client,
|
||||
const gchar *name,
|
||||
PinosProperties *properties,
|
||||
SpaNode *node);
|
||||
void pinos_node_remove (PinosNode *node);
|
||||
|
||||
const gchar * pinos_node_get_name (PinosNode *node);
|
||||
|
|
@ -93,18 +101,17 @@ PinosDaemon * pinos_node_get_daemon (PinosNode *node);
|
|||
PinosClient * pinos_node_get_client (PinosNode *node);
|
||||
const gchar * pinos_node_get_object_path (PinosNode *node);
|
||||
|
||||
guint pinos_node_get_free_port (PinosNode *node,
|
||||
PinosPort * pinos_node_get_free_port (PinosNode *node,
|
||||
PinosDirection direction);
|
||||
|
||||
PinosLink * pinos_node_link (PinosNode *output_node,
|
||||
guint output_id,
|
||||
PinosNode *input_node,
|
||||
guint input_id,
|
||||
PinosPort *output_port,
|
||||
PinosPort *input_port,
|
||||
GPtrArray *format_filter,
|
||||
PinosProperties *properties,
|
||||
GError **error);
|
||||
GList * pinos_node_get_links (PinosNode *node);
|
||||
|
||||
GList * pinos_node_get_ports (PinosNode *node,
|
||||
PinosDirection direction);
|
||||
|
||||
PinosNodeState pinos_node_get_state (PinosNode *node);
|
||||
gboolean pinos_node_set_state (PinosNode *node, PinosNodeState state);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue