diff options
author | Lars Knoll <lars.knoll@qt.io> | 2021-06-14 15:42:59 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2021-06-17 23:13:28 +0200 |
commit | af1182b5e29afa0cd69f929d54da224019707214 (patch) | |
tree | 45c04b63af92bc43d7125494284a2347c9ae7dab /src/multimedia/audio/qaudiodecoder.h | |
parent | 0bd8c0a36e8ccff03af7f6990298238455443ec4 (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/audio/qaudiodecoder.h')
-rw-r--r-- | src/multimedia/audio/qaudiodecoder.h | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/src/multimedia/audio/qaudiodecoder.h b/src/multimedia/audio/qaudiodecoder.h index 9dd257cc9..465bb3974 100644 --- a/src/multimedia/audio/qaudiodecoder.h +++ b/src/multimedia/audio/qaudiodecoder.h @@ -52,18 +52,11 @@ class Q_MULTIMEDIA_EXPORT QAudioDecoder : public QObject { Q_OBJECT Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) - Q_PROPERTY(State state READ state NOTIFY stateChanged) + Q_PROPERTY(bool isDecoding READ isDecoding NOTIFY isDecodingChanged) Q_PROPERTY(QString error READ errorString) Q_PROPERTY(bool bufferAvailable READ bufferAvailable NOTIFY bufferAvailableChanged) public: - enum State - { - StoppedState, - DecodingState - }; - Q_ENUM(State) - enum Error { NoError, @@ -77,8 +70,8 @@ public: explicit QAudioDecoder(QObject *parent = nullptr); ~QAudioDecoder(); - bool isAvailable() const; - State state() const; + bool isSupported() const; + bool isDecoding() const; QUrl source() const; void setSource(const QUrl &fileName); @@ -86,9 +79,6 @@ public: QIODevice* sourceDevice() const; void setSourceDevice(QIODevice *device); - QAudioFormat audioFormat() const; - void setAudioFormat(const QAudioFormat &format); - Error error() const; QString errorString() const; @@ -106,9 +96,7 @@ Q_SIGNALS: void bufferAvailableChanged(bool); void bufferReady(); void finished(); - - void stateChanged(QAudioDecoder::State newState); - void formatChanged(const QAudioFormat &format); + void isDecodingChanged(bool); void error(QAudioDecoder::Error error); @@ -124,7 +112,6 @@ private: QT_END_NAMESPACE -Q_MEDIA_ENUM_DEBUG(QAudioDecoder, State) Q_MEDIA_ENUM_DEBUG(QAudioDecoder, Error) #endif // QAUDIODECODER_H |