Commit graph

4003 commits

Author SHA1 Message Date
Wim Taymans
722776cf65 Remove some hardcoded channel number values
Mostly related to the number of channels.
2025-04-04 15:46:03 +02:00
Wim Taymans
5c547d58d1 adapter: handle builder overflow 2025-04-02 10:39:34 +02:00
Wim Taymans
774f9cbb80 videconvert: fix compilation on 32 bits 2025-04-02 10:15:37 +02:00
Wim Taymans
bf952a6e4b videoconvert: improve setup of DSP mode
Parse and use DSP formats.

Redo the conversion setup when the formats changed. We usually do this
when starting the node but the formats can change while running as well.
2025-04-01 16:35:32 +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
5c5075f4d6 videoconvert-ffmpeg: copy complete passthrough buffer data
We also need to copy the data type, flags and sizes.
2025-03-28 16:10:42 +01:00
Wim Taymans
b23161d772 videoconvert: always put frame size on Format param
We can now set the 0x0 frame size as the default as a wildcard.
2025-03-28 16:09:36 +01:00
Wim Taymans
5f4c0cdd1e improve debug and error reporting a little 2025-03-28 16:08:57 +01:00
Wim Taymans
ae1bbc93d8 videoconvert: return error on invalid formats 2025-03-28 16:08:19 +01: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
d0c4b491da v4l2: handle nearest set_format
The set_format function can return 1 when the format was adjusted to the
nearest supported format so return this from the port_set_param
function.

This instructs the adapter to recheck the configured format so that it
can store the adjuted format on the converter.
2025-03-28 16:00:51 +01:00
Wim Taymans
b501290bd5 audioconvert: support DYNAMIC data again
Because we advertize on out ports that we support DYNAMIC data, we need
to read the data pointer directly from the buffer and only fall back to
our cache (mmaped) pointer when it is NULL.

With DYNAMIC data, the peer element (mixer-dsp) directly copies the
input data pointer into the buffer data in the processing loop in order
to avoid a memcpy when there is no mixing needed.
2025-03-27 17:00:11 +01:00
Wim Taymans
328718f958 audioconvert: add support for buffer data mmap
When there is no data and the buffer is mmapable, try to mmap it. Unmap
again when clearing the buffers.

Use the mmaped data pointer of the buffer when processing.
2025-03-27 15:37:19 +01:00
Wim Taymans
9ceb4310f8 videoconvert: unmap buffer memory as well
Set a flag when we mmaped the buffer memory so that we can unmap it
again when clearing the buffers.
2025-03-27 15:21:12 +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
479ba33685 videoconvert-ffmpeg: support transcoding
When the input and output is an encoded format but the dimensions are
different, do a decode, scale and encode.
2025-03-26 17:52:26 +01:00
Wim Taymans
f8dcf32c8d videoconvert-ffmpeg: fix passthrough mode
Keep the passthrough flag up to date when we unset a port format or when
it changes.

We should only fill in the buffer data/fd when the ALLOC flag is set.

We should only take the passthrough input buffer as output when we are
in passthrough mode.

Copy the header metadata.
2025-03-26 17:52:26 +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
241ec04d88 videoconvert: support planar formats
Keep track of the per-place strides and sizes and use that to fill the
output buffer.
2025-03-26 12:29:26 +01:00
Wim Taymans
ea7cfb9e94 audioconvert: make sure the converter is in None mode
The audioconverter starts in Convert mode, so make sure it goes to the
None mode before we attempt to reconfigure ourselves.

Also remove the ports on audioconvert when going to None mode. This used
to somewhat work because we configured it in DSP mode without any
params, which is like None without ports.
2025-03-26 10:26:41 +01:00
Wim Taymans
636e123fdd videoconvert-ffmpeg: set better size suggestion
Use a better suggestion for the buffer size.
2025-03-26 09:54:12 +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
1515e46d50 ffmeg: fix default number of buffers
Make the MAX buffers different from the min and make sure the default
value is between min and max.
2025-03-25 16:19:50 +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
367e756ebe videoconvert-ffmpeg: remove debug 2025-03-24 11:45:29 +01:00
Wim Taymans
824354f38e videoadapter: sync with audioadapter 2025-03-24 11:45:11 +01:00
Wim Taymans
7e67daa292 audioadapter: negotiate formats from output to input
Try to avoid conversions by taking the output port format and using that
as a filter for the input port format.

Because filtering pods prefer the values of the filter, this will prefer
the output format values and thus avoid conversions.
2025-03-24 11:39:20 +01:00
Wim Taymans
de54cfc475 audioconvert: improve tmp buffer allocation
Use per port allocated memory so that we can easily increase the size
and add more buffers. This is necessary when we add filter-graphs that
require more ports.
2025-03-21 15:18:54 +01:00
Pauli Virtanen
6fe1c6d67b alsa: seq: double-check midi client version
Check midi client version after setting it, to see if it was really
successfully set.  Old kernels without UMP don't know about the midi
version fields, so snd_seq_set_client_midi_version() appears to fail
silently there.
2025-03-20 21:39:40 +02:00
Pauli Virtanen
e0938303e6 acp: Sennheiser GSX stereo profile
The card can output at higher sample rates in stereo profile, so add
that.
2025-03-20 12:24:56 +00:00
Wim Taymans
923b8b48ec alsa-seq; enable UMP again when we can
It got accidentally disabled for debugging
2025-03-20 12:55:09 +01:00
Wim Taymans
4e0545aa04 videoconvert: get the correct strides
Use ffmpeg to get the right stride for the negotiated format instead of
using a wrong hardcoded value.
2025-03-20 10:57:26 +01:00
Wim Taymans
bcde5cbd8a audioconvert: rework the filter-graphs a little
Use a simple free/active linked list for the filter-graphs and insert
the new filters in the right position in the list. Then simply copy the
list to an array for the processing thread.

when reconfiguring, set up all the filters again because the number of
channels might have changed.
2025-03-19 17:53:05 +01:00
Wim Taymans
de2ab7cac9 filter-graph: add support for channel positions
Make it possible to define a channel position in filter-graph.
Use the channel positions to perform the final channelmix.
2025-03-19 17:53:05 +01:00
Wim Taymans
33584dae1d ump: handle sysex from UMP to MIDI1 better
SysEx in UMP can span multiple packets. In MIDI1 we can't split them up
into multiple events so we need to collect the complete sysex and then
write out the event.

Fixes SysEx writes to ALSA seq by running the event encoder until a
valid packet is completed.

Also fixes split MIDI1 packets in the JACK API when going through the
tunnel or via netjack.
2025-03-19 17:53:05 +01:00
Wim Taymans
4e421e0012 audioadapter: return error code from set_param 2025-03-14 13:26:21 +01:00
Wim Taymans
f1ed12fc8d audioconvert: PortConfig only needs channels and position 2025-03-14 13:25:45 +01:00
Wim Taymans
f0e09ae363 filter-graph: make the filter-graph ports dynamic
When parsing the graph, parse the input and output port names into
a separate string array. This was we can keep them around when
setting up the graph.

Instead of setting up the graph right after loading it, do the graph
setup when we activate the graph. This makes it possible to pass the
input channels to the filter-graph and let it create the right amount of
plugins and ouput channels.

When setting up the graphs in the audioconverter, pass the current
number of channels as the input to the graph and keep track of the
channels that each filter produces.

This way we can also load a custom upmix or downmix graph, for example.
2025-03-14 10:10:18 +01:00
Wim Taymans
76619eaa1d audioconvert: fix the filter-graph samplerate
The filter graph runs before or after the resampler depending on the
direction of the conversion.
2025-03-14 10:03:44 +01:00
Pauli Virtanen
bd3a8b594f spa: acp: indicate ALSA UCM profile errors in UIs
Add "[ALSA UCM error]" to the end of card description, to indicate
something is wrong.
2025-03-13 21:25:55 +00:00
Pauli Virtanen
4338189f76 spa: acp: allow also too few channels in SplitPCM configs
GoXLR Mini has different numbers of channels actually available (21, 23,
or 25) depending on its firmware/etc, but its UCM profile specifies
always 23. The count can then be bigger or smaller than what is actually
available.

Fail a bit more gracefully in the case of too few channels: create all
the split devices specified by the profile. The channels that aren't
actually available in HW just won't get routed anywhere.

ALSA upstream IIUC is saying that the channel counts should be fixed, so
spew warnings that say the UCM profiles are wrong if they look wrong.
2025-03-13 21:25:55 +00:00
Frédéric Danis
1af1fc846c bluez5: backend-native: Add volume support to HFP HF
The volume synchronization could be done even if there's no audio link
and so no transport opened.

This patch allows to send the Speaker (AT+VGS) and Microphone (AT+VGM)
commands at the end of the SLC. And to exchange volume updates using the
telephony DBus interface, even without a transport.
2025-03-12 11:01:50 +01:00
Wim Taymans
bf3c7aa6e1 alsa-seq: fix UMP output
We need to set the UMP flag, which is done with
snd_seq_ev_set_ump_data() to make it output the midi data.
2025-03-11 13:29:38 +01:00
Wim Taymans
ff08c28b62 alsa-seq: avoid uninitialized warning 2025-03-11 12:33:08 +01:00
Wim Taymans
badd8691bd audioconvert: remove some unused fields 2025-03-11 11:52:52 +01:00
Wim Taymans
d43fb09ea1 audioconvert: configure resample channels correctly
Depending on the direction of the conversion, we run the resampler
before or after the channelmix. This means we need to use the channel
count before or after the channelmixer instead of always using the
channels after channelmixing.

Fixes #4595
2025-03-11 11:50:48 +01:00
Pauli Virtanen
a503244c10 spa: avoid casting between snd_seq_event_t & snd_seq_ump_event_t
Although the two structs have same initial sequence, it's not really
correct to cast between their pointers. Alsa-lib also does this only
internally, but not in API.
2025-03-10 18:12:54 +00:00