|
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 <QtCore/qvariant.h> |
|
43 #include <QtCore/qdebug.h> |
|
44 #include <QtGui/qwidget.h> |
|
45 |
|
46 #include "qt7backend.h" |
|
47 #include "qt7playerservice.h" |
|
48 #include "qt7playercontrol.h" |
|
49 #include "qt7playersession.h" |
|
50 #include "qt7videooutput.h" |
|
51 #include "qt7movieviewoutput.h" |
|
52 #include "qt7movieviewrenderer.h" |
|
53 #include "qt7movierenderer.h" |
|
54 #include "qt7movievideowidget.h" |
|
55 #include "qt7playermetadata.h" |
|
56 |
|
57 #include <qmediaplaylistnavigator.h> |
|
58 #include <qmediaplaylist.h> |
|
59 |
|
60 QT_USE_NAMESPACE |
|
61 |
|
62 QT7PlayerService::QT7PlayerService(QObject *parent): |
|
63 QMediaService(parent), |
|
64 m_videoOutput(0) |
|
65 { |
|
66 m_session = new QT7PlayerSession(this); |
|
67 |
|
68 m_control = new QT7PlayerControl(this); |
|
69 m_control->setSession(m_session); |
|
70 |
|
71 m_playerMetaDataControl = new QT7PlayerMetaDataControl(m_session, this); |
|
72 connect(m_control, SIGNAL(mediaChanged(QMediaContent)), m_playerMetaDataControl, SLOT(updateTags())); |
|
73 } |
|
74 |
|
75 QT7PlayerService::~QT7PlayerService() |
|
76 { |
|
77 } |
|
78 |
|
79 QMediaControl *QT7PlayerService::requestControl(const char *name) |
|
80 { |
|
81 if (qstrcmp(name, QMediaPlayerControl_iid) == 0) |
|
82 return m_control; |
|
83 |
|
84 if (qstrcmp(name, QMetaDataReaderControl_iid) == 0) |
|
85 return m_playerMetaDataControl; |
|
86 |
|
87 if (!m_videoOutput) { |
|
88 if (qstrcmp(name, QVideoWindowControl_iid) == 0) { |
|
89 #if defined(QT_MAC_USE_COCOA) |
|
90 m_videoOutput = new QT7MovieViewOutput(this); |
|
91 #endif |
|
92 } |
|
93 |
|
94 if (qstrcmp(name, QVideoRendererControl_iid) == 0) { |
|
95 #ifdef QUICKTIME_C_API_AVAILABLE |
|
96 m_videoOutput = new QT7MovieRenderer(this); |
|
97 #else |
|
98 m_videoOutput = new QT7MovieViewRenderer(this); |
|
99 #endif |
|
100 } |
|
101 |
|
102 if (qstrcmp(name, QVideoWidgetControl_iid) == 0) { |
|
103 #ifdef QUICKTIME_C_API_AVAILABLE |
|
104 m_videoOutput = new QT7MovieVideoWidget(this); |
|
105 #endif |
|
106 } |
|
107 |
|
108 if (m_videoOutput) { |
|
109 QT7VideoOutput *videoOutput = qobject_cast<QT7VideoOutput*>(m_videoOutput); |
|
110 m_session->setVideoOutput(videoOutput); |
|
111 return m_videoOutput; |
|
112 } |
|
113 } |
|
114 |
|
115 return 0; |
|
116 } |
|
117 |
|
118 void QT7PlayerService::releaseControl(QMediaControl *control) |
|
119 { |
|
120 if (m_videoOutput == control) { |
|
121 m_videoOutput = 0; |
|
122 m_session->setVideoOutput(0); |
|
123 delete control; |
|
124 } |
|
125 } |
|
126 |
|
127 #include "moc_qt7playerservice.cpp" |