summaryrefslogtreecommitdiffstats
path: root/src/multimedia/platform/qplatformaudiodecoder_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2021-06-14 15:42:59 +0200
committerLars Knoll <lars.knoll@qt.io>2021-06-17 23:13:28 +0200
commitaf1182b5e29afa0cd69f929d54da224019707214 (patch)
tree45c04b63af92bc43d7125494284a2347c9ae7dab /src/multimedia/platform/qplatformaudiodecoder_p.h
parent0bd8c0a36e8ccff03af7f6990298238455443ec4 (diff)
Fix the QAudioDecoder API
Adjust API after code review. Remove the audioFormat property. QAudioDecoder will now always decode to the native format used in the encoded file. QAudioBuffer will have the correct format set, and it's up to the app to handle this correctly. Remove state() and replace by isDecoding(). Change-Id: I6f2ac375d98b2d7c36aebaa729599f78699b1c7b Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io>
Diffstat (limited to 'src/multimedia/platform/qplatformaudiodecoder_p.h')
-rw-r--r--src/multimedia/platform/qplatformaudiodecoder_p.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/multimedia/platform/qplatformaudiodecoder_p.h b/src/multimedia/platform/qplatformaudiodecoder_p.h
index 91877e647..e097b79fa 100644
--- a/src/multimedia/platform/qplatformaudiodecoder_p.h
+++ b/src/multimedia/platform/qplatformaudiodecoder_p.h
@@ -66,8 +66,6 @@ class Q_MULTIMEDIA_EXPORT QPlatformAudioDecoder : public QObject
Q_OBJECT
public:
- virtual QAudioDecoder::State state() const { return m_state; }
-
virtual QUrl source() const = 0;
virtual void setSource(const QUrl &fileName) = 0;
@@ -77,17 +75,12 @@ public:
virtual void start() = 0;
virtual void stop() = 0;
- virtual QAudioFormat audioFormat() const = 0;
- virtual void setAudioFormat(const QAudioFormat &format) = 0;
-
virtual QAudioBuffer read() = 0;
virtual bool bufferAvailable() const = 0;
virtual qint64 position() const = 0;
virtual qint64 duration() const = 0;
- void stateChanged(QAudioDecoder::State newState);
- void formatChanged(const QAudioFormat &format);
void sourceChanged();
void error(int error, const QString &errorString);
@@ -95,7 +88,14 @@ public:
void bufferReady();
void bufferAvailableChanged(bool available);
+ void setIsDecoding(bool running = true) {
+ if (m_isDecoding == running)
+ return;
+ m_isDecoding = running;
+ emit q->isDecodingChanged(m_isDecoding);
+ }
void finished();
+ bool isDecoding() const { return m_isDecoding; }
void positionChanged(qint64 position);
void durationChanged(qint64 duration);
@@ -108,9 +108,9 @@ protected:
private:
QAudioDecoder *q = nullptr;
- QAudioDecoder::State m_state = QAudioDecoder::StoppedState;
QAudioDecoder::Error m_error = QAudioDecoder::NoError;
QString m_errorString;
+ bool m_isDecoding = false;
};
QT_END_NAMESPACE