diff options
author | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2011-08-07 16:36:32 +0200 |
---|---|---|
committer | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2011-10-12 08:49:02 +0100 |
commit | 52a7d015cd2a0dc7b97b2a28964f5f9dffdc528f (patch) | |
tree | c6e62cbc2fa35b04577a5960ecbc7021f4336e70 /sys | |
parent | acdd2c20f7ad360b752079248a166ed28ce1b5f1 (diff) | |
download | gstreamer-plugins-bad-52a7d015cd2a0dc7b97b2a28964f5f9dffdc528f.tar.gz |
shm: Add ability to add uint64 tags on buffers
Diffstat (limited to 'sys')
-rw-r--r-- | sys/shm/shmpipe.c | 24 | ||||
-rw-r--r-- | sys/shm/shmpipe.h | 8 |
2 files changed, 29 insertions, 3 deletions
diff --git a/sys/shm/shmpipe.c b/sys/shm/shmpipe.c index c629ea05c..583aa3846 100644 --- a/sys/shm/shmpipe.c +++ b/sys/shm/shmpipe.c @@ -78,7 +78,6 @@ enum }; typedef struct _ShmArea ShmArea; -typedef struct _ShmBuffer ShmBuffer; struct _ShmArea { @@ -112,6 +111,8 @@ struct _ShmBuffer int num_clients; int clients[0]; + + uint64_t tag; }; @@ -542,7 +543,7 @@ sp_writer_free_block (ShmBlock * block) /* Returns the number of client this has successfully been sent to */ int -sp_writer_send_buf (ShmPipe * self, char *buf, size_t size) +sp_writer_send_buf (ShmPipe * self, char *buf, size_t size, uint64_t tag) { ShmArea *area = NULL; unsigned long offset = 0; @@ -577,6 +578,7 @@ sp_writer_send_buf (ShmPipe * self, char *buf, size_t size) sb->size = size; sb->num_clients = self->num_clients; sb->ablock = ablock; + sb->tag = tag; for (client = self->clients; client; client = client->next) { struct CommandBuffer cb = { 0 }; @@ -892,3 +894,21 @@ sp_writer_get_path (ShmPipe * pipe) { return pipe->socket_path; } + +ShmBuffer * +sp_writer_get_pending_buffers (ShmPipe * self) +{ + return self->buffers; +} + +ShmBuffer * +sp_writer_get_next_buffer (ShmBuffer * buffer) +{ + return buffer->next; +} + +uint64_t +sp_writer_buf_get_tag (ShmBuffer * buffer) +{ + return buffer->tag; +} diff --git a/sys/shm/shmpipe.h b/sys/shm/shmpipe.h index 9cf0d6c61..eef8877d1 100644 --- a/sys/shm/shmpipe.h +++ b/sys/shm/shmpipe.h @@ -63,6 +63,7 @@ #define __SHMPIPE_H__ #include <stdlib.h> +#include <stdint.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> @@ -75,6 +76,7 @@ extern "C" { typedef struct _ShmClient ShmClient; typedef struct _ShmPipe ShmPipe; typedef struct _ShmBlock ShmBlock; +typedef struct _ShmBuffer ShmBuffer; ShmPipe *sp_writer_create (const char *path, size_t size, mode_t perms); const char *sp_writer_get_path (ShmPipe *pipe); @@ -90,7 +92,7 @@ int sp_writer_get_client_fd (ShmClient * client); ShmBlock *sp_writer_alloc_block (ShmPipe * self, size_t size); void sp_writer_free_block (ShmBlock *block); -int sp_writer_send_buf (ShmPipe * self, char *buf, size_t size); +int sp_writer_send_buf (ShmPipe * self, char *buf, size_t size, uint64_t tag); char *sp_writer_block_get_buf (ShmBlock *block); ShmPipe *sp_writer_block_get_pipe (ShmBlock *block); @@ -104,6 +106,10 @@ ShmPipe *sp_client_open (const char *path); long int sp_client_recv (ShmPipe * self, char **buf); int sp_client_recv_finish (ShmPipe * self, char *buf); +ShmBuffer *sp_writer_get_pending_buffers (ShmPipe * self); +ShmBuffer *sp_writer_get_next_buffer (ShmBuffer * buffer); +uint64_t sp_writer_buf_get_tag (ShmBuffer * buffer); + #ifdef __cplusplus } #endif |