Commit Graph

38 Commits

Author SHA1 Message Date
ejurgensen
89807b61ed [input] Fix possible segfault-on-exit
Could occur if killed during playback (because input_stop() is async, thus
referencing cmdbase after it is destroyed)
2021-04-22 17:00:36 +02:00
ejurgensen
47779e59e7 [input] Fix memleak of path when seting up a new input file
Credit @whatdoineed2do

Closes #1067
2020-08-10 22:01:49 +02:00
ejurgensen
360e46683b [input] Add a simple input for testing timing 2020-05-12 22:25:38 +02:00
ejurgensen
e570cbdcbd [player] Use input progress metadata to update clients
Before, we were ignoring progress metadata, and we were also updating clients
and db too early with input metadata (right when read from the input, instead of
waiting until playback (speakers) were at that position.

This change adds a complicated async chain of events from when the update is
received.
2020-05-12 20:16:15 +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
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
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
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
5307c6d94b [player] Fix commit 3e9f8ef, input_resume() must be non-blocking (possibly issue #773) 2019-07-14 00:02:50 +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
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
ce2be1a724 [-] A bit of cleaning up 2019-04-10 22:38:48 +02:00
ejurgensen
ca56ac25ed [input] Forgot to not timeout if player actually did read 2019-03-23 23:41:09 +01:00
ejurgensen
95deef9c06 A bit of scan-build fixup 2019-03-22 22:15:13 +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
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
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
b56b56af07 [input] Cleaning up 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
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
a7e8476996 [outputs] Refactor outputs some more, eg change callback system 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
a9085e978d [input] Change input abstraction to use media_quality instead of input_quality 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
e96b9500db [transcode] Implement new ffmpeg decoding methods: avcodec_send_packet/avcodec_receive_frame 2017-08-06 22:20:44 +02:00
ejurgensen
074b4e773d [input] Increase input buffer size to two seconds 2017-07-08 23:37:12 +02:00
ejurgensen
5d74c98431 [input] Pass read errors to the player through the input buffer 2017-03-11 19:23:49 +01:00
ejurgensen
dc84294348 [input/pipe] Parse basic Shairport metadata using mxml 2017-01-28 22:19:51 +01:00
ejurgensen
67d0504700 [input] Let input_metadata_free zero metadata like the other free functions 2017-01-27 22:36:00 +01:00
ejurgensen
7b6a7b65b3 [input] Add interface for getting metadata from input modules 2017-01-27 22:36:00 +01:00
ejurgensen
acc67338a1 [input] Add a buffer full callback for the player 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
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