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
9QT_BEGIN_NAMESPACE
10
11QPlatformMediaPlayer::QPlatformMediaPlayer(QMediaPlayer *parent) : player(parent)
12{
13 QPlatformMediaDevices::instance()->prepareAudio();
14}
15
16QPlatformMediaPlayer::~QPlatformMediaPlayer()
17{
18}
19
20void QPlatformMediaPlayer::stateChanged(QMediaPlayer::PlaybackState newState)
21{
22 if (newState == m_state)
23 return;
24 m_state = newState;
25 player->d_func()->setState(newState);
26}
27
28void QPlatformMediaPlayer::mediaStatusChanged(QMediaPlayer::MediaStatus status)
29{
30 if (m_status == status)
31 return;
32 m_status = status;
33 player->d_func()->setStatus(status);
34}
35
36void QPlatformMediaPlayer::error(int error, const QString &errorString)
37{
38 player->d_func()->setError(error: QMediaPlayer::Error(error), errorString);
39}
40
41void *QPlatformMediaPlayer::nativePipeline(QMediaPlayer *player)
42{
43 if (!player)
44 return nullptr;
45
46 auto playerPrivate = player->d_func();
47 if (!playerPrivate || !playerPrivate->control)
48 return nullptr;
49
50 return playerPrivate->control->nativePipeline();
51}
52
53QT_END_NAMESPACE
54

source code of qtmultimedia/src/multimedia/platform/qplatformmediaplayer.cpp