1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#include "qmediaservice.h"
41#include "qmediaservice_p.h"
42
43#include <QtCore/qtimer.h>
44
45
46
47QT_BEGIN_NAMESPACE
48
49
50/*!
51 \class QMediaService
52 \brief The QMediaService class provides a common base class for media
53 service implementations.
54 \ingroup multimedia
55 \ingroup multimedia_control
56 \ingroup multimedia_core
57 \inmodule QtMultimedia
58
59 Media services provide implementations of the functionality promised
60 by media objects, and allow multiple providers to implement a QMediaObject.
61
62 To provide the functionality of a QMediaObject media services implement
63 QMediaControl interfaces. Services typically implement one core media
64 control which provides the core feature of a media object, and some
65 number of additional controls which provide either optional features of
66 the media object, or features of a secondary media object or peripheral
67 object.
68
69 A pointer to media service's QMediaControl implementation can be obtained
70 by passing the control's interface name to the requestControl() function.
71
72 \snippet multimedia-snippets/media.cpp Request control
73
74 Media objects can use services loaded dynamically from plug-ins or
75 implemented statically within an applications. Plug-in based services
76 should also implement the QMediaServiceProviderPlugin interface. Static
77 services should implement the QMediaServiceProvider interface. In general,
78 implementing a QMediaService is outside of the scope of this documentation
79 and support on the relevant mailing lists or IRC channels should be sought.
80
81 \sa QMediaObject, QMediaControl
82*/
83
84/*!
85 Construct a media service with the given \a parent. This class is meant as a
86 base class for Multimedia services so this constructor is protected.
87*/
88
89QMediaService::QMediaService(QObject *parent)
90 : QObject(parent)
91 , d_ptr(new QMediaServicePrivate)
92{
93 d_ptr->q_ptr = this;
94}
95
96/*!
97 \internal
98*/
99QMediaService::QMediaService(QMediaServicePrivate &dd, QObject *parent)
100 : QObject(parent)
101 , d_ptr(&dd)
102{
103 d_ptr->q_ptr = this;
104}
105
106/*!
107 Destroys a media service.
108*/
109
110QMediaService::~QMediaService()
111{
112 delete d_ptr;
113}
114
115/*!
116 \fn QMediaControl* QMediaService::requestControl(const char *interface)
117
118 Returns a pointer to the media control implementing \a interface.
119
120 If the service does not implement the control, or if it is unavailable a
121 null pointer is returned instead.
122
123 Controls must be returned to the service when no longer needed using the
124 releaseControl() function.
125*/
126
127/*!
128 \fn T QMediaService::requestControl()
129
130 Returns a pointer to the media control of type T implemented by a media service.
131
132 If the service does not implement the control, or if it is unavailable a
133 null pointer is returned instead.
134
135 Controls must be returned to the service when no longer needed using the
136 releaseControl() function.
137*/
138
139/*!
140 \fn void QMediaService::releaseControl(QMediaControl *control);
141
142 Releases a \a control back to the service.
143*/
144
145#include "moc_qmediaservice.cpp"
146
147QT_END_NAMESPACE
148
149