|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Part of the MVS Application for TechView |
|
15 // |
|
16 |
|
17 #include <techview/eikfnlab.h> |
|
18 #include <techview/eikcfdlg.h> |
|
19 #include <techview/eikbtgpc.h> |
|
20 #include <techview/eikdialg.h> |
|
21 #include <techview/eikon.rsg> |
|
22 #include <eikmobs.h> |
|
23 #include <coecntrl.h> |
|
24 #include <eikenv.h> |
|
25 #include "MVSAppUI.h" |
|
26 #include "MVSApp.hrh" |
|
27 #include "MVSViewTicker.h" |
|
28 #include "MVSConstants.h" |
|
29 #include "MVSVolumeDialog.h" |
|
30 #include "MVSBalanceDialog.h" |
|
31 #include "MVSRepeatDialog.h" |
|
32 #include "MVSSelectPluginsDialog.h" |
|
33 #include "MVSSaveAsDialog.h" |
|
34 #include "MVSEditMetaInfoDialog.h" |
|
35 #include "MVSConfigAudioFormatDialog.h" |
|
36 #include "MVSConfigVideoFormatDialog.h" |
|
37 #include "MVSSystemInfoDialog.h" |
|
38 #include "MVSVideoSettingDialog.h" |
|
39 #include "MVSAudioSettingDialog.h" |
|
40 #include "MVSSetPlayWindowDialog.h" |
|
41 #include "MVSViewMetaInfoDialog.h" |
|
42 #include "MVSCropDialog.h" |
|
43 #include "MVSMultipleScreenDialog.h" |
|
44 #include "MVSResourceNotifyDialog.h" |
|
45 |
|
46 const TInt KMaxSupportedPlugins = 10; |
|
47 const TInt KMaxSupportedExtension = 10; |
|
48 const TInt KMaxSupportedCodecs = 10; |
|
49 const TInt KLabelCaptionMaxLength = 16; |
|
50 const TInt KTimeValueLength = 12; |
|
51 |
|
52 void CMVSAppUi::ConstructL() |
|
53 { |
|
54 CEikAppUi::ConstructL(); |
|
55 User::LeaveIfError(iLogs.Connect()); |
|
56 iLogs.MkDirAll(KLogsPath); |
|
57 iButtons=iEikonEnv->AppUiFactory()->ToolBar(); |
|
58 //Meta entry initialization |
|
59 iMetaTitle = CMMFMetaDataEntry::NewL(KTitle,Ka); |
|
60 iMetaAuthor = CMMFMetaDataEntry::NewL(KAuthor,Ka); |
|
61 iMetaCopyright = CMMFMetaDataEntry::NewL(KCopyrt,Ka); |
|
62 iMetaRevision = CMMFMetaDataEntry::NewL(KRevision,Ka); |
|
63 iMetaCategory = CMMFMetaDataEntry::NewL(KCategory,Ka); |
|
64 iMetaComments = CMMFMetaDataEntry::NewL(KComments,Ka); |
|
65 iVideoPlayAgent = CMVSVideoPlayAgent::NewL(*this); |
|
66 iAppView = CMVSAppView::NewL(ClientRect(), *iVideoPlayAgent); |
|
67 iPluginArray = new(ELeave) CDesCArrayFlat(KMaxSupportedPlugins); |
|
68 iExtArray = new(ELeave) CDesCArrayFlat(KMaxSupportedExtension); |
|
69 iCodecArray = new(ELeave) CDesCArrayFlat(KMaxSupportedCodecs); |
|
70 iAudioPlayAgent = CMVSAudioPlayAgent::NewL(*this); |
|
71 iAudioRecordAgent = CMVSAudioRecordAgent::NewL(*this); |
|
72 iVideoRecordAgent = CMVSVideoRecordAgent::NewL(*this); |
|
73 iPluginInfo=CMVSControllerPluginInfo::NewL(); |
|
74 iAutoplay = EFalse; |
|
75 iMode=EIdle; |
|
76 User::LeaveIfError(iLogger.Connect()); |
|
77 iLogger.CreateLog(KLogsDir,KLogsFile,EFileLoggingModeAppend); |
|
78 iSettingManager = CSettingsManager::NewL(); |
|
79 iRepeatDelay = 1000000;//initial value of 1 second in microseconds. |
|
80 iPriority = 1;//default settings |
|
81 iPriorityPreference = EMdaPriorityPreferenceNone;//default settings |
|
82 iRotation = EVideoRotationNone;//default settings |
|
83 iNoRepeats = 0; |
|
84 iScreenNumber = 0; |
|
85 if(!iSettingManager->FileExists()) |
|
86 { |
|
87 iSettingManager->MakeSeedIndexL(); |
|
88 } |
|
89 iSettingManager->ReadGeneralSettingsL(this); |
|
90 iSelectedPluginIdx = -1; |
|
91 iMediaType = 0; //set audio media initially |
|
92 iPluginsCnt = iPluginInfo->GetPluginListL(iPluginArray,iUidArray ); |
|
93 iControllerUid = TUid::Null(); |
|
94 iViewTicker = CMVSViewTicker::NewL(this); |
|
95 |
|
96 // Add one video control per screen |
|
97 // except for screen 0 which already has a video control |
|
98 // via the app view |
|
99 const TInt numScreens = CCoeEnv::Static()->WsSession().NumberOfScreens(); |
|
100 |
|
101 for(TInt i = 1; i < numScreens; ++i) |
|
102 { |
|
103 CMVSVideoControl* videoCtl = CMVSVideoControl::NewLC(*iVideoPlayAgent, i, *(CCoeEnv::Static()->RootWin(i))); |
|
104 CWsScreenDevice* screenDevice = new (ELeave) CWsScreenDevice(CCoeEnv::Static()->WsSession()); |
|
105 CleanupStack::PushL(screenDevice); |
|
106 User::LeaveIfError(screenDevice->Construct(i)); |
|
107 videoCtl->SetExtent(TPoint(0, 0), screenDevice->SizeInPixels()); |
|
108 CleanupStack::PopAndDestroy(screenDevice); |
|
109 videoCtl->ActivateL(); |
|
110 iVideoCtls.AppendL(videoCtl); |
|
111 CleanupStack::Pop(videoCtl); |
|
112 } |
|
113 |
|
114 iVideoCtl = iAppView->iMainWindowControl; |
|
115 iLogger.Write(_L("Application START")); |
|
116 iSrcFName.Copy(KDefault); |
|
117 iDestFilename = KDefault; |
|
118 iRecordLimitSet = EFalse; |
|
119 iAlreadyRegistered = EFalse; |
|
120 } |
|
121 |
|
122 CMVSAppUi::CMVSAppUi() |
|
123 :iVolumeOrGain(10),iNoRepeats(0),iMainWindowText(8), iMaxFileBuffer(0) |
|
124 #ifdef SYMBIAN_BUILD_GCE |
|
125 ,iAutoScaleType(EAutoScaleNone), |
|
126 iAutoScaleHorizPos(EHorizontalAlignCenter), |
|
127 iAutoScaleVertPos(EVerticalAlignCenter) |
|
128 #endif |
|
129 { |
|
130 } |
|
131 |
|
132 CMVSAppUi::~CMVSAppUi() |
|
133 { |
|
134 delete iAudioPlayAgent; |
|
135 delete iAudioRecordAgent; |
|
136 delete iVideoPlayAgent; |
|
137 delete iVideoRecordAgent; |
|
138 iUidArray.Close(); |
|
139 iAudioUidArray.Close(); |
|
140 iVideoUidArray.Close(); |
|
141 iAudioPlayUidArray.Close(); |
|
142 iOverlayText.Close(); |
|
143 delete iPluginInfo; |
|
144 delete iPluginArray; |
|
145 delete iExtArray; |
|
146 delete iCodecArray; |
|
147 delete iMetaTitle; |
|
148 delete iMetaAuthor; |
|
149 delete iMetaCopyright; |
|
150 delete iMetaRevision; |
|
151 delete iMetaCategory; |
|
152 delete iMetaComments; |
|
153 iMainWindowText.Reset(); |
|
154 if(iLogger.Handle()) |
|
155 { |
|
156 iLogger.CloseLog(); |
|
157 iLogger.Close(); |
|
158 } |
|
159 iLogs.Close(); |
|
160 delete iViewTicker; |
|
161 delete iSettingManager; |
|
162 iVideoCtls.ResetAndDestroy(); |
|
163 delete iAppView; |
|
164 } |
|
165 |
|
166 //All the user actvated actions in the UI is captured and handled |
|
167 //through here |
|
168 void CMVSAppUi::HandleCommandL(TInt aCommand) |
|
169 { |
|
170 TBool needsUpdating = ETrue; |
|
171 switch (aCommand) |
|
172 { |
|
173 case EMVSCmdNew: |
|
174 { |
|
175 if( iMode != EIdle ) |
|
176 { |
|
177 return;//dont get into record mode,as the system is still in a previous active state,Playing/Recording. |
|
178 } |
|
179 FileOpenForRecordL(); |
|
180 } |
|
181 break; |
|
182 |
|
183 |
|
184 case EMVSCmdOpen: |
|
185 { |
|
186 if(iState == EAudioPlaying || iState == EVideoPlaying || iState == EAudioRecording || iState == EVideoRecording || iMode == EVideoRecord || iMode == EAudioRecord) |
|
187 { |
|
188 return;//dont get into record mode,as the system is still in a previous active state,Playing/Recording. |
|
189 } |
|
190 Reset(); |
|
191 FileOpenL(); |
|
192 iLogger.Write(_L("Opened for Play")); |
|
193 } |
|
194 break; |
|
195 |
|
196 case EMVSCmdMultiScreen: |
|
197 { |
|
198 iSetScreen->SetupDialogLD(iScreenNumber,this); |
|
199 } |
|
200 break; |
|
201 |
|
202 case EMVSRegisterForNotification: |
|
203 { |
|
204 iRegisterForNotification->SetupDialogLD(this); |
|
205 } |
|
206 break; |
|
207 |
|
208 case EMVSCmdSetVolume: |
|
209 { |
|
210 if((iMode == EAudioPlay) || (iMode == EVideoPlay)) |
|
211 { |
|
212 iVolumeDialog->SetupDialogLD(iVolumeOrGain,0,0, ETrue, this); |
|
213 iLogger.Write(_L("volume set")); |
|
214 } |
|
215 else if((iMode == EAudioRecord)||(iMode == EVideoRecord)) |
|
216 { |
|
217 iVolumeDialog->SetupDialogLD(iVolumeOrGain,0,0, EFalse, this); |
|
218 iLogger.Write(_L("gain set")); |
|
219 } |
|
220 } |
|
221 break; |
|
222 |
|
223 |
|
224 case EMVSCmdSetPlayBalance: |
|
225 { |
|
226 iBalanceDialog->SetupDialogLD(iBalance,this, ETrue); |
|
227 iLogger.Write(_L("Balance Set")); |
|
228 } |
|
229 break; |
|
230 |
|
231 |
|
232 case EMVSCmdSetRecordBalance: |
|
233 { |
|
234 iBalanceDialog->SetupDialogLD(0,this, EFalse); |
|
235 } |
|
236 break; |
|
237 |
|
238 |
|
239 case EMVSCmdSetRepeats: |
|
240 { |
|
241 iRepeatDialog->SetupDialogLD(iNoRepeats,iRepeatDelay, this); |
|
242 iLogger.Write(_L("Repeats Set")); |
|
243 } |
|
244 break; |
|
245 |
|
246 case EMVSCmdEditMetadata: |
|
247 { |
|
248 iMetaArray.Reset(); |
|
249 if(iMetaArray.Count() == 0) |
|
250 { |
|
251 InitializeMetaArrayL(); |
|
252 } |
|
253 switch(iMode) |
|
254 { |
|
255 case EAudioRecord: |
|
256 case EVideoRecord: |
|
257 { |
|
258 iEditMetaInfoDialog->SetupDialogLD(iMetaArray,this); |
|
259 iLogger.Write(_L("MetaData Edited")); |
|
260 iMetaArray.Close(); |
|
261 } |
|
262 break; |
|
263 |
|
264 case EAudioPlay: |
|
265 case EVideoPlay: |
|
266 { |
|
267 iViewMetaInfoDialog->SetupDialogLD(iMetaArray,this); |
|
268 iLogger.Write(_L("MetaData View")); |
|
269 iMetaArray.Close(); |
|
270 } |
|
271 } |
|
272 } |
|
273 break; |
|
274 |
|
275 |
|
276 case EMVSCmdExit: |
|
277 { |
|
278 if (iDisplayAdded) |
|
279 { |
|
280 iVideoPlayAgent->RemoveDisplayWindowL(iVideoCtl->ControlWindow()); |
|
281 iVideoPlayAgent->RemoveDisplayWindowL(iVideoCtl->Pip().ControlWindow()); |
|
282 iVideoPlayAgent->RemoveDisplay(iVideoCtl->ScreenNumber()); |
|
283 iVideoCtl->Pip().Clear(); |
|
284 iDisplayAdded = EFalse; |
|
285 } |
|
286 |
|
287 iLogger.Write(_L("Application EXIT")); |
|
288 iSettingManager->WriteGeneralSettingsL(this); |
|
289 Exit(); |
|
290 } |
|
291 break; |
|
292 |
|
293 |
|
294 case EMVSCmdPlay: |
|
295 { |
|
296 if(!iButtons->IsCommandDimmed(EMVSCmdPlay)) |
|
297 { |
|
298 switch(iMode) |
|
299 { |
|
300 case EAudioPlay: |
|
301 { |
|
302 iAppView->iStatusWindowTimeControl->ResetText2L(); |
|
303 SetVolumeL(iVolumeOrGain,0); |
|
304 iButtons->DimCommand(EMVSCmdRecord, ETrue); |
|
305 iButtons->DrawNow(); |
|
306 if(iState == ENotReady) |
|
307 { |
|
308 FileOpenL(); |
|
309 iAutoplay=ETrue; |
|
310 } |
|
311 else |
|
312 { |
|
313 iAudioPlayAgent->Play(); |
|
314 iLogger.Write(_L("Playing using AudioPlayAgent")); |
|
315 } |
|
316 } |
|
317 break; |
|
318 |
|
319 case EAudioRecord: |
|
320 { |
|
321 iAppView->iStatusWindowTimeControl->ResetText2L(); |
|
322 SetVolumeL(iVolumeOrGain,0); |
|
323 iAudioRecordAgent->PlayL(); |
|
324 iLogger.Write(_L("Playing using AudioRecordAgent")); |
|
325 } |
|
326 break; |
|
327 |
|
328 case EVideoPlay: |
|
329 { |
|
330 if (iVideoPlayAgent->AudioEnabledL()) |
|
331 { |
|
332 SetVolumeL(iVolumeOrGain, 0); |
|
333 } |
|
334 iButtons->DimCommand(EMVSCmdSetRepeats, ETrue); |
|
335 iButtons->DrawNow(); |
|
336 |
|
337 #ifdef SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS |
|
338 if (iVideoPlayAgent->SupportVideoPlayerUtility2()) |
|
339 { |
|
340 PrepareVideoControlsL(); |
|
341 } |
|
342 #endif // SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS |
|
343 iVideoPlayAgent->Play(); |
|
344 iLogger.Write(_L("Playing using VideoPlayAgent")); |
|
345 } |
|
346 break; |
|
347 |
|
348 case EIdle: |
|
349 case EVideoRecord: |
|
350 break; |
|
351 |
|
352 default: |
|
353 ASSERT(EFalse); |
|
354 break; |
|
355 } |
|
356 } |
|
357 else |
|
358 { |
|
359 needsUpdating = EFalse; |
|
360 } |
|
361 } |
|
362 break; |
|
363 |
|
364 |
|
365 case EMVSCmdRecord: |
|
366 { |
|
367 if(!iButtons->IsCommandDimmed(EMVSCmdRecord)) |
|
368 { |
|
369 switch(iMode) |
|
370 { |
|
371 case EAudioRecord: |
|
372 { |
|
373 iAudioRecordAgent->RecordL(); |
|
374 iLogger.Write(_L("Recording using AudioRecordAgent")); |
|
375 iButtons->DimCommand(EMVSCmdRecord, ETrue); |
|
376 iButtons->DimCommand(EMVSCmdPlay, ETrue); |
|
377 iButtons->DrawNow(); |
|
378 } |
|
379 break; |
|
380 case EVideoRecord: |
|
381 { |
|
382 //start view finder and record |
|
383 CCamera *camera = iVideoRecordAgent->Camera(); |
|
384 TSize imageSize; |
|
385 camera->EnumerateCaptureSizes(imageSize,1,CCamera::EFormatFbsBitmapColor16M); |
|
386 TPoint pos = DrawBorders(imageSize); |
|
387 TRect clientRect = ClientRect(); |
|
388 pos.iY += clientRect.iTl.iY;//add y-offset for menu bar |
|
389 TRect screenRect(pos,imageSize); |
|
390 TRect clipRect = screenRect ; |
|
391 if (!camera->ViewFinderActive()) |
|
392 { |
|
393 CCoeEnv *coenv = iAppView->iMainWindowControl->ControlEnv(); |
|
394 camera->StartViewFinderDirectL( coenv->WsSession(), |
|
395 *coenv->ScreenDevice(), |
|
396 *iAppView->DrawableWindow(), |
|
397 screenRect, |
|
398 clipRect); |
|
399 } |
|
400 if (!iFileReplace) |
|
401 { |
|
402 SetVideoFrameRateL(iVideoFrameRate); |
|
403 SetVideoFrameSizeL(iFrameSize); |
|
404 SetAudioEnabledL(iAudioEnabled); |
|
405 } |
|
406 iVideoRecordAgent->Record(); |
|
407 iLogger.Write(_L("Recording using VideoRecordAgent")); |
|
408 iButtons->DimCommand(EMVSCmdRecord, ETrue); |
|
409 iButtons->DimCommand(EMVSCmdPlay, ETrue); |
|
410 iButtons->DrawNow(); |
|
411 } |
|
412 break; |
|
413 default: |
|
414 ASSERT(EFalse); |
|
415 break; |
|
416 } |
|
417 } |
|
418 else |
|
419 { |
|
420 needsUpdating = EFalse; |
|
421 } |
|
422 } |
|
423 break; |
|
424 |
|
425 |
|
426 case EMVSCmdPause: |
|
427 { |
|
428 if(!iButtons->IsCommandDimmed(EMVSCmdPause)) |
|
429 { |
|
430 switch(iMode) |
|
431 { |
|
432 case EAudioPlay: |
|
433 { |
|
434 iAudioPlayAgent->Pause(); |
|
435 iLogger.Write(_L("AudioPlayAgent Paused")); |
|
436 iButtons->DimCommand(EMVSCmdPlay, EFalse); |
|
437 iButtons->DrawNow(); |
|
438 } |
|
439 break; |
|
440 |
|
441 case EAudioRecord: |
|
442 { |
|
443 User::InfoPrint(KNotsupported); |
|
444 } |
|
445 break; |
|
446 |
|
447 case EVideoPlay: |
|
448 { |
|
449 iVideoPlayAgent->PauseL(); |
|
450 iLogger.Write(_L("AudioPlayAgent Paused")); |
|
451 iButtons->DimCommand(EMVSCmdPlay, EFalse); |
|
452 iButtons->DrawNow(); |
|
453 } |
|
454 break; |
|
455 |
|
456 case EVideoRecord: |
|
457 { |
|
458 iVideoRecordAgent->PauseL(); |
|
459 iLogger.Write(_L("VideoRecordAgent Paused")); |
|
460 iButtons->DimCommand(EMVSCmdRecord, EFalse); |
|
461 iButtons->DrawNow(); |
|
462 } |
|
463 break; |
|
464 |
|
465 case EIdle: |
|
466 break; |
|
467 |
|
468 default: |
|
469 ASSERT(EFalse); |
|
470 break; |
|
471 } |
|
472 } |
|
473 else |
|
474 { |
|
475 needsUpdating = EFalse; |
|
476 } |
|
477 } |
|
478 break; |
|
479 |
|
480 |
|
481 case EMVSCmdStop: |
|
482 { |
|
483 if(!iButtons->IsCommandDimmed(EMVSCmdStop)) |
|
484 { |
|
485 switch(iMode) |
|
486 { |
|
487 case EAudioPlay: |
|
488 { |
|
489 iAudioPlayAgent->Stop(); |
|
490 iLogger.Write(_L("AudioPlayAgent Stopped")); |
|
491 iButtons->DimCommand(EMVSCmdPlay, EFalse); |
|
492 iButtons->DrawNow(); |
|
493 } |
|
494 break; |
|
495 |
|
496 case EAudioRecord: |
|
497 { |
|
498 iAudioRecordAgent->Stop(); |
|
499 iLogger.Write(_L("AudioRecordAgent Stopped")); |
|
500 iButtons->DimCommand(EMVSCmdRecord, EFalse); |
|
501 iButtons->DrawNow(); |
|
502 iButtons->DimCommand(EMVSCmdPlay, EFalse); |
|
503 iButtons->DrawNow(); |
|
504 } |
|
505 break; |
|
506 |
|
507 case EVideoPlay: |
|
508 { |
|
509 iVideoPlayAgent->Stop(); |
|
510 iLogger.Write(_L("VideoPlayAgent Stopped")); |
|
511 iButtons->DimCommand(EMVSCmdPlay, EFalse); |
|
512 iButtons->DrawNow(); |
|
513 iAppView->DrawNow(); |
|
514 } |
|
515 break; |
|
516 |
|
517 case EVideoRecord: |
|
518 { |
|
519 StopViewFinder(); |
|
520 iVideoRecordAgent->Stop(); |
|
521 iLogger.Write(_L("VideoRecordAgent Stopped")); |
|
522 iButtons->DimCommand(EMVSCmdRecord, EFalse); |
|
523 iButtons->DrawNow(); |
|
524 } |
|
525 break; |
|
526 |
|
527 case EIdle: |
|
528 break; |
|
529 |
|
530 default: |
|
531 ASSERT(EFalse); |
|
532 break; |
|
533 } |
|
534 } |
|
535 else |
|
536 { |
|
537 needsUpdating = EFalse; |
|
538 } |
|
539 } |
|
540 break; |
|
541 |
|
542 |
|
543 case EMVSCmdSetPlayWindow: |
|
544 { |
|
545 iSetPlayWindow->SetupDialogLD(iStart,iEnd,iDuration,this); |
|
546 iLogger.Write(_L("AudioPlayAgent SetPlayWindow")); |
|
547 } |
|
548 break; |
|
549 |
|
550 |
|
551 case EMVSCmdClearPlayWindow: |
|
552 { |
|
553 iStart = 0; |
|
554 iEnd = iAudioPlayAgent->Duration(); |
|
555 iAudioPlayAgent->ClearPlayWindow(); |
|
556 iLogger.Write(_L("AudioPlayAgent ClearPlayWindow")); |
|
557 } |
|
558 break; |
|
559 |
|
560 |
|
561 case EMVSCmdSystemInfo: |
|
562 { |
|
563 iSystemInfo->SetupDialogLD(this); |
|
564 iLogger.Write(_L("System Info")); |
|
565 } |
|
566 break; |
|
567 |
|
568 |
|
569 case EMVSVideoCmdSettings: |
|
570 { |
|
571 if (iVideoPlayAgent->SupportVideoPlayerUtility2()) |
|
572 { |
|
573 iVideoSetting->SetupDialogLD(iRotation, this, iVideoExtent, iWindowClipRect, ETrue, iPip, iCrp); |
|
574 } |
|
575 else |
|
576 { |
|
577 iVideoSetting->SetupDialogLD(iRotation,this, TRect(0, 0, 0, 0), TRect(0, 0, 0, 0), EFalse, EFalse, iCrp); |
|
578 } |
|
579 iLogger.Write(_L("Video Settings")); |
|
580 } |
|
581 break; |
|
582 |
|
583 |
|
584 case EMVSCmdAudioSetting: |
|
585 { |
|
586 iAudioSetting->SetupDialogLD(iNoRepeats,iRepeatDelay,iPriority,iPriorityPreference,iMaxFileBuffer, this); |
|
587 iLogger.Write(_L("Audio Setting")); |
|
588 } |
|
589 break; |
|
590 |
|
591 |
|
592 case EMVSCmdClose: |
|
593 { |
|
594 FileClose(); |
|
595 iRecordLimitSet = EFalse; |
|
596 } |
|
597 break; |
|
598 |
|
599 |
|
600 case EMVSCmdSetCropWindow: |
|
601 { |
|
602 iCropPosition=0; |
|
603 iCropStart=GetCropStart(); |
|
604 iClipLength = iAudioRecordAgent->Duration(); |
|
605 iCropEnd=iClipLength; |
|
606 iCropDialog->SetupDialogLD(iCropPosition,iClipLength,0,iCropEnd,this); |
|
607 iLogger.Write(_L("CropWindow set")); |
|
608 } |
|
609 break; |
|
610 |
|
611 case EMVSCmdClearLog: |
|
612 { |
|
613 |
|
614 } |
|
615 break; |
|
616 #ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT |
|
617 case EMVSCmdEnableSubtitles : |
|
618 { |
|
619 iVideoPlayAgent->EnableSubtitlesL(); |
|
620 } |
|
621 break; |
|
622 case EMVSCmdDisableSubtitles : |
|
623 { |
|
624 iVideoPlayAgent->DisableSubtitlesL(); |
|
625 } |
|
626 break; |
|
627 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT |
|
628 } |
|
629 if(needsUpdating) |
|
630 { |
|
631 UpdateDisplayL(iState); |
|
632 } |
|
633 } |
|
634 |
|
635 void CMVSAppUi::PrepareVideoControlsL() |
|
636 { |
|
637 if (iDisplayAdded) |
|
638 { |
|
639 iVideoPlayAgent->RemoveDisplayWindowL(iVideoCtl->ControlWindow()); |
|
640 iVideoPlayAgent->RemoveDisplay(iVideoCtl->ScreenNumber()); |
|
641 TRAP_IGNORE(iVideoPlayAgent->RemoveDisplayWindowL(iVideoCtl->Pip().ControlWindow())); |
|
642 iDisplayAdded = EFalse; |
|
643 } |
|
644 |
|
645 iVideoCtl = iAppView->iMainWindowControl; |
|
646 |
|
647 CCoeEnv* env = CCoeEnv::Static(); |
|
648 |
|
649 if (iScreenNumber > 0) |
|
650 { |
|
651 // Video ctls start at 0 in index for display 1 |
|
652 iVideoCtl = iVideoCtls[iScreenNumber - 1]; |
|
653 } |
|
654 |
|
655 TRect extent = iVideoExtentSet ? iVideoExtent : iVideoCtl->Rect(); |
|
656 TRect clip = iWindowClipRectSet ? iWindowClipRect : iVideoCtl->Rect(); |
|
657 iVideoPlayAgent->AddDisplayWindowL(env->WsSession(), *(env->ScreenDevice(iScreenNumber)), iVideoCtl->ControlWindow(), extent, clip); |
|
658 iDisplayAdded = ETrue; |
|
659 |
|
660 if (iPip) |
|
661 { |
|
662 // Picture-in-picture has been enabled. |
|
663 TSize videoFrameSize; |
|
664 iVideoPlayAgent->VideoFrameSizeL(videoFrameSize); |
|
665 TSize winSize = iVideoCtl->Size(); |
|
666 |
|
667 // Picture-in-picture should be an 8th of original |
|
668 videoFrameSize.iHeight /= 4; |
|
669 videoFrameSize.iWidth /= 4; |
|
670 |
|
671 TPoint pipLoc(winSize.iWidth - (videoFrameSize.iWidth + 4), 4); |
|
672 |
|
673 iVideoCtl->Pip().SetExtent(pipLoc, videoFrameSize); |
|
674 |
|
675 if (iCrp) |
|
676 { |
|
677 iVideoCtl->EnablePip(CMVSPipControl::EUseCrp); |
|
678 iVideoPlayAgent->AddDisplayL(env->WsSession(), iScreenNumber, iVideoCtl->Pip()); |
|
679 } |
|
680 else |
|
681 { |
|
682 iVideoCtl->EnablePip(CMVSPipControl::EUseMmf); |
|
683 iVideoPlayAgent->AddDisplayWindowL(env->WsSession(), *(env->ScreenDevice(iScreenNumber)), iVideoCtl->Pip().ControlWindow()); |
|
684 iVideoPlayAgent->SetAutoScaleL(iVideoCtl->Pip().ControlWindow(), EAutoScaleBestFit, EHorizontalAlignCenter, EVerticalAlignCenter); |
|
685 } |
|
686 } |
|
687 else |
|
688 { |
|
689 // Picture-in-picture has been disabled. |
|
690 iVideoCtl->DisablePip(); |
|
691 } |
|
692 } |
|
693 |
|
694 void CMVSAppUi::SetPosition(TTimeIntervalMicroSeconds& aPos) |
|
695 { |
|
696 if(iMode == EAudioPlay) |
|
697 { |
|
698 iAudioPlayAgent->SetPosition(aPos); |
|
699 } |
|
700 else if(iMode == EAudioRecord) |
|
701 { |
|
702 iAudioRecordAgent->SetPosition(aPos); |
|
703 } |
|
704 } |
|
705 |
|
706 //Opens a file for playing |
|
707 void CMVSAppUi::FileOpenL() |
|
708 { |
|
709 //Open the file dialog |
|
710 CEikFileOpenDialog* dialog = new (ELeave) CEikFileOpenDialog(&iSrcFName); |
|
711 TInt val = dialog->ExecuteLD(R_EIK_DIALOG_FILE_OPEN); |
|
712 if(val != 0) |
|
713 { |
|
714 TUid mediatype = iPluginInfo->GetMediaTypeL(iSrcFName); |
|
715 if(mediatype == KUidMediaTypeVideo) |
|
716 { |
|
717 TRect rect, clipRect; |
|
718 rect = clipRect = TRect(iAppView->iMainWindowControl->PositionRelativeToScreen(), iAppView->iMainWindowControl->Size()); |
|
719 |
|
720 rect.Shrink(2,2); |
|
721 clipRect.Shrink(2,2); |
|
722 |
|
723 // Clear the area where the video will be displayed |
|
724 #ifdef SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS |
|
725 iVideoPlayAgent->SetVideoOutputL(iCoeEnv->WsSession(), |
|
726 *iCoeEnv->ScreenDevice(iScreenNumber), |
|
727 iVideoCtl->ControlWindow(), |
|
728 rect, |
|
729 clipRect); |
|
730 #else |
|
731 iVideoPlayAgent->SetVideoOutputL(iCoeEnv->WsSession(), |
|
732 *iCoeEnv->ScreenDevice(), |
|
733 iVideoCtl->ControlWindow(), |
|
734 rect, |
|
735 clipRect); |
|
736 #endif // SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS |
|
737 |
|
738 TInt res = iVideoPlayAgent->SetScreenNumber(iScreenNumber); |
|
739 if(res == KErrNotSupported) |
|
740 { |
|
741 User::InfoPrint(KMultiScreenNotsupported); |
|
742 } |
|
743 //Enable AP&R for register notification made before opening the file |
|
744 if(iRegistered) |
|
745 { |
|
746 TInt regerr = iVideoPlayAgent->RegisterForNotification(); |
|
747 if(regerr == KErrNone) |
|
748 { |
|
749 User::InfoPrint(KRegisterSuccess); |
|
750 } |
|
751 else |
|
752 { |
|
753 User::InfoPrint(KRegisterFailure); |
|
754 } |
|
755 } |
|
756 else if(iAlreadyRegistered) |
|
757 { |
|
758 TInt cancelerr = iVideoPlayAgent->CancelNotification(); |
|
759 if(cancelerr == KErrNone) |
|
760 { |
|
761 iAlreadyRegistered = EFalse; |
|
762 User::InfoPrint(KRegisterCancelation); |
|
763 } |
|
764 else |
|
765 { |
|
766 User::InfoPrint(KCancelationFailure); |
|
767 } |
|
768 } |
|
769 iVideoPlayAgent->OpenFileL(iSrcFName); |
|
770 iMode = EVideoPlay; |
|
771 } |
|
772 else if(mediatype == KUidMediaTypeAudio) |
|
773 { |
|
774 iAudioPlayAgent->OpenFileL(iSrcFName); |
|
775 iMode = EAudioPlay; |
|
776 iButtons->DimCommand(EMVSCmdSetVolume,EFalse); |
|
777 iButtons->DrawNow(); |
|
778 } |
|
779 else |
|
780 { |
|
781 User::InfoPrint(KNotSupported); |
|
782 } |
|
783 } |
|
784 return; |
|
785 } |
|
786 |
|
787 //Opens a new or existing file to record. |
|
788 void CMVSAppUi::FileOpenForRecordL() |
|
789 { |
|
790 iExtArray->Reset(); |
|
791 iPluginArray->Reset(); |
|
792 iCodecArray->Reset(); |
|
793 iSelectedPluginIdx = KBeforeSelectingController; |
|
794 iSelectPluginsDialog->SetupDialogLD(iPluginArray,iExtArray, iCodecArray, this); |
|
795 //Indicates that the controller wasnt selected, leave it to the MMF to select |
|
796 //tha appropriate controller. |
|
797 if(iSelectedPluginIdx == KControllerNotSelected) |
|
798 { |
|
799 iControllerUid = TUid::Null(); |
|
800 } |
|
801 else |
|
802 { |
|
803 if(iMediaType) |
|
804 { |
|
805 iControllerUid = iVideoUidArray[iSelectedPluginIdx]; |
|
806 } |
|
807 else |
|
808 { |
|
809 iControllerUid = iAudioUidArray[iSelectedPluginIdx]; |
|
810 } |
|
811 } |
|
812 if(!iMediaType) |
|
813 { |
|
814 iMode = EAudioRecord; |
|
815 } |
|
816 else if(iMediaType) |
|
817 { |
|
818 iMode = EVideoRecord; |
|
819 } |
|
820 SaveAsDialogL(); |
|
821 } |
|
822 |
|
823 void CMVSAppUi::FileClose() |
|
824 { |
|
825 iButtons->DimCommand(EMVSCmdSetVolume, ETrue); |
|
826 iButtons->DimCommand(EMVSCmdRecord, ETrue); |
|
827 switch(iMode) |
|
828 { |
|
829 case EAudioPlay: |
|
830 { |
|
831 iAudioPlayAgent->Stop(); |
|
832 iLogger.Write(_L("AudioPlayAgent Close")); |
|
833 } |
|
834 break; |
|
835 |
|
836 case EAudioRecord: |
|
837 { |
|
838 iAudioRecordAgent->Stop(); |
|
839 iLogger.Write(_L("AudioRecordAgent Close")); |
|
840 } |
|
841 break; |
|
842 |
|
843 case EVideoPlay: |
|
844 { |
|
845 iVideoPlayAgent->Close(); |
|
846 iLogger.Write(_L("VideoPlayAgent Close")); |
|
847 iAppView->DrawNow(); |
|
848 } |
|
849 break; |
|
850 |
|
851 case EVideoRecord: |
|
852 { |
|
853 iVideoRecordAgent->Close(); |
|
854 iLogger.Write(_L("VideoRecordAgent Close")); |
|
855 } |
|
856 break; |
|
857 |
|
858 default: |
|
859 break; |
|
860 } |
|
861 Reset(); |
|
862 } |
|
863 |
|
864 |
|
865 void CMVSAppUi::SaveAsDialogL() |
|
866 { |
|
867 iFileReplace = ETrue; |
|
868 TInt errVal = iSaveAsDialog->SetupDialogLD(iDestFilename, &iFileReplace); |
|
869 if(errVal) |
|
870 { |
|
871 DetermineFinalFNameL(); |
|
872 if(iProceed) |
|
873 { |
|
874 iOpeningForRecord=ETrue; |
|
875 RFs fs = CCoeEnv::Static()->FsSession(); |
|
876 if(iMode==EAudioRecord) |
|
877 { |
|
878 TInt uidcount = iAudioPlayUidArray.Count(); |
|
879 TUid playcontrollerUid = TUid::Null(); |
|
880 if(uidcount) |
|
881 { |
|
882 playcontrollerUid = iAudioPlayUidArray[0]; |
|
883 } |
|
884 if(iFileReplace) |
|
885 { |
|
886 fs.Delete(iDestFilename); |
|
887 } |
|
888 iAudioRecordAgent->CreateNewFileL(iDestFilename,iControllerUid,playcontrollerUid); |
|
889 iLogger.Write(_L("Opened file for Audio Record")); |
|
890 iRecFName.Copy(iDestFilename); |
|
891 iButtons->DimCommand(EMVSCmdRecord, EFalse); |
|
892 iButtons->DrawNow(); |
|
893 } |
|
894 |
|
895 else if(iMode==EVideoRecord) |
|
896 { |
|
897 if(iFileReplace) |
|
898 { |
|
899 fs.Delete(iDestFilename); |
|
900 } |
|
901 TInt err = iVideoRecordAgent->OpenFileL(iDestFilename,iControllerUid); |
|
902 if(err != KErrNone) |
|
903 { |
|
904 iLogger.Write(_L("ECam Object creation failed")); |
|
905 User::InfoPrint(KVideoError); |
|
906 } |
|
907 else |
|
908 { |
|
909 iLogger.Write(_L("Opened file for Video Record")); |
|
910 iRecFName.Copy(iDestFilename); |
|
911 iButtons->DimCommand(EMVSCmdRecord, EFalse); |
|
912 iButtons->DrawNow(); |
|
913 } |
|
914 } |
|
915 } |
|
916 } |
|
917 else |
|
918 { |
|
919 iMode = EIdle; |
|
920 UpdateStateChange(ENotReady , KErrNone); |
|
921 } |
|
922 } |
|
923 |
|
924 //The state change calls from the agents |
|
925 void CMVSAppUi::UpdateStateChange(TMVSState aState, TInt aError) |
|
926 { |
|
927 TInt error = aError; |
|
928 //if state changes from EVideoRecording and view finder is running, stop it. |
|
929 if(iState == EVideoRecording && aState != EVideoRecording) |
|
930 { |
|
931 StopViewFinder(); |
|
932 } |
|
933 //if playback stops, redraw the app view |
|
934 if(iState == EVideoPlaying && aState != EVideoPlaying) |
|
935 { |
|
936 // the last frame is still on the display, but nothing is in charge |
|
937 // of redrawing it. this would otherwise lead to graphical glitches |
|
938 // as the frame is partially erased over time. |
|
939 iAppView->iMainWindowControl->DrawNow(); |
|
940 } |
|
941 iState=aState; |
|
942 if(error == KErrNone) |
|
943 { |
|
944 if(aState == EAudioOpened) |
|
945 { |
|
946 iAppView->ResetProgressBar(); |
|
947 iButtons->DimCommand(EMVSCmdPlay,EFalse); |
|
948 iButtons->DrawNow(); |
|
949 if(iMode == EAudioPlay) |
|
950 { |
|
951 iButtons->DimCommand(EMVSCmdRecord,ETrue); |
|
952 iDuration = iAudioPlayAgent->Duration(); |
|
953 if((iStart == 0) && (iEnd == 0)) |
|
954 { |
|
955 iStart = 0; |
|
956 iEnd = iDuration; |
|
957 } |
|
958 } |
|
959 if(iButtons->IsCommandDimmed(EMVSCmdSetRepeats)) |
|
960 { |
|
961 iButtons->DimCommand(EMVSCmdSetRepeats,EFalse); |
|
962 iButtons->DrawNow(); |
|
963 } |
|
964 if(iButtons->IsCommandDimmed(EMVSCmdSetPlayBalance)) |
|
965 { |
|
966 iButtons->DimCommand(EMVSCmdSetPlayBalance,EFalse); |
|
967 iButtons->DrawNow(); |
|
968 } |
|
969 //Provided to automatically start playing, when the play button is selected |
|
970 //without opening a file through the file menu. |
|
971 if(iAutoplay) |
|
972 { |
|
973 iAudioPlayAgent->Play(); |
|
974 iAutoplay=EFalse; |
|
975 } |
|
976 if(iMode == EAudioRecord && !iOpeningForRecord) |
|
977 { |
|
978 iButtons->DimCommand(EMVSCmdRecord,EFalse); |
|
979 iButtons->DimCommand(EMVSCmdPlay,EFalse); |
|
980 iButtons->DrawNow(); |
|
981 } |
|
982 //Pop the Audio Record Settings Dialogue |
|
983 if(iMode == EAudioRecord && iOpeningForRecord && iSelectedPluginIdx !=-2) |
|
984 { |
|
985 iButtons->DimCommand(EMVSCmdSetPlayBalance,EFalse); |
|
986 if(iButtons->IsCommandDimmed(EMVSCmdRecord)) |
|
987 { |
|
988 iButtons->DimCommand(EMVSCmdRecord,EFalse); |
|
989 iButtons->DrawNow(); |
|
990 } |
|
991 //if appending to an existing file no need to re-enter the controller configuration. |
|
992 if(iFileReplace) |
|
993 { |
|
994 if(!iMediaType && iSelectedPluginIdx !=-1) |
|
995 { |
|
996 TRAP(error, iConfigFormatDialog->SetupDialogLD(this,iAudioUidArray[iSelectedPluginIdx],iSettingManager) ); |
|
997 iOpeningForRecord = EFalse; |
|
998 } |
|
999 } |
|
1000 } |
|
1001 } |
|
1002 else if(aState == EAudioPlaying) |
|
1003 { |
|
1004 iButtons->DimCommand(EMVSCmdPlay, ETrue); |
|
1005 iButtons->DimCommand(EMVSCmdRecord,ETrue); |
|
1006 iButtons->DimCommand(EMVSCmdPause, EFalse); |
|
1007 iButtons->DimCommand(EMVSCmdStop, EFalse); |
|
1008 iButtons->DrawNow(); |
|
1009 } |
|
1010 else if(aState == ENotReady) |
|
1011 { |
|
1012 iButtons->DimCommand(EMVSCmdSetPlayBalance,EFalse); |
|
1013 iButtons->DimCommand(EMVSCmdSetVolume, ETrue); |
|
1014 iButtons->DimCommand(EMVSCmdRecord, ETrue); |
|
1015 iButtons->DimCommand(EMVSCmdPlay, EFalse); |
|
1016 iButtons->DrawNow(); |
|
1017 |
|
1018 // File has been closed. Remove the display window if it was added. |
|
1019 if (iDisplayAdded) |
|
1020 { |
|
1021 TRAP(error, iVideoPlayAgent->RemoveDisplayWindowL(iVideoCtl->ControlWindow())); |
|
1022 TRAP(error, iVideoPlayAgent->RemoveDisplayWindowL(iVideoCtl->Pip().ControlWindow())); |
|
1023 iVideoPlayAgent->RemoveDisplay(iVideoCtl->ScreenNumber()); |
|
1024 iVideoCtl->Pip().Clear(); |
|
1025 iDisplayAdded = EFalse; |
|
1026 } |
|
1027 } |
|
1028 else if(aState == EAudioOpening) |
|
1029 { |
|
1030 iButtons->DimCommand(EMVSCmdSetVolume,EFalse); |
|
1031 } |
|
1032 else if(aState == EAudioPaused) |
|
1033 { |
|
1034 iButtons->DimCommand(EMVSCmdPause, ETrue); |
|
1035 iButtons->DrawNow(); |
|
1036 } |
|
1037 else if(aState == EAudioStopped) |
|
1038 { |
|
1039 iAppView->ResetProgressBar(); |
|
1040 iButtons->DimCommand(EMVSCmdStop, ETrue); |
|
1041 iButtons->DimCommand(EMVSCmdPause, ETrue); |
|
1042 iButtons->DrawNow(); |
|
1043 } |
|
1044 else if(aState == EVideoPaused) |
|
1045 { |
|
1046 iButtons->DimCommand(EMVSCmdPause,ETrue); |
|
1047 iButtons->DrawNow(); |
|
1048 } |
|
1049 else if(aState == EVideoStopped) |
|
1050 { |
|
1051 iButtons->DimCommand(EMVSCmdStop,ETrue); |
|
1052 iButtons->DimCommand(EMVSCmdPause, ETrue); |
|
1053 iButtons->DrawNow(); |
|
1054 } |
|
1055 else if(aState == EVideoPlaying) |
|
1056 { |
|
1057 iButtons->DimCommand(EMVSCmdPlay, ETrue); |
|
1058 iButtons->DimCommand(EMVSCmdRecord,ETrue); |
|
1059 iButtons->DimCommand(EMVSCmdPause,ETrue); |
|
1060 iButtons->DimCommand(EMVSCmdStop,EFalse); |
|
1061 iButtons->DrawNow(); |
|
1062 } |
|
1063 else if(aState == EVideoRecording) |
|
1064 { |
|
1065 iButtons->DimCommand(EMVSCmdPlay, ETrue); |
|
1066 iButtons->DimCommand(EMVSCmdRecord, ETrue); |
|
1067 iButtons->DimCommand(EMVSCmdPause,EFalse); |
|
1068 iButtons->DimCommand(EMVSCmdSetRepeats,ETrue); |
|
1069 iButtons->DrawNow(); |
|
1070 } |
|
1071 |
|
1072 else if(aState == EAudioRecording) |
|
1073 { |
|
1074 iButtons->DimCommand(EMVSCmdPlay, ETrue); |
|
1075 iButtons->DimCommand(EMVSCmdRecord,ETrue); |
|
1076 iButtons->DimCommand(EMVSCmdPause,ETrue); |
|
1077 iButtons->DrawNow(); |
|
1078 } |
|
1079 else if(aState == EVideoOpened ) |
|
1080 { |
|
1081 //Pop the Video Record Settings Dialogue |
|
1082 iButtons->DimCommand(EMVSCmdPlay,EFalse); |
|
1083 iButtons->DimCommand(EMVSCmdPause,ETrue); |
|
1084 iButtons->DimCommand(EMVSCmdSetRepeats,ETrue); |
|
1085 iButtons->DrawNow(); |
|
1086 if(iButtons->IsCommandDimmed(EMVSCmdSetPlayBalance)) |
|
1087 { |
|
1088 iButtons->DimCommand(EMVSCmdSetPlayBalance,EFalse); |
|
1089 iButtons->DrawNow(); |
|
1090 } |
|
1091 if(iMode==EVideoRecord && iOpeningForRecord) |
|
1092 { |
|
1093 iButtons->DimCommand(EMVSCmdSetPlayBalance,ETrue); |
|
1094 if(iFileReplace) |
|
1095 { |
|
1096 if(iMediaType && iSelectedPluginIdx !=-1) |
|
1097 { |
|
1098 TRAP(error, iVideoFormatDialog->SetupDialogLD(this,iVideoUidArray[iSelectedPluginIdx],iSettingManager) ); |
|
1099 iOpeningForRecord=EFalse; |
|
1100 } |
|
1101 } |
|
1102 } |
|
1103 } |
|
1104 if(error != KErrNone) |
|
1105 { |
|
1106 LogErrors(error); |
|
1107 } |
|
1108 } |
|
1109 else if ((error == KErrEof) && (aState == EAudioStopped)) |
|
1110 { |
|
1111 iButtons->DimCommand(EMVSCmdPlay, EFalse); |
|
1112 iButtons->DimCommand(EMVSCmdRecord,ETrue); |
|
1113 iButtons->DimCommand(EMVSCmdPause,EFalse); |
|
1114 iButtons->DimCommand(EMVSCmdStop,EFalse); |
|
1115 iButtons->DrawNow(); |
|
1116 } |
|
1117 else |
|
1118 { |
|
1119 LogErrors(error); |
|
1120 } |
|
1121 |
|
1122 //As the state changes the display windows(views) contents also needs to be changed |
|
1123 TRAPD(err,UpdateDisplayL(iState)); |
|
1124 if(err) |
|
1125 { |
|
1126 LogErrors(err); |
|
1127 iState = ENotReady; |
|
1128 FileClose(); |
|
1129 } |
|
1130 } |
|
1131 |
|
1132 void CMVSAppUi::MvsResourceNotification(const TDesC8& /*aNotificationData*/) |
|
1133 { |
|
1134 if(iMode == EVideoPlay) |
|
1135 { |
|
1136 iVideoPlayAgent->Play(); |
|
1137 } |
|
1138 } |
|
1139 //Return the current mode of the App |
|
1140 void CMVSAppUi::Reset() |
|
1141 { |
|
1142 iMode =EIdle; |
|
1143 iState =ENotReady; |
|
1144 iBitRate = 0; |
|
1145 iSampleRate = 0; |
|
1146 iChannels =0; |
|
1147 iAutoplay = EFalse; |
|
1148 iStart = 0; |
|
1149 iEnd = 0; |
|
1150 iDuration = 0; |
|
1151 } |
|
1152 |
|
1153 |
|
1154 //GetCropStart() |
|
1155 TTimeIntervalMicroSeconds CMVSAppUi::GetCropStart() const |
|
1156 { |
|
1157 return iCropStart; |
|
1158 } |
|
1159 |
|
1160 |
|
1161 // Returns the cropping end-point in microseconds |
|
1162 TTimeIntervalMicroSeconds CMVSAppUi::GetCropEnd() const |
|
1163 { |
|
1164 return iCropEnd; |
|
1165 } |
|
1166 |
|
1167 //Volume setting |
|
1168 void CMVSAppUi::SetVolumeL(TInt aVolume, TTimeIntervalMicroSeconds aRamp) |
|
1169 { |
|
1170 //Initialise the volume settings based on the parameters |
|
1171 iVolumeOrGain = aVolume; |
|
1172 iRamp = aRamp; |
|
1173 switch(iMode) |
|
1174 { |
|
1175 case EAudioPlay: |
|
1176 { |
|
1177 //And set the maximum volume based on the device's audio capabilities |
|
1178 iMaxVolume = iAudioPlayAgent->MaxVolume(); |
|
1179 //Set the volume, and volume ramps. |
|
1180 iAudioPlayAgent->SetVolume((iVolumeOrGain*iMaxVolume)/100, iRamp); |
|
1181 } |
|
1182 break; |
|
1183 |
|
1184 case EAudioRecord: |
|
1185 { |
|
1186 //And set the maximum volume based on the device's audio capabilities |
|
1187 iMaxVolume = iAudioRecordAgent->MaxGain(); |
|
1188 //Set the volume, and volume ramps. |
|
1189 iAudioRecordAgent->SetGain((iVolumeOrGain*iMaxVolume)/100); |
|
1190 } |
|
1191 break; |
|
1192 |
|
1193 case EVideoPlay: |
|
1194 { |
|
1195 iMaxVolume = iVideoPlayAgent->MaxVolume(); |
|
1196 iVideoPlayAgent->SetVolumeL((iVolumeOrGain*iMaxVolume)/100); |
|
1197 } |
|
1198 break; |
|
1199 |
|
1200 case EVideoRecord: |
|
1201 { |
|
1202 iMaxVolume = iVideoRecordAgent->MaxGainL(); |
|
1203 iVideoRecordAgent->SetGainL((iVolumeOrGain*iMaxVolume)/100); |
|
1204 } |
|
1205 break; |
|
1206 |
|
1207 case EIdle: |
|
1208 break; |
|
1209 |
|
1210 default: |
|
1211 ASSERT(EFalse); |
|
1212 break; |
|
1213 } |
|
1214 } |
|
1215 |
|
1216 |
|
1217 //Set repeats |
|
1218 void CMVSAppUi::SetRepeats(TInt aNoRepeats, TTimeIntervalMicroSeconds aDelay) |
|
1219 { |
|
1220 //Initialise the repeat variables based on the parameters |
|
1221 iNoRepeats = aNoRepeats; |
|
1222 iRepeatDelay = aDelay; |
|
1223 switch(iMode) |
|
1224 { |
|
1225 case EAudioPlay: |
|
1226 //Set the repeat settings based on these values |
|
1227 iAudioPlayAgent->SetRepeats(iNoRepeats, iRepeatDelay); |
|
1228 break; |
|
1229 |
|
1230 case EAudioRecord: |
|
1231 //Set the repeat settings based on these values |
|
1232 iAudioRecordAgent->SetRepeats(iNoRepeats, iRepeatDelay); |
|
1233 break; |
|
1234 default: |
|
1235 break; |
|
1236 } |
|
1237 } |
|
1238 |
|
1239 //Balance settings |
|
1240 // |
|
1241 // |
|
1242 // |
|
1243 // Sets the balance, based on the argument. This value is translated to both |
|
1244 // the playback AND recording balance for the device. |
|
1245 // |
|
1246 void CMVSAppUi::SetBalanceL(TInt aBalance) |
|
1247 { |
|
1248 iBalance = aBalance; |
|
1249 switch(iMode) |
|
1250 { |
|
1251 case EAudioPlay: |
|
1252 iAudioPlayAgent->SetBalance(iBalance); |
|
1253 break; |
|
1254 |
|
1255 case EAudioRecord: |
|
1256 iAudioRecordAgent->SetRecordBalance(iBalance); |
|
1257 break; |
|
1258 |
|
1259 case EVideoPlay: |
|
1260 iVideoPlayAgent->SetBalanceL(iBalance); |
|
1261 break; |
|
1262 |
|
1263 case EVideoRecord: |
|
1264 User::InfoPrint(KNotsupported); |
|
1265 break; |
|
1266 |
|
1267 case EIdle: |
|
1268 break; |
|
1269 |
|
1270 default: |
|
1271 ASSERT(EFalse); |
|
1272 break; |
|
1273 |
|
1274 } |
|
1275 } |
|
1276 |
|
1277 |
|
1278 // |
|
1279 //SetPriorityL(...) |
|
1280 // |
|
1281 // Sets the audio priority, and the priority preference, based on the |
|
1282 // arguments. |
|
1283 // |
|
1284 void CMVSAppUi::SetPriorityL(TInt aPriority, |
|
1285 TMdaPriorityPreference aPriorityPreference) |
|
1286 { |
|
1287 iPriority = aPriority; |
|
1288 iPriorityPreference = aPriorityPreference; |
|
1289 switch(iMode) |
|
1290 { |
|
1291 case EAudioPlay: |
|
1292 iAudioPlayAgent->SetPriority(iPriority,iPriorityPreference); |
|
1293 break; |
|
1294 |
|
1295 case EVideoPlay: |
|
1296 iVideoPlayAgent->SetPriorityL(iPriority,iPriorityPreference); |
|
1297 break; |
|
1298 |
|
1299 case EAudioRecord: |
|
1300 iAudioRecordAgent->SetPriority(iPriority,iPriorityPreference); |
|
1301 break; |
|
1302 |
|
1303 case EVideoRecord: |
|
1304 iVideoRecordAgent->SetPriorityL(iPriority,iPriorityPreference); |
|
1305 break; |
|
1306 |
|
1307 case EIdle: |
|
1308 break; |
|
1309 |
|
1310 default: |
|
1311 ASSERT(EFalse); |
|
1312 break; |
|
1313 } |
|
1314 } |
|
1315 |
|
1316 |
|
1317 // |
|
1318 //SetPlayWindow(...) |
|
1319 // |
|
1320 // Sets the play window, based on the |
|
1321 // arguments. |
|
1322 // return value indicates if the operation is successful or not. |
|
1323 TBool CMVSAppUi::SetPlayWindow(TTimeIntervalMicroSeconds aStart, |
|
1324 TTimeIntervalMicroSeconds aEnd) |
|
1325 { |
|
1326 iStart = aStart; |
|
1327 iEnd = aEnd; |
|
1328 TInt err = iAudioPlayAgent->SetPlayWindow(iStart,iEnd); |
|
1329 if(err != KErrNone) |
|
1330 { |
|
1331 LogErrors(err); |
|
1332 iStart = 0; |
|
1333 iEnd = iDuration; |
|
1334 return EFalse; |
|
1335 } |
|
1336 else |
|
1337 { |
|
1338 return ETrue; |
|
1339 } |
|
1340 } |
|
1341 |
|
1342 |
|
1343 // |
|
1344 //SetMetaDataL(...) |
|
1345 // |
|
1346 // Sets the MetaData, based on the arguments |
|
1347 // |
|
1348 void CMVSAppUi::SetMetaDataL(RPointerArray<CMMFMetaDataEntry> aMetaArray) |
|
1349 { |
|
1350 switch(iMode) |
|
1351 { |
|
1352 case EAudioRecord: |
|
1353 iAudioRecordAgent->SetMetaDataL(aMetaArray); |
|
1354 break; |
|
1355 |
|
1356 case EVideoRecord: |
|
1357 iVideoRecordAgent->SetMetaDataL(aMetaArray); |
|
1358 break; |
|
1359 default: |
|
1360 ASSERT(EFalse); |
|
1361 break; |
|
1362 } |
|
1363 |
|
1364 } |
|
1365 |
|
1366 |
|
1367 // |
|
1368 //GetMetaDataL(...) |
|
1369 // |
|
1370 // Sets the MetaData, based on the arguments |
|
1371 // |
|
1372 void CMVSAppUi::GetMetaDataL(RPointerArray<CMMFMetaDataEntry>& aMetaArray) |
|
1373 { |
|
1374 switch(iMode) |
|
1375 { |
|
1376 case EAudioPlay: |
|
1377 iAudioPlayAgent->GetMetaArrayL(aMetaArray); |
|
1378 break; |
|
1379 |
|
1380 case EVideoPlay: |
|
1381 iVideoPlayAgent->GetMetaDataArrayL(aMetaArray); |
|
1382 break; |
|
1383 default: |
|
1384 ASSERT(EFalse); |
|
1385 break; |
|
1386 } |
|
1387 |
|
1388 } |
|
1389 |
|
1390 |
|
1391 |
|
1392 // |
|
1393 //SetCrop(...) |
|
1394 // |
|
1395 // Sets the crop window, and also whether to crop from begining |
|
1396 // or end, based on the arguments passed |
|
1397 // |
|
1398 void CMVSAppUi::SetCropL(TTimeIntervalMicroSeconds aCropStart,TBool aCropFromBeginning) |
|
1399 { |
|
1400 iAudioRecordAgent->CropClipL(aCropStart,aCropFromBeginning); |
|
1401 iCropStart=aCropStart; |
|
1402 iCropFromBeginning=aCropFromBeginning; |
|
1403 } |
|
1404 |
|
1405 |
|
1406 void CMVSAppUi::SetBitRateL(TUint aBitRate) |
|
1407 { |
|
1408 TRAPD(err,iAudioRecordAgent->SetDestinationBitRateL(aBitRate)); |
|
1409 if(err != KErrNone) |
|
1410 { |
|
1411 iLogger.Write(_L("SetDestinationBitRateL returned err")); |
|
1412 } |
|
1413 else |
|
1414 { |
|
1415 iBitRate = aBitRate; |
|
1416 } |
|
1417 } |
|
1418 |
|
1419 |
|
1420 void CMVSAppUi::SetSampleRateL(TUint aSampleRate) |
|
1421 { |
|
1422 iAudioRecordAgent->SetDestinationSampleRateL(aSampleRate); |
|
1423 iSampleRate = aSampleRate; |
|
1424 } |
|
1425 |
|
1426 void CMVSAppUi::SetChannelsL(TUint aNumberOfChannels) |
|
1427 { |
|
1428 iAudioRecordAgent->SetDestinationNumberOfChannelsL(aNumberOfChannels); |
|
1429 iChannels = aNumberOfChannels; |
|
1430 } |
|
1431 |
|
1432 void CMVSAppUi::SetCodecsL(TFourCC aDataType) |
|
1433 { |
|
1434 iAudioRecordAgent->SetDestinationDataTypeL(aDataType); |
|
1435 } |
|
1436 |
|
1437 |
|
1438 |
|
1439 void CMVSAppUi::InitializeMetaArrayL() |
|
1440 { |
|
1441 //Reset the meta array |
|
1442 iMetaArray.Reset(); |
|
1443 if(iMetaTitle != NULL) |
|
1444 { |
|
1445 iMetaArray.AppendL(iMetaTitle); |
|
1446 } |
|
1447 |
|
1448 if(iMetaAuthor != NULL) |
|
1449 { |
|
1450 iMetaArray.AppendL(iMetaAuthor); |
|
1451 } |
|
1452 |
|
1453 if(iMetaCopyright != NULL) |
|
1454 { |
|
1455 iMetaArray.AppendL(iMetaCopyright); |
|
1456 } |
|
1457 |
|
1458 if(iMetaRevision != NULL) |
|
1459 { |
|
1460 iMetaArray.AppendL(iMetaRevision); |
|
1461 } |
|
1462 |
|
1463 if(iMetaCategory != NULL) |
|
1464 { |
|
1465 iMetaArray.AppendL(iMetaCategory); |
|
1466 } |
|
1467 |
|
1468 if(iMetaComments != NULL) |
|
1469 { |
|
1470 iMetaArray.AppendL(iMetaComments); |
|
1471 } |
|
1472 } |
|
1473 |
|
1474 // |
|
1475 //DynInitMenuPaneL(...) *** This method can LEAVE *** |
|
1476 // |
|
1477 // Initialises the availibility of controls on the menu bar depending on the |
|
1478 // current state of the MVSApp. This allows the application to |
|
1479 // constrain the availibility of controls which are inappropriate in certain |
|
1480 // states. |
|
1481 // |
|
1482 |
|
1483 void CMVSAppUi::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane) |
|
1484 { |
|
1485 switch(iMode) |
|
1486 { |
|
1487 case (EAudioRecord): |
|
1488 //File menu |
|
1489 if(aResourceId == R_MVS_FILE_MENU) |
|
1490 { |
|
1491 aMenuPane->SetItemDimmed(EMVSCmdNew,ETrue); |
|
1492 aMenuPane->SetItemDimmed(EMVSCmdOpen,ETrue); |
|
1493 aMenuPane->SetItemDimmed(EMVSCmdClose,EFalse); |
|
1494 aMenuPane->SetItemDimmed(EMVSCmdSystemInfo,EFalse); |
|
1495 aMenuPane->SetItemDimmed(EMVSCmdExit,EFalse); |
|
1496 } |
|
1497 |
|
1498 //Edit Menu |
|
1499 if(aResourceId == R_MVS_EDIT_MENU) |
|
1500 { |
|
1501 aMenuPane->SetItemDimmed(EMVSCmdSetCropWindow,EFalse); |
|
1502 aMenuPane->SetItemDimmed(EMVSCmdSetPlayWindow,ETrue); |
|
1503 aMenuPane->SetItemDimmed(EMVSCmdClearPlayWindow,ETrue); |
|
1504 } |
|
1505 |
|
1506 //Settings menu > |
|
1507 if(aResourceId == R_MVS_SETTINGS_MENU) |
|
1508 { |
|
1509 aMenuPane->SetItemDimmed(EMVSCmdAudioSetting,EFalse); |
|
1510 aMenuPane->SetItemDimmed(EMVSVideoCmdSettings,ETrue); |
|
1511 aMenuPane->SetItemDimmed(EMVSCmdEditMetadata,EFalse); |
|
1512 aMenuPane->SetItemDimmed(EMVSCmdClearLog,ETrue); |
|
1513 #ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT |
|
1514 aMenuPane->SetItemDimmed(EMVSCmdEnableSubtitles, ETrue); |
|
1515 aMenuPane->SetItemDimmed(EMVSCmdDisableSubtitles, ETrue); |
|
1516 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT |
|
1517 } |
|
1518 |
|
1519 if(iState == EAudioRecording) |
|
1520 { |
|
1521 //Controls menu |
|
1522 if(aResourceId == R_MVS_CONTROLS_MENU) |
|
1523 { |
|
1524 aMenuPane->SetItemDimmed(EMVSCmdPlay,ETrue); |
|
1525 aMenuPane->SetItemDimmed(EMVSCmdPause,ETrue); |
|
1526 aMenuPane->SetItemDimmed(EMVSCmdStop,EFalse); |
|
1527 aMenuPane->SetItemDimmed(EMVSCmdRewind,ETrue); |
|
1528 aMenuPane->SetItemDimmed(EMVSCmdFastForward,ETrue); |
|
1529 aMenuPane->SetItemDimmed(EMVSCmdRecord,ETrue); |
|
1530 } |
|
1531 } |
|
1532 else |
|
1533 { |
|
1534 if(aResourceId == R_MVS_CONTROLS_MENU) |
|
1535 { |
|
1536 aMenuPane->SetItemDimmed(EMVSCmdPlay,ETrue); |
|
1537 aMenuPane->SetItemDimmed(EMVSCmdPause,ETrue); |
|
1538 aMenuPane->SetItemDimmed(EMVSCmdStop,ETrue); |
|
1539 aMenuPane->SetItemDimmed(EMVSCmdRewind,ETrue); |
|
1540 aMenuPane->SetItemDimmed(EMVSCmdFastForward,ETrue); |
|
1541 aMenuPane->SetItemDimmed(EMVSCmdRecord,EFalse); |
|
1542 } |
|
1543 } |
|
1544 break; |
|
1545 |
|
1546 |
|
1547 case (EVideoRecord): |
|
1548 //File menu |
|
1549 if(aResourceId == R_MVS_FILE_MENU) |
|
1550 { |
|
1551 aMenuPane->SetItemDimmed(EMVSCmdNew,ETrue); |
|
1552 aMenuPane->SetItemDimmed(EMVSCmdOpen,ETrue); |
|
1553 aMenuPane->SetItemDimmed(EMVSCmdClose,EFalse); |
|
1554 aMenuPane->SetItemDimmed(EMVSCmdSystemInfo,EFalse); |
|
1555 aMenuPane->SetItemDimmed(EMVSCmdExit,EFalse); |
|
1556 } |
|
1557 |
|
1558 //Edit Menu |
|
1559 if(aResourceId == R_MVS_EDIT_MENU) |
|
1560 { |
|
1561 aMenuPane->SetItemDimmed(EMVSCmdSetCropWindow,ETrue); |
|
1562 aMenuPane->SetItemDimmed(EMVSCmdSetPlayWindow,ETrue); |
|
1563 aMenuPane->SetItemDimmed(EMVSCmdClearPlayWindow,ETrue); |
|
1564 } |
|
1565 |
|
1566 //Settings menu > |
|
1567 if(aResourceId == R_MVS_SETTINGS_MENU) |
|
1568 { |
|
1569 aMenuPane->SetItemDimmed(EMVSCmdAudioSetting,ETrue); |
|
1570 aMenuPane->SetItemDimmed(EMVSVideoCmdSettings,ETrue); |
|
1571 aMenuPane->SetItemDimmed(EMVSCmdEditMetadata,EFalse); |
|
1572 aMenuPane->SetItemDimmed(EMVSCmdClearLog,ETrue); |
|
1573 #ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT |
|
1574 aMenuPane->SetItemDimmed(EMVSCmdEnableSubtitles, ETrue); |
|
1575 aMenuPane->SetItemDimmed(EMVSCmdDisableSubtitles, ETrue); |
|
1576 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT |
|
1577 } |
|
1578 |
|
1579 if(iState == EVideoRecording) |
|
1580 { |
|
1581 //File menu |
|
1582 if(aResourceId == R_MVS_FILE_MENU) |
|
1583 { |
|
1584 aMenuPane->SetItemDimmed(EMVSCmdNew,ETrue); |
|
1585 aMenuPane->SetItemDimmed(EMVSCmdOpen,ETrue); |
|
1586 aMenuPane->SetItemDimmed(EMVSCmdClose,EFalse); |
|
1587 aMenuPane->SetItemDimmed(EMVSCmdSystemInfo,EFalse); |
|
1588 aMenuPane->SetItemDimmed(EMVSCmdExit,EFalse); |
|
1589 } |
|
1590 |
|
1591 //Controls menu |
|
1592 if(aResourceId == R_MVS_CONTROLS_MENU) |
|
1593 { |
|
1594 aMenuPane->SetItemDimmed(EMVSCmdPlay,ETrue); |
|
1595 aMenuPane->SetItemDimmed(EMVSCmdPause,ETrue); |
|
1596 aMenuPane->SetItemDimmed(EMVSCmdStop,EFalse); |
|
1597 aMenuPane->SetItemDimmed(EMVSCmdRewind,ETrue); |
|
1598 aMenuPane->SetItemDimmed(EMVSCmdFastForward,ETrue); |
|
1599 aMenuPane->SetItemDimmed(EMVSCmdRecord,ETrue); |
|
1600 } |
|
1601 } |
|
1602 else |
|
1603 { |
|
1604 if(aResourceId == R_MVS_CONTROLS_MENU) |
|
1605 { |
|
1606 aMenuPane->SetItemDimmed(EMVSCmdPlay,ETrue); |
|
1607 aMenuPane->SetItemDimmed(EMVSCmdPause,ETrue); |
|
1608 aMenuPane->SetItemDimmed(EMVSCmdStop,ETrue); |
|
1609 aMenuPane->SetItemDimmed(EMVSCmdRewind,ETrue); |
|
1610 aMenuPane->SetItemDimmed(EMVSCmdFastForward,ETrue); |
|
1611 aMenuPane->SetItemDimmed(EMVSCmdRecord,EFalse); |
|
1612 } |
|
1613 } |
|
1614 if(iState == EVideoOpened) |
|
1615 { |
|
1616 //File menu |
|
1617 if(aResourceId == R_MVS_FILE_MENU) |
|
1618 { |
|
1619 aMenuPane->SetItemDimmed(EMVSCmdNew,ETrue); |
|
1620 aMenuPane->SetItemDimmed(EMVSCmdOpen,ETrue); |
|
1621 aMenuPane->SetItemDimmed(EMVSCmdClose,EFalse); |
|
1622 aMenuPane->SetItemDimmed(EMVSCmdSystemInfo,EFalse); |
|
1623 aMenuPane->SetItemDimmed(EMVSCmdExit,EFalse); |
|
1624 } |
|
1625 } |
|
1626 if(iState == EVideoStopped) |
|
1627 { |
|
1628 //File menu |
|
1629 if(aResourceId == R_MVS_FILE_MENU) |
|
1630 { |
|
1631 aMenuPane->SetItemDimmed(EMVSCmdNew,ETrue); |
|
1632 aMenuPane->SetItemDimmed(EMVSCmdOpen,ETrue); |
|
1633 aMenuPane->SetItemDimmed(EMVSCmdClose,EFalse); |
|
1634 aMenuPane->SetItemDimmed(EMVSCmdSystemInfo,EFalse); |
|
1635 aMenuPane->SetItemDimmed(EMVSCmdExit,EFalse); |
|
1636 } |
|
1637 } |
|
1638 break; |
|
1639 |
|
1640 case (EAudioPlay): |
|
1641 |
|
1642 if(iState == EAudioOpened) |
|
1643 { |
|
1644 //File menu |
|
1645 if(aResourceId == R_MVS_FILE_MENU) |
|
1646 { |
|
1647 aMenuPane->SetItemDimmed(EMVSCmdNew,ETrue); |
|
1648 aMenuPane->SetItemDimmed(EMVSCmdOpen,EFalse); |
|
1649 aMenuPane->SetItemDimmed(EMVSCmdClose,EFalse); |
|
1650 aMenuPane->SetItemDimmed(EMVSCmdSystemInfo,EFalse); |
|
1651 aMenuPane->SetItemDimmed(EMVSCmdExit,EFalse); |
|
1652 } |
|
1653 |
|
1654 //Edit Menu |
|
1655 if(aResourceId == R_MVS_EDIT_MENU) |
|
1656 { |
|
1657 aMenuPane->SetItemDimmed(EMVSCmdSetCropWindow,ETrue); |
|
1658 aMenuPane->SetItemDimmed(EMVSCmdSetPlayWindow,EFalse); |
|
1659 aMenuPane->SetItemDimmed(EMVSCmdClearPlayWindow,EFalse); |
|
1660 } |
|
1661 |
|
1662 //Settings menu |
|
1663 if(aResourceId == R_MVS_SETTINGS_MENU) |
|
1664 { |
|
1665 aMenuPane->SetItemDimmed(EMVSCmdAudioSetting,EFalse); |
|
1666 aMenuPane->SetItemDimmed(EMVSVideoCmdSettings,ETrue); |
|
1667 //aMenuPane->SetItemDimmed(EMVSCmdEditMetadata,ETrue); |
|
1668 aMenuPane->SetItemDimmed(EMVSCmdClearLog,EFalse); |
|
1669 #ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT |
|
1670 aMenuPane->SetItemDimmed(EMVSCmdEnableSubtitles, ETrue); |
|
1671 aMenuPane->SetItemDimmed(EMVSCmdDisableSubtitles, ETrue); |
|
1672 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT |
|
1673 } |
|
1674 |
|
1675 //Controls menu |
|
1676 if(aResourceId == R_MVS_CONTROLS_MENU) |
|
1677 { |
|
1678 aMenuPane->SetItemDimmed(EMVSCmdPlay,EFalse); |
|
1679 aMenuPane->SetItemDimmed(EMVSCmdPause,ETrue); |
|
1680 aMenuPane->SetItemDimmed(EMVSCmdStop,ETrue); |
|
1681 aMenuPane->SetItemDimmed(EMVSCmdRewind,ETrue); |
|
1682 aMenuPane->SetItemDimmed(EMVSCmdFastForward,ETrue); |
|
1683 aMenuPane->SetItemDimmed(EMVSCmdRecord,ETrue); |
|
1684 } |
|
1685 } |
|
1686 |
|
1687 else if(iState == EAudioPlaying) |
|
1688 { |
|
1689 //File menu |
|
1690 if(aResourceId == R_MVS_FILE_MENU) |
|
1691 { |
|
1692 aMenuPane->SetItemDimmed(EMVSCmdNew,ETrue); |
|
1693 aMenuPane->SetItemDimmed(EMVSCmdOpen,ETrue); |
|
1694 aMenuPane->SetItemDimmed(EMVSCmdClose,EFalse); |
|
1695 aMenuPane->SetItemDimmed(EMVSCmdSystemInfo,EFalse); |
|
1696 aMenuPane->SetItemDimmed(EMVSCmdExit,EFalse); |
|
1697 } |
|
1698 |
|
1699 //Edit Menu |
|
1700 if(aResourceId == R_MVS_EDIT_MENU) |
|
1701 { |
|
1702 aMenuPane->SetItemDimmed(EMVSCmdSetCropWindow,ETrue); |
|
1703 aMenuPane->SetItemDimmed(EMVSCmdSetPlayWindow,ETrue); |
|
1704 aMenuPane->SetItemDimmed(EMVSCmdClearPlayWindow,ETrue); |
|
1705 } |
|
1706 |
|
1707 //Settings menu |
|
1708 if(aResourceId == R_MVS_SETTINGS_MENU) |
|
1709 { |
|
1710 aMenuPane->SetItemDimmed(EMVSCmdAudioSetting,ETrue); |
|
1711 aMenuPane->SetItemDimmed(EMVSVideoCmdSettings,ETrue); |
|
1712 aMenuPane->SetItemDimmed(EMVSCmdEditMetadata,ETrue); |
|
1713 aMenuPane->SetItemDimmed(EMVSCmdClearLog,EFalse); |
|
1714 #ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT |
|
1715 aMenuPane->SetItemDimmed(EMVSCmdEnableSubtitles, ETrue); |
|
1716 aMenuPane->SetItemDimmed(EMVSCmdDisableSubtitles, ETrue); |
|
1717 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT |
|
1718 } |
|
1719 |
|
1720 //Controls menu |
|
1721 if(aResourceId == R_MVS_CONTROLS_MENU) |
|
1722 { |
|
1723 aMenuPane->SetItemDimmed(EMVSCmdPlay,ETrue); |
|
1724 aMenuPane->SetItemDimmed(EMVSCmdPause,EFalse); |
|
1725 aMenuPane->SetItemDimmed(EMVSCmdStop,EFalse); |
|
1726 aMenuPane->SetItemDimmed(EMVSCmdRewind,ETrue); |
|
1727 aMenuPane->SetItemDimmed(EMVSCmdFastForward,ETrue); |
|
1728 aMenuPane->SetItemDimmed(EMVSCmdRecord,ETrue); |
|
1729 } |
|
1730 } |
|
1731 |
|
1732 else if(iState == EAudioPaused) |
|
1733 { |
|
1734 //File menu |
|
1735 if(aResourceId == R_MVS_FILE_MENU) |
|
1736 { |
|
1737 aMenuPane->SetItemDimmed(EMVSCmdNew,ETrue); |
|
1738 aMenuPane->SetItemDimmed(EMVSCmdOpen,EFalse); |
|
1739 aMenuPane->SetItemDimmed(EMVSCmdClose,EFalse); |
|
1740 aMenuPane->SetItemDimmed(EMVSCmdSystemInfo,EFalse); |
|
1741 aMenuPane->SetItemDimmed(EMVSCmdExit,EFalse); |
|
1742 } |
|
1743 |
|
1744 //Edit Menu |
|
1745 if(aResourceId == R_MVS_EDIT_MENU) |
|
1746 { |
|
1747 aMenuPane->SetItemDimmed(EMVSCmdSetCropWindow,ETrue); |
|
1748 aMenuPane->SetItemDimmed(EMVSCmdSetPlayWindow,EFalse); |
|
1749 aMenuPane->SetItemDimmed(EMVSCmdClearPlayWindow,EFalse); |
|
1750 } |
|
1751 |
|
1752 //Settings menu |
|
1753 if(aResourceId == R_MVS_SETTINGS_MENU) |
|
1754 { |
|
1755 aMenuPane->SetItemDimmed(EMVSCmdAudioSetting,EFalse); |
|
1756 aMenuPane->SetItemDimmed(EMVSVideoCmdSettings,ETrue); |
|
1757 aMenuPane->SetItemDimmed(EMVSCmdEditMetadata,ETrue); |
|
1758 aMenuPane->SetItemDimmed(EMVSCmdClearLog,EFalse); |
|
1759 #ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT |
|
1760 aMenuPane->SetItemDimmed(EMVSCmdEnableSubtitles, ETrue); |
|
1761 aMenuPane->SetItemDimmed(EMVSCmdDisableSubtitles, ETrue); |
|
1762 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT |
|
1763 } |
|
1764 |
|
1765 //Controls menu |
|
1766 if(aResourceId == R_MVS_CONTROLS_MENU) |
|
1767 { |
|
1768 aMenuPane->SetItemDimmed(EMVSCmdPlay,EFalse); |
|
1769 aMenuPane->SetItemDimmed(EMVSCmdPause,ETrue); |
|
1770 aMenuPane->SetItemDimmed(EMVSCmdStop,EFalse); |
|
1771 aMenuPane->SetItemDimmed(EMVSCmdRewind,ETrue); |
|
1772 aMenuPane->SetItemDimmed(EMVSCmdFastForward,ETrue); |
|
1773 aMenuPane->SetItemDimmed(EMVSCmdRecord,ETrue); |
|
1774 } |
|
1775 } |
|
1776 else if(iState == EAudioStopped) |
|
1777 { |
|
1778 //File menu |
|
1779 if(aResourceId == R_MVS_FILE_MENU) |
|
1780 { |
|
1781 aMenuPane->SetItemDimmed(EMVSCmdNew,ETrue); |
|
1782 aMenuPane->SetItemDimmed(EMVSCmdOpen,EFalse); |
|
1783 aMenuPane->SetItemDimmed(EMVSCmdClose,EFalse); |
|
1784 aMenuPane->SetItemDimmed(EMVSCmdSystemInfo,EFalse); |
|
1785 aMenuPane->SetItemDimmed(EMVSCmdExit,EFalse); |
|
1786 } |
|
1787 |
|
1788 //Edit Menu |
|
1789 if(aResourceId == R_MVS_EDIT_MENU) |
|
1790 { |
|
1791 aMenuPane->SetItemDimmed(EMVSCmdSetCropWindow,ETrue); |
|
1792 aMenuPane->SetItemDimmed(EMVSCmdSetPlayWindow,EFalse); |
|
1793 aMenuPane->SetItemDimmed(EMVSCmdClearPlayWindow,EFalse); |
|
1794 } |
|
1795 |
|
1796 //Settings menu |
|
1797 if(aResourceId == R_MVS_SETTINGS_MENU) |
|
1798 { |
|
1799 aMenuPane->SetItemDimmed(EMVSCmdAudioSetting,EFalse); |
|
1800 aMenuPane->SetItemDimmed(EMVSVideoCmdSettings,ETrue); |
|
1801 aMenuPane->SetItemDimmed(EMVSCmdEditMetadata,ETrue); |
|
1802 aMenuPane->SetItemDimmed(EMVSCmdClearLog,EFalse); |
|
1803 #ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT |
|
1804 aMenuPane->SetItemDimmed(EMVSCmdEnableSubtitles, ETrue); |
|
1805 aMenuPane->SetItemDimmed(EMVSCmdDisableSubtitles, ETrue); |
|
1806 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT |
|
1807 } |
|
1808 |
|
1809 //Controls menu |
|
1810 if(aResourceId == R_MVS_CONTROLS_MENU) |
|
1811 { |
|
1812 aMenuPane->SetItemDimmed(EMVSCmdPlay,EFalse); |
|
1813 aMenuPane->SetItemDimmed(EMVSCmdPause,ETrue); |
|
1814 aMenuPane->SetItemDimmed(EMVSCmdStop,ETrue); |
|
1815 aMenuPane->SetItemDimmed(EMVSCmdRewind,ETrue); |
|
1816 aMenuPane->SetItemDimmed(EMVSCmdFastForward,ETrue); |
|
1817 aMenuPane->SetItemDimmed(EMVSCmdRecord,ETrue); |
|
1818 } |
|
1819 } |
|
1820 break; |
|
1821 |
|
1822 case (EVideoPlay): |
|
1823 if(iState == EVideoOpened) |
|
1824 { |
|
1825 //File menu |
|
1826 if(aResourceId == R_MVS_FILE_MENU) |
|
1827 { |
|
1828 aMenuPane->SetItemDimmed(EMVSCmdNew,ETrue); |
|
1829 aMenuPane->SetItemDimmed(EMVSCmdOpen,ETrue); |
|
1830 aMenuPane->SetItemDimmed(EMVSCmdClose,EFalse); |
|
1831 aMenuPane->SetItemDimmed(EMVSCmdSystemInfo,EFalse); |
|
1832 aMenuPane->SetItemDimmed(EMVSCmdExit,EFalse); |
|
1833 } |
|
1834 |
|
1835 //Edit Menu |
|
1836 if(aResourceId == R_MVS_EDIT_MENU) |
|
1837 { |
|
1838 aMenuPane->SetItemDimmed(EMVSCmdSetCropWindow,ETrue); |
|
1839 aMenuPane->SetItemDimmed(EMVSCmdSetPlayWindow,ETrue); |
|
1840 aMenuPane->SetItemDimmed(EMVSCmdClearPlayWindow,ETrue); |
|
1841 } |
|
1842 |
|
1843 //Settings menu |
|
1844 if(aResourceId == R_MVS_SETTINGS_MENU) |
|
1845 { |
|
1846 aMenuPane->SetItemDimmed(EMVSCmdAudioSetting,ETrue); |
|
1847 aMenuPane->SetItemDimmed(EMVSVideoCmdSettings,EFalse); |
|
1848 aMenuPane->SetItemDimmed(EMVSCmdEditMetadata,ETrue); |
|
1849 aMenuPane->SetItemDimmed(EMVSCmdMultiScreen,EFalse); |
|
1850 aMenuPane->SetItemDimmed(EMVSCmdClearLog,EFalse); |
|
1851 #ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT |
|
1852 TBool subAvail = iVideoPlayAgent->SubtitlesAvailable(); |
|
1853 aMenuPane->SetItemDimmed(EMVSCmdEnableSubtitles, !subAvail); |
|
1854 aMenuPane->SetItemDimmed(EMVSCmdDisableSubtitles, !subAvail); |
|
1855 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT |
|
1856 } |
|
1857 |
|
1858 //Controls menu |
|
1859 if(aResourceId == R_MVS_CONTROLS_MENU) |
|
1860 { |
|
1861 aMenuPane->SetItemDimmed(EMVSCmdPlay,EFalse); |
|
1862 aMenuPane->SetItemDimmed(EMVSCmdPause,ETrue); |
|
1863 aMenuPane->SetItemDimmed(EMVSCmdStop,ETrue); |
|
1864 aMenuPane->SetItemDimmed(EMVSCmdRewind,ETrue); |
|
1865 aMenuPane->SetItemDimmed(EMVSCmdFastForward,ETrue); |
|
1866 aMenuPane->SetItemDimmed(EMVSCmdRecord,ETrue); |
|
1867 } |
|
1868 } |
|
1869 |
|
1870 else if(iState == EVideoPlaying) |
|
1871 { |
|
1872 //File menu |
|
1873 if(aResourceId == R_MVS_FILE_MENU) |
|
1874 { |
|
1875 aMenuPane->SetItemDimmed(EMVSCmdNew,ETrue); |
|
1876 aMenuPane->SetItemDimmed(EMVSCmdOpen,ETrue); |
|
1877 aMenuPane->SetItemDimmed(EMVSCmdClose,EFalse); |
|
1878 aMenuPane->SetItemDimmed(EMVSCmdSystemInfo,ETrue); |
|
1879 aMenuPane->SetItemDimmed(EMVSCmdExit,EFalse); |
|
1880 } |
|
1881 |
|
1882 //Edit Menu |
|
1883 if(aResourceId == R_MVS_EDIT_MENU) |
|
1884 { |
|
1885 aMenuPane->SetItemDimmed(EMVSCmdSetCropWindow,ETrue); |
|
1886 aMenuPane->SetItemDimmed(EMVSCmdSetPlayWindow,ETrue); |
|
1887 aMenuPane->SetItemDimmed(EMVSCmdClearPlayWindow,ETrue); |
|
1888 } |
|
1889 |
|
1890 //Settings menu |
|
1891 if(aResourceId == R_MVS_SETTINGS_MENU) |
|
1892 { |
|
1893 aMenuPane->SetItemDimmed(EMVSCmdAudioSetting,ETrue); |
|
1894 aMenuPane->SetItemDimmed(EMVSVideoCmdSettings,EFalse); |
|
1895 aMenuPane->SetItemDimmed(EMVSCmdEditMetadata,ETrue); |
|
1896 aMenuPane->SetItemDimmed(EMVSCmdClearLog,EFalse); |
|
1897 #ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT |
|
1898 TBool subAvail = iVideoPlayAgent->SubtitlesAvailable(); |
|
1899 aMenuPane->SetItemDimmed(EMVSCmdEnableSubtitles, !subAvail); |
|
1900 aMenuPane->SetItemDimmed(EMVSCmdDisableSubtitles, !subAvail); |
|
1901 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT |
|
1902 } |
|
1903 |
|
1904 //Controls menu |
|
1905 if(aResourceId == R_MVS_CONTROLS_MENU) |
|
1906 { |
|
1907 aMenuPane->SetItemDimmed(EMVSCmdPlay,ETrue); |
|
1908 aMenuPane->SetItemDimmed(EMVSCmdPause,ETrue); |
|
1909 aMenuPane->SetItemDimmed(EMVSCmdStop,EFalse); |
|
1910 aMenuPane->SetItemDimmed(EMVSCmdRewind,ETrue); |
|
1911 aMenuPane->SetItemDimmed(EMVSCmdFastForward,ETrue); |
|
1912 aMenuPane->SetItemDimmed(EMVSCmdRecord,ETrue); |
|
1913 } |
|
1914 } |
|
1915 else if(iState == EVideoPaused) |
|
1916 { |
|
1917 //File menu |
|
1918 if(aResourceId == R_MVS_FILE_MENU) |
|
1919 { |
|
1920 aMenuPane->SetItemDimmed(EMVSCmdNew,ETrue); |
|
1921 aMenuPane->SetItemDimmed(EMVSCmdOpen,EFalse); |
|
1922 aMenuPane->SetItemDimmed(EMVSCmdClose,EFalse); |
|
1923 aMenuPane->SetItemDimmed(EMVSCmdSystemInfo,EFalse); |
|
1924 aMenuPane->SetItemDimmed(EMVSCmdExit,EFalse); |
|
1925 } |
|
1926 |
|
1927 //Edit Menu |
|
1928 if(aResourceId == R_MVS_EDIT_MENU) |
|
1929 { |
|
1930 aMenuPane->SetItemDimmed(EMVSCmdSetCropWindow,ETrue); |
|
1931 aMenuPane->SetItemDimmed(EMVSCmdSetPlayWindow,ETrue); |
|
1932 aMenuPane->SetItemDimmed(EMVSCmdClearPlayWindow,ETrue); |
|
1933 } |
|
1934 |
|
1935 //Settings menu |
|
1936 if(aResourceId == R_MVS_SETTINGS_MENU) |
|
1937 { |
|
1938 aMenuPane->SetItemDimmed(EMVSCmdAudioSetting,ETrue); |
|
1939 aMenuPane->SetItemDimmed(EMVSVideoCmdSettings,EFalse); |
|
1940 aMenuPane->SetItemDimmed(EMVSCmdEditMetadata,ETrue); |
|
1941 aMenuPane->SetItemDimmed(EMVSCmdClearLog,EFalse); |
|
1942 #ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT |
|
1943 TBool subAvail = iVideoPlayAgent->SubtitlesAvailable(); |
|
1944 aMenuPane->SetItemDimmed(EMVSCmdEnableSubtitles, !subAvail); |
|
1945 aMenuPane->SetItemDimmed(EMVSCmdDisableSubtitles, !subAvail); |
|
1946 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT |
|
1947 } |
|
1948 |
|
1949 //Controls menu |
|
1950 if(aResourceId == R_MVS_CONTROLS_MENU) |
|
1951 { |
|
1952 aMenuPane->SetItemDimmed(EMVSCmdPlay,EFalse); |
|
1953 aMenuPane->SetItemDimmed(EMVSCmdPause,ETrue); |
|
1954 aMenuPane->SetItemDimmed(EMVSCmdStop,EFalse); |
|
1955 aMenuPane->SetItemDimmed(EMVSCmdRewind,ETrue); |
|
1956 aMenuPane->SetItemDimmed(EMVSCmdFastForward,ETrue); |
|
1957 aMenuPane->SetItemDimmed(EMVSCmdRecord,ETrue); |
|
1958 } |
|
1959 } |
|
1960 else if(iState == EVideoStopped) |
|
1961 { |
|
1962 //File menu |
|
1963 if(aResourceId == R_MVS_FILE_MENU) |
|
1964 { |
|
1965 aMenuPane->SetItemDimmed(EMVSCmdNew,ETrue); |
|
1966 aMenuPane->SetItemDimmed(EMVSCmdOpen,EFalse); |
|
1967 aMenuPane->SetItemDimmed(EMVSCmdClose,EFalse); |
|
1968 aMenuPane->SetItemDimmed(EMVSCmdSystemInfo,EFalse); |
|
1969 aMenuPane->SetItemDimmed(EMVSCmdExit,EFalse); |
|
1970 } |
|
1971 |
|
1972 //Edit Menu |
|
1973 if(aResourceId == R_MVS_EDIT_MENU) |
|
1974 { |
|
1975 aMenuPane->SetItemDimmed(EMVSCmdSetCropWindow,ETrue); |
|
1976 aMenuPane->SetItemDimmed(EMVSCmdSetPlayWindow,ETrue); |
|
1977 aMenuPane->SetItemDimmed(EMVSCmdClearPlayWindow,ETrue); |
|
1978 } |
|
1979 |
|
1980 //Settings menu |
|
1981 if(aResourceId == R_MVS_SETTINGS_MENU) |
|
1982 { |
|
1983 aMenuPane->SetItemDimmed(EMVSCmdAudioSetting,ETrue); |
|
1984 aMenuPane->SetItemDimmed(EMVSVideoCmdSettings,EFalse); |
|
1985 aMenuPane->SetItemDimmed(EMVSCmdEditMetadata,ETrue); |
|
1986 aMenuPane->SetItemDimmed(EMVSCmdClearLog,EFalse); |
|
1987 #ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT |
|
1988 TBool subAvail = iVideoPlayAgent->SubtitlesAvailable(); |
|
1989 aMenuPane->SetItemDimmed(EMVSCmdEnableSubtitles, !subAvail); |
|
1990 aMenuPane->SetItemDimmed(EMVSCmdDisableSubtitles, !subAvail); |
|
1991 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT |
|
1992 } |
|
1993 |
|
1994 //Controls menu |
|
1995 if(aResourceId == R_MVS_CONTROLS_MENU) |
|
1996 { |
|
1997 aMenuPane->SetItemDimmed(EMVSCmdPlay,EFalse); |
|
1998 aMenuPane->SetItemDimmed(EMVSCmdPause,ETrue); |
|
1999 aMenuPane->SetItemDimmed(EMVSCmdStop,ETrue); |
|
2000 aMenuPane->SetItemDimmed(EMVSCmdRewind,ETrue); |
|
2001 aMenuPane->SetItemDimmed(EMVSCmdFastForward,ETrue); |
|
2002 aMenuPane->SetItemDimmed(EMVSCmdRecord,ETrue); |
|
2003 } |
|
2004 } |
|
2005 break; |
|
2006 |
|
2007 case (EIdle): |
|
2008 //File menu |
|
2009 if(aResourceId == R_MVS_FILE_MENU) |
|
2010 { |
|
2011 aMenuPane->SetItemDimmed(EMVSCmdNew,EFalse); |
|
2012 aMenuPane->SetItemDimmed(EMVSCmdOpen,EFalse); |
|
2013 aMenuPane->SetItemDimmed(EMVSCmdClose,ETrue); |
|
2014 aMenuPane->SetItemDimmed(EMVSCmdSystemInfo,EFalse); |
|
2015 aMenuPane->SetItemDimmed(EMVSCmdExit,EFalse); |
|
2016 } |
|
2017 |
|
2018 //Edit Menu |
|
2019 if(aResourceId == R_MVS_EDIT_MENU) |
|
2020 { |
|
2021 aMenuPane->SetItemDimmed(EMVSCmdSetCropWindow,ETrue); |
|
2022 aMenuPane->SetItemDimmed(EMVSCmdSetPlayWindow,ETrue); |
|
2023 aMenuPane->SetItemDimmed(EMVSCmdClearPlayWindow,ETrue); |
|
2024 } |
|
2025 |
|
2026 //Settings menu > |
|
2027 if(aResourceId == R_MVS_SETTINGS_MENU) |
|
2028 { |
|
2029 aMenuPane->SetItemDimmed(EMVSCmdAudioSetting,ETrue); |
|
2030 aMenuPane->SetItemDimmed(EMVSVideoCmdSettings,ETrue); |
|
2031 aMenuPane->SetItemDimmed(EMVSCmdEditMetadata,ETrue); |
|
2032 aMenuPane->SetItemDimmed(EMVSCmdMultiScreen,EFalse); |
|
2033 aMenuPane->SetItemDimmed(EMVSCmdClearLog,EFalse); |
|
2034 #ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT |
|
2035 aMenuPane->SetItemDimmed(EMVSCmdEnableSubtitles, ETrue); |
|
2036 aMenuPane->SetItemDimmed(EMVSCmdDisableSubtitles, ETrue); |
|
2037 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT |
|
2038 } |
|
2039 |
|
2040 //Controls menu |
|
2041 if(aResourceId == R_MVS_CONTROLS_MENU) |
|
2042 { |
|
2043 aMenuPane->SetItemDimmed(EMVSCmdPlay,ETrue); |
|
2044 aMenuPane->SetItemDimmed(EMVSCmdPause,ETrue); |
|
2045 aMenuPane->SetItemDimmed(EMVSCmdStop,ETrue); |
|
2046 aMenuPane->SetItemDimmed(EMVSCmdRewind,ETrue); |
|
2047 aMenuPane->SetItemDimmed(EMVSCmdFastForward,ETrue); |
|
2048 aMenuPane->SetItemDimmed(EMVSCmdRecord,ETrue); |
|
2049 } |
|
2050 break; |
|
2051 |
|
2052 default: |
|
2053 ASSERT(EFalse); |
|
2054 break; |
|
2055 } |
|
2056 } |
|
2057 |
|
2058 |
|
2059 void CMVSAppUi::InternalizeL(RReadStream& aStream) |
|
2060 { |
|
2061 iVolumeOrGain = aStream.ReadInt32L(); |
|
2062 iBalance = aStream.ReadInt32L(); |
|
2063 iNoRepeats = aStream.ReadInt32L(); |
|
2064 iRepeatDelay = aStream.ReadReal64L(); |
|
2065 } |
|
2066 |
|
2067 void CMVSAppUi::ExternalizeL(RWriteStream& aStream) |
|
2068 { |
|
2069 aStream.WriteInt32L(iVolumeOrGain); |
|
2070 aStream.WriteInt32L(iBalance); |
|
2071 aStream.WriteInt32L(iNoRepeats); |
|
2072 aStream.WriteReal64L(iRepeatDelay.Int64()); |
|
2073 } |
|
2074 |
|
2075 //Returns the selected controller plugin from the UI |
|
2076 void CMVSAppUi::SelectedPluginIdx(TInt aIdx) |
|
2077 { |
|
2078 iSelectedPluginIdx = aIdx; |
|
2079 } |
|
2080 |
|
2081 //Returns the selected Extension from the UI |
|
2082 void CMVSAppUi::SelectedExtension(TDesC16& aDes) |
|
2083 { |
|
2084 iControllerExt = aDes; |
|
2085 } |
|
2086 |
|
2087 |
|
2088 TInt CMVSAppUi::GetExtensionListL(CDesCArrayFlat* aExtArray, |
|
2089 TBool aMediaType) |
|
2090 { |
|
2091 return iPluginInfo->GetExtensionListL(aMediaType,aExtArray); |
|
2092 } |
|
2093 |
|
2094 |
|
2095 TInt CMVSAppUi::GetPluginListL(TInt8 aExtIdx,CDesCArrayFlat* aExtArray,CDesCArrayFlat* aPluginArray,TBool aMediaType) |
|
2096 { |
|
2097 iControllerExt.Copy(aExtArray->operator[](aExtIdx)); |
|
2098 iAudioUidArray.Reset(); |
|
2099 iAudioPlayUidArray.Reset(); |
|
2100 iVideoUidArray.Reset(); |
|
2101 if(!aMediaType) |
|
2102 { |
|
2103 return iPluginInfo->GetAudioPluginListL(aPluginArray,iAudioUidArray,iAudioPlayUidArray,&iControllerExt); |
|
2104 } |
|
2105 else |
|
2106 { |
|
2107 return iPluginInfo->GetVideoPluginListL(aPluginArray,iVideoUidArray,&iControllerExt); |
|
2108 } |
|
2109 } |
|
2110 |
|
2111 TInt CMVSAppUi::GetSystemInfoL(CDesCArrayFlat* aPluginArray) |
|
2112 { |
|
2113 return iPluginInfo->GetPluginListL(aPluginArray,iUidArray); |
|
2114 } |
|
2115 |
|
2116 //Returnd the selected media type, ie Audio or Video |
|
2117 void CMVSAppUi::SelectedMedia(TBool aMediaType) |
|
2118 { |
|
2119 iMediaType = aMediaType; |
|
2120 } |
|
2121 |
|
2122 |
|
2123 void CMVSAppUi::GetSupportedBitRatesL(RArray <TUint>& aBitRateArray) |
|
2124 { |
|
2125 iAudioRecordAgent->GetSupportedBitRatesArrayL(aBitRateArray); |
|
2126 } |
|
2127 |
|
2128 void CMVSAppUi::GetSupportedSampleRatesArrayL(RArray<TUint>& aSampleRatesArray) |
|
2129 { |
|
2130 iAudioRecordAgent->GetSupportedSampleRatesArrayL(aSampleRatesArray); |
|
2131 } |
|
2132 |
|
2133 void CMVSAppUi::GetSupportedNoChannelsArrayL(RArray<TUint>& aNoChannelsArray) |
|
2134 { |
|
2135 iAudioRecordAgent->GetSupportedNoChannelsArrayL(aNoChannelsArray); |
|
2136 } |
|
2137 |
|
2138 void CMVSAppUi::GetSupportedCodecsArrayL(RArray<TFourCC>& aCodecsArray) |
|
2139 { |
|
2140 iAudioRecordAgent->GetSupportedCodecsArrayL(aCodecsArray); |
|
2141 } |
|
2142 |
|
2143 void CMVSAppUi::GetSupportedFrameRatesL(RArray <TReal32>& aFrameRateArray) |
|
2144 { |
|
2145 iVideoRecordAgent->GetSupportedFrameRatesArrayL(aFrameRateArray); |
|
2146 } |
|
2147 |
|
2148 void CMVSAppUi::GetSupportedFrameSizeArrayL(RArray <TSize>& aFrameSizeArray) |
|
2149 { |
|
2150 iVideoRecordAgent->GetSupportedFrameSizesArrayL(aFrameSizeArray); |
|
2151 } |
|
2152 |
|
2153 void CMVSAppUi::SetVideoFrameRateL(TReal32 aFrameRate) |
|
2154 { |
|
2155 TRAPD(err,iVideoRecordAgent->SetVideoFrameRateL(aFrameRate)); |
|
2156 if(err != KErrNone) |
|
2157 { |
|
2158 iLogger.Write(_L("SetVideoFrameRateL returned err")); |
|
2159 } |
|
2160 else |
|
2161 { |
|
2162 iVideoFrameRate = aFrameRate; |
|
2163 } |
|
2164 } |
|
2165 |
|
2166 void CMVSAppUi::SetVideoFrameSizeL(TSize aFrameSize) |
|
2167 { |
|
2168 TRAPD(err,iVideoRecordAgent->SetVideoFrameSizeL(aFrameSize)); |
|
2169 if(err != KErrNone) |
|
2170 { |
|
2171 iLogger.Write(_L("SetVideoFrameRateL returned err")); |
|
2172 } |
|
2173 else |
|
2174 { |
|
2175 iFrameSize = aFrameSize; |
|
2176 } |
|
2177 } |
|
2178 |
|
2179 void CMVSAppUi::SetAudioEnabledL(TBool aAudioEnabled) |
|
2180 { |
|
2181 iAudioEnabled = aAudioEnabled; |
|
2182 iVideoRecordAgent->SetAudioEnabledL(iAudioEnabled); |
|
2183 iLogger.Write(_L("Audio Enabled for Video")); |
|
2184 } |
|
2185 |
|
2186 void CMVSAppUi::GetSupportedVideoTypesL(CDesC8ArrayFlat& aMimeArray) |
|
2187 { |
|
2188 iVideoRecordAgent->GetSupportedVideoTypesL(aMimeArray); |
|
2189 } |
|
2190 |
|
2191 void CMVSAppUi::SetVideoTypeL(const TDesC8 &aType) |
|
2192 { |
|
2193 iVideoRecordAgent->SetVideoTypeL(aType); |
|
2194 } |
|
2195 |
|
2196 void CMVSAppUi::WriteAudioDataL(CMVSConfigAudioFormatDialog* aAudioFormatDlg, |
|
2197 const TUid& aUid) |
|
2198 { |
|
2199 iSettingManager->WriteAudioDataL(aAudioFormatDlg,aUid); |
|
2200 } |
|
2201 |
|
2202 void CMVSAppUi::WriteVideoDataL(CMVSConfigVideoFormatDialog* aVideoFormatDlg, |
|
2203 const TUid& aUid) |
|
2204 { |
|
2205 iSettingManager->WriteVideoDataL(aVideoFormatDlg,aUid); |
|
2206 } |
|
2207 |
|
2208 TReal32 CMVSAppUi::GetVideoFrameRateL() |
|
2209 { |
|
2210 if(iMode == EVideoRecord) |
|
2211 { |
|
2212 iVideoFrameRate=iVideoRecordAgent->VideoFrameRateL(); |
|
2213 } |
|
2214 else if(iMode == EVideoPlay) |
|
2215 { |
|
2216 iVideoFrameRate=iVideoPlayAgent->VideoFrameRateL(); |
|
2217 } |
|
2218 return iVideoFrameRate; |
|
2219 } |
|
2220 |
|
2221 TVideoRotation CMVSAppUi::GetRotationL() |
|
2222 { |
|
2223 iVideoRotation = iVideoPlayAgent->RotationL(); |
|
2224 return iVideoRotation; |
|
2225 } |
|
2226 |
|
2227 void CMVSAppUi::SetRotationL(TVideoRotation aRotation) |
|
2228 { |
|
2229 TRAPD(err, iVideoPlayAgent->SetRotationL(aRotation)); |
|
2230 if (err == KErrNotSupported) |
|
2231 { |
|
2232 User::InfoPrint(KNotsupported); |
|
2233 iLogger.Write(_L("Error,This feature not supported by the controller")); |
|
2234 } |
|
2235 else if (err == KErrNotReady) |
|
2236 { |
|
2237 iLogger.Write(_L("Error, Videoplayer not yet created in the agent")); |
|
2238 } |
|
2239 else |
|
2240 { |
|
2241 iRotation = aRotation; |
|
2242 } |
|
2243 } |
|
2244 |
|
2245 void CMVSAppUi::GetScaleFactorL(TReal32& aScaleWidth, TReal32& aScaleHeight, TBool& aAntiAliasFiltering) |
|
2246 { |
|
2247 TRAPD(err, iVideoPlayAgent->GetScaleFactorL(aScaleWidth, aScaleHeight, aAntiAliasFiltering)); |
|
2248 if (err == KErrNotSupported) |
|
2249 { |
|
2250 User::InfoPrint(KNotsupported); |
|
2251 } |
|
2252 else if (err == KErrNotReady) |
|
2253 { |
|
2254 iLogger.Write(_L("Error, Videoplayer not yet created in the agent")); |
|
2255 } |
|
2256 } |
|
2257 |
|
2258 void CMVSAppUi::SetScaleFactorL(TReal32 aScaleWidth,TReal32 aScaleHeight,TBool aAntiAliasFiltering) |
|
2259 { |
|
2260 TRAPD(err, iVideoPlayAgent->SetScaleFactorL(aScaleWidth,aScaleHeight,aAntiAliasFiltering)); |
|
2261 if (err == KErrNotSupported) |
|
2262 { |
|
2263 User::InfoPrint(KNotsupported); |
|
2264 } |
|
2265 else if (err == KErrNotReady) |
|
2266 { |
|
2267 iLogger.Write(_L("Error, Videoplayer not yet created in the agent")); |
|
2268 } |
|
2269 } |
|
2270 |
|
2271 void CMVSAppUi::SetCropRegionL(const TRect& aCropRegion) |
|
2272 { |
|
2273 TRAPD(err, iVideoPlayAgent->SetCropRegionL(aCropRegion)); |
|
2274 if (err == KErrNotSupported) |
|
2275 { |
|
2276 User::InfoPrint(KNotsupported); |
|
2277 } |
|
2278 else if (err == KErrNotReady) |
|
2279 { |
|
2280 iLogger.Write(_L("Error, Videoplayer not yet created in the agent")); |
|
2281 } |
|
2282 } |
|
2283 |
|
2284 void CMVSAppUi::GetCropRegionL(TRect& aCropRegion) |
|
2285 { |
|
2286 TRAPD(err, iVideoPlayAgent->GetCropRegionL(aCropRegion)); |
|
2287 if (err == KErrNotSupported) |
|
2288 { |
|
2289 User::InfoPrint(KNotsupported); |
|
2290 } |
|
2291 else if (err == KErrNotReady) |
|
2292 { |
|
2293 iLogger.Write(_L("Error, Videoplayer not yet created in the agent")); |
|
2294 } |
|
2295 } |
|
2296 |
|
2297 void CMVSAppUi::SetVideoExtent(const TRect& aVideoExtent) |
|
2298 { |
|
2299 TRAPD(err, iVideoPlayAgent->SetVideoExtentL(aVideoExtent)); |
|
2300 if (err != KErrNone) |
|
2301 { |
|
2302 TBuf<50> text; |
|
2303 text.AppendFormat(_L("SetVideoExtentL - %d"), err); |
|
2304 User::InfoPrint(text); |
|
2305 return; |
|
2306 } |
|
2307 iVideoExtentSet = ETrue; |
|
2308 iVideoExtent = aVideoExtent; |
|
2309 } |
|
2310 |
|
2311 void CMVSAppUi::SetWindowClippingRect(const TRect& aWindowClipRect) |
|
2312 { |
|
2313 TRAPD(err, iVideoPlayAgent->SetWindowClipRectL(aWindowClipRect)); |
|
2314 if (err != KErrNone) |
|
2315 { |
|
2316 TBuf<50> text; |
|
2317 text.AppendFormat(_L("SetWindowClippingRectL - %d"), err); |
|
2318 User::InfoPrint(text); |
|
2319 return; |
|
2320 } |
|
2321 |
|
2322 iWindowClipRectSet = ETrue; |
|
2323 iWindowClipRect = aWindowClipRect; |
|
2324 } |
|
2325 |
|
2326 void CMVSAppUi::SetOverlayTextL(const TDesC& aOverlayText) |
|
2327 { |
|
2328 iOverlayText.Close(); |
|
2329 iOverlayText.CreateL(aOverlayText); |
|
2330 |
|
2331 iAppView->iMainWindowControl->SetOverlayTextL(aOverlayText); |
|
2332 } |
|
2333 |
|
2334 const TDesC& CMVSAppUi::OverlayText() const |
|
2335 { |
|
2336 return iOverlayText; |
|
2337 } |
|
2338 |
|
2339 void CMVSAppUi::SetAutoScaleL(TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos) |
|
2340 { |
|
2341 iVideoPlayAgent->SetAutoScaleL(aScaleType, aHorizPos, aVertPos); |
|
2342 iAutoScaleType = aScaleType; |
|
2343 iAutoScaleHorizPos = aHorizPos; |
|
2344 iAutoScaleVertPos = aVertPos; |
|
2345 } |
|
2346 |
|
2347 void CMVSAppUi::GetAutoScale(TAutoScaleType& aScaleType, TInt& aHorizPos, TInt& aVertPos) |
|
2348 { |
|
2349 aScaleType = iAutoScaleType; |
|
2350 aHorizPos = iAutoScaleHorizPos; |
|
2351 aVertPos = iAutoScaleVertPos; |
|
2352 } |
|
2353 |
|
2354 void CMVSAppUi::SetOutputScreen(TInt aScreenNumber) |
|
2355 { |
|
2356 iScreenNumber = aScreenNumber; |
|
2357 } |
|
2358 |
|
2359 void CMVSAppUi::RegisterForNotification(TBool aRegistered) |
|
2360 { |
|
2361 if(iRegistered) |
|
2362 { |
|
2363 iAlreadyRegistered = ETrue; |
|
2364 } |
|
2365 iRegistered = aRegistered; |
|
2366 if(iMode == EVideoPlay) |
|
2367 { |
|
2368 if(iRegistered && iAlreadyRegistered == EFalse) |
|
2369 { |
|
2370 TInt regerr = iVideoPlayAgent->RegisterForNotification(); |
|
2371 if(regerr == KErrNone) |
|
2372 { |
|
2373 User::InfoPrint(KRegisterSuccess); |
|
2374 } |
|
2375 else |
|
2376 { |
|
2377 User::InfoPrint(KRegisterFailure); |
|
2378 } |
|
2379 } |
|
2380 else if(iAlreadyRegistered && iRegistered == EFalse) |
|
2381 { |
|
2382 TInt cancelerr = iVideoPlayAgent->CancelNotification(); |
|
2383 if(cancelerr == KErrNone) |
|
2384 { |
|
2385 iAlreadyRegistered = EFalse; |
|
2386 User::InfoPrint(KRegisterCancelation); |
|
2387 } |
|
2388 else |
|
2389 { |
|
2390 User::InfoPrint(KCancelationFailure); |
|
2391 } |
|
2392 } |
|
2393 } |
|
2394 else if(iMode == EAudioPlay && iRegistered) |
|
2395 { |
|
2396 } |
|
2397 } |
|
2398 |
|
2399 void CMVSAppUi::SetPip(TBool aPip) |
|
2400 { |
|
2401 iPip = aPip; |
|
2402 } |
|
2403 |
|
2404 void CMVSAppUi::SetCrp(TBool aCrp) |
|
2405 { |
|
2406 iCrp = aCrp; |
|
2407 } |
|
2408 /* |
|
2409 UpdteDisplay(....) |
|
2410 Used to populate all the view windows,based |
|
2411 on the arguments passed this includes updating the time bar,the file name |
|
2412 and the state of the app. |
|
2413 */ |
|
2414 void CMVSAppUi::UpdateDisplayL(TMVSState aState) |
|
2415 { |
|
2416 TBuf<KTimeValueLength> disTime; |
|
2417 TFileName disFName; |
|
2418 TBuf<32> disState; |
|
2419 disTime.Append(iDisplayTime); |
|
2420 disFName.Append(iDisplayFName); |
|
2421 disState.Append(iDisplayState); |
|
2422 |
|
2423 iDisplayFName.Zero(); |
|
2424 iDisplayState.Zero(); |
|
2425 iDisplayTime.Zero(); |
|
2426 |
|
2427 switch(aState) |
|
2428 { |
|
2429 case(ENotReady): |
|
2430 iCoeEnv->ReadResourceL(iDisplayFName, R_NOFILE); |
|
2431 iCoeEnv->ReadResourceL(iDisplayState, R_IDLE); |
|
2432 iCoeEnv->ReadResourceL(iDisplayTime, R_ZEROTIME); |
|
2433 break; |
|
2434 case(EAudioOpened): |
|
2435 case(EVideoOpened): |
|
2436 if(iMode == EAudioPlay || iMode == EVideoPlay) |
|
2437 { |
|
2438 iDisplayFName.Append(iSrcFName); |
|
2439 } |
|
2440 if(iMode == EAudioRecord || iMode == EVideoRecord) |
|
2441 { |
|
2442 iDisplayFName.Append(iRecFName); |
|
2443 } |
|
2444 iCoeEnv->ReadResourceL(iDisplayState, R_OPEN); |
|
2445 break; |
|
2446 |
|
2447 case(EAudioStopped): |
|
2448 case(EVideoStopped): |
|
2449 if(iMode == EAudioPlay || iMode == EVideoPlay) |
|
2450 { |
|
2451 iDisplayFName.Append(iSrcFName); |
|
2452 } |
|
2453 if(iMode == EAudioRecord || iMode == EVideoRecord) |
|
2454 { |
|
2455 iDisplayFName.Append(iRecFName); |
|
2456 } |
|
2457 iCoeEnv->ReadResourceL(iDisplayState, R_READY); |
|
2458 break; |
|
2459 |
|
2460 case(EAudioPlaying): |
|
2461 case(EVideoPlaying): |
|
2462 if(iMode == EAudioPlay || iMode == EVideoPlay) |
|
2463 { |
|
2464 iDisplayFName.Append(iSrcFName); |
|
2465 } |
|
2466 if(iMode == EAudioRecord || iMode == EVideoRecord) |
|
2467 { |
|
2468 iDisplayFName.Append(iRecFName); |
|
2469 } |
|
2470 iCoeEnv->ReadResourceL(iDisplayState, R_PLAYING); |
|
2471 break; |
|
2472 |
|
2473 case(EAudioRecording): |
|
2474 iDisplayFName.Append(iRecFName); |
|
2475 iCoeEnv->ReadResourceL(iDisplayState, R_RECORDING); |
|
2476 ConvertTimeToDes(iAudioRecordAgent->Position(), iDisplayTime); |
|
2477 break; |
|
2478 |
|
2479 case(EVideoRecording): |
|
2480 iDisplayFName.Append(iRecFName); |
|
2481 iCoeEnv->ReadResourceL(iDisplayState, R_RECORDING); |
|
2482 ConvertTimeToDes(iVideoRecordAgent->DurationL(), iDisplayTime); |
|
2483 break; |
|
2484 |
|
2485 case(EAudioPaused): |
|
2486 case(EVideoPaused): |
|
2487 if(iMode == EAudioPlay || iMode == EVideoPlay) |
|
2488 { |
|
2489 iDisplayFName.Append(iSrcFName); |
|
2490 } |
|
2491 if(iMode == EAudioRecord || iMode == EVideoRecord) |
|
2492 { |
|
2493 iDisplayFName.Append(iRecFName); |
|
2494 } |
|
2495 iCoeEnv->ReadResourceL(iDisplayState, R_PAUSED); |
|
2496 break; |
|
2497 |
|
2498 default: |
|
2499 iCoeEnv->ReadResourceL(iDisplayFName, R_NOFILE); |
|
2500 iCoeEnv->ReadResourceL(iDisplayState, R_IDLE); |
|
2501 iCoeEnv->ReadResourceL(iDisplayTime, R_ZEROTIME); |
|
2502 break; |
|
2503 } |
|
2504 |
|
2505 if (iMode == EVideoPlay) |
|
2506 { |
|
2507 if (aState != EVideoPlaying && iVideoPlayAgent->SupportVideoPlayerUtility2() && iDisplayAdded) |
|
2508 { |
|
2509 iVideoCtl->Pip().Clear(); |
|
2510 PrepareVideoControlsL(); |
|
2511 } |
|
2512 } |
|
2513 |
|
2514 PopulateInfoWindowDataL(aState); |
|
2515 |
|
2516 if(disFName.CompareF(iDisplayFName) != 0) |
|
2517 { |
|
2518 iAppView->iStatusWindowFNameControl->SetTextL(iDisplayFName); |
|
2519 iAppView->iStatusWindowFNameControl->DrawNow(); |
|
2520 } |
|
2521 if(disTime.CompareF(iDisplayTime) != 0) |
|
2522 { |
|
2523 iAppView->iStatusWindowTimeControl->SetTextL(iDisplayTime); |
|
2524 iAppView->iStatusWindowTimeControl->DrawNow(); |
|
2525 } |
|
2526 if(disState.CompareF(iDisplayState) != 0) |
|
2527 { |
|
2528 iAppView->iStatusWindowStateControl->SetTextL(iDisplayState); |
|
2529 iAppView->iStatusWindowStateControl->DrawNow(); |
|
2530 } |
|
2531 |
|
2532 TBuf<256> dollarDes; |
|
2533 BuildDollarDesFromArrayL(dollarDes); |
|
2534 if(iDollarDes.CompareF(dollarDes) != 0) |
|
2535 { |
|
2536 iDollarDes.Zero(); |
|
2537 iDollarDes.Append(dollarDes); |
|
2538 iAppView->iInfoWindowControl->SetTextL(dollarDes); |
|
2539 iAppView->iInfoWindowControl->DrawNow(); |
|
2540 } |
|
2541 } |
|
2542 |
|
2543 |
|
2544 |
|
2545 // |
|
2546 //PopulateMainWindowData(...) ***TRAPPED ERRORS*** |
|
2547 // |
|
2548 // Adds data to the array used to hold playback or recording data |
|
2549 // such as the volume, cropping window and balance. This is then used to |
|
2550 // build a $$-separated descriptor which is sent to the view to be |
|
2551 // displayed as lines of text within the main window. |
|
2552 // |
|
2553 void CMVSAppUi::PopulateInfoWindowDataL(TMVSState aState) |
|
2554 { |
|
2555 TInt balance; |
|
2556 TBuf<256> infoBuf; |
|
2557 TBuf<75> welcome; |
|
2558 iCoeEnv->ReadResourceL(welcome, R_WELCOME); |
|
2559 |
|
2560 TBuf<32> format; |
|
2561 iCoeEnv->ReadResourceL(format, R_FORMAT); |
|
2562 |
|
2563 TBuf<10> left; |
|
2564 iCoeEnv->ReadResourceL(left, R_LEFT); |
|
2565 |
|
2566 TBuf<10> right; |
|
2567 iCoeEnv->ReadResourceL(right, R_RIGHT); |
|
2568 |
|
2569 TBuf<1> close; |
|
2570 iCoeEnv->ReadResourceL(close, R_CLOSE); |
|
2571 |
|
2572 TBuf<56> noCrop; |
|
2573 iCoeEnv->ReadResourceL(noCrop, R_NOCROP); |
|
2574 |
|
2575 TBuf<KLabelCaptionMaxLength> center; |
|
2576 iCoeEnv->ReadResourceL(center, R_CENTER); |
|
2577 |
|
2578 TBuf<KLabelCaptionMaxLength> volume; |
|
2579 iCoeEnv->ReadResourceL(volume, R_VOLUME); |
|
2580 |
|
2581 TBuf<KLabelCaptionMaxLength> ramp; |
|
2582 iCoeEnv->ReadResourceL(ramp, R_RAMP); |
|
2583 |
|
2584 TBuf<KLabelCaptionMaxLength> balanceDes; |
|
2585 iCoeEnv->ReadResourceL(balanceDes, R_BALANCE); |
|
2586 |
|
2587 TBuf<KLabelCaptionMaxLength> cropStart; |
|
2588 iCoeEnv->ReadResourceL(cropStart, R_CROPSTART); |
|
2589 |
|
2590 TBuf<KLabelCaptionMaxLength> cropEnd; |
|
2591 iCoeEnv->ReadResourceL(cropEnd, R_CROPEND); |
|
2592 |
|
2593 TBuf<KLabelCaptionMaxLength> noRepeats; |
|
2594 iCoeEnv->ReadResourceL(noRepeats, R_NOREPEATS); |
|
2595 |
|
2596 TBuf<32> audioPriority; |
|
2597 iCoeEnv->ReadResourceL(audioPriority, R_AUDIOPRIORITY); |
|
2598 |
|
2599 TBuf<KLabelCaptionMaxLength> gain; |
|
2600 iCoeEnv->ReadResourceL(gain, R_GAIN); |
|
2601 |
|
2602 TBuf<KLabelCaptionMaxLength> clipLength; |
|
2603 iCoeEnv->ReadResourceL(clipLength, R_CLIPLENGTH); |
|
2604 |
|
2605 TBuf<KLabelCaptionMaxLength> bitRate; |
|
2606 iCoeEnv->ReadResourceL(bitRate, R_BITRATE); |
|
2607 |
|
2608 TBuf<KLabelCaptionMaxLength> sampleRate; |
|
2609 iCoeEnv->ReadResourceL(sampleRate, R_SAMPLERATE); |
|
2610 |
|
2611 TBuf<KLabelCaptionMaxLength> channels; |
|
2612 iCoeEnv->ReadResourceL(channels,R_CHANNELS); |
|
2613 |
|
2614 TBuf<KLabelCaptionMaxLength> AudioEnabled; |
|
2615 iCoeEnv->ReadResourceL(AudioEnabled, R_AUDIOENABLED); |
|
2616 |
|
2617 TBuf<KLabelCaptionMaxLength> AudioNotEnabled; |
|
2618 iCoeEnv->ReadResourceL(AudioNotEnabled, R_AUDIONOTENABLED); |
|
2619 |
|
2620 _LIT(KPercent, "%"); |
|
2621 |
|
2622 TBuf<KTimeValueLength> clipLengthDes; |
|
2623 |
|
2624 //If the window text has anything in it, clear it out |
|
2625 if(iMainWindowText.Count() > 0) |
|
2626 { |
|
2627 iMainWindowText.Reset(); |
|
2628 } |
|
2629 TTimeIntervalMicroSeconds duration; |
|
2630 TInt64 clipLengthVal =0; |
|
2631 TUint bitrateValue = 0; |
|
2632 TInt frameHeight = 0; |
|
2633 TInt frameWidth = 0; |
|
2634 TInt frameRate = 0; |
|
2635 //Populate the array based on the current state |
|
2636 switch(aState) |
|
2637 { |
|
2638 //Idle, the main window is all but empty |
|
2639 case(ENotReady): |
|
2640 iMainWindowText.AppendL(welcome); |
|
2641 if(iButtons->IsCommandDimmed(EMVSCmdPause)) |
|
2642 { |
|
2643 iButtons->DimCommand(EMVSCmdPause,EFalse); |
|
2644 iButtons->DrawNow(); |
|
2645 } |
|
2646 if(iButtons->IsCommandDimmed(EMVSCmdPlay)) |
|
2647 { |
|
2648 iButtons->DimCommand(EMVSCmdPlay,EFalse); |
|
2649 iButtons->DrawNow(); |
|
2650 } |
|
2651 if(iButtons->IsCommandDimmed(EMVSCmdStop)) |
|
2652 { |
|
2653 iButtons->DimCommand(EMVSCmdStop,EFalse); |
|
2654 iButtons->DrawNow(); |
|
2655 } |
|
2656 break; |
|
2657 |
|
2658 //Recording: show the gain, balance and crop window. |
|
2659 case(EAudioRecording): |
|
2660 if(iButtons->IsCommandDimmed(EMVSCmdStop)) |
|
2661 { |
|
2662 iButtons->DimCommand(EMVSCmdStop,EFalse); |
|
2663 iButtons->DrawNow(); |
|
2664 } |
|
2665 infoBuf.Append(KAudioRecording); |
|
2666 iMainWindowText.AppendL(infoBuf); |
|
2667 infoBuf.Zero(); |
|
2668 infoBuf.Append(gain); |
|
2669 infoBuf.AppendNum(iVolumeOrGain); |
|
2670 infoBuf.Append(KPercent); |
|
2671 iMainWindowText.AppendL(infoBuf); |
|
2672 infoBuf.Zero(); |
|
2673 infoBuf.Append(balanceDes); |
|
2674 //Convert the balance to a number between 0 and 100 |
|
2675 iAudioRecordAgent->GetRecordBalance(iBalance); |
|
2676 balance = (iBalance/2) + 50; |
|
2677 //Translate this figure into 'Left', 'Right' or 'Center' |
|
2678 if(balance < 50) |
|
2679 { |
|
2680 infoBuf.Append(left); |
|
2681 infoBuf.AppendNum(balance); |
|
2682 infoBuf.Append(close); |
|
2683 } |
|
2684 else if(balance == 50) |
|
2685 { |
|
2686 infoBuf.Append(center); |
|
2687 } |
|
2688 else |
|
2689 { |
|
2690 infoBuf.Append(right); |
|
2691 infoBuf.AppendNum(balance); |
|
2692 infoBuf.Append(close); |
|
2693 } |
|
2694 iMainWindowText.AppendL(infoBuf); |
|
2695 infoBuf.Zero(); |
|
2696 infoBuf.Append(bitRate); |
|
2697 if(iBitRate == 0) |
|
2698 { |
|
2699 infoBuf.Append(KNotSupported); |
|
2700 } |
|
2701 else |
|
2702 { |
|
2703 infoBuf.AppendNum(iBitRate); |
|
2704 } |
|
2705 iMainWindowText.AppendL(infoBuf); |
|
2706 infoBuf.Zero(); |
|
2707 infoBuf.Append(sampleRate); |
|
2708 infoBuf.AppendNum(iSampleRate); |
|
2709 iMainWindowText.AppendL(infoBuf); |
|
2710 infoBuf.Zero(); |
|
2711 if(iChannels == 1) |
|
2712 { |
|
2713 infoBuf.Append(channels); |
|
2714 infoBuf.Append(KMono); |
|
2715 iMainWindowText.AppendL(infoBuf); |
|
2716 infoBuf.Zero(); |
|
2717 } |
|
2718 else if(iChannels == 2) |
|
2719 { |
|
2720 infoBuf.Append(channels); |
|
2721 infoBuf.Append(KStereo); |
|
2722 iMainWindowText.AppendL(infoBuf); |
|
2723 infoBuf.Zero(); |
|
2724 } |
|
2725 break; |
|
2726 |
|
2727 case(EVideoRecording): |
|
2728 if(iButtons->IsCommandDimmed(EMVSCmdStop)) |
|
2729 { |
|
2730 iButtons->DimCommand(EMVSCmdStop,EFalse); |
|
2731 iButtons->DrawNow(); |
|
2732 } |
|
2733 infoBuf.Append(KVideoRecording); |
|
2734 iMainWindowText.AppendL(infoBuf); |
|
2735 infoBuf.Zero(); |
|
2736 if(iVideoRecordAgent->AudioEnabledL()) |
|
2737 { |
|
2738 infoBuf.Zero(); |
|
2739 infoBuf.Append(AudioEnabled); |
|
2740 iMainWindowText.AppendL(infoBuf); |
|
2741 infoBuf.Zero(); |
|
2742 infoBuf.Append(gain); |
|
2743 infoBuf.AppendNum(iVolumeOrGain); |
|
2744 infoBuf.Append(KPercent); |
|
2745 iMainWindowText.AppendL(infoBuf); |
|
2746 infoBuf.Zero(); |
|
2747 } |
|
2748 else |
|
2749 { |
|
2750 infoBuf.Zero(); |
|
2751 infoBuf.Append(AudioNotEnabled); |
|
2752 iMainWindowText.AppendL(infoBuf); |
|
2753 infoBuf.Zero(); |
|
2754 } |
|
2755 infoBuf.Append(KFrameSize); |
|
2756 frameHeight = iFrameSize.iHeight; |
|
2757 frameWidth = iFrameSize.iWidth; |
|
2758 infoBuf.AppendNum(frameWidth); |
|
2759 infoBuf.Append(KComma); |
|
2760 infoBuf.AppendNum(frameHeight); |
|
2761 iMainWindowText.AppendL(infoBuf); |
|
2762 infoBuf.Zero(); |
|
2763 infoBuf.Append(KFrameRate); |
|
2764 frameRate = TInt(iVideoFrameRate); |
|
2765 infoBuf.AppendNum(frameRate); |
|
2766 iMainWindowText.AppendL(infoBuf); |
|
2767 infoBuf.Zero(); |
|
2768 break; |
|
2769 |
|
2770 //The default state displays all playback information such as |
|
2771 //Volume, balance, cropping points, audio priority & the number of |
|
2772 //repeats. |
|
2773 case(EAudioOpened): |
|
2774 if(iMode == EAudioPlay) |
|
2775 { |
|
2776 infoBuf.Append(volume); |
|
2777 } |
|
2778 if(iMode == EAudioRecord) |
|
2779 { |
|
2780 infoBuf.Append(KGain); |
|
2781 } |
|
2782 infoBuf.AppendNum(iVolumeOrGain); |
|
2783 infoBuf.Append(KPercent); |
|
2784 iMainWindowText.AppendL(infoBuf); |
|
2785 infoBuf.Zero(); |
|
2786 infoBuf.Append(balanceDes); |
|
2787 balance = (iBalance/2) + 50; |
|
2788 if(balance < 50) |
|
2789 { |
|
2790 infoBuf.Append(left); |
|
2791 infoBuf.AppendNum(balance); |
|
2792 infoBuf.Append(close); |
|
2793 } |
|
2794 else if(balance == 50) |
|
2795 { |
|
2796 infoBuf.Append(center); |
|
2797 } |
|
2798 else |
|
2799 { |
|
2800 infoBuf.Append(right); |
|
2801 infoBuf.AppendNum(balance); |
|
2802 infoBuf.Append(close); |
|
2803 } |
|
2804 iMainWindowText.AppendL(infoBuf); |
|
2805 infoBuf.Zero(); |
|
2806 infoBuf.Append(noRepeats); |
|
2807 infoBuf.AppendNum(iNoRepeats); |
|
2808 iMainWindowText.AppendL(infoBuf); |
|
2809 infoBuf.Zero(); |
|
2810 //Audio Priority |
|
2811 infoBuf.Append(audioPriority); |
|
2812 infoBuf.AppendNum(iPriority); |
|
2813 iMainWindowText.AppendL(infoBuf); |
|
2814 infoBuf.Zero(); |
|
2815 infoBuf.Append(KDuration); |
|
2816 if(iMode == EAudioPlay) |
|
2817 { |
|
2818 duration = iAudioPlayAgent->Duration(); |
|
2819 } |
|
2820 else if(iMode == EAudioRecord) |
|
2821 { |
|
2822 duration = iAudioRecordAgent->Duration(); |
|
2823 if(duration > 0) |
|
2824 { |
|
2825 iButtons->DimCommand(EMVSCmdPlay,EFalse); |
|
2826 } |
|
2827 else |
|
2828 { |
|
2829 iButtons->DimCommand(EMVSCmdPlay,ETrue); |
|
2830 } |
|
2831 iButtons->DimCommand(EMVSCmdPause,ETrue); |
|
2832 iButtons->DimCommand(EMVSCmdStop,ETrue); |
|
2833 iButtons->DrawNow(); |
|
2834 } |
|
2835 clipLengthVal = duration.Int64(); |
|
2836 infoBuf.AppendNum(clipLengthVal); |
|
2837 infoBuf.Append(KMs); |
|
2838 iMainWindowText.AppendL(infoBuf); |
|
2839 infoBuf.Zero(); |
|
2840 infoBuf.Append(KBitRate); |
|
2841 if(iMode == EAudioPlay) |
|
2842 { |
|
2843 iAudioPlayAgent->GetBitRate(bitrateValue); |
|
2844 infoBuf.AppendNum(bitrateValue); |
|
2845 } |
|
2846 else if(iMode == EAudioRecord) |
|
2847 { |
|
2848 if(iBitRate == 0) |
|
2849 { |
|
2850 infoBuf.Append(KNotSupported); |
|
2851 } |
|
2852 else |
|
2853 { |
|
2854 infoBuf.AppendNum(iBitRate); |
|
2855 } |
|
2856 } |
|
2857 iMainWindowText.AppendL(infoBuf); |
|
2858 infoBuf.Zero(); |
|
2859 break; |
|
2860 |
|
2861 case(EAudioStopped): |
|
2862 infoBuf.Append(KStopped); |
|
2863 iMainWindowText.AppendL(infoBuf); |
|
2864 infoBuf.Zero(); |
|
2865 infoBuf.Append(volume); |
|
2866 infoBuf.AppendNum(iVolumeOrGain); |
|
2867 infoBuf.Append(KPercent); |
|
2868 iMainWindowText.AppendL(infoBuf); |
|
2869 infoBuf.Zero(); |
|
2870 infoBuf.Append(balanceDes); |
|
2871 balance = (iBalance/2) + 50; |
|
2872 if(balance < 50) |
|
2873 { |
|
2874 infoBuf.Append(left); |
|
2875 infoBuf.AppendNum(balance); |
|
2876 infoBuf.Append(close); |
|
2877 } |
|
2878 else if(balance == 50) |
|
2879 { |
|
2880 infoBuf.Append(center); |
|
2881 } |
|
2882 else |
|
2883 { |
|
2884 infoBuf.Append(right); |
|
2885 infoBuf.AppendNum(balance); |
|
2886 infoBuf.Append(close); |
|
2887 } |
|
2888 iMainWindowText.AppendL(infoBuf); |
|
2889 infoBuf.Zero(); |
|
2890 infoBuf.Append(noRepeats); |
|
2891 infoBuf.AppendNum(iNoRepeats); |
|
2892 iMainWindowText.AppendL(infoBuf); |
|
2893 infoBuf.Zero(); |
|
2894 //Audio Priority |
|
2895 infoBuf.Append(audioPriority); |
|
2896 infoBuf.AppendNum(iPriority); |
|
2897 iMainWindowText.AppendL(infoBuf); |
|
2898 infoBuf.Zero(); |
|
2899 infoBuf.Append(KDuration); |
|
2900 if(iMode == EAudioPlay) |
|
2901 { |
|
2902 duration = iAudioPlayAgent->Duration(); |
|
2903 } |
|
2904 else if(iMode == EAudioRecord) |
|
2905 { |
|
2906 duration = iAudioRecordAgent->Duration(); |
|
2907 } |
|
2908 clipLengthVal = duration.Int64(); |
|
2909 infoBuf.AppendNum(clipLengthVal); |
|
2910 infoBuf.Append(KMs); |
|
2911 iMainWindowText.AppendL(infoBuf); |
|
2912 infoBuf.Zero(); |
|
2913 infoBuf.Append(KBitRate); |
|
2914 if(iMode == EAudioPlay) |
|
2915 { |
|
2916 iAudioPlayAgent->GetBitRate(bitrateValue); |
|
2917 infoBuf.AppendNum(bitrateValue); |
|
2918 } |
|
2919 else if(iMode == EAudioRecord) |
|
2920 { |
|
2921 if(iBitRate == 0) |
|
2922 { |
|
2923 infoBuf.Append(KNotSupported); |
|
2924 } |
|
2925 else |
|
2926 { |
|
2927 infoBuf.AppendNum(iBitRate); |
|
2928 } |
|
2929 } |
|
2930 iMainWindowText.AppendL(infoBuf); |
|
2931 infoBuf.Zero(); |
|
2932 break; |
|
2933 |
|
2934 case(EAudioPlaying): |
|
2935 infoBuf.Append(KAudioPlaying); |
|
2936 iMainWindowText.AppendL(infoBuf); |
|
2937 infoBuf.Zero(); |
|
2938 infoBuf.Append(volume); |
|
2939 infoBuf.AppendNum(iVolumeOrGain); |
|
2940 infoBuf.Append(KPercent); |
|
2941 iMainWindowText.AppendL(infoBuf); |
|
2942 infoBuf.Zero(); |
|
2943 infoBuf.Append(balanceDes); |
|
2944 balance = (iBalance/2) + 50; |
|
2945 if(balance < 50) |
|
2946 { |
|
2947 infoBuf.Append(left); |
|
2948 infoBuf.AppendNum(balance); |
|
2949 infoBuf.Append(close); |
|
2950 } |
|
2951 else if(balance == 50) |
|
2952 { |
|
2953 infoBuf.Append(center); |
|
2954 } |
|
2955 else |
|
2956 { |
|
2957 infoBuf.Append(right); |
|
2958 infoBuf.AppendNum(balance); |
|
2959 infoBuf.Append(close); |
|
2960 } |
|
2961 iMainWindowText.AppendL(infoBuf); |
|
2962 infoBuf.Zero(); |
|
2963 infoBuf.Append(noRepeats); |
|
2964 infoBuf.AppendNum(iNoRepeats); |
|
2965 iMainWindowText.AppendL(infoBuf); |
|
2966 infoBuf.Zero(); |
|
2967 //Audio Priority |
|
2968 infoBuf.Append(audioPriority); |
|
2969 infoBuf.AppendNum(iPriority); |
|
2970 iMainWindowText.AppendL(infoBuf); |
|
2971 infoBuf.Zero(); |
|
2972 infoBuf.Append(KDuration); |
|
2973 if(iMode == EAudioPlay) |
|
2974 { |
|
2975 duration = iAudioPlayAgent->Duration(); |
|
2976 } |
|
2977 else if(iMode == EAudioRecord) |
|
2978 { |
|
2979 duration = iAudioRecordAgent->Duration(); |
|
2980 } |
|
2981 clipLengthVal = duration.Int64(); |
|
2982 infoBuf.AppendNum(clipLengthVal); |
|
2983 infoBuf.Append(KMs); |
|
2984 iMainWindowText.AppendL(infoBuf); |
|
2985 infoBuf.Zero(); |
|
2986 infoBuf.Append(KBitRate); |
|
2987 if(iMode == EAudioPlay) |
|
2988 { |
|
2989 iAudioPlayAgent->GetBitRate(bitrateValue); |
|
2990 infoBuf.AppendNum(bitrateValue); |
|
2991 } |
|
2992 else if(iMode == EAudioRecord) |
|
2993 { |
|
2994 if(iBitRate == 0) |
|
2995 { |
|
2996 infoBuf.Append(KNotSupported); |
|
2997 } |
|
2998 else |
|
2999 { |
|
3000 infoBuf.AppendNum(iBitRate); |
|
3001 } |
|
3002 } |
|
3003 iMainWindowText.AppendL(infoBuf); |
|
3004 infoBuf.Zero(); |
|
3005 break; |
|
3006 |
|
3007 case(EAudioPaused): |
|
3008 infoBuf.Append(KPaused); |
|
3009 iMainWindowText.AppendL(infoBuf); |
|
3010 infoBuf.Zero(); |
|
3011 infoBuf.Append(volume); |
|
3012 infoBuf.AppendNum(iVolumeOrGain); |
|
3013 infoBuf.Append(KPercent); |
|
3014 iMainWindowText.AppendL(infoBuf); |
|
3015 infoBuf.Zero(); |
|
3016 infoBuf.Append(balanceDes); |
|
3017 balance = (iBalance/2) + 50; |
|
3018 if(balance < 50) |
|
3019 { |
|
3020 infoBuf.Append(left); |
|
3021 infoBuf.AppendNum(balance); |
|
3022 infoBuf.Append(close); |
|
3023 } |
|
3024 else if(balance == 50) |
|
3025 { |
|
3026 infoBuf.Append(center); |
|
3027 } |
|
3028 else |
|
3029 { |
|
3030 infoBuf.Append(right); |
|
3031 infoBuf.AppendNum(balance); |
|
3032 infoBuf.Append(close); |
|
3033 } |
|
3034 iMainWindowText.AppendL(infoBuf); |
|
3035 infoBuf.Zero(); |
|
3036 infoBuf.Append(noRepeats); |
|
3037 infoBuf.AppendNum(iNoRepeats); |
|
3038 iMainWindowText.AppendL(infoBuf); |
|
3039 infoBuf.Zero(); |
|
3040 //Audio Priority |
|
3041 infoBuf.Append(audioPriority); |
|
3042 infoBuf.AppendNum(iPriority); |
|
3043 iMainWindowText.AppendL(infoBuf); |
|
3044 infoBuf.Zero(); |
|
3045 infoBuf.Append(KDuration); |
|
3046 if(iMode == EAudioPlay) |
|
3047 { |
|
3048 duration = iAudioPlayAgent->Duration(); |
|
3049 } |
|
3050 else if(iMode == EAudioRecord) |
|
3051 { |
|
3052 duration = iAudioRecordAgent->Duration(); |
|
3053 } |
|
3054 clipLengthVal = duration.Int64(); |
|
3055 infoBuf.AppendNum(clipLengthVal); |
|
3056 infoBuf.Append(KMs); |
|
3057 iMainWindowText.AppendL(infoBuf); |
|
3058 infoBuf.Zero(); |
|
3059 infoBuf.Append(KBitRate); |
|
3060 if(iMode == EAudioPlay) |
|
3061 { |
|
3062 iAudioPlayAgent->GetBitRate(bitrateValue); |
|
3063 infoBuf.AppendNum(bitrateValue); |
|
3064 } |
|
3065 else if(iMode == EAudioRecord) |
|
3066 { |
|
3067 if(iBitRate == 0) |
|
3068 { |
|
3069 infoBuf.Append(KNotSupported); |
|
3070 } |
|
3071 else |
|
3072 { |
|
3073 infoBuf.AppendNum(iBitRate); |
|
3074 } |
|
3075 } |
|
3076 iMainWindowText.AppendL(infoBuf); |
|
3077 infoBuf.Zero(); |
|
3078 break; |
|
3079 |
|
3080 case(EVideoOpened): |
|
3081 if(iMode == EVideoPlay) |
|
3082 { |
|
3083 infoBuf.Append(KVideoOpened); |
|
3084 iMainWindowText.AppendL(infoBuf); |
|
3085 infoBuf.Zero(); |
|
3086 if(iVideoPlayAgent->AudioEnabledL()) |
|
3087 { |
|
3088 infoBuf.Zero(); |
|
3089 infoBuf.Append(AudioEnabled); |
|
3090 iMainWindowText.AppendL(infoBuf); |
|
3091 infoBuf.Zero(); |
|
3092 infoBuf.Append(volume); |
|
3093 infoBuf.AppendNum(iVolumeOrGain); |
|
3094 infoBuf.Append(KPercent); |
|
3095 iMainWindowText.AppendL(infoBuf); |
|
3096 infoBuf.Zero(); |
|
3097 if(iButtons->IsCommandDimmed(EMVSCmdSetVolume)) |
|
3098 { |
|
3099 iButtons->DimCommand(EMVSCmdSetVolume,EFalse); |
|
3100 iButtons->DrawNow(); |
|
3101 } |
|
3102 } |
|
3103 else |
|
3104 { |
|
3105 infoBuf.Zero(); |
|
3106 infoBuf.Append(AudioNotEnabled); |
|
3107 iMainWindowText.AppendL(infoBuf); |
|
3108 infoBuf.Zero(); |
|
3109 } |
|
3110 infoBuf.Append(KDuration); |
|
3111 duration = iVideoPlayAgent->DurationL(); |
|
3112 clipLengthVal = duration.Int64(); |
|
3113 infoBuf.AppendNum(clipLengthVal); |
|
3114 iMainWindowText.AppendL(infoBuf); |
|
3115 infoBuf.Zero(); |
|
3116 iVideoPlayAgent->VideoFrameSizeL(iFrameSize); |
|
3117 frameHeight = iFrameSize.iHeight; |
|
3118 frameWidth = iFrameSize.iWidth; |
|
3119 infoBuf.Append(KFrameSize); |
|
3120 infoBuf.AppendNum(frameWidth); |
|
3121 infoBuf.Append(KComma); |
|
3122 infoBuf.AppendNum(frameHeight); |
|
3123 iMainWindowText.AppendL(infoBuf); |
|
3124 infoBuf.Zero(); |
|
3125 iVideoFrameRate = GetVideoFrameRateL(); |
|
3126 } |
|
3127 else if(iMode == EVideoRecord) |
|
3128 { |
|
3129 iButtons->DimCommand(EMVSCmdPlay,ETrue); |
|
3130 iButtons->DimCommand(EMVSCmdPause,ETrue); |
|
3131 iButtons->DimCommand(EMVSCmdStop,ETrue); |
|
3132 iButtons->DrawNow(); |
|
3133 infoBuf.Append(KVideoOpenedForRecord); |
|
3134 iMainWindowText.AppendL(infoBuf); |
|
3135 if(iVideoRecordAgent->AudioEnabledL()) |
|
3136 { |
|
3137 iButtons->DimCommand(EMVSCmdSetVolume, EFalse); |
|
3138 iButtons->DrawNow(); |
|
3139 infoBuf.Zero(); |
|
3140 infoBuf.Append(AudioEnabled); |
|
3141 iMainWindowText.AppendL(infoBuf); |
|
3142 infoBuf.Zero(); |
|
3143 infoBuf.Append(gain); |
|
3144 infoBuf.AppendNum(iVolumeOrGain); |
|
3145 infoBuf.Append(KPercent); |
|
3146 iMainWindowText.AppendL(infoBuf); |
|
3147 infoBuf.Zero(); |
|
3148 } |
|
3149 else |
|
3150 { |
|
3151 infoBuf.Zero(); |
|
3152 infoBuf.Append(AudioNotEnabled); |
|
3153 iMainWindowText.AppendL(infoBuf); |
|
3154 infoBuf.Zero(); |
|
3155 } |
|
3156 infoBuf.Append(KFrameSize); |
|
3157 frameHeight =iFrameSize.iHeight; |
|
3158 frameWidth =iFrameSize.iWidth; |
|
3159 infoBuf.AppendNum(frameWidth); |
|
3160 infoBuf.Append(KComma); |
|
3161 infoBuf.AppendNum(frameHeight); |
|
3162 iMainWindowText.AppendL(infoBuf); |
|
3163 infoBuf.Zero(); |
|
3164 } |
|
3165 infoBuf.Zero(); |
|
3166 infoBuf.Append(KFrameRate); |
|
3167 frameRate = TInt(iVideoFrameRate); |
|
3168 infoBuf.AppendNum(frameRate); |
|
3169 iMainWindowText.AppendL(infoBuf); |
|
3170 infoBuf.Zero(); |
|
3171 break; |
|
3172 |
|
3173 case(EVideoPlaying): |
|
3174 infoBuf.Append(KVideoPlaying); |
|
3175 iMainWindowText.AppendL(infoBuf); |
|
3176 infoBuf.Zero(); |
|
3177 if( iVideoPlayAgent->AudioEnabledL()) |
|
3178 { |
|
3179 infoBuf.Zero(); |
|
3180 infoBuf.Append(AudioEnabled); |
|
3181 iMainWindowText.AppendL(infoBuf); |
|
3182 infoBuf.Zero(); |
|
3183 infoBuf.Append(volume); |
|
3184 infoBuf.AppendNum(iVolumeOrGain); |
|
3185 infoBuf.Append(KPercent); |
|
3186 iMainWindowText.AppendL(infoBuf); |
|
3187 infoBuf.Zero(); |
|
3188 } |
|
3189 else |
|
3190 { |
|
3191 infoBuf.Zero(); |
|
3192 infoBuf.Append(AudioNotEnabled); |
|
3193 iMainWindowText.AppendL(infoBuf); |
|
3194 infoBuf.Zero(); |
|
3195 } |
|
3196 infoBuf.Append(KDuration); |
|
3197 duration = iVideoPlayAgent->DurationL(); |
|
3198 clipLengthVal = duration.Int64(); |
|
3199 infoBuf.AppendNum(clipLengthVal); |
|
3200 iMainWindowText.AppendL(infoBuf); |
|
3201 infoBuf.Zero(); |
|
3202 iVideoPlayAgent->VideoFrameSizeL(iFrameSize); |
|
3203 frameHeight = iFrameSize.iHeight; |
|
3204 frameWidth = iFrameSize.iWidth; |
|
3205 infoBuf.Append(KFrameSize); |
|
3206 infoBuf.AppendNum(frameWidth); |
|
3207 infoBuf.Append(KComma); |
|
3208 infoBuf.AppendNum(frameHeight); |
|
3209 iMainWindowText.AppendL(infoBuf); |
|
3210 infoBuf.Zero(); |
|
3211 infoBuf.Append(KFrameRate); |
|
3212 iVideoFrameRate = GetVideoFrameRateL(); |
|
3213 frameRate = TInt(iVideoFrameRate); |
|
3214 infoBuf.AppendNum(frameRate); |
|
3215 iMainWindowText.AppendL(infoBuf); |
|
3216 infoBuf.Zero(); |
|
3217 break; |
|
3218 |
|
3219 case(EVideoPaused): |
|
3220 infoBuf.Append(KPaused); |
|
3221 iMainWindowText.AppendL(infoBuf); |
|
3222 if(iMode == EVideoRecord) |
|
3223 { |
|
3224 if(iVideoRecordAgent->AudioEnabledL()) |
|
3225 { |
|
3226 infoBuf.Zero(); |
|
3227 infoBuf.Append(AudioEnabled); |
|
3228 iMainWindowText.AppendL(infoBuf); |
|
3229 infoBuf.Zero(); |
|
3230 } |
|
3231 else |
|
3232 { |
|
3233 infoBuf.Zero(); |
|
3234 infoBuf.Append(AudioNotEnabled); |
|
3235 iMainWindowText.AppendL(infoBuf); |
|
3236 infoBuf.Zero(); |
|
3237 } |
|
3238 infoBuf.Append(KDuration); |
|
3239 duration = iVideoRecordAgent->DurationL(); |
|
3240 clipLengthVal = duration.Int64(); |
|
3241 infoBuf.AppendNum(clipLengthVal); |
|
3242 iMainWindowText.AppendL(infoBuf); |
|
3243 infoBuf.Zero(); |
|
3244 |
|
3245 } |
|
3246 if(iMode == EVideoPlay) |
|
3247 { |
|
3248 if(iVideoPlayAgent->AudioEnabledL()) |
|
3249 { |
|
3250 infoBuf.Zero(); |
|
3251 infoBuf.Append(AudioEnabled); |
|
3252 iMainWindowText.AppendL(infoBuf); |
|
3253 infoBuf.Zero(); |
|
3254 infoBuf.Append(volume); |
|
3255 infoBuf.AppendNum(iVolumeOrGain); |
|
3256 infoBuf.Append(KPercent); |
|
3257 iMainWindowText.AppendL(infoBuf); |
|
3258 infoBuf.Zero(); |
|
3259 } |
|
3260 else |
|
3261 { |
|
3262 infoBuf.Zero(); |
|
3263 infoBuf.Append(AudioNotEnabled); |
|
3264 iMainWindowText.AppendL(infoBuf); |
|
3265 infoBuf.Zero(); |
|
3266 } |
|
3267 infoBuf.Append(KDuration); |
|
3268 duration = iVideoPlayAgent->DurationL(); |
|
3269 clipLengthVal = duration.Int64(); |
|
3270 infoBuf.AppendNum(clipLengthVal); |
|
3271 iMainWindowText.AppendL(infoBuf); |
|
3272 infoBuf.Zero(); |
|
3273 iVideoPlayAgent->VideoFrameSizeL(iFrameSize); |
|
3274 frameHeight = iFrameSize.iHeight; |
|
3275 frameWidth = iFrameSize.iWidth; |
|
3276 infoBuf.Append(KFrameSize); |
|
3277 infoBuf.AppendNum(frameWidth); |
|
3278 infoBuf.Append(KComma); |
|
3279 infoBuf.AppendNum(frameHeight); |
|
3280 iMainWindowText.AppendL(infoBuf); |
|
3281 infoBuf.Zero(); |
|
3282 infoBuf.Append(KFrameRate); |
|
3283 iVideoFrameRate = GetVideoFrameRateL(); |
|
3284 frameRate = TInt(iVideoFrameRate); |
|
3285 infoBuf.AppendNum(frameRate); |
|
3286 iMainWindowText.AppendL(infoBuf); |
|
3287 infoBuf.Zero(); |
|
3288 } |
|
3289 break; |
|
3290 |
|
3291 case(EVideoStopped): |
|
3292 infoBuf.Append(KStopped); |
|
3293 iMainWindowText.AppendL(infoBuf); |
|
3294 if(iMode == EVideoPlay) |
|
3295 { |
|
3296 if(iVideoPlayAgent->AudioEnabledL()) |
|
3297 { |
|
3298 infoBuf.Zero(); |
|
3299 infoBuf.Append(AudioEnabled); |
|
3300 iMainWindowText.AppendL(infoBuf); |
|
3301 infoBuf.Zero(); |
|
3302 infoBuf.Append(volume); |
|
3303 infoBuf.AppendNum(iVolumeOrGain); |
|
3304 infoBuf.Append(KPercent); |
|
3305 iMainWindowText.AppendL(infoBuf); |
|
3306 infoBuf.Zero(); |
|
3307 } |
|
3308 else |
|
3309 { |
|
3310 infoBuf.Zero(); |
|
3311 infoBuf.Append(AudioNotEnabled); |
|
3312 iMainWindowText.AppendL(infoBuf); |
|
3313 infoBuf.Zero(); |
|
3314 } |
|
3315 infoBuf.Append(KDuration); |
|
3316 duration = iVideoPlayAgent->DurationL(); |
|
3317 clipLengthVal = duration.Int64(); |
|
3318 infoBuf.AppendNum(clipLengthVal); |
|
3319 iMainWindowText.AppendL(infoBuf); |
|
3320 infoBuf.Zero(); |
|
3321 iVideoPlayAgent->VideoFrameSizeL(iFrameSize); |
|
3322 frameHeight = iFrameSize.iHeight; |
|
3323 frameWidth = iFrameSize.iWidth; |
|
3324 infoBuf.Append(KFrameSize); |
|
3325 infoBuf.AppendNum(frameWidth); |
|
3326 infoBuf.Append(KComma); |
|
3327 infoBuf.AppendNum(frameHeight); |
|
3328 iMainWindowText.AppendL(infoBuf); |
|
3329 infoBuf.Zero(); |
|
3330 iVideoFrameRate = GetVideoFrameRateL(); |
|
3331 } |
|
3332 else if(iMode == EVideoRecord) |
|
3333 { |
|
3334 if(iVideoRecordAgent->AudioEnabledL()) |
|
3335 { |
|
3336 infoBuf.Zero(); |
|
3337 infoBuf.Append(AudioEnabled); |
|
3338 iMainWindowText.AppendL(infoBuf); |
|
3339 infoBuf.Zero(); |
|
3340 infoBuf.Append(gain); |
|
3341 infoBuf.AppendNum(iVolumeOrGain); |
|
3342 infoBuf.Append(KPercent); |
|
3343 iMainWindowText.AppendL(infoBuf); |
|
3344 } |
|
3345 else |
|
3346 { |
|
3347 infoBuf.Zero(); |
|
3348 infoBuf.Append(AudioNotEnabled); |
|
3349 iMainWindowText.AppendL(infoBuf); |
|
3350 infoBuf.Zero(); |
|
3351 } |
|
3352 infoBuf.Zero(); |
|
3353 infoBuf.Append(KDuration); |
|
3354 duration = iVideoRecordAgent->DurationL(); |
|
3355 clipLengthVal = duration.Int64(); |
|
3356 infoBuf.AppendNum(clipLengthVal); |
|
3357 iMainWindowText.AppendL(infoBuf); |
|
3358 infoBuf.Zero(); |
|
3359 infoBuf.Append(KFrameSize); |
|
3360 frameHeight =iFrameSize.iHeight; |
|
3361 frameWidth =iFrameSize.iWidth; |
|
3362 infoBuf.AppendNum(frameWidth); |
|
3363 infoBuf.Append(KComma); |
|
3364 infoBuf.AppendNum(frameHeight); |
|
3365 iMainWindowText.AppendL(infoBuf); |
|
3366 infoBuf.Zero(); |
|
3367 } |
|
3368 infoBuf.Zero(); |
|
3369 infoBuf.Append(KFrameRate); |
|
3370 frameRate = TInt(iVideoFrameRate); |
|
3371 infoBuf.AppendNum(frameRate); |
|
3372 iMainWindowText.AppendL(infoBuf); |
|
3373 infoBuf.Zero(); |
|
3374 break; |
|
3375 } |
|
3376 TInt clipLen = I64INT(clipLengthVal); |
|
3377 iAppView->SetClipLength(clipLen); |
|
3378 } |
|
3379 |
|
3380 void CMVSAppUi::BuildDollarDesFromArrayL(TDes& aDollarDes) |
|
3381 { |
|
3382 //take the CDesCArrayFlat and build a dollar separated descriptor |
|
3383 TInt counter; |
|
3384 TBuf<2> dollar; |
|
3385 for(counter = 0; counter < iMainWindowText.Count(); ++counter) |
|
3386 { |
|
3387 aDollarDes.Append(iMainWindowText[counter]); |
|
3388 iCoeEnv->ReadResourceL(dollar, R_DOLLARDOLLAR); |
|
3389 aDollarDes.Append(dollar); |
|
3390 } |
|
3391 return; |
|
3392 } |
|
3393 |
|
3394 // |
|
3395 //ConvertTimeToDes(...) |
|
3396 // |
|
3397 // Converts the time to a descriptor for display purposes. The display is |
|
3398 // in the format HH:MM:SS:SS. |
|
3399 // |
|
3400 void CMVSAppUi::ConvertTimeToDes(TTimeIntervalMicroSeconds aPosition, |
|
3401 TDes& aDes) |
|
3402 { |
|
3403 _LIT(KColon, ":"); |
|
3404 _LIT(KZeroDes, "0"); |
|
3405 RArray<TInt> addZero; //array to record whether we need to append a '0' |
|
3406 //to each value in the times array. |
|
3407 RArray<TInt> times; //The array of times, stored hour, minute, second... |
|
3408 |
|
3409 TInt64 milliseconds = I64INT(aPosition.Int64())/1000; |
|
3410 TInt seconds = milliseconds/1000; |
|
3411 milliseconds = milliseconds - (seconds * 1000); |
|
3412 |
|
3413 TInt hundreds = milliseconds/10; //hundreds of seconds |
|
3414 |
|
3415 TInt minutes = seconds/60; |
|
3416 seconds = seconds - minutes*60; //seconds |
|
3417 |
|
3418 TInt hours = minutes/60; //hours |
|
3419 minutes = minutes - hours*60; //minutes |
|
3420 |
|
3421 times.Append(hours); |
|
3422 times.Append(minutes); |
|
3423 times.Append(seconds); |
|
3424 times.Append(hundreds); //fill the array |
|
3425 |
|
3426 TBuf<256> timeDes; //descriptor holding each element of the times array |
|
3427 //in turn. |
|
3428 |
|
3429 TInt counter = 0; //counter |
|
3430 for(counter = 0; counter < 4; ++counter) |
|
3431 { |
|
3432 timeDes.Zero(); |
|
3433 timeDes.AppendNum(times[counter]); |
|
3434 |
|
3435 if(timeDes.Length() == 1) |
|
3436 { |
|
3437 //If the time value is a single digit, we need to add a '0' |
|
3438 addZero.Append(1); |
|
3439 } |
|
3440 else |
|
3441 { |
|
3442 //Otherwise, we do not. |
|
3443 addZero.Append(0); |
|
3444 } |
|
3445 } |
|
3446 |
|
3447 //Add zeros where required. |
|
3448 if(addZero[0]) |
|
3449 aDes.Append(KZeroDes); |
|
3450 aDes.AppendNum(hours); |
|
3451 aDes.Append(KColon); |
|
3452 if(addZero[1]) |
|
3453 aDes.Append(KZeroDes); |
|
3454 aDes.AppendNum(minutes); |
|
3455 aDes.Append(KColon); |
|
3456 if(addZero[2]) |
|
3457 aDes.Append(KZeroDes); |
|
3458 aDes.AppendNum(seconds); |
|
3459 aDes.Append(KColon); |
|
3460 if(addZero[3]) |
|
3461 aDes.Append(KZeroDes); |
|
3462 aDes.AppendNum(hundreds); |
|
3463 |
|
3464 //Close the RArrays and return |
|
3465 addZero.Close(); |
|
3466 times.Close(); |
|
3467 return; |
|
3468 } |
|
3469 |
|
3470 // |
|
3471 //UpdatePositionViewL() |
|
3472 // |
|
3473 // Updates the view if the state is recording or playing. Otherwise, this is |
|
3474 // unnecessary. |
|
3475 // |
|
3476 void CMVSAppUi::UpdatePositionViewL() |
|
3477 { |
|
3478 TBuf<64> dispStr1; |
|
3479 TBuf<256> temp; |
|
3480 TInt64 currentposition = 0; |
|
3481 if(iState == EAudioRecording || iState == EAudioPlaying || iState == EVideoRecording |
|
3482 || iState == EVideoPlaying || iState == EAudioPaused || iState == EVideoPaused |
|
3483 || iState == EVideoStopped || iState == EAudioStopped) |
|
3484 { |
|
3485 iDisplayTime.Zero(); |
|
3486 if(iMode==EAudioRecord) |
|
3487 { |
|
3488 TBuf<64> dispStr2; |
|
3489 TBuf<32> recTimeLeft; |
|
3490 TTimeIntervalMicroSeconds timeLeft = iAudioRecordAgent->RecordTimeAvailable(); |
|
3491 if(iRecordLimitSet && iState == EAudioRecording) |
|
3492 { |
|
3493 ConvertTimeToDes(timeLeft, recTimeLeft); |
|
3494 dispStr2.Copy(_L("Time Left:")); |
|
3495 dispStr2.Append(recTimeLeft); |
|
3496 iAppView->iStatusWindowTimeControl->SetText2L(dispStr2); |
|
3497 dispStr1.Copy(_L("Rec. Time:")); |
|
3498 } |
|
3499 } |
|
3500 if(iMode==EAudioRecord && iState==EAudioRecording) |
|
3501 { |
|
3502 iClipLength = iAudioRecordAgent->Duration(); |
|
3503 iTimeElapsed = iAudioRecordAgent->Position(); |
|
3504 TInt64 duration = iClipLength.Int64(); |
|
3505 TInt64 position = iTimeElapsed.Int64(); |
|
3506 currentposition = duration + position; |
|
3507 iTimeElapsed = TTimeIntervalMicroSeconds(currentposition); |
|
3508 } |
|
3509 else if(iMode==EAudioRecord && iState==EAudioPlaying) |
|
3510 { |
|
3511 iTimeElapsed=iAudioRecordAgent->Position(); |
|
3512 iAppView->UpdatePlayProgress(iTimeElapsed); |
|
3513 } |
|
3514 else if(iMode==EAudioPlay) |
|
3515 { |
|
3516 iAudioPlayAgent->GetPosition(iTimeElapsed); |
|
3517 iAppView->UpdatePlayProgress(iTimeElapsed); |
|
3518 } |
|
3519 else if(iMode==EVideoPlay) |
|
3520 { |
|
3521 iTimeElapsed = iVideoPlayAgent->PositionL(); |
|
3522 } |
|
3523 else if(iMode==EVideoRecord) |
|
3524 { |
|
3525 iTimeElapsed = iVideoRecordAgent->DurationL(); |
|
3526 } |
|
3527 temp.AppendNum(currentposition); |
|
3528 |
|
3529 ConvertTimeToDes(iTimeElapsed, iDisplayTime); |
|
3530 dispStr1.Append(iDisplayTime); |
|
3531 iAppView->iStatusWindowTimeControl->SetTextL(dispStr1); |
|
3532 iAppView->iStatusWindowTimeControl->DrawNow(); |
|
3533 } |
|
3534 } |
|
3535 |
|
3536 |
|
3537 void CMVSAppUi::SetMaxFileSize(TInt& aVal) |
|
3538 { |
|
3539 if(aVal>0) |
|
3540 { |
|
3541 iRecordLimitSet = ETrue; |
|
3542 iAudioRecordAgent->SetMaxWriteLength(aVal); |
|
3543 } |
|
3544 else |
|
3545 { |
|
3546 iRecordLimitSet = EFalse; |
|
3547 iAudioRecordAgent->SetMaxWriteLength(aVal); |
|
3548 TRAP_IGNORE(iAppView->iStatusWindowTimeControl->ResetText2L()); |
|
3549 } |
|
3550 } |
|
3551 |
|
3552 //Handling the errors and logging it to the |
|
3553 //log file |
|
3554 void CMVSAppUi::LogErrors(TInt aError) |
|
3555 { |
|
3556 TBuf<KErrorTextLength> erorrDes; |
|
3557 CEikonEnv::Static()->GetErrorText(erorrDes,aError); |
|
3558 CEikonEnv::Static()->AlertWin(erorrDes); |
|
3559 iLogger.Write(erorrDes); |
|
3560 } |
|
3561 |
|
3562 |
|
3563 void CMVSAppUi::DetermineFinalFNameL() |
|
3564 { |
|
3565 //check whether the extension and the controller |
|
3566 //has been selected or not.If not selected proceed |
|
3567 //to the next dialog, nothing to be appended here to |
|
3568 //the filename.Else append the selected extension to |
|
3569 //the filename. |
|
3570 if(iSelectedPluginIdx == KControllerNotSelected) |
|
3571 { |
|
3572 iProceed = ETrue; |
|
3573 } |
|
3574 TFileName givenExt; |
|
3575 TParsePtr parser(iDestFilename); |
|
3576 TPtrC extensionval = parser.Ext(); |
|
3577 if(extensionval.Length() == 0) |
|
3578 { |
|
3579 iDestFilename.Append(iControllerExt); |
|
3580 iProceed = ETrue; |
|
3581 return; |
|
3582 } |
|
3583 else |
|
3584 { |
|
3585 //If the extension is too long, report an error. |
|
3586 if(extensionval.Length() > 4) |
|
3587 { |
|
3588 _LIT(KExtTooLong, "Extension TOO long"); |
|
3589 User::InfoPrint(KExtTooLong); |
|
3590 iProceed = EFalse; |
|
3591 } |
|
3592 |
|
3593 //Otherwise record the extension given in the filename |
|
3594 if(extensionval.CompareF(iControllerExt)==0) |
|
3595 { |
|
3596 iProceed = ETrue; |
|
3597 return; |
|
3598 } |
|
3599 |
|
3600 //Otherwise, append the right extension to the filename and return. |
|
3601 else |
|
3602 { |
|
3603 _LIT(KWrongExt, "Wrong Extension"); |
|
3604 _LIT(KWrongExtBody, "Extension mismatch,Please re-enter"); |
|
3605 CEikonEnv::Static()->InfoWinL(KWrongExt, KWrongExtBody); |
|
3606 SaveAsDialogL(); |
|
3607 iProceed = EFalse; |
|
3608 } |
|
3609 } |
|
3610 } |
|
3611 |
|
3612 TPoint CMVSAppUi::DrawBorders(const TSize& aSize) const |
|
3613 { |
|
3614 CWindowGc& gc = iAppView->iMainWindowControl->SystemGc(); |
|
3615 gc.Activate(iAppView->iMainWindowControl->ControlWindow()); |
|
3616 TRect rect(iAppView->iMainWindowControl->Size()); |
|
3617 TPoint pos( rect.iTl.iX + rect.Width()/2 - aSize.iWidth/2, |
|
3618 rect.iTl.iY + rect.Height()/2 - aSize.iHeight/2); |
|
3619 TRect drawRect(pos,aSize); |
|
3620 gc.SetPenColor(KRgbBlack); |
|
3621 drawRect.Grow(1,1); |
|
3622 gc.DrawRect(drawRect); |
|
3623 gc.Deactivate(); |
|
3624 iAppView->iMainWindowControl->ControlEnv()->WsSession().Flush(); |
|
3625 return pos; |
|
3626 } |
|
3627 |
|
3628 void CMVSAppUi::StopViewFinder() |
|
3629 { |
|
3630 if(!iVideoRecordAgent) |
|
3631 { |
|
3632 return; |
|
3633 } |
|
3634 CCamera *camera = iVideoRecordAgent->Camera(); |
|
3635 if (camera->ViewFinderActive()) |
|
3636 { |
|
3637 camera->StopViewFinder(); |
|
3638 iAppView->iMainWindowControl->DrawNow(); |
|
3639 } |
|
3640 } |