1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 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 #include <QtCore/qlist.h> |
|
46 #include "qvideowidget.h" |
|
47 |
|
48 #include "S60cameraservice.h" |
|
49 #include "S60cameracontrol.h" |
|
50 #include "S60cameravideodevicecontrol.h" |
|
51 #include "S60camerafocuscontrol.h" |
|
52 #include "S60cameraexposurecontrol.h" |
|
53 #include "S60cameraimageprocessingcontrol.h" |
|
54 #include "s60cameraimagecapturecontrol.h" |
|
55 #include "S60mediacontrol.h" |
|
56 #include "S60camerasession.h" |
|
57 #include "S60viewfinderwidget.h" |
|
58 #include "S60videooutputcontrol.h" |
|
59 #include "S60mediacontainercontrol.h" |
|
60 #include "s60videoencoder.h" |
|
61 |
|
62 S60CameraService::S60CameraService(QObject *parent) |
|
63 : QMediaService(parent) |
|
64 { |
|
65 // session class is the main symbian backend class |
|
66 m_session = new S60CameraSession(this); |
|
67 // different control classes which use session class to do the work |
|
68 m_control = new S60CameraControl(m_session, this); |
|
69 m_videoDeviceControl = new S60CameraVideoDeviceControl(m_session, this); |
|
70 m_focusControl = new S60CameraFocusControl(m_session, this); |
|
71 m_exposureControl = new S60CameraExposureControl(m_session, this); |
|
72 m_imageProccessingControl = new S60CameraImageProcessingControl(m_session, this); |
|
73 m_imageCaptureControl = new S60CameraImageCaptureControl(m_session, this); |
|
74 |
|
75 m_media = new S60MediaControl(m_session, this); |
|
76 m_mediaFormat = new S60MediaContainerControl(m_session, this); |
|
77 m_videoEncoder = new S60VideoEncoder(m_session, this); |
|
78 m_viewFinderWidget = new S60ViewFinderWidgetControl(this); |
|
79 m_videoOutput = new S60VideoOutputControl(this); |
|
80 connect(m_videoOutput, SIGNAL(outputChanged(QVideoOutputControl::Output)), |
|
81 this, SLOT(videoOutputChanged(QVideoOutputControl::Output))); |
|
82 |
|
83 m_videoOutput->setAvailableOutputs(QList<QVideoOutputControl::Output>() |
|
84 << QVideoOutputControl::WidgetOutput); |
|
85 } |
|
86 |
|
87 S60CameraService::~S60CameraService() |
|
88 { |
|
89 } |
|
90 |
|
91 QMediaControl *S60CameraService::control(const char *name) const |
|
92 { |
|
93 if (qstrcmp(name,QMediaRecorderControl_iid) == 0) |
|
94 return m_media; |
|
95 |
|
96 if(qstrcmp(name,QCameraControl_iid) == 0) |
|
97 return m_control; |
|
98 |
|
99 if(qstrcmp(name,QVideoEncoderControl_iid) == 0) |
|
100 return m_videoEncoder; |
|
101 |
|
102 if(qstrcmp(name,QMediaContainerControl_iid) == 0) |
|
103 return m_mediaFormat; |
|
104 |
|
105 if(qstrcmp(name,QVideoOutputControl_iid) == 0) |
|
106 return m_videoOutput; |
|
107 |
|
108 if(qstrcmp(name,QCameraExposureControl_iid) == 0) |
|
109 return m_exposureControl; |
|
110 |
|
111 if (qstrcmp(name, QVideoWidgetControl_iid) == 0) |
|
112 return m_viewFinderWidget; |
|
113 |
|
114 if(qstrcmp(name,QCameraFocusControl_iid) == 0) |
|
115 return m_focusControl; |
|
116 |
|
117 if(qstrcmp(name,QImageProcessingControl_iid) == 0) |
|
118 return m_imageProccessingControl; |
|
119 |
|
120 if(qstrcmp(name,QImageCaptureControl_iid) == 0) |
|
121 return m_imageCaptureControl; |
|
122 |
|
123 if(qstrcmp(name,QVideoDeviceControl_iid) == 0) |
|
124 return m_videoDeviceControl; |
|
125 |
|
126 |
|
127 return 0; |
|
128 } |
|
129 int S60CameraService::deviceCount() |
|
130 { |
|
131 return S60CameraSession::deviceCount(); |
|
132 } |
|
133 |
|
134 QString S60CameraService::deviceDescription(const int index) |
|
135 { |
|
136 return S60CameraSession::description(index); |
|
137 } |
|
138 QString S60CameraService::deviceName(const int index) |
|
139 { |
|
140 return S60CameraSession::name(index); |
|
141 } |
|
142 |
|
143 void S60CameraService::videoOutputChanged(QVideoOutputControl::Output output) |
|
144 { |
|
145 switch (output) { |
|
146 case QVideoOutputControl::NoOutput: |
|
147 m_control->setVideoOutput(0); |
|
148 break; |
|
149 case QVideoOutputControl::WidgetOutput: |
|
150 m_control->setVideoOutput(m_viewFinderWidget); |
|
151 break; |
|
152 default: |
|
153 qWarning("Invalid video output selection"); |
|
154 break; |
|
155 } |
|
156 } |
|
157 |
|
158 |
|
159 /* |
|
160 bool S60CameraService::isEndpointSupported(QMediaService::MediaEndpoint endpointType) |
|
161 { |
|
162 return false; |
|
163 } |
|
164 |
|
165 void S60CameraService::setInputStream(QIODevice* stream) |
|
166 { |
|
167 } |
|
168 |
|
169 QIODevice* S60CameraService::inputStream() const |
|
170 { |
|
171 return 0; |
|
172 } |
|
173 |
|
174 void S60CameraService::setOutputStream(QIODevice* stream) |
|
175 { |
|
176 } |
|
177 |
|
178 QIODevice* S60CameraService::outputStream() const |
|
179 { |
|
180 return 0; |
|
181 } |
|
182 |
|
183 QString S60CameraService::activeEndpoint(QMediaService::MediaEndpoint endpointType) |
|
184 { |
|
185 return QByteArray(); |
|
186 } |
|
187 |
|
188 bool S60CameraService::setActiveEndpoint(QMediaService::MediaEndpoint endpointType, const QString& endpoint) |
|
189 { |
|
190 return true; |
|
191 } |
|
192 |
|
193 QList<QString> S60CameraService::supportedEndpoints(QMediaService::MediaEndpoint endpointType) const |
|
194 { |
|
195 QList<QString> list; |
|
196 //TODO |
|
197 return list; |
|
198 } |
|
199 */ |
|
200 |
|