|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CAM_CAMERA_H |
|
20 #define CAM_CAMERA_H |
|
21 |
|
22 #include <ecam/ecamplugin.h> |
|
23 #include <e32base.h> |
|
24 |
|
25 #include "CamCameraCallback.h" |
|
26 class MCameraObserver; |
|
27 class MCameraObserver2; |
|
28 class CCamCameraCallback; //CCamCameraCallBack |
|
29 |
|
30 class CCamCamera : public CCameraPlugin |
|
31 { |
|
32 public: |
|
33 |
|
34 /* |
|
35 * NewL method; creating an instance based on MCameraObserver2 |
|
36 */ |
|
37 static CCamCamera* NewL( MCameraObserver2& aObserver, |
|
38 TInt aCameraIndex, |
|
39 TInt aPriority ); |
|
40 |
|
41 /** |
|
42 * New2L method |
|
43 */ |
|
44 static CCamCamera* New2L( MCameraObserver2& aObserver, |
|
45 TInt aCameraIndex, |
|
46 TInt aPriority ); |
|
47 |
|
48 /* |
|
49 * NewL method returns CCamera object; created based on |
|
50 * MCameraObserver's observer |
|
51 */ |
|
52 static CCamCamera* NewL( MCameraObserver& aObserver, |
|
53 TInt aCameraIndex ); |
|
54 |
|
55 /** |
|
56 * New2L method |
|
57 */ |
|
58 static CCamCamera* New2L( MCameraObserver& aObserver, |
|
59 TInt aCameraIndex ); |
|
60 |
|
61 /* |
|
62 * NewDuplicateL |
|
63 */ |
|
64 static CCamCamera* NewDuplicateL( MCameraObserver2& aObserver, |
|
65 TInt aCameraHandle ); |
|
66 |
|
67 /* |
|
68 * NewDuplicate2L |
|
69 */ |
|
70 static CCamCamera* NewDuplicate2L( MCameraObserver2& aObserver, |
|
71 TInt aCameraHandle ); |
|
72 |
|
73 /* |
|
74 * NewDuplicateL |
|
75 */ |
|
76 static CCamCamera* NewDuplicateL( MCameraObserver& aObserver, |
|
77 TInt aCameraHandle ); |
|
78 |
|
79 /* |
|
80 * NewDuplicate2L |
|
81 */ |
|
82 static CCamCamera* NewDuplicate2L( MCameraObserver& aObserver, |
|
83 TInt aCameraHandle ); |
|
84 |
|
85 /* |
|
86 * Destructor |
|
87 */ |
|
88 ~CCamCamera(); |
|
89 |
|
90 |
|
91 // Needed for compatibility with Symbian CCameraPlugin. Not implemented. |
|
92 void Construct2L(MCameraObserver& aObserver, TInt aCameraIndex); |
|
93 void Construct2DupL(MCameraObserver& aObserver, TInt aCameraHandle); |
|
94 void Construct2L(MCameraObserver2& aObserver, TInt aCameraIndex,TInt aPriority); |
|
95 void Construct2DupL(MCameraObserver2& aObserver, TInt aCameraHandle); |
|
96 |
|
97 public: // From CCamera documentation found from symbian |
|
98 |
|
99 /* |
|
100 * Returns the number of camera's available |
|
101 * For now, its 2 |
|
102 */ |
|
103 static TInt CamerasAvailable(); |
|
104 |
|
105 /* |
|
106 * All the default information is set using this method for the camera |
|
107 * Refer to TCameraInfo for further details |
|
108 */ |
|
109 virtual void CameraInfo(TCameraInfo& aInfo) const; |
|
110 |
|
111 /* |
|
112 * Interface to reserve the camera, before actually using it |
|
113 */ |
|
114 virtual void Reserve(); |
|
115 |
|
116 /* |
|
117 * Release the camera, if not needed |
|
118 */ |
|
119 virtual void Release(); |
|
120 |
|
121 /* |
|
122 * Interface to switch to PowerOn state of the camera |
|
123 */ |
|
124 virtual void PowerOn(); |
|
125 |
|
126 /* |
|
127 * Interface to switch to PowerOff state |
|
128 */ |
|
129 virtual void PowerOff(); |
|
130 |
|
131 /* |
|
132 * Interface to return the Handle ID for the camera |
|
133 */ |
|
134 virtual TInt Handle(); |
|
135 |
|
136 /* |
|
137 * Interface to set the zoom factor for the camera; by default its 0 |
|
138 */ |
|
139 virtual void SetZoomFactorL(TInt aZoomFactor = 0); |
|
140 |
|
141 /* |
|
142 * Interface to get the zoom factor |
|
143 */ |
|
144 virtual TInt ZoomFactor() const; |
|
145 |
|
146 /* |
|
147 * Interface to set the digital zoom factor for the camera; by default its 0 |
|
148 */ |
|
149 virtual void SetDigitalZoomFactorL(TInt aDigitalZoomFactor = 0); |
|
150 |
|
151 /* |
|
152 * Interface to get the digital zoom factor for the camera; by default its 0 |
|
153 */ |
|
154 virtual TInt DigitalZoomFactor() const; |
|
155 |
|
156 /* |
|
157 * Interface to set the contrast for the camera |
|
158 */ |
|
159 virtual void SetContrastL(TInt aContrast); |
|
160 |
|
161 /* |
|
162 * Interface to get the contrast for the camera |
|
163 */ |
|
164 virtual TInt Contrast() const; |
|
165 |
|
166 /* |
|
167 * Interface to set the brightness |
|
168 */ |
|
169 virtual void SetBrightnessL(TInt aBrightness); |
|
170 |
|
171 /* |
|
172 * Interface to get the brightness of camera |
|
173 */ |
|
174 virtual TInt Brightness() const; |
|
175 |
|
176 /* |
|
177 * Interface to start the direct view finder |
|
178 */ |
|
179 virtual void StartViewFinderDirectL(RWsSession& aWs,CWsScreenDevice& aScreenDevice,RWindowBase& aWindow,TRect& aScreenRect); |
|
180 |
|
181 /* |
|
182 * Interface to start the direct view finder |
|
183 */ |
|
184 virtual void StartViewFinderDirectL(RWsSession& aWs,CWsScreenDevice& aScreenDevice,RWindowBase& aWindow,TRect& aScreenRect,TRect& aClipRect); |
|
185 |
|
186 /* |
|
187 * Interface to start the view finder bitmaps |
|
188 */ |
|
189 virtual void StartViewFinderBitmapsL(TSize& aSize); |
|
190 |
|
191 /* |
|
192 * Interface to start the view finder bitmaps |
|
193 */ |
|
194 virtual void StartViewFinderBitmapsL(TSize& aSize,TRect& aClipRect); |
|
195 |
|
196 /* |
|
197 * Interface to start the View finder frame |
|
198 */ |
|
199 virtual void StartViewFinderL(TFormat aImageFormat,TSize& aSize); |
|
200 |
|
201 /* |
|
202 * Interface to start the view finder |
|
203 */ |
|
204 virtual void StartViewFinderL(TFormat aImageFormat,TSize& aSize,TRect& aClipRect); |
|
205 |
|
206 /* |
|
207 * Interface to check if the view finder is active |
|
208 */ |
|
209 virtual TBool ViewFinderActive() const; |
|
210 |
|
211 /* |
|
212 * |
|
213 */ |
|
214 virtual void SetViewFinderMirrorL(TBool aMirror); |
|
215 |
|
216 /* |
|
217 * |
|
218 */ |
|
219 virtual TBool ViewFinderMirror() const; |
|
220 |
|
221 /* |
|
222 * Interface to stop the view finder |
|
223 */ |
|
224 virtual void StopViewFinder(); |
|
225 |
|
226 /* |
|
227 * Interface to start Prepare Image Capture |
|
228 */ |
|
229 virtual void PrepareImageCaptureL(TFormat aImageFormat,TInt aSizeIndex); |
|
230 |
|
231 /* |
|
232 * Interface to start Prepare Image Capture |
|
233 */ |
|
234 virtual void PrepareImageCaptureL(TFormat aImageFormat,TInt aSizeIndex,const TRect& aClipRect); |
|
235 |
|
236 /* |
|
237 * Interface to Capture Image |
|
238 */ |
|
239 virtual void CaptureImage(); |
|
240 |
|
241 /* |
|
242 * Interface to Cancel Capture Image |
|
243 */ |
|
244 virtual void CancelCaptureImage(); |
|
245 |
|
246 /* |
|
247 * |
|
248 */ |
|
249 virtual void EnumerateCaptureSizes(TSize& aSize,TInt aSizeIndex,TFormat aFormat) const; |
|
250 |
|
251 /* |
|
252 * Interfaces to start prepare video capture |
|
253 */ |
|
254 virtual void PrepareVideoCaptureL(TFormat aFormat,TInt aSizeIndex,TInt aRateIndex,TInt aBuffersToUse,TInt aFramesPerBuffer); |
|
255 |
|
256 /* |
|
257 * Interfaces to start prepare video capture |
|
258 */ |
|
259 virtual void PrepareVideoCaptureL(TFormat aFormat,TInt aSizeIndex,TInt aRateIndex,TInt aBuffersToUse,TInt aFramesPerBuffer,const TRect& aClipRect); |
|
260 |
|
261 /* |
|
262 * Interface to start the video capture |
|
263 */ |
|
264 virtual void StartVideoCapture(); |
|
265 |
|
266 /* |
|
267 * Interface to stop the video capture |
|
268 */ |
|
269 virtual void StopVideoCapture(); |
|
270 |
|
271 /* |
|
272 * Interface to check if the video capture is active |
|
273 */ |
|
274 virtual TBool VideoCaptureActive() const; |
|
275 |
|
276 /* |
|
277 * |
|
278 */ |
|
279 virtual void EnumerateVideoFrameSizes(TSize& aSize,TInt aSizeIndex,TFormat aFormat) const; |
|
280 |
|
281 /* |
|
282 * |
|
283 */ |
|
284 virtual void EnumerateVideoFrameRates(TReal32& aRate,TInt aRateIndex,TFormat aFormat,TInt aSizeIndex,TExposure aExposure = EExposureAuto) const; |
|
285 |
|
286 /* |
|
287 * Interface to fetch the frame size |
|
288 */ |
|
289 virtual void GetFrameSize(TSize& aSize) const; |
|
290 |
|
291 /* |
|
292 * Interface to get the Frame Rate |
|
293 */ |
|
294 virtual TReal32 FrameRate() const; |
|
295 |
|
296 /* |
|
297 * Interface to get the number of buffers in use |
|
298 */ |
|
299 virtual TInt BuffersInUse() const; |
|
300 |
|
301 /* |
|
302 * Interface to get the number of frames in a buffer |
|
303 */ |
|
304 virtual TInt FramesPerBuffer() const; |
|
305 |
|
306 /* |
|
307 * Interface to set the JPEG quality |
|
308 */ |
|
309 virtual void SetJpegQuality(TInt aQuality); |
|
310 |
|
311 /* |
|
312 * Return the JPEG quality |
|
313 */ |
|
314 virtual TInt JpegQuality() const; |
|
315 |
|
316 /* |
|
317 * |
|
318 */ |
|
319 virtual TAny* CustomInterface(TUid aInterface); |
|
320 /* |
|
321 * |
|
322 */ |
|
323 virtual void SetFlashL(TFlash aFlash = EFlashNone); |
|
324 /* |
|
325 * |
|
326 */ |
|
327 virtual TFlash Flash() const; |
|
328 /* |
|
329 * |
|
330 */ |
|
331 virtual void SetExposureL(TExposure aExposure = EExposureAuto); |
|
332 /* |
|
333 * |
|
334 */ |
|
335 virtual TExposure Exposure() const; |
|
336 /* |
|
337 * |
|
338 */ |
|
339 virtual void SetWhiteBalanceL(TWhiteBalance aWhiteBalance = EWBAuto); |
|
340 /* |
|
341 * |
|
342 */ |
|
343 virtual TWhiteBalance WhiteBalance() const; |
|
344 /* |
|
345 * |
|
346 */ |
|
347 |
|
348 |
|
349 // Private methods |
|
350 private: |
|
351 |
|
352 /* |
|
353 * |
|
354 */ |
|
355 void InitPhotoResolutionsL(); |
|
356 |
|
357 /* |
|
358 * |
|
359 */ |
|
360 static TInt ViewfinderCallBack( TAny* aSelf ); |
|
361 |
|
362 |
|
363 // Constructors |
|
364 private: |
|
365 |
|
366 /* |
|
367 * ConstructL |
|
368 */ |
|
369 void ConstructL(); |
|
370 |
|
371 /* |
|
372 * Constructor |
|
373 */ |
|
374 CCamCamera( MCameraObserver& aObserver, TInt aCameraIndex ); |
|
375 |
|
376 /* |
|
377 * Constructor |
|
378 */ |
|
379 CCamCamera( MCameraObserver2& aObserver, TInt aCameraIndex, TInt aPriority ); |
|
380 |
|
381 |
|
382 private: |
|
383 // Observers defined from CamCameraController |
|
384 MCameraObserver* iObserver; |
|
385 MCameraObserver2* iObserver2; |
|
386 |
|
387 // Call Back Related members |
|
388 CCamCameraCallBack* iCallBackActive; |
|
389 |
|
390 // Keeping track of the camera states (TCamCameraStateFlags ORed). |
|
391 // @see TCamCameraStateFlags |
|
392 TUint iState; |
|
393 |
|
394 TInt iCameraIndex; |
|
395 TInt iPriority; |
|
396 |
|
397 TCameraInfo iInfo; |
|
398 |
|
399 TInt iBrightness; |
|
400 TInt iContrast; |
|
401 |
|
402 TWhiteBalance iWhiteBalance; |
|
403 TExposure iExposure; |
|
404 TFlash iFlash; |
|
405 |
|
406 TInt iDigitalZoom; |
|
407 TInt iZoomFactor; |
|
408 |
|
409 TSize iViewfinderSize; |
|
410 TBool iViewFinderMirror; |
|
411 |
|
412 TFormat iFormat; |
|
413 TInt iSizeIndex; |
|
414 TInt iQuality; |
|
415 |
|
416 RArray<TSize> iPhotoResolutions; |
|
417 CCameraappTestBitmapManager* iBitmapManager; |
|
418 CPeriodic *iVfPeriodic; |
|
419 }; |
|
420 |
|
421 #endif // CAM_CAMERA_H |
|
422 |
|
423 |
|
424 |