Commit graph

65 commits

Author SHA1 Message Date
Demi Marie Obenour
9e789c65c2 src: check that POD arrays have the correct size for their type
The parser does not check that POD arrays have the correct size for
their type, so the calling code must do that.

This also enumerates some of the code that cannot handle the size of the
values of an array not being the exact expected size for its type.
There is a lot of it.
2025-07-24 16:27:42 -04:00
Demi Marie Obenour
30419c37df Ensure all globals have PW_KEY_OBJECT_SERIAL prop
This avoids the caller having to set this property.
2024-02-09 14:45:05 +00:00
Wim Taymans
212fe59530 perm: add permission mask to global
Add a mask of possible permissions for a global.
Make sure the permissions of an object are limited to the global
mask.
2023-07-28 10:22:12 +02:00
Wim Taymans
0b2d9ee007 module-session-manager: use dynamic builder
The buffer is very small and we should use a dynamic builder if we don't
know what pod we will expect.
2023-06-15 11:05:17 +02:00
Barnabás Pőcze
934ab3036e treewide: use SPDX tags to specify copyright information
SPDX tags make the licensing information easy to understand and clear,
and they are machine parseable.

See https://spdx.dev for more information.
2023-02-16 10:54:48 +00:00
Demi Marie Obenour
400860f63c Add <stdint.h> includes
This is to make the headers standalone.
2022-09-23 15:19:01 +00:00
Fabrice Fontaine
85ca67b927 fix detection of reallocarray
Fix detection of reallocarray (e.g. on glibc) raised since commit
0708a39b43

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2022-05-30 09:33:27 +02:00
Wim Taymans
383df85466 modules: handle factory destroy
Listen for factory destroy and clean up the module.

See #565
2022-05-06 12:11:20 +02:00
Wim Taymans
ba7d410c3c handle realloc error better
Make sure we free the old pointer, clear it and set the array size to 0.
Use reallocarray where possible.
2022-04-27 10:09:06 +02:00
Quentin Wenger
22fc9eec35 Cleanup argument names in methods and events interfaces
First method argument is object, first event argument is data.

Closes !963
2022-04-15 10:11:49 +02:00
Wim Taymans
b97327e1f6 module: handle type register errors
Registering an export type can give an error when the type is already
registered. Handle those errors and refuse to load the module.

See #2281
2022-04-11 21:15:13 +02:00
Wim Taymans
c89595d86f protocol: increase some limits 2022-03-02 10:05:27 +01:00
Pauli Virtanen
ab353a8057 module-session-manager: set object.serial on session objects
Session, endpoint, link, and stream objects should also set
object.serial.
2022-02-28 20:11:01 +02:00
Wim Taymans
ead827d6cb modules: limit the max amount of items in the protocol
For now, put a limit on the amount of items we can send and receive
over the native protocol. A more complex way of allocating and freeing
can be implemented later when we really need to raise the limits.

Fixes #2070
2022-01-28 15:55:44 +01:00
Wim Taymans
b1fb4a2660 Revert "global: don't reuse ids"
This reverts commit bae0d16e09.
2022-01-17 12:12:54 +01:00
Wim Taymans
bae0d16e09 global: don't reuse ids 2022-01-13 14:53:18 +01:00
Barnabás Pőcze
e6e27fe74c pipewire: module-session-manager: harmonize type of change_mask
The `pw_*_info` structures in core pipewire all have 64-bit change
masks. Convert the change masks in the session manager extension
to 64-bit as the differing sizes can cause problems.

This introduces an API and ABI break unfortunately, but due to
the limited number of users of the session manager extension,
it was deemed safe.

See wireplumber#49
2021-12-14 15:15:55 +00:00
Wim Taymans
e7f9046bb8 global: place object.serial in object info
Make a method to return or allocate the serial for a global.
When the global is unregistered, a new serial is calculated.
Place the serial in the object info and the global info.
2021-11-22 17:13:10 +01:00
Wim Taymans
3509962f3a module-session-manager: don't leak the impl structure
We need to remove the listener for the object as well so that we
can safely free the impl memory.
2021-10-27 17:41:32 +02:00
Barnabás Pőcze
f5d51162c4 treewide: mark things static and const
Mark some structures, arrays static/const at various places.
In some cases this prevents unnecessary initialization
when a function is entered.

All in all, the text segments across all shared
libraries are reduced by about 2 KiB. However,
the total size increases by about 2 KiB as well.
2021-06-30 14:44:08 +02:00
George Kiagiadakis
59407d2f08 includes: update all references to extensions to point to pipewire/extensions
This also brings the advantage that all tools, examples, modules, components
can also be compiled standalone out-of-tree using libpipewire from the system
2021-06-18 17:54:18 +03:00
Peter Hutterer
e0471c6757 pipewire: allow NULL pointers in pw_properties_free()
Just like the real free() we should just ignore a NULL pointer, makes the
caller code easier for those instances where properties are optional.

Patch generated with concinelle with a few manual fixes.
2021-06-02 10:56:46 +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
Emmanuel Gil Peyrot
14fdf07e8f Run codespell on the entire codebase
This tool detects and fixes common English spelling mistakes, with
generally very few mistakes.

Here is the command I used to generate this commit.  There were a few
changes that had to be done manually, and of course adding the ignore
file:
```shell
codespell -I .codespell-ignore -x .codespell-ignore -w
```

I didn’t add it to the CI, but this would be a good place for it.
2020-08-17 17:16:31 +00:00
Wim Taymans
469dff0153 use global_update_keys
First set the properties in the object itself and then copy them
over to the global. This ensure that the global properties are
also in the object and makes code a bit cleaner.

It also make it possible to use the global id to make the property
values unique, if we want to later .
2020-08-05 12:55:33 +02:00
Wim Taymans
91d4806611 permission: add some helpers
Add PW_PERM_ALL as a shortcut for all permissions
Add PW_PERMISSION_FORMAT and PW_PERMISSION_ARGS to nicely format
permissions.
2020-07-30 16:26:29 +02:00
George Kiagiadakis
6ecbe00774 session-manager: emit cached info with CHANGE_MASK_ALL on new resources 2020-06-01 16:25:40 +00:00
George Kiagiadakis
e918d60959 session-manager: implement factories for session, endpoint-stream & endpoint-link
Heavily based on the endpoint factory
2020-03-27 14:56:07 +00:00
George Kiagiadakis
444d180218 session-manager: endpoint: implement caching info & params
The info structure needs to be cached because there is no way to
request it from the implementation, unless we hack the add_listener
API to be used for making info requests or add a new method that
will be used just in the implementation (both are bad ideas).

The params are cached because
1) a client doing enum_params + sync will not work correctly, since
 the sync call syncs with the server and not the implementation...
 we could block the client to solve that, but then there is also #2
2) the implementation is not aware of the clients and therefore
 it cannot keep track of who is subscribed and who is not, this
 needs to happen in the server. Then if we only keep track of the
 subscriptions in the server and keep requesting params from the
 impl, there is no way to know if a param event coming from the
 impl matches a call to enum_params or to subscribe or if it's
 just an update that needs to be forwarded to subscribers.
2020-03-27 14:56:07 +00:00
George Kiagiadakis
df66edd9ab session-manager: implement 'endpoint' factory
This is modeled after the 'metadata' factory and provides
a way to use the pw_endpoint interface directly to implement
an endpoint object in a client.
2020-03-27 14:56:07 +00:00
George Kiagiadakis
0a8ec0380b session-manager: check error code when registering the marshallers 2020-03-27 14:56:07 +00:00
George Kiagiadakis
e971a79fce session-manager: implement export functions for session-manager objects 2020-03-27 14:56:07 +00:00
George Kiagiadakis
234c642746 session-manager: move files into client-endpoint / client-session subdirs
To clean up space for the new implementation.
The existing code is exclusively for use with the client-endpoint
and client-session factories.
2020-03-27 14:56:07 +00:00
George Kiagiadakis
bc3a92e950 session-manager: add impl marshallers for endpoint, -stream, -link and session 2020-03-27 14:56:07 +00:00
Wim Taymans
df519ee3b3 avoid including private.h
Expose some more methods to make it possible to build without
including the private.h header, especially in modules.
2020-01-02 13:48:50 +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
310077438b pw_impl_factory_new -> pw_context_create_factory 2019-12-11 17:50:27 +01:00
Wim Taymans
3805d5dfa2 pw_endpoint_stream_proxy -> pw_endpoint_stream 2019-12-11 16:48:00 +01:00
Wim Taymans
9b53c65c72 pw_endpoint_proxy -> pw_endpoint 2019-12-11 16:43:53 +01:00
Wim Taymans
85103d128e pw_session_proxy -> pw_session 2019-12-11 16:39:24 +01:00
Wim Taymans
3c737cf39c pw_endpoint_link_proxy -> pw_endpoint_link 2019-12-11 16:36:12 +01:00
Wim Taymans
94ed9c8e38 pw_client_endpoint_proxy -> pw_client_endpoint
pw_client_session_proxy -> pw_client_session
2019-12-11 16:31:58 +01:00
Wim Taymans
443a49947e pw_module -> pw_impl_module 2019-12-11 11:57:56 +01:00
Wim Taymans
815d4a8d20 pw_factory -> pw_impl_factory 2019-12-11 11:45:27 +01:00
Wim Taymans
95688939bf pw_client -> pw_impl_client 2019-12-11 11:21:43 +01:00
Wim Taymans
d70a47b7fe move proxy implementations in their own file
Rearrange headers
2019-12-11 10:58:51 +01:00
Wim Taymans
8ea78c2e3f pw_core -> pw_context
The proxy API is the one that we would like to expose for applications
and the other API is used internally when implementing modules or
factories.

The current pw_core object is really a context for all objects so
name it that way. It also makes it possible to rename pw_core_proxy
to pw_proxy later.
2019-12-10 18:19:56 +01:00
Wim Taymans
5a2ad084e8 proxy: add pw_proxy_set_bound_id
Add method to set bound_id and emit the signal.

Rename resource_bound_id -> resource_set_bound_id and add
resource_get_bound_id.
2019-12-10 12:19:11 +01:00
Wim Taymans
125fcb5660 session-manager: remove obsolte _set_id
media-session: Wait for devices to appear and be bound before setting
the profile on the device. Then wait for all the nodes to appear
before attempting the create endpoints on the device.
2019-11-29 13:34:09 +01:00
Wim Taymans
8e24e57db0 endpoint: handle NULL name and media_class 2019-11-29 13:34:09 +01:00