Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwavedecoder.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:critical reason:data-parser
4
5#ifndef WAVEDECODER_H
6#define WAVEDECODER_H
7
8#include <QtCore/qiodevice.h>
9#include <QtMultimedia/qaudioformat.h>
10
11
13
14#if QT_DEPRECATED_SINCE(6, 11)
15
17{
19
20public:
21 QT_DEPRECATED_VERSION_X_6_11("QWaveDecoder is deprecated. Please use QAudioDecoder instead.")
22 explicit QWaveDecoder(QIODevice *device, QObject *parent = nullptr);
23 QT_DEPRECATED_VERSION_X_6_11("QWaveDecoder is deprecated. Please use QAudioDecoder instead.")
24 explicit QWaveDecoder(QIODevice *device, const QAudioFormat &format, QObject *parent = nullptr);
26
29 int duration() const;
30 static qint64 headerLength();
31
33 void close() override;
34 bool seek(qint64 pos) override;
35 qint64 pos() const override;
37 qint64 size() const override;
38 bool isSequential() const override;
40
42 void formatKnown();
43 void parsingError();
44
45private Q_SLOTS:
46 void handleData();
47
48private:
50 qint64 writeData(const char *data, qint64 len) override;
51
52 bool writeHeader();
53 bool writeDataLength();
55 bool findChunk(const char *chunkId);
57 void parsingFailed();
58
59 enum State {
63 };
64
65 struct chunk
66 {
67 char id[4]; // A four-character code that identifies the representation of the chunk data
68 // padded on the right with blank characters (ASCII 32)
69 quint32 size; // Does not include the size of the id or size fields or the pad byte at the end of payload
70 };
71
72 bool peekChunk(chunk* pChunk, bool handleEndianness = true);
73
74 struct RIFFHeader
75 {
77 char type[4];
78 };
79 struct WAVEHeader
80 {
88 };
89
90 struct DATAHeader
91 {
93 };
94
95 struct CombinedHeader
96 {
100 };
101 static const int HeaderLength = sizeof(CombinedHeader);
102
103 bool haveFormat = false;
104 bool haveHeader = false;
105 qint64 dataSize = 0;
106 QIODevice *device = nullptr;
110 bool bigEndian = false;
111 bool byteSwap = false;
112 int bps = 0;
113};
114
115#endif // QT_DEPRECATED_SINCE(6, 11)
116
118
119#endif // WAVEDECODER_H
\inmodule QtSql