diff --git a/pipewire-jack b/pipewire-jack index 274d616fa..0bc34d530 160000 --- a/pipewire-jack +++ b/pipewire-jack @@ -1 +1 @@ -Subproject commit 274d616fa6adef0a917f16e1001cf66fdca88e64 +Subproject commit 0bc34d53018af1e4194dfb08b6c1aea737c2afb0 diff --git a/pipewire-pulseaudio b/pipewire-pulseaudio index f269cb9e5..694ae6dd8 160000 --- a/pipewire-pulseaudio +++ b/pipewire-pulseaudio @@ -1 +1 @@ -Subproject commit f269cb9e517124f27916d3964ce8169c06d7ed77 +Subproject commit 694ae6dd84dc4f98add11474607d8e211bd4ae4a diff --git a/spa/include/spa/buffer/alloc.h b/spa/include/spa/buffer/alloc.h index 1dd910010..832ef7eb7 100644 --- a/spa/include/spa/buffer/alloc.h +++ b/spa/include/spa/buffer/alloc.h @@ -142,14 +142,14 @@ static inline int spa_buffer_alloc_fill_info(struct spa_buffer_alloc_info *info, size += SPA_ROUND_UP_N(metas[i].size, 8); info->meta_size = size; - if (SPA_FLAG_CHECK(info->flags, SPA_BUFFER_ALLOC_FLAG_INLINE_META)) + if (SPA_FLAG_IS_SET(info->flags, SPA_BUFFER_ALLOC_FLAG_INLINE_META)) target = &info->skel_size; else target = &info->mem_size; *target += info->meta_size; info->chunk_size = n_datas * sizeof(struct spa_chunk); - if (SPA_FLAG_CHECK(info->flags, SPA_BUFFER_ALLOC_FLAG_INLINE_CHUNK)) + if (SPA_FLAG_IS_SET(info->flags, SPA_BUFFER_ALLOC_FLAG_INLINE_CHUNK)) target = &info->skel_size; else target = &info->mem_size; @@ -162,8 +162,8 @@ static inline int spa_buffer_alloc_fill_info(struct spa_buffer_alloc_info *info, } info->data_size = size; - if (!SPA_FLAG_CHECK(info->flags, SPA_BUFFER_ALLOC_FLAG_NO_DATA) && - SPA_FLAG_CHECK(info->flags, SPA_BUFFER_ALLOC_FLAG_INLINE_DATA)) + if (!SPA_FLAG_IS_SET(info->flags, SPA_BUFFER_ALLOC_FLAG_NO_DATA) && + SPA_FLAG_IS_SET(info->flags, SPA_BUFFER_ALLOC_FLAG_INLINE_DATA)) target = &info->skel_size; else target = &info->mem_size; @@ -209,7 +209,7 @@ spa_buffer_alloc_layout(struct spa_buffer_alloc_info *info, skel = SPA_MEMBER(b->datas, info->n_datas * sizeof(struct spa_data), void); data = data_mem; - if (SPA_FLAG_CHECK(info->flags, SPA_BUFFER_ALLOC_FLAG_INLINE_META)) + if (SPA_FLAG_IS_SET(info->flags, SPA_BUFFER_ALLOC_FLAG_INLINE_META)) dp = &skel; else dp = &data; @@ -222,7 +222,7 @@ spa_buffer_alloc_layout(struct spa_buffer_alloc_info *info, } size = info->n_datas * sizeof(struct spa_chunk); - if (SPA_FLAG_CHECK(info->flags, SPA_BUFFER_ALLOC_FLAG_INLINE_CHUNK)) { + if (SPA_FLAG_IS_SET(info->flags, SPA_BUFFER_ALLOC_FLAG_INLINE_CHUNK)) { cp = (struct spa_chunk*)skel; skel = SPA_MEMBER(skel, size, void); } @@ -231,7 +231,7 @@ spa_buffer_alloc_layout(struct spa_buffer_alloc_info *info, data = SPA_MEMBER(data, size, void); } - if (SPA_FLAG_CHECK(info->flags, SPA_BUFFER_ALLOC_FLAG_INLINE_DATA)) + if (SPA_FLAG_IS_SET(info->flags, SPA_BUFFER_ALLOC_FLAG_INLINE_DATA)) dp = &skel; else dp = &data; @@ -241,7 +241,7 @@ spa_buffer_alloc_layout(struct spa_buffer_alloc_info *info, *d = info->datas[i]; d->chunk = &cp[i]; - if (!SPA_FLAG_CHECK(info->flags, SPA_BUFFER_ALLOC_FLAG_NO_DATA)) { + if (!SPA_FLAG_IS_SET(info->flags, SPA_BUFFER_ALLOC_FLAG_NO_DATA)) { *dp = SPA_PTR_ALIGN(*dp, info->data_aligns[i], void); d->data = *dp; *dp = SPA_MEMBER(*dp, d->maxsize, void); diff --git a/spa/include/spa/param/audio/format-utils.h b/spa/include/spa/param/audio/format-utils.h index a593141cf..4af8a249e 100644 --- a/spa/include/spa/param/audio/format-utils.h +++ b/spa/include/spa/param/audio/format-utils.h @@ -67,7 +67,7 @@ spa_format_audio_raw_build(struct spa_pod_builder *builder, uint32_t id, struct SPA_FORMAT_AUDIO_channels, SPA_POD_Int(info->channels), 0); - if (!SPA_FLAG_CHECK(info->flags, SPA_AUDIO_FLAG_UNPOSITIONED)) { + if (!SPA_FLAG_IS_SET(info->flags, SPA_AUDIO_FLAG_UNPOSITIONED)) { spa_pod_builder_prop(builder, SPA_FORMAT_AUDIO_position, 0); spa_pod_builder_array(builder, sizeof(uint32_t), SPA_TYPE_Id, info->channels, info->position); diff --git a/spa/include/spa/pod/builder.h b/spa/include/spa/pod/builder.h index cb5c01725..a6d68f617 100644 --- a/spa/include/spa/pod/builder.h +++ b/spa/include/spa/pod/builder.h @@ -190,7 +190,7 @@ spa_pod_builder_primitive(struct spa_pod_builder *builder, const struct spa_pod } else { data = p; size = SPA_POD_SIZE(p); - SPA_FLAG_UNSET(builder->state.flags, SPA_POD_BUILDER_FLAG_FIRST); + SPA_FLAG_CLEAR(builder->state.flags, SPA_POD_BUILDER_FLAG_FIRST); } res = spa_pod_builder_raw(builder, data, size); if (builder->state.flags != SPA_POD_BUILDER_FLAG_BODY) diff --git a/spa/include/spa/utils/defs.h b/spa/include/spa/utils/defs.h index 523390ac3..2642ca97e 100644 --- a/spa/include/spa/utils/defs.h +++ b/spa/include/spa/utils/defs.h @@ -37,9 +37,10 @@ extern "C" { #include #define SPA_FLAG_MASK(field,mask,flag) (((field) & (mask)) == (flag)) -#define SPA_FLAG_CHECK(field,flag) SPA_FLAG_MASK(field,flag,flag) +#define SPA_FLAG_IS_SET(field,flag) SPA_FLAG_MASK(field,flag,flag) #define SPA_FLAG_SET(field,flag) ((field) |= (flag)) -#define SPA_FLAG_UNSET(field,flag) ((field) &= ~(flag)) +#define SPA_FLAG_CLEAR(field,flag) ((field) &= ~(flag)) +#define SPA_FLAG_UPDATE(field,flag,val) ((val) ? SPA_FLAG_SET(field,flag) : SPA_FLAG_CLEAR(field,flag)) enum spa_direction { SPA_DIRECTION_INPUT = 0, diff --git a/spa/plugins/alsa/alsa-pcm-sink.c b/spa/plugins/alsa/alsa-pcm-sink.c index 7217a0763..85d77fc88 100644 --- a/spa/plugins/alsa/alsa-pcm-sink.c +++ b/spa/plugins/alsa/alsa-pcm-sink.c @@ -617,7 +617,7 @@ static int impl_node_process(void *object) input->buffer_id < this->n_buffers) { struct buffer *b = &this->buffers[input->buffer_id]; - if (!SPA_FLAG_CHECK(b->flags, BUFFER_FLAG_OUT)) { + if (!SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_OUT)) { spa_log_warn(this->log, NAME " %p: buffer %u in use", this, input->buffer_id); input->status = -EINVAL; @@ -625,7 +625,7 @@ static int impl_node_process(void *object) } spa_log_trace_fp(this->log, NAME " %p: queue buffer %u", this, input->buffer_id); spa_list_append(&this->ready, &b->link); - SPA_FLAG_UNSET(b->flags, BUFFER_FLAG_OUT); + SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_OUT); input->buffer_id = SPA_ID_INVALID; spa_alsa_write(this, 0); diff --git a/spa/plugins/alsa/alsa-pcm-source.c b/spa/plugins/alsa/alsa-pcm-source.c index ac68be26b..70a7a5d6b 100644 --- a/spa/plugins/alsa/alsa-pcm-source.c +++ b/spa/plugins/alsa/alsa-pcm-source.c @@ -337,10 +337,10 @@ static void recycle_buffer(struct state *this, uint32_t buffer_id) { struct buffer *b = &this->buffers[buffer_id]; - if (SPA_FLAG_CHECK(b->flags, BUFFER_FLAG_OUT)) { + if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_OUT)) { spa_log_trace_fp(this->log, NAME " %p: recycle buffer %u", this, buffer_id); spa_list_append(&this->free, &b->link); - SPA_FLAG_UNSET(b->flags, BUFFER_FLAG_OUT); + SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_OUT); } } diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c index ff48ee186..5a2688459 100644 --- a/spa/plugins/alsa/alsa-pcm.c +++ b/spa/plugins/alsa/alsa-pcm.c @@ -1099,7 +1099,7 @@ static void reset_buffers(struct state *this) SPA_FLAG_SET(b->flags, BUFFER_FLAG_OUT); } else { spa_list_append(&this->free, &b->link); - SPA_FLAG_UNSET(b->flags, BUFFER_FLAG_OUT); + SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_OUT); } } } diff --git a/spa/plugins/alsa/alsa-seq.c b/spa/plugins/alsa/alsa-seq.c index f499f8bce..124d10dab 100644 --- a/spa/plugins/alsa/alsa-seq.c +++ b/spa/plugins/alsa/alsa-seq.c @@ -380,11 +380,11 @@ int spa_alsa_seq_recycle_buffer(struct seq_state *state, struct seq_port *port, { struct buffer *b = &port->buffers[buffer_id]; - if (SPA_FLAG_CHECK(b->flags, BUFFER_FLAG_OUT)) { + if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_OUT)) { spa_log_trace_fp(state->log, NAME " %p: recycle buffer port:%p buffer-id:%u", state, port, buffer_id); spa_list_append(&port->free, &b->link); - SPA_FLAG_UNSET(b->flags, BUFFER_FLAG_OUT); + SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_OUT); } return 0; } @@ -758,7 +758,7 @@ static void reset_buffers(struct seq_state *this, struct seq_port *port) SPA_FLAG_SET(b->flags, BUFFER_FLAG_OUT); } else { spa_list_append(&port->free, &b->link); - SPA_FLAG_UNSET(b->flags, BUFFER_FLAG_OUT); + SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_OUT); } } } diff --git a/spa/plugins/audioconvert/audioadapter.c b/spa/plugins/audioconvert/audioadapter.c index e5ea0ca5a..2d775381e 100644 --- a/spa/plugins/audioconvert/audioadapter.c +++ b/spa/plugins/audioconvert/audioadapter.c @@ -681,8 +681,8 @@ static int negotiate_buffers(struct impl *this) slave_flags = this->slave_flags; conv_flags = this->convert_flags; - slave_alloc = SPA_FLAG_CHECK(slave_flags, SPA_PORT_FLAG_CAN_ALLOC_BUFFERS); - conv_alloc = SPA_FLAG_CHECK(conv_flags, SPA_PORT_FLAG_CAN_ALLOC_BUFFERS); + slave_alloc = SPA_FLAG_IS_SET(slave_flags, SPA_PORT_FLAG_CAN_ALLOC_BUFFERS); + conv_alloc = SPA_FLAG_IS_SET(conv_flags, SPA_PORT_FLAG_CAN_ALLOC_BUFFERS); flags = 0; if (conv_alloc || slave_alloc) { diff --git a/spa/plugins/audioconvert/audioconvert.c b/spa/plugins/audioconvert/audioconvert.c index 42e077451..0859bf732 100644 --- a/spa/plugins/audioconvert/audioconvert.c +++ b/spa/plugins/audioconvert/audioconvert.c @@ -322,9 +322,9 @@ static int negotiate_link_buffers(struct impl *this, struct link *link) spa_pod_fixate(param); - in_alloc = SPA_FLAG_CHECK(link->in_flags, + in_alloc = SPA_FLAG_IS_SET(link->in_flags, SPA_PORT_FLAG_CAN_ALLOC_BUFFERS); - out_alloc = SPA_FLAG_CHECK(link->out_flags, + out_alloc = SPA_FLAG_IS_SET(link->out_flags, SPA_PORT_FLAG_CAN_ALLOC_BUFFERS); flags = 0; diff --git a/spa/plugins/audioconvert/channelmix.c b/spa/plugins/audioconvert/channelmix.c index 65a524a2d..580e7a4db 100644 --- a/spa/plugins/audioconvert/channelmix.c +++ b/spa/plugins/audioconvert/channelmix.c @@ -761,7 +761,7 @@ impl_node_port_use_buffers(void *object, } b->datas[j] = d[j].data; if (direction == SPA_DIRECTION_OUTPUT && - !SPA_FLAG_CHECK(d[j].flags, SPA_DATA_FLAG_DYNAMIC)) + !SPA_FLAG_IS_SET(d[j].flags, SPA_DATA_FLAG_DYNAMIC)) this->is_passthrough = false; } if (direction == SPA_DIRECTION_OUTPUT) @@ -803,9 +803,9 @@ static void recycle_buffer(struct impl *this, uint32_t id) struct port *port = GET_OUT_PORT(this, 0); struct buffer *b = &port->buffers[id]; - if (SPA_FLAG_CHECK(b->flags, BUFFER_FLAG_OUT)) { + if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_OUT)) { spa_list_append(&port->queue, &b->link); - SPA_FLAG_UNSET(b->flags, BUFFER_FLAG_OUT); + SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_OUT); spa_log_trace_fp(this->log, NAME " %p: recycle buffer %d", this, id); } } diff --git a/spa/plugins/audioconvert/fmtconvert.c b/spa/plugins/audioconvert/fmtconvert.c index d9a40a882..82d807d9f 100644 --- a/spa/plugins/audioconvert/fmtconvert.c +++ b/spa/plugins/audioconvert/fmtconvert.c @@ -376,7 +376,7 @@ static int port_enum_formats(void *object, SPA_FORMAT_AUDIO_rate, SPA_POD_Int(info.info.raw.rate), SPA_FORMAT_AUDIO_channels, SPA_POD_Int(info.info.raw.channels), 0); - if (!SPA_FLAG_CHECK(info.info.raw.flags, SPA_AUDIO_FLAG_UNPOSITIONED)) { + if (!SPA_FLAG_IS_SET(info.info.raw.flags, SPA_AUDIO_FLAG_UNPOSITIONED)) { qsort(info.info.raw.position, info.info.raw.channels, sizeof(uint32_t), int32_cmp); spa_pod_builder_prop(builder, SPA_FORMAT_AUDIO_position, 0); @@ -703,7 +703,7 @@ impl_node_port_use_buffers(void *object, } b->datas[j] = d[j].data; if (direction == SPA_DIRECTION_OUTPUT && - !SPA_FLAG_CHECK(d[j].flags, SPA_DATA_FLAG_DYNAMIC)) + !SPA_FLAG_IS_SET(d[j].flags, SPA_DATA_FLAG_DYNAMIC)) this->is_passthrough = false; } @@ -750,9 +750,9 @@ static void recycle_buffer(struct impl *this, struct port *port, uint32_t id) { struct buffer *b = &port->buffers[id]; - if (SPA_FLAG_CHECK(b->flags, BUFFER_FLAG_OUT)) { + if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_OUT)) { spa_list_append(&port->queue, &b->link); - SPA_FLAG_UNSET(b->flags, BUFFER_FLAG_OUT); + SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_OUT); spa_log_trace_fp(this->log, NAME " %p: recycle buffer %d", this, id); } } diff --git a/spa/plugins/audioconvert/merger.c b/spa/plugins/audioconvert/merger.c index 2aa85ee21..bcfe355bc 100644 --- a/spa/plugins/audioconvert/merger.c +++ b/spa/plugins/audioconvert/merger.c @@ -724,7 +724,7 @@ static void queue_buffer(struct impl *this, struct port *port, uint32_t id) spa_log_trace_fp(this->log, NAME " %p: queue buffer %d on port %d %d", this, id, port->id, b->flags); - if (SPA_FLAG_CHECK(b->flags, BUFFER_FLAG_QUEUED)) + if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_QUEUED)) return; spa_list_append(&port->queue, &b->link); @@ -740,7 +740,7 @@ static struct buffer *dequeue_buffer(struct impl *this, struct port *port) b = spa_list_first(&port->queue, struct buffer, link); spa_list_remove(&b->link); - SPA_FLAG_UNSET(b->flags, BUFFER_FLAG_QUEUED); + SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_QUEUED); spa_log_trace_fp(this->log, NAME " %p: dequeue buffer %d on port %d %u", this, b->id, port->id, b->flags); @@ -802,7 +802,7 @@ impl_node_port_use_buffers(void *object, } b->datas[j] = d[j].data; if (direction == SPA_DIRECTION_OUTPUT && - !SPA_FLAG_CHECK(d[j].flags, SPA_DATA_FLAG_DYNAMIC)) + !SPA_FLAG_IS_SET(d[j].flags, SPA_DATA_FLAG_DYNAMIC)) this->is_passthrough = false; } @@ -915,7 +915,7 @@ static inline int handle_monitor(struct impl *this, const void *data, int n_samp spa_log_trace(this->log, "%p: io %p %08x", this, outport->io, dd->flags); - if (SPA_FLAG_CHECK(dd->flags, SPA_DATA_FLAG_DYNAMIC)) + if (SPA_FLAG_IS_SET(dd->flags, SPA_DATA_FLAG_DYNAMIC)) dd->data = (void*)data; else memcpy(dd->data, data, size); diff --git a/spa/plugins/audioconvert/resample-native.h b/spa/plugins/audioconvert/resample-native.h index 731a4c125..b92bd55d3 100644 --- a/spa/plugins/audioconvert/resample-native.h +++ b/spa/plugins/audioconvert/resample-native.h @@ -123,15 +123,15 @@ static void impl_native_update_rate(struct resample *r, double rate) data->func = is_full ? do_resample_full_c : do_resample_inter_c; #if defined (HAVE_SSE) - if (SPA_FLAG_CHECK(r->cpu_flags, SPA_CPU_FLAG_SSE)) + if (SPA_FLAG_IS_SET(r->cpu_flags, SPA_CPU_FLAG_SSE)) data->func = is_full ? do_resample_full_sse : do_resample_inter_sse; #endif #if defined (HAVE_SSSE3) - if (SPA_FLAG_CHECK(r->cpu_flags, SPA_CPU_FLAG_SSSE3 | SPA_CPU_FLAG_SLOW_UNALIGNED)) + if (SPA_FLAG_IS_SET(r->cpu_flags, SPA_CPU_FLAG_SSSE3 | SPA_CPU_FLAG_SLOW_UNALIGNED)) data->func = is_full ? do_resample_full_ssse3 : do_resample_inter_ssse3; #endif #if defined(HAVE_AVX) && defined(HAVE_FMA) - if (SPA_FLAG_CHECK(r->cpu_flags, SPA_CPU_FLAG_AVX | SPA_CPU_FLAG_FMA3)) + if (SPA_FLAG_IS_SET(r->cpu_flags, SPA_CPU_FLAG_AVX | SPA_CPU_FLAG_FMA3)) data->func = is_full ? do_resample_full_avx : do_resample_inter_avx; #endif } diff --git a/spa/plugins/audioconvert/resample.c b/spa/plugins/audioconvert/resample.c index b7513ff4e..96f9a25a9 100644 --- a/spa/plugins/audioconvert/resample.c +++ b/spa/plugins/audioconvert/resample.c @@ -658,9 +658,9 @@ static void recycle_buffer(struct impl *this, uint32_t id) struct port *port = GET_OUT_PORT(this, 0); struct buffer *b = &port->buffers[id]; - if (SPA_FLAG_CHECK(b->flags, BUFFER_FLAG_OUT)) { + if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_OUT)) { spa_list_append(&port->queue, &b->link); - SPA_FLAG_UNSET(b->flags, BUFFER_FLAG_OUT); + SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_OUT); spa_log_trace_fp(this->log, NAME " %p: recycle buffer %d", this, id); } } diff --git a/spa/plugins/audioconvert/splitter.c b/spa/plugins/audioconvert/splitter.c index 2c848b888..48a8185b2 100644 --- a/spa/plugins/audioconvert/splitter.c +++ b/spa/plugins/audioconvert/splitter.c @@ -688,7 +688,7 @@ static void queue_buffer(struct impl *this, struct port *port, uint32_t id) spa_log_trace_fp(this->log, NAME " %p: queue buffer %d on port %d %d", this, id, port->id, b->flags); - if (SPA_FLAG_CHECK(b->flags, BUFFER_FLAG_QUEUED)) + if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_QUEUED)) return; spa_list_append(&port->queue, &b->link); @@ -704,7 +704,7 @@ static struct buffer *dequeue_buffer(struct impl *this, struct port *port) b = spa_list_first(&port->queue, struct buffer, link); spa_list_remove(&b->link); - SPA_FLAG_UNSET(b->flags, BUFFER_FLAG_QUEUED); + SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_QUEUED); spa_log_trace_fp(this->log, NAME " %p: dequeue buffer %d on port %d %u", this, b->id, port->id, b->flags); @@ -758,7 +758,7 @@ impl_node_port_use_buffers(void *object, } b->datas[j] = d[j].data; if (direction == SPA_DIRECTION_OUTPUT && - !SPA_FLAG_CHECK(d[j].flags, SPA_DATA_FLAG_DYNAMIC)) + !SPA_FLAG_IS_SET(d[j].flags, SPA_DATA_FLAG_DYNAMIC)) this->is_passthrough = false; spa_log_debug(this->log, NAME " %p: buffer %d data %d flags:%08x %p", diff --git a/spa/plugins/audioconvert/test-source.c b/spa/plugins/audioconvert/test-source.c index 95234736b..ccd02fc92 100644 --- a/spa/plugins/audioconvert/test-source.c +++ b/spa/plugins/audioconvert/test-source.c @@ -618,9 +618,9 @@ impl_node_port_set_param(void *object, static void recycle_buffer(struct impl *this, struct port *port, struct buffer *b) { - if (SPA_FLAG_CHECK(b->flags, BUFFER_FLAG_OUT)) { + if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_OUT)) { spa_list_append(&port->queue, &b->link); - SPA_FLAG_UNSET(b->flags, BUFFER_FLAG_OUT); + SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_OUT); spa_log_trace_fp(this->log, NAME " %p: recycle buffer %d", this, b->id); } } diff --git a/spa/plugins/jack/jack-source.c b/spa/plugins/jack/jack-source.c index 78d1253cc..1a427a9e2 100644 --- a/spa/plugins/jack/jack-source.c +++ b/spa/plugins/jack/jack-source.c @@ -227,9 +227,9 @@ static inline void reuse_buffer(struct impl *this, struct port *port, uint32_t i { struct buffer *b = &port->buffers[id]; - if (SPA_FLAG_CHECK(b->flags, BUFFER_FLAG_OUT)) { + if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_OUT)) { spa_log_trace(this->log, NAME " %p: reuse buffer %d", this, id); - SPA_FLAG_UNSET(b->flags, BUFFER_FLAG_OUT); + SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_OUT); spa_list_append(&port->empty, &b->link); } } diff --git a/spa/plugins/v4l2/v4l2-utils.c b/spa/plugins/v4l2/v4l2-utils.c index 3be85c6f2..9442e732b 100644 --- a/spa/plugins/v4l2/v4l2-utils.c +++ b/spa/plugins/v4l2/v4l2-utils.c @@ -127,10 +127,10 @@ static int spa_v4l2_buffer_recycle(struct impl *this, uint32_t buffer_id) struct spa_v4l2_device *dev = &port->dev; int err; - if (!SPA_FLAG_CHECK(b->flags, BUFFER_FLAG_OUTSTANDING)) + if (!SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_OUTSTANDING)) return 0; - SPA_FLAG_UNSET(b->flags, BUFFER_FLAG_OUTSTANDING); + SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_OUTSTANDING); spa_log_trace(this->log, "v4l2 %p: recycle buffer %d", this, buffer_id); if (xioctl(dev->fd, VIDIOC_QBUF, &b->v4l2_buffer) < 0) { @@ -158,15 +158,15 @@ static int spa_v4l2_clear_buffers(struct impl *this) b = &port->buffers[i]; d = b->outbuf->datas; - if (SPA_FLAG_CHECK(b->flags, BUFFER_FLAG_OUTSTANDING)) { + if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_OUTSTANDING)) { spa_log_info(this->log, "v4l2: queueing outstanding buffer %p", b); spa_v4l2_buffer_recycle(this, i); } - if (SPA_FLAG_CHECK(b->flags, BUFFER_FLAG_MAPPED)) { + if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_MAPPED)) { munmap(SPA_MEMBER(b->ptr, -d[0].mapoffset, void), d[0].maxsize - d[0].mapoffset); } - if (SPA_FLAG_CHECK(b->flags, BUFFER_FLAG_ALLOCATED)) { + if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_ALLOCATED)) { spa_log_debug(this->log, "v4l2: close %d", (int) d[0].fd); close(d[0].fd); } @@ -1552,7 +1552,7 @@ static int spa_v4l2_stream_off(struct impl *this) struct buffer *b; b = &port->buffers[i]; - if (!SPA_FLAG_CHECK(b->flags, BUFFER_FLAG_OUTSTANDING)) { + if (!SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_OUTSTANDING)) { if (xioctl(dev->fd, VIDIOC_QBUF, &b->v4l2_buffer) < 0) spa_log_warn(this->log, "VIDIOC_QBUF: %s", strerror(errno)); } diff --git a/spa/plugins/videoconvert/videoadapter.c b/spa/plugins/videoconvert/videoadapter.c index 71a251380..7c893f35b 100644 --- a/spa/plugins/videoconvert/videoadapter.c +++ b/spa/plugins/videoconvert/videoadapter.c @@ -606,8 +606,8 @@ static int negotiate_buffers(struct impl *this) slave_flags = this->slave_flags; conv_flags = this->convert_flags; - slave_alloc = SPA_FLAG_CHECK(slave_flags, SPA_PORT_FLAG_CAN_ALLOC_BUFFERS); - conv_alloc = SPA_FLAG_CHECK(conv_flags, SPA_PORT_FLAG_CAN_ALLOC_BUFFERS); + slave_alloc = SPA_FLAG_IS_SET(slave_flags, SPA_PORT_FLAG_CAN_ALLOC_BUFFERS); + conv_alloc = SPA_FLAG_IS_SET(conv_flags, SPA_PORT_FLAG_CAN_ALLOC_BUFFERS); flags = 0; if (conv_alloc || slave_alloc) { diff --git a/spa/plugins/vulkan/vulkan-compute-source.c b/spa/plugins/vulkan/vulkan-compute-source.c index 29388dd5f..2c8615582 100644 --- a/spa/plugins/vulkan/vulkan-compute-source.c +++ b/spa/plugins/vulkan/vulkan-compute-source.c @@ -322,10 +322,10 @@ static inline void reuse_buffer(struct impl *this, struct port *port, uint32_t i { struct buffer *b = &port->buffers[id]; - if (SPA_FLAG_CHECK(b->flags, BUFFER_FLAG_OUT)) { + if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_OUT)) { spa_log_trace(this->log, NAME " %p: reuse buffer %d", this, id); - SPA_FLAG_UNSET(b->flags, BUFFER_FLAG_OUT); + SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_OUT); spa_list_append(&port->empty, &b->link); if (!this->props.live) diff --git a/spa/tools/spa-inspect.c b/spa/tools/spa-inspect.c index 7f894b99f..1f71f116b 100644 --- a/spa/tools/spa-inspect.c +++ b/spa/tools/spa-inspect.c @@ -84,7 +84,7 @@ inspect_node_params(struct data *data, struct spa_node *node, for (i = 0; i < n_params; i++) { printf("enumerating: %s:\n", spa_debug_type_find_name(spa_type_param, params[i].id)); - if (!SPA_FLAG_CHECK(params[i].flags, SPA_PARAM_INFO_READ)) + if (!SPA_FLAG_IS_SET(params[i].flags, SPA_PARAM_INFO_READ)) continue; spa_zero(listener); @@ -118,7 +118,7 @@ inspect_port_params(struct data *data, struct spa_node *node, params[i].flags & SPA_PARAM_INFO_READ ? 'r' : '-', params[i].flags & SPA_PARAM_INFO_WRITE ? 'w' : '-'); - if (!SPA_FLAG_CHECK(params[i].flags, SPA_PARAM_INFO_READ)) + if (!SPA_FLAG_IS_SET(params[i].flags, SPA_PARAM_INFO_READ)) continue; printf("values:\n"); diff --git a/src/modules/module-client-node/remote-node.c b/src/modules/module-client-node/remote-node.c index 7e6112044..cc2be17c6 100644 --- a/src/modules/module-client-node/remote-node.c +++ b/src/modules/module-client-node/remote-node.c @@ -366,7 +366,7 @@ static int add_port_update(struct pw_proxy *proxy, struct pw_port *port, uint32_ pi.flags = port->spa_flags; pi.rate = SPA_FRACTION(0, 1); pi.props = &port->properties->dict; - SPA_FLAG_UNSET(pi.flags, SPA_PORT_FLAG_DYNAMIC_DATA); + SPA_FLAG_CLEAR(pi.flags, SPA_PORT_FLAG_DYNAMIC_DATA); pi.n_params = port->info.n_params; pi.params = port->info.params; } diff --git a/src/modules/module-protocol-native.c b/src/modules/module-protocol-native.c index be2d4f578..d328815fc 100644 --- a/src/modules/module-protocol-native.c +++ b/src/modules/module-protocol-native.c @@ -204,10 +204,7 @@ client_busy_changed(void *data, bool busy) c->busy = busy; - if (busy) - SPA_FLAG_UNSET(mask, SPA_IO_IN); - else - SPA_FLAG_SET(mask, SPA_IO_IN); + SPA_FLAG_UPDATE(mask, SPA_IO_IN, !busy); pw_log_debug(NAME" %p: busy changed %d", client->protocol, busy); pw_loop_update_io(client->core->main_loop, c->source, mask); @@ -238,7 +235,7 @@ connection_data(void *data, int fd, uint32_t mask) res = pw_protocol_native_connection_flush(this->connection); if (res >= 0) { int mask = this->source->mask; - SPA_FLAG_UNSET(mask, SPA_IO_OUT); + SPA_FLAG_CLEAR(mask, SPA_IO_OUT); pw_loop_update_io(client->protocol->core->main_loop, this->source, mask); } else if (res != EAGAIN) { @@ -540,7 +537,7 @@ on_remote_data(void *data, int fd, uint32_t mask) res = pw_protocol_native_connection_flush(conn); if (res >= 0) { int mask = impl->source->mask; - SPA_FLAG_UNSET(mask, SPA_IO_OUT); + SPA_FLAG_CLEAR(mask, SPA_IO_OUT); pw_loop_update_io(core->main_loop, impl->source, mask); impl->flushing = false; diff --git a/src/modules/spa/spa-device.c b/src/modules/spa/spa-device.c index 4e7200898..3e36f88fd 100644 --- a/src/modules/spa/spa-device.c +++ b/src/modules/spa/spa-device.c @@ -100,7 +100,7 @@ pw_spa_device_new(struct pw_core *core, pw_device_add_listener(this, &impl->device_listener, &device_events, impl); pw_device_set_implementation(this, impl->device); - if (!SPA_FLAG_CHECK(impl->flags, PW_SPA_DEVICE_FLAG_NO_REGISTER)) { + if (!SPA_FLAG_IS_SET(impl->flags, PW_SPA_DEVICE_FLAG_NO_REGISTER)) { if ((res = pw_device_register(this, NULL)) < 0) goto error_register; } diff --git a/src/modules/spa/spa-node.c b/src/modules/spa/spa-node.c index 4b1e05397..b9c00ed1f 100644 --- a/src/modules/spa/spa-node.c +++ b/src/modules/spa/spa-node.c @@ -79,10 +79,10 @@ static void complete_init(struct impl *impl) impl->init_pending = SPA_ID_INVALID; - if (SPA_FLAG_CHECK(impl->flags, PW_SPA_NODE_FLAG_ACTIVATE)) + if (SPA_FLAG_IS_SET(impl->flags, PW_SPA_NODE_FLAG_ACTIVATE)) pw_node_set_active(this, true); - if (!SPA_FLAG_CHECK(impl->flags, PW_SPA_NODE_FLAG_NO_REGISTER)) + if (!SPA_FLAG_IS_SET(impl->flags, PW_SPA_NODE_FLAG_NO_REGISTER)) pw_node_register(this, NULL); else pw_node_initialized(this); diff --git a/src/modules/module-adapter/floatmix.c b/src/pipewire/mix/floatmix.c similarity index 99% rename from src/modules/module-adapter/floatmix.c rename to src/pipewire/mix/floatmix.c index 33fb72e1e..2ade15039 100644 --- a/src/modules/module-adapter/floatmix.c +++ b/src/pipewire/mix/floatmix.c @@ -436,7 +436,7 @@ static int clear_buffers(struct impl *this, struct port *port) static int queue_buffer(struct impl *this, struct port *port, struct buffer *b) { - if (SPA_FLAG_CHECK(b->flags, BUFFER_FLAG_QUEUED)) + if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_QUEUED)) return -EINVAL; spa_list_append(&port->queue, &b->link); @@ -454,7 +454,7 @@ static struct buffer *dequeue_buffer(struct impl *this, struct port *port) b = spa_list_first(&port->queue, struct buffer, link); spa_list_remove(&b->link); - SPA_FLAG_UNSET(b->flags, BUFFER_FLAG_QUEUED); + SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_QUEUED); spa_log_trace_fp(this->log, NAME " %p: dequeue buffer %d", this, b->id); return b; } @@ -730,7 +730,8 @@ static int impl_node_process(void *object) (inio = inport->io) == NULL || inio->buffer_id >= inport->n_buffers || inio->status != SPA_STATUS_HAVE_DATA) { - spa_log_trace_fp(this->log, NAME " %p: skip input %d %d %p %d %d %d", this, + spa_log_trace_fp(this->log, NAME " %p: skip input idx:%d valid:%d " + "io:%p status:%d buf_id:%d n_buffers:%d", this, i, inport->valid, inio, inio ? inio->status : -1, inio ? inio->buffer_id : SPA_ID_INVALID, diff --git a/src/pipewire/node.c b/src/pipewire/node.c index 17e852268..8b1366a86 100644 --- a/src/pipewire/node.c +++ b/src/pipewire/node.c @@ -1637,7 +1637,7 @@ pw_node_find_port(struct pw_node *node, enum pw_direction direction, uint32_t po break; } /* We can use this port if it can multiplex */ - if (SPA_FLAG_CHECK(p->mix_flags, PW_PORT_MIX_FLAG_MULTI)) + if (SPA_FLAG_IS_SET(p->mix_flags, PW_PORT_MIX_FLAG_MULTI)) port = p; } } @@ -1659,12 +1659,12 @@ uint32_t pw_node_get_free_port_id(struct pw_node *node, enum pw_direction direct max_ports = node->info.max_input_ports; n_ports = node->info.n_input_ports; portmap = &node->input_port_map; - dynamic = SPA_FLAG_CHECK(node->spa_flags, SPA_NODE_FLAG_IN_DYNAMIC_PORTS); + dynamic = SPA_FLAG_IS_SET(node->spa_flags, SPA_NODE_FLAG_IN_DYNAMIC_PORTS); } else { max_ports = node->info.max_output_ports; n_ports = node->info.n_output_ports; portmap = &node->output_port_map; - dynamic = SPA_FLAG_CHECK(node->spa_flags, SPA_NODE_FLAG_OUT_DYNAMIC_PORTS); + dynamic = SPA_FLAG_IS_SET(node->spa_flags, SPA_NODE_FLAG_OUT_DYNAMIC_PORTS); } pw_log_debug(NAME" %p: direction %s n_ports:%u max_ports:%u", node, pw_direction_as_string(direction), n_ports, max_ports); diff --git a/src/pipewire/port.c b/src/pipewire/port.c index a3ac4e1c1..0e10d60d2 100644 --- a/src/pipewire/port.c +++ b/src/pipewire/port.c @@ -384,9 +384,9 @@ struct pw_port *pw_port_new(enum pw_direction direction, } if (info) { - if (SPA_FLAG_CHECK(info->flags, SPA_PORT_FLAG_PHYSICAL)) + if (SPA_FLAG_IS_SET(info->flags, SPA_PORT_FLAG_PHYSICAL)) pw_properties_set(properties, PW_KEY_PORT_PHYSICAL, "1"); - if (SPA_FLAG_CHECK(info->flags, SPA_PORT_FLAG_TERMINAL)) + if (SPA_FLAG_IS_SET(info->flags, SPA_PORT_FLAG_TERMINAL)) pw_properties_set(properties, PW_KEY_PORT_TERMINAL, "1"); this->spa_flags = info->flags; } @@ -850,7 +850,7 @@ static void pw_port_remove(struct pw_port *port) pw_loop_invoke(port->node->data_loop, do_remove_port, SPA_ID_INVALID, NULL, 0, true, port); - if (SPA_FLAG_CHECK(port->flags, PW_PORT_FLAG_TO_REMOVE)) { + if (SPA_FLAG_IS_SET(port->flags, PW_PORT_FLAG_TO_REMOVE)) { if ((res = spa_node_remove_port(node->node, port->direction, port->port_id)) < 0) pw_log_warn(NAME" %p: can't remove: %s", port, spa_strerror(res)); } diff --git a/src/pipewire/stream.c b/src/pipewire/stream.c index 3466d9145..a2a0e44cc 100644 --- a/src/pipewire/stream.c +++ b/src/pipewire/stream.c @@ -222,7 +222,7 @@ static inline int push_queue(struct stream *stream, struct queue *queue, struct { uint32_t index; - if (SPA_FLAG_CHECK(buffer->flags, BUFFER_FLAG_QUEUED)) + if (SPA_FLAG_IS_SET(buffer->flags, BUFFER_FLAG_QUEUED)) return -EINVAL; SPA_FLAG_SET(buffer->flags, BUFFER_FLAG_QUEUED); @@ -251,7 +251,7 @@ static inline struct buffer *pop_queue(struct stream *stream, struct queue *queu buffer = &stream->buffers[id]; queue->outcount += buffer->this.size; - SPA_FLAG_UNSET(buffer->flags, BUFFER_FLAG_QUEUED); + SPA_FLAG_CLEAR(buffer->flags, BUFFER_FLAG_QUEUED); return buffer; } @@ -304,7 +304,7 @@ do_call_process(struct spa_loop *loop, static void call_process(struct stream *impl) { pw_log_trace(NAME" %p: call process", impl); - if (SPA_FLAG_CHECK(impl->flags, PW_STREAM_FLAG_RT_PROCESS)) { + if (SPA_FLAG_IS_SET(impl->flags, PW_STREAM_FLAG_RT_PROCESS)) { do_call_process(NULL, false, 1, NULL, 0, impl); } else { @@ -624,7 +624,7 @@ static void clear_buffers(struct pw_stream *stream) pw_stream_emit_remove_buffer(stream, &b->this); - if (SPA_FLAG_CHECK(b->flags, BUFFER_FLAG_MAPPED)) { + if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_MAPPED)) { for (j = 0; j < b->this.buffer->n_datas; j++) { struct spa_data *d = &b->this.buffer->datas[j]; pw_log_debug(NAME" %p: clear buffer %d mem", @@ -663,7 +663,7 @@ static int impl_port_use_buffers(void *object, b->flags = 0; b->id = i; - if (SPA_FLAG_CHECK(impl_flags, PW_STREAM_FLAG_MAP_BUFFERS)) { + if (SPA_FLAG_IS_SET(impl_flags, PW_STREAM_FLAG_MAP_BUFFERS)) { for (j = 0; j < buffers[i]->n_datas; j++) { struct spa_data *d = &buffers[i]->datas[j]; if (d->type == SPA_DATA_MemFd || @@ -814,7 +814,7 @@ again: } } - if (!impl->draining && !SPA_FLAG_CHECK(impl->flags, PW_STREAM_FLAG_DRIVER)) { + if (!impl->draining && !SPA_FLAG_IS_SET(impl->flags, PW_STREAM_FLAG_DRIVER)) { call_process(impl); if (spa_ringbuffer_get_read_index(&impl->queued.ring, &index) >= MIN_QUEUED && io->status == SPA_STATUS_NEED_DATA) @@ -1056,7 +1056,7 @@ static int handle_connect(struct pw_stream *stream) pw_node_set_implementation(slave, &impl->impl_node); - if (!SPA_FLAG_CHECK(impl->flags, PW_STREAM_FLAG_INACTIVE)) + if (!SPA_FLAG_IS_SET(impl->flags, PW_STREAM_FLAG_INACTIVE)) pw_node_set_active(slave, true); if (impl->media_type == SPA_MEDIA_TYPE_audio && @@ -1486,7 +1486,7 @@ pw_stream_connect(struct pw_stream *stream, if (flags & PW_STREAM_FLAG_DONT_RECONNECT) pw_properties_set(stream->properties, PW_KEY_NODE_DONT_RECONNECT, "1"); - impl->alloc_buffers = SPA_FLAG_CHECK(flags, PW_STREAM_FLAG_ALLOC_BUFFERS); + impl->alloc_buffers = SPA_FLAG_IS_SET(flags, PW_STREAM_FLAG_ALLOC_BUFFERS); pw_properties_setf(stream->properties, PW_KEY_MEDIA_CLASS, "Stream/%s/%s", direction == PW_DIRECTION_INPUT ? "Input" : "Output", @@ -1669,7 +1669,7 @@ do_process(struct spa_loop *loop, static inline int call_trigger(struct stream *impl) { int res = 0; - if (SPA_FLAG_CHECK(impl->flags, PW_STREAM_FLAG_DRIVER)) { + if (SPA_FLAG_IS_SET(impl->flags, PW_STREAM_FLAG_DRIVER)) { res = pw_loop_invoke(impl->core->data_loop, do_process, 1, NULL, 0, false, impl); } diff --git a/src/tools/pipewire-monitor.c b/src/tools/pipewire-monitor.c index abb2ad97e..822dae0d0 100644 --- a/src/tools/pipewire-monitor.c +++ b/src/tools/pipewire-monitor.c @@ -289,7 +289,7 @@ static void node_event_info(void *object, const struct pw_node_info *info) if (old != NULL && info->params[i].flags == old->params[i].flags) continue; remove_params(data, info->params[i].id, 0); - if (!SPA_FLAG_CHECK(info->params[i].flags, SPA_PARAM_INFO_READ)) + if (!SPA_FLAG_IS_SET(info->params[i].flags, SPA_PARAM_INFO_READ)) continue; pw_node_proxy_enum_params((struct pw_node_proxy*)data->proxy, 0, info->params[i].id, 0, 0, NULL); @@ -349,7 +349,7 @@ static void port_event_info(void *object, const struct pw_port_info *info) if (old != NULL && info->params[i].flags == old->params[i].flags) continue; remove_params(data, info->params[i].id, 0); - if (!SPA_FLAG_CHECK(info->params[i].flags, SPA_PARAM_INFO_READ)) + if (!SPA_FLAG_IS_SET(info->params[i].flags, SPA_PARAM_INFO_READ)) continue; pw_port_proxy_enum_params((struct pw_port_proxy*)data->proxy, 0, info->params[i].id, 0, 0, NULL); @@ -528,7 +528,7 @@ static void device_event_info(void *object, const struct pw_device_info *info) if (old != NULL && info->params[i].flags == old->params[i].flags) continue; remove_params(data, info->params[i].id, 0); - if (!SPA_FLAG_CHECK(info->params[i].flags, SPA_PARAM_INFO_READ)) + if (!SPA_FLAG_IS_SET(info->params[i].flags, SPA_PARAM_INFO_READ)) continue; pw_device_proxy_enum_params((struct pw_device_proxy*)data->proxy, 0, info->params[i].id, 0, 0, NULL);