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
12
QT_BEGIN_NAMESPACE
13
14
#
if
QT_DEPRECATED_SINCE
(
6
,
11
)
15
16
class
Q_MULTIMEDIA_EXPORT
QWaveDecoder
:
public
QIODevice
17
{
18
Q_OBJECT
19
20
public
:
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
);
25
~
QWaveDecoder
()
override
;
26
27
QAudioFormat
audioFormat
()
const
;
28
QIODevice
*
getDevice
();
29
int
duration
()
const
;
30
static
qint64
headerLength
();
31
32
bool
open
(
QIODevice
::
OpenMode
mode
)
override
;
33
void
close
()
override
;
34
bool
seek
(
qint64
pos
)
override
;
35
qint64
pos
()
const
override
;
36
void
setIODevice
(
QIODevice
*
device
);
37
qint64
size
()
const
override
;
38
bool
isSequential
()
const
override
;
39
qint64
bytesAvailable
()
const
override
;
40
41
Q_SIGNALS
:
42
void
formatKnown
();
43
void
parsingError
();
44
45
private
Q_SLOTS
:
46
void
handleData
();
47
48
private
:
49
qint64
readData
(
char
*
data
,
qint64
maxlen
)
override
;
50
qint64
writeData
(
const
char
*
data
,
qint64
len
)
override
;
51
52
bool
writeHeader
();
53
bool
writeDataLength
();
54
bool
enoughDataAvailable
();
55
bool
findChunk
(
const
char
*
chunkId
);
56
void
discardBytes
(
qint64
numBytes
);
57
void
parsingFailed
();
58
59
enum
State
{
60
InitialState
,
61
WaitingForFormatState
,
62
WaitingForDataState
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
{
76
chunk
descriptor
;
77
char
type
[4];
78
};
79
struct
WAVEHeader
80
{
81
chunk
descriptor
;
82
quint16
audioFormat
;
83
quint16
numChannels
;
84
quint32
sampleRate
;
85
quint32
byteRate
;
86
quint16
blockAlign
;
87
quint16
bitsPerSample
;
88
};
89
90
struct
DATAHeader
91
{
92
chunk
descriptor
;
93
};
94
95
struct
CombinedHeader
96
{
97
RIFFHeader
riff
;
98
WAVEHeader
wave
;
99
DATAHeader
data
;
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
;
107
QAudioFormat
format
;
108
State
state
=
InitialState
;
109
quint32
junkToSkip
= 0;
110
bool
bigEndian
=
false
;
111
bool
byteSwap
=
false
;
112
int
bps
= 0;
113
};
114
115
#
endif
// QT_DEPRECATED_SINCE(6, 11)
116
117
QT_END_NAMESPACE
118
119
#
endif
// WAVEDECODER_H
QSqlRelationalDelegate
\inmodule QtSql
QPlatformGraphicsBufferHelper
\inmodule QtGui
qtmultimedia
src
multimedia
audio
qwavedecoder.h
Generated on
for Qt by
1.14.0