Commit graph

142 commits

Author SHA1 Message Date
Roderick van Domburg 5cc3040bd8
Update futures 2022-01-08 21:21:31 +01:00
Roderick van Domburg 89a5133bd7
Upgrade aes-ctr to latest aes 2022-01-08 20:51:51 +01:00
Roderick van Domburg 8d74d48809
Audio file seeking improvements
- Ensure there is enough disk space for the write file
- Switch streaming mode only if necessary
- Return `Err` on seeking errors, instead of exiting
- Use the actual position after seeking
2022-01-06 21:55:08 +01:00
Roderick van Domburg 1a7c440bd7
Improve lock ordering and contention 2022-01-05 20:44:08 +01:00
Roderick van Domburg 5c2b5a21c1
Fix audio file caching 2022-01-05 16:43:46 +01:00
Roderick van Domburg 3e09eff906
Improve initial loading time
- Configure the decoder according to Spotify's metadata, don't probe

- Return from `AudioFile::open` as soon as possible, with the smallest
  possible block size suitable for opening the decoder, so the UI
  transitions from loading to playing/paused state. From there,
  the regular prefetching will take over.
2022-01-04 23:23:20 +01:00
Roderick van Domburg 7921f23927
Improve format handling and support MP3
- Switch from `lewton` to `Symphonia`. This is a pure Rust demuxer
  and decoder in active development that supports a wide range of
  formats, including Ogg Vorbis, MP3, AAC and FLAC for future HiFi
  support. At the moment only Ogg Vorbis and MP3 are enabled; all
  AAC files are DRM-protected.

- Bump MSRV to 1.51, required for `Symphonia`.

- Filter out all files whose format is not specified.

- Not all episodes seem to be encrypted. If we can't get an audio
  key, try and see if we can play the file without decryption.

- After seeking, report the actual position instead of the target.

- Remove the 0xa7 bytes offset from `Subfile`, `Symphonia` does
  not balk at Spotify's custom Ogg packet before it. This also
  simplifies handling of formats other than Ogg Vorbis.

- When there is no next track to load, signal the UI that the
  player has stopped. Before, the player would get stuck in an
  infinite reloading loop when there was only one track in the
  queue and that track could not be loaded.
2022-01-03 00:13:28 +01:00
Roderick van Domburg 286a031d94
Always seek to starting position 2021-12-30 21:52:15 +01:00
Roderick van Domburg 9b6e02fa0d
Prevent a few potential panics 2021-12-29 23:15:08 +01:00
Roderick van Domburg e51f475a00
Further initial loading improvements
This should fix remaining cases of a client connecting, and failing
to start playback from *beyond* the beginning when `librespot` is
still loading that track.

This undoes the `suppress_loading_status` workaround from #430,
under the assumption that the race condition reported there has
since been fixed on Spotify's end.
2021-12-29 22:27:31 +01:00
Roderick van Domburg 332f9f04b1
Fix error hitting play when loading
Further changes:

 - Improve some debug and trace messages

 - Default to streaming download strategy

 - Synchronize mixer volume on loading play

 - Use default normalisation values when the file position isn't
   exactly what we need it to be

 - Update track position only when the decoder reports a
   successful seek
2021-12-28 23:46:37 +01:00
Roderick van Domburg 0f78fc277e
Call stream_from_cdn with CdnUrl 2021-12-27 21:42:57 +01:00
Roderick van Domburg 8aa23ed0c6
Drop locks as soon as possible 2021-12-27 00:11:07 +01:00
Roderick van Domburg b4f7a9e35e
Change to parking_lot and remove remaining panics 2021-12-26 23:02:02 +01:00
Roderick van Domburg 62461be1fc
Change panics into Result<_, librespot_core::Error> 2021-12-26 21:18:42 +01:00
Roderick van Domburg a297c68913
Make ping estimation less chatty 2021-12-19 00:14:00 +01:00
Roderick van Domburg 0d51fd43dc
Remove unwraps from librespot-audio 2021-12-18 23:44:13 +01:00
Roderick van Domburg d18a0d1803
Fix caching message when cache is disabled 2021-12-18 14:02:28 +01:00
Roderick van Domburg 9d88ac59c6
Configure User-Agent once 2021-12-18 13:39:41 +01:00
Roderick van Domburg 3b07a6bcb9
Support user-defined temp directories 2021-12-17 20:58:05 +01:00
Roderick van Domburg 2f7b9863d9
Implement CDN for audio files 2021-12-16 22:42:37 +01:00
Roderick van Domburg f3bb679ab1
Rid of the last remaining clippy warnings 2021-12-08 21:00:42 +01:00
Roderick van Domburg 9b2ca1442e
Move FileId out of SpotifyId 2021-12-08 19:53:45 +01:00
Roderick van Domburg f03a7e95c1
Merge remote-tracking branch 'librespot-org/dev' into new-api-wip 2021-12-08 19:11:53 +01:00
Roderick van Domburg 0e6b1ba9dc
Update version numbers to 0.3.1 2021-10-24 20:12:33 +02:00
Sasha Hilton 6a3377402a Update version numbers to 0.3.0 2021-10-13 15:10:18 +01:00
Roderick van Domburg 949ca4fded
Add and default to "auto" normalisation type (#844) 2021-09-20 19:22:02 +02:00
Roderick van Domburg b016b69772
Fix clippy warnings 2021-09-01 21:25:32 +02:00
Roderick van Domburg 7cd1b7a26a
Merge branch 'dev' into new-api-client 2021-06-26 00:14:20 +02:00
Roderick van Domburg 0703630041
Use PacketType instead of hex identifiers 2021-06-22 23:57:38 +02:00
Roderick van Domburg ad19b69bfb
Various code improvements (#777)
* Remove deprecated use of std::u16::MAX
* Use `FromStr` for fallible `&str` conversions
* DRY up strings into constants
* Change `as_ref().map()` into `as_deref()`
* Use `Duration` for time constants and functions
* Optimize `Vec` with response times
* Move comments for `rustdoc` to parse
2021-05-31 22:32:39 +02:00
johannesd3 555274b5af
Move decoder to playback crate 2021-05-11 20:36:53 +02:00
Sasha Hilton 2ef3928691 Update version numbers to 0.2.0 2021-05-04 13:05:13 +01:00
johannesd3 4925adb4f1 Fix broken streaming mode 2021-04-21 11:26:49 +02:00
johannesd3 b4f9ae31e2 Fix clippy warnings 2021-04-10 14:06:41 +02:00
johannesd3 26c127c2ec Merge branch 'dev' into tokio_migration 2021-04-10 12:59:47 +02:00
johannesd3 ff499825e0 Add missing feature flag to tokio 2021-04-10 12:50:30 +02:00
johannesd3 b7350b71da Restore previous feature flags
Some of the feature flags librespot uses are not really additive but
rather mutual exclusive. A previous attempt to improve the situation
had other drawbacks, so it's better to postpone a decision and restore
the old behaviour.
2021-04-10 12:50:30 +02:00
Roderick van Domburg e20b96c598 Merge remote-tracking branch 'upstream/dev' into hi-res-volume-control 2021-04-09 20:06:20 +02:00
Roderick van Domburg d0ea9631d2 Optimize requantizer to work in f32, then round 2021-04-09 19:33:28 +02:00
johannesd3 7c3d89112d Fix clippy warnings 2021-04-09 10:45:43 +02:00
johannesd3 f5274f5ada Merge branch 'dev' into tokio_migration 2021-04-09 10:39:06 +02:00
Roderick van Domburg 78bc621ebb Move SamplesConverter into convert.rs 2021-04-05 21:30:40 +02:00
Roderick van Domburg a200b25916 Fix formatting 2021-03-27 21:44:01 +01:00
Roderick van Domburg cdbce21e71 Make S16 to F32 sample conversion less magical 2021-03-27 21:42:10 +01:00
Roderick van Domburg bfca1ec15e Minor code improvements and crates bump 2021-03-27 21:13:14 +01:00
Roderick van Domburg 74b2fea338 Refactor sample conversion into separate struct 2021-03-21 22:16:47 +01:00
philippe44 86dbaa8ed5
true/false don't need to be explicit
Co-authored-by: Johannesd3 <51954457+Johannesd3@users.noreply.github.com>
2021-03-20 12:11:49 -07:00
Roderick van Domburg a1326ba9f4 First round of refactoring
- DRY-ups

 - Remove incorrect optimization attempt in the libvorbis decoder,
   that skewed 0.0 samples non-linear

 - PortAudio and SDL backends do not support S24 output. The PortAudio
   bindings could, but not through this API.
2021-03-18 22:06:43 +01:00
Roderick van Domburg 770ea15498 Add support for S24 and S24_3 output formats 2021-03-17 00:00:27 +01:00