|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the Qt Mobility Components. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #include "qmediaservice.h" |
|
43 #include "qmediaservice_p.h" |
|
44 |
|
45 #include <QtCore/qtimer.h> |
|
46 |
|
47 |
|
48 |
|
49 QT_BEGIN_NAMESPACE |
|
50 |
|
51 |
|
52 /*! |
|
53 \class QMediaService |
|
54 \brief The QMediaService class provides a common base class for media |
|
55 service implementations. |
|
56 \ingroup multimedia |
|
57 \preliminary |
|
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 \code |
|
73 QMediaPlayerControl *control = qobject_cast<QMediaPlayerControl *>( |
|
74 service->requestControl("com.nokia.Qt.QMediaPlayerControl/1.0")); |
|
75 \endcode |
|
76 |
|
77 Media objects can use services loaded dynamically from plug-ins or |
|
78 implemented statically within an applications. Plug-in based services |
|
79 should also implement the QMediaServiceProviderPlugin interface. Static |
|
80 services should implement the QMediaServiceProvider interface. |
|
81 |
|
82 \sa QMediaObject, QMediaControl, QMediaServiceProvider, QMediaServiceProviderPlugin |
|
83 */ |
|
84 |
|
85 /*! |
|
86 Construct a media service with the given \a parent. This class is meant as a |
|
87 base class for Multimedia services so this constructor is protected. |
|
88 */ |
|
89 |
|
90 QMediaService::QMediaService(QObject *parent) |
|
91 : QObject(parent) |
|
92 , d_ptr(new QMediaServicePrivate) |
|
93 { |
|
94 d_ptr->q_ptr = this; |
|
95 } |
|
96 |
|
97 /*! |
|
98 \internal |
|
99 */ |
|
100 QMediaService::QMediaService(QMediaServicePrivate &dd, QObject *parent) |
|
101 : QObject(parent) |
|
102 , d_ptr(&dd) |
|
103 { |
|
104 d_ptr->q_ptr = this; |
|
105 } |
|
106 |
|
107 /*! |
|
108 Destroys a media service. |
|
109 */ |
|
110 |
|
111 QMediaService::~QMediaService() |
|
112 { |
|
113 delete d_ptr; |
|
114 } |
|
115 |
|
116 /*! |
|
117 \fn QMediaControl* QMediaService::requestControl(const char *interface) |
|
118 |
|
119 Returns a pointer to the media control implementing \a interface. |
|
120 |
|
121 If the service does not implement the control, or if it is unavailable a |
|
122 null pointer is returned instead. |
|
123 |
|
124 Controls must be returned to the service when no longer needed using the |
|
125 releaseControl() function. |
|
126 */ |
|
127 |
|
128 /*! |
|
129 \fn T QMediaService::requestControl() |
|
130 |
|
131 Returns a pointer to the media control of type T implemented by a media service. |
|
132 |
|
133 If the service does not implement the control, or if it is unavailable a |
|
134 null pointer is returned instead. |
|
135 |
|
136 Controls must be returned to the service when no longer needed using the |
|
137 releaseControl() function. |
|
138 */ |
|
139 |
|
140 /*! |
|
141 \fn void QMediaService::releaseControl(QMediaControl *control); |
|
142 |
|
143 Releases a \a control back to the service. |
|
144 */ |
|
145 |
|
146 #include "moc_qmediaservice.cpp" |
|
147 |
|
148 QT_END_NAMESPACE |
|
149 |