mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
Enable header metadata
Enable the header metadata so that we have timestamps again. Rework allocation in the link a little. Reuse previously allocated buffers when possible. Keep track of where the buffers was allocated. Make some more convenience functions to initialize buffer headers. Make it so that we move allocations to the app. Make some helpers to make memfd memory in pinos now that we will be able to do all allocation there.
This commit is contained in:
parent
24108e01c1
commit
9d4048e73a
15 changed files with 504 additions and 157 deletions
|
|
@ -164,21 +164,18 @@ size_t spa_buffer_get_size (const SpaBuffer *buffer);
|
|||
size_t spa_buffer_serialize (void *dest, const SpaBuffer *buffer);
|
||||
SpaBuffer * spa_buffer_deserialize (void *src, off_t offset);
|
||||
|
||||
/**
|
||||
* SpaBufferAllocFlags:
|
||||
* @SPA_BUFFER_ALLOC_FLAG_NONE: no flags
|
||||
* @SPA_BUFFER_ALLOC_FLAG_NO_MEM: don't allocate memory
|
||||
*/
|
||||
typedef enum {
|
||||
SPA_BUFFER_ALLOC_FLAG_NONE = 0,
|
||||
SPA_BUFFER_ALLOC_FLAG_NO_MEM,
|
||||
} SpaBufferAllocFlags;
|
||||
|
||||
SpaResult spa_buffer_alloc (SpaBufferAllocFlags flags,
|
||||
SpaAllocParam **params,
|
||||
unsigned int n_params,
|
||||
SpaBuffer **buffers,
|
||||
unsigned int *n_buffers);
|
||||
|
||||
SpaResult spa_alloc_params_get_header_size (SpaAllocParam **params,
|
||||
unsigned int n_params,
|
||||
unsigned int n_datas,
|
||||
size_t *size);
|
||||
|
||||
SpaResult spa_buffer_init_headers (SpaAllocParam **params,
|
||||
unsigned int n_params,
|
||||
unsigned int n_datas,
|
||||
SpaBuffer **buffers,
|
||||
unsigned int n_buffers);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
|
|
|||
|
|
@ -346,7 +346,9 @@ struct _SpaNode {
|
|||
* the READY state or to CONFIGURE when @format is NULL.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_OK_RECHECK on success
|
||||
* #SPA_RESULT_OK_RECHECK on success, the value of @format might have been
|
||||
* changed depending on @flags and the final value can be found by
|
||||
* doing SpaNode::get_format.
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when node is %NULL
|
||||
* #SPA_RESULT_INVALID_PORT when port_id is not valid
|
||||
* #SPA_RESULT_INVALID_MEDIA_TYPE when the media type is not valid
|
||||
|
|
@ -411,8 +413,8 @@ struct _SpaNode {
|
|||
* on the buffers.
|
||||
*
|
||||
* Upon completion, this function might change the state of the
|
||||
* node to PAUSED, when the node has enough buffers, or READY when
|
||||
* @buffers are %NULL.
|
||||
* node to PAUSED, when the node has enough buffers on all ports, or READY
|
||||
* when @buffers are %NULL.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_ASYNC the function is executed asynchronously
|
||||
|
|
@ -432,6 +434,10 @@ struct _SpaNode {
|
|||
*
|
||||
* Tell the port to allocate memory for @buffers.
|
||||
*
|
||||
* @params should contain an array of pointers to buffers. The data
|
||||
* in the buffers should point to an array of at least 1 SPA_DATA_TYPE_INVALID
|
||||
* data pointers that will be filled by this function.
|
||||
*
|
||||
* For input ports, the buffers will be dequeued and ready to be filled
|
||||
* and pushed into the port. A notify should be configured so that you can
|
||||
* know when a buffer can be reused.
|
||||
|
|
@ -439,7 +445,15 @@ struct _SpaNode {
|
|||
* For output ports, the buffers remain queued. port_reuse_buffer() should
|
||||
* be called when a buffer can be reused.
|
||||
*
|
||||
* Upon completion, this function might change the state of the
|
||||
* node to PAUSED, when the node has enough buffers on all ports.
|
||||
*
|
||||
* Once the port has allocated buffers, the memory of the buffers can be
|
||||
* released again by calling SpaNode::port_use_buffers with %NULL.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_ERROR when the node already has allocated buffers.
|
||||
* #SPA_RESULT_ASYNC the function is executed asynchronously
|
||||
*/
|
||||
SpaResult (*port_alloc_buffers) (SpaNode *node,
|
||||
uint32_t port_id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue