Commit 020e8018 authored by VaL Doroshchuk's avatar VaL Doroshchuk
Browse files

PulseAudio: Support 24 bit frames

Applied 24 bits frames support and also stronger restrictions
for supported formats: https://freedesktop.org/software/pulseaudio/doxygen/sample.html



Task-number: QTBUG-63427
Change-Id: If5372217cbf16c1152db55748adcfbd61263403d
Reviewed-by: default avatarChristian Stromme <christian.stromme@qt.io>
parent 2972eaa1
Branches
Tags
No related merge requests found
Showing with 16 additions and 13 deletions
...@@ -73,20 +73,23 @@ inline pa_sample_spec audioFormatToSampleSpec(const QAudioFormat &format) ...@@ -73,20 +73,23 @@ inline pa_sample_spec audioFormatToSampleSpec(const QAudioFormat &format)
spec.rate = format.sampleRate(); spec.rate = format.sampleRate();
spec.channels = format.channelCount(); spec.channels = format.channelCount();
spec.format = PA_SAMPLE_INVALID;
if (format.sampleSize() == 8) const bool isBigEndian = (format.byteOrder() == QAudioFormat::BigEndian);
spec.format = PA_SAMPLE_U8;
else if (format.sampleSize() == 16) { if (format.sampleType() == QAudioFormat::UnSignedInt) {
switch (format.byteOrder()) { if (format.sampleSize() == 8)
case QAudioFormat::BigEndian: spec.format = PA_SAMPLE_S16BE; break; spec.format = PA_SAMPLE_U8;
case QAudioFormat::LittleEndian: spec.format = PA_SAMPLE_S16LE; break; } else if (format.sampleType() == QAudioFormat::SignedInt) {
} if (format.sampleSize() == 16) {
} spec.format = isBigEndian ? PA_SAMPLE_S16BE : PA_SAMPLE_S16LE;
else if (format.sampleSize() == 32) { } else if (format.sampleSize() == 24) {
switch (format.byteOrder()) { spec.format = isBigEndian ? PA_SAMPLE_S24BE : PA_SAMPLE_S24LE;
case QAudioFormat::BigEndian: spec.format = PA_SAMPLE_S32BE; break; } else if (format.sampleSize() == 32) {
case QAudioFormat::LittleEndian: spec.format = PA_SAMPLE_S32LE; break; spec.format = isBigEndian ? PA_SAMPLE_S32BE : PA_SAMPLE_S32LE;
} }
} else if (format.sampleType() == QAudioFormat::Float) {
if (format.sampleSize() == 32)
spec.format = isBigEndian ? PA_SAMPLE_FLOAT32BE : PA_SAMPLE_FLOAT32LE;
} }
return spec; return spec;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment