Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qplatformaudiodecoder_p.h
Go to the documentation of this file.
1
// Copyright (C) 2021 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
4
#
ifndef
QAUDIODECODERCONTROL_H
5
#
define
QAUDIODECODERCONTROL_H
6
7
//
8
// W A R N I N G
9
// -------------
10
//
11
// This file is not part of the Qt API. It exists purely as an
12
// implementation detail. This header file may change from version to
13
// version without notice, or even be removed.
14
//
15
// We mean it.
16
//
17
18
#
include
<
QtMultimedia
/
qaudiobuffer
.
h
>
19
#
include
<
QtMultimedia
/
qaudiodecoder
.
h
>
20
#
include
<
QtCore
/
private
/
qglobal_p
.
h
>
21
#
include
<
QtCore
/
qurl
.
h
>
22
#
include
<
chrono
>
23
24
QT_BEGIN_NAMESPACE
25
26
class
QIODevice;
27
class
Q_MULTIMEDIA_EXPORT
QPlatformAudioDecoder
:
public
QObject
28
{
29
Q_OBJECT
30
31
public
:
32
static
constexpr
std::chrono::milliseconds kInvalidDuration{ -1 };
33
static
constexpr
std::chrono::milliseconds kInvalidPosition{ -1 };
34
35
virtual
QUrl source()
const
= 0;
36
virtual
void
setSource(
const
QUrl &fileName) = 0;
37
38
virtual
QIODevice* sourceDevice()
const
= 0;
39
virtual
void
setSourceDevice(QIODevice *device) = 0;
40
41
virtual
void
start() = 0;
42
virtual
void
stop() = 0;
43
44
virtual
QAudioFormat audioFormat()
const
= 0;
45
virtual
void
setAudioFormat(
const
QAudioFormat &format) = 0;
46
47
virtual
QAudioBuffer read() = 0;
48
virtual
bool
bufferAvailable()
const
{
return
m_bufferAvailable; }
49
50
std::chrono::milliseconds position()
const
{
return
m_position; }
51
std::chrono::milliseconds duration()
const
{
return
m_duration; }
52
53
void
formatChanged(
const
QAudioFormat &format);
54
55
void
sourceChanged();
56
57
void
error(QAudioDecoder::Error error,
const
QString &errorString);
58
void
clearError() { error(QAudioDecoder::NoError, QString()); }
59
60
void
bufferReady();
61
void
bufferAvailableChanged(
bool
available);
62
void
setIsDecoding(
bool
running =
true
) {
63
if
(m_isDecoding == running)
64
return
;
65
m_isDecoding = running;
66
Q_EMIT q->isDecodingChanged(m_isDecoding);
67
}
68
void
finished();
69
bool
isDecoding()
const
{
return
m_isDecoding; }
70
71
void
positionChanged(std::chrono::milliseconds);
72
void
durationChanged(std::chrono::milliseconds);
73
74
QAudioDecoder::Error error()
const
{
return
m_error; }
75
QString errorString()
const
{
return
m_errorString; }
76
77
virtual
bool
canReadQrc()
const
{
return
false
; }
78
79
~QPlatformAudioDecoder() override;
80
81
protected
:
82
explicit
QPlatformAudioDecoder(QAudioDecoder *parent);
83
84
private
:
85
QAudioDecoder *q =
nullptr
;
86
87
// stored in milliseconds resolution
88
std::chrono::milliseconds m_duration = kInvalidDuration;
89
std::chrono::milliseconds m_position = kInvalidPosition;
90
QAudioDecoder::Error m_error = QAudioDecoder::NoError;
91
QString m_errorString;
92
bool
m_isDecoding =
false
;
93
bool
m_bufferAvailable =
false
;
94
};
95
96
QT_END_NAMESPACE
97
98
#
endif
// QAUDIODECODERCONTROL_H
QPlatformAudioDecoder
Definition
qplatformaudiodecoder_p.h:28
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtmultimedia
src
multimedia
platform
qplatformaudiodecoder_p.h
Generated on
for Qt by
1.18.0