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
13
QT_BEGIN_NAMESPACE
14
15
#
if
QT_DEPRECATED_SINCE
(
6
,
11
)
16
17
class
Q_MULTIMEDIA_EXPORT
QWaveDecoder
:
public
QIODevice
18
{
19
Q_OBJECT
20
21
public
:
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
);
26
~
QWaveDecoder
()
override
;
27
28
QAudioFormat
audioFormat
()
const
;
29
QIODevice
*
getDevice
();
30
int
duration
()
const
;
31
static
qint64
headerLength
();
32
33
bool
open
(
QIODevice
::
OpenMode
mode
)
override
;
34
void
close
()
override
;
35
bool
seek
(
qint64
pos
)
override
;
36
qint64
pos
()
const
override
;
37
void
setIODevice
(
QIODevice
*
device
);
38
qint64
size
()
const
override
;
39
bool
isSequential
()
const
override
;
40
qint64
bytesAvailable
()
const
override
;
41
42
Q_SIGNALS
:
43
void
formatKnown
();
44
void
parsingError
();
45
46
private
Q_SLOTS
:
47
void
handleData
();
48
49
private
:
50
qint64
readData
(
char
*
data
,
qint64
maxlen
)
override
;
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];
60
quint32
size
;
61
};
62
63
struct
RIFFHeader
64
{
65
chunk
descriptor
;
66
char
type
[4];
67
};
68
struct
WAVEHeader
69
{
70
chunk
descriptor
;
71
quint16
audioFormat
;
72
quint16
numChannels
;
73
quint32
sampleRate
;
74
quint32
byteRate
;
75
quint16
blockAlign
;
76
quint16
bitsPerSample
;
77
};
78
79
struct
DATAHeader
80
{
81
chunk
descriptor
;
82
};
83
84
struct
CombinedHeader
85
{
86
RIFFHeader
riff
;
87
WAVEHeader
wave
;
88
DATAHeader
data
;
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
;
96
QAudioFormat
format
;
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
101
Q_DECL_UNUSED_MEMBER
char
m_abiPadding
[8];
102
#
endif
103
};
104
105
#
endif
// QT_DEPRECATED_SINCE(6, 11)
106
107
QT_END_NAMESPACE
108
109
#
endif
// WAVEDECODER_H
QSqlRelationalDelegate
\inmodule QtSql
qtmultimedia
src
multimedia
audio
qwavedecoder.h
Generated on
for Qt by
1.16.1