1
0
Fork 0
mirror of https://github.com/librespot-org/librespot.git synced 2025-10-03 01:39:28 +02:00
Commit graph

2094 commits

Author SHA1 Message Date
Roderick van Domburg
f59766af7e
perf(playback): optimize audio conversion with 16-bit dithering and bit shifts
Since Spotify audio is always 16-bit depth, optimize the conversion pipeline:
- Always dither at 16-bit level regardless of output format
- Preserve fractional precision until final rounding for better requantization
- Replace floating-point multiplication with compile-time bit shifts
- Add comprehensive inlining to eliminate function call overhead
- Specialize 24-bit clamping to remove runtime branching

This maintains proper dithering of the original 16-bit quantization artifacts
while maximizing performance through bit-shift operations and eliminating
unnecessary runtime calculations.
2025-08-14 00:31:59 +02:00
Roderick van Domburg
218eced556
style: format with style edition 2024 2025-08-13 23:09:59 +02:00
Roderick van Domburg
056d125cb2
refactor: move from native to webpki certs on all platforms 2025-08-13 19:05:52 +02:00
Roderick van Domburg
416bf00888
feat: improve Gaussian dither 2025-08-13 18:40:00 +02:00
Roderick van Domburg
fe7ca0d700
refactor: move from aws-lc to ring 2025-08-13 18:34:40 +02:00
Roderick van Domburg
c4766ceb99
fix: downgrade sysinfo for MSRV constraints 2025-08-13 17:22:37 +02:00
Roderick van Domburg
445f8b10a2
refactor: clean up Rodio fallback handling 2025-08-13 17:11:43 +02:00
Roderick van Domburg
648c9e30ea
ci: bump MSRV to 1.85 and update actions 2025-08-13 17:06:14 +02:00
Roderick van Domburg
1dcd041070
fix: install default crypto provider 2025-08-13 16:44:22 +02:00
Roderick van Domburg
6288e7e03c
refactor: update to Rust 1.85 and edition 2024, use inline log args
- Update MSRV to 1.85 and Rust edition to 2024.
- Refactor all logging macros to use inline argument formatting.
- Fix import order in main.rs and examples.
- Add async environment variable setter to main.rs as safe facade.
2025-08-13 16:19:39 +02:00
Roderick van Domburg
0aec38b07a
refactor: use Rust 2021 format strings for error and debug messages 2025-08-13 15:44:58 +02:00
Roderick van Domburg
fdd4a16fdc
feat: fallback to S16 format if unsupported in Rodio backend 2025-08-13 13:27:16 +02:00
Roderick van Domburg
ce1ab8ff3f
refactor: update dependencies and code for latest ecosystem changes
- Update many dependencies to latest versions across all crates
- Switch from `once_cell::OnceCell` to `std::sync::OnceLock` where appropriate
- Update OAuth to use stateful `reqwest` for HTTP requests
- Fix Rodio backend to honor the requested sample format
2025-08-13 13:19:48 +02:00
Roderick van Domburg
1d5c0d8451
docs: correct changelog entry for stream_from_cdn 2025-08-13 13:18:53 +02:00
Timon de Groot
ba3d501b08
spclient: Specify base url for metadata requests (#1528)
Fixes #1527
2025-08-11 13:31:36 +02:00
./lemon.sh
3a700f0020
fix: add fallback logic for CDN urls (#1524) 2025-08-08 16:32:20 +02:00
Felix Prillwitz
be37402421
Expose possible mixer opening errors (#1488)
* playback: handle errors when opening mixer

* chore: update CHANGELOG.md

* fix tests and typo
2025-07-14 17:39:33 +02:00
Felix Prillwitz
80c27ec476
fix: playback of uris by api request (#1509)
- pop page after usage
- become active when play is requested
2025-06-26 17:39:49 +02:00
Richard Peña B.
b2915ee2bf
fix(cdn_url): add support for verify query parameter (#1513)
- Updated `MaybeExpiringUrls` to handle `verify` query parameter.
- Extracted expiry timestamp from `verify` parameter if present.
- Adjusted test cases to include URLs with `verify` parameter.
- Updated assertions to account for the new URL format.

This change ensures compatibility with URLs containing the `verify`
query parameter, improving the flexibility of the CDN URL handling.

Solves #1512
2025-06-26 17:27:59 +02:00
Mads Marquart
2c425ebd06
Fix compiler error when objc2 is in dependency tree (#1503) 2025-06-09 12:34:54 +02:00
Felix Prillwitz
3686718ea2
Chore: fix clippy warnings for stable (1.87) and nightly (1.89) (#1504)
* chore: stable - fix clippy warnings

* chore: nightly - fix clippy warnings
2025-06-09 12:13:17 +02:00
Felix Prillwitz
8b729540f4
Re-Add ability to handle/play tracks (#1468)
* re-add support to play a set of tracks

* connect: reduce some cloning

* connect: derive clone for LoadRequest

* apply review, improve function naming

* clippy fix
2025-05-04 20:29:54 +02:00
Felix Prillwitz
e2c3ac3146
Mark unrelated parsing error as warning (#1491)
* mark known parsing error as warning

* add copilot suggestion

* adjust unknown enum handling for json
2025-05-03 23:39:07 +02:00
Thomas Schlage
d12e1b8549
Send playback position as player event (#1495)
* Send play progress as PlayerEvent::PositionChanged

* Replaced PlayerEvent::PositionChanged with set_progress_callback() method

* Revert "Replaced PlayerEvent::PositionChanged with set_progress_callback() method"

This reverts commit f26e3de07b.

* Added opt-in config in PlayerConfig for progress event

* Added doc comments and set default position interval to 1sec for standalone

* Remove handling of PositionChanged in standalone binary

* Fixed wrong event handling
2025-05-03 23:37:17 +02:00
Scott S. McCoy
6bdc0eb312
spirc: Configurable volume control steps (#1498)
* spirc: Configurable volume control steps

Allow the volume control steps to be configured via the `--volume-steps`
command line parameter. The author personally found the default volume
steps of `1024` to be completely unusable, and is presently using `128`
as his configuration. Perhaps consider this as a more reasonable
default.

Additionally, reduce the delay in volume update from a wopping two
seconds to 500ms, again for usability.

Also clean up the seemingly unnecessary use of a pattern match on
whether or not `--initial-volume` was supplied.

* fixup! spirc: Configurable volume control steps

* fixup! spirc: Configurable volume control steps

* fixup! spirc: Configurable volume control steps

* fixup! spirc: Configurable volume control steps

* fixup! spirc: Configurable volume control steps

* fixup! spirc: Configurable volume control steps

---------

Co-authored-by: Scott S. McCoy <scott.s.mccoy@acm.org>
2025-05-01 23:19:47 +02:00
Felix Prillwitz
59381ccad3
Handle/Ignore unknown audio formats (#1467)
* ignore unknown enum values

* update CHANGELOG.md

* metadata: introduce own AudioFileFormat

* metadata: adjust handling for better readability
2025-04-13 06:37:12 +00:00
Roderick van Domburg
cb958a07f2
Saturate seek position to track duration (#1483)
The fix prevents seeking past the end of a track by capping the requested
seek position to the actual duration.
2025-04-06 20:37:19 +02:00
Rudi Heitbaum
5981b88ac5
Update Cargo.lock (#1480)
Fixes build with CMake 4.0.0
2025-03-31 15:24:03 +00:00
Felix Prillwitz
837b3e6d1a
Emit shuffle and repeat events again (#1469)
* emit shuffle and repeat events again

* connect: split context/track repeat handling
2025-03-22 20:17:46 +01:00
Christoph
11c3df8eb1
removes homething devicetype (#1471)
* removes homething devicetype

fixes #1470

From the comments about "homething" support in spotify:
"Did they ever release their homething product? I assumed not and guess they removed all support for it. We could just remove this footgun."

* mention breaking homething change in Changelog
2025-03-03 15:06:48 +01:00
Felix Prillwitz
09b4aa41e5
Add rustdoc to connect crate (#1455)
* restructure connect and add initial docs

* replace inline crate rustdoc with README.md

* connect: make metadata trait less visible

* connect: add some more docs

* chore: remove clippy warning

* update CHANGELOG.md

* revert unrelated changes

* enforce separation of autoplay and options

* hide and improve docs of uid

* remove/rename remarks

* update connect example and link in docs

* fixup rebase and clippy warnings
2025-02-22 23:39:16 +01:00
Carlos Tocino
f497806fb1
OAuth process made by a struct, allowing customization options. (#1462)
* get refresh token. Optional auth url browser opening

* changelog

* access token accepts custom message

* docs updated

* CustomParams renamed

* OAuthToken can be cloned

* builder pattern on token management

* changelog

* docs and format issues

* split methods and finish documentation

* new example and minor adjustments

* typo

* remove unnecessary dependency

* requested changes

* Update oauth/src/lib.rs

Co-authored-by: Felix Prillwitz <photovoltex@mailbox.org>

* Update oauth/src/lib.rs

Co-authored-by: Felix Prillwitz <photovoltex@mailbox.org>

* Update CHANGELOG.md

Co-authored-by: Felix Prillwitz <photovoltex@mailbox.org>

* Update oauth/src/lib.rs

Co-authored-by: Felix Prillwitz <photovoltex@mailbox.org>

* Update oauth/src/lib.rs

Co-authored-by: Felix Prillwitz <photovoltex@mailbox.org>

* Update oauth/src/lib.rs

Co-authored-by: Nick Steel <nick@nsteel.co.uk>

* Update oauth/src/lib.rs

Co-authored-by: Nick Steel <nick@nsteel.co.uk>

* remove veil. Oauth flow fix

* debug trait instead of veil

* Update main.rs

Co-authored-by: Nick Steel <nick@nsteel.co.uk>

---------

Co-authored-by: Felix Prillwitz <photovoltex@mailbox.org>
Co-authored-by: Nick Steel <nick@nsteel.co.uk>
2025-02-18 16:39:31 +01:00
humaita-github
581c8d61ea
Replacing atomic_shim with portable-atomic, since atomic_shim worsk well for MIPS and MIPSEL, but has problem with some ARM flavours. (#1466) 2025-02-14 20:16:29 +01:00
Dariusz Olszewski
cf61ede6c6
Fix cross compilation for armv6hf (Raspberry Pi 1) (#1457)
* Use ring instead of aws-lc as the default backend for hyper-rustls

Signed-off-by: Dariusz Olszewski <starypatyk@users.noreply.github.com>

* Cross-compile with libmdns

Signed-off-by: Dariusz Olszewski <starypatyk@users.noreply.github.com>

* Simplify Docker image to cross-compile for armv6hf (RPi 1)

Signed-off-by: Dariusz Olszewski <starypatyk@users.noreply.github.com>

* Revert "Use ring instead of aws-lc as the default backend for hyper-rustls"

This reverts commit faeaf506d6.

* Fix bindgen issues (aws-lc-rs) when cross-compiling for armv6hf

Signed-off-by: Dariusz Olszewski <starypatyk@users.noreply.github.com>

* Add git to the Docker image for cross-compiling

Signed-off-by: Dariusz Olszewski <starypatyk@users.noreply.github.com>

---------

Signed-off-by: Dariusz Olszewski <starypatyk@users.noreply.github.com>
Co-authored-by: Dariusz Olszewski <starypatyk@users.noreply.github.com>
2025-02-03 22:50:47 +01:00
Felix Prillwitz
34762f2274
Shuffle tracks in place (#1445)
* connect: add shuffle_vec.rs

* connect: shuffle in place

* add shuffle with seed option

* reduce complexity to add new metadata fields

* add context index to metadata

* use seed for shuffle

When losing the connection and restarting the dealer, the seed is now stored in the context metadata. So on transfer we can pickup the seed again and shuffle the context as it was previously

* add log for shuffle seed

* connect: use small_rng, derive Default

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-02-02 22:58:30 +01:00
humaita-github
471735aa5a
Update softmixer.rs to use AtomicU64 from atomic_shim, so that librespot works with MIPS and MIPSEL (#1461)
* Update softmixer.rs

Use AtomicU64 from atomic_shim, so that librespot works with MIPS and MIPSEL

* Update Cargo.toml with atomic-shim dependency

Added atomic-shim dependency

* Update Cargo.lock with atomic-shim package

Added atomic-shim package
2025-01-31 23:29:55 +01:00
Nick Steel
c1ae8608aa
core: include AP handshake in 5s timeout (#1458)
* core: include AP handshake in 5s timeout

* Update CHANGELOG.md
2025-01-28 17:04:58 +01:00
Felix Prillwitz
98e9703edb
connect: handle dnd of current track (#1449) 2025-01-23 19:14:48 +01:00
Felix Prillwitz
5f7cfdc76c
Expose autoplay option to SpircLoadCommand (#1446)
* connect: add autoplay option to SpircLoadCommand

* update CHANGELOG.md

* actually ignore options when starting autoplay
2025-01-23 19:13:30 +01:00
Felix Prillwitz
0e9a3def83
update Cargo.lock (#1440)
Fixes #1426
2025-01-22 22:49:16 +01:00
Felix Prillwitz
b54f3e30db
connect: expose disable_volume (#1451) 2025-01-20 16:59:04 +01:00
Felix Prillwitz
f3bb380851
Dealer: Rework context retrieval (#1414)
* connect: simplify `handle_command` for SpircCommand

* connect: simplify `handle_player_event`

* connect: `handle_player_event` update log entries

* connect: set `playback_speed` according to player state

* connect: reduce/group state updates by delaying them slightly

* connect: load entire context at once

* connect: use is_playing from connect_state

* connect: move `ResolveContext` in own file

* connect: handle metadata correct

* connect: resolve context rework

- resolved contexts independently, by that we don't block our main loop
- move resolve logic into own file
- polish handling for play and transfer

* connect: rework aftermath

* general logging and comment fixups

* connect: fix incorrect stopping

* connect: always handle player seek event

* connect: adjust behavior

- rename `handle_context` to `handle_next_context`
- disconnect should only pause the playback
- find_next should not exceed queue length

* fix typo and `find_next`

* connect: fixes for context and transfer

- fix context_metadata and restriction incorrect reset
- do some state updates earlier
- add more logging

* revert removal of state setup

* `clear_next_tracks` should never clear queued items

just mimics official client behavior

* connect: make `playing_track` optional and handle it correctly

* connect: adjust finish of context resolving

* connect: set track position when shuffling

* example: adjust to model change

* connect: remove duplicate track

* connect: provide all recently played tracks to autoplay request

- removes previously added workaround

* connect: apply review suggestions

- use drain instead of for with pop
- use for instead of loop
- use or_else instead of match
- use Self::Error instead of the value
- free memory for metadata and restrictions

* connect: impl trait for player context

* connect: fix incorrect playing and paused

* connect: apply options as official clients

* protocol: move trait impls into impl_trait mod
2025-01-18 16:45:33 +01:00
catango
c288cf7106
Fix testcases for cross compilation (#1443)
Crossbuild breaks due to missing bindgen. Additionally install bindgen-cli as it is not part
of the default github runnter any more.
2025-01-18 13:59:44 +01:00
Mateusz Mojsiejuk
14e3965ea3
Shrink/Optimize Dockerfile (#1430)
Changes Shrink the resulting image with 70mb by removing
un-used dependencies and merging several
runs to a single layer.
2025-01-12 23:03:56 +01:00
Fabio Waljaard
3a570fc5f1
Fix pause state when transferring (#1444) 2025-01-12 22:48:38 +01:00
Fabio Waljaard
4cecb2289a
Handle 'None' uri or empty string uri in transfer command (#1439) 2025-01-12 20:39:45 +01:00
eladyn
7003e98c1b
metadata: handle empty trailer_uri for shows (#1432)
* metadata: handle empty trailer_uri for shows

* chore: update changelog
2024-12-30 17:27:34 +01:00
Felix Prillwitz
2a574267ae
Update protobuf files (#1424)
* update protobuf definitions

* add additionally required proto files

* update version.rs

* adjust code to protobuf changes

* fix formatting

* apply suggestions, improve errors
2024-12-24 09:39:49 +01:00
Felix Prillwitz
0ad1f7249b
Update MSRV to 1.81 (#1428)
* bump MSRV to 1.81
* Update zbus to v5
* Update jack to 0.13
2024-12-23 10:28:06 +01:00
Benedikt
d82d94b76c
discovery: don't panic on libmdns errors (#1427)
On panic, the discovery task crashes, but the main program is not
notified of this. Returning an error will result in the Discovery stream
yielding None, serving as notification to the application (which might
shutdown with error, for example, if no other means of authentication is
available).
2024-12-19 22:31:28 +01:00