|
1 /* |
|
2 * Copyright (c) 2002 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: Camcorder MMF API Test DLL |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 |
|
22 #include "CamcTestClient_9.h" |
|
23 #include "CamCControllerCustomCommands.h" |
|
24 #include <mmf/common/mmfstandardcustomcommands.h> |
|
25 #include <mmf/server/mmffile.h> |
|
26 #include <AudioPreference.h> |
|
27 #include "camctest.h" |
|
28 |
|
29 |
|
30 // EXTERNAL DATA STRUCTURES |
|
31 |
|
32 // EXTERNAL FUNCTION PROTOTYPES |
|
33 |
|
34 // CONSTANTS |
|
35 |
|
36 const TInt KMaxVideoLength = 3600; |
|
37 |
|
38 // MACROS |
|
39 // Debug print macro |
|
40 #ifdef _DEBUG |
|
41 #include <e32svr.h> |
|
42 #define PRINT(x) RDebug::Print x |
|
43 #else |
|
44 #define PRINT(x) |
|
45 #endif |
|
46 |
|
47 |
|
48 // LOCAL CONSTANTS AND MACROS |
|
49 |
|
50 // MODULE DATA STRUCTURES |
|
51 |
|
52 // LOCAL FUNCTION PROTOTYPES |
|
53 |
|
54 // FORWARD DECLARATIONS |
|
55 |
|
56 |
|
57 CCamcTestClient_9::CCamcTestClient_9 () : CTimer(CActive::EPriorityHigh) |
|
58 { |
|
59 } |
|
60 |
|
61 |
|
62 CCamcTestClient_9::~CCamcTestClient_9 () |
|
63 { |
|
64 Cancel(); |
|
65 delete iCamc; |
|
66 } |
|
67 |
|
68 CCamcTestClient_9* CCamcTestClient_9::NewL() |
|
69 { |
|
70 CCamcTestClient_9* self = new(ELeave) CCamcTestClient_9; |
|
71 CleanupStack::PushL(self); |
|
72 self->ConstructL( ); |
|
73 CleanupStack::Pop(self); |
|
74 return self; |
|
75 } |
|
76 |
|
77 void CCamcTestClient_9::ConstructL( ) |
|
78 { |
|
79 iCamc = CVideoRecorderUtility::NewL( *this, KAudioPriorityVideoRecording, EMdaPriorityPreferenceTimeAndQuality ); |
|
80 iOpenReady = EFalse; |
|
81 iPrepareReady = EFalse; |
|
82 iRecordingReady = EFalse; |
|
83 iPaused = EFalse; |
|
84 iNewFileName = EFalse; |
|
85 iRecord2ndTime = EFalse; |
|
86 |
|
87 CTimer::ConstructL(); |
|
88 iTimeout = 0; |
|
89 iClosed = 0; |
|
90 CActiveScheduler::Add(this); |
|
91 } |
|
92 |
|
93 |
|
94 void CCamcTestClient_9::Start_Active_ObjectL ( TestClient9Actions aAction, TInt aCameraHandle ) |
|
95 { |
|
96 |
|
97 TFileName file; |
|
98 TInt camHandle = aCameraHandle; |
|
99 TUid controllerUid = {0x101F8503}; //implementation uid |
|
100 TUid formatUid = {0}; |
|
101 TUid formatUidG2 = {0x101F86D6}; |
|
102 TUid formatUidMP4 = {0x101F873D}; |
|
103 |
|
104 |
|
105 iAction = aAction; //iAction might be set to NULL after action has been executed |
|
106 iSavedAction = aAction; //SavedAction will never be changed. |
|
107 // iTimeout = aTimeout; |
|
108 iTimeout = 1500000; |
|
109 |
|
110 if ( iAction == K_TC9_NewFileNameWhenRecordSecondTimeDiffFileFormat ) |
|
111 { |
|
112 AddDriveLetterToPath(_L("recordQCIF.3g2"), file); |
|
113 |
|
114 TRAPD(err, |
|
115 iCamc->OpenFileL( file, camHandle, |
|
116 controllerUid, |
|
117 formatUidG2, |
|
118 _L8("video/H263-2000"), |
|
119 TFourCC(' ', 'A', 'M', 'R') )); |
|
120 |
|
121 if (err) |
|
122 { |
|
123 User::Leave(99); |
|
124 } |
|
125 } |
|
126 else if ( iAction == K_TC9_NewFileNameWhenRecordSecondTimeMPEG4FileFormat ) |
|
127 { |
|
128 AddDriveLetterToPath(_L("recordQCIF.mp4"), file); |
|
129 |
|
130 TRAPD(err, |
|
131 iCamc->OpenFileL( file, camHandle, |
|
132 controllerUid, |
|
133 formatUidMP4, |
|
134 _L8("video/mp4v-es; profile-level-id=3"), |
|
135 TFourCC(' ', 'A', 'A', 'C') )); |
|
136 |
|
137 if (err) |
|
138 { |
|
139 User::Leave(99); |
|
140 } |
|
141 } |
|
142 else if ( iAction == K_TC9_NewFileNameWhenRecordSecondTimeH264BaselineFileFormat ) |
|
143 { |
|
144 AddDriveLetterToPath(_L("recordCIF.mp4"), file); |
|
145 |
|
146 TRAPD(err, |
|
147 iCamc->OpenFileL( file, camHandle, |
|
148 controllerUid, |
|
149 formatUidMP4, |
|
150 _L8("video/H264; profile-level-id=42800D"), |
|
151 TFourCC(' ', 'A', 'A', 'C') )); |
|
152 |
|
153 if (err) |
|
154 { |
|
155 User::Leave(99); |
|
156 } |
|
157 } |
|
158 else if ( iAction == K_TC9_NewFileNameWhenRecordSecondTimeH264HighFileFormat ) |
|
159 { |
|
160 AddDriveLetterToPath(_L("recordCIF.mp4"), file); |
|
161 |
|
162 TRAPD(err, |
|
163 iCamc->OpenFileL( file, camHandle, |
|
164 controllerUid, |
|
165 formatUidMP4, |
|
166 _L8("video/H264; profile-level-id=64400D"), |
|
167 TFourCC(' ', 'A', 'A', 'C') )); |
|
168 |
|
169 if (err) |
|
170 { |
|
171 User::Leave(99); |
|
172 } |
|
173 } |
|
174 else |
|
175 { |
|
176 AddDriveLetterToPath(_L("recordQCIF.3gp"), file); |
|
177 |
|
178 TRAPD(err, |
|
179 iCamc->OpenFileL( file, camHandle, |
|
180 controllerUid, |
|
181 formatUid, |
|
182 _L8("video/H263-2000"), |
|
183 TFourCC(' ', 'A', 'M', 'R') )); |
|
184 |
|
185 if (err) |
|
186 { |
|
187 User::Leave(99); |
|
188 } |
|
189 } |
|
190 iOpenReady = EFalse; |
|
191 |
|
192 // Main part of program is a wait loop |
|
193 // This function completes when the scheduler stops |
|
194 CActiveScheduler::Start(); |
|
195 |
|
196 if ( iError ) |
|
197 { |
|
198 User::Leave( iError ); |
|
199 } |
|
200 } |
|
201 |
|
202 void CCamcTestClient_9::RunL() |
|
203 { |
|
204 |
|
205 // Trap RunL, to catch if the AO leaves. |
|
206 // A Walkaround... |
|
207 // RunError() should be used in this case, but |
|
208 // Apparently, it is not possible to use the AO RunError() virtual function |
|
209 // for that purpose, it is not called. |
|
210 |
|
211 TRAPD( err,RunLTrappedL() ); |
|
212 if ( err ) |
|
213 { |
|
214 SomethingInActiveObjectIsLeaving(err); |
|
215 } |
|
216 } |
|
217 |
|
218 void CCamcTestClient_9::RunLTrappedL() |
|
219 { |
|
220 if ( iOpenReady ) |
|
221 { |
|
222 iOpenReady = EFalse; |
|
223 switch ( iAction ) |
|
224 { |
|
225 case K_Tc9_PrepareWhenControllerReadyWhitoutSetting: |
|
226 case K_Tc9_PrepareWhenControllerReadyOnlyVideoBitRateSetting: |
|
227 case K_Tc9_PrepareWhenControllerReadyOnlyVideoFrameSizeSetting: |
|
228 { |
|
229 break; |
|
230 } |
|
231 case K_TC9_NewFileNameWhenInternalStop: |
|
232 { |
|
233 iCamc->SetMaxClipSizeL(TC9_FILE_SIZE_LIMIT) ; |
|
234 break; |
|
235 } |
|
236 case K_TC9_NewFileNameWhenRecordSecondTimeMPEG4FileFormat: |
|
237 case K_TC9_NewFileNameWhenRecordSecondTimeH264BaselineFileFormat: |
|
238 case K_TC9_NewFileNameWhenRecordSecondTimeH264HighFileFormat: |
|
239 { |
|
240 iCamc->SetVideoFrameSizeL(TSize(352,288)); |
|
241 iCamc->SetVideoFrameRateL(TReal32(15)); |
|
242 iCamc->SetVideoBitRateL( TC9_VIDEO_BIT_RATE ); |
|
243 iCamc->SetAudioBitRateL(TInt( TC9_AUDIO_BIT_RATE_AAC )); |
|
244 break; |
|
245 } |
|
246 default: |
|
247 { |
|
248 // Set default parameters. They can be overwritten depending on the test case. |
|
249 iCamc->SetVideoFrameSizeL(TSize(176,144)); |
|
250 iCamc->SetVideoFrameRateL(TReal32(15)); |
|
251 iCamc->SetVideoBitRateL( TC9_VIDEO_BIT_RATE ); |
|
252 iCamc->SetAudioBitRateL(TInt( TC9_AUDIO_BIT_RATE )); |
|
253 break; |
|
254 } |
|
255 |
|
256 } |
|
257 |
|
258 switch ( iAction ) |
|
259 { |
|
260 case K_Tc9_PrepareWhenControllerReadyWhitoutSetting: |
|
261 { |
|
262 break; |
|
263 } |
|
264 case K_Tc9_PrepareWhenControllerReadyOnlyVideoBitRateSetting: |
|
265 { |
|
266 iCamc->SetVideoBitRateL(TInt(50000)); |
|
267 break; |
|
268 } |
|
269 case K_Tc9_PrepareWhenControllerReadyOnlyVideoFrameSizeSetting: |
|
270 { |
|
271 iCamc->SetVideoFrameSizeL(TSize(176,144)); |
|
272 break; |
|
273 } |
|
274 case K_Tc9_SetMaxClipSizeLWhenControllerReadySize0: |
|
275 { |
|
276 iCamc->SetMaxClipSizeL( 0 ); |
|
277 break; |
|
278 } |
|
279 case K_Tc9_SetMaxClipSizeLWhenControllerReadyKMMFNoMaxClipSize: |
|
280 { |
|
281 iCamc->SetMaxClipSizeL( KMMFNoMaxClipSize ); |
|
282 break; |
|
283 } |
|
284 case K_Tc9_OpenFileInAFolderNonExistent: |
|
285 { |
|
286 AddDriveLetterToPath(_L("non-existent-folder\\recordQCIF.3gp"), iFileName); |
|
287 TMMFFileParams params; |
|
288 params.iPath = iFileName; |
|
289 TPckgC<TMMFFileParams> pckg(params); |
|
290 |
|
291 TUid controllerUid = {0x101F8503}; // controller implementation interface uid |
|
292 TInt ret = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8); |
|
293 if (ret != 0) |
|
294 { |
|
295 User::Leave(K_Tc9_ValueNotExpected); |
|
296 } |
|
297 iAction = K_Tc9_none; |
|
298 break; |
|
299 } |
|
300 default: |
|
301 { |
|
302 break; |
|
303 } |
|
304 } |
|
305 iCamc->Prepare(); |
|
306 |
|
307 } |
|
308 else if ( iPrepareReady ) |
|
309 { |
|
310 TBool record = EFalse; |
|
311 switch ( iAction ) |
|
312 { |
|
313 case K_Tc9_SetMaxClipSizeLWhenControllerReadySize0: |
|
314 case K_Tc9_SetMaxClipSizeLWhenControllerReadyKMMFNoMaxClipSize: |
|
315 { |
|
316 iPrepareReady = EFalse; |
|
317 iCamc->Record(); |
|
318 record = EFalse; |
|
319 break; |
|
320 } |
|
321 case K_TC9_NewFileNameWhenPreparedNotRecording: |
|
322 { |
|
323 if (!iNewFileName) |
|
324 { |
|
325 AddDriveLetterToPath(_L("NewFileName.3gp"),iFileName); |
|
326 |
|
327 TMMFFileParams params; |
|
328 params.iPath = iFileName; |
|
329 TPckgC<TMMFFileParams> pckg(params); |
|
330 |
|
331 TUid controllerUid = {0x101F8503}; // controller implementation interface uid |
|
332 TInt ret = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8); |
|
333 if (ret != 0) |
|
334 { |
|
335 User::Leave(K_Tc9_ValueNotExpected); |
|
336 } |
|
337 |
|
338 iCamc->Prepare(); |
|
339 iAction = K_Tc9_none; |
|
340 } |
|
341 break; |
|
342 } |
|
343 case K_TC9_NewFileNameWhenInternalStop : |
|
344 { |
|
345 iPrepareReady = EFalse; |
|
346 iCamc->Record(); // No timer need, will eventually stop because of filesize limit. |
|
347 break; |
|
348 } |
|
349 |
|
350 default: |
|
351 { |
|
352 record = ETrue; |
|
353 break; |
|
354 } |
|
355 } |
|
356 if ( record ) |
|
357 { |
|
358 iPrepareReady = EFalse; |
|
359 iCamc->Record(); |
|
360 CTimer::After( iTimeout ); |
|
361 } |
|
362 } |
|
363 |
|
364 else if ( iRecordingReady ) |
|
365 { |
|
366 TBool close = EFalse; |
|
367 iRecordingReady = EFalse; |
|
368 |
|
369 TMMFFileParams params; |
|
370 switch ( iAction ) |
|
371 { |
|
372 case K_Tc9_RecordTimeAvailWhenRecordingReady: |
|
373 { |
|
374 // Compare if default size limit is correctly returned by |
|
375 // a RecordTimeAvailableL |
|
376 TTimeIntervalMicroSeconds timeRemaining = iCamc->RecordTimeAvailable(); |
|
377 TInt64 timeRemainingInSec = timeRemaining.Int64()/1E6; //Max time is 3600s = 60min |
|
378 |
|
379 PRINT((_L("CCamCTest_9::RecordTimeAvailable5: timeRemainingInSec: %d "), I64INT(timeRemainingInSec ))); |
|
380 |
|
381 |
|
382 |
|
383 // Duration value depends on available disk drive space. |
|
384 // Get the free space of the disk drive: |
|
385 |
|
386 RFs fsSession; |
|
387 fsSession.Connect(); |
|
388 TVolumeInfo volumeInfo; |
|
389 TInt err = fsSession.Volume(volumeInfo,EDriveC); |
|
390 fsSession.Close(); |
|
391 if (err) |
|
392 { |
|
393 User::Leave( KErrGeneral) ; |
|
394 } |
|
395 |
|
396 // Possible duration = available disk space/videobitrate |
|
397 TInt64 calculatedDuration = volumeInfo.iFree / TInt64((TC9_VIDEO_BIT_RATE+TC9_AUDIO_BIT_RATE)/8); |
|
398 |
|
399 // If there is more space than the max length of the video -> |
|
400 // set the calculatedDuration to max length |
|
401 if ( calculatedDuration > KMaxVideoLength) |
|
402 { |
|
403 calculatedDuration = KMaxVideoLength; |
|
404 } |
|
405 |
|
406 RDebug::Print(_L("CCamcTest_9::RecordTimeAvailable5 timeRemaining is %d "), I64INT(timeRemainingInSec )); |
|
407 RDebug::Print(_L("CCamcTest_9::RecordTimeAvailable5 calculatedDuration is %d "), I64INT(calculatedDuration ) ); |
|
408 // Allows 5% error margin: |
|
409 if ( ( timeRemainingInSec > calculatedDuration*1.05 ) || |
|
410 ( timeRemainingInSec < calculatedDuration*0.95 ) ) |
|
411 { |
|
412 RDebug::Print(_L("CCamcTest_9::RecordTimeAvailable5 is leaving, because timeRemaining != Calculated ") ); |
|
413 User::Leave( K_Tc9_ValueNotWithinRange ) ; |
|
414 } |
|
415 close = ETrue; |
|
416 break; |
|
417 } |
|
418 |
|
419 case K_TC9_NewFileNameWhenRecordSecondTime : |
|
420 { |
|
421 if (!iRecord2ndTime) |
|
422 { |
|
423 iRecord2ndTime =ETrue; |
|
424 AddDriveLetterToPath(_L("NewFileName.3gp"), iFileName ); |
|
425 |
|
426 params.iPath = iFileName; |
|
427 TPckgC<TMMFFileParams> pckg(params); |
|
428 |
|
429 TUid controllerUid = {0x101F8503}; // controller implementation interface uid |
|
430 TInt ret = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8); |
|
431 if (ret != 0) |
|
432 { |
|
433 User::Leave(K_Tc9_ValueNotExpected); |
|
434 } |
|
435 iCamc->Prepare(); |
|
436 iAction = K_Tc9_none; |
|
437 } |
|
438 break; |
|
439 } |
|
440 |
|
441 case K_TC9_NewFileNameWhenRecordSecondTimeDiffFileFormat : |
|
442 { |
|
443 if (!iRecord2ndTime) |
|
444 { |
|
445 iRecord2ndTime =ETrue; |
|
446 AddDriveLetterToPath(_L("NewFileName.3g2"), iFileName ); |
|
447 |
|
448 params.iPath = iFileName; |
|
449 TPckgC<TMMFFileParams> pckg(params); |
|
450 |
|
451 TUid controllerUid = {0x101F8503}; // controller implementation interface uid |
|
452 TInt ret = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8); |
|
453 if (ret != 0) |
|
454 { |
|
455 User::Leave(K_Tc9_ValueNotExpected); |
|
456 } |
|
457 iCamc->Prepare(); |
|
458 iAction = K_Tc9_none; |
|
459 } |
|
460 break; |
|
461 } |
|
462 |
|
463 case K_TC9_NewFileNameWhenRecordSecondTimeMPEG4FileFormat : |
|
464 case K_TC9_NewFileNameWhenRecordSecondTimeH264BaselineFileFormat: |
|
465 case K_TC9_NewFileNameWhenRecordSecondTimeH264HighFileFormat: |
|
466 { |
|
467 if (!iRecord2ndTime) |
|
468 { |
|
469 iRecord2ndTime =ETrue; |
|
470 AddDriveLetterToPath(_L("NewFileName.mp4"), iFileName ); |
|
471 |
|
472 params.iPath = iFileName; |
|
473 TPckgC<TMMFFileParams> pckg(params); |
|
474 |
|
475 TUid controllerUid = {0x101F8503}; // controller implementation interface uid |
|
476 TInt ret = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8); |
|
477 if (ret != 0) |
|
478 { |
|
479 User::Leave(K_Tc9_ValueNotExpected); |
|
480 } |
|
481 iCamc->Prepare(); |
|
482 iAction = K_Tc9_none; |
|
483 } |
|
484 break; |
|
485 } |
|
486 |
|
487 case K_TC9_NewFileNameWhenInternalStop : |
|
488 { |
|
489 if (!iRecord2ndTime) |
|
490 { |
|
491 iRecord2ndTime =ETrue; |
|
492 AddDriveLetterToPath(_L("NewFileName.3gp"), iFileName ); |
|
493 |
|
494 params.iPath = iFileName; |
|
495 TPckgC<TMMFFileParams> pckg(params); |
|
496 |
|
497 TUid controllerUid = {0x101F8503}; // controller implementation interface uid |
|
498 TInt ret = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8); |
|
499 if (ret != 0) |
|
500 { |
|
501 User::Leave(K_Tc9_ValueNotExpected); |
|
502 } |
|
503 |
|
504 iCamc->Prepare(); |
|
505 } |
|
506 else |
|
507 { |
|
508 close = ETrue; |
|
509 } |
|
510 break; |
|
511 |
|
512 } |
|
513 default: |
|
514 { |
|
515 close = ETrue; |
|
516 break; |
|
517 } |
|
518 } |
|
519 if (close) |
|
520 { |
|
521 iCamc->Close(); |
|
522 iClosed = ETrue; |
|
523 CTimer::After( 1000 ); |
|
524 } |
|
525 } |
|
526 |
|
527 else |
|
528 { |
|
529 RunLContinuedL(); |
|
530 } |
|
531 |
|
532 if ( iClosed ) |
|
533 { |
|
534 iCamc->Stop(); |
|
535 CActiveScheduler::Stop(); |
|
536 } |
|
537 } |
|
538 |
|
539 void CCamcTestClient_9::RunLContinuedL() |
|
540 // This function exist to skip a MS VC6 bug/feature |
|
541 // Without this, VC6 would complains about stack abuse. |
|
542 { |
|
543 if ( iPaused ) //resume |
|
544 { |
|
545 switch ( iAction ) |
|
546 { |
|
547 case K_TC9_NewFileNameWhenPaused : |
|
548 { |
|
549 |
|
550 AddDriveLetterToPath(_L("NewFileName.3gp"), iFileName ); |
|
551 |
|
552 iAction=K_Tc9_none; |
|
553 |
|
554 TMMFFileParams params; |
|
555 params.iPath = iFileName; |
|
556 TPckgC<TMMFFileParams> pckg(params); |
|
557 |
|
558 TUid controllerUid = {0x101F8503}; // controller implementation interface uid |
|
559 TInt err = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8); |
|
560 if (err) |
|
561 { |
|
562 User::Leave(err); |
|
563 } |
|
564 break; |
|
565 } |
|
566 default: |
|
567 iPaused = EFalse; |
|
568 iCamc->Record(); |
|
569 } |
|
570 } |
|
571 |
|
572 else //timer |
|
573 { |
|
574 switch ( iAction ) |
|
575 { |
|
576 case K_TC9_NewFileNameWhenRecording : |
|
577 { |
|
578 AddDriveLetterToPath(_L("NewFileName.3gp"), iFileName ); |
|
579 |
|
580 TMMFFileParams params; |
|
581 params.iPath = iFileName; |
|
582 TPckgC<TMMFFileParams> pckg(params); |
|
583 |
|
584 TUid controllerUid = {0x101F8503}; // controller implementation interface uid |
|
585 TInt err = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8); |
|
586 if (err) |
|
587 { |
|
588 User::Leave(err); |
|
589 } |
|
590 break; |
|
591 } |
|
592 case K_TC9_NewFileNameWhenPaused: |
|
593 { |
|
594 iCamc->PauseL(); |
|
595 CTimer::After(2 * TInt32 ( 1E6 ) ); // Pause for 2 seconds. |
|
596 iPaused=ETrue; |
|
597 break; |
|
598 } |
|
599 default: |
|
600 iCamc->Stop(); // Simulates that iRecording has been completed through the |
|
601 // MvruoRecordComplete callback |
|
602 iRecordingReady=ETrue; |
|
603 CTimer::After( 1000 ); |
|
604 } |
|
605 } |
|
606 |
|
607 |
|
608 } |
|
609 |
|
610 |
|
611 |
|
612 void CCamcTestClient_9::DoCancel() |
|
613 { |
|
614 iCamc->Stop(); |
|
615 iCamc->Close(); |
|
616 delete iCamc; |
|
617 iCamc = NULL; |
|
618 } |
|
619 |
|
620 |
|
621 void CCamcTestClient_9::MvruoOpenComplete( TInt aError ) |
|
622 { |
|
623 if (aError) |
|
624 { |
|
625 SomethingInActiveObjectIsLeaving(aError); |
|
626 } |
|
627 else |
|
628 { |
|
629 iOpenReady = ETrue; |
|
630 RunL(); |
|
631 } |
|
632 } |
|
633 |
|
634 void CCamcTestClient_9::MvruoPrepareComplete( TInt aError ) |
|
635 { |
|
636 if (aError) |
|
637 { |
|
638 SomethingInActiveObjectIsLeaving(aError); |
|
639 } |
|
640 else |
|
641 { |
|
642 iPrepareReady = ETrue; |
|
643 RunL(); |
|
644 } |
|
645 } |
|
646 |
|
647 void CCamcTestClient_9::MvruoRecordComplete( TInt aError ) |
|
648 { |
|
649 switch( iAction) |
|
650 { |
|
651 case K_Tc9_SetMaxClipSizeLWhenControllerReadySize0 : |
|
652 case K_Tc9_SetMaxClipSizeLWhenControllerReadyKMMFNoMaxClipSize : |
|
653 { |
|
654 if ( (aError == KErrDiskFull) || (aError == KErrCompletion ) ) |
|
655 { |
|
656 // KErrCompletion if there is more space than needed for 60 min recording. |
|
657 // Otherwise KErrDiskFull |
|
658 aError = KErrNone; |
|
659 } |
|
660 else |
|
661 { |
|
662 aError = KErrGeneral; |
|
663 } |
|
664 break; |
|
665 } |
|
666 case K_TC9_NewFileNameWhenInternalStop : |
|
667 { |
|
668 if (aError == KErrCompletion) |
|
669 { |
|
670 // That's expected case. |
|
671 aError = KErrNone; |
|
672 } |
|
673 else |
|
674 { |
|
675 aError = KErrGeneral; |
|
676 } |
|
677 break; |
|
678 } |
|
679 } |
|
680 |
|
681 if (aError) |
|
682 { |
|
683 SomethingInActiveObjectIsLeaving(aError); |
|
684 } |
|
685 else |
|
686 { |
|
687 iRecordingReady = ETrue; |
|
688 RunL(); |
|
689 } |
|
690 } |
|
691 |
|
692 void CCamcTestClient_9::MvruoEvent(const TMMFEvent& /*aEvent*/) |
|
693 { |
|
694 /* Should be never called ... */ |
|
695 SomethingInActiveObjectIsLeaving(99); |
|
696 } |
|
697 |
|
698 void CCamcTestClient_9::SomethingInActiveObjectIsLeaving (TInt aError) |
|
699 { |
|
700 // Something in the active object is leaving |
|
701 // or a fatal error has been found. |
|
702 |
|
703 // Stop the active object scheduler. |
|
704 iError=aError; |
|
705 iCamc->Stop(); |
|
706 CActiveScheduler::Stop(); |
|
707 } |
|
708 |
|
709 |