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 "qplatformmediaplayer_p.h" |
5 | #include <private/qmediaplayer_p.h> |
6 | #include "qmediaplayer.h" |
7 | #include "qplatformmediadevices_p.h" |
8 | #include "qplatformmediaintegration_p.h" |
9 | |
10 | QT_BEGIN_NAMESPACE |
11 | |
12 | QPlatformMediaPlayer::QPlatformMediaPlayer(QMediaPlayer *parent) : player(parent) |
13 | { |
14 | QPlatformMediaIntegration::instance()->mediaDevices()->prepareAudio(); |
15 | } |
16 | |
17 | QPlatformMediaPlayer::~QPlatformMediaPlayer() = default; |
18 | |
19 | void QPlatformMediaPlayer::stateChanged(QMediaPlayer::PlaybackState newState) |
20 | { |
21 | if (newState == m_state) |
22 | return; |
23 | m_state = newState; |
24 | player->d_func()->setState(newState); |
25 | } |
26 | |
27 | void QPlatformMediaPlayer::mediaStatusChanged(QMediaPlayer::MediaStatus status) |
28 | { |
29 | if (m_status == status) |
30 | return; |
31 | m_status = status; |
32 | player->d_func()->setStatus(status); |
33 | } |
34 | |
35 | void QPlatformMediaPlayer::error(int error, const QString &errorString) |
36 | { |
37 | player->d_func()->setError(error: QMediaPlayer::Error(error), errorString); |
38 | } |
39 | |
40 | QT_END_NAMESPACE |
41 |