sl@0
|
1 |
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
/**
|
sl@0
|
17 |
@file
|
sl@0
|
18 |
@internalComponent
|
sl@0
|
19 |
*/
|
sl@0
|
20 |
|
sl@0
|
21 |
#include "mmcameraserver.h"
|
sl@0
|
22 |
#include "mmcameraserversession.h"
|
sl@0
|
23 |
#include "mmcameraservercontroller.h"
|
sl@0
|
24 |
|
sl@0
|
25 |
#include <graphics/surfacemanager.h>
|
sl@0
|
26 |
|
sl@0
|
27 |
using namespace MMClient;
|
sl@0
|
28 |
using namespace MMVideoComponents;
|
sl@0
|
29 |
using namespace MMCameraComponents;
|
sl@0
|
30 |
|
sl@0
|
31 |
static const TInt KMMCamHandleNumberBase = 500;
|
sl@0
|
32 |
const TInt KDefaultFrameRate = 30;
|
sl@0
|
33 |
|
sl@0
|
34 |
CMMCameraServerController* CMMCameraServerController::NewL(TInt aCameraIndex)
|
sl@0
|
35 |
{
|
sl@0
|
36 |
CMMCameraServerController* self = new(ELeave) CMMCameraServerController(aCameraIndex);
|
sl@0
|
37 |
CleanupStack::PushL(self);
|
sl@0
|
38 |
self->ConstructL();
|
sl@0
|
39 |
CleanupStack::Pop(self);
|
sl@0
|
40 |
return self;
|
sl@0
|
41 |
}
|
sl@0
|
42 |
|
sl@0
|
43 |
CMMCameraServerController::CMMCameraServerController(TInt aCameraIndex): iCameraIndex(aCameraIndex),
|
sl@0
|
44 |
iCameraHandle(KMMCamHandleNumberBase + iCameraIndex),
|
sl@0
|
45 |
iMMCapability(EFalse),
|
sl@0
|
46 |
iViewFinderState(CCamera::CCameraV2DirectViewFinder::EViewFinderInActive),
|
sl@0
|
47 |
iFlash(CCamera::EFlashNone),
|
sl@0
|
48 |
iExposure(CCamera::EExposureAuto),
|
sl@0
|
49 |
iWhiteBalance(CCamera::EWBAuto)
|
sl@0
|
50 |
{
|
sl@0
|
51 |
}
|
sl@0
|
52 |
|
sl@0
|
53 |
void CMMCameraServerController::ConstructL()
|
sl@0
|
54 |
{
|
sl@0
|
55 |
User::LeaveIfError(iMMServer.Connect()); // Connect to the MM server
|
sl@0
|
56 |
|
sl@0
|
57 |
// Create characterizations for camera and graphics sink
|
sl@0
|
58 |
XMMCameraViewFinderCharacterization* cameraViewFinderChar = XMMCameraViewFinderCharacterization::New();
|
sl@0
|
59 |
XMMVideoGraphicsSinkCharacterization* graphicsSinkChar = XMMVideoGraphicsSinkCharacterization::New();
|
sl@0
|
60 |
XMMCameraSensorCharacterization* cameraSensorChar = XMMCameraSensorCharacterization::New();
|
sl@0
|
61 |
// XMMCameraCaptureCharacterization* cameraCaptureChar = XMMCameraCaptureCharacterization::New();
|
sl@0
|
62 |
|
sl@0
|
63 |
// Open stream, stream container and camera/graphics sink components
|
sl@0
|
64 |
User::LeaveIfError(iMMStreamContainer.Open());
|
sl@0
|
65 |
User::LeaveIfError(iMMStream.Open(iMMStreamContainer));
|
sl@0
|
66 |
|
sl@0
|
67 |
User::LeaveIfError(iCameraViewFinder.Open(*cameraViewFinderChar));
|
sl@0
|
68 |
User::LeaveIfError(iMMStream.Append(iCameraViewFinder));
|
sl@0
|
69 |
|
sl@0
|
70 |
User::LeaveIfError(iGraphicsSink.Open(*graphicsSinkChar));
|
sl@0
|
71 |
User::LeaveIfError(iMMStream.Append(iGraphicsSink));
|
sl@0
|
72 |
|
sl@0
|
73 |
User::LeaveIfError(iCameraSensor.Open(*cameraSensorChar));
|
sl@0
|
74 |
User::LeaveIfError(iMMStream.Append(iCameraSensor));
|
sl@0
|
75 |
}
|
sl@0
|
76 |
|
sl@0
|
77 |
CMMCameraServerController::~CMMCameraServerController()
|
sl@0
|
78 |
{
|
sl@0
|
79 |
iCameraCapture.Close();
|
sl@0
|
80 |
iCameraSensor.Close();
|
sl@0
|
81 |
iGraphicsSink.Close();
|
sl@0
|
82 |
iCameraViewFinder.Close();
|
sl@0
|
83 |
iMMStream.Close();
|
sl@0
|
84 |
iMMStreamContainer.Close();
|
sl@0
|
85 |
iMMServer.Close();
|
sl@0
|
86 |
|
sl@0
|
87 |
iCamCntrlLink.Deque();
|
sl@0
|
88 |
iCamCntrlLink.iNext = NULL;
|
sl@0
|
89 |
}
|
sl@0
|
90 |
|
sl@0
|
91 |
TInt CMMCameraServerController::CameraIndex() const
|
sl@0
|
92 |
{
|
sl@0
|
93 |
return iCameraIndex;
|
sl@0
|
94 |
}
|
sl@0
|
95 |
|
sl@0
|
96 |
TInt CMMCameraServerController::CameraHandle() const
|
sl@0
|
97 |
{
|
sl@0
|
98 |
return iCameraHandle;
|
sl@0
|
99 |
}
|
sl@0
|
100 |
|
sl@0
|
101 |
void CMMCameraServerController::PrepareDirectViewFinderL(TDirectViewFinderInfo& aDirectViewFinderInfo)
|
sl@0
|
102 |
{
|
sl@0
|
103 |
// Default mode - One Shot setting off
|
sl@0
|
104 |
User::LeaveIfError(iCameraSensor.SetSensorOneShot(EFalse));
|
sl@0
|
105 |
|
sl@0
|
106 |
User::LeaveIfError(iCameraViewFinder.SetFrameDimensions(aDirectViewFinderInfo.iScreenRect.Width(), aDirectViewFinderInfo.iScreenRect.Height()));
|
sl@0
|
107 |
User::LeaveIfError(iCameraViewFinder.SetColorFormat(MMCameraComponents::EColorFormatYUV422Planar));
|
sl@0
|
108 |
// TODO: Replace 2 with calculation to find bytes per pixel depending on color format
|
sl@0
|
109 |
User::LeaveIfError(iCameraViewFinder.SetStride(aDirectViewFinderInfo.iScreenRect.Width() * 2));
|
sl@0
|
110 |
// Default mode - Frame rate = 30 fps
|
sl@0
|
111 |
User::LeaveIfError(iCameraViewFinder.SetFrameRate(KDefaultFrameRate));
|
sl@0
|
112 |
|
sl@0
|
113 |
User::LeaveIfError(iMMServer.Commit(iMMStreamContainer));
|
sl@0
|
114 |
|
sl@0
|
115 |
// User::LeaveIfError(iGraphicsSink.SetScreenNumber(aDirectViewFinderInfo.iScreenNum)); // Commented out as not yet supported by translators
|
sl@0
|
116 |
User::LeaveIfError(iGraphicsSink.GetSurfaceId(aDirectViewFinderInfo.iSurfaceId));
|
sl@0
|
117 |
iClipRect = aDirectViewFinderInfo.iClipRect;
|
sl@0
|
118 |
}
|
sl@0
|
119 |
|
sl@0
|
120 |
TInt CMMCameraServerController::StartDirectViewFinder()
|
sl@0
|
121 |
{
|
sl@0
|
122 |
TRequestStatus status;
|
sl@0
|
123 |
iMMStream.Start(status);
|
sl@0
|
124 |
User::WaitForRequest(status);
|
sl@0
|
125 |
if(status.Int() == KErrNone)
|
sl@0
|
126 |
{
|
sl@0
|
127 |
iViewFinderState = CCamera::CCameraV2DirectViewFinder::EViewFinderActive;
|
sl@0
|
128 |
}
|
sl@0
|
129 |
|
sl@0
|
130 |
return status.Int();
|
sl@0
|
131 |
}
|
sl@0
|
132 |
|
sl@0
|
133 |
void CMMCameraServerController::StopDirectViewFinder()
|
sl@0
|
134 |
{
|
sl@0
|
135 |
TRequestStatus status;
|
sl@0
|
136 |
iMMStream.Stop(status);
|
sl@0
|
137 |
User::WaitForRequest(status);
|
sl@0
|
138 |
iViewFinderState = CCamera::CCameraV2DirectViewFinder::EViewFinderInActive;
|
sl@0
|
139 |
}
|
sl@0
|
140 |
|
sl@0
|
141 |
void CMMCameraServerController::PauseDirectViewFinder()
|
sl@0
|
142 |
{
|
sl@0
|
143 |
TRequestStatus status;
|
sl@0
|
144 |
iMMStream.Pause(status);
|
sl@0
|
145 |
User::WaitForRequest(status);
|
sl@0
|
146 |
iViewFinderState = CCamera::CCameraV2DirectViewFinder::EViewFinderPause;
|
sl@0
|
147 |
}
|
sl@0
|
148 |
|
sl@0
|
149 |
void CMMCameraServerController::ResumeDirectViewFinder()
|
sl@0
|
150 |
{
|
sl@0
|
151 |
TRequestStatus status;
|
sl@0
|
152 |
iMMStream.Resume(status);
|
sl@0
|
153 |
User::WaitForRequest(status);
|
sl@0
|
154 |
iViewFinderState = CCamera::CCameraV2DirectViewFinder::EViewFinderActive;
|
sl@0
|
155 |
}
|
sl@0
|
156 |
|
sl@0
|
157 |
CCamera::CCameraV2DirectViewFinder::TViewFinderState CMMCameraServerController::GetDirectViewFinderState() const
|
sl@0
|
158 |
{
|
sl@0
|
159 |
return iViewFinderState;
|
sl@0
|
160 |
}
|
sl@0
|
161 |
|
sl@0
|
162 |
TInt CMMCameraServerController::SetDirectViewFinderMirror(const TBool aMirror)
|
sl@0
|
163 |
{
|
sl@0
|
164 |
// mismatch here between ECAM API (which only specify whether mirror is on or off)
|
sl@0
|
165 |
// and RMMCameraSensor (which specify horizontal and/or vertical mirror modes)
|
sl@0
|
166 |
if (aMirror)
|
sl@0
|
167 |
{
|
sl@0
|
168 |
return iCameraSensor.SetMirrorType(EMirrorHorizontal);
|
sl@0
|
169 |
}
|
sl@0
|
170 |
else
|
sl@0
|
171 |
{
|
sl@0
|
172 |
return iCameraSensor.SetMirrorType(EMirrorNone);
|
sl@0
|
173 |
}
|
sl@0
|
174 |
}
|
sl@0
|
175 |
|
sl@0
|
176 |
TInt CMMCameraServerController::GetDirectViewFinderMirror(TBool& aMirror)
|
sl@0
|
177 |
{
|
sl@0
|
178 |
// mismatch here between ECAM API (which only specify whether mirror is on or off)
|
sl@0
|
179 |
// and RMMCameraSensor (which specify horizontal and/or vertical mirror modes)
|
sl@0
|
180 |
TMMMirror mirror;
|
sl@0
|
181 |
TInt error = iCameraSensor.GetMirrorType(mirror);
|
sl@0
|
182 |
if (error != KErrNone)
|
sl@0
|
183 |
{
|
sl@0
|
184 |
return error;
|
sl@0
|
185 |
}
|
sl@0
|
186 |
|
sl@0
|
187 |
if (mirror == EMirrorHorizontal)
|
sl@0
|
188 |
{
|
sl@0
|
189 |
aMirror = ETrue;
|
sl@0
|
190 |
}
|
sl@0
|
191 |
else
|
sl@0
|
192 |
{
|
sl@0
|
193 |
aMirror = EFalse;
|
sl@0
|
194 |
}
|
sl@0
|
195 |
|
sl@0
|
196 |
return KErrNone;
|
sl@0
|
197 |
}
|
sl@0
|
198 |
|
sl@0
|
199 |
TInt CMMCameraServerController::DirectViewFinderProperties(TInt& aScreenNum, TRect& aScreenRect, TRect& aClipRect)
|
sl@0
|
200 |
{
|
sl@0
|
201 |
TUint screenNumber = 0;
|
sl@0
|
202 |
TInt error = iGraphicsSink.GetScreenNumber(screenNumber); // will currently just return 0 as screen number Set() not yet supported
|
sl@0
|
203 |
if (error == KErrNone)
|
sl@0
|
204 |
{
|
sl@0
|
205 |
aScreenNum = screenNumber;
|
sl@0
|
206 |
TUint width;
|
sl@0
|
207 |
TUint height;
|
sl@0
|
208 |
TInt error = iCameraViewFinder.GetFrameDimensions(width, height);
|
sl@0
|
209 |
if (error ==KErrNone)
|
sl@0
|
210 |
{
|
sl@0
|
211 |
aScreenRect.SetWidth(width);
|
sl@0
|
212 |
aScreenRect.SetHeight(height);
|
sl@0
|
213 |
aClipRect = iClipRect;
|
sl@0
|
214 |
return KErrNone;
|
sl@0
|
215 |
}
|
sl@0
|
216 |
}
|
sl@0
|
217 |
else
|
sl@0
|
218 |
{
|
sl@0
|
219 |
aScreenNum = -1;
|
sl@0
|
220 |
}
|
sl@0
|
221 |
|
sl@0
|
222 |
return error;
|
sl@0
|
223 |
}
|
sl@0
|
224 |
|
sl@0
|
225 |
TInt CMMCameraServerController::SetZoom(const TInt aZoom)
|
sl@0
|
226 |
{
|
sl@0
|
227 |
iZoom = aZoom;
|
sl@0
|
228 |
return KErrNone;
|
sl@0
|
229 |
}
|
sl@0
|
230 |
|
sl@0
|
231 |
TInt CMMCameraServerController::SetDigitalZoom(const TInt aDigitalZoom)
|
sl@0
|
232 |
{
|
sl@0
|
233 |
iDigitalZoom = aDigitalZoom;
|
sl@0
|
234 |
return KErrNone;
|
sl@0
|
235 |
}
|
sl@0
|
236 |
|
sl@0
|
237 |
TInt CMMCameraServerController::SetContrast(const TInt aContrast)
|
sl@0
|
238 |
{
|
sl@0
|
239 |
iContrast = aContrast;
|
sl@0
|
240 |
return KErrNone;
|
sl@0
|
241 |
}
|
sl@0
|
242 |
|
sl@0
|
243 |
TInt CMMCameraServerController::SetBrightness(const TInt aBrightness)
|
sl@0
|
244 |
{
|
sl@0
|
245 |
iBrightness = aBrightness;
|
sl@0
|
246 |
return KErrNone;
|
sl@0
|
247 |
// return iCameraSensor.SetBrightness(aBrightness);
|
sl@0
|
248 |
}
|
sl@0
|
249 |
|
sl@0
|
250 |
TInt CMMCameraServerController::SetFlash(const CCamera::TFlash aFlash)
|
sl@0
|
251 |
{
|
sl@0
|
252 |
iFlash = aFlash;
|
sl@0
|
253 |
return KErrNone;
|
sl@0
|
254 |
}
|
sl@0
|
255 |
|
sl@0
|
256 |
TInt CMMCameraServerController::SetExposure(const CCamera::TExposure aExposure)
|
sl@0
|
257 |
{
|
sl@0
|
258 |
iExposure = aExposure;
|
sl@0
|
259 |
return KErrNone;
|
sl@0
|
260 |
|
sl@0
|
261 |
/*
|
sl@0
|
262 |
// Several CCamera exposure values dont have equivalent TMMExposureControl values
|
sl@0
|
263 |
switch (aExposure)
|
sl@0
|
264 |
{
|
sl@0
|
265 |
case CCamera::EExposureAuto:
|
sl@0
|
266 |
{
|
sl@0
|
267 |
return iCameraSensor.SetExposureControl(EExposureControlAuto);
|
sl@0
|
268 |
}
|
sl@0
|
269 |
case CCamera::EExposureNight:
|
sl@0
|
270 |
{
|
sl@0
|
271 |
return iCameraSensor.SetExposureControl(EExposureControlNight);
|
sl@0
|
272 |
}
|
sl@0
|
273 |
case CCamera::EExposureBacklight:
|
sl@0
|
274 |
{
|
sl@0
|
275 |
return iCameraSensor.SetExposureControl(EExposureControlBackLight);
|
sl@0
|
276 |
}
|
sl@0
|
277 |
case CCamera::EExposureCenter:
|
sl@0
|
278 |
{
|
sl@0
|
279 |
return iCameraSensor.SetExposureControl(EExposureControlSpotLight);
|
sl@0
|
280 |
}
|
sl@0
|
281 |
case CCamera::EExposureSport:
|
sl@0
|
282 |
{
|
sl@0
|
283 |
return iCameraSensor.SetExposureControl(EExposureControlSports);
|
sl@0
|
284 |
}
|
sl@0
|
285 |
case CCamera::EExposureSnow:
|
sl@0
|
286 |
{
|
sl@0
|
287 |
return iCameraSensor.SetExposureControl(EExposureControlSnow);
|
sl@0
|
288 |
}
|
sl@0
|
289 |
case CCamera::EExposureBeach:
|
sl@0
|
290 |
{
|
sl@0
|
291 |
return iCameraSensor.SetExposureControl(EExposureControlBeach);
|
sl@0
|
292 |
}
|
sl@0
|
293 |
default:
|
sl@0
|
294 |
{
|
sl@0
|
295 |
return KErrNotSupported;
|
sl@0
|
296 |
}
|
sl@0
|
297 |
}
|
sl@0
|
298 |
*/ }
|
sl@0
|
299 |
|
sl@0
|
300 |
TInt CMMCameraServerController::SetWhiteBalance(const CCamera::TWhiteBalance aWhiteBalance)
|
sl@0
|
301 |
{
|
sl@0
|
302 |
iWhiteBalance = aWhiteBalance;
|
sl@0
|
303 |
return KErrNone;
|
sl@0
|
304 |
|
sl@0
|
305 |
/* // Several CCamera white balance values dont have equivalent TMMWhiteBalControl values
|
sl@0
|
306 |
switch (aWhiteBalance)
|
sl@0
|
307 |
{
|
sl@0
|
308 |
case CCamera::EWBAuto:
|
sl@0
|
309 |
{
|
sl@0
|
310 |
return iCameraSensor.SetWhiteBalanceControl(EWhiteBalControlAuto);
|
sl@0
|
311 |
}
|
sl@0
|
312 |
case CCamera::EWBDaylight:
|
sl@0
|
313 |
{
|
sl@0
|
314 |
return iCameraSensor.SetWhiteBalanceControl(EWhiteBalControlSunLight);
|
sl@0
|
315 |
}
|
sl@0
|
316 |
case CCamera::EWBCloudy:
|
sl@0
|
317 |
{
|
sl@0
|
318 |
return iCameraSensor.SetWhiteBalanceControl(EWhiteBalControlCloudy);
|
sl@0
|
319 |
}
|
sl@0
|
320 |
case CCamera::EWBTungsten:
|
sl@0
|
321 |
{
|
sl@0
|
322 |
return iCameraSensor.SetWhiteBalanceControl(EWhiteBalControlTungsten);
|
sl@0
|
323 |
}
|
sl@0
|
324 |
case CCamera::EWBFluorescent:
|
sl@0
|
325 |
{
|
sl@0
|
326 |
return iCameraSensor.SetWhiteBalanceControl(EWhiteBalControlFluorescent);
|
sl@0
|
327 |
}
|
sl@0
|
328 |
case CCamera::EWBFlash:
|
sl@0
|
329 |
{
|
sl@0
|
330 |
return iCameraSensor.SetWhiteBalanceControl(EWhiteBalControlFlash);
|
sl@0
|
331 |
}
|
sl@0
|
332 |
case CCamera::EWBShade:
|
sl@0
|
333 |
{
|
sl@0
|
334 |
return iCameraSensor.SetWhiteBalanceControl(EWhiteBalControlShade);
|
sl@0
|
335 |
}
|
sl@0
|
336 |
case CCamera::EWBHorizon:
|
sl@0
|
337 |
{
|
sl@0
|
338 |
return iCameraSensor.SetWhiteBalanceControl(EWhiteBalControlHorizon);
|
sl@0
|
339 |
}
|
sl@0
|
340 |
default:
|
sl@0
|
341 |
{
|
sl@0
|
342 |
return KErrNotSupported;
|
sl@0
|
343 |
}
|
sl@0
|
344 |
}
|
sl@0
|
345 |
*/ }
|
sl@0
|
346 |
|
sl@0
|
347 |
TInt CMMCameraServerController::GetZoom(TInt& aZoom)
|
sl@0
|
348 |
{
|
sl@0
|
349 |
aZoom = iZoom;
|
sl@0
|
350 |
return KErrNone;
|
sl@0
|
351 |
}
|
sl@0
|
352 |
|
sl@0
|
353 |
TInt CMMCameraServerController::GetDigitalZoom(TInt& aDigitalZoom)
|
sl@0
|
354 |
{
|
sl@0
|
355 |
aDigitalZoom = iDigitalZoom;
|
sl@0
|
356 |
return KErrNone;
|
sl@0
|
357 |
}
|
sl@0
|
358 |
|
sl@0
|
359 |
TInt CMMCameraServerController::GetContrast(TInt& aContrast)
|
sl@0
|
360 |
{
|
sl@0
|
361 |
aContrast = iContrast;
|
sl@0
|
362 |
return KErrNone;
|
sl@0
|
363 |
}
|
sl@0
|
364 |
|
sl@0
|
365 |
TInt CMMCameraServerController::GetBrightness(TInt& aBrightness)
|
sl@0
|
366 |
{
|
sl@0
|
367 |
aBrightness = iBrightness;
|
sl@0
|
368 |
return KErrNone;
|
sl@0
|
369 |
// return iCameraSensor.GetBrightness(aBrightness);
|
sl@0
|
370 |
}
|
sl@0
|
371 |
|
sl@0
|
372 |
TInt CMMCameraServerController::GetFlash(CCamera::TFlash& aFlash)
|
sl@0
|
373 |
{
|
sl@0
|
374 |
aFlash = iFlash;
|
sl@0
|
375 |
return KErrNone;
|
sl@0
|
376 |
}
|
sl@0
|
377 |
|
sl@0
|
378 |
TInt CMMCameraServerController::GetExposure(CCamera::TExposure& aExposure)
|
sl@0
|
379 |
{
|
sl@0
|
380 |
aExposure = iExposure;
|
sl@0
|
381 |
return KErrNone;
|
sl@0
|
382 |
|
sl@0
|
383 |
/*
|
sl@0
|
384 |
// Several CCamera exposure values dont have equivalent TMMExposureControl values
|
sl@0
|
385 |
TMMExposureControl exposure;
|
sl@0
|
386 |
TInt error = iCameraSensor.GetExposureControl(exposure);
|
sl@0
|
387 |
if (error != KErrNone)
|
sl@0
|
388 |
{
|
sl@0
|
389 |
return error;
|
sl@0
|
390 |
}
|
sl@0
|
391 |
|
sl@0
|
392 |
switch (exposure)
|
sl@0
|
393 |
{
|
sl@0
|
394 |
case EExposureControlAuto:
|
sl@0
|
395 |
{
|
sl@0
|
396 |
aExposure = CCamera::EExposureAuto;
|
sl@0
|
397 |
break;
|
sl@0
|
398 |
}
|
sl@0
|
399 |
case EExposureControlNight:
|
sl@0
|
400 |
{
|
sl@0
|
401 |
aExposure = CCamera::EExposureNight;
|
sl@0
|
402 |
break;
|
sl@0
|
403 |
}
|
sl@0
|
404 |
case EExposureControlBackLight:
|
sl@0
|
405 |
{
|
sl@0
|
406 |
aExposure = CCamera::EExposureBacklight;
|
sl@0
|
407 |
break;
|
sl@0
|
408 |
}
|
sl@0
|
409 |
case EExposureControlSpotLight:
|
sl@0
|
410 |
{
|
sl@0
|
411 |
aExposure = CCamera::EExposureCenter;
|
sl@0
|
412 |
break;
|
sl@0
|
413 |
}
|
sl@0
|
414 |
case EExposureControlSports:
|
sl@0
|
415 |
{
|
sl@0
|
416 |
aExposure = CCamera::EExposureSport;
|
sl@0
|
417 |
break;
|
sl@0
|
418 |
}
|
sl@0
|
419 |
case EExposureControlSnow:
|
sl@0
|
420 |
{
|
sl@0
|
421 |
aExposure = CCamera::EExposureSnow;
|
sl@0
|
422 |
break;
|
sl@0
|
423 |
}
|
sl@0
|
424 |
case EExposureControlBeach:
|
sl@0
|
425 |
{
|
sl@0
|
426 |
aExposure = CCamera::EExposureBeach;
|
sl@0
|
427 |
break;
|
sl@0
|
428 |
}
|
sl@0
|
429 |
default:
|
sl@0
|
430 |
{
|
sl@0
|
431 |
return KErrNotSupported;
|
sl@0
|
432 |
}
|
sl@0
|
433 |
}
|
sl@0
|
434 |
|
sl@0
|
435 |
return KErrNone;
|
sl@0
|
436 |
*/ }
|
sl@0
|
437 |
|
sl@0
|
438 |
TInt CMMCameraServerController::GetWhiteBalance(CCamera::TWhiteBalance& aWhiteBalance)
|
sl@0
|
439 |
{
|
sl@0
|
440 |
aWhiteBalance = iWhiteBalance;
|
sl@0
|
441 |
return KErrNone;
|
sl@0
|
442 |
|
sl@0
|
443 |
/*
|
sl@0
|
444 |
// Several CCamera white balance values dont have equivalent TMMWhiteBalControl values
|
sl@0
|
445 |
TMMWhiteBalControl whiteBal;
|
sl@0
|
446 |
TInt error = iCameraSensor.GetWhiteBalanceControl(whiteBal);
|
sl@0
|
447 |
if (error != KErrNone)
|
sl@0
|
448 |
{
|
sl@0
|
449 |
return error;
|
sl@0
|
450 |
}
|
sl@0
|
451 |
|
sl@0
|
452 |
switch (aWhiteBalance)
|
sl@0
|
453 |
{
|
sl@0
|
454 |
case EWhiteBalControlAuto:
|
sl@0
|
455 |
{
|
sl@0
|
456 |
aWhiteBalance = CCamera::EWBAuto;
|
sl@0
|
457 |
break;
|
sl@0
|
458 |
}
|
sl@0
|
459 |
case EWhiteBalControlSunLight:
|
sl@0
|
460 |
{
|
sl@0
|
461 |
aWhiteBalance = CCamera::EWBDaylight;
|
sl@0
|
462 |
break;
|
sl@0
|
463 |
}
|
sl@0
|
464 |
case EWhiteBalControlCloudy:
|
sl@0
|
465 |
{
|
sl@0
|
466 |
aWhiteBalance = CCamera::EWBCloudy;
|
sl@0
|
467 |
break;
|
sl@0
|
468 |
}
|
sl@0
|
469 |
case EWhiteBalControlTungsten:
|
sl@0
|
470 |
{
|
sl@0
|
471 |
aWhiteBalance = CCamera::EWBTungsten;
|
sl@0
|
472 |
break;
|
sl@0
|
473 |
}
|
sl@0
|
474 |
case EWhiteBalControlFluorescent:
|
sl@0
|
475 |
{
|
sl@0
|
476 |
aWhiteBalance = CCamera::EWBFluorescent;
|
sl@0
|
477 |
break;
|
sl@0
|
478 |
}
|
sl@0
|
479 |
case EWhiteBalControlFlash:
|
sl@0
|
480 |
{
|
sl@0
|
481 |
aWhiteBalance = CCamera::EWBFlash;
|
sl@0
|
482 |
break;
|
sl@0
|
483 |
}
|
sl@0
|
484 |
case EWhiteBalControlShade:
|
sl@0
|
485 |
{
|
sl@0
|
486 |
aWhiteBalance = CCamera::EWBShade;
|
sl@0
|
487 |
break;
|
sl@0
|
488 |
}
|
sl@0
|
489 |
case EWhiteBalControlHorizon:
|
sl@0
|
490 |
{
|
sl@0
|
491 |
aWhiteBalance = CCamera::EWBHorizon;
|
sl@0
|
492 |
break;
|
sl@0
|
493 |
}
|
sl@0
|
494 |
default:
|
sl@0
|
495 |
{
|
sl@0
|
496 |
return KErrNotSupported;
|
sl@0
|
497 |
}
|
sl@0
|
498 |
}
|
sl@0
|
499 |
|
sl@0
|
500 |
return KErrNone;
|
sl@0
|
501 |
*/ }
|
sl@0
|
502 |
|
sl@0
|
503 |
void CMMCameraServerController::Reset()
|
sl@0
|
504 |
{
|
sl@0
|
505 |
if (iViewFinderState == CCamera::CCameraV2DirectViewFinder::EViewFinderActive)
|
sl@0
|
506 |
{
|
sl@0
|
507 |
StopDirectViewFinder();
|
sl@0
|
508 |
}
|
sl@0
|
509 |
}
|
sl@0
|
510 |
|
sl@0
|
511 |
|
sl@0
|
512 |
|
sl@0
|
513 |
|
sl@0
|
514 |
CMMCameraServerControllerQuery* CMMCameraServerControllerQuery::NewL()
|
sl@0
|
515 |
{
|
sl@0
|
516 |
CMMCameraServerControllerQuery* self = new (ELeave) CMMCameraServerControllerQuery();
|
sl@0
|
517 |
CleanupStack::PushL(self);
|
sl@0
|
518 |
self->ConstructL();
|
sl@0
|
519 |
CleanupStack::Pop(self);
|
sl@0
|
520 |
return self;
|
sl@0
|
521 |
}
|
sl@0
|
522 |
|
sl@0
|
523 |
CMMCameraServerControllerQuery::~CMMCameraServerControllerQuery()
|
sl@0
|
524 |
{
|
sl@0
|
525 |
iServer.Close();
|
sl@0
|
526 |
}
|
sl@0
|
527 |
|
sl@0
|
528 |
void CMMCameraServerControllerQuery::ConstructL()
|
sl@0
|
529 |
{
|
sl@0
|
530 |
User::LeaveIfError(iServer.Connect());
|
sl@0
|
531 |
}
|
sl@0
|
532 |
|
sl@0
|
533 |
CMMCameraServerControllerQuery::CMMCameraServerControllerQuery()
|
sl@0
|
534 |
{
|
sl@0
|
535 |
}
|
sl@0
|
536 |
|
sl@0
|
537 |
TInt CMMCameraServerControllerQuery::GetCamerasAvailable()
|
sl@0
|
538 |
{
|
sl@0
|
539 |
// Code to query MM server TBC
|
sl@0
|
540 |
return 1;
|
sl@0
|
541 |
}
|