summaryrefslogtreecommitdiffstats
path: root/src/multimedia/qnx/qqnxaudiosink.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/multimedia/qnx/qqnxaudiosink.cpp')
-rw-r--r--src/multimedia/qnx/qqnxaudiosink.cpp66
1 files changed, 16 insertions, 50 deletions
diff --git a/src/multimedia/qnx/qqnxaudiosink.cpp b/src/multimedia/qnx/qqnxaudiosink.cpp
index 9d846b774..fa4b97ab6 100644
--- a/src/multimedia/qnx/qqnxaudiosink.cpp
+++ b/src/multimedia/qnx/qqnxaudiosink.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Research In Motion
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Research In Motion
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qqnxaudiosink_p.h"
@@ -50,11 +14,14 @@
QT_BEGIN_NAMESPACE
-QQnxAudioSink::QQnxAudioSink(const QAudioDevice &deviceInfo)
- : m_source(0)
+QQnxAudioSink::QQnxAudioSink(const QAudioDevice &deviceInfo, QObject *parent)
+ : QPlatformAudioSink(parent)
+ , m_source(0)
, m_pushSource(false)
+ , m_timer(new QTimer(this))
, m_error(QAudio::NoError)
, m_state(QAudio::StoppedState)
+ , m_suspendedInState(QAudio::SuspendedState)
, m_volume(1.0)
, m_periodSize(0)
, m_bytesWritten(0)
@@ -62,9 +29,9 @@ QQnxAudioSink::QQnxAudioSink(const QAudioDevice &deviceInfo)
, m_deviceInfo(deviceInfo)
, m_pcmNotifier(0)
{
- m_timer.setSingleShot(false);
- m_timer.setInterval(20);
- connect(&m_timer, &QTimer::timeout, this, &QQnxAudioSink::pullData);
+ m_timer->setSingleShot(false);
+ m_timer->setInterval(20);
+ connect(m_timer, &QTimer::timeout, this, &QQnxAudioSink::pullData);
const std::optional<snd_pcm_channel_info_t> info = QnxAudioUtils::pcmChannelInfo(
m_deviceInfo.id(), QAudioDevice::Output);
@@ -88,7 +55,7 @@ void QQnxAudioSink::start(QIODevice *source)
if (open()) {
changeState(QAudio::ActiveState, QAudio::NoError);
- m_timer.start();
+ m_timer->start();
} else {
changeState(QAudio::StoppedState, QAudio::OpenError);
}
@@ -344,7 +311,7 @@ bool QQnxAudioSink::open()
void QQnxAudioSink::close()
{
if (!m_pushSource)
- m_timer.stop();
+ m_timer->stop();
destroyPcmNotifiers();
@@ -448,18 +415,17 @@ qint64 QQnxAudioSink::write(const char *data, qint64 len)
void QQnxAudioSink::suspendInternal(QAudio::State suspendState)
{
if (!m_pushSource)
- m_timer.stop();
+ m_timer->stop();
+ m_suspendedInState = m_state;
changeState(suspendState, QAudio::NoError);
}
void QQnxAudioSink::resumeInternal()
{
- const QAudio::State state = m_pushSource ? QAudio::IdleState : QAudio::ActiveState;
+ changeState(m_suspendedInState, QAudio::NoError);
- changeState(state, QAudio::NoError);
-
- m_timer.start();
+ m_timer->start();
}
QAudio::State suspendState(const snd_pcm_event_t &event)