summaryrefslogtreecommitdiffstats
path: root/src/multimedia/android/qopenslesengine_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/multimedia/android/qopenslesengine_p.h')
-rw-r--r--src/multimedia/android/qopenslesengine_p.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/multimedia/android/qopenslesengine_p.h b/src/multimedia/android/qopenslesengine_p.h
new file mode 100644
index 000000000..9918ac888
--- /dev/null
+++ b/src/multimedia/android/qopenslesengine_p.h
@@ -0,0 +1,65 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QOPENSLESENGINE_H
+#define QOPENSLESENGINE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <qglobal.h>
+#include <qaudio.h>
+#include <qlist.h>
+#include <qaudioformat.h>
+#include <qaudiodevice.h>
+#include <SLES/OpenSLES_Android.h>
+
+QT_BEGIN_NAMESPACE
+
+class QOpenSLESEngine
+{
+public:
+ enum OutputValue { FramesPerBuffer, SampleRate };
+
+ QOpenSLESEngine();
+ ~QOpenSLESEngine();
+
+ static QOpenSLESEngine *instance();
+
+ SLEngineItf slEngine() const { return m_engine; }
+
+ static SLAndroidDataFormat_PCM_EX audioFormatToSLFormatPCM(const QAudioFormat &format);
+
+ static QList<QAudioDevice> availableDevices(QAudioDevice::Mode mode);
+ static bool setAudioOutput(const QByteArray &deviceId);
+ QList<int> supportedChannelCounts(QAudioDevice::Mode mode) const;
+ QList<int> supportedSampleRates(QAudioDevice::Mode mode) const;
+
+ static int getOutputValue(OutputValue type, int defaultValue = 0);
+ static int getDefaultBufferSize(const QAudioFormat &format);
+ static int getLowLatencyBufferSize(const QAudioFormat &format);
+ static bool supportsLowLatency();
+ static bool printDebugInfo();
+
+private:
+ void checkSupportedInputFormats();
+ bool inputFormatIsSupported(SLAndroidDataFormat_PCM_EX format);
+ SLObjectItf m_engineObject;
+ SLEngineItf m_engine;
+
+ QList<int> m_supportedInputChannelCounts;
+ QList<int> m_supportedInputSampleRates;
+ bool m_checkedInputFormats;
+};
+
+QT_END_NAMESPACE
+
+#endif // QOPENSLESENGINE_H