Commit graph

1718 commits

Author SHA1 Message Date
Roderick van Domburg 650d41b020
Merge pull request #976 from JasonLG1979/pulseaudio-name
Set the PulseAudio name to match librespot's device name
2022-03-19 22:49:26 +01:00
JasonLG1979 e0e23c9167 Use the librespot name arg for the app name in the PulseAudio backend
This sets the name displayed by PulseAudio to Librespot - Instance Name if a name is given otherwise Librespot (the default name).

This also sets the correct "role" as per the docs:

https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/Developer/Clients/ApplicationProperties/

PA_PROP_MEDIA_ROLE

"This is a property of the actual streamed data, not so much the application"

Roles are used for policies, things like automatically muting a music player when a call comes in and whatnot.

For bonus points this also sets PULSE_PROP_application.icon_name to audio-x-generic so that we get a nice icon in the PulseAudio settings by our name instead of a missing icon placeholder.
2022-03-19 15:09:26 -05:00
Roderick van Domburg dd8155b044
Merge pull request #967 from JasonLG1979/SymphoniaDecoder
Refactor Symphonia decoder
2022-03-04 11:58:17 +01:00
Roderick van Domburg dfa48562c4
Merge pull request #968 from JasonLG1979/silence-compiler-warning
Silence compiler warning
2022-03-04 11:56:32 +01:00
JasonLG1979 30c960a6cd Silence compiler warning
The `split` variable in `split_uri` should not be `mut`.
2022-02-23 17:08:43 -06:00
JasonLG1979 85d6c0c714 symphonia_decoder tweak
* Remove unwrap

* Refactor normalisation_data.
2022-02-20 01:27:12 -06:00
Jason Gray 47f1362453
Port remove unsafe code and catch up with dev (#956) 2022-02-14 12:15:19 +01:00
Jason Gray 616809b64c
Quantum-realm level normalisation optimization (#965)
This saves up to 1-2% CPU useage on a PI 4 depending on how much normalisation is actually being done.

* We don't need to test against EPSILON. The factor will never be over 1.0 in basic normalisation mode.
* Don't check the normalisation mode EVERY sample.
* Do as little math as possible by simplfiying all equations as much as possible (while still retaining the textbook equations in comments).
* Misc cleanup
2022-02-13 22:50:32 +01:00
Sebastian Dröge ab562cc8d8
Update GStreamer to 0.18 and clean up (#964)
* Update GStreamer backend to 0.18
* Don't manually go through all intermediate states when shutting down the GStreamer backend; that happens automatically
* Don't initialize GStreamer twice
* Use less stringly-typed API for configuring the appsrc
* Create our own main context instead of stealing the default one; if the application somewhere else uses the default main context this would otherwise fail in interesting ways
* Create GStreamer pipeline more explicitly instead of going via strings for everything
* Add an audioresample element before the sink in case the sink doesn't support the sample rate
* Remove unnecessary `as_bytes()` call
* Use a GStreamer bus sync handler instead of spawning a new thread with a mainloop; it's only used for printing errors or when the end of the stream is reached, which can also be done as well when synchronously handling messages.
* Change `expect()` calls to proper error returns wherever possible in GStreamer backend
* Store asynchronously reported error in GStreamer backend and return them on next write
* Update MSRV to 1.56
2022-02-13 21:52:02 +01:00
Roderick van Domburg cb194cfd3b
Merge pull request #966 from michaelherger/fix-params-printout
Only log runtime argument if it starts with a dash "-"
2022-02-13 20:48:36 +01:00
Michael Herger 6f6d330bce Only log runtime argument if it starts with a dash "-"
When there's a value that corresponds to an argument name used in the same command line, the logging of the arguments gets confused and logs the matching argument, but without the leading dash:

```
% target/debug/librespot -n c --verbose -c /path/to/my/cache
[2022-02-07T22:32:25Z INFO  librespot] librespot 0.3.1 55ced49 (Built on 2022-02-07, Build ID: qaEB8kEW, Profile: debug)
[2022-02-07T22:32:25Z TRACE librespot] Command line argument(s):
[2022-02-07T22:32:25Z TRACE librespot] 		-n "c"
[2022-02-07T22:32:25Z TRACE librespot] 		c "/path/to/my/cache"
[2022-02-07T22:32:25Z TRACE librespot] 		--verbose
[2022-02-07T22:32:25Z TRACE librespot] 		-c "/path/to/my/cache"
```

Here we're using the literal `c` as the device name, and the `-c` argument. Thus the `c /path/to/my/cache` is logged in addition to `-c /path...`.

After checking whether the key has a leading dash, this issue is gone:

```
% target/debug/librespot -n c --verbose -c /path/to/my/cache
[2022-02-07T22:32:41Z INFO  librespot] librespot 0.3.1 55ced49 (Built on 2022-02-07, Build ID: qaEB8kEW, Profile: debug)
[2022-02-07T22:32:41Z TRACE librespot] Command line argument(s):
[2022-02-07T22:32:41Z TRACE librespot] 		-n "c"
[2022-02-07T22:32:41Z TRACE librespot] 		--verbose
[2022-02-07T22:32:41Z TRACE librespot] 		-c "/path/to/my/cache"
```
2022-02-07 23:37:29 +01:00
Roderick van Domburg c49415c3fb
Merge pull request #960 from JasonLG1979/fix-shuffle
Prevent shuffle crash
2022-02-03 09:36:09 +01:00
Roderick van Domburg 009814679e
Merge pull request #962 from pdeljanov/symphonia-v0.5
Upgrade to Symphonia v0.5
2022-02-03 09:34:35 +01:00
Philip Deljanov e64f09fd77 Upgrade to Symphonia v0.5. 2022-02-01 19:02:14 -05:00
JasonLG1979 d54f3982a0 update changelog 2022-02-01 17:48:13 -06:00
JasonLG1979 edb98d5c1d Prevent shuffle crash
fixes https://github.com/librespot-org/librespot/issues/959
2022-01-31 18:31:09 -06:00
Roderick van Domburg f4be9bb85d
Merge pull request #954 from JasonLG1979/remove-dep-warning
Remove basic normalisation deprecation warning
2022-01-28 08:45:18 +01:00
JasonLG1979 3c749a8f0e Remove basic normalisation deprecation warning 2022-01-27 17:03:21 -06:00
Roderick van Domburg c8971dce63
Fix Alsa softvol linear mapping (#950)
Use `--volume-range` overrides
2022-01-27 18:39:28 +01:00
Jason Gray 03e71f6e0a
simplify get_factor (#942)
Simplify `get_factor`
2022-01-27 07:40:59 +01:00
Roderick van Domburg 9b25669a08
Fix clippy lints 2022-01-26 23:05:40 +01:00
Roderick van Domburg 827b815da9
Update Rodio and neatly call play/pause 2022-01-26 22:54:04 +01:00
Roderick van Domburg cb1cfddb74
Send platform-dependent client token request 2022-01-26 22:53:30 +01:00
Roderick van Domburg 31c682453b
Prevent man-in-the-middle attacks 2022-01-25 22:48:27 +01:00
Roderick van Domburg f40fe7de43
Update crates 2022-01-25 21:18:06 +01:00
Roderick van Domburg 44860f4738
Remove assertions for what we know works well 2022-01-25 20:58:39 +01:00
Roderick van Domburg 552d9145f4
Feature-gate passthrough decoder 2022-01-25 20:46:10 +01:00
Roderick van Domburg 3f95a45b27
Parse dates without month or day (fixes #943) 2022-01-25 20:03:35 +01:00
SuisChan 2c63ef111a Added linux fields to connectivity.proto 2022-01-25 11:56:19 +01:00
Roderick van Domburg 55ced49c2d
Merge pull request #929 from jforberg/playlist_tracks
Add error message for bad ID
2022-01-24 13:47:09 +01:00
Roderick van Domburg a447bb5be9
Merge pull request #944 from SuisChan/update-protos
Add more connectivity.proto fields
2022-01-24 13:45:03 +01:00
SuisChan 8498ad8078 Update connectivity.proto 2022-01-24 12:52:15 +01:00
Jason Gray ceebb374f0
Remove unsafe code (#940)
Remove unsafe code
2022-01-23 19:02:04 +01:00
Roderick van Domburg 4ea1b77c7b
Fix client-token and implement expiry logic 2022-01-23 00:26:52 +01:00
Roderick van Domburg 1528292583
Retrieve client token (not working) 2022-01-22 23:17:10 +01:00
Roderick van Domburg 0630586cd6
Ensure a client ID is present 2022-01-22 21:27:56 +01:00
Roderick van Domburg 0822af0328
Use configured client ID on initial connection (fixes #941) 2022-01-22 21:17:55 +01:00
Roderick van Domburg f2625965b3
Count from the start for stability 2022-01-22 21:13:11 +01:00
Jason Gray c6e97a7f8a
Save some more CPU cycles in the limiter (#939)
Optimise limiter CPU usage
2022-01-17 22:57:30 +01:00
Roderick van Domburg 8851951f04
Change counting to spirc and player
They can be reinstantiated, unlike the `session` which is now
intended to be constructed once.
2022-01-16 21:29:59 +01:00
Roderick van Domburg fcb21df81f
Fix connect test 2022-01-16 01:36:28 +01:00
Roderick van Domburg 2065ded7b6
Fix examples 2022-01-16 01:29:50 +01:00
Roderick van Domburg abbc3bade8
Register message listeners before connecting 2022-01-16 01:14:00 +01:00
Roderick van Domburg 8811b89b2d
Document MSRV 1.53 and cargo clippy requirement 2022-01-14 23:45:31 +01:00
Roderick van Domburg 0de55c6183
Merge branch 'dev' into new-api 2022-01-14 23:42:18 +01:00
Roderick van Domburg 72af0d2014
New dynamic limiter for very wide dynamic ranges (#935)
New dynamic limiter for very wide dynamic ranges
2022-01-14 23:31:29 +01:00
Roderick van Domburg dbeeb0f991
Switch from chrono to time 2022-01-14 23:28:09 +01:00
Roderick van Domburg 7fe13be564
Fix audio file streaming 2022-01-14 23:24:43 +01:00
Roderick van Domburg 1e54913523
Fix --device argument to various backends (#938)
Fix `--device` argument to various backends
2022-01-14 08:20:29 +01:00
Roderick van Domburg 0cc4466245
Improve range checks 2022-01-13 21:15:27 +01:00