Commit Graph

3925 Commits

Author SHA1 Message Date
ejurgensen
16cfca1bfe [scan] Remove some id3 tags that ffmpeg parses better (issue #882)
ffmpeg parses TDA, TDAT, TYE, TYER and TDR these days, so there is no need
to do that in forked-daapd. Also the parsing of TDA/TDAT was incorrect,
since it is MMDD.
2020-01-14 20:33:39 +01:00
ejurgensen
dfd2a4ab14 [dacp] Increase current revision number even if there are no open requests
This change aligns with iTunes behavior. It also means that a client that is
not long polling can use the revision number (cmsr) value to check for changes.
2020-01-12 01:06:34 +01:00
ejurgensen
919906233c [logger] Adjust log repeat max 2020-01-12 01:06:34 +01:00
ejurgensen
92dee0386d [daap/dacp] Workaround so that libevent cleans up when a long poll is disconnected
See https://github.com/ejurgensen/forked-daapd/issues/870
2020-01-12 01:06:34 +01:00
ejurgensen
87cb3b8b58 [logger] Always limit repeated logging no matter the log level 2020-01-12 01:06:34 +01:00
ejurgensen
4fa7eb98a0 [daap/dacp] Fix for memleak when client hangs up 2020-01-12 01:05:59 +01:00
ejurgensen
8d21a66493 [logger] Suppress logging of many similar repeated messages 2020-01-12 01:05:59 +01:00
whatdoineed2do/Ray
609cba5f04 [alsa] multi alsa cfg section SEGV with no nickname - use 'card' when not specified 2020-01-06 15:38:32 +00:00
ejurgensen
cc78926721 [dacp] Support for volumeup, volumedown and mutetoggle (issue #873)
Mute toggle only supported via enable/disable
2020-01-03 23:40:16 +01:00
whatdoineed2do/Ray
7ea8eeae05 [alsa] cfg section typo using 'mixer_device_name' 2020-01-03 19:37:07 +00:00
ejurgensen
e61e98bcbb [player] Reverse args to player_speaker_get_byid() for consistency 2020-01-03 19:38:52 +01:00
ejurgensen
af1bc27dd5 [dacp] Support for dmcp.device-prevent-playback (issue #855) 2020-01-03 19:36:35 +01:00
ejurgensen
80b183c7ff [dacp] Fix for genres that have single quotes in their name (fixes #869) 2020-01-03 19:05:48 +01:00
ejurgensen
4e1e5efedc [alsa] Changes to commit 0cb4e0b: multiple devices 2020-01-03 19:02:39 +01:00
whatdoineed2do/Ray
0cb4e0b862 [outputs/conf] New multiple 'alsa' sections split from 'audio' 2020-01-02 23:51:59 +01:00
ejurgensen
8248d2fe9f [scan] Fix access violation if pls line has no '=' 2019-12-27 23:58:57 +01:00
ejurgensen
251080344e [alsa] Fix missing unsubscription when closing session (ref. #866) 2019-12-27 11:29:36 +01:00
ejurgensen
0c08e83811 [outputs] Fix segv due to incorrect array size (fix for issue #866)
If the number of quality subscriptions reaches max then this bug will be
triggered, because we will incorrectly use the last element of the
output_buffer for a subscription, thus losing the zero terminator.
2019-12-27 00:10:32 +01:00
ejurgensen
33f97f55f3 [player] Fix for #860, going to next track when consume is enabled 2019-12-17 20:58:47 +01:00
ejurgensen
b83023356b [db] Fix for time_added incorrectly updated (issue #852) 2019-12-04 20:57:21 +01:00
Will Saxon
f3ebb574ba Recognize '@' as an operator identical to ':' (#841)
* Recognize '@' as an operator identical to ':'

* Add comments

* Add shortened example query
2019-11-16 12:27:43 +01:00
ejurgensen
f5e59c9b26
[pipe] Allow sample rate of 88200
Ref. issue #838
2019-11-05 00:13:33 +01:00
ejurgensen
6f3c315dfc [db] Add missing declarations of media_kind column in commit 40c7522 (fixes issue #836) 2019-11-03 00:16:20 +01:00
ejurgensen
a4f9bb576d [xcode] Increase read timeout 15s -> 30s (ref. issue #728) 2019-11-02 08:56:10 -07:00
Christian Meffert
cafdb96329
Merge pull request #833 from chme/cache_control
[httpd] Force browsers to always revalidate their cache
2019-11-02 07:57:55 +01:00
ejurgensen
40c7522baa [db] Make Apple Music on Catalina work - part 2 (fix for issue #834)
Extends the playlist table with media_kind to handle playlist queries like
this from Apple Music:

/databases/71/containers?session-id=12345678&revision-number=4&delta=0&query=('dmap.itemname:Library%20name','com.apple.itunes.extended-media-kind:1','com.apple.itunes.extended-media-kind:32','com.apple.itunes.extended-media-kind:128','com.apple.itunes.extended-media-kind:65537')&meta=dmap.itemid,dmap.itemname,dmap.persistentid,dmap.parentcontainerid,com.apple.itunes.is-podcast-playlist,com.apple.itunes.special-playlist,com.apple.itunes.smart-playlist,dmap.haschildcontainers,com.apple.itunes.saved-genius,dmap.objectextradata
2019-11-01 15:44:53 -07:00
ejurgensen
a69e79e5ec [daap] Make Apple Music on Catalina work - part 1 (fix for issue #834)
Like with iTunes, it has adverse effects to announce support for DAAP groups,
so with this change we also check if user-agent is "Music" before deciding what
to announce.
2019-11-01 15:43:56 -07:00
ejurgensen
dd24c35b2f [misc] Add missing comparison in quality_is_equal() 2019-10-26 23:30:44 +02:00
ejurgensen
051e526b2c [pipe] Disallow 24 bit input, doesn't work currently
If 24 bit input needs to be transcoded, like it will for AirPlay, it
will fail in transcode.c, because XCODE_PCM24 actually produces 4-byte
samples.
2019-10-26 23:28:05 +02:00
chme
662bfa529b [httpd] Force browsers to always revalidate their cached versions
Setting Cache-Control to "no-cache" tells a client to always make a
request to check if the version in the client cache is still valid
(response code 403 not modified).
2019-10-26 12:01:15 +02:00
ejurgensen
85ab7c3057 [alsa] Fix playback of 24 bit audio (issue #830)
The player will write 24 bit samples using 3 bytes, not 4, so the appropriate
sample format is SND_PCM_FORMAT_S24_3LE, not SND_PCM_FORMAT_S24_LE.

For extra protection we also use snd_pcm_bytes_to_frames() instead of BTOS(),
because that way we can be more certain that the buffer is not too short for
snd_pcm_writei().
2019-10-22 19:51:51 +02:00
ejurgensen
41f51d43ac [pipe] Allow configuration of 32 bit input format (issue #830)
Should work with e.g. arecord -f S32_LE -r 96000 -c 2 -t wav
2019-10-21 21:54:12 +02:00
chme
4c835f4435 [player] Remove dead code and rework check if fetching queue item failed 2019-10-20 14:36:21 +02:00
chme
69d3c97b7e [player] Fix freeing of queue item if error happens during seek
Plus fix some code style issues and add more documentation
2019-10-20 14:36:21 +02:00
chme
6e5d6791ff [player/dacp/mpd/jsonapi] Combine seek commands into one with mode param
Also changes relative seeking behavior:
- seeking behind the the current track only switches to the previous
track, if we are not more than 3 seconds into the current track,
otherwise starts current track from the beginning
- seeking beyond the current track will start the next track from the
beginning
2019-10-20 14:36:21 +02:00
chme
d69f328973 [jsonapi] Support relative seeking 2019-10-20 14:36:21 +02:00
chme
ced11ef0c1 [player] Allow seeking by a relative amount of milliseconds 2019-10-20 14:36:21 +02:00
chme
dc9396886c [jsonapi] Set correct artwork url for pipe input 2019-10-20 08:39:18 +02:00
chme
7e6b8f740d [db] Add missing mapping of queue version into queue item on fetch 2019-10-20 08:38:40 +02:00
ejurgensen
547222ec2b
Merge pull request #821 from chme/master_vol
[player] Fix missing update of master volume in web interface
2019-09-26 22:17:37 +02:00
chme
e3edcb5b96 [player] Fix missing update of master volume in web interface
Activating/deactivating an output might change the master volume,
therefor send a volume change notification.
2019-09-26 08:11:29 +02:00
chme
2846287169 [jsonapi] Add endpoint "/api/outputs/{id}/toggle" to toggle outputs 2019-09-26 08:00:03 +02:00
ejurgensen
8cff93ce55 [streaming] A bit of fixing up 2019-09-22 23:08:35 +02:00
whatdoineed2do/Ray
586dc4342d [streaming] mem leak fix on client initiated disconnect; close callback cleans
up the session but not the evhhttp_request object alloc'd in
  httpd()-> event_base_loop() -> ... -> evhttp_request_new()
2019-09-22 23:08:35 +02:00
whatdoineed2do/Ray
c2ba1fdb63 [streaming,conf,xcode] review fixes 2019-09-22 22:58:32 +02:00
whatdoineed2do/Ray
008e11bfb8 [streaming] review: remove bps/channels from cfg, undoc icy_metaint cfg option 2019-09-22 22:58:32 +02:00
whatdoineed2do/Ray
7ccd32c354 [streaming] validate cfg for supported ffmpeg/mp3 sample_rates
$ fmpeg -h encoder=mp3
    ...
	Supported sample rates: 44100 48000 32000 22050 24000 16000 11025 12000 8000
	Supported sample formats: s32p fltp s16p
	Supported channel layouts: mono stereo
2019-09-22 22:58:32 +02:00
whatdoineed2do/Ray
8762891145 [streaming] configurable icy_metaint 2019-09-22 22:58:32 +02:00
whatdoineed2do/Ray
f5c3eb0c14 [streaming] refactor for sperate in/out streaming qualities and configurable streaming params 2019-09-22 22:58:32 +02:00
whatdoineed2do/Ray
07d297aaca [streaming] increase icy-metaint interval to 16k bytes 2019-09-22 22:58:32 +02:00
whatdoineed2do/Ray
554799ebc3 [streaming/xcode] configurable MP3 streaming bitrate 2019-09-22 22:58:32 +02:00
ejurgensen
cae790ed7e [pipe] Harden pict_tmpfile_recreate() against invalid input, take 2 2019-09-22 22:56:18 +02:00
ejurgensen
d2921e9444 [pipe] Harden pict_tmpfile_recreate() against invalid input 2019-09-22 20:27:47 +02:00
ejurgensen
56d3f42598 Fix a few gcc 8 / scan-build compiler warnings 2019-09-22 00:51:17 +02:00
ejurgensen
cf927e7daa [pipe] Fixup missing condition 2019-09-20 21:51:09 +02:00
ejurgensen
e1a0e366cf [dacp] Make sure Remote updates images from metadata pipes 2019-09-20 21:47:17 +02:00
ejurgensen
7316c060b8 [pipe/artwork] Support for artwork via Shairport metadata pipes, take 3
This implementation uses a tmpfile for storage of the artwork, plus it uses
artwork_get() which means that it scales the image as requested by the client.

It also does not create a tmpfile unless we actually receive artwork.
2019-09-20 21:47:17 +02:00
ejurgensen
ddb91e61ef [pipe/artwork] Support for artwork via Shairport metadata pipes, take 2
This implementation uses a tmpfile for storage of the artwork (instead of the
cache, which may not be enabled).
2019-09-20 21:47:17 +02:00
ejurgensen
69fafd873d [pipe/artwork] Support for artwork via Shairport metadata pipes
This implementation uses the cache for storage. Might change that to use a
tmpfile instead.
2019-09-20 21:47:17 +02:00
ejurgensen
2e149273e5 [cache] Clear stash if called with called with NULL 2019-09-20 21:47:17 +02:00
ejurgensen
1752901529 [misc] Change b64_* to wrap ffmpeg's base64 encoder/decoder
Using ffmpeg's is probably better than having our own, plus it provides us with
decoded length, which we will need to support artwork via pipe.
2019-09-20 21:47:17 +02:00
ejurgensen
e654276262 [alsa] Fix incorrect use of abs() for float, use fabs() instead 2019-09-18 21:28:15 +02:00
ejurgensen
6836a0f277 [mdns] Fix incorrect error check for getaddrinfo (can cause segfault)
Non-zero return from getaddrinfo is an error, so since *ai could be a null
pointer when derefenced in the following socket() call.
2019-09-18 21:18:01 +02:00
ejurgensen
4ab734343c [-] Free events on exit (turns out event_base_free does not free them)
Credit @whatdoineed2do, ref. pr #797
2019-09-09 22:23:00 +02:00
chme
d88182820c [mpd] Fix initial value of 'songpos' in play command 2019-09-07 08:31:31 +02:00
Christian Meffert
7925639f5b
Merge pull request #790 from chme/admin_settings
Introduce new settings for displaying the composer in the now playing page
2019-08-31 09:05:49 +02:00
Christian Meffert
73470113b6
Merge pull request #795 from whatdoineed2do/jsonapi-memleak
[jsonapi] potential memleaks on query_params.filter object
2019-08-30 19:31:44 +02:00
whatdoineed2do/Ray
6ad3d8dbef [jsonapi] potential memleaks on query_params.filter object 2019-08-28 21:35:29 +01:00
ejurgensen
ef9c0117c9 [input] Fix pipe playback bringing cpu to 100%
When pipe playback is started, but no data is written to the pipe, the input
loop would bring the cpu to 100%. This fix limits the loop like it was before
player refactor.
2019-08-28 22:23:11 +02:00
chme
a5c2d6c0f8 [spotify] Return widest image if no max width is given 2019-08-25 11:24:14 +02:00
chme
2cc310b646 [jsonapi] Expose reading and updating settings through the JSON API 2019-08-25 10:39:16 +02:00
chme
02dd0a9445 [settings] Add settings component
This adds a new settings component for user configurable options that
can be changed through the JSON API.
The settings are stored in the admin db table and not in the conf-file.
2019-08-25 10:39:16 +02:00
ejurgensen
78373af201 [cast] Add a simple delay to stream to a have little bit of sync
Since it is unknown how to do real sync on Chromecast, this commit instead adds
a primitive delay to the stream, so that it is at least somewhat closer to
Airplay/local audio.

Also some cleanup of unused stuff.
2019-08-23 19:45:17 +02:00
whatdoineed2do
a5987addd4 [db,jsonapi] case insensitive directory/file listing (#784)
* [db,jsonapi] case insensitive directory/file listing

* [jsonapi] file listing of playlist uses same VPATH ordering as per directory and files

* [db,jsonapi] sorting via existing S_VPATH

* [db] replace LOWER with COLLATE NOCASE
2019-08-21 22:54:34 +02:00
ejurgensen
9cb5810e9a [player] Avoid repeated resets on output delay when changing track (issue #781) 2019-08-18 23:12:10 +02:00
ejurgensen
19ba9d106a [input] Buffer full callback should also be made when source reading ends
Otherwise the player will wait infinitely
2019-08-18 23:10:56 +02:00
ejurgensen
b9b2874a2e [player] Possible fix for issue #781 where playback status is incorrect
pb_suspend() + pb_resume() during track changes made the playback status
incorrect, i.e. pb_session.source_list/playing_now would not match what the
input was actually writing. This attempts to solve it by resetting the
session when pb_suspend() is called, so that the input, input_buffer and
source_list come into sync.
2019-08-17 01:44:45 +02:00
ejurgensen
86339eee87 [input] Make input_resume() not reopen tracks that have finished playing
If playback was paused during the very last part of the track, the rest of the
track would be read into the input buffer and the input would be closed. With
this commit the input will not be reopened.

Also allow input_flush to be called with null argument.
2019-08-17 01:37:39 +02:00
ejurgensen
7dfe4c2b65 [daap] Always use S_PLAYLIST ordering for Q_PL (ref issue #785) 2019-08-13 21:35:07 +02:00
ejurgensen
f9bfec180f [raop] Fix possible infinite loop + wrong packet resend (fixes issue #775)
Fixes bugs which were due to incorrect handling of unsigned integer wrap-around:

1. Calling packet_resend() with seqnum + len greater than UINT16_MAX => infinite loop
2. Calling rtp_packet_get() with session->seqnum - seqnum greater than pktbuf_next => wrong packet
2019-08-10 22:41:04 +02:00
ejurgensen
6578f28621 [raop] Logging change to find cause of issue #775 2019-08-09 23:58:45 +02:00
chme
a87059265d [spotify] Require Spotify web API scope playlist-read-collaborative
Also exposes granted and required Spotify web API scope through the
forked-daapd JSON API.
2019-08-03 12:55:53 +02:00
Christian Meffert
d996b1ff09
Merge pull request #772 from whatdoineed2do/smartpl-dynamic-dates-context
[smartpl] generate dynamic dates for SMARTPL queries
2019-08-03 08:51:57 +02:00
whatdoineed2do/Ray
50232bc091 [streaming] icy-meta overflow fix (for artist+song title > 4064 bytes) 2019-08-01 12:42:20 +01:00
whatdoineed2do
0941cf51ff [streaming] support sending ICY metadata (title) (#732)
* [streaming] obey Icy-MetaData directive and send icy title

* [streaming] fix 'streaming_sessions' race conditions/dbl frees on shutdown

* [streaming] simplify icy meta sending logic

* [streaming] 'icy request' variable cleanup

* [streaming] icy-meta comment/logging cleanup
2019-07-31 16:34:11 +02:00
ejurgensen
cf173df805 [outputs] Fix issue where RTP packet is not available for retransmit
Check for sequence number did not account for wrap around, so e.g. a
request for seqnum 65335 when first was 65100 and last was 100 would
not work.
2019-07-20 20:37:22 +02:00
chme
772b18479d [smartpl] Refactor appending date expression to sql query 2019-07-14 20:51:46 +01:00
ejurgensen
5307c6d94b [player] Fix commit 3e9f8ef, input_resume() must be non-blocking (possibly issue #773) 2019-07-14 00:02:50 +02:00
ejurgensen
2f3ec36c6a [input] Fix for playback pause on http streams
This fixes a bug from commit 37ce8dd6 where seek_http (which is called when
pausing playback) for non-seekable streams would return -1, thus signalling
an error, even though it is not. The player would think that the stream
could not be played and then skip to the next item.
2019-07-12 19:15:31 +02:00
ejurgensen
3e9f8effa0 [player] Better fix for resuming playback af long pause (issue #766)
The fix in commit 3928ab6 broke resuming from an underrun, since it meant that
pb_resume() would flush the input buffer. With this fix it is possible to call
input_resume(), which will not flush the buffer if the source is already open.

Also renamed some functions in player.c for consistency.
2019-07-12 19:11:48 +02:00
whatdoineed2do/Ray
02d4ba1eaa [smartpl] remove dupl code from interval AFTER/BEFORE DATE 2019-07-11 18:48:29 +01:00
whatdoineed2do/Ray
62201e4128 [smartpl] handle intervals in 'week' as days due to lack of SQLite modifier support 2019-07-11 18:25:01 +01:00
whatdoineed2do/Ray
3dcd826513 [smartpl] date 'interval' handling defered to db/not using potentially inaccurate time_t calcaulations 2019-07-11 18:25:01 +01:00
whatdoineed2do/Ray
d31a8c1e05 [smartpl] generate dynamic dates for SMARTPL queries
For dates that require context (ie today, yesterday, N days ago etc) we want the
underlying SQL to respect the current time when running query;  a query that
requests items for 'today' should only find matches for the time it was run.
Current implementation would generated a fixed date (at the time the SMARTPL is
inserted into db) in the playlist table where as this commit understands the
context of the date.
2019-07-11 18:25:01 +01:00
ejurgensen
3928ab6f82 [player] Fix for resuming playback after long pause (issue #766)
After a long pause the input would close the source (due to INPUT_OPEN_TIMEOUT).

This change makes the player restart the input when resuming.
2019-07-09 23:12:20 +02:00
Christian Meffert
e608b763ef
Merge pull request #752 from whatdoineed2do/db-queue-quality
db queue to incl media quality info
2019-07-09 20:19:10 +02:00
whatdoineed2do/Ray
e0a18082f7 [web-src/jsonapi] move endpoint /api/update as PUT operation 2019-07-09 13:54:59 +02:00
whatdoineed2do/Ray
8c024387ae [web-src/jsonapi] endpoint GET /api/update/meta -> PUT /api/rescan 2019-07-09 13:54:59 +02:00
whatdoineed2do/Ray
e9c1a59ad2 [jsonapi] expose force metadata rescan via /api/update/meta endpoint 2019-07-09 13:54:59 +02:00
whatdoineed2do/Ray
8f311d4360 [library] support forced metadata scan of library, via '.meta-rescan' file 2019-07-09 13:54:59 +02:00
whatdoineed2do/Ray
9baba8f8db [smartpl] use start of today (ie 00:00) for DATE calculations 2019-07-06 18:52:58 +01:00
ejurgensen
528a175d99 [main] Conditionally disable functions deprecated by ffmpeg 4.0
av_register_all, av_lockmgr_register and avfilter_register_all
2019-07-03 20:29:31 +02:00
ejurgensen
a321667201 [xcode] Remove deprecated ffmpeg AVFormatContext filename field 2019-07-02 21:48:34 +02:00
ejurgensen
bc8e6794ad [cast] Fix some compiler warnings 2019-07-02 20:42:31 +02:00
ejurgensen
51d85d0975 [alsa] Fix for ALSA issues when source quality changes (issue #722, issue #744 and issue #754)
* Fix "clicks" during playback, especially on low buffer size devices
  Bug had two causes: Trying to write to the prebuf ringbuffer when it was full
  and writing new audio to the device without first having drained the prebuf,
  thus writing out of order.

* Use snd_pcm_drain() so alsa doesn't report underrun on playback session end
  Removes SNDRV_PCM_IOCTL_SYNC_PTR errors

* Fix missing error check of the return value from snd_pcm_avail (now use snd_pcm_avail_delay)
2019-06-22 21:53:09 +02:00
ejurgensen
a28e370c4f
Merge pull request #748 from chme/conf_deprecated
[conf] Gracefully handle the change of config options for modifying playlists
2019-06-16 22:05:08 +02:00
chme
94af51f19b [conf/logger] Log error message from libconfuse in forked-daapd log 2019-06-15 12:21:27 +02:00
chme
9351d905f2 [mpd] Handle deprecated config options gracefully 2019-06-15 12:21:27 +02:00
chme
7853f80269 [conf] Readd old config options in mpd section as deprecated 2019-06-15 12:21:27 +02:00
ejurgensen
0cb8907201 [streaming] Logging fix 2019-06-12 22:51:25 +02:00
whatdoineed2do/Ray
f194145b8e [jsonapi] queue/track responses incl type/bitrate/samplerate/channels 2019-06-12 16:52:46 +01:00
whatdoineed2do/Ray
e2d62a62a4 [scan] extract 'channels' from (files) audio and type/bitrate/samplerate/channels from streams 2019-06-12 16:52:02 +01:00
whatdoineed2do/Ray
b126a2fbc0 [db] add 'channels' to file/queue tbl 2019-06-12 16:52:02 +01:00
whatdoineed2do/Ray
c796db251d [db] schema v20.01 support codec type/bitrate/samplerate in queue tbl 2019-06-12 16:50:52 +01:00
Scott Shambarger
20f5118f75 [alsa] asoundlib.h should be alsa/asoundlib.h 2019-06-11 20:10:04 -07:00
chme
d35333139e [jsonapi] Fix segfault if no default playlist directory is set in conf 2019-06-01 08:12:38 +02:00
ejurgensen
4f5966c9ff [db] Speed up Q_PL query used by e.g. '/databases/1/containers' request
The previous solution would use subqueries to count the number of items and
streams in each playlist, which means that response time gets pretty slow if
there are many playlists.

This commit also includes a number of lesser db code changes.
2019-05-30 21:19:40 +02:00
chme
4434fe7a2c [jsonapi] Check for empty playlist name in queue/save 2019-05-30 11:23:22 +02:00
chme
2b4b9c747f [jsonapi] Add config options for saving playlists to config reply 2019-05-30 11:23:22 +02:00
whatdoineed2do/Ray
d28f7f43b7 [jsonapi,mpd,conf] save playlist via JSON api
- new endpoint api/queue/save?name= to .m3u via library_save()
- refact for common cfg for playlist save options
2019-05-30 07:23:04 +02:00
ejurgensen
380f1358d5 [xcode] Disable reconnect_at_eof, does not work with m3u8 (fixes #745)
Only fixes #745 with newer versions of ffmpeg. With ffmpeg 3.4 playback
will still get interrupted because av_read_frame returns an error.
2019-05-21 21:19:03 +02:00
ejurgensen
7bf90eb8cb [xcode] Fix for reading mono sources (ref issue #742) 2019-05-19 22:45:39 +02:00
Christian Meffert
cbd8d8a44d
Merge pull request #740 from whatdoineed2do/library-https-stream
[library] accept https:// streams
2019-05-18 07:36:45 +02:00
ejurgensen
b3d6211371 [db] Upgrade db schema to 21.0
Commit b3bfb0a and e1993bc change the triggers and calculation of id's in a way
that is not backwards compatible, so we need to make major schema upgrade.
2019-05-17 23:07:48 +02:00
ejurgensen
e1993bc7b6 [db] Comeback for the files-table insert trigger 2019-05-17 23:03:05 +02:00
ejurgensen
35a585c23e [scan] Use MusicBrainz and other tags to set songalbumid
Credit to @whatdoineed2do for finding tags and suggesting this change.
2019-05-17 23:03:05 +02:00
ejurgensen
b3bfb0a5f6 [db] Move calculation of artist/album id's from sqlite to code
The purpose of this is to support library backends making their own
calculation of these id's, which is relevant if they have more information
available than just album_artist and album.

This also removes a bunch of sqlite extension code plus some triggers, which
in itself is probably an improvement.
2019-05-17 23:03:05 +02:00
ejurgensen
c8650a0450 [cast] Put back Chromecast exclude option
Was removed by mistake in commit f8b0147
2019-05-16 23:04:33 +02:00
ejurgensen
31d852993f
Merge pull request #741 from whatdoineed2do/seekable-http-streams
Seekable http streams
2019-05-16 15:26:32 +02:00
ejurgensen
cd7bf45749
[alsa] Return ALSA the error code from buffer_write, not -1 2019-05-15 11:53:13 +02:00
whatdoineed2do/Ray
37ce8dd607 [inputs] enable seek on non-live http streams 2019-05-12 11:08:42 +01:00
whatdoineed2do/Ray
bc8a156132 [library] accept https:// streams 2019-05-12 11:07:08 +01:00
ejurgensen
c36df4fb8e [raop] Bring back forgotten keep-alive for Apple TV's
The keep-alive was accidently disabled by the player refactor (after v26.5).
2019-05-12 00:11:07 +02:00
ejurgensen
a208604c86 [player] More comprehensive attempt at fixing short tracks (issue #733)
Replace reading_next and reading_prev with a list of sources, so that we can
deal with short tracks, i.e. tracks where reading ends before playback starts.
2019-05-11 23:16:22 +02:00
ejurgensen
f793ad9f3e [player] Fix incorrect player state while buffering (partial fix for #738)
Player would return PLAYER_PLAYING when resuming playback after a pause, but
it should initially return PLAYER_PAUSED because it is still buffering.
2019-05-10 16:47:18 +02:00
ejurgensen
1948dcb959 [player] Quick fix for short track segfault (issue #733)
With short tracks reading ends before playback starts, so event_read_eof comes
before event_play_start, which causes playing_now to point to a null
reading_now.

With this change it will point to a non-null reading_prev, but note that in the
hopefully rare case of multiple short tracks, the playing_now pointer will
still be incorrect.
2019-05-05 23:21:28 +02:00
Ali Graham
c7cab8ef6f [websocket] disable ipv6 in ws_init if disabled in config 2019-05-05 22:45:28 +09:30
ejurgensen
9fcc3d2c01 [pipe] Fix double free of metadata strings (fixes #724) 2019-05-04 23:07:22 +02:00
ejurgensen
bc4b5275f3 [input] Make sure marker list is always ordered by pos
Otherwise the read size in input_read() becomes invalid and we segfault.
2019-05-01 23:11:39 +02:00
ejurgensen
c7b8b94163 [alsa] Set quality in device_open() (possible fix for issue #720) 2019-04-12 22:24:48 +02:00
ejurgensen
ce2be1a724 [-] A bit of cleaning up 2019-04-10 22:38:48 +02:00
ejurgensen
dc65cb5b76 [alsa] Make sync and sync evaluation period configurable 2019-04-09 21:45:16 +02:00
ejurgensen
40934e7162 [cast] Remove/disable some unused code
Leaving some of the MEDIA commands in, even though they are not used any more.
Might come in handy later.
2019-04-09 21:03:14 +02:00
ejurgensen
55d9d9e6bd [xcode/artwork] Drop support for ffmpeg legacy versions 2019-04-08 22:06:56 +02:00
ejurgensen
b33e2665a1 [xcode] Hardcode png/jpeg pix formats (fix for #717)
ffmpeg changed the behaviour of avcodec_default_get_format() so that it picks
AV_PIX_FMT_MONOBLACK instead of AV_PIX_FMT_RGB24 for the png encoder. That
makes the function of no use to us, so now the pix formats are just hardcoded
in the settings instead.
2019-04-08 21:30:29 +02:00
ejurgensen
02cd65a992 [alsa] New resample-based sync correction 2019-04-08 00:50:20 +02:00
ejurgensen
781a3c16ed [cast] Remove use of PAUSE, doesn't work with the mirroring app 2019-04-05 23:06:05 +02:00
ejurgensen
2c778a4da0 [cast] Remove check for appid, the session id check should suffice 2019-04-04 21:20:39 +02:00
ejurgensen
53780a7ef3 [xcode] Make sample rate + channels variable
This change is preparation to use ffmpeg's resampling capabilities to keep local
audio in sync (by up/downsampling slightly). This requires that sample rates are
not fixed for a transcode profile.

Added benefit of this is that we don't need quite as many xcode profiles.
2019-04-02 22:47:11 +02:00
ejurgensen
413ce25ec6 [cast] Fixup print mask 2019-03-28 23:22:49 +01:00
ejurgensen
9836280029 [player] Fix issue where sync timestamps are incorrect after pb_suspend() 2019-03-28 23:06:45 +01:00
ejurgensen
f1493db069 [player] Fix bug where device is always deselected before db_speaker_save() 2019-03-28 10:47:58 +01:00
ejurgensen
5f84fefd1b [player] Remove pause timer remnants (moved to input/output in prev commit) 2019-03-27 22:48:09 +01:00
ejurgensen
d10e8ab1a2 [player] Fix proceed to next if track cannot be opened 2019-03-27 22:29:28 +01:00
ejurgensen
9773d9b840 [cast] Fallback if new mirroring app not present + metadata (not working) 2019-03-26 23:13:09 +01:00
ejurgensen
6930fdb28d [alsa] Fix memleak: Missing free 2019-03-26 22:08:15 +01:00
ejurgensen
4a664cfa9f [player] Fix playback start not showing in some clients 2019-03-24 22:53:01 +01:00
ejurgensen
ca56ac25ed [input] Forgot to not timeout if player actually did read 2019-03-23 23:41:09 +01:00
ejurgensen
1b0892a53a [player] Fix player losing quality + invalid return values from source_read() 2019-03-23 23:10:23 +01:00
ejurgensen
7d0ae01e84 [raop] Fixup forgotten free of pktbuffer 2019-03-22 23:25:34 +01:00
ejurgensen
aa36353480 [player] Fixup crash if playback stops while sending metadata 2019-03-22 23:24:11 +01:00
ejurgensen
95deef9c06 A bit of scan-build fixup 2019-03-22 22:15:13 +01:00
ejurgensen
4fb45e84f2 [player/outputs] New metadata handling (wip) 2019-03-18 23:06:08 +01:00
ejurgensen
ab0a6055b9 [input] Refactor metadata handling + add playback wait timeout
Previously input_metadata_get() would retrieve artwork from the source being
read currently, which might not be the one that triggered the FLAG_METADATA
event. So to fix this the metadata is now read by the input module itself when
the METADATA event happens, and the result is stored with the marker.

The commit also includes a timer so that the input thread does loop forever
if the player never starts reading.

Also some refactoring of metadata + abolish input_metadata_get and
input_quality_get. The latter in an attempt to treat the two in the same way.
2019-03-18 23:06:08 +01:00
ejurgensen
992ab90876 [xcode] Fix missing "&" 2019-03-18 23:06:08 +01:00
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
daf7d755eb [input] Fix input writing too slowly for buffer to fill up after underrun
After an underrun the player doesn't read, so that meant input_wait would
wait a second before allowing the input to write, even though the input_buffer
was not full
2019-03-18 23:06:08 +01:00
ejurgensen
9b31264a3c [xcode] Use av_get_bytes_per_sample instead of av_get_bits_per_sample
av_get_bits_per_sample(ctx->settings.audio_codec) may return 0 with some codecs
2019-03-18 23:06:08 +01:00
ejurgensen
01797662de [cast] Fix segfault from cast_master_session not being reset 2019-03-18 23:06:08 +01:00
ejurgensen
f8b0147b12 [cast] First draft of Chromecast based on RTP (instead of mp3)
Includes adaptions to modified outputs interface
2019-03-18 23:06:08 +01:00
ejurgensen
9b6a892984 [rtp] Extra commenting about the RTP header 2019-03-18 23:06:08 +01:00
ejurgensen
d762bd0a56 [raop] master_session_free should allow null as argument 2019-03-18 23:06:08 +01:00
ejurgensen
3e4766ffaa [outputs] Fix segfault if encode_reset() fails to setup an encode_ctx 2019-03-18 23:06:08 +01:00
ejurgensen
1285128b9a [xcode] Fix incorrect source BPS detection + support for more audio qualities 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
63a2e750c7 [pulse] Convert Pulseaudio to new interface, incl support for native quality
First draft, probably has a few bugs
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
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