Merge branch 'v0.19.x'

This commit is contained in:
Max Kellermann 2016-08-15 12:32:42 +02:00
commit 743fa73a01
3 changed files with 47 additions and 11 deletions

6
NEWS
View File

@ -54,6 +54,12 @@ ver 0.20 (not yet released)
* update
- apply .mpdignore matches to subdirectories
ver 0.19.19 (not yet released)
* decoder
- wildmidi: support libWildMidi 0.4
* output
- pulse: support 32 bit, 24 bit and floating point playback
ver 0.19.18 (2016/08/05)
* decoder
- ffmpeg: fix crash with older FFmpeg versions (< 3.0)

View File

@ -65,6 +65,24 @@ wildmidi_finish(void)
WildMidi_Shutdown();
}
static DecoderCommand
wildmidi_output(Decoder &decoder, midi *wm)
{
#ifdef LIBWILDMIDI_VER_MAJOR
/* WildMidi 0.4 has switched from "char*" to "int8_t*" */
int8_t buffer[4096];
#else
/* pre 0.4 */
char buffer[4096];
#endif
int length = WildMidi_GetOutput(wm, buffer, sizeof(buffer));
if (length <= 0)
return DecoderCommand::STOP;
return decoder_data(decoder, nullptr, buffer, length, 0);
}
static void
wildmidi_file_decode(Decoder &decoder, Path path_fs)
{
@ -94,18 +112,11 @@ wildmidi_file_decode(Decoder &decoder, Path path_fs)
DecoderCommand cmd;
do {
char buffer[4096];
int len;
info = WildMidi_GetInfo(wm);
if (info == nullptr)
break;
len = WildMidi_GetOutput(wm, buffer, sizeof(buffer));
if (len <= 0)
break;
cmd = decoder_data(decoder, nullptr, buffer, len, 0);
cmd = wildmidi_output(decoder, wm);
if (cmd == DecoderCommand::SEEK) {
unsigned long seek_where =

View File

@ -679,11 +679,30 @@ PulseOutput::Open(AudioFormat &audio_format, Error &error)
return false;
}
/* MPD doesn't support the other pulseaudio sample formats, so
we just force MPD to send us everything as 16 bit */
audio_format.format = SampleFormat::S16;
/* Use the sample formats that our version of PulseAudio and MPD
have in common, otherwise force MPD to send 16 bit */
pa_sample_spec ss;
switch (audio_format.format) {
case SampleFormat::FLOAT:
ss.format = PA_SAMPLE_FLOAT32NE;
break;
case SampleFormat::S32:
ss.format = PA_SAMPLE_S32NE;
break;
case SampleFormat::S24_P32:
ss.format = PA_SAMPLE_S24_32NE;
break;
case SampleFormat::S16:
ss.format = PA_SAMPLE_S16NE;
break;
default:
audio_format.format = SampleFormat::S16;
ss.format = PA_SAMPLE_S16NE;
break;
}
ss.format = PA_SAMPLE_S16NE;
ss.rate = audio_format.sample_rate;
ss.channels = audio_format.channels;