Make buffer structure sharable

Use stucture offsets instead of pointers so that we can share the buffer
structure between client and server.
We can then pass an fd wrapping the memory of the buffer to the client.
Add beginnings of a memory pool
This commit is contained in:
Wim Taymans 2016-08-03 15:59:17 +02:00
parent 3ace7e9648
commit 98993c680b
23 changed files with 456 additions and 583 deletions

View file

@ -27,6 +27,7 @@ extern "C" {
#endif
#include <inttypes.h>
#include <stdlib.h>
#include <stddef.h>
typedef enum {
SPA_RESULT_OK = 0,
@ -71,6 +72,14 @@ typedef void (*SpaNotify) (void *data);
#define SPA_MIN(a,b) ((a)<(b) ? (a) : (b))
#define SPA_MAX(a,b) ((a)>(b) ? (a) : (b))
#define SPA_MEMBER(b,o,t) ((t*)((uint8_t*)(b) + (o)))
#define SPA_PTR_TO_INT(p) ((int) ((intptr_t) (p)))
#define SPA_INT_TO_PTR(u) ((void*) ((intptr_t) (u)))
#define SPA_PTR_TO_UINT32(p) ((uint32_t) ((uintptr_t) (p)))
#define SPA_UINT32_TO_PTR(u) ((void*) ((uintptr_t) (u)))
#define SPA_ID_INVALID ((uint32_t)0xffffffff)