Commit graph

54 commits

Author SHA1 Message Date
Wim Taymans
399ff82ab2 adapter: always negotiate from convert to follower
Make the converter format a higher priority in all cases. The converter
has been negotiated first and is able to make a better suggestion for
the ideal format in all cases.
2025-05-05 10:33:07 +02:00
Wim Taymans
14eb03a821 videoconvert: Enumerate follower params better
Make sure we increment the next counter even when we are in passthrough
mode or the property is not readable.
2025-05-05 10:31:37 +02:00
Wim Taymans
5c547d58d1 adapter: handle builder overflow 2025-04-02 10:39:34 +02:00
Wim Taymans
da69bddb95 adapter: Improve convert setup
Always do configure_convert, even when the passthrough state didn't
change, for example when going from none to convert.
2025-04-01 16:31:25 +02:00
Wim Taymans
1adc9e5445 videoadapter: init the builder for each param
Or else we keep on adding items until we overflow.
2025-04-01 16:24:40 +02:00
Wim Taymans
dba31d7e2a videoadapter: use the supported dataType in Buffer param
Get the dataType field from the Buffer param. This is a mask of the
supported data types for the buffers. Pass this to the allocating node
if there is one, otherwise use MemPtr as the allocated format.
2025-03-28 16:04:54 +01:00
Wim Taymans
abc03ec810 adapter: fix buffer alloc order
Prefer to let the follower allocate buffers. If we are allocating
buffers, first do use_buffers on the allocating node or else the
non-allocating node just ends up with NULL buffers.
2025-03-27 09:29:52 +01:00
Wim Taymans
2873d7a6cc adapter: add Header metadata by default
Firefox needs this but we should eventually check the Meta Params to
decide on this.
2025-03-26 17:52:26 +01:00
Wim Taymans
beb075c5a6 adapter: only use DYNAMIC buffer data when supported 2025-03-26 09:51:09 +01:00
Wim Taymans
6015fa353a adapter: call reconfigure_mode instead of configure_convert
configure_convert does not set up the current mode, so call the more
complete reconfigure_mode to set the initial converter mode.
2025-03-26 09:43:58 +01:00
Wim Taymans
4ddb17c4b5 videoconvert: don't load the dummy converter
Just don't load any converter at all, the dummy converter has some
issues.
2025-03-25 15:14:03 +01:00
Arun Raghavan
14b7b31bd9 videoadapter: Use dummy converter by default
The ffmpeg converter doesn't quite work yet for planar formats at least,
so let's leave the dummy as the default till that works.
2025-03-25 08:26:29 -04:00
Wim Taymans
824354f38e videoadapter: sync with audioadapter 2025-03-24 11:45:11 +01:00
Michael Tretter
0814bafef1 videoadapter: fix EnumPortConfig for adapter without converter
The videoadapter always exposes the EnumPortConfig parameter. If no
converter is loaded, the EnumPortConfig parameter doesn't return a
parameter.

In this case, the client-node in the PipeWire server returns -ENOENT for
the EnumPortConfig, which in turn causes WirePlumber to fail the object
activation and it won't be able to create a link for the object.

This happens since Commit b57375ba85 ("stream: enable videoadapter in
all cases"), since now the videoadapter is always added. Before that,
the EnumPortConfig parameter was just not exposed and linking worked.

Running another client that ignores the error codes for missing
parameters (e.g., pw-dump) hides the issue, as the EnumPortConfig result
is cached as successful with 0 parameters and accessing the cache
doesn't return an error code.

Return the same PortConfig for EnumPortConfig as for PortConfig to fix
this.
2025-01-28 11:38:08 +00:00
Wim Taymans
8cd3fc6922 adapter: increase max-retry to 64
When the follower doesn't produce enough data for this many attempts,
bail and cause an xrun to avoid an infinite loop.

The limit of 8 cause real-life problems and should be larger. It should
probably depend on the expected size per cycle (node.latency) and the
current quantum but we don't always have this information.

See #4334
2024-10-07 09:28:39 +02:00
Wim Taymans
563186eff6 adapter: also forward the RequestProcess events 2024-09-16 17:01:50 +02:00
Wim Taymans
2762b8d98f videoadapter: sync with audioadapter 2024-09-06 17:35:34 +02:00
Wim Taymans
4d2cdd6da3 audioadapter: dynamically load the audio converter
So that we can plug in other implementations. Also handle the cases
where we can't load a converter.
2024-09-06 17:30:58 +02:00
Wim Taymans
9fb14be4e3 adapter: improve format parsing some more 2024-09-06 15:06:31 +02:00
Wim Taymans
7b30e515be videoadapter: sync with audio adapter
Try to passthrough the converter format to the follower when we can
before negotiating a conversion.

Try to convert between all follower formats instead of just the first
one.

When enumerating the port params, first enum the follower formats and
then the conversion formats.
2024-09-06 12:17:36 +02:00
columbarius
4d33ccf89a videoconvert: Start dummy plugin in passthrough mode
Since the dummy plugin can't process buffers, we should configure the
adapter to use passthrough mode  for now, instead of requiering the user
to do it manually.
2024-08-29 14:00:51 +00:00
columbarius
7d97e47e28 videoconvert: Enable loading external converter plugins
Load the converter from the video.adapt.converter property.
2024-01-22 13:59:16 +00:00
columbarius
d6c1b6470a videoconvert: apply changes from audioadapter
Update the videoadapter to the structure of the audioadapter.
2024-01-22 13:59:16 +00:00
Pauli Virtanen
eaea03c26c spa: export log topic enumerations 2024-01-04 10:02:55 +00:00
Barnabás Pőcze
8256a2d5a6 spa: remove unnecessary indirection for some spa_log_topics
This results in shorter machine code since it removes one
pointer load and a NULL check.
2023-10-06 13:08:24 +00: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
6207d98ff1 spa: add debug log context
Make a real debug context with a log function and move it to a new file.
This way we don't need to redefine a macro.
Make a new context for debugging to a log file. Make new functions to
debug to a log file.
Move the stringbuffer to string utils.
Integrate file/line/func and topics into the debug log.
We can remove some more things from the pipewire log_object function and
also add support for topics.
2023-01-18 17:51:16 +01:00
Wim Taymans
3c67821c4a spa: add context to debug functions
Add new spa_debugc_ funnctions that take a context. The user should also
redefine the spa_debugc macro to handle the context.

Use this to let some plugins log the pod and format to the log without
using the global logger.

Also use this to remove our custom pod logger function by reusing the
spa one with a custom context.
2023-01-18 13:12:16 +01:00
Wim Taymans
5e58e03da7 spa: redirect adapter log to logfile
Fixes #2923
2023-01-18 13:12:16 +01:00
Wim Taymans
85ffe68ea3 Revert "adapter: removed unused follower_current_format"
This reverts commit 6c963ed933.

This code was meant to set a filter on the format for the follower
but is not implemented yet.

Problem is that the unit tests and wireplumber call this code and would
need to be patched.
2022-11-09 16:24:49 +01:00
Wim Taymans
6c963ed933 adapter: removed unused follower_current_format 2022-11-09 16:03:18 +01:00
Wim Taymans
44d743ed95 spa: make all format parsing fields optional
Just like the optional build, make all field parsing optional. This
will leave the fields with their default values if they are not parsed
from the param.

We can then remove our custom functions and use the generic ones in
various places.
2022-11-03 13:13:07 +01:00
Wim Taymans
74447acedb Add some more format checks
The format parse functions don't really check if the parsed values
make any sense so we need to to this ourselves.
2022-11-03 13:10:32 +01:00
Wim Taymans
2d858e0ba2 spa: a Flush command does not stop processing
A flush command is not supposed to stop playback but just clear the
current state. Normally, to avoid complications, an application will
Pause, Flush and optionally Start to do things smoothly without
interfering with the process loop, but things should not crash if that's
not the case.

Fixes #2726
2022-09-26 11:10:02 +02:00
Wim Taymans
ffc09ce55e videoconvert: refresh with latest audioadapter copy 2022-09-06 17:48:00 +02:00
Wim Taymans
35cbe4e939 buffers: make alignment optional
Make the alignment parameter optional when negotiating buffers.
Default to a 16 bytes alignment and adjust for the max cpu
alignment.
Remove the useless align buffer parameter in plugins, we always
set it to 16 anyway.
2022-01-03 12:32:26 +01: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
cdfd50e166 spa: add spa_atob() to convert a string to a boolean
This replaces the manual check for "true" and some (inconsistent) return value
of atoi. All those instances now require either "true" or "1" to parse as
true, any other value (including NULL) is boolean false.
2021-05-18 22:18:56 +10: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
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
Andrea Gelmini
85b136d8ce Fix typos
Signed-off-by: Andrea Gelmini <andrea.gelmini@gelma.net>
2021-04-30 16:27:34 +00:00
Wim Taymans
e71936f870 Improve naming
master -> driving
priority_master -> priority_driver
segment_master -> segment_owner
2020-08-06 13:49:33 +02:00
Wim Taymans
acccccd2c0 Use SPA_IO_BUFFERS_INIT when we can
We should not have to initialize the state to NEED_DATA, anything
that is not HAVE_DATA is good. Also we need to set the buffer to
INVALID because else it might be recycled.
2020-03-19 13:09:21 +01: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
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
feb8dd3a34 Add include of keys.h 2019-11-21 09:34:08 +01:00
Wim Taymans
9ffec214b8 fix includes 2019-10-25 15:01:02 +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
8b85cc225e rename HAVE/NEED_BUFFER -> HAVE/NEED_DATA
It is more generic and works with control-only ports as well
2019-09-16 12:55:23 +02:00