Commit Graph

381 Commits

Author SHA1 Message Date
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
chme
30d43bef4f [player] Fix return value in volume_setrel_speaker if device is not
selected
2016-08-06 06:34:34 +02:00
chme
2ae94e8f82 [player] Fix return value in playback_prev_bh if source_open failed 2016-08-06 06:31:09 +02:00
chme
cd9a3bae07 [player] Fix return value in playback_start_item if source_open failed 2016-08-06 06:29:55 +02:00
ejurgensen
547783d008 Merge pull request #268 from chme/threadexit
Refactor thread exit handling
2016-06-11 22:57:09 +02:00
chme
32ac6c2ea9 [commands] Rename commands_cmdloop_break to commands_base_destroy and
free commands_base after breaking the libevent loop
2016-06-11 10:56:27 +02:00
chme
a9a656042b [player] Cleanup: player clock is the only sync-source available 2016-06-11 10:37:09 +02:00
chme
5258ee712c [commands] Added functionality to break the event loop of a command base 2016-06-11 09:52:31 +02:00
chme
5dc1cba5c8 On deinit free event base before freeing command base and pipes 2016-05-21 06:48:02 +02:00
chme
3c9a7d9119 [player] Use generic commands for inter thread communication 2016-05-15 08:42:15 +02:00
ejurgensen
9a56044c77 [misc] Explicitly check for pthread_setname_np/pthread_set_name_np
Seems there is no pthread_setname_np in OpenWrt
2016-05-05 19:39:15 +02:00
ejurgensen
1f10c6a928 [player] Always reselect output devices when they return online
Consider this use case:
1. Playback stops, device switched off
2. Device switched back on, playback started by user
Before this commit, the device would be unselected when it came back on.
I don't think that is desirable, so with this commit the selection will
stay (except if the device comes back on during playback).
2016-04-30 23:55:45 +02:00
ejurgensen
960f89fcbd [player] Remove unused var 2016-04-14 10:04:21 +02:00
ejurgensen
857055a18d [player] Insert duplicate packets slowly on timer overrun 2016-04-14 09:48:48 +02:00
ejurgensen
acc1ff4a47 [player] Sort devices and autoselect based on priority 2016-04-14 09:48:47 +02:00
ejurgensen
c5bb83480d [alsa] Add rewritten ALSA to generic outputs interface 2016-04-14 09:48:47 +02:00
ejurgensen
617303d545 [player] Purge laudio from player.c 2016-04-14 09:48:47 +02:00
ejurgensen
36755031cb [outputs] Make a wrapper for mp3 streaming so it can be included in
the generic outputs interface and so special handling in player.c can
be removed
2016-04-14 09:48:47 +02:00
ejurgensen
a07c24d625 [player] Fix possible segfault after playback stop on FreeBSD/machines with lo-res timers 2016-04-14 08:55:59 +02:00
chme
1fb1fc7d2d [player] Add config option to disable clearing the queue after playback
stops (default is clearing the queue) and if true do not clear the
queue.

This option is necessary because some dacp clients rely on the queue
being empty if player is stopped. Retune for example does not always
show the queue contents if player state is stopped.
2016-03-20 07:45:21 +01:00
chme
e3750957f5 [player] Allow removing by position (dacp-requests) if player is stopped 2016-03-19 09:40:36 +01:00
chme
ed2fe682fe [player] Allow moving by position (dacp-requests) if player is stopped 2016-03-19 09:40:36 +01:00
chme
d35894ac15 [mpd] Return correct item-id for command 'addid' and return correct
number of items in the queue if player is stopped for command 'status'
2016-03-19 09:40:36 +01:00
ejurgensen
b454a2fd60 [general] Put back support for platforms without pipe2(), see issue #239 2016-03-17 22:20:16 +01:00
ejurgensen
abce1d0eeb Merge pull request #237 from chme/threadnames
Set thread names
2016-03-12 17:18:34 +01:00
chme
98d6db002f Set thread names to make it easier to identify threads during debugging 2016-03-12 14:01:08 +01:00
chme
9a5b67031e [player] Remove unnecessary check for plid != 0 and set plid always to 0
if queue changed
2016-03-12 14:01:08 +01:00
ejurgensen
bd61399e49 [player] Only catch up by lowering sample rate if data_kind is http or pipe 2016-03-06 10:55:10 +01:00
ejurgensen
3000341acd [player] Different timer catch up for files + remove timer abort
Timer abort should no longer apply since we may catch up for more
than a second. Introduce separate catch up strategies for files and
streams, since for files we can read at our own pace.
2016-02-28 22:28:37 +01:00
chme
494a936caa [mpd] Implement mpd command 'move' 2016-02-21 19:01:52 +01:00
ejurgensen
a824f73779 [player] Remove some debug log messages 2016-02-12 22:00:10 +01:00
ejurgensen
bd75281340 [player] Save speaker name and rename raop_ to output_ 2016-02-11 20:04:30 +01:00
ejurgensen
483a428bae [chromecast] Try to improve session handling + actually remove device on mdns cb 2016-02-11 20:04:29 +01:00
ejurgensen
e4d209f8a0 [chromecast] Support for most basic functionality 2016-02-11 20:04:29 +01:00
ejurgensen
ffe8653d9e [chromecast] Remove RAOP specifics from player.c, add generic output interface 2016-02-11 20:04:29 +01:00
ejurgensen
4c887ba7bb [chromecast] First building blocks for supporting ChromeCast 2016-02-11 20:04:29 +01:00
ejurgensen
62eb1a067d [player] Rename ticks to overrun and safeguard against decreasing from 0 2016-02-11 20:02:17 +01:00
ejurgensen
5f5a138c77 [player] Fix for player getting ahead of network streams (issue #218)
Issue caused stuttering after a few hours. This fix will check if
the player is getting behind the playback timer. Apparently, we
sometimes get samples at a rate slightly below 44100 from network
streams, and then we end up consuming too quickly. This introduces
a way of reducing consumption if that happens.
2016-02-11 08:29:29 +01:00
chme
b2d2e9286f [mpd] implement range support for 'delete' command 2015-11-22 12:06:01 +01:00
chme
8fc8d08b42 [player] Add missing notification of playlist changes after removing an
item from the playlist
2015-11-21 14:23:06 +01:00
ejurgensen
316af87189 Merge pull request #193 from chme/mpd
[mpd] Add support for moveid and close command
2015-10-31 11:31:27 +01:00
chme
1c409846d5 [player/queue] Add player commands to move queue-items by item-id 2015-10-31 07:56:50 +01:00
chme
94895b8eed [player] if source is not pausable (http-streams or pipe) abort playback
on pause command 

This restores the behaviour before the queue/player-refactoring.
2015-10-25 09:00:47 +01:00
ejurgensen
3e80e5c517 [transcode] Don't pass error to player on eof + some comments and cleaning 2015-10-22 22:09:19 +02:00
ejurgensen
9853b8f9bd Merge pull request #188 from chme/playerfixes
Playerfixes
2015-10-19 22:15:43 +02:00
chme
7592462571 [player] Fix segfault if reading from source failed for all queue items 2015-10-19 21:33:43 +02:00
ejurgensen
55104015e0 Full removal of libevent 1 legacy code. Also drop pipe() in FreeBSD, since pipe2 is available now. 2015-10-19 21:15:29 +02:00
ejurgensen
2a610812a5 Refactor transcode.c so it can actually transcode + use new capability to support mp3 streaming.
Also includes the skeleton for perhaps supporting video in the future. Adds more fine-grained
ffmpeg/libav compability checks. Dependency on libavresample/libswresample exchanged with
dependency on libavfilter, which seems more versatile.
2015-10-09 23:58:27 +02:00
chme
199b765a7d [player] Store item-ids in history to allow start of playback from the
previously played items in dacp
2015-10-04 08:05:37 +02:00
chme
b19a7280b9 [player] remove unused player_queue struct 2015-10-04 08:05:37 +02:00
chme
fbce3a7d57 [player] Confusing naming of ids cleaned up 2015-10-04 08:05:37 +02:00
chme
ba3385b0ec [queue] Remove queue_info and queue_item_info structs 2015-10-04 08:05:37 +02:00
chme
064dfef2de [player] cleanup metadata_trigger
metadata_trigger is always called for the current streaming item and
source_open makes sure that the stream_start and output_start values are
set correctly
2015-10-04 08:05:36 +02:00
chme
64698eb3a4 [player] Some minor cleanup (error handling, comments) 2015-10-04 08:05:36 +02:00
chme
a06424a701 [mpd] Expose queue-item-id instead of dbmfi-id in mpd commands
[player] Reshuffle on end of playlist and repeat mode is "repeat all"
2015-10-04 07:59:58 +02:00
chme
cb2805800b [player] Fix segfault if pause requested in the last two seconds of the
last item in the playqueue (cur_streaming is already NULL)
2015-10-04 07:59:58 +02:00
chme
2b037b67d9 [player] Combine stream_stop and stream_cleanup into one function 2015-10-04 07:59:58 +02:00
chme
e44a160b9a [player] Improve error handling 2015-10-04 07:59:58 +02:00
chme
4595a2f4a6 [player] Add missing metadata trigger on item change (after eof) 2015-10-04 07:59:58 +02:00
chme
c8a61015fc [dacp] Fix playing of radio streams after queue refactoring 2015-10-04 07:59:58 +02:00
chme
58069e67f8 [player/spotify] adjust spotify integration to refactoring of player 2015-10-04 07:59:58 +02:00
chme
e1147c00a1 [player] Refactor player to better fit the queue refactor 2015-10-04 07:59:58 +02:00
chme
1f53d7ab1a [queue] Refactor queue handling
Decouple the playing/streaming item from the queue. Move all queue
related functions to seperate file queue.h/c.
Introduce internal item "head" to make iterating over the play-queue and
shuffle-queue easier.
2015-10-04 07:59:57 +02:00
chme
10d7097f98 [player] rename "queue_*"-functions to "playerqueue_*" (avoid naming
conflicts with later introduced separate queue file
2015-10-04 07:57:39 +02:00
chme
1fbedaa54f [player] Refactor queue_get 2015-10-04 07:57:38 +02:00
chme
f0a6a48599 [player] Refactor queue_remove functions 2015-10-04 07:57:38 +02:00
chme
1812848ee1 Move client protocol specific make_queue functions out of player.c/h 2015-10-04 07:57:38 +02:00
ejurgensen
4db6318a82 Fix issue where volume gets set to -1 on startup of raop devices 2015-09-27 15:24:04 +02:00
ejurgensen
68912efa1f Enable resuming playback from saved position for certain media kinds (eg audiobooks) 2015-08-04 22:33:32 +02:00
ejurgensen
d870b97142 Remove LastFM thread now that it can run from the worker thread 2015-06-27 23:24:07 +02:00
ejurgensen
4fffc057b6 Change queue_remove() to fix segfault because source_head/shuffle_head could become invalid, and to protect against invalid input in general (ref issue #160).
Also try to failsafe source_position() and implement next_ps() all around.
2015-06-08 00:21:49 +02:00
ejurgensen
79cdfebf34 Merge pull request #150 from chme/mpdidle
Add support for mpd idle command
2015-05-21 22:31:03 +02:00
chme
3886ec6638 Add version number for playlist (queue)
This is necessary to return a valid playlist id for mpd status command.
2015-05-09 07:46:33 +02:00
chme
aa4a12cabe add events for playlist (queue), volume, speaker, options
(random/shuffle) changes
2015-05-09 07:46:33 +02:00
chme
d2c7c87191 use listener logic to send dacp update requests 2015-05-09 07:46:33 +02:00
chme
36499f4997 [player] added some source code comments 2015-05-09 07:46:33 +02:00
chme
600e48842f [mpd] idle command 2015-05-09 07:46:33 +02:00
chme
fb92040d4b expose generic player_queue_make function 2015-05-09 07:35:15 +02:00
chme
3832692929 move setting query_params.sort out of generic queue make function 2015-05-09 07:35:14 +02:00
chme
3a495a3d48 move setting query_params.idx_type out of generic queue make function 2015-05-09 07:35:14 +02:00
chme
d19fbe5ed7 fix first item is not shuffled 2015-05-05 18:44:02 +02:00
chme
659f9c09bb Use enum values for data_kind and media_kind 2015-04-23 11:34:44 +02:00
ejurgensen
8a0994860f Ignore empty ICY StreamTitles 2015-04-12 18:15:06 +02:00
ejurgensen
99cda05dab Remove player metadata event timer (use the existing instead) 2015-04-11 20:30:31 +02:00
ejurgensen
0397b824a5 Fixup (select between cur_playing and cur_streaming) 2015-04-09 22:33:23 +02:00
ejurgensen
e72447954a Some cleaning up of ICY artwork retrieval 2015-04-09 22:22:42 +02:00
ejurgensen
f1931bfc1a Abandon raop_metadata_arg, and defer metadata time setting 2015-04-09 21:04:35 +02:00
ejurgensen
ad81e05ab4 Better thread safety by making sure that the raop globals are only accessed through the player thread 2015-04-07 23:35:56 +02:00
ejurgensen
e49c941a00 Add a worker thread to support async tasks from the player thread
(and maybe others later)
2015-03-31 23:05:24 +02:00
ejurgensen
b8d8df132b Support for remote m3u playlists (ref pr #79) 2015-03-20 23:40:42 +01:00
ejurgensen
6221e24f1b Support for live ICY metadata for streams (incl. artwork) 2015-03-14 21:42:53 +01:00
chme
4a1bff500a [mpd] fixes for commands noidle, list (handle special case with second
argument 'album'), addid (sql error if virtual path contains
character ') and fix error messages in various commands
2015-03-10 22:12:33 +01:00
ejurgensen
1a0d2ef59b Reduce log severity 2015-02-28 15:16:19 +01:00
chme
1923e7b67d silence compiler warning in player.c "warning: ignoring return value of
‘read’ ..."
2015-02-28 08:00:10 +01:00
chme
63a480d5fc refactor playback_start, added comments to clarify the use of
item_range, renamed some variables (avoid using "song")
2015-02-14 22:39:51 +01:00
chme
830054bd71 Initial support for mpd protocol 2015-02-14 08:50:18 +01:00
chme
07b4d6b6a9 first song not shuffled 2015-02-01 10:51:43 +01:00
ejurgensen
b1903e4551 Always try to start AirPlay when laudio fails (issue #86) 2015-01-16 23:18:21 +01:00
ejurgensen
a3a689573f Better define in player.c 2014-09-28 22:14:30 +02:00
ejurgensen
1ffbfd8c45 Proper update to libevent 2 in player.c 2014-09-28 22:09:22 +02:00
ejurgensen
965df4fdfc Delete event after disarming timer (maybe not necessary, but for safety) 2014-09-28 15:30:52 +02:00