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 <QtMultimedia/qaudioformat.h>
9#include <QtCore/qiodevice.h>
10#include <QtCore/qbytearray.h>
11#include <memory>
12
14
15#if QT_DEPRECATED_SINCE(6, 11)
16
18{
20
21public:
22 QT_DEPRECATED_VERSION_X_6_11("QWaveDecoder is deprecated. Please use QAudioDecoder instead.")
23 explicit QWaveDecoder(QIODevice *device, QObject *parent = nullptr);
24 QT_DEPRECATED_VERSION_X_6_11("QWaveDecoder is deprecated. Please use QAudioDecoder instead.")
25 explicit QWaveDecoder(QIODevice *device, const QAudioFormat &format, QObject *parent = nullptr);
27
30 int duration() const;
31 static qint64 headerLength();
32
34 void close() override;
35 bool seek(qint64 pos) override;
36 qint64 pos() const override;
38 qint64 size() const override;
39 bool isSequential() const override;
41
43 void formatKnown();
44 void parsingError();
45
46private Q_SLOTS:
47 void handleData();
48
49private:
51 qint64 writeData(const char *data, qint64 len) override;
52
53 bool writeHeader();
54 bool writeDataLength();
55 void parsingFailed();
56
57 struct chunk
58 {
59 char id[4];
61 };
62
63 struct RIFFHeader
64 {
66 char type[4];
67 };
68 struct WAVEHeader
69 {
77 };
78
79 struct DATAHeader
80 {
82 };
83
84 struct CombinedHeader
85 {
89 };
90 static const int HeaderLength = sizeof(CombinedHeader);
91
92 bool haveFormat = false;
93 bool haveHeader = false;
94 qint64 dataSize = 0;
95 QIODevice *device = nullptr;
97 std::unique_ptr<QByteArray> m_headerBuf; // accumulates bytes for dr_wav parsing
98 bool m_byteSwap = false; // true when WAV endian != host endian
99
100# if QT_POINTER_SIZE == 4
102# endif
103};
104
105#endif // QT_DEPRECATED_SINCE(6, 11)
106
108
109#endif // WAVEDECODER_H
\inmodule QtSql