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.
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.