Commit graph

13743 commits

Author SHA1 Message Date
Pauli Virtanen
584ea400c3 bluez5: fix spelling "Headphone" -> "Headphones"
"Headphone" is usually plural
2025-05-05 07:45:24 +00:00
Pauli Virtanen
270eda63a9 bluez5: different icon for A2DP & HFP output routes
Set different icons for A2DP & HFP output routes, so that they look
different (in Gnome).

Don't call the non-HFP output route as "headset" or "handsfree" in this
case, to be less ambiguous about microphone availability.

Also set device.icon-name for the device too.
2025-05-05 07:45:24 +00:00
Sanchayan Maity
9586ef891e bluez5: Use device set for ASHA
While ASHA does not really use the D-Bus device set interface
but since ASHA has a device-wide HiSyncId and needs to handle
left and right side via a combine sink, use the device set
notion for ASHA as well.
2025-05-05 07:43:34 +00:00
Sanchayan Maity
1b6830f68f bluez5: media-sink: Improvements for ASHA
Clean up as per feedback from Pauli and Barnabás.
2025-05-05 07:43:34 +00:00
Arun Raghavan
b02b69b271 bluez5: media-sink: Drop a redundant ASHA state variable 2025-05-05 07:43:34 +00:00
Arun Raghavan
ce8abfc5cc bluez5: media-sink: Refine ASHA other-side timer setup further
Let's just directly use the next timer value from the other side
directly, and the reference time as well to calculate the expected next
sample position we want to send from on this side.
2025-05-05 07:43:34 +00:00
Arun Raghavan
c5b5476aa4 bluez5: media-sink: Skip samples to align audio data for ASHA
For ASHA, we want the media sinks to send packets where the ASHA packet
sequence number corresponds to time position of audio in that packet.
2025-05-05 07:43:34 +00:00
Arun Raghavan
efb4a1df25 bluez5: media-sink: Snap timer to ASHA connection interval
For ASHA stereo, the timer for flushing packets on both sides of a
pair should be as closed to each other as possible.

Also set seqnum before first flush so other side sends the correct
packets at the start.
2025-05-05 07:43:34 +00:00
Arun Raghavan
4d22296d3a bluez5: media-sink: Use reference time for ASHA sequence numbers
This improves the sequence number generation by tying it to
get_reference_time.
2025-05-05 07:43:34 +00:00
Sanchayan Maity
24843a73c0 bluez5: media-sink: Support for ASHA stereo 2025-05-05 07:43:34 +00:00
Sanchayan Maity
69b5fe8395 bluez5: g722: Do not set sequence number in start_encode
In ASHA, we might need to sync sequence numbers between
left and right side media sink. If the sequence number
is added in start encode, it becomes difficult to set
the sequence number again when a call to reset_buffer
in media sink might have happened already.

This effectively reverts commit ab5f81b9a.
2025-05-05 07:43:34 +00:00
Sanchayan Maity
db47c3e442 bluez5-device: Expose HiSyncId and Side information on ASHA node 2025-05-05 07:43:34 +00:00
Sanchayan Maity
74fe7728d2 bluez5: media-sink: Set up node group for ASHA
ASHA devices with the same HiSyncId should use the same
node group/driver.
2025-05-05 07:43:34 +00:00
Sanchayan Maity
8120493edb bluez5-dbus: Track ASHA HiSyncId & Side information in transport
ASHA devices with the same HiSyncId are a pair and this
will be used later on to set them up together with a
combine sink like device set for BAP. Side information
is required for channel information when setting up the
combine sink.
2025-05-05 07:43:34 +00:00
Frédéric Danis
612cbf5176 bluez5: hfp-hf: Fix HFP HF states
hfp_hf_slc1 is not used so remove it, and rename hfp_hf_slc2 to
hfp_hf_clcc to be consistent with other states.
2025-05-05 07:41:06 +00:00
Frédéric Danis
533c67710e bluez5: backend-native: Fix rfcomm_send_volume_cmd()
This function always returns true. Change to not returning anything.
2025-05-05 07:41:06 +00:00
George Kiagiadakis
8e62b08e58 bluez5: hfp-hf: don't change hf_state after sending AT+BCS
The +BCS event may interrupt any of the initialization commands after
SLC is established and by changing the state here we may lose track
of the initialization sequence.

There is no reason to have the hfp_hf_bcs state anyway. If the
initialization sequence is over, we can remain in the hfp_hf_vgm state.
2025-05-05 07:41:06 +00:00
Stefan Binding
7f07448a80 spa: acp: Allow Volume control which supports mute to be used as a hardware mute
Some devices have a hardware volume control, but not a dedicated
hardware mute control. In some of these cases, the volume control is
described as having a hardware mute when volume is 0. This is described
in the TLV information of the volume control, when the
SNDRV_CTL_TLVD_DB_SCALE_MUTE flag is set in the TLV structure.
If set, alsa-lib will set the minimum dB value to -99999.99dB, which
can be detected inside PipeWire.

PipeWire can then use this hardware volume control to apply hardware
mute, when set.

In order to be able to set volumes and mutes separately, changing the
volume whilst muted will save the value, but not write it to the
hardware. When the device is unmuted, the saved value will be restored.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
2025-05-05 07:40:29 +00:00
Arun Raghavan
21a468a9cd gst: Add H.265 support
Same as H.264 for now, we might eventually want to add more stream
formats etc.
2025-05-05 07:38:25 +00:00
Arun Raghavan
39e079d8ac spa: video: Add H.265 as a format
Quite similar to H.264.

Fixes: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4674
2025-05-05 07:38:25 +00:00
George Kiagiadakis
92643f77f9 bluez5: backend-native: fix sco HUP|ERR debug message
Print the error in td->err (the SO_ERROR) or else let the user know
this is a regular hangup. The previous printout was always reporting
EAGAIN (remainder in errno from the event loop code, I suppose)
as an error, without any real data.
2025-05-02 16:12:23 +03:00
Wim Taymans
2ea8d3430c tools: add c key to reset ERR counters
Reset the ERR counters when pressing the c key. This only makes the
current pw-top start counting from 0 again, it does not change anything
globally on the server. It's still usefull because you can use it to
let it count the number of new errors since the keypress.
2025-04-30 15:10:15 +02:00
Wim Taymans
8d3cb2cd84 filter-graph: clean control_port array on unload
Because we created it when we loaded the graph.
2025-04-30 13:18:34 +02:00
Wim Taymans
aa67998e26 filter-graph: process controls after loading the graph
Do some of the counting of the nodes and controls when we add a node
to make things easier later.

Do the setup of the graph controls after loading the graph because we
know exactly how many controls we will have.

Fixes controls being unavailable until the filter-graph is activated.
2025-04-30 12:21:39 +02:00
Wim Taymans
237c0197c6 filter-chain: add props only once
Only add the properties offset in the builder after we actually got a
property or else we end up with the same property twice.
2025-04-30 12:20:31 +02:00
Wim Taymans
664359a020 netjack2: use strncpy to copy the header
It pads the remaining bytes in the header with 0 bytes so that the
memory doesn't contain uninitialized data.
2025-04-30 11:02:58 +02:00
Wim Taymans
a9083c7519 netjack2: improve shutdown
Destroy the sources from the io handler immediately when there is an
error so that we don't end up in endless error wakeups.

Schedule the free from the main loop and make sure only one can ever
run.
2025-04-30 11:00:42 +02:00
Wim Taymans
743d86500c netjack2: fix trace_fp compilation 2025-04-29 18:36:54 +02:00
Wim Taymans
6e8db1cd4a netjack2: handle connection errors in more cases 2025-04-29 18:09:02 +02:00
Wim Taymans
c7b318523d netjack2: set timeout to sane value again 2025-04-29 17:35:40 +02:00
Wim Taymans
3856d29646 netjack2: implement driver and manager roles correctly
The manager is actually not supposed to decide much about the number of
audio and midi ports. It should just suggest a default when connecting
driver doesn't know.

Add a audio.ports parameters to manager and driver to suggest/ask for
the amount of audio ports. Let the audio.position/audio.channels be a
specification of the channel mask in case it matches the requested
channels, otherwise use AUX channels for the ports.

This means that we must derive the mode (sink/source/audio/midi) from
the ports that are negotiated in the manager and the driver, so delay
this until after negotiation.

Make sure all the possible modes work. For midi only streams, we can't
wait for the session manager to perform a PortConfig so do that
ourselves. Make sure we only use a source trigger when we have a sink.

Fixes #4666
2025-04-29 17:17:14 +02:00
Wim Taymans
18a5f884be netjack2: make function to clear events
Make a separate function to clear events instead of passing NULL as the
midi buffer and segfaulting.
2025-04-29 16:26:30 +02:00
Wim Taymans
78fe234bfe netjack2: copy the node.group to streams
Just in case we want them to be scheduled in the same group.
2025-04-29 09:17:35 +02:00
Wim Taymans
40dbc5f00f netjack2: keep per stream io_position
And handle the trigger failure with a warning and fallback.
2025-04-29 09:16:54 +02:00
Wim Taymans
3d6e77e96d netjack2: warn when the trigger fails 2025-04-29 09:16:01 +02:00
Wim Taymans
07f033c8da netjack2: keep position io per stream
Keep a position info for the stream it was set and then use the position
info for the stream that is driving the graph. Otherwise we might use a
destroyed position info.
2025-04-28 12:23:15 +02:00
Wim Taymans
b6cb76bf8d netjack2: implement ifname in the driver
See #4666
2025-04-28 11:13:33 +02:00
Wim Taymans
93ee66dcab netjack2: Improve docs
Remove unused option.
Clarify that channels and midi port are chosen by the server.

See #4666
2025-04-28 11:12:48 +02:00
Wim Taymans
84c18df626 ebur128: fix port name
Fixes #4667
2025-04-28 09:51:20 +02:00
Wim Taymans
14f48c7a1c acp: probe max 192 channels
Thr 256 channel probe can cause overflows because we use uint8_t for the
channel count in some places.

Fixes #4669
2025-04-28 09:47:43 +02:00
Wim Taymans
7e4dd9524f alsa-seq: add the source only on success
Otherwise if we have an error with the timerfd, we have the source fd
added and we close the device.
2025-04-28 09:47:22 +02:00
Wim Taymans
41665e6bb8 examples: handle I420 and IYUV formats
They are represented in PipeWire with 3 planes now.
2025-04-24 11:18:12 +02:00
Wim Taymans
7d6e2a6417 impl-link: refactor format negotiation
Make a new port_info structure that holds the link port information for
input and output. We can use this in some places and remove some
redundant code.

We can also pass a reference to this port_info as the work-queue
object, which makes it more natural to find the associated port info in
the various work queue callbacks.

Move the private pw_context_find_format to the link implementation,
where is it actually used.

Rework the format negotiation code to use an array of 2 port_info
structures with the two ports to negotiate. The negiotiation will
always use the first port_info as higher priority.

Make sure a driver port has a lower priority than the other port. We want
to negotiate the source/sink to something close that what is
provided/requested by the client. The client can always adapt to the
driver port format fields by giving a "don't care" value for the format
property (either unspecified or with an out of range default value).
2025-04-24 11:17:49 +02:00
Wim Taymans
abfad78fb3 pod: swap inputs for filter when invalid default
We usualy want to prefer the filter default value. When this value is
not within the valid range/alternatives, swap the logic and prefer the
defaults of the other pod.

This way we can have a filter with an invalid default that will then use
the preference of the other pod but still enforce some bounds.
2025-04-24 11:14:51 +02:00
Wim Taymans
8b01fce2bc filter: remove unused function 2025-04-24 11:09:40 +02:00
Wim Taymans
19f6d83fa2 pod: move some filter functions to compare 2025-04-24 11:09:09 +02:00
Wim Taymans
1cca24c585 videoconvert: consume input buffer in all cases
Return the input buffer when we get some error so that the other side
can send new data.
2025-04-24 10:58:04 +02:00
Wim Taymans
bcf0c0cf89 v4l2: only skip buffer for raw formats
We don't want to skip the first buffer for encoded formats because it
can contain the encoding parameters, in the h264 case, for example.
2025-04-24 10:57:49 +02:00
Wim Taymans
d1d580cafa pod: move common check outside of the loop 2025-04-24 10:44:20 +02:00
Wim Taymans
4774178c68 pod: struct has spa_pod as the body 2025-04-24 10:42:20 +02:00