Commit Graph

3596 Commits

Author SHA1 Message Date
ejurgensen
3c2ff294a1 [player] Fix rewind problem where quality level was lost by player
+ remember to flush in source_start(), since the input won't do it if
input_now_reading has already been closed (e.g. if starting a new track
while playback is at the end of another track)
2019-03-18 23:06:08 +01:00
ejurgensen
50c7d96bc4 [raop] Remove flush timer, the player now takes care of stopping
Player now stops 10 secs after stop command and 10 mins after pause. At
that time the outputs have probably cut the connection themselves, but
that might be ok (needs testing).
2019-03-18 23:06:08 +01:00
ejurgensen
2893e597c3 [player] Partially revert commit ec9633c, now don't do full stop straight away
It is normal for the player to be called with stop() and then start(), so we
should keep the outputs open for a while.
2019-03-18 23:06:08 +01:00
ejurgensen
4017ce8846 [player] Fixup to commit 8f39c65, avoid crash when queue ends 2019-03-18 23:06:08 +01:00
ejurgensen
fc20b55a9b [raop] Log sync packet times 2019-03-18 23:06:08 +01:00
ejurgensen
977f8570a5 [player] Fix handling of underrun/read_deficit
* Also call full_cb() from input_wait if buffer is full
* Make read_deficit count missing bytes instead of clock ticks
* Make read_deficit a part of the playback session
2019-03-18 23:06:08 +01:00
ejurgensen
143708368c [alsa] Fix sync check
Sync correction still not implemented
2019-03-18 23:06:08 +01:00
ejurgensen
0f83b09ef7 [player] Fix incorrect setting of start timestamp
The time stamp was getting set too late, because if pos was zero the first
reads then it would be overwritten, but it shouldn't because the loop will
catch up even if the initial reads have zero samples.
2019-03-18 23:06:08 +01:00
ejurgensen
16469f6fa3 [player] Fixup missing fix from merge conflict resolution 2019-03-18 23:06:08 +01:00
ejurgensen
a37c9b4839 [player] Change name that was incorrect from merge conflict resolution 2019-03-18 23:06:08 +01:00
ejurgensen
2472aa9463 [player] Add timer to stop playback after being paused for a while 2019-03-18 23:06:08 +01:00
ejurgensen
b56b56af07 [input] Cleaning up 2019-03-18 23:06:08 +01:00
ejurgensen
107fa3634b [spotify] Remove obsolete .start reference 2019-03-18 23:06:08 +01:00
ejurgensen
cfaceab9fe [outputs] Misc fixup 2019-03-18 23:06:08 +01:00
ejurgensen
9d5555152c [alsa] Implement new output interface + some refactoring
Sync still missing
2019-03-18 23:06:08 +01:00
ejurgensen
b811122566 [outputs] Rename output_buffer.frame to .data 2019-03-18 23:06:08 +01:00
ejurgensen
5c35e1a9db [player] Completely stop devices on playback_stop()
Previously we just flushed, and local audio devices would never get closed.
Also a little fixup to the printing of session debug.
2019-03-18 23:06:08 +01:00
ejurgensen
19694ee1dd [misc] Add ringbuffer utility to misc.c/misc.h 2019-03-18 23:06:08 +01:00
ejurgensen
9dfab16138 [streaming] Cleaning bugs from refactor 2019-03-18 23:06:08 +01:00
ejurgensen
201c97fdf8 Fixup 3 - remove small risk of crash if encode_setup called incorrectly 2019-03-18 23:06:08 +01:00
ejurgensen
de55acf797 [input] Fixup 2: Seeking when rewinding to 0 2019-03-18 23:06:08 +01:00
ejurgensen
c74b305983 [outputs] Fix crash, invalid reference to device after outputs_device_add 2019-03-18 23:06:08 +01:00
ejurgensen
b7add1d0fa [inputs/player] Fixup part 1 2019-03-18 23:06:08 +01:00
ejurgensen
d008e241cf [outputs] Make outputs_device_flush (per device flushing)
Works better with the callback mechanism
2019-03-18 23:06:08 +01:00
ejurgensen
87ca6363ae [player/input] Refactor - WIP
* Open input sources earlier
* Gapless playback
* Remove fixed 44100/16 from player
* Complete restructure player internals
2019-03-18 23:06:08 +01:00
ejurgensen
e97ad7d970 [outputs] Reinstate device->activated, so that mdns flukes can't bring down playback 2019-03-18 23:06:08 +01:00
ejurgensen
936103f462 [outputs] Move device_add/rm to outputs and get rid of advertised flag 2019-03-18 23:06:08 +01:00
ejurgensen
a7e8476996 [outputs] Refactor outputs some more, eg change callback system 2019-03-18 23:06:08 +01:00
ejurgensen
e99f20992e [player/outputs] Implement changed output interfaces in most backends
Still missing cast, alsa and pulseaudio, but these can so far just be
disabled with configure.

Otherwise still mostly untested.
2019-03-18 23:06:08 +01:00
ejurgensen
14a6d318f0 [outputs] Changes to interface of outputs module
* Drop output_sessions, was just a pointer to the actual session anyway
* Drop the old write, flush and stop prototypes
* Some minor changes/renaming

Purpose of this is also to fix a race condition in player.c where it
could try to start two sessions on the same speaker. This could happen
because outputs_device_start() in line 2093 is conditional on device->session
which however is false while a device is starting up.
2019-03-18 23:06:08 +01:00
ejurgensen
cee740ae51 [misc] Move MIN() macro from raop.c to misc.c 2019-03-18 23:06:08 +01:00
ejurgensen
94dfef6e78 [input] Return quality flag even if read size is zero
First input_read() has bufsize 0, because we don't know quality yet
2019-03-18 23:06:08 +01:00
ejurgensen
0cb3881621 [player/outputs/raop] Get rid of outputs_playback_start() (still WIP)
outputs_playback_start() had the problem that was not consistently invoked: If
for instance local audio playback was running and a Airplay device was then
activated, the raop's playback_start would never be invoked (and vice versa,
of course).

Instead, the player now writes the presentation timestamp every time to the
output, so it doesn't need to keep track of it from the start.
2019-03-18 23:06:08 +01:00
ejurgensen
a924a8dd66 [raop] Reorganise code a little 2019-03-18 23:06:08 +01:00
ejurgensen
fcc91ecd86 [player/outputs] Handle multiple quality levels + use rtp_common (WIP!)
* Untie Airtunes stuff further from player and non-Airplay outputs
* Change raop.c to use rtp_common.c (step 1)
* Change heartbeat of player to 100 ticks/sec, since we have untied from
  Airtunes 352 samples per packet (which equals 126 ticks/sec at 44100)

Still a lot to be done in the player, since the rtptime's in it don't
are probably broken.
2019-03-18 23:06:08 +01:00
ejurgensen
cdd0aa884b [outputs] Add ability to deal with multiple qualities
Output module can now take input data in multiple quality levels, and
can resample to those output modules that would require a certain quality
level, like raop.c would
2019-03-18 23:06:08 +01:00
ejurgensen
7e48887adc [rtp] Add RTP utility module: rtp_common.c rtp_common.h
Expectation is to use this for both Airplay and Chromecast RTP streaming
2019-03-18 23:06:08 +01:00
ejurgensen
76bbfb6d2c [streaming] Adjust httpd_streaming to new transcode interface 2019-03-18 23:06:08 +01:00
ejurgensen
4fe5c47526 [inputs] Change pipe and file_http inputs to use media_quality 2019-03-18 23:06:08 +01:00
ejurgensen
7048a72d86 [spotify] Use media_quality instead of input_quality
and allow more than 2 channels ... probably wouldn't actually work, hard to test
2019-03-18 23:06:08 +01:00
ejurgensen
a9085e978d [input] Change input abstraction to use media_quality instead of input_quality 2019-03-18 23:06:08 +01:00
ejurgensen
462d787fab [misc] Add media_quality struct for storing sample rate, bps and channels 2019-03-18 23:06:08 +01:00
ejurgensen
ad77a42dbb [xcode] Adapt to allow for new raw PCM input profiles, e.g. 48000/16 2019-03-18 23:06:08 +01:00
ejurgensen
1696fc3384 [input] Adapt input_buffer so it can handle dynamic quality (sample rates etc)
Still WIP, player and outputs cannot handle this yet
2019-03-18 23:06:08 +01:00
ejurgensen
9182597605 [input/xcode] Write to input buffer with the sources native sample rate/format
Still WIP at this point since the player and output can't use the use improved
quality yet, and because rtptimes etc. are likely incorrect
2019-03-18 23:06:08 +01:00
ejurgensen
84e813038b [player] Some additional comments 2019-03-18 23:06:08 +01:00
ejurgensen
d850c2e691 [xcode] Add OPUS encoding profile for RTP Chromecasting 2019-03-18 23:06:08 +01:00
chme
f85df07308 [jsonapi] Respect order defined in smartpl expression in queue/items/add 2019-02-23 11:02:12 +01:00
chme
e078ba8ed0 [jsonapi] Use same order by clause when adding queue items by
expressions as is used in search tracks by expression
2019-02-23 11:02:12 +01:00
chme
a3f2551eea [jsonapi] Support starting playback from position in queue/items/add 2019-02-23 09:41:58 +01:00
chme
435df3fe8f [spotify] Add support for adding spotify artist tracks to the queue 2019-02-20 10:10:53 +01:00
chme
3d494d5f58 [spotify] Switch to new web api playlist endpoints
The old playlist endpoints containing the user are deprecated and will
eventually be removed
(https://developer.spotify.com/community/news/2019/01/15/update-changes-to-playlist-uris/).
2019-02-20 09:30:02 +01:00
chme
7a2ba572f8 [streaming] Remove timeout for mpeg stream requests
Remove the need for clients to regularly reconnect to the mp3 stream. As
long as the connection is open, we are sending mp3 stream data.
2019-02-14 12:15:11 +01:00
chme
3343e9cfc8 [jsonapi] Rename queue item "albumartist_id" to "album_artist_id"
Keeps it in sync with the naming in the track object. Also introduce a
helper function to add an int64 as a json string.
2019-02-14 08:22:50 +01:00
Christian Meffert
90a7c120c3
Merge pull request #689 from chme/web_podcasts
Improve podcasts views in player web interface
2019-02-13 15:47:22 +01:00
Christian Meffert
a38a21e21e
Merge pull request #686 from whatdoineed2do/db-q-now-playing-modal
[db,web-src] support links to album,artist from queue item modal like others modals
2019-02-13 15:46:51 +01:00
whatdoineed2do/Ray
17022c9103 [jsonapi] expose albumid/artistid persistent id on queue object 2019-02-12 09:21:39 +00:00
whatdoineed2do/Ray
7e02eb510d [db] add songartistid to queue tbl 2019-02-12 09:21:39 +00:00
chme
8840a65ee6 [smartpl] Add "songalbumid" as valid query field 2019-02-10 08:21:15 +01:00
ejurgensen
b1622b5b91
Merge pull request #687 from chme/spotify_artwork_2
[spotify/artwork] Add spotify webapi as an additional artwork source
2019-02-09 11:07:47 +01:00
chme
9b8bff45ab [artwork/http] Check response code and content type
Extends the http_client_ctx to hold the response code for a request.
Also adds the content type header, if it was a https request (using
libcurl instead of libevent)
2019-02-09 08:35:20 +01:00
ejurgensen
cb49554608 [raop] Fix forgotten include of conffile.c in commit 18acb73 (fixes #688) 2019-02-07 21:14:13 +01:00
chme
733a521df8 [spotify/artwork] Add spotify webapi as an additional artwork source 2019-02-05 16:04:08 +01:00
chme
0ded6d63bf [db/jsonapi] New admin value for Last-Modified in JSON API header
This adds a new timestamp value "db_modified" into the admin db table.
In addition to the existing "db_update" admin value, this value is also
updated if rating, play-/skip-count or seek changes for a
media_info_file (files db table).

This should improve the caching behavior in clients of the JSON API
(especially the player web interface) in refreshing its data if some of
this values changes.
2019-01-31 09:42:53 +01:00
chme
3bc15e1278 [jsonapi] Add endpoint to update a tracks rating and/or play_count
New endpoint is PUT api/library/tracks/[id] and supported query
parameters are:
- rating: with values between 0 and 100
- play_count: with values "reset" (resets play_count and skip_count) or
"increment" (increments play_count)
2019-01-31 09:42:53 +01:00
chme
7d0e48eb0e [db] Add support for resetting play- and skip-count 2019-01-31 09:42:53 +01:00
chme
b9a7ce7dd2 [jsonapi] Add endpoint to retrieve details for a single track by its id 2019-01-31 09:42:53 +01:00
ejurgensen
c70f96fdec [db] Fix integer overflow in bind_mfi (ref issue #683)
Also drop DB_TYPE_CHAR since it's not really being used.
2019-01-30 23:34:00 +01:00
ejurgensen
7abf68200d [scan] Fix parsing of iTunes "Play Date" tag (fixes #683)
"Play Date" tag was seconds since 1904 (an Apple Mac HFS+ timestamp), not a
Unix timestamp as we assumed. Seems Apple themselves realised that wasn't a
great idea (+ not a proper plist date type), and therefore provide "Play Date
UTC" as an alternative.
2019-01-30 22:32:46 +01:00
chme
81753d44a7 [mpd] Report support for protocol version 0.20 2019-01-28 22:40:25 +01:00
chme
f77c216650 [mpd] Refactor parsing filter/window arguments and add support for
"group" argument in "list" command
2019-01-28 22:40:25 +01:00
chme
e015032292 [mpd] Add duration attribute with millisecond precision 2019-01-28 22:40:25 +01:00
chme
5bd94df4a6 [mpd] Add listfiles command
For now listfiles simply returns the same result as lsinfo (no support
for listing files not part of the library)
2019-01-28 22:40:25 +01:00
chme
937d1e3f5f [db] Add "group" attribute to query_params and allow grouping files 2019-01-28 22:40:25 +01:00
chme
06aaacbe8f [smartpl] Fix wrong where clause for date field queries with "before"
keyword
2019-01-28 20:46:04 +01:00
chme
9fff02841b [jsonapi] Fix error in web interface files-view if the library directory
end with a trailing slash
2019-01-28 15:00:18 +01:00
chme
238361ea25 [player] Fix segfault when getting single speaker/output by id 2019-01-26 17:50:30 +01:00
chme
b000803fe3 [misc] Add compiler hint to check format parameters 2019-01-26 10:08:11 +01:00
chme
1f2b608d62 [mpd] Fix wrong number of format parameters for safe_asprintf
Fixes a segfault in cases where the default playlist directory config
(in the mpd section of the configuration file) was set/activated.
2019-01-26 10:07:48 +01:00
chme
116c315a84 [player] Rename struct spk_info to player_speaker_info 2019-01-22 17:47:15 +01:00
chme
343c583229 [jsonapi] Support changing volume by the given step (increase/decrease
volume)
2019-01-21 11:11:20 +01:00
chme
db7b9c689b [player] Add command to get a single speaker info by its id 2019-01-21 11:11:20 +01:00
chme
c165c55b5b [jsonapi] Add player/toggle endpoint
Toggles playback state depending on the current player state:
- playing --> pause
- paused, stopped --> play
2019-01-20 12:03:50 +01:00
ejurgensen
741825d086 [cast] Add option to exclude speakers (closes #659) 2019-01-09 20:26:31 +01:00
chme
fb60a05228 [jsonapi] Add support for "playback", "clear" and "shuffle" parameters
in
"queue/items/add" endpoint
2019-01-05 07:21:36 +01:00
chme
77a19a6df9 [jsonapi] Add checks for failed playback start and return error code 2019-01-02 09:51:54 +01:00
chme
0f4cbb3375 [http/jsonapi] Use strtok_r instead of strtok 2019-01-02 09:51:54 +01:00
chme
f23732945b [websocket] Support "database" notifications 2019-01-02 09:51:54 +01:00
chme
b3853ef0f3 [jsonapi] Check for empty "uris" parameter in queue/items/add (prevents
a segfault) and log failed requests in error log
2019-01-02 09:51:54 +01:00
chme
2ead24a2f7 [jsonapi] Add optional expression parameter to queue/items/add endpoint
Adds support to add tracks by a smart pl query expression
2019-01-02 09:51:54 +01:00
chme
ca99bf8718 [jsonapi] Sort files by filename and return directories in api/config 2019-01-02 09:51:54 +01:00
ejurgensen
cd7af46c36 [db] Generic version of db_drop_indices/triggers + fix memleak
Memleak in db_drop_triggers() in error case (array "index" not being freed)
2019-01-01 21:34:29 +01:00
chme
010e8b2959 [db] Fix missing creation of triggers for persistent ids in db init 2019-01-01 09:38:02 +01:00
ejurgensen
19c39bf133 [scan] Always use compilation_artist for tracks in compilation dir
Reason is that tracks in compilation dir are not to be trusted when it comes
to album_artist.

See afee99d5db (commitcomment-31807556).
2018-12-31 15:55:49 +01:00
ejurgensen
9929832b5f [db] Don't zero play_count, skip_count, seek, time_played, time_skipped on update
If a file gets updated/rescanned we generally don't want to reset the above
values. This commit adds DB_FLAG_NO_ZERO, which marks a field so that
db_file_update() will only update it if the new value is non-zero (i.e. the
caller probably has a "better" value).
2018-12-31 15:55:49 +01:00
ejurgensen
734b4e9851 [db] Transfer some library tag fixup to the db's generic fixup
Transfer setting defaults for media_kind and item_kind. Also sets
default media_kind for queue_items.
2018-12-31 15:55:49 +01:00
ejurgensen
c3eb95d201 [db] Change use of compilation_artist, so that album_artist has preference
This change means that we will use album_artist even if compilation_artist
is configured, thus compilation_artist will only be used to override artist.
2018-12-31 15:55:49 +01:00
ejurgensen
9fc2065ada [db] Use album_artist if we have no artist metadata 2018-12-31 15:55:49 +01:00
ejurgensen
8043ca1291 [db] Drop upgrade support for pre-v17 db versions
Also drop the old way of recreating the files table, it is now replaced by
db_table_upgrade().
2018-12-31 15:55:49 +01:00
ejurgensen
a4c254e6e7 [db] Recreate v20 files table, so that new constraints take effect if upgrading
The constraints on songalbumid and songartistid where changed with v20, so we
need to make sure they take effect when upgrading.

This commit tries to do the table recreation like sqlite recommends and without
manually crafted copy queries that are probably prone to errors.

Since we are recreating anyway, this commit also reorders the columns slightly.

It also includes auto-drop/recreation of triggers (should really have been its
own commit) during upgrade, like is already done with indices.
2018-12-31 15:55:49 +01:00