Commit graph

481 commits

Author SHA1 Message Date
Wim Taymans
633c27824f add sentinel to parser as well 2019-07-09 21:16:56 +02:00
Wim Taymans
9b4b915f25 add SPA_SENTINEL 2019-07-09 21:13:26 +02:00
Michael Tretter
39c01ba2fe builder: fix calls to builder_add that are not terminated by NULL
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().
2019-07-09 20:53:44 +02:00
Wim Taymans
0720e375a1 avoid error(), it's not defined on musl 2019-06-21 16:33:49 +02:00
Wim Taymans
37613b67ba alsa: handle alsa-lib 1.1.9
alsa-lib 1.1.9 removed /usr/include/alsa from the include path, we
must include <alsa/asoundlib.h>
2019-05-23 09:25:51 +02:00
Michael Olbrich
6b269cce35 node: use spa_list_for_each_safe() for pw_node_events_*
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).
2019-05-21 17:10:09 +02:00
Michael Olbrich
5f507c804f remove libv4l2 dependency
It's not used anywhere right now.
2019-05-14 13:21:53 +02:00
Wim Taymans
2b5c6fd676 list: add _consume method
Add safer way to destroy a list of objects.
2019-05-06 17:04:16 +02:00
Wim Taymans
e4be9837c4 v4l2: add Camera media.role 2019-04-30 15:54:29 +02:00
Wim Taymans
9f7c9022cf format: map all mjpeg formats to video/mjpeg
Fixes #139
2019-04-10 17:03:14 +02:00
Philipp Zabel
181a6a2cea v4l2: do not keep non-capture devices open
If VIDIOC_QUERYCAP fails, or V4L2_CAP_VIDEO_CAPTURE is not set,
spa_v4l2_open should close the port file descriptor again.
2019-04-02 23:25:34 +02:00
Wim Taymans
f6391be214 add SPA_EXPORT where needed 2019-02-06 11:59:05 +01:00
Wim Taymans
703309f6cd spa: don't use constructor attribute to register factories 2019-02-06 11:38:12 +01:00
Wim Taymans
e4cac644d2 fix some compiler warnings with clang 2019-02-06 11:35:36 +01:00
Wim Taymans
317f3b6be7 type: add function to map types
Add a helper function to map the types. This should be used instead
of calling directly into the type mapper when CFI is used.
2019-02-06 11:10:44 +01:00
Wim Taymans
dd3eb55aee utils: add SPA_EXPORT 2019-02-06 09:21:16 +01:00
Wim Taymans
053e01177d loop: use simple hook emission
Add new simple hook emision without a cursor. The one with the cursor
is not thread safe and is not needed for the loop.

Fixes #110
2018-12-14 10:07:55 +01:00
Wim Taymans
39078f2abc meta: use spa_point and spa_rectangle
Change Cursor and Bitmap to what the work branch uses
2018-11-30 15:49:58 +01:00
Wim Taymans
218fd081df meta: define invalid cursor metadata 2018-11-30 12:08:53 +01:00
Wim Taymans
cd53eca92b meta: add cursor metadata and examples
Add a moving and flashing circle cursor to video-src
Render the cursor in video-play
2018-11-30 11:07:45 +01:00
Wim Taymans
49afacd66f v4l2: fix crash when unplugging
Only remove the v4l2 fd once on disconnect
Make sure we don't use the clock anymore when a link is destroyed.
2018-11-22 10:54:57 +01:00
Wim Taymans
1ea84b2869 spa: explicitly cast the offset to signed int
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
2018-11-12 10:50:21 +01:00
Tomas Popela
f58f63ae64 Fix build with clang
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);
2018-09-10 10:07:40 +02:00
Jan Alexander Steffens (heftig)
bbba49aae1 meson: Use pkgconfig.generate
Also fixes the moduledir having a duplicated prefix.
2018-09-03 21:21:47 +02:00
Wim Taymans
5eac8f7675 remove last debug includes
Fixes #82
2018-08-16 13:26:49 +02:00
Wim Taymans
d8525e3732 hooks: enforce version on hook emission
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.
2018-08-15 11:53:23 +02:00
Wim Taymans
2de7f9cc03 list: add iteration with a cursor
Iterating a list with a cursor is heavier but is safe against removal
of any element in the list. Move the hook cursor iterator to list.
2018-08-15 11:24:40 +02:00
Wim Taymans
4eae1f0c6f debug: add specific format debug 2018-08-14 13:05:10 +02:00
Wim Taymans
9d36b85dd6 remove spalib 2018-08-14 12:33:53 +02:00
Wim Taymans
d3b9a52ec4 don't link with spalib when we don't have to 2018-08-13 17:22:55 +02:00
Wim Taymans
872a1131fa pod: move compare and filter functions out of the library 2018-08-13 17:17:23 +02:00
Wim Taymans
d768a2d6da make spa-lib versioned
Fixes #60
2018-08-13 16:14:14 +02:00
Wim Taymans
de766324b9 hook: add private data for future expansion 2018-07-20 10:35:31 +02:00
Wim Taymans
1e54d9e00b hook: make safer
Also protect against removal of the next hook by using a cursor.
2018-06-15 13:11:00 +02:00
Wim Taymans
70bdb72857 loop: add back the destroy loop
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.
2018-06-15 13:06:59 +02:00
Wim Taymans
c42d495771 loop: blocking wait
Release the locks before waiting.
2018-06-15 13:06:13 +02:00
Giovanni Campagna
07f12c9713 v4l2: fix enumerating frame interval for continuous/step-wise devices
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
2018-04-03 16:28:23 +02:00
Eike Rathke
871dd2743b __STDC_VERSION__ may be undefined
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.
2018-04-03 16:27:58 +02:00
Philipp Zabel
e38cba4e13 v4l2: check device caps
If V4L2_CAP_DEVICE_CAPS is set, device_caps must be checked for the
V4L2_CAP_VIDEO_CAPTURE flag instead of capabilities.
2018-04-03 16:27:43 +02:00
Wim Taymans
187b6d4bf9 alsa: update the offset after each copy 2018-03-14 16:03:58 +01:00
Wim Taymans
8cadcd7f56 hook: return number of hooks called
Do finish_format ourselved when nobody was listening for the
format change.
2018-03-14 16:03:33 +01:00
Wim Taymans
2ed627f3b1 list: remove stray ; 2018-03-14 15:15:13 +01:00
Wim Taymans
638916e065 loop: remove the destroy_list
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.
2018-03-14 14:51:36 +01:00
Wim Taymans
8e2ceb773e Improve some debug 2018-03-01 09:01:52 +01:00
Wim Taymans
6f61ac9357 fix some signed vs unsigned comparisons 2018-02-20 18:19:11 +01:00
Wim Taymans
d3cc45c611 alsa: make some log as debug 2018-02-20 15:48:47 +01:00
Wim Taymans
2fe7197930 node: add option to pause-on-idle
v4l2 is slower to start when we pause in idle. Disable this
behaviour with an option on the node.
2018-02-20 12:28:19 +01:00
Wim Taymans
528d0a1c7d alsa: put device name in separate property 2018-02-20 09:59:52 +01:00
Wim Taymans
0e5a1b6327 props: use macro for property alternatives 2018-02-20 09:36:05 +01:00
Wim Taymans
c613ae4b40 v4l2: unset format, then close
v4l2 does not want to close unless the format is cleared
2018-02-16 18:14:24 +01:00