libpulseaudio: support float and 24-bit packed output in sles sink
This commit is contained in:
parent
bdb7a8f4fd
commit
75dd068d87
@ -1,7 +1,7 @@
|
||||
TERMUX_PKG_HOMEPAGE=https://www.freedesktop.org/wiki/Software/PulseAudio
|
||||
TERMUX_PKG_DESCRIPTION="A featureful, general-purpose sound server - shared libraries"
|
||||
TERMUX_PKG_VERSION=12.2
|
||||
TERMUX_PKG_REVISION=8
|
||||
TERMUX_PKG_REVISION=9
|
||||
TERMUX_PKG_SHA256=809668ffc296043779c984f53461c2b3987a45b7a25eb2f0a1d11d9f23ba4055
|
||||
TERMUX_PKG_SRCURL=https://www.freedesktop.org/software/pulseaudio/releases/pulseaudio-${TERMUX_PKG_VERSION}.tar.xz
|
||||
TERMUX_PKG_DEPENDS="libltdl, libsndfile, libandroid-glob, libsoxr"
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include <pulsecore/rtpoll.h>
|
||||
|
||||
#include <SLES/OpenSLES.h>
|
||||
#include <SLES/OpenSLES_Android.h>
|
||||
|
||||
PA_MODULE_AUTHOR("Lennart Poettering, Nathan Martynov");
|
||||
PA_MODULE_DESCRIPTION("Android OpenSL ES sink");
|
||||
@ -125,10 +126,15 @@ static int pa_init_sles_player(struct userdata *u, pa_sample_spec *ss) {
|
||||
locator_bufferqueue.locatorType = SL_DATALOCATOR_BUFFERQUEUE;
|
||||
locator_bufferqueue.numBuffers = 8;
|
||||
|
||||
SLDataFormat_PCM pcm;
|
||||
pcm.formatType = SL_DATAFORMAT_PCM;
|
||||
SLAndroidDataFormat_PCM_EX pcm;
|
||||
if (ss->format == PA_SAMPLE_FLOAT32LE) {
|
||||
pcm.formatType = SL_ANDROID_DATAFORMAT_PCM_EX;
|
||||
pcm.representation = SL_ANDROID_PCM_REPRESENTATION_FLOAT;
|
||||
} else {
|
||||
pcm.formatType = SL_DATAFORMAT_PCM;
|
||||
}
|
||||
pcm.numChannels = ss->channels;
|
||||
pcm.samplesPerSec = ss->rate * 1000;
|
||||
pcm.sampleRate = ss->rate * 1000;
|
||||
pcm.bitsPerSample = pcm.containerSize = pa_sample_size(ss) * 8;
|
||||
pcm.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT;
|
||||
pcm.endianness = SL_BYTEORDER_LITTLEENDIAN;
|
||||
@ -249,7 +255,16 @@ int pa__init(pa_module*m) {
|
||||
ss = m->core->default_sample_spec;
|
||||
pa_channel_map_init_stereo(&map);
|
||||
|
||||
ss.format = ss.format > PA_SAMPLE_S16BE ? PA_SAMPLE_S32LE : PA_SAMPLE_S16LE;
|
||||
switch (ss.format) {
|
||||
case PA_SAMPLE_S16LE:
|
||||
case PA_SAMPLE_S24LE:
|
||||
case PA_SAMPLE_S32LE:
|
||||
case PA_SAMPLE_FLOAT32LE:
|
||||
break;
|
||||
default:
|
||||
pa_log("Sample format not supported");
|
||||
goto fail;
|
||||
}
|
||||
pa_modargs_get_sample_rate(ma, &ss.rate);
|
||||
ss.channels = map.channels;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user