|
1 /* |
|
2 * Copyright (c) 2002 - 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: Camera Application Engine implementation video recording methods |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include <mmf/server/mmffile.h> // For MMF definitions (as TMMFFileConfig) |
|
22 #include <AudioPreference.h> // For MMF audio preference definitions. |
|
23 |
|
24 |
|
25 #include "CaeEngineImp.h" // Engine implementation header. |
|
26 #include "CaeVideoQualityLevels.h" // For video recording quality levels. |
|
27 #include "CaeVideoTimes.h" // For generating video recording time estimates. |
|
28 #include "CaeStillStatesActive.h" |
|
29 |
|
30 #ifdef CAE_TEST_VERSION |
|
31 #include "CaeEngineImpTestErrors.h" // For TEST_VERSION compilation only |
|
32 #endif |
|
33 |
|
34 #include "OstTraceDefinitions.h" |
|
35 #ifdef OST_TRACE_COMPILER_IN_USE |
|
36 #include "CaeEngineImpVideoRecordingTraces.h" |
|
37 #endif |
|
38 |
|
39 // ============================ MEMBER FUNCTIONS =============================== |
|
40 |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // CCaeEngineImp::InitVideoRecorderL |
|
44 // Initialise the engine for video recording using default parameters. |
|
45 // ----------------------------------------------------------------------------- |
|
46 // |
|
47 void CCaeEngineImp::InitVideoRecorderL() |
|
48 { |
|
49 OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_INITVIDEORECORDERL, "e_CAM_CAE_INITVIDEORECORDER 1" ); |
|
50 LOGTEXT( _L( "Cae: CCaeEngineImp::InitVideoRecorderL() entering" ) ); |
|
51 |
|
52 iVideoInitialized = EFalse; |
|
53 |
|
54 // Close video recording if previously opened/prepared. |
|
55 CloseVideoRecording(); |
|
56 |
|
57 // (Re-)initialize these. |
|
58 iVideoTimesInterval = KVideoTimesIntervalDefault; |
|
59 iMaxClipSizeInBytes = KMMFNoMaxClipSize; |
|
60 iMaxClipSizeInBytesPrep = KMMFNoMaxClipSize; |
|
61 |
|
62 // Create video quality levels container object. |
|
63 delete iVideoQualityLevelsCont; |
|
64 iVideoQualityLevelsCont = NULL; |
|
65 iVideoQualityLevelsCont = CCaeVideoQualityLevelsCont::NewL(); |
|
66 |
|
67 // Destroy possible video clip file name. (Its allocated elsewhere when file name is set.) |
|
68 delete iVideoClipFileName; |
|
69 iVideoClipFileName = NULL; |
|
70 |
|
71 // Create video recorder. |
|
72 delete iVideoRecorder; |
|
73 iVideoRecorder = NULL; |
|
74 iVideoRecorder = CVideoRecorderUtility::NewL( *this , KAudioPriorityVideoRecording, |
|
75 TMdaPriorityPreference( KAudioPrefVideoRecording ) ); |
|
76 |
|
77 delete iVideoFrameSize; |
|
78 iVideoFrameSize = NULL; |
|
79 iVideoFrameSize = new( ELeave ) TSize(); |
|
80 |
|
81 delete iVideoFrameSizePrep; |
|
82 iVideoFrameSizePrep = NULL; |
|
83 iVideoFrameSizePrep = new( ELeave ) TSize(); |
|
84 |
|
85 // Create video times generator object. |
|
86 delete iVideoTimes; |
|
87 iVideoTimes = NULL; |
|
88 iVideoTimes = CCaeVideoTimes::NewL(); |
|
89 |
|
90 // Create call-back function for video times generation. |
|
91 delete iVideoTimesCallback; |
|
92 iVideoTimesCallback = NULL; |
|
93 iVideoTimesCallback = new( ELeave ) TCallBack( VideoRecordingTimesCallback, this ); |
|
94 |
|
95 // Initialize default video recording quality levels. |
|
96 iInfo->iNumVideoQualityLevelsSupported = |
|
97 iVideoQualityLevelsCont->InitDefaultsL(); |
|
98 |
|
99 iVideoInitialized = ETrue; |
|
100 |
|
101 LOGTEXT( _L( "Cae: CCaeEngineImp::InitVideoRecorderL() returning" ) ); |
|
102 OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_INITVIDEORECORDERL, "e_CAM_CAE_INITVIDEORECORDER 0" ); |
|
103 } |
|
104 |
|
105 |
|
106 // ----------------------------------------------------------------------------- |
|
107 // CCaeEngineImp::InitVideoRecorderL |
|
108 // Initialise the engine for video recording using either using default |
|
109 // parameters or parameters from ini-file. |
|
110 // ----------------------------------------------------------------------------- |
|
111 // |
|
112 void CCaeEngineImp::InitVideoRecorderL( |
|
113 TUid aSdUidVideoQltyLevels ) |
|
114 { |
|
115 if( aSdUidVideoQltyLevels == KNullUid ) |
|
116 { |
|
117 InitVideoRecorderL(); |
|
118 } |
|
119 else |
|
120 { |
|
121 LOGTEXT( _L( "Cae: CCaeEngineImp::InitVideoRecorderL(aSdUidVideoQltyLevels): NOT SUPPORTED, leaving" ) ); |
|
122 User::Leave( KErrNotSupported ); |
|
123 } |
|
124 } |
|
125 |
|
126 |
|
127 // ----------------------------------------------------------------------------- |
|
128 // CCaeEngineImp::SetVideoRecordingFileNameL |
|
129 // If video recording is not prepared then just memorizes the file name. |
|
130 // If video recording is prepared, then calls variated ChangeVideoFileNameL(). |
|
131 // ----------------------------------------------------------------------------- |
|
132 // |
|
133 void CCaeEngineImp::SetVideoRecordingFileNameL( |
|
134 const TDesC& aVideoClipFileName ) |
|
135 { |
|
136 LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoRecordingFileNameL() entering" ) ); |
|
137 |
|
138 if ( !iVideoInitialized || iVideoRecordingRunning ) |
|
139 { |
|
140 LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoRecordingFileNameL leaving KErrNotReady" )); |
|
141 User::Leave( KErrNotReady ); |
|
142 } |
|
143 |
|
144 if ( aVideoClipFileName.Length() > 0 ) |
|
145 { |
|
146 // Memorize the video clip file name. |
|
147 delete iVideoClipFileName; |
|
148 iVideoClipFileName = NULL; |
|
149 iVideoClipFileName = aVideoClipFileName.AllocL(); |
|
150 } |
|
151 else |
|
152 { |
|
153 LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoRecordingFileNameL leaving KErrArgument (aVideoClipFileName)" )); |
|
154 User::Leave( KErrArgument ); |
|
155 } |
|
156 |
|
157 if ( iVideoPrepared ) |
|
158 { |
|
159 // Does the actual change of file name, only if video is prepared. |
|
160 // Note: Variated implementation |
|
161 ChangeVideoFileNameL(); |
|
162 } |
|
163 |
|
164 LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoRecordingFileNameL() returning" ) ); |
|
165 } |
|
166 |
|
167 |
|
168 // ----------------------------------------------------------------------------- |
|
169 // CCaeEngineImp::PrepareVideoRecordingL |
|
170 // Retrieves video recording parameters from the specified quality level and |
|
171 // calls overloading PrepareVideoRecordingL(). |
|
172 // ----------------------------------------------------------------------------- |
|
173 // |
|
174 void CCaeEngineImp::PrepareVideoRecordingL( |
|
175 TInt aVideoQualityIndex ) |
|
176 { |
|
177 LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareVideoRecordingL() entering" ) ); |
|
178 |
|
179 if ( ( aVideoQualityIndex < 0 ) || |
|
180 ( aVideoQualityIndex >= iVideoQualityLevelsCont->Count() ) ) |
|
181 { |
|
182 LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareVideoRecordingL() leaving KErrArgument" ) ); |
|
183 User::Leave( KErrArgument ); |
|
184 } |
|
185 |
|
186 PrepareVideoRecordingL( iVideoQualityLevelsCont->At( aVideoQualityIndex ).iFrameSize, |
|
187 iVideoQualityLevelsCont->At( aVideoQualityIndex ).iFrameRate, |
|
188 iVideoQualityLevelsCont->At( aVideoQualityIndex ).iBitRate, |
|
189 iVideoQualityLevelsCont->At( aVideoQualityIndex ).iAudioEnabled, |
|
190 iVideoQualityLevelsCont->At( aVideoQualityIndex ).iAudioBitRate, |
|
191 iVideoQualityLevelsCont->At( aVideoQualityIndex ).iMimeType, |
|
192 iVideoQualityLevelsCont->At( aVideoQualityIndex ).iPreferredSupplier, |
|
193 iVideoQualityLevelsCont->At( aVideoQualityIndex ).iVideoType, |
|
194 iVideoQualityLevelsCont->At( aVideoQualityIndex ).iAudioType ); |
|
195 |
|
196 iVideoQualityIndex = aVideoQualityIndex; |
|
197 |
|
198 LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareVideoRecordingL() returning" ) ); |
|
199 } |
|
200 |
|
201 |
|
202 // ----------------------------------------------------------------------------- |
|
203 // CCaeEngineImp::PrepareVideoRecordingL |
|
204 // Finds first the UIDs needed for opening a video recording, uses ECOM. |
|
205 // Then gets camera handle from Camera API. |
|
206 // Finally calls Video Recorder API OpenFileL(). |
|
207 // ----------------------------------------------------------------------------- |
|
208 // |
|
209 void CCaeEngineImp::PrepareVideoRecordingL( |
|
210 const TSize& aFrameSize, |
|
211 TReal32 aFrameRate, |
|
212 TInt aBitRate, |
|
213 TBool aAudioEnabled, |
|
214 const TDesC8& aMimeType, |
|
215 const TDesC& aPreferredSupplier, |
|
216 const TDesC8& aVideoType, |
|
217 const TDesC8& aAudioType ) |
|
218 { |
|
219 OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_PREPAREVIDEORECORDINGL, "e_CAM_CAE_PREPAREVIDEORECORDING 1" ); |
|
220 LOGTEXT3( _L( "Cae: CCaeEngineImp::PrepareVideoRecordingL() entering aFrameSize wxh=%dx%d" ), |
|
221 aFrameSize.iWidth, aFrameSize.iHeight ); |
|
222 |
|
223 // Leave if not initialized properly or busy doing something else. |
|
224 if ( !iVideoInitialized || |
|
225 !iVideoClipFileName || |
|
226 iStillStatesActive->IsRunning() || |
|
227 iVideoRecordingRunning ) |
|
228 { |
|
229 LOGTEXT2( _L( "Cae: CCaeEngineImp::PrepareVideoRecordingL leaving KErrNotReady, iVideoInitialized=%d" ), iVideoInitialized ); |
|
230 User::Leave( KErrNotReady ); |
|
231 } |
|
232 |
|
233 CheckPowerL(); |
|
234 |
|
235 // Leave if video clip file name is not set properly. |
|
236 if ( iVideoClipFileName->Length() == 0 ) |
|
237 { |
|
238 LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareVideoRecordingL() leaving KErrArgument (iVideoClipFileName)" ) ); |
|
239 User::Leave( KErrArgument ); |
|
240 } |
|
241 |
|
242 // Close if previously opened/prepared. |
|
243 CloseVideoRecording(); |
|
244 |
|
245 // Find values for iVideoControllerUid and iVideoFormatUid. |
|
246 // Those are also needed if clip file name is changed when prepared. |
|
247 FindVideoUidsL( aMimeType, aPreferredSupplier ); |
|
248 |
|
249 // Memorize video type. |
|
250 delete iVideoType; |
|
251 iVideoType = NULL; |
|
252 iVideoType = aVideoType.AllocL(); |
|
253 |
|
254 // Convert audio type from TDesC8 to TFourCC. |
|
255 iVideoAudioType = ConvertAndSetVideoAudioTypeL( aAudioType ); |
|
256 |
|
257 // Memorize the parameters to be prepared. |
|
258 *iVideoFrameSizePrep = aFrameSize; |
|
259 iVideoFrameRatePrep = aFrameRate; |
|
260 iVideoBitRatePrep = aBitRate; |
|
261 iVideoAudioEnabledPrep = aAudioEnabled; |
|
262 |
|
263 // Open video recorder. |
|
264 iVideoOpened = ETrue; // This is always set to ETrue when |
|
265 // OpenFileL has been called to allow |
|
266 // freeing resources by CloseVideoRecording(). |
|
267 OstTrace0( CAMERASRV_PERFORMANCE, DUP2_CCAEENGINEIMP_PREPAREVIDEORECORDINGL, "e_CAM_CAE_VIDEORECORDER_OPENFILE 1" ); |
|
268 iVideoRecorder->OpenFileL( iVideoClipFileName->Des(), |
|
269 iCameraHandle, |
|
270 iVideoControllerUid, |
|
271 iVideoFormatUid, |
|
272 iVideoType->Des(), |
|
273 iVideoAudioType ); |
|
274 OstTrace0( CAMERASRV_PERFORMANCE, DUP3_CCAEENGINEIMP_PREPAREVIDEORECORDINGL, "e_CAM_CAE_VIDEORECORDER_OPENFILE 0" ); |
|
275 |
|
276 LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareVideoRecordingL() returning" ) ); |
|
277 OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_PREPAREVIDEORECORDINGL, "e_CAM_CAE_PREPAREVIDEORECORDING 0" ); |
|
278 } |
|
279 |
|
280 |
|
281 // ----------------------------------------------------------------------------- |
|
282 // CCaeEngineImp::CloseVideoRecording |
|
283 // ----------------------------------------------------------------------------- |
|
284 // |
|
285 void CCaeEngineImp::CloseVideoRecording() |
|
286 { |
|
287 OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_CLOSEVIDEORECORDING, "e_CAM_CAE_CLOSEVIDEORECORDING 1" ); |
|
288 LOGTEXT( _L( "Cae: CCaeEngineImp::CloseVideoRecording() entering" ) ); |
|
289 |
|
290 if ( iVideoPrepared ) |
|
291 { |
|
292 CancelVideoRecording(); |
|
293 iVideoPrepared = EFalse; |
|
294 } |
|
295 |
|
296 if ( iVideoOpened ) |
|
297 { |
|
298 OstTrace0( CAMERASRV_PERFORMANCE, DUP2_CCAEENGINEIMP_CLOSEVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_CLOSE 1" ); |
|
299 iVideoRecorder->Close(); |
|
300 OstTrace0( CAMERASRV_PERFORMANCE, DUP3_CCAEENGINEIMP_CLOSEVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_CLOSE 0" ); |
|
301 iVideoOpened = EFalse; |
|
302 } |
|
303 |
|
304 LOGTEXT( _L( "Cae: CCaeEngineImp::CloseVideoRecording() returning" ) ); |
|
305 OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_CLOSEVIDEORECORDING, "e_CAM_CAE_CLOSEVIDEORECORDING 0" ); |
|
306 } |
|
307 |
|
308 |
|
309 // ----------------------------------------------------------------------------- |
|
310 // CCaeEngineImp::VideoQualityIndex |
|
311 // ----------------------------------------------------------------------------- |
|
312 // |
|
313 TInt CCaeEngineImp::VideoQualityIndex() const |
|
314 { |
|
315 LOGTEXT( _L( "Cae: CCaeEngineImp::VideoQualityIndex()" ) ); |
|
316 |
|
317 TInt qualityIndex( -1 ); |
|
318 if ( iVideoPrepared ) |
|
319 { |
|
320 qualityIndex = iVideoQualityIndex; |
|
321 } |
|
322 return qualityIndex; |
|
323 } |
|
324 |
|
325 |
|
326 // ----------------------------------------------------------------------------- |
|
327 // CCaeEngineImp::GetVideoFrameSize |
|
328 // ----------------------------------------------------------------------------- |
|
329 // |
|
330 void CCaeEngineImp::GetVideoFrameSize( |
|
331 TInt aVideoQualityIndex, |
|
332 TSize& aFrameSize ) const |
|
333 { |
|
334 LOGTEXT( _L( "Cae: CCaeEngineImp::GetVideoFrameSize()" ) ); |
|
335 |
|
336 if ( aVideoQualityIndex >= 0 && |
|
337 aVideoQualityIndex < iVideoQualityLevelsCont->Count() ) |
|
338 { |
|
339 aFrameSize = iVideoQualityLevelsCont->At( aVideoQualityIndex ).iFrameSize; |
|
340 } |
|
341 } |
|
342 |
|
343 |
|
344 // ----------------------------------------------------------------------------- |
|
345 // CCaeEngineImp::VideoFrameRate |
|
346 // ----------------------------------------------------------------------------- |
|
347 // |
|
348 TReal32 CCaeEngineImp::VideoFrameRate( |
|
349 TInt aVideoQualityIndex ) const |
|
350 { |
|
351 LOGTEXT( _L( "Cae: CCaeEngineImp::VideoFrameRate()" ) ); |
|
352 |
|
353 TReal32 frameRate( 0.0 ); |
|
354 if ( aVideoQualityIndex >= 0 && |
|
355 aVideoQualityIndex < iVideoQualityLevelsCont->Count() ) |
|
356 { |
|
357 frameRate = iVideoQualityLevelsCont->At( aVideoQualityIndex ).iFrameRate; |
|
358 } |
|
359 return frameRate; |
|
360 } |
|
361 |
|
362 |
|
363 // ----------------------------------------------------------------------------- |
|
364 // CCaeEngineImp::EstimatedVideoRecordingBitRateL |
|
365 // ----------------------------------------------------------------------------- |
|
366 // |
|
367 TInt CCaeEngineImp::EstimatedVideoRecordingBitRateL( |
|
368 TInt aVideoQualityIndex ) const |
|
369 { |
|
370 LOGTEXT( _L( "Cae: CCaeEngineImp::EstimatedVideoRecordingBitRateL()" ) ); |
|
371 |
|
372 TInt storageRate( 0 ); |
|
373 if ( aVideoQualityIndex >= 0 && |
|
374 aVideoQualityIndex < iVideoQualityLevelsCont->Count() ) |
|
375 { |
|
376 storageRate = iVideoQualityLevelsCont->At( aVideoQualityIndex ).iStorageRate; |
|
377 } |
|
378 return storageRate; |
|
379 } |
|
380 |
|
381 |
|
382 // ----------------------------------------------------------------------------- |
|
383 // CCaeEngineImp::SetVideoClipMaxSizeL |
|
384 // If video recording is not prepared then just memorizes the clip max size. |
|
385 // If video recording is prepared, then calls Video Recorder API |
|
386 // SetMaxClipSizeL() and Prepare(). |
|
387 // ----------------------------------------------------------------------------- |
|
388 // |
|
389 void CCaeEngineImp::SetVideoClipMaxSizeL( |
|
390 TInt aMaxClipSizeInBytes ) |
|
391 { |
|
392 LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoClipMaxSizeL() entering" ) ); |
|
393 |
|
394 if ( !iVideoInitialized || iVideoRecordingRunning ) |
|
395 { |
|
396 LOGTEXT2( _L( "Cae: CCaeEngineImp::SetVideoClipMaxSizeL leaving KErrNotReady, iVideoInitialized=%d" ), iVideoInitialized ); |
|
397 User::Leave( KErrNotReady ); |
|
398 } |
|
399 |
|
400 if ( aMaxClipSizeInBytes > 0 ) |
|
401 { |
|
402 iMaxClipSizeInBytesPrep = aMaxClipSizeInBytes; |
|
403 } |
|
404 else |
|
405 { |
|
406 iMaxClipSizeInBytesPrep = KMMFNoMaxClipSize; |
|
407 } |
|
408 |
|
409 if ( iVideoPrepared ) |
|
410 { |
|
411 iPrepPars = ETrue; |
|
412 iVideoRecorder->SetMaxClipSizeL( iMaxClipSizeInBytesPrep ); |
|
413 OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_SETVIDEOCLIPMAXSIZEL, "e_CAM_CAE_VIDEORECORDER_PREPARE 1" ); |
|
414 iVideoRecorder->Prepare(); |
|
415 OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_SETVIDEOCLIPMAXSIZEL, "e_CAM_CAE_VIDEORECORDER_PREPARE 0" ); |
|
416 } |
|
417 |
|
418 LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoClipMaxSizeL() returning" ) ); |
|
419 } |
|
420 |
|
421 |
|
422 // ----------------------------------------------------------------------------- |
|
423 // CCaeEngineImp::VideoClipMaxSize |
|
424 // ----------------------------------------------------------------------------- |
|
425 // |
|
426 TInt CCaeEngineImp::VideoClipMaxSize() const |
|
427 { |
|
428 LOGTEXT( _L( "Cae: CCaeEngineImp::VideoClipMaxSize()" ) ); |
|
429 |
|
430 TInt maxClipSizeInBytes( 0 ); |
|
431 if ( iMaxClipSizeInBytes != KMMFNoMaxClipSize ) |
|
432 { |
|
433 maxClipSizeInBytes = iMaxClipSizeInBytes; |
|
434 } |
|
435 |
|
436 return maxClipSizeInBytes; |
|
437 } |
|
438 |
|
439 |
|
440 // ----------------------------------------------------------------------------- |
|
441 // CCaeEngineImp::SetVideoAudioL |
|
442 // Calls Video Recorder API SetAudioEnabledL() and Prepare(). |
|
443 // ----------------------------------------------------------------------------- |
|
444 // |
|
445 void CCaeEngineImp::SetVideoAudioL( |
|
446 TBool aAudioEnabled ) |
|
447 { |
|
448 LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoAudioL() entering" ) ); |
|
449 |
|
450 if ( !iVideoInitialized || iVideoRecordingRunning ) |
|
451 { |
|
452 LOGTEXT2( _L( "Cae: CCaeEngineImp::SetVideoAudioL leaving KErrNotReady, iVideoInitialized=%d" ), iVideoInitialized ); |
|
453 User::Leave( KErrNotReady ); |
|
454 } |
|
455 |
|
456 iVideoAudioEnabledPrep = aAudioEnabled; |
|
457 iVideoRecorder->SetAudioEnabledL( iVideoAudioEnabledPrep ); |
|
458 iPrepPars = ETrue; |
|
459 OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_SETVIDEOAUDIOL, "e_CAM_CAE_VIDEORECORDER_PREPARE 1" ); |
|
460 iVideoRecorder->Prepare(); |
|
461 OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_SETVIDEOAUDIOL, "e_CAM_CAE_VIDEORECORDER_PREPARE 0" ); |
|
462 |
|
463 LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoAudioL() returning" ) ); |
|
464 } |
|
465 |
|
466 |
|
467 // ----------------------------------------------------------------------------- |
|
468 // CCaeEngineImp::VideoAudio |
|
469 // Calls Video Recorder API AudioEnabledL(). |
|
470 // ----------------------------------------------------------------------------- |
|
471 // |
|
472 TBool CCaeEngineImp::VideoAudio() const |
|
473 { |
|
474 LOGTEXT( _L( "Cae: CCaeEngineImp::VideoAudio()" ) ); |
|
475 |
|
476 TBool audioEnabled( EFalse ); |
|
477 if ( iVideoRecorder ) |
|
478 { |
|
479 TRAPD( error, { audioEnabled = iVideoRecorder->AudioEnabledL(); } ); |
|
480 if ( error != KErrNone ) |
|
481 { |
|
482 audioEnabled = EFalse; |
|
483 } |
|
484 } |
|
485 return audioEnabled; |
|
486 } |
|
487 |
|
488 |
|
489 // ----------------------------------------------------------------------------- |
|
490 // CCaeEngineImp::SetVideoTimesIntervalL |
|
491 // Converts from TTimeIntervalMicroSeconds used in the interface to |
|
492 // TTimeIntervalMicroSeconds32 used internally. |
|
493 // ----------------------------------------------------------------------------- |
|
494 // |
|
495 void CCaeEngineImp::SetVideoTimesIntervalL( |
|
496 TTimeIntervalMicroSeconds aInterval ) |
|
497 { |
|
498 LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoTimesIntervalL()" ) ); |
|
499 |
|
500 if ( iVideoRecordingRunning ) |
|
501 { |
|
502 LOGTEXT2( _L( "Cae: CCaeEngineImp::SetVideoTimesIntervalL leaving KErrNotReady, iVideoRecordingRunning=%d" ), iVideoRecordingRunning ); |
|
503 User::Leave( KErrNotReady ); |
|
504 } |
|
505 |
|
506 // Note: KMaxTInt32 in microseconds is about 35 minutes |
|
507 if ( aInterval < TTimeIntervalMicroSeconds( 0 ) || |
|
508 aInterval > TTimeIntervalMicroSeconds( KMaxTInt32 ) ) |
|
509 { |
|
510 LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoTimesIntervalL leaving KErrArgument" )); |
|
511 User::Leave( KErrArgument ); |
|
512 } |
|
513 |
|
514 iVideoTimesInterval = I64INT( aInterval.Int64() ); |
|
515 } |
|
516 |
|
517 |
|
518 // ----------------------------------------------------------------------------- |
|
519 // CCaeEngineImp::VideoTimesInterval |
|
520 // Converts to TTimeIntervalMicroSeconds used in the interface from |
|
521 // TTimeIntervalMicroSeconds32 used internally. |
|
522 // ----------------------------------------------------------------------------- |
|
523 // |
|
524 TTimeIntervalMicroSeconds CCaeEngineImp::VideoTimesInterval() const |
|
525 { |
|
526 LOGTEXT( _L( "Cae: CCaeEngineImp::VideoTimesInterval()" ) ); |
|
527 |
|
528 TInt64 intInterval = iVideoTimesInterval.Int(); |
|
529 |
|
530 TTimeIntervalMicroSeconds interval( intInterval ); |
|
531 |
|
532 return interval; |
|
533 } |
|
534 |
|
535 |
|
536 // ----------------------------------------------------------------------------- |
|
537 // CCaeEngineImp::StartVideoRecording |
|
538 // Calls Video Recorder API Record(). |
|
539 // Starts generating video recording time information for the client. |
|
540 // Finally calls McaeoVideoRecordingOn(). |
|
541 // ----------------------------------------------------------------------------- |
|
542 // |
|
543 void CCaeEngineImp::StartVideoRecording() |
|
544 { |
|
545 OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_STARTVIDEORECORDING, "e_CAM_CAE_STARTVIDEORECORDING 1" ); |
|
546 LOGTEXT( _L( "Cae: CCaeEngineImp::StartVideoRecording() entering" ) ); |
|
547 |
|
548 TInt error( KErrNone ); |
|
549 |
|
550 if ( iVideoPrepared && !iVideoRecordingRunning ) |
|
551 { |
|
552 iVideoRecordingRunning = ETrue; |
|
553 iVideoRecordingPaused = EFalse; |
|
554 |
|
555 // Reset previous time information |
|
556 iPrevTimeElapsed = 0; |
|
557 iPrevTimeRemaining = 0; |
|
558 |
|
559 // Start video recording. |
|
560 OstTrace0( CAMERASRV_PERFORMANCE, DUP2_CCAEENGINEIMP_STARTVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_RECORD 1" ); |
|
561 iVideoRecorder->Record(); |
|
562 OstTrace0( CAMERASRV_PERFORMANCE, DUP3_CCAEENGINEIMP_STARTVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_RECORD 0" ); |
|
563 if ( iVideoTimesInterval > TTimeIntervalMicroSeconds32( 0 ) ) |
|
564 { |
|
565 // Start generating video recording time information for the client. |
|
566 iVideoTimes->Start( KVideoTimesDelay, // delay |
|
567 iVideoTimesInterval, // interval |
|
568 *iVideoTimesCallback ); // callback |
|
569 } |
|
570 } |
|
571 else |
|
572 { |
|
573 error = KErrNotReady; |
|
574 } |
|
575 |
|
576 |
|
577 OstTrace0( CAMERASRV_PERFORMANCE, DUP4_CCAEENGINEIMP_STARTVIDEORECORDING, "e_CAM_CAE_MCAEOVIDEORECORDINGON 1" ); |
|
578 iCaeObserver->McaeoVideoRecordingOn( error ); |
|
579 OstTrace0( CAMERASRV_PERFORMANCE, DUP5_CCAEENGINEIMP_STARTVIDEORECORDING, "e_CAM_CAE_MCAEOVIDEORECORDINGON 0" ); |
|
580 |
|
581 LOGTEXT( _L( "Cae: CCaeEngineImp::StartVideoRecording() returning" ) ); |
|
582 OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_STARTVIDEORECORDING, "e_CAM_CAE_STARTVIDEORECORDING 0" ); |
|
583 } |
|
584 |
|
585 |
|
586 // ----------------------------------------------------------------------------- |
|
587 // CCaeEngineImp::StopVideoRecording |
|
588 // Calls Video Recorder API Record(), DurationL(), and RecordTimeAvailable(). |
|
589 // Stops generating video recording time information for the client. |
|
590 // Delivers video recording time info to the client once right after stopping, |
|
591 // by calling McaeoVideoRecordingTimes(). |
|
592 // Finally calls McaeoVideoRecordingComplete(). |
|
593 // ----------------------------------------------------------------------------- |
|
594 // |
|
595 void CCaeEngineImp::StopVideoRecording() |
|
596 { |
|
597 OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_STOPVIDEORECORDING 1" ); |
|
598 LOGTEXT( _L( "Cae: CCaeEngineImp::StopVideoRecording() entering" ) ); |
|
599 |
|
600 TInt stoppingError( KErrNone ); |
|
601 TInt asyncStopErr( KErrNone ); |
|
602 |
|
603 if ( iVideoRecordingRunning ) |
|
604 { |
|
605 TInt timesError( KErrNone ); |
|
606 TTimeIntervalMicroSeconds timeElapsed( 0 ); |
|
607 |
|
608 iVideoRecordingRunning = EFalse; |
|
609 |
|
610 // Stop generating video recording time information for the client. |
|
611 iVideoTimes->Cancel(); |
|
612 |
|
613 if ( iVideoTimesInterval > TTimeIntervalMicroSeconds32( 0 ) ) |
|
614 { |
|
615 // Query elapsed time before stop (it is set to zero after stop). |
|
616 TRAP( timesError, { timeElapsed = iVideoRecorder->DurationL(); } ); |
|
617 // Possible error is ignored locally because not so crucial. Error code is delivered by call-back. |
|
618 } |
|
619 |
|
620 // Stop video recording. |
|
621 if ( iAsyncVideoStopEnabled ) |
|
622 { |
|
623 LOGTEXT( _L( "Cae: CCaeEngineImp::StopVideoRecording(). using custom command ECamCControllerCCVideoStopAsync" )); |
|
624 OstTrace0( CAMERASRV_PERFORMANCE, DUP2_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_STOP_ASYNC 1" ); |
|
625 asyncStopErr = iVideoRecorder->CustomCommandSync( TMMFMessageDestination( iVideoControllerUid, KMMFObjectHandleController ), |
|
626 ECamCControllerCCVideoStopAsync, |
|
627 KNullDesC8, |
|
628 KNullDesC8 ); |
|
629 OstTrace0( CAMERASRV_PERFORMANCE, DUP3_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_STOP_ASYNC 0" ); |
|
630 if ( asyncStopErr ) // async stop was not supported, use sync stop |
|
631 { |
|
632 LOGTEXT2( _L( "Cae: CCaeEngineImp::StopVideoRecording(). async stop err=%d, using sync stop" ), asyncStopErr); |
|
633 OstTrace0( CAMERASRV_PERFORMANCE, DUP4_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_STOP 1" ); |
|
634 stoppingError = iVideoRecorder->Stop(); |
|
635 OstTrace0( CAMERASRV_PERFORMANCE, DUP5_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_STOP 0" ); |
|
636 OstTrace0( CAMERASRV_PERFORMANCE, DUP8_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_MCAEOVIDEORECORDINGSTOPPED 1" ); |
|
637 iCaeObserver->McaeoVideoRecordingStopped(); |
|
638 OstTrace0( CAMERASRV_PERFORMANCE, DUP9_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_MCAEOVIDEORECORDINGSTOPPED 0" ); |
|
639 } |
|
640 } |
|
641 else |
|
642 { |
|
643 // Synchronous, quaranteed that video recording is stopped when returning. |
|
644 OstTrace0( CAMERASRV_PERFORMANCE, DUP6_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_STOP 1" ); |
|
645 stoppingError = iVideoRecorder->Stop(); |
|
646 OstTrace0( CAMERASRV_PERFORMANCE, DUP7_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_STOP 0" ); |
|
647 } |
|
648 |
|
649 // Can't be paused anymore. |
|
650 iVideoRecordingPaused = EFalse; |
|
651 |
|
652 /* |
|
653 #ifdef CAE_TEST_VERSION |
|
654 // For simulating errors when compiled as special "test version". |
|
655 CaeStopVideoRecordingError( stoppingError ); |
|
656 #endif |
|
657 */ |
|
658 |
|
659 if ( iVideoTimesInterval > TTimeIntervalMicroSeconds32( 0 ) ) |
|
660 { |
|
661 // Query remaining time after stop. |
|
662 TTimeIntervalMicroSeconds timeRemaining = iVideoRecorder->RecordTimeAvailable(); |
|
663 |
|
664 // The elapsed time could have been reseted to zero by the video recorder |
|
665 // if there is stopping ongoing in video recorder, even if we do |
|
666 // not have had the notification yet. In that case McaeoVideoRecordingTimes |
|
667 // should be called with previous valid values. |
|
668 if ( ( timeElapsed == 0 ) && ( iPrevTimeElapsed != 0 ) ) |
|
669 { |
|
670 // Invalid time. Use previous time information |
|
671 LOGTEXT2( _L( "Cae: CCaeEngineImp::StopVideoRecording(). Got invalid elapsed time from the video recorder: %f s." ), |
|
672 I64LOW( timeElapsed.Int64() ) * 1.0 / KOneSecond); |
|
673 LOGTEXT3( _L( "Cae: CCaeEngineImp::StopVideoRecording(). Use previous valid elapsed time %f s. and remaining time %f s." ), |
|
674 I64LOW( iPrevTimeElapsed.Int64() ) * 1.0 / KOneSecond, |
|
675 I64LOW( iPrevTimeRemaining.Int64() ) * 1.0 / KOneSecond ); |
|
676 timeElapsed = iPrevTimeElapsed; |
|
677 timeRemaining =iPrevTimeRemaining; |
|
678 } |
|
679 |
|
680 // Deliver video times (elapsed, remaining) information. |
|
681 iCaeObserver->McaeoVideoRecordingTimes( timeElapsed, timeRemaining, timesError ); |
|
682 } |
|
683 } |
|
684 else |
|
685 { |
|
686 stoppingError = KErrNotReady; |
|
687 } |
|
688 |
|
689 // Reset previous time information |
|
690 iPrevTimeElapsed = 0; |
|
691 iPrevTimeRemaining = 0; |
|
692 |
|
693 if ( !iAsyncVideoStopEnabled || asyncStopErr ) |
|
694 { |
|
695 OstTrace0( CAMERASRV_PERFORMANCE, DUP10_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_MCAEOVIDEORECORDINGCOMPLETE 1" ); |
|
696 iCaeObserver->McaeoVideoRecordingComplete( stoppingError ); |
|
697 OstTrace0( CAMERASRV_PERFORMANCE, DUP11_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_MCAEOVIDEORECORDINGCOMPLETE 0" ); |
|
698 } |
|
699 |
|
700 |
|
701 LOGTEXT( _L( "Cae: CCaeEngineImp::StopVideoRecording() returning" ) ); |
|
702 OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_STOPVIDEORECORDING 0" ); |
|
703 } |
|
704 |
|
705 |
|
706 // ----------------------------------------------------------------------------- |
|
707 // CCaeEngineImp::PauseVideoRecording |
|
708 // Stops generating video recording time info for the client. |
|
709 // Calls Video Recorder API PauseL(). |
|
710 // Delivers video recording time info to the client once right after pausing |
|
711 // by calling VideoRecordingTimesCallback() that calls Video Recorder API |
|
712 // DurationL() and RecordTimeAvailable(), and then McaeoVideoRecordingTimes(). |
|
713 // Finally calls McaeoVideoRecordingPaused(). |
|
714 // ----------------------------------------------------------------------------- |
|
715 // |
|
716 void CCaeEngineImp::PauseVideoRecording() |
|
717 { |
|
718 LOGTEXT( _L( "Cae: CCaeEngineImp::PauseVideoRecording() entering" ) ); |
|
719 |
|
720 TInt error( KErrNone ); |
|
721 |
|
722 if ( iVideoRecordingRunning && !iVideoRecordingPaused ) |
|
723 { |
|
724 // Stop generating video recording time info for the client. |
|
725 iVideoTimes->Cancel(); |
|
726 // Pause video recording. |
|
727 TRAP( error, iVideoRecorder->PauseL() ); |
|
728 if ( iVideoTimesInterval > TTimeIntervalMicroSeconds32( 0 ) ) |
|
729 { |
|
730 // Deliver video recording times (elapsed, remaining) info once. |
|
731 VideoRecordingTimesCallback( this ); |
|
732 } |
|
733 // Intentionally setting iVideoRecordingPaused after (possibly) calling VideoRecordingTimesCallback(). |
|
734 if ( error == KErrNone ) |
|
735 { |
|
736 iVideoRecordingPaused = ETrue; |
|
737 } |
|
738 } |
|
739 else |
|
740 { |
|
741 error = KErrNotReady; |
|
742 } |
|
743 |
|
744 iCaeObserver->McaeoVideoRecordingPaused( error ); |
|
745 |
|
746 LOGTEXT( _L( "Cae: CCaeEngineImp::PauseVideoRecording() returning" ) ); |
|
747 } |
|
748 |
|
749 |
|
750 // ----------------------------------------------------------------------------- |
|
751 // CCaeEngineImp::ResumeVideoRecording |
|
752 // Calls Video Recorder API Record(). |
|
753 // Starts generating video recording time information for the client. |
|
754 // Finally calls McaeoVideoRecordingOn(). |
|
755 // ----------------------------------------------------------------------------- |
|
756 // |
|
757 void CCaeEngineImp::ResumeVideoRecording() |
|
758 { |
|
759 LOGTEXT( _L( "Cae: CCaeEngineImp::ResumeVideoRecording() entering" ) ); |
|
760 |
|
761 TInt error( KErrNone ); |
|
762 |
|
763 if ( iVideoRecordingRunning && iVideoRecordingPaused ) |
|
764 { |
|
765 // Start video recording. |
|
766 OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_RESUMEVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_RECORD 1" ); |
|
767 iVideoRecorder->Record(); |
|
768 OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_RESUMEVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_RECORD 0" ); |
|
769 iVideoRecordingPaused = EFalse; |
|
770 if ( iVideoTimesInterval > TTimeIntervalMicroSeconds32( 0 ) ) |
|
771 { |
|
772 // Start generating video recording time information for the client. |
|
773 iVideoTimes->Start( KVideoTimesDelay, // delay |
|
774 iVideoTimesInterval, // interval |
|
775 *iVideoTimesCallback ); // callback |
|
776 } |
|
777 } |
|
778 else |
|
779 { |
|
780 error = KErrNotReady; |
|
781 } |
|
782 |
|
783 iCaeObserver->McaeoVideoRecordingOn( error ); |
|
784 |
|
785 LOGTEXT( _L( "Cae: CCaeEngineImp::ResumeVideoRecording() returning" ) ); |
|
786 } |
|
787 |
|
788 |
|
789 // ----------------------------------------------------------------------------- |
|
790 // CCaeEngineImp::RemainingVideoRecordingTime |
|
791 // Calls Video Recorder API RecordTimeAvailable(). |
|
792 // ----------------------------------------------------------------------------- |
|
793 // |
|
794 TTimeIntervalMicroSeconds CCaeEngineImp::RemainingVideoRecordingTime() const |
|
795 { |
|
796 LOGTEXT( _L( "Cae: CCaeEngineImp::RemainingVideoRecordingTime()" ) ); |
|
797 |
|
798 TTimeIntervalMicroSeconds remaining( 0 ); |
|
799 if ( iVideoRecorder ) |
|
800 { |
|
801 remaining = iVideoRecorder->RecordTimeAvailable(); |
|
802 } |
|
803 return remaining; |
|
804 } |
|
805 |
|
806 |
|
807 // ----------------------------------------------------------------------------- |
|
808 // CCaeEngineImp::IsVideoRecording |
|
809 // ----------------------------------------------------------------------------- |
|
810 // |
|
811 TBool CCaeEngineImp::IsVideoRecording() const |
|
812 { |
|
813 return iVideoRecordingRunning; |
|
814 } |
|
815 |
|
816 |
|
817 // ----------------------------------------------------------------------------- |
|
818 // CCaeEngineImp::PrepareVideoRecordingL |
|
819 // Overloading version with audio bit rate argument. |
|
820 // ----------------------------------------------------------------------------- |
|
821 // |
|
822 void CCaeEngineImp::PrepareVideoRecordingL( |
|
823 const TSize& aFrameSize, |
|
824 TReal32 aFrameRate, |
|
825 TInt aBitRate, |
|
826 TBool aAudioEnabled, |
|
827 TInt aAudioBitRate, |
|
828 const TDesC8& aMimeType, |
|
829 const TDesC& aPreferredSupplier, |
|
830 const TDesC8& aVideoType, |
|
831 const TDesC8& aAudioType ) |
|
832 { |
|
833 OstTrace0( CAMERASRV_PERFORMANCE, DUP4_CCAEENGINEIMP_PREPAREVIDEORECORDINGL, "e_CAM_CAE_PREPAREVIDEORECORDINGL 1" ); |
|
834 // Memorize video audio bit rate value to be prepared. |
|
835 iVideoAudioBitRatePrep = aAudioBitRate; |
|
836 // Force audio bit rate preparation. |
|
837 iPrepareVideoAudioBitRate = ETrue; |
|
838 |
|
839 // Call the version without audio bit rate argument. |
|
840 // This is possible because the separate PrepareVideoSettingsL() is doing |
|
841 // settings after succesfull opening of video recording. |
|
842 PrepareVideoRecordingL( aFrameSize, |
|
843 aFrameRate, |
|
844 aBitRate, |
|
845 aAudioEnabled, |
|
846 aMimeType, |
|
847 aPreferredSupplier, |
|
848 aVideoType, |
|
849 aAudioType ); |
|
850 OstTrace0( CAMERASRV_PERFORMANCE, DUP5_CCAEENGINEIMP_PREPAREVIDEORECORDINGL, "e_CAM_CAE_PREPAREVIDEORECORDINGL 0" ); |
|
851 } |
|
852 |
|
853 |
|
854 // ----------------------------------------------------------------------------- |
|
855 // CCaeEngineImp::MvruoOpenComplete |
|
856 // The status of the video recorder after initialisation. |
|
857 // This is either KErrNone if the open has completed successfully, |
|
858 // or one of the system wide error codes |
|
859 // ----------------------------------------------------------------------------- |
|
860 // |
|
861 void CCaeEngineImp::MvruoOpenComplete( |
|
862 TInt aError ) |
|
863 { |
|
864 LOGTEXT2( _L( "Cae: CCaeEngineImp::MvruoOpenComplete() entering, aError=%d" ), aError ); |
|
865 |
|
866 #ifdef CAE_TEST_VERSION |
|
867 // For simulating errors when compiled as special "test version". |
|
868 CaeMvruoOpenCompleteError( aError ); |
|
869 #endif |
|
870 |
|
871 if ( aError == KErrNone ) |
|
872 { |
|
873 // To get default video audio bit rate. |
|
874 TRAP( aError, { iVideoAudioBitRate = iVideoRecorder->AudioBitRateL(); } ); |
|
875 // (ignore possible error) |
|
876 // Prepare settings only if no errors in opening. |
|
877 TRAP( aError, PrepareVideoSettingsL() ); |
|
878 if ( aError != KErrNone ) |
|
879 { |
|
880 OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_MVRUOOPENCOMPLETE, "e_CAM_CAE_MCAEOVIDEOPREPARECOMPLETE 1" ); |
|
881 iCaeObserver->McaeoVideoPrepareComplete( aError ); |
|
882 OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_MVRUOOPENCOMPLETE, "e_CAM_CAE_MCAEOVIDEOPREPARECOMPLETE 0" ); |
|
883 } |
|
884 } |
|
885 else |
|
886 { |
|
887 OstTrace0( CAMERASRV_PERFORMANCE, DUP2_CCAEENGINEIMP_MVRUOOPENCOMPLETE, "e_CAM_CAE_MCAEOVIDEOPREPARECOMPLETE 1" ); |
|
888 iCaeObserver->McaeoVideoPrepareComplete( aError ); |
|
889 OstTrace0( CAMERASRV_PERFORMANCE, DUP3_CCAEENGINEIMP_MVRUOOPENCOMPLETE, "e_CAM_CAE_MCAEOVIDEOPREPARECOMPLETE 0" ); |
|
890 } |
|
891 |
|
892 LOGTEXT( _L( "Cae: CCaeEngineImp::MvruoOpenComplete() returning" ) ); |
|
893 } |
|
894 |
|
895 |
|
896 // ----------------------------------------------------------------------------- |
|
897 // CCaeEngineImp::MvruoPrepareComplete |
|
898 // Notification that video recorder is ready to begin recording. This callback |
|
899 // is generated in response to a call to VR's Prepare. |
|
900 // ----------------------------------------------------------------------------- |
|
901 // |
|
902 void CCaeEngineImp::MvruoPrepareComplete( |
|
903 TInt aError ) |
|
904 { |
|
905 LOGTEXT2( _L( "Cae: CCaeEngineImp::MvruoPrepareComplete() entering, aError=%d" ), aError ); |
|
906 |
|
907 #ifdef CAE_TEST_VERSION |
|
908 // For simulating errors when compiled as special "test version". |
|
909 CaeMvruoPrepareCompleteError( aError ); |
|
910 #endif |
|
911 |
|
912 if ( iVideoOpened && ( aError == KErrNone ) ) |
|
913 { |
|
914 iVideoPrepared = ETrue; // Later errors with settings after |
|
915 // do not change the value. |
|
916 } |
|
917 |
|
918 if ( iPrepPars ) |
|
919 { |
|
920 iPrepPars = EFalse; |
|
921 // If no error, then fresh parameters are valid. |
|
922 // Otherwise, old parameters are kept. |
|
923 if ( aError == KErrNone ) |
|
924 { |
|
925 *iVideoFrameSize = *iVideoFrameSizePrep; |
|
926 iVideoFrameRate = iVideoFrameRatePrep; |
|
927 iVideoBitRate = iVideoBitRatePrep; |
|
928 iVideoAudioEnabled = iVideoAudioEnabledPrep; |
|
929 iVideoAudioBitRate = iVideoAudioBitRatePrep; |
|
930 iMaxClipSizeInBytes = iMaxClipSizeInBytesPrep; |
|
931 } |
|
932 else |
|
933 { |
|
934 *iVideoFrameSizePrep = *iVideoFrameSize; |
|
935 iVideoFrameRatePrep = iVideoFrameRate; |
|
936 iVideoBitRatePrep = iVideoBitRate; |
|
937 iVideoAudioEnabledPrep = iVideoAudioEnabled; |
|
938 iVideoAudioBitRatePrep = iVideoAudioBitRate; |
|
939 iMaxClipSizeInBytesPrep = iMaxClipSizeInBytes; |
|
940 } |
|
941 } |
|
942 |
|
943 OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_MVRUOPREPARECOMPLETE, "e_CAM_CAE_MCAEOVIDEOPREPARECOMPLETE 1" ); |
|
944 iCaeObserver->McaeoVideoPrepareComplete( aError ); |
|
945 OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_MVRUOPREPARECOMPLETE, "e_CAM_CAE_MCAEOVIDEOPREPARECOMPLETE 0" ); |
|
946 |
|
947 LOGTEXT( _L( "Cae: CCaeEngineImp::MvruoPrepareComplete() returning" ) ); |
|
948 } |
|
949 |
|
950 |
|
951 // ----------------------------------------------------------------------------- |
|
952 // CCaeEngineImp::MvruoRecordComplete |
|
953 // Notification that video recording has completed. This is not called if |
|
954 // recording is explicitly stopped by calling Stop. |
|
955 // ----------------------------------------------------------------------------- |
|
956 // |
|
957 void CCaeEngineImp::MvruoRecordComplete( |
|
958 TInt aError ) |
|
959 { |
|
960 LOGTEXT3( _L( "Cae: CCaeEngineImp::MvruoRecordComplete() entering, aError=%d, iVideoRecordingRunning=%d" ), aError, iVideoRecordingRunning ); |
|
961 |
|
962 // Stop generating video recording time information for the client. |
|
963 iVideoTimes->Cancel(); |
|
964 // Recording stopped: can't be paused anymore. |
|
965 iVideoRecordingPaused = EFalse; |
|
966 |
|
967 // Reset previous time information |
|
968 iPrevTimeElapsed = 0; |
|
969 iPrevTimeRemaining = 0; |
|
970 |
|
971 if ( iVideoRecordingRunning || iAsyncVideoStopEnabled ) // To ensure that McaeoVideoRecordingComplete |
|
972 { // gets called just once per recording. |
|
973 iVideoRecordingRunning = EFalse; |
|
974 |
|
975 #ifdef CAE_TEST_VERSION |
|
976 // For simulating errors when compiled as special "test version". |
|
977 CaeMvruoRecordCompleteError( aError ); |
|
978 #endif |
|
979 |
|
980 // Close video recording always in error case. Otherwise the camcorder plugin would |
|
981 // be in indeterminated state. |
|
982 // The code KErrCompletion means that video reocording has been completed by timer |
|
983 if ( aError && aError != KErrCompletion && aError != KErrDiskFull ) |
|
984 { |
|
985 CloseVideoRecording(); |
|
986 } |
|
987 |
|
988 // In async stop mode call also the other call-back to play stop sound |
|
989 if ( iAsyncVideoStopEnabled ) |
|
990 { |
|
991 OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_MVRUORECORDCOMPLETE, "e_CAM_CAE_MCAEOVIDEORECORDINGSTOPPED 1" ); |
|
992 iCaeObserver->McaeoVideoRecordingStopped(); |
|
993 OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_MVRUORECORDCOMPLETE, "e_CAM_CAE_MCAEOVIDEORECORDINGSTOPPED 0" ); |
|
994 } |
|
995 OstTrace0( CAMERASRV_PERFORMANCE, DUP2_CCAEENGINEIMP_MVRUORECORDCOMPLETE, "e_CAM_CAE_MCAEOVIDEORECORDINGCOMPLETE 1" ); |
|
996 iCaeObserver->McaeoVideoRecordingComplete( aError ); |
|
997 OstTrace0( CAMERASRV_PERFORMANCE, DUP3_CCAEENGINEIMP_MVRUORECORDCOMPLETE, "e_CAM_CAE_MCAEOVIDEORECORDINGCOMPLETE 0" ); |
|
998 } |
|
999 |
|
1000 LOGTEXT( _L( "Cae: CCaeEngineImp::MvruoRecordComplete() returning" ) ); |
|
1001 } |
|
1002 |
|
1003 |
|
1004 // ----------------------------------------------------------------------------- |
|
1005 // CCaeEngineImp::MvruoEvent |
|
1006 // Event Notification from controller |
|
1007 // ----------------------------------------------------------------------------- |
|
1008 // |
|
1009 |
|
1010 void CCaeEngineImp::MvruoEvent( |
|
1011 const TMMFEvent& aEvent ) |
|
1012 { |
|
1013 LOGTEXT3( _L( "Cae: CCaeEngineImp::MvruoEvent() entering, uid=%x, err=%d" ), aEvent.iEventType.iUid, aEvent.iErrorCode ); |
|
1014 |
|
1015 if ( aEvent.iEventType.iUid == KCamCControllerCCVideoRecordStopped.iUid ) |
|
1016 { |
|
1017 OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_MVRUOEVENT, "e_CAM_CAE_MCAEOVIDEORECORDINGSTOPPED 1" ); |
|
1018 iCaeObserver->McaeoVideoRecordingStopped(); |
|
1019 OstTrace0( CAMERASRV_PERFORMANCE, DUP3_CCAEENGINEIMP_MVRUOEVENT, "e_CAM_CAE_MCAEOVIDEORECORDINGSTOPPED 0" ); |
|
1020 } |
|
1021 else if ( aEvent.iEventType.iUid == KCamCControllerCCVideoFileComposed.iUid ) |
|
1022 { |
|
1023 OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_MVRUOEVENT, "e_CAM_CAE_MCAEOVIDEORECORDINGCOMPLETE 1" ); |
|
1024 iCaeObserver->McaeoVideoRecordingComplete( aEvent.iErrorCode ); |
|
1025 OstTrace0( CAMERASRV_PERFORMANCE, DUP2_CCAEENGINEIMP_MVRUOEVENT, "e_CAM_CAE_MCAEOVIDEORECORDINGCOMPLETE 0" ); |
|
1026 } |
|
1027 else |
|
1028 { |
|
1029 // Send others events as error to UI |
|
1030 iVideoPrepared = EFalse; // mark that re-preparation is needed |
|
1031 OstTrace0( CAMERASRV_PERFORMANCE, DUP4_CCAEENGINEIMP_MVRUOEVENT, "e_CAM_CAE_MCAEOVIDEOPREPARECOMPLETE 1" ); |
|
1032 iCaeObserver->McaeoVideoPrepareComplete( aEvent.iErrorCode ); |
|
1033 OstTrace0( CAMERASRV_PERFORMANCE, DUP5_CCAEENGINEIMP_MVRUOEVENT, "e_CAM_CAE_MCAEOVIDEOPREPARECOMPLETE 0" ); |
|
1034 } |
|
1035 |
|
1036 LOGTEXT( _L( "Cae: CCaeEngineImp::MvruoEvent() returning" ) ); |
|
1037 } |
|
1038 |
|
1039 |
|
1040 |
|
1041 // ----------------------------------------------------------------------------- |
|
1042 // CCaeEngineImp::CancelVideoRecording |
|
1043 // Calls Video Recorder API Stop(). |
|
1044 // ----------------------------------------------------------------------------- |
|
1045 // |
|
1046 void CCaeEngineImp::CancelVideoRecording() |
|
1047 { |
|
1048 LOGTEXT( _L( "Cae: CCaeEngineImp::CancelVideoRecording() entering" ) ); |
|
1049 |
|
1050 if ( iVideoRecordingRunning ) |
|
1051 { |
|
1052 // This also prevents McaeoVideoRecordingComplete() call from MvruoRecordComplete() |
|
1053 // and McaeoVideoRecordingTimes() call from VideoRecordingTimesCallback(). |
|
1054 iVideoRecordingRunning = EFalse; |
|
1055 // Stop generating video recording time information for the client. |
|
1056 iVideoTimes->Cancel(); |
|
1057 |
|
1058 // Reset previous time information |
|
1059 iPrevTimeElapsed = 0; |
|
1060 iPrevTimeRemaining = 0; |
|
1061 |
|
1062 // Stop video recording. Do not call McaeoVideoRecordingComplete() |
|
1063 OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_CANCELVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_STOP 1" ); |
|
1064 (void) iVideoRecorder->Stop(); |
|
1065 OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_CANCELVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_STOP 0" ); |
|
1066 iVideoRecordingPaused = EFalse; |
|
1067 } |
|
1068 |
|
1069 LOGTEXT( _L( "Cae: CCaeEngineImp::CancelVideoRecording() returning" ) ); |
|
1070 } |
|
1071 |
|
1072 |
|
1073 // ----------------------------------------------------------------------------- |
|
1074 // CCaeEngineImp::PrepareVideoSettingsL |
|
1075 // Calls Video Recorder API setting methods to set video recording paramaters. |
|
1076 // ----------------------------------------------------------------------------- |
|
1077 // |
|
1078 void CCaeEngineImp::PrepareVideoSettingsL() |
|
1079 { |
|
1080 OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_PREPAREVIDEOSETTINGSL, "e_CAM_CAE_PREPAREVIDEOSETTINGS 1" ); |
|
1081 LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareVideoSettingsL() entering" ) ); |
|
1082 |
|
1083 #ifdef CAE_TEST_VERSION |
|
1084 // For simulating errors when compiled as special "test version". |
|
1085 CaePrepareVideoSettingsErrorL(); |
|
1086 #endif |
|
1087 |
|
1088 iVideoRecorder->SetVideoFrameSizeL( *iVideoFrameSizePrep ); |
|
1089 iVideoRecorder->SetVideoFrameRateL( iVideoFrameRatePrep ); |
|
1090 iVideoRecorder->SetVideoBitRateL( iVideoBitRatePrep ); |
|
1091 iVideoRecorder->SetAudioEnabledL( iVideoAudioEnabledPrep ); |
|
1092 if ( iPrepareVideoAudioBitRate ) |
|
1093 { |
|
1094 iVideoRecorder->SetAudioBitRateL( iVideoAudioBitRatePrep ); |
|
1095 iPrepareVideoAudioBitRate = EFalse; |
|
1096 } |
|
1097 iVideoRecorder->SetMaxClipSizeL( iMaxClipSizeInBytesPrep ); |
|
1098 |
|
1099 // Set the recording gain to the maximum |
|
1100 TInt gain = iVideoRecorder->GainL(); |
|
1101 LOGTEXT2( _L( "Cae: CCaeEngineImp::PrepareVideoSettingsL() GainL was %d" ), gain ); |
|
1102 gain = iVideoRecorder->MaxGainL(); |
|
1103 LOGTEXT2( _L( "Cae: CCaeEngineImp::PrepareVideoSettingsL() MaxGainL is %d" ), gain ); |
|
1104 iVideoRecorder->SetGainL( gain ); |
|
1105 gain = iVideoRecorder->GainL(); |
|
1106 LOGTEXT2( _L( "Cae: CCaeEngineImp::PrepareVideoSettingsL() GainL set to %d" ), gain ); |
|
1107 |
|
1108 iPrepPars = ETrue; |
|
1109 OstTrace0( CAMERASRV_PERFORMANCE, DUP2_CCAEENGINEIMP_PREPAREVIDEOSETTINGSL, "e_CAM_CAE_VIDEORECORDER_PREPARE 1" ); |
|
1110 iVideoRecorder->Prepare(); |
|
1111 OstTrace0( CAMERASRV_PERFORMANCE, DUP3_CCAEENGINEIMP_PREPAREVIDEOSETTINGSL, "e_CAM_CAE_VIDEORECORDER_PREPARE 0" ); |
|
1112 |
|
1113 LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareVideoSettingsL() returning" ) ); |
|
1114 OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_PREPAREVIDEOSETTINGSL, "e_CAM_CAE_PREPAREVIDEOSETTINGS 0" ); |
|
1115 } |
|
1116 |
|
1117 |
|
1118 // ----------------------------------------------------------------------------- |
|
1119 // CCaeEngineImp::FindVideoUidsL |
|
1120 // Finds UIDs for opening video recording. Uses ECOM. |
|
1121 // ----------------------------------------------------------------------------- |
|
1122 // |
|
1123 void CCaeEngineImp::FindVideoUidsL( |
|
1124 const TDesC8& aMimeType, |
|
1125 const TDesC& aPreferredSupplier ) |
|
1126 { |
|
1127 LOGTEXT( _L( "Cae: CCaeEngineImp::FindVideoUidsL() entering" ) ); |
|
1128 |
|
1129 iVideoControllerUid.iUid = 0; |
|
1130 iVideoFormatUid.iUid = 0; |
|
1131 |
|
1132 // Retrieve a list of possible controllers from ECOM. |
|
1133 // |
|
1134 // Controller must support recording the requested mime type. |
|
1135 // Controller must be provided by preferred supplier. |
|
1136 |
|
1137 CMMFControllerPluginSelectionParameters* cSelect = |
|
1138 CMMFControllerPluginSelectionParameters::NewLC(); |
|
1139 CMMFFormatSelectionParameters* fSelect = |
|
1140 CMMFFormatSelectionParameters::NewLC(); |
|
1141 |
|
1142 fSelect->SetMatchToMimeTypeL( aMimeType ); |
|
1143 cSelect->SetRequiredRecordFormatSupportL( *fSelect ); |
|
1144 cSelect->SetPreferredSupplierL( aPreferredSupplier, |
|
1145 CMMFPluginSelectionParameters::EOnlyPreferredSupplierPluginsReturned ); |
|
1146 |
|
1147 RMMFControllerImplInfoArray controllers; |
|
1148 CleanupResetAndDestroyPushL( controllers ); |
|
1149 cSelect->ListImplementationsL( controllers ); |
|
1150 |
|
1151 if ( controllers.Count() < 1 ) |
|
1152 { |
|
1153 // No appropriate controllers found. |
|
1154 LOGTEXT( _L( "Cae: CCaeEngineImp::FindVideoUidsL() leaving KErrNotSupported (no controllers found)" ) ); |
|
1155 User::Leave( KErrNotSupported ); |
|
1156 } |
|
1157 |
|
1158 TBool found( EFalse ); |
|
1159 for ( TInt contInd = 0; contInd < controllers.Count() && !found; contInd++ ) // there can be more than one controller, search from all of them |
|
1160 { |
|
1161 // Get the controller UID. |
|
1162 iVideoControllerUid = controllers[contInd]->Uid(); |
|
1163 LOGTEXT3( _L("Cae: CCaeEngineImp::FindVideoUidsL() contInd=%d, Uid=%x"), contInd, iVideoControllerUid.iUid ); |
|
1164 |
|
1165 // Inquires the controller about supported formats. |
|
1166 RMMFFormatImplInfoArray formats = controllers[contInd]->RecordFormats(); |
|
1167 |
|
1168 // Get the first format that supports our mime type. |
|
1169 for ( TInt i = 0; i < formats.Count(); i++ ) |
|
1170 { |
|
1171 if ( formats[i]->SupportsMimeType( aMimeType ) ) |
|
1172 { |
|
1173 iVideoFormatUid = formats[i]->Uid(); // set the UID |
|
1174 found = ETrue; |
|
1175 LOGTEXT3( _L("Cae: CCaeEngineImp::FindVideoUidsL() Found iVideoFormatUid=%x, index=%d"), iVideoFormatUid.iUid, i ); |
|
1176 break; |
|
1177 } |
|
1178 } |
|
1179 } |
|
1180 if ( !found ) |
|
1181 { |
|
1182 // No appropriate video format found. |
|
1183 LOGTEXT( _L( "Cae: CCaeEngineImp::FindVideoUidsL() leaving KErrNotSupported (no video format found)" ) ); |
|
1184 User::Leave( KErrNotSupported ); |
|
1185 } |
|
1186 |
|
1187 CleanupStack::PopAndDestroy( 3, cSelect ); // cselect, fselect, controllers |
|
1188 |
|
1189 LOGTEXT( _L( "Cae: CCaeEngineImp::FindVideoUidsL() returning" ) ); |
|
1190 } |
|
1191 |
|
1192 |
|
1193 // ----------------------------------------------------------------------------- |
|
1194 // CCaeEngineImp::ConvertAndSetVideoAudioTypeL |
|
1195 // Convert audio type from TDesC8 to TFourCC, set to iVideoAudioType. |
|
1196 // ----------------------------------------------------------------------------- |
|
1197 // |
|
1198 TFourCC CCaeEngineImp::ConvertAndSetVideoAudioTypeL( |
|
1199 const TDesC8& aAudioType ) |
|
1200 { |
|
1201 if ( aAudioType == KNullDesC8 ) |
|
1202 { |
|
1203 return KMMFFourCCCodeNULL; |
|
1204 } |
|
1205 else |
|
1206 { |
|
1207 if ( aAudioType.Length() != 4 ) |
|
1208 { |
|
1209 User::Leave( KErrArgument ); |
|
1210 } |
|
1211 return TFourCC( aAudioType[0], aAudioType[1], aAudioType[2], aAudioType[3] ); |
|
1212 } |
|
1213 } |
|
1214 |
|
1215 |
|
1216 // ----------------------------------------------------------------------------- |
|
1217 // CCaeEngineImp::VideoRecordingTimesCallback |
|
1218 // Calls Video Recorder API DurationL() and RecordTimeAvailable(). |
|
1219 // Finally calls McaeoVideoRecordingTimes(). |
|
1220 // ----------------------------------------------------------------------------- |
|
1221 // |
|
1222 TInt CCaeEngineImp::VideoRecordingTimesCallback( |
|
1223 TAny* aEngineImp ) |
|
1224 { |
|
1225 LOGTEXT( _L( "Cae: CCaeEngineImp::VideoRecordingTimesCallback() entering" ) ); |
|
1226 |
|
1227 CCaeEngineImp* thisEngineImp = static_cast<CCaeEngineImp*>( aEngineImp ); |
|
1228 |
|
1229 if ( thisEngineImp->iVideoRecordingRunning && !thisEngineImp->iVideoRecordingPaused ) |
|
1230 { |
|
1231 // Query elapsed recording time. |
|
1232 TTimeIntervalMicroSeconds timeElapsed( 0 ); |
|
1233 TRAPD( error, { timeElapsed = thisEngineImp->iVideoRecorder->DurationL(); } ); |
|
1234 |
|
1235 // Query remaining recording time. |
|
1236 TTimeIntervalMicroSeconds timeRemaining = thisEngineImp->iVideoRecorder->RecordTimeAvailable(); |
|
1237 |
|
1238 // The elapsed time could have been reseted to zero by the video recorder |
|
1239 // if there is stopping ongoing in video recorder, even if we do |
|
1240 // not have had the notification yet. In that case McaeoVideoRecordingTimes |
|
1241 // should be called with previous valid values. |
|
1242 if ( ( timeElapsed == 0 ) && ( thisEngineImp->iPrevTimeElapsed != 0 ) ) |
|
1243 { |
|
1244 // Invalid time. Use previous time information |
|
1245 LOGTEXT2( _L( "Cae: CCaeEngineImp::VideoRecordingTimesCallback(). Got invalid elapsed time from the video recorder: %f s." ), |
|
1246 I64LOW( timeElapsed.Int64() ) * 1.0 / KOneSecond); |
|
1247 LOGTEXT3( _L( "Cae: CCaeEngineImp::VideoRecordingTimesCallback(). Use previous valid elapsed time %f s. and remaining time %f s." ), |
|
1248 I64LOW( thisEngineImp->iPrevTimeElapsed.Int64() ) * 1.0 / KOneSecond, |
|
1249 I64LOW( thisEngineImp->iPrevTimeRemaining.Int64() ) * 1.0 / KOneSecond ); |
|
1250 timeElapsed = thisEngineImp->iPrevTimeElapsed; |
|
1251 timeRemaining = thisEngineImp->iPrevTimeRemaining; |
|
1252 } |
|
1253 else |
|
1254 { |
|
1255 // Store current time information |
|
1256 thisEngineImp->iPrevTimeElapsed = timeElapsed; |
|
1257 thisEngineImp->iPrevTimeRemaining = timeRemaining; |
|
1258 } |
|
1259 |
|
1260 // Deliver video recording times information. |
|
1261 thisEngineImp->iCaeObserver->McaeoVideoRecordingTimes( timeElapsed, timeRemaining, error ); |
|
1262 } |
|
1263 |
|
1264 LOGTEXT( _L( "Cae: CCaeEngineImp::VideoRecordingTimesCallback() returning" ) ); |
|
1265 |
|
1266 return ETrue; |
|
1267 } |
|
1268 |
|
1269 // --------------------------------------------------------- |
|
1270 // CCaeEngineImp::EnumerateVideoFrameSizeL |
|
1271 // Checks that camera HW supports given framesize |
|
1272 // --------------------------------------------------------- |
|
1273 // |
|
1274 TInt CCaeEngineImp::EnumerateVideoFrameSizeL(const TSize& aSize) |
|
1275 { |
|
1276 |
|
1277 LOGTEXT3( _L("Cae: CCaeEngineImp::EnumerateVideoFrameSizeL(), In, size: %dx%d"), aSize.iWidth, aSize.iHeight ); |
|
1278 |
|
1279 TCameraInfo cameraInfo; |
|
1280 iCamera->CameraInfo( cameraInfo ); |
|
1281 |
|
1282 TSize size; |
|
1283 TInt i = 0; |
|
1284 TInt j = 0; |
|
1285 TInt sizeIndex = -1; |
|
1286 |
|
1287 if ( cameraInfo.iVideoFrameFormatsSupported & CCamera::EFormatYUV420Planar ) |
|
1288 { |
|
1289 // check YUV420 planar |
|
1290 for ( i = 0; i < cameraInfo.iNumVideoFrameSizesSupported; i++ ) |
|
1291 { |
|
1292 iCamera->EnumerateVideoFrameSizes(size, i, CCamera::EFormatYUV420Planar); |
|
1293 LOGTEXT3(_L("Cae: CCaeEngineImp::EnumerateVideoFrameSizeL() Camera EFormatYUV420Planar %d x %d found from camera"), size.iWidth, size.iHeight ); |
|
1294 |
|
1295 if ( size == aSize ) |
|
1296 { |
|
1297 LOGTEXT3(_L("Cae: CCaeEngineImp::EnumerateVideoFrameSizeL() Camera EFormatYUV420Planar %d x %d Matched."), size.iWidth, size.iHeight ); |
|
1298 sizeIndex = i; |
|
1299 break; |
|
1300 } |
|
1301 } |
|
1302 } |
|
1303 else |
|
1304 { |
|
1305 LOGTEXT(_L("Cae: CCaeEngineImp::EnumerateVideoFrameSizeL() Camera doesn't support EFormatYUV420Planar")); |
|
1306 } |
|
1307 |
|
1308 if ( cameraInfo.iVideoFrameFormatsSupported & CCamera::EFormatYUV422 ) |
|
1309 { |
|
1310 // check YUV422 interleaved |
|
1311 for ( j = 0; j < cameraInfo.iNumVideoFrameSizesSupported; j++ ) |
|
1312 { |
|
1313 iCamera->EnumerateVideoFrameSizes(size, j, CCamera::EFormatYUV422 ); |
|
1314 LOGTEXT3(_L("Cae: CCaeEngineImp::EnumerateVideoFrameSizeL() Camera EFormatYUV422 %d x %d found from camera"), size.iWidth, size.iHeight ); |
|
1315 |
|
1316 if ( size == aSize ) |
|
1317 { |
|
1318 LOGTEXT3(_L("Cae: CCaeEngineImp::EnumerateVideoFrameSizeL() Camera EFormatYUV422 %d x %d Matched."), size.iWidth, size.iHeight ); |
|
1319 sizeIndex = j; |
|
1320 break; |
|
1321 } |
|
1322 } |
|
1323 } |
|
1324 else |
|
1325 { |
|
1326 LOGTEXT(_L("Cae: CCaeEngineImp::EnumerateVideoFrameSizeL() Camera doesn't support EFormatYUV422")); |
|
1327 } |
|
1328 |
|
1329 if ( sizeIndex == -1 ) |
|
1330 { |
|
1331 LOGTEXT(_L("Cae: CCaeEngineImp::EnumerateVideoFrameSizeL(), Camera does not support this resolution")); |
|
1332 } |
|
1333 |
|
1334 |
|
1335 LOGTEXT(_L("Cae: CCaeEngineImp::EnumerateVideoFrameSizeL(), Out")); |
|
1336 return ( sizeIndex ); |
|
1337 } |
|
1338 |
|
1339 // --------------------------------------------------------- |
|
1340 // CCaeEngineImp::SetAsyncVideoStopMode |
|
1341 // Enables/disables async stopping |
|
1342 // --------------------------------------------------------- |
|
1343 // |
|
1344 TInt CCaeEngineImp::SetAsyncVideoStopMode( TBool aAsyncVideoStopEnabled ) |
|
1345 { |
|
1346 LOGTEXT2( _L("Cae: CCaeEngineImp::SetAsyncVideoStop(%d) entering"), aAsyncVideoStopEnabled ); |
|
1347 TInt err; |
|
1348 |
|
1349 // Check if async stopping is supported |
|
1350 if ( iVideoControllerUid == KCamCControllerImplementationUid ) |
|
1351 { |
|
1352 iAsyncVideoStopEnabled = aAsyncVideoStopEnabled; |
|
1353 err = KErrNone; |
|
1354 } |
|
1355 else |
|
1356 { |
|
1357 err = KErrNotSupported; |
|
1358 } |
|
1359 |
|
1360 LOGTEXT2(_L("Cae: CCaeEngineImp::SetAsyncVideoStop() err=%d, returning"), err); |
|
1361 return ( err ); |
|
1362 } |
|
1363 |
|
1364 |
|
1365 // End of File |