mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
Work on negotiation
Add helpers to convert between pinos and gstreamer formats. Use pinos formats in the API. Work on removing some hardcoded stuff and instead use the real format from the pinos server. Use memfd and sealing.
This commit is contained in:
parent
dd1fbef28f
commit
ac5d22ec79
26 changed files with 638 additions and 199 deletions
|
|
@ -102,37 +102,29 @@ typedef struct {
|
|||
/**
|
||||
* SpaData:
|
||||
* @mem: reference to the memory to use
|
||||
* @offset: ofset in memory
|
||||
* @size: size of memory
|
||||
* @stride: stride of memory if applicable
|
||||
*/
|
||||
typedef struct {
|
||||
SpaMemoryRef mem;
|
||||
off_t offset;
|
||||
size_t size;
|
||||
size_t stride;
|
||||
SpaMemoryChunk mem;
|
||||
ssize_t stride;
|
||||
} SpaData;
|
||||
|
||||
/**
|
||||
* SpaBuffer:
|
||||
* @id: buffer id
|
||||
* @mem: reference to the memory for this buffer
|
||||
* @offset: offset inside memory
|
||||
* @size: of of memory
|
||||
* @n_metas: number of metadata
|
||||
* @metas: offset of array of @n_metas metadata
|
||||
* @n_datas: number of data pointers
|
||||
* @datas: offset of array of @n_datas data pointers
|
||||
*/
|
||||
struct _SpaBuffer {
|
||||
uint32_t id;
|
||||
SpaMemoryRef mem;
|
||||
off_t offset;
|
||||
size_t size;
|
||||
unsigned int n_metas;
|
||||
off_t metas;
|
||||
unsigned int n_datas;
|
||||
off_t datas;
|
||||
uint32_t id;
|
||||
SpaMemoryChunk mem;
|
||||
unsigned int n_metas;
|
||||
off_t metas;
|
||||
unsigned int n_datas;
|
||||
off_t datas;
|
||||
};
|
||||
|
||||
#define SPA_BUFFER_METAS(b) (SPA_MEMBER ((b), (b)->metas, SpaMeta))
|
||||
|
|
|
|||
|
|
@ -91,8 +91,8 @@ typedef enum {
|
|||
/* SPA_CONTROL_CMD_NODE_UPDATE */
|
||||
typedef struct {
|
||||
uint32_t change_mask;
|
||||
uint32_t max_input_ports;
|
||||
uint32_t max_output_ports;
|
||||
unsigned int max_input_ports;
|
||||
unsigned int max_output_ports;
|
||||
const SpaProps *props;
|
||||
} SpaControlCmdNodeUpdate;
|
||||
|
||||
|
|
@ -100,8 +100,8 @@ typedef struct {
|
|||
typedef struct {
|
||||
uint32_t port_id;
|
||||
uint32_t change_mask;
|
||||
uint32_t direction;
|
||||
uint32_t n_possible_formats;
|
||||
SpaDirection direction;
|
||||
unsigned int n_possible_formats;
|
||||
const SpaFormat **possible_formats;
|
||||
const SpaProps *props;
|
||||
const SpaPortInfo *info;
|
||||
|
|
@ -132,8 +132,8 @@ typedef struct {
|
|||
|
||||
/* SPA_CONTROL_CMD_ADD_PORT */
|
||||
typedef struct {
|
||||
uint32_t port_id;
|
||||
uint32_t direction;
|
||||
uint32_t port_id;
|
||||
SpaDirection direction;
|
||||
} SpaControlCmdAddPort;
|
||||
|
||||
/* SPA_CONTROL_CMD_REMOVE_PORT */
|
||||
|
|
@ -152,7 +152,7 @@ typedef struct {
|
|||
typedef struct {
|
||||
uint32_t port_id;
|
||||
uint32_t id;
|
||||
uint32_t size;
|
||||
size_t size;
|
||||
void *value;
|
||||
} SpaControlCmdSetProperty;
|
||||
|
||||
|
|
@ -164,24 +164,22 @@ typedef struct {
|
|||
uint32_t port_id;
|
||||
SpaMemoryRef mem;
|
||||
uint32_t mem_type;
|
||||
uint32_t fd_index;
|
||||
unsigned int fd_index;
|
||||
uint32_t flags;
|
||||
uint64_t size;
|
||||
size_t size;
|
||||
} SpaControlCmdAddMem;
|
||||
|
||||
/* SPA_CONTROL_CMD_REMOVE_MEM */
|
||||
typedef struct {
|
||||
uint32_t port_id;
|
||||
uint32_t port_id;
|
||||
SpaMemoryRef mem;
|
||||
} SpaControlCmdRemoveMem;
|
||||
|
||||
/* SPA_CONTROL_CMD_ADD_BUFFER */
|
||||
typedef struct {
|
||||
uint32_t port_id;
|
||||
uint32_t buffer_id;
|
||||
SpaMemoryRef mem;
|
||||
off_t offset;
|
||||
size_t size;
|
||||
uint32_t port_id;
|
||||
uint32_t buffer_id;
|
||||
SpaMemoryChunk mem;
|
||||
} SpaControlCmdAddBuffer;
|
||||
|
||||
/* SPA_CONTROL_CMD_REMOVE_BUFFER */
|
||||
|
|
@ -194,16 +192,16 @@ typedef struct {
|
|||
typedef struct {
|
||||
uint32_t port_id;
|
||||
uint32_t buffer_id;
|
||||
uint64_t offset;
|
||||
uint64_t size;
|
||||
off_t offset;
|
||||
size_t size;
|
||||
} SpaControlCmdProcessBuffer;
|
||||
|
||||
/* SPA_CONTROL_CMD_REUSE_BUFFER */
|
||||
typedef struct {
|
||||
uint32_t port_id;
|
||||
uint32_t buffer_id;
|
||||
uint64_t offset;
|
||||
uint64_t size;
|
||||
off_t offset;
|
||||
size_t size;
|
||||
} SpaControlCmdReuseBuffer;
|
||||
|
||||
|
||||
|
|
@ -221,7 +219,8 @@ SpaResult spa_control_iter_next (SpaControlIter *iter);
|
|||
SpaResult spa_control_iter_end (SpaControlIter *iter);
|
||||
|
||||
SpaControlCmd spa_control_iter_get_cmd (SpaControlIter *iter);
|
||||
void * spa_control_iter_get_data (SpaControlIter *iter, size_t *size);
|
||||
void * spa_control_iter_get_data (SpaControlIter *iter,
|
||||
size_t *size);
|
||||
|
||||
SpaResult spa_control_iter_parse_cmd (SpaControlIter *iter,
|
||||
void *command);
|
||||
|
|
|
|||
|
|
@ -62,22 +62,34 @@ typedef enum {
|
|||
* @media_type: media type
|
||||
* @media_subtype: subtype
|
||||
* @mem: memory reference
|
||||
* @offset: offset in memory
|
||||
* @size: size in memory
|
||||
*/
|
||||
struct _SpaFormat {
|
||||
SpaProps props;
|
||||
SpaMediaType media_type;
|
||||
SpaMediaSubType media_subtype;
|
||||
SpaMemoryRef mem;
|
||||
SpaMemoryChunk mem;
|
||||
};
|
||||
|
||||
#define spa_format_ref(f) spa_memory_ref(&(f)->mem)
|
||||
#define spa_format_unref(f) spa_memory_unref(&(f)->mem)
|
||||
static inline void
|
||||
spa_format_ref (SpaFormat *format)
|
||||
{
|
||||
spa_memory_ref (&format->mem.mem);
|
||||
}
|
||||
|
||||
static inline void
|
||||
spa_format_unref (SpaFormat *format)
|
||||
{
|
||||
spa_memory_unref (&format->mem.mem);
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
SPA_PROP_ID_INVALID = 0,
|
||||
SPA_PROP_ID_MEDIA_CUSTOM_START = 200,
|
||||
} SpaFormatProps;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ extern "C" {
|
|||
|
||||
typedef struct _SpaMemory SpaMemory;
|
||||
typedef struct _SpaMemoryRef SpaMemoryRef;
|
||||
typedef struct _SpaMemoryChunk SpaMemoryChunk;
|
||||
typedef struct _SpaMemoryPool SpaMemoryPool;
|
||||
|
||||
#include <spa/defs.h>
|
||||
|
|
@ -48,12 +49,27 @@ typedef enum {
|
|||
* SpaMemoryRef:
|
||||
* @pool_id: the pool id
|
||||
* @id: mem_id
|
||||
*
|
||||
* A reference to a block of memory
|
||||
*/
|
||||
struct _SpaMemoryRef {
|
||||
uint32_t pool_id;
|
||||
uint32_t id;
|
||||
};
|
||||
|
||||
/**
|
||||
* SpaMemoryChunk:
|
||||
* @mem: the memory
|
||||
* @offset: the offset in the memory
|
||||
* @size: the size in the memory
|
||||
*
|
||||
* A reference to a part of memory
|
||||
*/
|
||||
struct _SpaMemoryChunk {
|
||||
SpaMemoryRef mem;
|
||||
off_t offset;
|
||||
size_t size;
|
||||
};
|
||||
/**
|
||||
* SpaMemory:
|
||||
* @refcount: a refcount
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue