Commit graph

55 commits

Author SHA1 Message Date
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
Wim Taymans
8335c50e1e session-manager: fix protocol 2019-11-29 13:34:09 +01:00
Wim Taymans
80ac755670 media-session: make the services more modular 2019-11-29 13:34:09 +01:00
Wim Taymans
8d49964c4d session-manager: add monitor keys
Add keys to specify monitor endpoints
2019-11-29 13:34:08 +01:00
Wim Taymans
f2ce69c4bd media-session: pass the client.id in the endpoint
Pass the client.id that we made this endpoint for in the endpoint
properties. This makes it possible to let pulse find the client
that belongs to the endpiont. The client.id is used to find the
client that actually made the object (the session manager)
2019-11-29 13:34:08 +01:00
Wim Taymans
8c43ebaf3e pulse: find linked endpoints
Set the stream node object-id as the node.id on the endpoint so that
the pulse api can find the linked endpoint.
2019-11-29 13:34:08 +01:00
Wim Taymans
709a52e286 media-session: also create EndpointLink objects
Create an endpoint link object when linking endpoints. Keep track
of the links in the endpoint_link and cleanup when they are all
gone.

Improve properties on session objects.
2019-11-29 13:34:08 +01:00
Wim Taymans
ddd185e749 session-manager: pass param id as POD_Id 2019-11-29 13:34:07 +01:00
Wim Taymans
3cd7d90d88 media-session: link all stream ports
Create a helper in the session manager to link all ports between
2 nodes.

Make the output endpoint call the input endpoint create_link, passing
the node or ports to link to.

Make the input endpoint complete the link by calling the session
helper to link all ports.

Remove the node policy, we're only using a policy for the endpoints
now.
2019-11-29 13:34:07 +01:00
Wim Taymans
3f3dfbc67e More session manager work
pulseaudio card is mapped to device
pulseaudio sink/source is mapped to an endpoint
prepare to map streams to card profiles
Add Route param to implement the endpoint routing later (ports)
Create an alsa endpoint for each device
Create one stream for each endpoint (Playback/Capture)

Implement create_link on the endpoint. The idea is to call
create link on the peer endpoint to complete the link. Remove
create_link on the session.

Add stream-monitor to turn pw_stream nodes into endpoints

Add a policy manager that tries to link endpoints

Use enum pw_direction for the endpoint direction. We can use the
media_class to determine if this is a pw_stream or not but it should
not really matter, you can link any output to any input.

Add autoconnect property for endpoints to make the policy connect.
2019-11-29 13:34:07 +01:00
Wim Taymans
e3a1c4151e emit bound_id event 2019-11-29 13:34:06 +01:00