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