Merge branch 'v0.19.x'
This commit is contained in:
commit
35a2a48c47
4
NEWS
4
NEWS
@ -57,7 +57,11 @@ ver 0.20 (not yet released)
|
||||
ver 0.19.20 (not yet released)
|
||||
* decoder
|
||||
- ffmpeg: ignore empty packets
|
||||
- pcm: fix corruption bug with partial frames (after short read)
|
||||
- sidplay: fix playback speed with libsidplayfp
|
||||
* output
|
||||
- winmm: fix 8 bit playback
|
||||
* fix gcc 7.0 -Wimplicit-fallthrough
|
||||
|
||||
ver 0.19.19 (2016/08/23)
|
||||
* decoder
|
||||
|
@ -66,8 +66,8 @@
|
||||
<function>strcpy</function> just fine with UTF-8 encoded
|
||||
strings. For example: <returnvalue>OK</returnvalue> encoded in
|
||||
UTF-8 is simply <returnvalue>OK</returnvalue>. For more
|
||||
information on UTF=8:
|
||||
http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8)
|
||||
information on UTF-8:
|
||||
<ulink url="http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8"/>)
|
||||
</para>
|
||||
</section>
|
||||
|
||||
|
@ -25,16 +25,34 @@
|
||||
#include "system/ByteOrder.hxx"
|
||||
#include "util/Domain.hxx"
|
||||
#include "util/ByteReverse.hxx"
|
||||
#include "util/StaticFifoBuffer.hxx"
|
||||
#include "util/NumberParser.hxx"
|
||||
#include "util/MimeType.hxx"
|
||||
#include "Log.hxx"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
static constexpr Domain pcm_decoder_domain("pcm_decoder");
|
||||
|
||||
template<typename B>
|
||||
static bool
|
||||
FillBuffer(Decoder &decoder, InputStream &is, B &buffer)
|
||||
{
|
||||
buffer.Shift();
|
||||
auto w = buffer.Write();
|
||||
assert(!w.IsEmpty());
|
||||
|
||||
size_t nbytes = decoder_read(decoder, is, w.data, w.size);
|
||||
if (nbytes == 0 && is.LockIsEOF())
|
||||
return false;
|
||||
|
||||
buffer.Append(nbytes);
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
pcm_stream_decode(Decoder &decoder, InputStream &is)
|
||||
{
|
||||
@ -128,25 +146,27 @@ pcm_stream_decode(Decoder &decoder, InputStream &is)
|
||||
decoder_initialized(decoder, audio_format,
|
||||
is.IsSeekable(), total_time);
|
||||
|
||||
StaticFifoBuffer<uint8_t, 4096> buffer;
|
||||
|
||||
DecoderCommand cmd;
|
||||
do {
|
||||
char buffer[4096];
|
||||
|
||||
size_t nbytes = decoder_read(decoder, is,
|
||||
buffer, sizeof(buffer));
|
||||
|
||||
if (nbytes == 0 && is.LockIsEOF())
|
||||
if (!FillBuffer(decoder, is, buffer))
|
||||
break;
|
||||
|
||||
auto r = buffer.Read();
|
||||
/* round down to the nearest frame size, because we
|
||||
must not pass partial frames to decoder_data() */
|
||||
r.size -= r.size % frame_size;
|
||||
buffer.Consume(r.size);
|
||||
|
||||
if (reverse_endian)
|
||||
/* make sure we deliver samples in host byte order */
|
||||
reverse_bytes_16((uint16_t *)buffer,
|
||||
(uint16_t *)buffer,
|
||||
(uint16_t *)(buffer + nbytes));
|
||||
reverse_bytes_16((uint16_t *)r.data,
|
||||
(uint16_t *)r.data,
|
||||
(uint16_t *)(r.data + r.size));
|
||||
|
||||
cmd = nbytes > 0
|
||||
? decoder_data(decoder, is,
|
||||
buffer, nbytes, 0)
|
||||
cmd = !r.IsEmpty()
|
||||
? decoder_data(decoder, is, r.data, r.size, 0)
|
||||
: decoder_get_command(decoder);
|
||||
if (cmd == DecoderCommand::SEEK) {
|
||||
uint64_t frame = decoder_seek_where_frame(decoder);
|
||||
@ -154,6 +174,7 @@ pcm_stream_decode(Decoder &decoder, InputStream &is)
|
||||
|
||||
try {
|
||||
is.LockSeek(offset);
|
||||
buffer.Clear();
|
||||
decoder_command_finished(decoder);
|
||||
} catch (const std::runtime_error &e) {
|
||||
LogError(e);
|
||||
|
@ -223,6 +223,10 @@ AlsaInputStream::Recover(int err)
|
||||
case -EPIPE:
|
||||
LogDebug(alsa_input_domain, "Buffer Overrun");
|
||||
// drop through
|
||||
#if GCC_CHECK_VERSION(7,0)
|
||||
[[fallthrough]];
|
||||
#endif
|
||||
|
||||
case -ESTRPIPE:
|
||||
case -EINTR:
|
||||
err = snd_pcm_recover(capture_handle, err, 1);
|
||||
|
@ -774,6 +774,9 @@ AlsaOutput::Recover(int err)
|
||||
if (err == -EAGAIN)
|
||||
return 0;
|
||||
/* fall-through to snd_pcm_prepare: */
|
||||
#if GCC_CHECK_VERSION(7,0)
|
||||
[[fallthrough]];
|
||||
#endif
|
||||
case SND_PCM_STATE_SETUP:
|
||||
case SND_PCM_STATE_XRUN:
|
||||
period_position = 0;
|
||||
|
@ -161,10 +161,10 @@ WinmmOutput::Open(AudioFormat &audio_format)
|
||||
throw std::runtime_error("CreateEvent() failed");
|
||||
|
||||
switch (audio_format.format) {
|
||||
case SampleFormat::S8:
|
||||
case SampleFormat::S16:
|
||||
break;
|
||||
|
||||
case SampleFormat::S8:
|
||||
case SampleFormat::S24_P32:
|
||||
case SampleFormat::S32:
|
||||
case SampleFormat::FLOAT:
|
||||
|
Loading…
Reference in New Issue
Block a user