Commit graph

14 commits

Author SHA1 Message Date
Julian Bouzas
4732aea0c6 spa: clear all devices when udev monitor stops
Otherwise the udev device leaks when restarting the monitor
2021-07-13 17:03:30 +00:00
Wim Taymans
46ef88e520 spa: save the old change_mask and restore when emitting full
When we add a new listener to an object, it will emit the full state
of the object. For this it temporarily sets the change_mask to all
changes. Restore the previous state after this or else we might not
emit the right change_mask for the next listener.

Consider the case where one there are two listeners on an object.
The object emits a change and the first listener wants to enumerate the
changed params. For this is adds a new listener and then triggers the
enumeration. If we set the change_mask to 0 after adding the listener,
the second listener would get a 0 change_mask and fail to update
its state.
2021-05-27 15:21:44 +02:00
Peter Hutterer
71c6a175c4 Drop double semicolons 2021-05-20 07:24:22 +00:00
Peter Hutterer
7697ed0757 treewide: replace strcmp() == 0 with spa_streq()
This change is only done in source files for now, header files will be done
separately.
2021-05-18 22:10:27 +10:00
Peter Hutterer
65f5f2a6f8 alsa/v4l2: convdert udev's VID/PID from hex to decimal
udev's ID_MODEL_ID and ID_VENDOR_ID are inconsistent: always 4-digit hex but
sound devices are prefixed with 0x, v4l devices are not. Depending on the
actual ID, the value will look like decimal (1234) or hex (a234).

pw-dump will then print those as either decimal integers (i.e. 0x1234 becomes
decimal 1234) or double (i.e. a234 becomes 41524.00).

Make this consistent by converting the string from hex do decimal where we
get it.
2021-05-18 07:35:00 +00:00
Peter Hutterer
2405f0942b spa/buffer: rename SPA_MEMBER to SPA_PTROFF
SPA_MEMBER is misleading, all we're doing here is pointer+offset and a
type-casting the result. Rename to SPA_PTROFF which is more expressive (and
has the same number of characters so we don't need to re-indent).
2021-05-06 09:39:39 +00:00
Pauli Virtanen
20e383cea7 v4l2: remove device if inotify reports it's no longer accessible 2021-04-11 16:38:10 +00:00
Björn Daase
5913eb098c treewide: fix issues found by codespell 2021-03-16 19:11:25 +00:00
Wim Taymans
2b44f42845 pass the complete buffer size to snprintf
There is no reason to pass size-1, snprintf will always put a \0
at the end.
2021-02-02 12:09:29 +01:00
Wim Taymans
22c793aa87 v4l2: add inotify support
Wait with inotify until we can access the device node before emiting
the new device.
Clean up alsa-udev and make it more like v4l2-udev
2020-12-17 10:43:57 +01:00
Wim Taymans
a1846c9780 udev: don't loop forever on errors
When we can't find the v4l2 device id, unref the device and continue
instead of looping forever and consuming all memory.

Fixes #219
2020-03-24 15:54:58 +01:00
Wim Taymans
f391353c7f Make interface types a string
This is more in line with wayland and it allows us to create new
interfaces in modules without having to add anything to the type
enum. It also removes some lookups to map type_id to readable
name in debug.
2019-12-19 13:36:04 +01:00
Wim Taymans
77e07e1948 improve properties on globals and ports 2019-09-20 13:28:06 +02:00
Wim Taymans
6756a3c8fc monitor: remove monitor API and use device
Remove the monitor API, we can use the device API for it. Make sure
we support creating devices (like alsa) from another device (udev).

Use new object.id to store the object id in the object properties. Use
the port.id/node.id etc to make relations to other objects.
2019-09-20 13:04:14 +02:00
Renamed from spa/plugins/v4l2/v4l2-monitor.c (Browse further)