Commit Graph
267 Commits
Author SHA1 Message Date
lululombard bd9008e4f7 Add MQTT retain flag support 2026-02-08 12:43:53 +01:00
Mike Brady 07b60e7112 1. Add the ability to work back through queued buffers to find the first buffer that’s older than the given one. This is to enable the replacement of deciphered buffers with buffers that arrive later but are timed earlier.
Added functions that relate to this are: get_revised_seqno() to wind back through the queued buffers and clear_buffers_from() to free buffers that are already occupied.
2. Clean up get_audio_buffer_size_and_occupancy() and replace it with get_audio_buffer_occupancy().
3. Add a new general setting: audio_decoded_buffer_desired_length_in_seconds for managing the size of the player buffer queue when the source is buffered audio. Default is 0.75 seconds so that we can step back up to that time if older buffers appear.
2025-12-14 10:17:38 +00:00
Mike Brady 54445ee8f5 Separate out the debug facilities into their own files. Clean up and add a few associated methods. 2025-11-27 12:37:16 +00:00
Mike Brady d043f98330 Update the convolution code:
(1) to be multithreaded,
    (2) to work on multichannel audio and
    (3) to work on 48k and 44.1k audio.

    Allow multiple impulse response (IR) files with a new setting: "convolution_ir_files"
    When convolution starts, Shairport Sync will look for an IR file with a sample rate
    matching the input (44.1k or 48k) and channel count.
    If one can't be found, it will look for a single-channel IR file with the same rate.
    It will always choose the first match in the file list supplied "convolution_ir_files".

    Allow multithreading -- use the "convolution_thread_pool_size" to set the number of threads to use.

    Deprecate "convolution" -- use "convolution_enabled" instead.
    Deprecate "convolution_max_length" -- use "convolution_max_length_in_seconds" instead.
    Deprecate "convolution_ir_file" -- use "convolution_ir_files" instead.
    Update corresponding D-Bus methods and properties.

Update the loudness code to work on 48k and well as 44.1k audio and with multichannel audio.

    Deprecate "loudness" -- use "loudness_enabled" instead.
    Update corresponding D-Bus methods and properties.

Fix a deprecated FFmpeg warning.

Update HiFi-LoFi FFT convolver to latest available.
2025-10-13 13:26:20 +01:00
Mike Brady 07215e5f11 Add a default to the dbus message bus enum. Add a dbus_default_message_bus to the config. It is used as the default dbus message bus for dbus and mpris. 2025-09-29 13:56:32 +01:00
Mike Brady e05448aecc Check for configuration strings that are given but turn out to be empty, issue a warning and ignore them. 2025-04-14 10:40:26 +01:00
Mike Brady 60143518c2 This squashed commit comprises a long series of improvements, bug fixes, optimizations, and new feature additions:
- 48,000 frames per second operation,
 - 48k lossless stereo, 5.1 and 7.1 surround sound
 - Multichannel and multi rate operation on ALSA, PipeWire, PulseAudio, FreeBSD, stdout and unix pipe output backends.

Automatic, flexible and controllable output format (rate, sample format and channel count) selection.

Full FFmpeg integration to support transcoding, resampling, and new audio formats.

Better operation on lower powered devices down to e.g. Raspberry Pi B.

Reduced Docker image sizes with a slimmed-down FFmpeg library.

Enhanced timestamp handling for better synchronization.

Improved the sync error calculation.

A new "vernier" resampling and interpolation method for low-power CPUs.

Bug fixes and minor enhancements.

Note -- there are many breaking changes from previous versions of Shairport Sync!
2025-02-23 13:31:17 +00:00
aaronk6 cda315b6aa Add support for MQTT autodiscovery 2024-09-24 20:32:08 +02:00
Mike Brady 10b965a7aa add a diagnostic function debug_print_buffer, which might be useful in the future. 2024-07-18 15:26:55 +01:00
Mike Brady 98679bbb54 Add PipeWire sink target setting. Fix PipeWire node name code, duh, remove code that was double-deallocating settings strings. 2023-10-06 10:51:49 +01:00
Mike Brady 3763b321b8 Add two PipeWire backend ("pw") settings -- application_name (default: "Shairport Sync") and node_name (default: "shairport-sync"). 2023-10-05 09:41:21 +01:00
Mike Brady 60cee967dc Add a pthread_cleanup compatible function to release a pthread_rwlock. 2023-09-21 15:50:43 +01:00
Mike Brady b7d9c22de9 format adjustments 2023-09-11 16:01:38 +01:00
Mike Brady 8821ec2861 Update some slightly outdated comments in common.h and shairport-sync.conf 2023-07-23 13:18:52 +02:00
dasl- 1a55537790 fix typo 2023-07-13 21:49:29 -04:00
dasl- ebe1ca17f2 rename to dasl_tapered 2023-07-13 21:43:25 -04:00
dasl- baf51cf2a7 Add logarithmic volume_control_profile mode 2023-07-02 09:27:53 -04:00
Mike Brady 8201903a4e Add code to try to save your ears by handling a situation where the player volume was set very high some time ago and you have forgotten.
In that situation currenctly, when you play something, it will come out at the last volume set on the device, which will be that very high volume.
This could happen, for example, the morning after a loud party :).

The new code works as follows: If nothing has been played for a period, say a few hours, and the volume is higher than a threshold, new connections that ask
for the current volume setting will be offered the default (low) volume rather than the current (very high) one.
Most players, including the HomePod mini, iOS and iPadOS use this to set their initial volume.
The Mac Music app retains its own setting, and the Mac System Sounds preference sometimes seems to take its setting from the Music app,
but at least you can see the settings they will apply.

Existing connections are unaffected, so this facility should be unobtrusive.
2023-01-18 10:41:50 +00:00
Mike Brady d2ca8c84a4 Clang format 2023-01-14 12:53:20 +00:00
Mike Brady 28f54af281 Add a new setting: resync_recovery_time to give the systems a little time to restart.
Clean up the tolerance and resync threshold times.
2023-01-14 12:48:18 +00:00
Mike Brady d6536a8e79 Call the unfixable error if the output device can't be opened or disappears. Clang-format. 2022-12-30 18:36:33 +00:00
Mike Brady 7c1a5fd0ba Add ability to send frame/time updates at intervals as metadata. 2022-11-26 15:56:25 +00:00
Mike Brady 03d291f464 Second attempt. Modify the generation of the 12-digit classic AirPlay service name prefix so that it depends on the service name as well as the hardware address. 2022-11-17 10:31:51 +00:00
Mike Brady f775267d02 Remove the useless main_thread_id and fix the MPRIS quit handler. 2022-10-11 09:45:47 +01:00
Mike Brady fd880056fb Squashed commit of the following:
Add three parameters to the backend play() function call -- (1) a flag indicating whether the samples are timed or not. If timed, (2) the timestamp and (3) the local time at which the first frame should be heard.
    Update missing pipewire library message.
    Makefile.am fix.
    Update the SHM version and fix the SHM name so that it works with FreeBSD.
    Remove redundant (?) AC_HEADER_STDC check.
    Fix compilation and installation under FreeBSD -- changes to allow building in a separate directory broke the FreeBSD build process.
    Add AC_CHECK_LIB for gcrypt in case PKG_CHECK_MODULES fails to find it.
    Find gcrypt using pkg-config
    Add code to detect when the RTSP channel goes idle for a period, and use it to reset clocks and timings, etc. so that SPS resumes correctly where the source has gone to sleep while playing a realtime stream and has subsequently woken up.
    Don't exit if a UDP Clock Control packet is empty. Also check minimum packet size.
    Remove some very experimental code which may cause memory and port leaks.
    Strip file path from the filename used in debug messages, information messages, warnings and fatal error messages.
    BB fix to Makefile.am -- overwriting the DBUS stuff with MPRIS definitions, duh.
    Fix some problems building on FreeBSD and tidy up the use of the "sed" editor.
    Fix some problems building on picore.
    Fix an uninitialised variable
    start using the "nqptp" SMI
2022-09-12 15:19:52 +01:00
Mike Brady 4963c65a0e Fix the D-Bus quit method so that it works, duh. 2022-08-07 11:15:54 +01:00
Mike Brady 2dc6af2daf Partially clean up some mutex diagnostic stuff. 2022-05-18 19:37:18 +01:00
Mike Brady 3d720d65bf MQTT -- add code to deal with empty payloads by adding a dummy payload to empty messages by default. 2022-02-07 12:36:08 +00:00
Mike Brady 966d68bdec Begin to get SPS to give a unique shm interface name to nqptp. Also clang format 2021-12-27 12:19:01 +00:00
Mike Brady 035f41bdb4 Make the hw_addr 8 bytes long to that it can be read from as a 64-bit number. 2021-12-23 19:15:17 +00:00
Mike Brady 56bef8e7dd Use CLOCK_MONOLITHIC_RAW to avoid NTP effects, report raw and corrected timing from audio_alsa. Clean up statistics. Stop watchdog timing out AP2 sessions. CLean up some debug messages. 2021-11-28 16:08:48 +00:00
Mike Brady 04240708a9 Try using the monotonic clock for checking output rate... 2021-11-08 10:14:42 +00:00
Mike Brady d703314c06 Move group ID store to the conn. Fix the size of the groupContainsGroupLeader plist boolean store. 2021-09-01 10:28:30 +01:00
Mike Brady e098342185 remove a misleading obsolete comment. 2021-07-28 12:56:55 +01:00
Mike Brady a109b587ec Flush seems to be working properly and reliably. Some audio glitches removed too by dropping the first two AAC blocks of any passage. Crude. Flush diagnostic linked list stuff left in place. 2021-05-30 11:17:06 +01:00
Mike Brady e1034e1131 Advertise the _raop._tcp service as well as the _airplay._tcp service. Use a real MAC as the basis for the device ID. 2021-05-24 12:07:05 +01:00
Mike Brady e8e81a8b07 fix a couple of compilation errors. 2021-05-12 10:57:50 +01:00
Mike Brady 7ae72d795f add plist cleanup for pthread cleanup 2021-05-10 09:01:25 +01:00
ejurgensen f5cd4238f0 Announce the actual public key (pk) in Bonjour and GET /info
Same as other Airplay 2 devices do, even though it doesn't seem to be used
by any clients.
2021-05-07 19:26:48 +02:00
ejurgensen ba73111a6f Support for pair-verify 2021-05-04 20:38:35 +02:00
Mike Brady 796b7da07c Bringing across the extra AP2 components of common.h and common.c 2021-04-30 10:44:43 +01:00
Mike Brady 8a73d5972c rtp meged with lots of AP2 stuff still commented out. But it still works. 2021-04-29 15:04:50 +01:00
Mike Brady ca56287254 Make the first output backend in the list of backends the default and make its name the default output_name. Clang-format everything 2020-09-03 09:53:13 +01:00
Mike Brady 05beeaab22 Use exit() instead of abort() when a fatal error occurs, but skip the cleanup before exit, as this can cause trouble. 2020-06-22 10:16:37 +01:00
Mike Brady f5eceff6f7 Store clock drift information for each client based on its IP. This is stored in RAM, not on disk. Used at the start of a new session until new clock drift data is ready. 2020-06-11 12:09:55 +01:00
Mike Brady 5decc1bb06 Make the pipe, hub and mqtt separate threads with their own metadata queues. If one blocks, no new metadata is sent to it and the others are unaffected. 2020-05-30 15:49:00 +01:00
Mike Brady c0e5d0473e Add the ability to direct logs etc. to a file or pipe. 2020-05-28 12:19:59 +01:00
Mike Brady 6406c296f5 Add setting to direct logs to syslog, STDERR or STDOUT 2020-05-27 16:21:35 +01:00
Mike Brady 9e34b1334b Stop using home-brew non-blocking write. Instead, having opened the pipe non-blocking, change to blocking. 2020-05-27 15:02:49 +01:00
Mike Brady e8ef0e9371 rewrite the non_blocking_write to not use poll() and to return immediately if there is no reader at the end of the pipe. 2020-05-25 12:48:39 +01:00