Commit Graph

381 Commits

Author SHA1 Message Date
ejurgensen
b8e0280567 [outputs] Add a 10 sec stop timer + drop playback_stop()
In the output implementations playback_stop() was somewhat redundant,
since device_stop() does the same.

The timer should make sure that we always close outputs (previously
they were in some cases kept open).

The commit also includes some renaming.
2019-03-18 23:06:08 +01:00
ejurgensen
e3d39cff9b [player] Fix incorrect setting of buffer size to outputs 2019-03-18 23:06:08 +01:00
ejurgensen
f7096890f6 [player] Fix incorrect calculation of timestamp due to integer overflow 2019-03-18 23:06:08 +01:00
ejurgensen
39037c7c8b [player] Fix typo 2019-03-18 23:06:08 +01:00
ejurgensen
8cf717664d [player] Don't call event_read_quality() twice 2019-03-18 23:06:08 +01:00
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
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
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
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
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
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
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
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
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
chme
238361ea25 [player] Fix segfault when getting single speaker/output by id 2019-01-26 17:50:30 +01:00
chme
116c315a84 [player] Rename struct spk_info to player_speaker_info 2019-01-22 17:47:15 +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
f3a495cd37 [player] Fix memory leak if opening new source failed
player.c:2032:11: warning: Potential leak of memory pointed to by 'ps'
2018-12-29 16:34:56 +01:00
chme
2a76e888f0 [player] Send notification on output added/removed 2018-12-29 08:46:00 +01:00
ejurgensen
4f6c9bb366 Revert "[player] Do not abort if pausing a stream or pipe playback"
This reverts commit fd84dd51b5.
2018-12-03 23:59:31 +01:00
chme
fd84dd51b5 [player] Do not abort if pausing a stream or pipe playback
Instead we stop reading from the source and check on playback resume if
the source needs to be reopened.
2018-11-30 16:16:42 +01:00
chme
f6ddec3389 [player] On pause the current streaming item needs to be stopped, if it
is not the current playing item.

This happens if the input already switched to the next item in the queue
starting to stream it to the outputs (2 second buffer) while the outputs
are still playing the last seconds of the old item.
2018-11-30 15:41:28 +01:00
chme
05141480e2 [player/db] Increment queue version if shuffle mode is turned off
This fixes showing the wrong queue in the player web interface after
turing shuffle mode off.
2018-11-11 07:01:22 +01:00
chme
7252b3e509 [db] Add support to add items to the queue at specified position 2018-09-16 09:36:43 +02:00
chme
461a1d55bf [player] Only add persistent items to history
The current logic in httpd_dacp.c cannot handle non persistent items
correctly. The items are always shown with the dummy_mfi with "unkown
artist" etc.
2018-09-08 09:14:24 +02:00
chme
9a47335a05 [player] Only increment playcount and scrobble persistent items
Ommits useless update query for playcount for items that are not in the
library. Also avoids trying to scrobble these items (fixes error log
message "lastfm: Scrobble failed, track id 9999999 is unknown")
2018-09-08 08:32:49 +02:00
ejurgensen
fde0a28142 Support for skip_count and time_skipped file metadata 2018-08-18 22:56:27 +02:00
chme
705b7013c3 [player/dacp/mpd/json] Update master volume after setting speaker volume
Changing a speaker volume in a DACP clients results in two dacp requests
(at least in Retune):

setproperty?include-speaker-id=0&dmcp.volume=41
setproperty?speaker-id=198018693182577&dmcp.volume=43

The first request sets the absolute volume for the speaker (player.c -
volume_setabs_speaker). The second request is only triggered if the
volume from the first one is not the new master volume. This second
requests adjusts the relativ volume based on the loudest device (new
master volume) (player.c - volume_setrel_speaker). After the second
request the master volume and the relative volumes are correct (range
from 0 - 100 percent and master volume is 100 percent).

MPD and JSON API clients only set the absolute volume which results in
inconsistent master_volume and relative volumes. The added option to
update the master volume in volume_setabs_speaker/volume_setrel_speaker
makes sure the master volume and the relative volumes are correctly set.
2018-05-31 10:49:53 +03:00
chme
3d779e1273 [player] Additional debug logs for speaker volume 2018-05-31 10:49:53 +03:00
ejurgensen
b6e1269cf2 [raop/dacp/player] Support for Airplay speakers to register volume updates
Implements Active-Remote, which is sent to the speaker, so it can use this
to tell us who it is when it makes dacp request with a device-volume update.
2018-05-27 16:12:20 +02:00
chme
decf9f1329 [player] Add commands to enable/disable output 2018-02-10 09:04:18 +01:00
chme
93879c6f90 [player] Refactor speaker enumerate callback 2018-02-10 09:04:18 +01:00
chme
94fd370df2 [player] Simplify parameter passing to player commands 2018-02-10 09:04:18 +01:00
chme
d36e6ac5ab [player] Refactor speaker_set/speaker_activate 2018-02-10 09:04:18 +01:00
chme
f2659d995b [player] Refactor speaker_set/speaker_deactivate 2018-02-07 21:04:47 +01:00
chme
183ac17fd5 [player] Check player state in stop and pause commands 2017-12-28 16:30:38 +01:00
chme
0b07cff633 [player] Only update queue item in metadata_update_cb on changed
metadata. This avoids an unnecessary update query and queue change
notification (leading to clients requesting the unchanged queue).
2017-12-09 11:01:41 +01:00
chme
8776aa36e2 [player] Trigger SPEAKER event after finishing the command speaker_set 2017-12-03 10:46:03 +01:00
chme
d839e8cabb [listener/player] Adjust code comment for LISTENER_SPEAKER event 2017-12-03 10:46:03 +01:00
chme
1689182432 [player/raop] Trigger the SPEAKER event if device verification
succeeded/failed
2017-12-03 10:46:03 +01:00
chme
f696229fff [player/dacp/mpd] Pass additional information to speaker enum callback 2017-12-03 10:46:03 +01:00
ejurgensen
b71b32438b [player] Don't log single tick overruns 2017-07-23 16:58:18 +02:00
ejurgensen
b803c30dcd [player] Check volume range when called for volume change + some adjustments in pipe input 2017-07-14 20:04:35 +02:00
chme
ecb41eccca [player] Use false/true for boolean field 2017-07-09 11:43:10 +02:00
chme
3048817c0b [player] Add warning log message if overrun is detected but player is
still able to catch up
2017-07-09 11:43:05 +02:00
ejurgensen
6295f2d79a [player] Make the player resilient in cases where an output blocks
(due to e.g. network problems) and also make sure that all devices
have called back before restarting after a suspend. Also a whole
lot of tidying up while I am at it.
2017-07-06 22:13:04 +02:00
ejurgensen
81a93bbec1 [player] Add config option high_resolution_clock 2017-06-26 23:32:24 +02:00
ejurgensen
5e48a68525 [player] device_restart_cb() should also handle failures due to device verification 2017-06-20 20:58:46 +02:00
ejurgensen
f63d103753 [raop] Add support for Apple TV device verification, required by tvOS 10.2 (fix for issue #377)
- also change how speakers are saved/retrieved from the db
- add generic authorization methods in outputs.c and player.c
- let filescanner read *.verification files (containing PIN)
- configure options to enable and disable, since libsodium is required
2017-06-19 21:52:01 +02:00
ejurgensen
544791ef59 [player] Prevent crash if output is failed and triggers a playback_abort
when a pause or seek is requested
2017-05-04 18:06:18 +02:00
ejurgensen
b9e069939e [mdns] Also handle devices being switched on/off without Avahi service removal notices 2017-05-02 23:13:53 +02:00
ejurgensen
5d74c98431 [input] Pass read errors to the player through the input buffer 2017-03-11 19:23:49 +01:00
ejurgensen
26c22144fc [-] Misc housekeeping (minor memleaks, invalid free's) 2017-02-12 01:19:56 +01:00
chme
3896f61d06 [dacp] Keep the now playing item in the queue when calling (#353)
playqueueedit_clear
2017-02-11 09:28:35 +01:00
ejurgensen
245ce1d4e4 [player] Allow starting playback with no outputs 2017-02-08 22:31:47 +01:00
ejurgensen
e6793b4779 [player] Add player_playback_start_byid() function, will be needed for pipe input 2017-02-08 22:29:37 +01:00
chme
4e4e91d4a2 [player] Add log messages in case playback_start_item returns -1 2017-02-04 08:35:02 +01:00
ejurgensen
f7018dc659 [player] Skip/remove unplayable tracks in queue instead of aborting 2017-01-29 22:07:51 +01:00
ejurgensen
b44ae55c1d Some scan-build fixing up 2017-01-28 22:37:56 +01:00
ejurgensen
dc84294348 [input/pipe] Parse basic Shairport metadata using mxml 2017-01-28 22:19:51 +01:00
ejurgensen
ab06a9fd7d [player] Update info about player.c 2017-01-27 22:36:00 +01:00
ejurgensen
0b9b008a1a [player] Try to consolidate metadata handling + use input interface 2017-01-27 22:36:00 +01:00
ejurgensen
90f37b75ce [player] Fix it so source_read() returns silence and not an error until source_check stops playback 2017-01-27 22:36:00 +01:00
ejurgensen
aa8edeead4 [player] Add suspend/resume on underrun + misc fixing up 2017-01-27 22:35:15 +01:00
ejurgensen
9aede45a12 [pipe] Add a pipe input with autostart capabilities 2017-01-27 22:30:47 +01:00
ejurgensen
938e197fa4 [player] Refactor read/write
- remove read skip which is obsolete when input has own thread and cannot block
- simplify code
- fix while loop that could loop infinitely
2017-01-27 22:29:08 +01:00
ejurgensen
1258481202 [listener] Rename LISTENER_PLAYLIST to LISTENER_QUEUE 2017-01-27 22:25:32 +01:00
ejurgensen
79639c73ed [input] Add Spotify input module 2017-01-27 22:08:56 +01:00
ejurgensen
c92ebf9dfb [player] Fix problem where player_playback_cb triggers after playback stop 2017-01-27 22:01:24 +01:00
ejurgensen
3e24f857fa [input] Add input interface to player - WIP 2017-01-27 22:01:24 +01:00
chme
dea5c50b67 [player] Fix memleaks found with scan-build 2017-01-20 19:00:11 +01:00
Scott Shambarger
8ead7ea3b8 [config] configure.ac checks required features, updated porting
Added a real config.rpath
Fixed build date calc for BSD
Require some needed headers at configure time
Correctly check libav functions using pkg-config flags
Made checks for some Linux features available on other ports
Fixed porting issue with antlr dep files
Added default HOST_NAME_MAX if not defined
Added missing libav header
2016-12-29 16:14:22 -08:00
chme
c3e8568782 [player] Add 'consume' mode
If consume mode is active the current song is removed from the queue at
eof or if the next song action is triggered.
2016-12-09 14:48:24 +01:00
chme
2d1e5f6d60 [player/db] Remove function "db_file_get_seekpos" 2016-12-04 17:48:35 +01:00
chme
fdd85ccf66 [raop/dmap] Build raop metadata from queue item 2016-12-03 20:40:54 +01:00
chme
6c6f02fdfa Rename "queue_item.item_id" to "queue_item.id" 2016-12-03 11:14:03 +01:00
chme
cef4fedfb4 Remove unused structs and player arguments 2016-12-03 11:12:19 +01:00
chme
6c66d39d91 [player] Fix segfault if player reaches end of queue, fix repeat single 2016-12-03 11:12:19 +01:00
chme
a0590ce548 [db/player] Icy metadata update 2016-12-03 11:12:19 +01:00
chme
c504abe451 Use queue db table instead of in memory queue struct 2016-12-03 11:11:33 +01:00
chme
faaeb92ce5 [player] Reading media_file_info is not necessary in source_pause 2016-12-03 10:58:26 +01:00
ejurgensen
51e6008ef6 Merge pull request #305 from chme/streamsetup
Reduce dependency to media file in stream setup methods
2016-11-26 17:43:24 +01:00
ejurgensen
bdd6bab982 [-] Lots of housekeeping thanks to scan-build and input from @acmay 2016-11-19 23:08:50 +01:00
chme
6690ba32eb [player/transcode/httpd] Pass path, data_kind and song_length to
transcode_decode_setup/transcode_setup
2016-11-12 09:11:40 +01:00
chme
477088a36c [player/pipe] Only pass path to pipe_setup 2016-11-12 09:11:40 +01:00
chme
2db3318ce7 [player/spotify] Only pass spotify-path to spotify_playback_setup 2016-11-12 09:11:40 +01:00
chme
bdb2c74934 [player/dacp/mpd] Pass absolute volume to speaker enumerate callback and
add absolute volume to mpd 'outputs' command
2016-10-25 22:40:48 +02:00
chme
3981c67e3a [player] Do not execute the bottom half if playback_start is called
while player is already playing (results in s segfault after adding new
items through dacp clients)
2016-10-23 08:25:19 +02:00
ejurgensen
b3a1e744d6 [player] Fix possible segfault on http timeouts
Cause: 1) av_read_frame blocks and times out, 2) cur_streaming gets set to NULL, 3) playback timer callback where cur_streaming gets deref
2016-09-25 22:19:59 +02:00
ejurgensen
ac290b8b65 [player] Config option to disable speaker autoselection (closes #282) 2016-09-10 23:26:06 +02:00
chme
da83af04e2 [player] Fix return value in repeat_set if repeat mode did not change 2016-08-06 06:36:42 +02:00