39 Commits
Author SHA1 Message Date
Mike Brady 83ae1d286b Add a new exit handler to enable Shairport Sync to exit cleanly — that is, on exit, to clean up everything, e.g. open files, ports, sockets, devices, threads, it has been using.
If cleanup isn’t finished after one second, exit will occur unconditionally.
Use the new exit handler for normal exit, for SIGINT and SIGTERM handling, for abnormal exit after fatal errors, and for handling quit requests from the D-Bus and MPRIS interfaces.

When an unfixable error occurs without an installed unfixable error handler, unlock the mutex protecting Shairport Sync’s alsa backend to permit a clean exit.

Fix a very low-level mutex-locking error that interfered with debugging.

Simplify much mutex lock handling.
Remove lots of old and unused code, variables and definitions.

Update audio_sndio.c to remove some harmless compiler warnings.

Undo adding two seconds for messages to be output before _Exit() on die() to allow messages to be output...
Undo making die() exit unconditionally.
2026-07-16 14:51:06 +01:00
Mike Brady 11052b7896 Lot of changes here.
1. check_classic_mac_basic.yml — update to latest macOS-latest
2. docker-on-push-tag-or-pr — dependant updates
3. FFTConvolver — fix a compilation warning when the DEBUG flag is turned off
4. Reorganise some source files — e.g. move most of the metadata stuff into a subdirectory
5. Remove unused special-purpose AirPlay 2 RC event handler.
6. Reorganise source files and source code relating to the standard event handler.
7. Check configuration settings a little more carefully to offer more meaningful diagnostics.
8. Add password to AirPlay 2 and reorganise initialisation to set AirPlay 2 flags accordingly.  Also, remove redundant airplay_pin.
9. Remove redundant debug facility definitions from common.h
10. Make it possible to omit all the dacp stuff from a build.
11. Make it possible to omit metadata multicast from a build.
12. Add AP2-native metadata by setting bit 50 of features to true.
13. Improve stability when pre-empting an existing play session.
14. Fix a few compiler warnings in the pair_ap library.
15. Ensure that the audio format is known before starting synchronisation.
16. Improve handle_configure to set/clear a new config setting. Doesn’t seem to do anything…
17. Experimentally turn off bit 46 of AirPlay 2 features — seems to stop failing pair-verify attempts.
2026-04-26 10:23:18 +01:00
Mike Brady fb7de841b7 Silence some currently-irrelevant debug messages. 2026-03-02 19:00:31 +00:00
Mike Brady 0762428929 Handle default dbus message bus properly. 2025-09-29 14:04:33 +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
Mike Brady d67909b837 Add new metadata item: sps:songdatakind, derived from the asdk metadata token. It seems to indicate a timed item (0) or an untimed stream (1). Add output format, output frame rate, stream type (Realtime/Buffered/Classic) properties. Update MQTT appropriately. 2022-11-12 16:42:25 +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 dfd90bac6b Clean up code for the silent lead-in on a non-syncing back end e.g. a pipe. Clean up pipe creation and initial opening and associated error messages. Fix error with warning/die messages. Tidy up some debug messages. 2020-06-05 17:22:53 +01:00
Mike Brady 54d761ff7d Clean up some of the wording and layout of the configuration file
Clean up and improve the way lead-in sillence is used to give a more accurate sync time to the first packet of audio.
Allow very good sync to occur with 0.3 seconds of lead-in silence.
Improve the use of the buffer offset.
Format some other files.
2020-05-18 16:55:09 +01:00
Mike Brady 789ba1ee5e Treat the "mper" attribute as the 64-bit item that it is rather than a 32-bit item as hithereto. Output it as a hexadecimal number to correspond with the format of the track id obtained from AppleScript 2020-02-18 14:09:43 +00:00
Mike Brady 85ba78b619 More fixes to allow gcc-10 to compile without error 2020-02-13 17:57:30 +00:00
Mike Brady 249a6deff9 Bump copyright date. 2020-01-10 17:20:53 +00:00
Mike Brady 1f75fe4e7a Add or update some of the copyright notices 2019-12-27 14:37:01 +00:00
Mike Brady fe8198a23b Add SetAirplayVolume to the D-Bus RemoteControl interface.
Add SetVolume to the MPRIS interface.
Hook up the Volume property in the MPRIS interface.
Modify RemoteCommand in the D-Bus interface to return the HTTP status and response.
Change the type of airplay_volume from int to double in the metadata hub.
Add a few sample commands in the D-Bus document.
2019-12-20 17:17:21 +00:00
Mike Brady 86b6d7bfff Squashed commit of the following:
Fix Issue #890 -- https://github.com/mikebrady/shairport-sync/issues/890
    Recognise situation where a track has no artwork properly.
    Less likely to drop the 'availabile' property.
    Always output the full metadata whenever any part of it has changed.
    Metadata coming from dacp is now incorporated,
2019-08-29 11:47:49 +01:00
Mike Brady c8c70b6016 Add quit commands to the MPRIS and native D-Bus command set. Not tested ecologically. 2018-07-18 15:32:07 +01:00
Mike Brady a4eaace76b Begin to try to get Shairport Sync to quit cleanly, relinquishing memory and ports etc. properly so that valgrind can be more useful. 2018-07-17 10:28:06 +01:00
Mike Brady c2e3fa5aa7 Move ab_mutex, flow control CV and flush mutex initialisation and teardown out of the player thread. Thus remove need for player theread lock. Format some of the surce files. 2018-07-14 13:38:29 +01:00
Mike Brady 08a7d4ffb5 Use snprintf in place of sprintf. 2018-04-08 15:36:05 +01:00
Mike Brady 4aab0a6f92 Improve the scanner to start and stop properly and to release track data when remote control becomes unavailable. 2018-04-07 13:22:38 +01:00
Mike Brady 2cfbeca6ad Update the mpris service provider to deal with the new track metadata information. 2018-04-01 16:31:02 +01:00
Mike Brady cbbe84d8ba Add some more D-Bus facilities. Countermand faulty D-Bus commands. 2018-03-24 17:48:32 +00:00
Mike Brady 47fff82dd2 Getting the volume properties to work without feedback -- not there yet... 2018-03-09 09:25:49 +00:00
Mike Brady 8991f3420c Remove many causes of warnings at the -Wextra level 2018-03-07 20:48:21 +00:00
Mike Brady c36a7822a3 Tidy up using clang-format 2018-03-07 14:35:25 +00:00
Mike Brady 2d2c06a310 Hook up the dacp volume control, if available. 2018-03-04 17:42:53 +00:00
Mike Brady 64d36693d4 Add play/pause/stop MPRIS and quieten some debug messages 2018-02-21 18:30:32 +00:00
Mike Brady f3ef6b5e05 Quieten some debug messages and make others a bit more informative 2018-02-19 20:55:35 +00:00
Mike Brady 3a4e29c5c6 Tidy up dacp scanner -- stop scanning when audio source goes offline. 2018-02-18 16:29:09 +00:00
Mike Brady 352f6d5c97 Refinements to adding cover art. 2018-01-20 19:08:08 +00:00
Mike Brady 6b5a1b39c5 Hook up mpris artwork 2018-01-20 16:53:31 +00:00
Mike Brady ed38d00213 Add a little extra info to mpris d-bus bus acquisition. 2018-01-17 10:06:39 +00:00
Mike Brady 6ef554d39c Quieten a debug message. 2018-01-02 11:20:03 +00:00
Mike Brady aaee366fb7 Add metadata to MPRIS output -- not complete. 2018-01-01 23:04:18 +00:00
Mike Brady 1637a79dd6 Add tinyhttp code for sending and reading responses. Clean up some dacp routines. Most new and modified rooutines untested. 2017-12-18 18:50:01 +00:00
Mike Brady 03321799fb Add previous and next controls 2017-11-20 13:16:17 +00:00
Mike Brady bafdd94e33 Clang-format 2017-11-19 21:41:11 +00:00
Mike Brady b98e2a0854 Handle play / pause / play-pause / stop but primitively 2017-11-19 21:40:09 +00:00
Mike Brady df7c48f0f3 Clean up naming of some files, get the 'stop' command working 2017-11-19 21:16:36 +00:00