summaryrefslogtreecommitdiffstats
path: root/tests/manual/audiodecoder/audiodecoder.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/audiodecoder/audiodecoder.h')
-rw-r--r--tests/manual/audiodecoder/audiodecoder.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/manual/audiodecoder/audiodecoder.h b/tests/manual/audiodecoder/audiodecoder.h
new file mode 100644
index 000000000..25ce6501b
--- /dev/null
+++ b/tests/manual/audiodecoder/audiodecoder.h
@@ -0,0 +1,55 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef AUDIODECODER_H
+#define AUDIODECODER_H
+
+#include <QAudioDecoder>
+#include <QSoundEffect>
+#include <QTextStream>
+#include <QWaveDecoder>
+
+class AudioDecoder : public QObject
+{
+ Q_OBJECT
+
+public:
+ AudioDecoder(bool isPlayback, bool isDelete, const QString &targetFileName);
+ ~AudioDecoder();
+
+ void setSource(const QString &fileName);
+ void start();
+ void stop();
+ QAudioDecoder::Error getError();
+
+ void setTargetFilename(const QString &fileName);
+
+signals:
+ void done();
+
+public slots:
+ void bufferReady();
+ void error(QAudioDecoder::Error error);
+ void isDecodingChanged(bool isDecoding);
+ void finished();
+
+ void playbackStatusChanged();
+ void playingChanged();
+
+private slots:
+ void updateProgress();
+
+private:
+ bool m_isPlayback;
+ bool m_isDelete;
+ QAudioDecoder m_decoder;
+ QTextStream m_cout;
+
+ QString m_targetFilename;
+ QWaveDecoder *m_waveDecoder = nullptr;
+ QSoundEffect m_soundEffect;
+
+ qreal m_progress;
+};
+
+#endif // AUDIODECODER_H