Rework how clients connect.

Add buffer flags. The idea is to make it possible to easily check when a
buffer contains control information that we need to parse to update the
port fields.
Make the client create remote nodes and ports and set up proxies for
them.
Make a port base class implementing most of the logic to pass buffers
locally and remotely.
Remove most code from stream.c, it's now in the port.
Make a portsink and portsrc that can write and read to/from any port. We
use these in the server to send and receive data.
Rework format negotiation. The final format is now sent in-line before
the data. The server will select a format on output ports.
This commit is contained in:
Wim Taymans 2016-05-17 09:38:30 +02:00
parent e85c3002f7
commit 4a5ed1e1f5
35 changed files with 3111 additions and 761 deletions

View file

@ -65,12 +65,16 @@ void
pinos_buffer_clear (PinosBuffer *buffer)
{
PinosStackBuffer *sb = PSB (buffer);
gint i;
g_return_if_fail (is_valid_buffer (buffer));
sb->magic = 0;
g_free (sb->free_data);
for (i = 0; i < sb->n_fds; i++)
close (sb->fds[i]);
g_free (sb->free_fds);
sb->n_fds = 0;
}
/**
@ -94,6 +98,27 @@ pinos_buffer_get_version (PinosBuffer *buffer)
return hdr->version;
}
/**
* pinos_buffer_get_flags
* @buffer: a #PinosBuffer
*
* Get the buffer flags
*
* Returns: the buffer flags.
*/
PinosBufferFlags
pinos_buffer_get_flags (PinosBuffer *buffer)
{
PinosStackBuffer *sb = PSB (buffer);
PinosStackHeader *hdr;
g_return_val_if_fail (is_valid_buffer (buffer), -1);
hdr = sb->data;
return hdr->flags;
}
/**
* pinos_buffer_get_fd:
* @buffer: a #PinosBuffer
@ -397,12 +422,30 @@ pinos_buffer_builder_init_full (PinosBufferBuilder *builder,
sh = sb->sh = sb->buf.data;
sh->version = version;
sh->flags = 0;
sh->length = 0;
sb->type = 0;
sb->offset = 0;
}
/**
* pinos_buffer_builder_set_flags:
* @builder: a #PinosBufferBuilder
* @flags: flags to set
*
* Set the flags on the buffer from @builder.
*/
void
pinos_buffer_builder_set_flags (PinosBufferBuilder *builder, PinosBufferFlags flags)
{
struct stack_builder *sb = PPSB (builder);
g_return_if_fail (is_valid_builder (builder));
sb->sh->flags = flags;
}
/**
* pinos_buffer_builder_clear:
* @builder: a #PinosBufferBuilder
@ -742,6 +785,7 @@ pinos_buffer_builder_add_format_change (PinosBufferBuilder *builder,
len);
*p++ = payload->id;
strcpy (p, payload->format);
sb->sh->flags |= PINOS_BUFFER_FLAG_CONTROL;
return TRUE;
}