decoder/sidplay: fix playback speed with libsidplayfp
https://bugs.musicpd.org/view.php?id=4577
This commit is contained in:
parent
11ba44870b
commit
49c04ccfc7
1
NEWS
1
NEWS
|
@ -1,6 +1,7 @@
|
||||||
ver 0.19.20 (not yet released)
|
ver 0.19.20 (not yet released)
|
||||||
* decoder
|
* decoder
|
||||||
- ffmpeg: ignore empty packets
|
- ffmpeg: ignore empty packets
|
||||||
|
- sidplay: fix playback speed with libsidplayfp
|
||||||
|
|
||||||
ver 0.19.19 (2016/08/23)
|
ver 0.19.19 (2016/08/23)
|
||||||
* decoder
|
* decoder
|
||||||
|
|
|
@ -354,12 +354,19 @@ sidplay_file_decode(Decoder &decoder, Path path_fs)
|
||||||
DecoderCommand cmd;
|
DecoderCommand cmd;
|
||||||
do {
|
do {
|
||||||
short buffer[4096];
|
short buffer[4096];
|
||||||
size_t nbytes;
|
|
||||||
|
|
||||||
nbytes = player.play(buffer, ARRAY_SIZE(buffer));
|
const auto result = player.play(buffer, ARRAY_SIZE(buffer));
|
||||||
if (nbytes == 0)
|
if (result <= 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef HAVE_SIDPLAYFP
|
||||||
|
/* libsidplayfp returns the number of samples */
|
||||||
|
const size_t nbytes = result * sizeof(buffer[0]);
|
||||||
|
#else
|
||||||
|
/* libsidplay2 returns the number of bytes */
|
||||||
|
const size_t nbytes = result;
|
||||||
|
#endif
|
||||||
|
|
||||||
decoder_timestamp(decoder, (double)player.time() / timebase);
|
decoder_timestamp(decoder, (double)player.time() / timebase);
|
||||||
|
|
||||||
cmd = decoder_data(decoder, nullptr, buffer, nbytes, 0);
|
cmd = decoder_data(decoder, nullptr, buffer, nbytes, 0);
|
||||||
|
|
Loading…
Reference in New Issue