Commit graph

76 commits

Author SHA1 Message Date
Sam James
2cec77e7df *: unify config.h handling
config.h needs to be consistently included before any standard headers
if we ever want to set feature test macros (like _GNU_SOURCE or whatever)
inside. It can lead to hard-to-debug issues without that.

It can also be problematic just for our own HAVE_* that it may define
if it's not consistently made available before our own headers. Just
always include it first, before everything.

We already did this in many files, just not consistently.
2025-05-30 10:24:13 +00:00
Wim Taymans
9d1d1fcbef impl-port: add port.group property
Can be used to group ports together. Mostly because they are all from
the same stream and split into multiple ports by audioconvert/adapter.

Also useful for the alsa sequence to group client ports together.

Also interesting when pw-filter would be able to handle streams in the
future to find out what ports belong to what streams.
2024-06-24 13:38:09 +02:00
Wim Taymans
86af9de739 adapter: remove factory.mode property
We can deduce this from the way the node is configured with the
PortParam now.
2024-02-23 16:28:11 +01:00
Wim Taymans
59ea4ef897 adapter: move node.params to impl-node.c
Move configuration of initial Params from the adapter to the node to
make it more generally useful.

Add the same device.param config to devices.

This makes it possible to configure the default settings statically
while creating the nodes and devices.
2024-02-13 16:01:10 +01:00
Wim Taymans
513e8fa56f adapter: move adapter.auto-port-config to adapter
Move the handling of the default adapter port config to the adapter
itself.
2024-02-12 17:24:22 +01:00
Wim Taymans
5ab1d898ca impl-port: improve port properties
Move the port property logic from the adapter to the port itself.

The port was already doing some of the same work as a fallback but can
just as well do everything. This also makes things more unified when
there is no adapter used.
2023-03-02 12:35:11 +01: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
Wim Taymans
164e343dbf remove pipewire/private.h includes when possible
In many places this is not needed.
Expose pw_impl_node_set_param() for adapter.
2023-01-20 16:08:38 +01:00
Wim Taymans
f472fd736d fix includes
Only include debug we need. We usually only need the debug types.
2023-01-18 13:12:16 +01:00
Szabolcs Szőke
bb1f595b53 adapter: support custom prefix for device ports
Prefixes can be disabled for device ports by providing an empty string
2023-01-16 08:25:41 +00:00
Wim Taymans
792defde27 adapter: only add port name override when not empty
This makes it possible to add an empty string to keep the original
port name.
2023-01-13 17:52:24 +01:00
Dmitry Sharshakov
6fb543a514 adapter: support node.channel-names
Allow customizing channel names for nodes
2023-01-06 23:17:33 +03:00
Wim Taymans
6b09a304dc adapter: name control ports as "control" 2022-06-17 15:40:56 +02:00
Wim Taymans
83588daf60 adapter: support control ports in PortConfig 2022-06-17 12:49:33 +02:00
Wim Taymans
daf53b94ed adapter: pass spa_node to adapter
Make it possible to pass a spa_node as the follower of the adapter. This
avoids us having to wrap it in a pw_impl_node in order to unwrap it
again for the adapter spa_node.
2022-05-11 12:28:26 +02:00
Wim Taymans
5a72e2769a adapter: add adapter.auto-port-config property
This automatically configures the node in a supported format with the
highest amount of channels. Options are available to enable monitor
and to override the port channels as AUX or UNKNOWN.
2022-01-20 18:08:30 +01:00
Wim Taymans
aa128ed489 spa: make common function to find type from short name 2022-01-20 18:08:30 +01:00
Wim Taymans
72e748a197 adapter: add node.param.* property support
You can pass some node.param.* properties to the adapter and it will
configure them, so you can do:

    node.param.Props = {
        params = [
            audio.channels 6
        ]
    }

Remove adapter.port-config because it can be done with node.param
2022-01-18 11:55:08 +01:00
Wim Taymans
4dcb4f7526 adapter: add adapter.port-config option
It takes a JSON POD description of the PortConfig parameter and sets it
on the node. This can be used to configure the ports of the adapter node
directly.
2022-01-18 10:38:34 +01:00
Peter Hutterer
32fb369b66 modules: switch more modules to the new property helpers 2021-10-13 07:12:00 +00:00
Peter Hutterer
14112fd168 modules: use the new topic-based logging from various pipewire modules 2021-09-28 09:35:39 +02: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
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
Wim Taymans
d9240bb766 adapter: name monitor ports of applications as "monitor"
See !668
2021-05-17 15:37:31 +02:00
Wim Taymans
78aae9cfdc Revert "adapter: set prefix for all monitor ports to "monitor""
This reverts commit 38a40949ec.

This is not quite right, virtual devices now have monitor ports
instead of capture ports.
2021-05-17 15:32:33 +02:00
Dark
38a40949ec
adapter: set prefix for all monitor ports to "monitor" 2021-05-15 02:25:25 -04: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
Wim Taymans
80a543e043 adapter: improve error message
Make sure we debug the result code that is returned.
2021-02-26 20:45:25 +01:00
Wim Taymans
60233e30a7 jack: tweak names a little
Move the Description in the main node/port name. This then matches
the device names seen in pavucontrol.
Make the port alias contain the node nick.
2021-02-17 11:36:16 +01:00
Wim Taymans
38a7333608 adapter: number unknown ports from 1 instead of 0
This makes it like what jack does.
2021-02-17 10:14:47 +01: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
606d48a3e8 adapter: remove unused defines 2020-12-09 20:32:05 +01:00
Wim Taymans
3c2ab98a2a Add support for virtual source
A virtual source is usually implemented with a null-sink, it looks
like a source to pulseaudio clients but just forwards what it gets
as input.

Make sure the port names make sense.

You can use the null sink now as:

pactl load-module module-null-sink sink_name=source object.linger=1
     media.class=Audio/Source/Virtual channel_map=FL,FR,RL,RR

     This creates a node with "input" and "capture" ports and looks
     like a virtual source for pulseaudio clients.

pactl load-module module-null-sink sink_name=source object.linger=1
     media.class=Audio/Sink channel_map=FL,FR,RL,RR

     This creates a node with "playback" and "monitor" ports and looks
     like a virtual sink for pulseaudio clients.

pactl load-module module-null-sink sink_name=source object.linger=1
     media.class=Audio/Duplex channel_map=FL,FR,RL,RR

     This creates a node with "playback" and "capture" ports and looks
     like a virtual source and sink for pulseaudio clients.
2020-12-02 15:42:56 +01:00
Wim Taymans
53adabea19 adapter: name Duplex port names capture/playback 2020-12-02 13:00:21 +01:00
Wim Taymans
d6127a4745 handle Duplex media class
Audio/Duplex is both a source and a sink. Name the ports as input/output
and make sure we list them in the source and sink lists in pulse-server.
2020-12-02 11:44:19 +01:00
Wim Taymans
f8059be328 adapter: small cleanup 2020-12-02 10:33:30 +01:00
Wim Taymans
1570e62635 remove hooks from objects
Remove the hooks we installed on objects in the destroy/free event
or before calling _destroy. This is not really needed but it is
a nice thing to do because it calls the hook removed callbacks.
2020-11-06 15:53:32 +01:00
Wim Taymans
963b00b77b adapter: return an error when we can't find a format 2020-05-20 15:24:25 +02:00
Wim Taymans
eb93f259e0 avoid some useless assignments 2020-05-20 15:24:25 +02:00
Wim Taymans
cfce048528 adapter: pass error to factory 2020-05-08 16:18:10 +02:00
Wim Taymans
c4b2be2aad use true and false for boolean properties
So that it's easier to convert them to booleans in introspection
code later.
2020-03-03 18:17:46 +01:00
Wim Taymans
a528189d26 slave -> follower
We use master/follower terminology everywhere.
2020-02-21 10:47:32 +01: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
898e870997 pw_node -> pw_impl_node 2019-12-11 12:41:45 +01:00
Wim Taymans
f62d1cb357 pw_port -> pw_impl_port 2019-12-11 12:24:03 +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
5cfb6634f4 port: select a mixer when we set a format
When the port receives a format, look if we can find a mixer for it
and configure it.

Use the float32 mono mixer when possible.

Use the new pw_buffers in the link.

Let the port allocate buffers between the mixer and node when
requested.

The client-node doesn't need a mixer because mixing is done on the
client.

Remove all mixer and buffer negotiation code from adapter because
it is now done at the port level.
2019-10-02 18:07:10 +02:00
Wim Taymans
6e0ffb0c47 flags: change flag macros
SPA_FLAG_CHECK -> SPA_FLAG_IS_SET
SPA_FLAG_UNSET -> SPA_FLAG_CLEAR
Add SPA_FLAG_UPDATE
2019-10-02 18:00:42 +02:00
Wim Taymans
efe3aba608 adapter: put port channel in port name if possible 2019-09-25 10:44:40 +02:00