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.
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.
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
+ 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)
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).
* 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
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.
* 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.
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.