mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-16 08:56:45 -05:00
pass the client object around
Pass the client object around, it's easier to deal with than the sender id. Fix the ASYNC return check Don't overwrite the fds of a pollitem, instead keep an index of their position in the global fd array.
This commit is contained in:
parent
7b53fa8685
commit
c6861845a7
14 changed files with 123 additions and 79 deletions
|
|
@ -64,11 +64,13 @@ typedef enum {
|
|||
SPA_RESULT_ASYNC_BUSY = -30,
|
||||
} SpaResult;
|
||||
|
||||
#define SPA_ASYNC_MASK (3 << 30)
|
||||
#define SPA_ASYNC_SEQ_MASK (SPA_RESULT_ASYNC - 1)
|
||||
|
||||
#define SPA_RESULT_IS_OK(res) ((res) >= 0)
|
||||
#define SPA_RESULT_IS_ERROR(res) ((res) < 0)
|
||||
#define SPA_RESULT_IS_ASYNC(res) (((res) & SPA_RESULT_ASYNC) == SPA_RESULT_ASYNC)
|
||||
#define SPA_RESULT_IS_ASYNC(res) (((res) & SPA_ASYNC_MASK) == SPA_RESULT_ASYNC)
|
||||
|
||||
#define SPA_ASYNC_SEQ_MASK (SPA_RESULT_ASYNC - 1)
|
||||
#define SPA_RESULT_ASYNC_SEQ(res) ((res) & SPA_ASYNC_SEQ_MASK)
|
||||
#define SPA_RESULT_RETURN_ASYNC(seq) (SPA_RESULT_ASYNC | ((seq) & SPA_ASYNC_SEQ_MASK))
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ struct _SpaMemoryChunk {
|
|||
* SpaMemory:
|
||||
* @refcount: a refcount
|
||||
* @notify: notify when refcount is 0
|
||||
* @user_data: owner specific used data
|
||||
* @user_data: owner specific user data
|
||||
* @pool_id: the id of the pool
|
||||
* @id: the memory id
|
||||
* @flags: extra memory flags
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ struct _SpaAudioTestSrc {
|
|||
#define DEFAULT_WAVE 0
|
||||
#define DEFAULT_VOLUME 1.0
|
||||
#define DEFAULT_FREQ 440.0
|
||||
#define DEFAULT_LIVE false
|
||||
#define DEFAULT_LIVE true
|
||||
|
||||
static const double min_volume = 0.0;
|
||||
static const double max_volume = 10.0;
|
||||
|
|
@ -534,6 +534,9 @@ clear_buffers (SpaAudioTestSrc *this)
|
|||
this->alloc_buffers = NULL;
|
||||
this->n_buffers = 0;
|
||||
this->have_buffers = false;
|
||||
this->info.flags &= ~SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS;
|
||||
SPA_QUEUE_INIT (&this->empty);
|
||||
SPA_QUEUE_INIT (&this->ready);
|
||||
}
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
@ -719,6 +722,9 @@ spa_audiotestsrc_node_port_use_buffers (SpaNode *node,
|
|||
}
|
||||
this->n_buffers = n_buffers;
|
||||
this->have_buffers = true;
|
||||
this->info.flags |= SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS;
|
||||
} else {
|
||||
this->info.flags &= ~SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS;
|
||||
}
|
||||
|
||||
if (this->have_buffers) {
|
||||
|
|
@ -739,6 +745,7 @@ spa_audiotestsrc_node_port_alloc_buffers (SpaNode *node,
|
|||
uint32_t *n_buffers)
|
||||
{
|
||||
SpaAudioTestSrc *this;
|
||||
unsigned int i;
|
||||
|
||||
if (node == NULL || node->handle == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
|
@ -754,7 +761,12 @@ spa_audiotestsrc_node_port_alloc_buffers (SpaNode *node,
|
|||
if (!this->have_buffers)
|
||||
return SPA_RESULT_NO_BUFFERS;
|
||||
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
*n_buffers = SPA_MIN (*n_buffers, this->n_buffers);
|
||||
|
||||
for (i = 0; i < *n_buffers; i++)
|
||||
buffers[i] = this->alloc_buffers[i].outbuf;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
static SpaResult
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ struct _SpaVideoTestSrc {
|
|||
SpaQueue ready;
|
||||
};
|
||||
|
||||
#define DEFAULT_LIVE false
|
||||
#define DEFAULT_LIVE true
|
||||
|
||||
enum {
|
||||
PROP_ID_LIVE,
|
||||
|
|
@ -482,6 +482,9 @@ clear_buffers (SpaVideoTestSrc *this)
|
|||
this->alloc_buffers = NULL;
|
||||
this->n_buffers = 0;
|
||||
this->have_buffers = false;
|
||||
this->info.flags &= ~SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS;
|
||||
SPA_QUEUE_INIT (&this->empty);
|
||||
SPA_QUEUE_INIT (&this->ready);
|
||||
}
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
@ -668,6 +671,9 @@ spa_videotestsrc_node_port_use_buffers (SpaNode *node,
|
|||
}
|
||||
this->n_buffers = n_buffers;
|
||||
this->have_buffers = true;
|
||||
this->info.flags |= SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS;
|
||||
} else {
|
||||
this->info.flags &= ~SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS;
|
||||
}
|
||||
|
||||
if (this->have_buffers) {
|
||||
|
|
@ -688,6 +694,7 @@ spa_videotestsrc_node_port_alloc_buffers (SpaNode *node,
|
|||
uint32_t *n_buffers)
|
||||
{
|
||||
SpaVideoTestSrc *this;
|
||||
unsigned int i;
|
||||
|
||||
if (node == NULL || node->handle == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
|
@ -703,7 +710,12 @@ spa_videotestsrc_node_port_alloc_buffers (SpaNode *node,
|
|||
if (!this->have_buffers)
|
||||
return SPA_RESULT_NO_BUFFERS;
|
||||
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
*n_buffers = SPA_MIN (*n_buffers, this->n_buffers);
|
||||
|
||||
for (i = 0; i < *n_buffers; i++)
|
||||
buffers[i] = this->alloc_buffers[i].outbuf;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
static SpaResult
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue