blob: 0bf4724104f9ada3a571d34827c86a82397838a6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qplatformaudiodecoder_p.h"
#include "qthread.h"
QT_BEGIN_NAMESPACE
QPlatformAudioDecoder::QPlatformAudioDecoder(QAudioDecoder *parent) : q(parent) { }
QPlatformAudioDecoder::~QPlatformAudioDecoder() = default;
void QPlatformAudioDecoder::error(int error, const QString &errorString)
{
if (error == m_error && errorString == m_errorString)
return;
m_error = QAudioDecoder::Error(error);
m_errorString = errorString;
if (m_error != QAudioDecoder::NoError) {
setIsDecoding(false);
emit q->error(m_error);
}
}
void QPlatformAudioDecoder::bufferAvailableChanged(bool available)
{
if (m_bufferAvailable == available)
return;
m_bufferAvailable = available;
if (QThread::currentThread() != q->thread())
QMetaObject::invokeMethod(q, "bufferAvailableChanged", Qt::QueuedConnection, Q_ARG(bool, available));
else
emit q->bufferAvailableChanged(available);
}
void QPlatformAudioDecoder::bufferReady()
{
if (QThread::currentThread() != q->thread())
QMetaObject::invokeMethod(q, "bufferReady", Qt::QueuedConnection);
else
emit q->bufferReady();
}
void QPlatformAudioDecoder::sourceChanged()
{
emit q->sourceChanged();
}
void QPlatformAudioDecoder::formatChanged(const QAudioFormat &format)
{
emit q->formatChanged(format);
}
void QPlatformAudioDecoder::finished()
{
durationChanged(-1);
setIsDecoding(false);
emit q->finished();
}
void QPlatformAudioDecoder::positionChanged(qint64 position)
{
if (m_position == position)
return;
m_position = position;
emit q->positionChanged(position);
}
void QPlatformAudioDecoder::durationChanged(qint64 duration)
{
if (m_duration == duration)
return;
m_duration = duration;
emit q->durationChanged(duration);
}
QT_END_NAMESPACE
#include "moc_qplatformaudiodecoder_p.cpp"
|