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.cpp
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
4
#
include
"qplatformaudiodecoder_p.h"
5
6
#
include
<
QtCore
/
qthread
.
h
>
7
8
QT_BEGIN_NAMESPACE
9
10
QPlatformAudioDecoder::QPlatformAudioDecoder(QAudioDecoder *parent) : q(parent) { }
11
12
QPlatformAudioDecoder::~QPlatformAudioDecoder() =
default
;
13
14
void
QPlatformAudioDecoder::error(QAudioDecoder::Error error,
const
QString &errorString)
15
{
16
if
(error == m_error && errorString == m_errorString)
17
return
;
18
m_error = error;
19
m_errorString = errorString;
20
21
if
(m_error != QAudioDecoder::NoError) {
22
setIsDecoding(
false
);
23
Q_EMIT q->error(m_error);
24
}
25
}
26
27
void
QPlatformAudioDecoder::bufferAvailableChanged(
bool
available)
28
{
29
if
(m_bufferAvailable == available)
30
return
;
31
m_bufferAvailable = available;
32
33
if
(!q->thread()->isCurrentThread())
34
QMetaObject::invokeMethod(q, [q =
this
->q, available] {
35
q->bufferAvailableChanged(available);
36
}, Qt::QueuedConnection);
37
else
38
Q_EMIT q->bufferAvailableChanged(available);
39
}
40
41
void
QPlatformAudioDecoder::bufferReady()
42
{
43
if
(!q->thread()->isCurrentThread())
44
QMetaObject::invokeMethod(q, &QAudioDecoder::bufferReady, Qt::QueuedConnection);
45
else
46
Q_EMIT q->bufferReady();
47
}
48
49
void
QPlatformAudioDecoder::sourceChanged()
50
{
51
Q_EMIT q->sourceChanged();
52
}
53
54
void
QPlatformAudioDecoder::formatChanged(
const
QAudioFormat &format)
55
{
56
Q_EMIT q->formatChanged(format);
57
}
58
59
void
QPlatformAudioDecoder::finished()
60
{
61
durationChanged(kInvalidDuration);
62
setIsDecoding(
false
);
63
Q_EMIT q->finished();
64
}
65
66
void
QPlatformAudioDecoder::positionChanged(std::chrono::milliseconds position)
67
{
68
if
(m_position == position)
69
return
;
70
m_position = position;
71
Q_EMIT q->positionChanged(position.count());
72
}
73
74
void
QPlatformAudioDecoder::durationChanged(std::chrono::milliseconds duration)
75
{
76
if
(m_duration == duration)
77
return
;
78
m_duration = duration;
79
Q_EMIT q->durationChanged(duration.count());
80
}
81
82
QT_END_NAMESPACE
83
84
#
include
"moc_qplatformaudiodecoder_p.cpp"
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtmultimedia
src
multimedia
platform
qplatformaudiodecoder.cpp
Generated on
for Qt by
1.18.0