spa_pod_builder_add() is a va_args function that is terminated by a NULL
argument. The last argument must be a pointer type, because otherwise
checking for a NULL pointer can fail.
The __attribute__((__sentinel__)) prints a compiler warning, if the last
argument of a call to spa_pod_builder_add() is not a pointer type.
Fix all sentinel warnings by replacing all integer type 0 with pointer
type NULL in calls to spa_pod_builder_add().
Introduce spa_hook_list_call_simple_safe() as a new helper that uses
spa_list_for_each_safe() and use it for pw_node_events_* This way multiple
threads can iterate at the same time and, if only one thread is active, the
current list entry can be safely removed (e.g. in
pw_node_events_destroy()).
Without this the node listener_list may be corrupted when the main and data
loop iterate over the list at the same time (See #143).
As reported by Marcello Blancasio, convert the offset to a signed int
to avoid conversion without sign extension. Fixes unmap of stream
memory.
Fixes#103
By using __typeof__ instead of typeof:
/usr/include/pipewire/array.h:85:11: error: use of undeclared identifier 'typeof'; did you mean 'typeid'?
alloc = SPA_MAX(alloc, arr->extend);
Pass the minimum required version to the hook emission and only call
events when the handler is recent enough.
Add some macros to make event emission easier to read.
We need to keep the sources around until all sources are dispatched. If
not: source A and B are active after poll, A is dispatched first and
removes B, when B is then dispatched, the memory is gone. We don't
free the source but simply mark the fd invalid and move it do a
destroy list. After all sources are dispatched we destroy.
This is safe because removing a source is either done from the poll
context (with invoke) or when holding the right locks.
A device that supports continuous/step-wise frame interval will
report the correct frame intervals for index 0 and EINVAL for
every other index.
(https://linuxtv.org/downloads/v4l-dvb-apis/uapi/v4l/vidioc-enum-frameintervals.html)
Previously, the code would exit from the loop after successfully
reading index 0, without marking that the iteration of frame
interval completed. Therefore, the next time the function was
called the same frame intervals would be read, instead of advancing
to the next frame size or format type.
Instead, mark that we need to try and read the next format size.
Fixes#56
Clang++ (and g++) don't define __STDC_VERSION__ which results in
include/spa/support/log.h:101:5: error: '__STDC_VERSION__' is not defined, evaluates to 0 [-Werror,-Wundef]
#if __STDC_VERSION__ >= 199901L
include/pipewire/log.h:64:5: error: '__STDC_VERSION__' is not defined, evaluates to 0 [-Werror,-Wundef]
#if __STDC_VERSION__ >= 199901L
so check if __STDC_VERSION__ is defined before comparing.
Also, include/feature.h additionally defines __USE_ISOC99 (and
__USE_ISOC11 for C11 extension), so check these as well.
Don't use a destroy_list anymore, it's not safe anyway. Instead require
that sources be removed with (a blocking) invoke. Make sure we don't
dispatch sources that were removed from the loop.