1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmvalidationsuite/mmvalidationsuiteapp/src/MVSAppUI.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,3640 @@
1.4 +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// Part of the MVS Application for TechView
1.18 +//
1.19 +
1.20 +#include <techview/eikfnlab.h>
1.21 +#include <techview/eikcfdlg.h>
1.22 +#include <techview/eikbtgpc.h>
1.23 +#include <techview/eikdialg.h>
1.24 +#include <techview/eikon.rsg>
1.25 +#include <eikmobs.h>
1.26 +#include <coecntrl.h>
1.27 +#include <eikenv.h>
1.28 +#include "MVSAppUI.h"
1.29 +#include "MVSApp.hrh"
1.30 +#include "MVSViewTicker.h"
1.31 +#include "MVSConstants.h"
1.32 +#include "MVSVolumeDialog.h"
1.33 +#include "MVSBalanceDialog.h"
1.34 +#include "MVSRepeatDialog.h"
1.35 +#include "MVSSelectPluginsDialog.h"
1.36 +#include "MVSSaveAsDialog.h"
1.37 +#include "MVSEditMetaInfoDialog.h"
1.38 +#include "MVSConfigAudioFormatDialog.h"
1.39 +#include "MVSConfigVideoFormatDialog.h"
1.40 +#include "MVSSystemInfoDialog.h"
1.41 +#include "MVSVideoSettingDialog.h"
1.42 +#include "MVSAudioSettingDialog.h"
1.43 +#include "MVSSetPlayWindowDialog.h"
1.44 +#include "MVSViewMetaInfoDialog.h"
1.45 +#include "MVSCropDialog.h"
1.46 +#include "MVSMultipleScreenDialog.h"
1.47 +#include "MVSResourceNotifyDialog.h"
1.48 +
1.49 +const TInt KMaxSupportedPlugins = 10;
1.50 +const TInt KMaxSupportedExtension = 10;
1.51 +const TInt KMaxSupportedCodecs = 10;
1.52 +const TInt KLabelCaptionMaxLength = 16;
1.53 +const TInt KTimeValueLength = 12;
1.54 +
1.55 +void CMVSAppUi::ConstructL()
1.56 + {
1.57 + CEikAppUi::ConstructL();
1.58 + User::LeaveIfError(iLogs.Connect());
1.59 + iLogs.MkDirAll(KLogsPath);
1.60 + iButtons=iEikonEnv->AppUiFactory()->ToolBar();
1.61 + //Meta entry initialization
1.62 + iMetaTitle = CMMFMetaDataEntry::NewL(KTitle,Ka);
1.63 + iMetaAuthor = CMMFMetaDataEntry::NewL(KAuthor,Ka);
1.64 + iMetaCopyright = CMMFMetaDataEntry::NewL(KCopyrt,Ka);
1.65 + iMetaRevision = CMMFMetaDataEntry::NewL(KRevision,Ka);
1.66 + iMetaCategory = CMMFMetaDataEntry::NewL(KCategory,Ka);
1.67 + iMetaComments = CMMFMetaDataEntry::NewL(KComments,Ka);
1.68 + iVideoPlayAgent = CMVSVideoPlayAgent::NewL(*this);
1.69 + iAppView = CMVSAppView::NewL(ClientRect(), *iVideoPlayAgent);
1.70 + iPluginArray = new(ELeave) CDesCArrayFlat(KMaxSupportedPlugins);
1.71 + iExtArray = new(ELeave) CDesCArrayFlat(KMaxSupportedExtension);
1.72 + iCodecArray = new(ELeave) CDesCArrayFlat(KMaxSupportedCodecs);
1.73 + iAudioPlayAgent = CMVSAudioPlayAgent::NewL(*this);
1.74 + iAudioRecordAgent = CMVSAudioRecordAgent::NewL(*this);
1.75 + iVideoRecordAgent = CMVSVideoRecordAgent::NewL(*this);
1.76 + iPluginInfo=CMVSControllerPluginInfo::NewL();
1.77 + iAutoplay = EFalse;
1.78 + iMode=EIdle;
1.79 + User::LeaveIfError(iLogger.Connect());
1.80 + iLogger.CreateLog(KLogsDir,KLogsFile,EFileLoggingModeAppend);
1.81 + iSettingManager = CSettingsManager::NewL();
1.82 + iRepeatDelay = 1000000;//initial value of 1 second in microseconds.
1.83 + iPriority = 1;//default settings
1.84 + iPriorityPreference = EMdaPriorityPreferenceNone;//default settings
1.85 + iRotation = EVideoRotationNone;//default settings
1.86 + iNoRepeats = 0;
1.87 + iScreenNumber = 0;
1.88 + if(!iSettingManager->FileExists())
1.89 + {
1.90 + iSettingManager->MakeSeedIndexL();
1.91 + }
1.92 + iSettingManager->ReadGeneralSettingsL(this);
1.93 + iSelectedPluginIdx = -1;
1.94 + iMediaType = 0; //set audio media initially
1.95 + iPluginsCnt = iPluginInfo->GetPluginListL(iPluginArray,iUidArray );
1.96 + iControllerUid = TUid::Null();
1.97 + iViewTicker = CMVSViewTicker::NewL(this);
1.98 +
1.99 + // Add one video control per screen
1.100 + // except for screen 0 which already has a video control
1.101 + // via the app view
1.102 + const TInt numScreens = CCoeEnv::Static()->WsSession().NumberOfScreens();
1.103 +
1.104 + for(TInt i = 1; i < numScreens; ++i)
1.105 + {
1.106 + CMVSVideoControl* videoCtl = CMVSVideoControl::NewLC(*iVideoPlayAgent, i, *(CCoeEnv::Static()->RootWin(i)));
1.107 + CWsScreenDevice* screenDevice = new (ELeave) CWsScreenDevice(CCoeEnv::Static()->WsSession());
1.108 + CleanupStack::PushL(screenDevice);
1.109 + User::LeaveIfError(screenDevice->Construct(i));
1.110 + videoCtl->SetExtent(TPoint(0, 0), screenDevice->SizeInPixels());
1.111 + CleanupStack::PopAndDestroy(screenDevice);
1.112 + videoCtl->ActivateL();
1.113 + iVideoCtls.AppendL(videoCtl);
1.114 + CleanupStack::Pop(videoCtl);
1.115 + }
1.116 +
1.117 + iVideoCtl = iAppView->iMainWindowControl;
1.118 + iLogger.Write(_L("Application START"));
1.119 + iSrcFName.Copy(KDefault);
1.120 + iDestFilename = KDefault;
1.121 + iRecordLimitSet = EFalse;
1.122 + iAlreadyRegistered = EFalse;
1.123 + }
1.124 +
1.125 +CMVSAppUi::CMVSAppUi()
1.126 +:iVolumeOrGain(10),iNoRepeats(0),iMainWindowText(8), iMaxFileBuffer(0)
1.127 +#ifdef SYMBIAN_BUILD_GCE
1.128 + ,iAutoScaleType(EAutoScaleNone),
1.129 + iAutoScaleHorizPos(EHorizontalAlignCenter),
1.130 + iAutoScaleVertPos(EVerticalAlignCenter)
1.131 +#endif
1.132 + {
1.133 + }
1.134 +
1.135 +CMVSAppUi::~CMVSAppUi()
1.136 + {
1.137 + delete iAudioPlayAgent;
1.138 + delete iAudioRecordAgent;
1.139 + delete iVideoPlayAgent;
1.140 + delete iVideoRecordAgent;
1.141 + iUidArray.Close();
1.142 + iAudioUidArray.Close();
1.143 + iVideoUidArray.Close();
1.144 + iAudioPlayUidArray.Close();
1.145 + iOverlayText.Close();
1.146 + delete iPluginInfo;
1.147 + delete iPluginArray;
1.148 + delete iExtArray;
1.149 + delete iCodecArray;
1.150 + delete iMetaTitle;
1.151 + delete iMetaAuthor;
1.152 + delete iMetaCopyright;
1.153 + delete iMetaRevision;
1.154 + delete iMetaCategory;
1.155 + delete iMetaComments;
1.156 + iMainWindowText.Reset();
1.157 + if(iLogger.Handle())
1.158 + {
1.159 + iLogger.CloseLog();
1.160 + iLogger.Close();
1.161 + }
1.162 + iLogs.Close();
1.163 + delete iViewTicker;
1.164 + delete iSettingManager;
1.165 + iVideoCtls.ResetAndDestroy();
1.166 + delete iAppView;
1.167 + }
1.168 +
1.169 +//All the user actvated actions in the UI is captured and handled
1.170 +//through here
1.171 +void CMVSAppUi::HandleCommandL(TInt aCommand)
1.172 + {
1.173 + TBool needsUpdating = ETrue;
1.174 + switch (aCommand)
1.175 + {
1.176 + case EMVSCmdNew:
1.177 + {
1.178 + if( iMode != EIdle )
1.179 + {
1.180 + return;//dont get into record mode,as the system is still in a previous active state,Playing/Recording.
1.181 + }
1.182 + FileOpenForRecordL();
1.183 + }
1.184 + break;
1.185 +
1.186 +
1.187 + case EMVSCmdOpen:
1.188 + {
1.189 + if(iState == EAudioPlaying || iState == EVideoPlaying || iState == EAudioRecording || iState == EVideoRecording || iMode == EVideoRecord || iMode == EAudioRecord)
1.190 + {
1.191 + return;//dont get into record mode,as the system is still in a previous active state,Playing/Recording.
1.192 + }
1.193 + Reset();
1.194 + FileOpenL();
1.195 + iLogger.Write(_L("Opened for Play"));
1.196 + }
1.197 + break;
1.198 +
1.199 + case EMVSCmdMultiScreen:
1.200 + {
1.201 + iSetScreen->SetupDialogLD(iScreenNumber,this);
1.202 + }
1.203 + break;
1.204 +
1.205 + case EMVSRegisterForNotification:
1.206 + {
1.207 + iRegisterForNotification->SetupDialogLD(this);
1.208 + }
1.209 + break;
1.210 +
1.211 + case EMVSCmdSetVolume:
1.212 + {
1.213 + if((iMode == EAudioPlay) || (iMode == EVideoPlay))
1.214 + {
1.215 + iVolumeDialog->SetupDialogLD(iVolumeOrGain,0,0, ETrue, this);
1.216 + iLogger.Write(_L("volume set"));
1.217 + }
1.218 + else if((iMode == EAudioRecord)||(iMode == EVideoRecord))
1.219 + {
1.220 + iVolumeDialog->SetupDialogLD(iVolumeOrGain,0,0, EFalse, this);
1.221 + iLogger.Write(_L("gain set"));
1.222 + }
1.223 + }
1.224 + break;
1.225 +
1.226 +
1.227 + case EMVSCmdSetPlayBalance:
1.228 + {
1.229 + iBalanceDialog->SetupDialogLD(iBalance,this, ETrue);
1.230 + iLogger.Write(_L("Balance Set"));
1.231 + }
1.232 + break;
1.233 +
1.234 +
1.235 + case EMVSCmdSetRecordBalance:
1.236 + {
1.237 + iBalanceDialog->SetupDialogLD(0,this, EFalse);
1.238 + }
1.239 + break;
1.240 +
1.241 +
1.242 + case EMVSCmdSetRepeats:
1.243 + {
1.244 + iRepeatDialog->SetupDialogLD(iNoRepeats,iRepeatDelay, this);
1.245 + iLogger.Write(_L("Repeats Set"));
1.246 + }
1.247 + break;
1.248 +
1.249 + case EMVSCmdEditMetadata:
1.250 + {
1.251 + iMetaArray.Reset();
1.252 + if(iMetaArray.Count() == 0)
1.253 + {
1.254 + InitializeMetaArrayL();
1.255 + }
1.256 + switch(iMode)
1.257 + {
1.258 + case EAudioRecord:
1.259 + case EVideoRecord:
1.260 + {
1.261 + iEditMetaInfoDialog->SetupDialogLD(iMetaArray,this);
1.262 + iLogger.Write(_L("MetaData Edited"));
1.263 + iMetaArray.Close();
1.264 + }
1.265 + break;
1.266 +
1.267 + case EAudioPlay:
1.268 + case EVideoPlay:
1.269 + {
1.270 + iViewMetaInfoDialog->SetupDialogLD(iMetaArray,this);
1.271 + iLogger.Write(_L("MetaData View"));
1.272 + iMetaArray.Close();
1.273 + }
1.274 + }
1.275 + }
1.276 + break;
1.277 +
1.278 +
1.279 + case EMVSCmdExit:
1.280 + {
1.281 + if (iDisplayAdded)
1.282 + {
1.283 + iVideoPlayAgent->RemoveDisplayWindowL(iVideoCtl->ControlWindow());
1.284 + iVideoPlayAgent->RemoveDisplayWindowL(iVideoCtl->Pip().ControlWindow());
1.285 + iVideoPlayAgent->RemoveDisplay(iVideoCtl->ScreenNumber());
1.286 + iVideoCtl->Pip().Clear();
1.287 + iDisplayAdded = EFalse;
1.288 + }
1.289 +
1.290 + iLogger.Write(_L("Application EXIT"));
1.291 + iSettingManager->WriteGeneralSettingsL(this);
1.292 + Exit();
1.293 + }
1.294 + break;
1.295 +
1.296 +
1.297 + case EMVSCmdPlay:
1.298 + {
1.299 + if(!iButtons->IsCommandDimmed(EMVSCmdPlay))
1.300 + {
1.301 + switch(iMode)
1.302 + {
1.303 + case EAudioPlay:
1.304 + {
1.305 + iAppView->iStatusWindowTimeControl->ResetText2L();
1.306 + SetVolumeL(iVolumeOrGain,0);
1.307 + iButtons->DimCommand(EMVSCmdRecord, ETrue);
1.308 + iButtons->DrawNow();
1.309 + if(iState == ENotReady)
1.310 + {
1.311 + FileOpenL();
1.312 + iAutoplay=ETrue;
1.313 + }
1.314 + else
1.315 + {
1.316 + iAudioPlayAgent->Play();
1.317 + iLogger.Write(_L("Playing using AudioPlayAgent"));
1.318 + }
1.319 + }
1.320 + break;
1.321 +
1.322 + case EAudioRecord:
1.323 + {
1.324 + iAppView->iStatusWindowTimeControl->ResetText2L();
1.325 + SetVolumeL(iVolumeOrGain,0);
1.326 + iAudioRecordAgent->PlayL();
1.327 + iLogger.Write(_L("Playing using AudioRecordAgent"));
1.328 + }
1.329 + break;
1.330 +
1.331 + case EVideoPlay:
1.332 + {
1.333 + if (iVideoPlayAgent->AudioEnabledL())
1.334 + {
1.335 + SetVolumeL(iVolumeOrGain, 0);
1.336 + }
1.337 + iButtons->DimCommand(EMVSCmdSetRepeats, ETrue);
1.338 + iButtons->DrawNow();
1.339 +
1.340 +#ifdef SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS
1.341 + if (iVideoPlayAgent->SupportVideoPlayerUtility2())
1.342 + {
1.343 + PrepareVideoControlsL();
1.344 + }
1.345 +#endif // SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS
1.346 + iVideoPlayAgent->Play();
1.347 + iLogger.Write(_L("Playing using VideoPlayAgent"));
1.348 + }
1.349 + break;
1.350 +
1.351 + case EIdle:
1.352 + case EVideoRecord:
1.353 + break;
1.354 +
1.355 + default:
1.356 + ASSERT(EFalse);
1.357 + break;
1.358 + }
1.359 + }
1.360 + else
1.361 + {
1.362 + needsUpdating = EFalse;
1.363 + }
1.364 + }
1.365 + break;
1.366 +
1.367 +
1.368 + case EMVSCmdRecord:
1.369 + {
1.370 + if(!iButtons->IsCommandDimmed(EMVSCmdRecord))
1.371 + {
1.372 + switch(iMode)
1.373 + {
1.374 + case EAudioRecord:
1.375 + {
1.376 + iAudioRecordAgent->RecordL();
1.377 + iLogger.Write(_L("Recording using AudioRecordAgent"));
1.378 + iButtons->DimCommand(EMVSCmdRecord, ETrue);
1.379 + iButtons->DimCommand(EMVSCmdPlay, ETrue);
1.380 + iButtons->DrawNow();
1.381 + }
1.382 + break;
1.383 + case EVideoRecord:
1.384 + {
1.385 + //start view finder and record
1.386 + CCamera *camera = iVideoRecordAgent->Camera();
1.387 + TSize imageSize;
1.388 + camera->EnumerateCaptureSizes(imageSize,1,CCamera::EFormatFbsBitmapColor16M);
1.389 + TPoint pos = DrawBorders(imageSize);
1.390 + TRect clientRect = ClientRect();
1.391 + pos.iY += clientRect.iTl.iY;//add y-offset for menu bar
1.392 + TRect screenRect(pos,imageSize);
1.393 + TRect clipRect = screenRect ;
1.394 + if (!camera->ViewFinderActive())
1.395 + {
1.396 + CCoeEnv *coenv = iAppView->iMainWindowControl->ControlEnv();
1.397 + camera->StartViewFinderDirectL( coenv->WsSession(),
1.398 + *coenv->ScreenDevice(),
1.399 + *iAppView->DrawableWindow(),
1.400 + screenRect,
1.401 + clipRect);
1.402 + }
1.403 + if (!iFileReplace)
1.404 + {
1.405 + SetVideoFrameRateL(iVideoFrameRate);
1.406 + SetVideoFrameSizeL(iFrameSize);
1.407 + SetAudioEnabledL(iAudioEnabled);
1.408 + }
1.409 + iVideoRecordAgent->Record();
1.410 + iLogger.Write(_L("Recording using VideoRecordAgent"));
1.411 + iButtons->DimCommand(EMVSCmdRecord, ETrue);
1.412 + iButtons->DimCommand(EMVSCmdPlay, ETrue);
1.413 + iButtons->DrawNow();
1.414 + }
1.415 + break;
1.416 + default:
1.417 + ASSERT(EFalse);
1.418 + break;
1.419 + }
1.420 + }
1.421 + else
1.422 + {
1.423 + needsUpdating = EFalse;
1.424 + }
1.425 + }
1.426 + break;
1.427 +
1.428 +
1.429 + case EMVSCmdPause:
1.430 + {
1.431 + if(!iButtons->IsCommandDimmed(EMVSCmdPause))
1.432 + {
1.433 + switch(iMode)
1.434 + {
1.435 + case EAudioPlay:
1.436 + {
1.437 + iAudioPlayAgent->Pause();
1.438 + iLogger.Write(_L("AudioPlayAgent Paused"));
1.439 + iButtons->DimCommand(EMVSCmdPlay, EFalse);
1.440 + iButtons->DrawNow();
1.441 + }
1.442 + break;
1.443 +
1.444 + case EAudioRecord:
1.445 + {
1.446 + User::InfoPrint(KNotsupported);
1.447 + }
1.448 + break;
1.449 +
1.450 + case EVideoPlay:
1.451 + {
1.452 + iVideoPlayAgent->PauseL();
1.453 + iLogger.Write(_L("AudioPlayAgent Paused"));
1.454 + iButtons->DimCommand(EMVSCmdPlay, EFalse);
1.455 + iButtons->DrawNow();
1.456 + }
1.457 + break;
1.458 +
1.459 + case EVideoRecord:
1.460 + {
1.461 + iVideoRecordAgent->PauseL();
1.462 + iLogger.Write(_L("VideoRecordAgent Paused"));
1.463 + iButtons->DimCommand(EMVSCmdRecord, EFalse);
1.464 + iButtons->DrawNow();
1.465 + }
1.466 + break;
1.467 +
1.468 + case EIdle:
1.469 + break;
1.470 +
1.471 + default:
1.472 + ASSERT(EFalse);
1.473 + break;
1.474 + }
1.475 + }
1.476 + else
1.477 + {
1.478 + needsUpdating = EFalse;
1.479 + }
1.480 + }
1.481 + break;
1.482 +
1.483 +
1.484 + case EMVSCmdStop:
1.485 + {
1.486 + if(!iButtons->IsCommandDimmed(EMVSCmdStop))
1.487 + {
1.488 + switch(iMode)
1.489 + {
1.490 + case EAudioPlay:
1.491 + {
1.492 + iAudioPlayAgent->Stop();
1.493 + iLogger.Write(_L("AudioPlayAgent Stopped"));
1.494 + iButtons->DimCommand(EMVSCmdPlay, EFalse);
1.495 + iButtons->DrawNow();
1.496 + }
1.497 + break;
1.498 +
1.499 + case EAudioRecord:
1.500 + {
1.501 + iAudioRecordAgent->Stop();
1.502 + iLogger.Write(_L("AudioRecordAgent Stopped"));
1.503 + iButtons->DimCommand(EMVSCmdRecord, EFalse);
1.504 + iButtons->DrawNow();
1.505 + iButtons->DimCommand(EMVSCmdPlay, EFalse);
1.506 + iButtons->DrawNow();
1.507 + }
1.508 + break;
1.509 +
1.510 + case EVideoPlay:
1.511 + {
1.512 + iVideoPlayAgent->Stop();
1.513 + iLogger.Write(_L("VideoPlayAgent Stopped"));
1.514 + iButtons->DimCommand(EMVSCmdPlay, EFalse);
1.515 + iButtons->DrawNow();
1.516 + iAppView->DrawNow();
1.517 + }
1.518 + break;
1.519 +
1.520 + case EVideoRecord:
1.521 + {
1.522 + StopViewFinder();
1.523 + iVideoRecordAgent->Stop();
1.524 + iLogger.Write(_L("VideoRecordAgent Stopped"));
1.525 + iButtons->DimCommand(EMVSCmdRecord, EFalse);
1.526 + iButtons->DrawNow();
1.527 + }
1.528 + break;
1.529 +
1.530 + case EIdle:
1.531 + break;
1.532 +
1.533 + default:
1.534 + ASSERT(EFalse);
1.535 + break;
1.536 + }
1.537 + }
1.538 + else
1.539 + {
1.540 + needsUpdating = EFalse;
1.541 + }
1.542 + }
1.543 + break;
1.544 +
1.545 +
1.546 + case EMVSCmdSetPlayWindow:
1.547 + {
1.548 + iSetPlayWindow->SetupDialogLD(iStart,iEnd,iDuration,this);
1.549 + iLogger.Write(_L("AudioPlayAgent SetPlayWindow"));
1.550 + }
1.551 + break;
1.552 +
1.553 +
1.554 + case EMVSCmdClearPlayWindow:
1.555 + {
1.556 + iStart = 0;
1.557 + iEnd = iAudioPlayAgent->Duration();
1.558 + iAudioPlayAgent->ClearPlayWindow();
1.559 + iLogger.Write(_L("AudioPlayAgent ClearPlayWindow"));
1.560 + }
1.561 + break;
1.562 +
1.563 +
1.564 + case EMVSCmdSystemInfo:
1.565 + {
1.566 + iSystemInfo->SetupDialogLD(this);
1.567 + iLogger.Write(_L("System Info"));
1.568 + }
1.569 + break;
1.570 +
1.571 +
1.572 + case EMVSVideoCmdSettings:
1.573 + {
1.574 + if (iVideoPlayAgent->SupportVideoPlayerUtility2())
1.575 + {
1.576 + iVideoSetting->SetupDialogLD(iRotation, this, iVideoExtent, iWindowClipRect, ETrue, iPip, iCrp);
1.577 + }
1.578 + else
1.579 + {
1.580 + iVideoSetting->SetupDialogLD(iRotation,this, TRect(0, 0, 0, 0), TRect(0, 0, 0, 0), EFalse, EFalse, iCrp);
1.581 + }
1.582 + iLogger.Write(_L("Video Settings"));
1.583 + }
1.584 + break;
1.585 +
1.586 +
1.587 + case EMVSCmdAudioSetting:
1.588 + {
1.589 + iAudioSetting->SetupDialogLD(iNoRepeats,iRepeatDelay,iPriority,iPriorityPreference,iMaxFileBuffer, this);
1.590 + iLogger.Write(_L("Audio Setting"));
1.591 + }
1.592 + break;
1.593 +
1.594 +
1.595 + case EMVSCmdClose:
1.596 + {
1.597 + FileClose();
1.598 + iRecordLimitSet = EFalse;
1.599 + }
1.600 + break;
1.601 +
1.602 +
1.603 + case EMVSCmdSetCropWindow:
1.604 + {
1.605 + iCropPosition=0;
1.606 + iCropStart=GetCropStart();
1.607 + iClipLength = iAudioRecordAgent->Duration();
1.608 + iCropEnd=iClipLength;
1.609 + iCropDialog->SetupDialogLD(iCropPosition,iClipLength,0,iCropEnd,this);
1.610 + iLogger.Write(_L("CropWindow set"));
1.611 + }
1.612 + break;
1.613 +
1.614 + case EMVSCmdClearLog:
1.615 + {
1.616 +
1.617 + }
1.618 + break;
1.619 +#ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
1.620 + case EMVSCmdEnableSubtitles :
1.621 + {
1.622 + iVideoPlayAgent->EnableSubtitlesL();
1.623 + }
1.624 + break;
1.625 + case EMVSCmdDisableSubtitles :
1.626 + {
1.627 + iVideoPlayAgent->DisableSubtitlesL();
1.628 + }
1.629 + break;
1.630 +#endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
1.631 + }
1.632 + if(needsUpdating)
1.633 + {
1.634 + UpdateDisplayL(iState);
1.635 + }
1.636 + }
1.637 +
1.638 +void CMVSAppUi::PrepareVideoControlsL()
1.639 + {
1.640 + if (iDisplayAdded)
1.641 + {
1.642 + iVideoPlayAgent->RemoveDisplayWindowL(iVideoCtl->ControlWindow());
1.643 + iVideoPlayAgent->RemoveDisplay(iVideoCtl->ScreenNumber());
1.644 + TRAP_IGNORE(iVideoPlayAgent->RemoveDisplayWindowL(iVideoCtl->Pip().ControlWindow()));
1.645 + iDisplayAdded = EFalse;
1.646 + }
1.647 +
1.648 + iVideoCtl = iAppView->iMainWindowControl;
1.649 +
1.650 + CCoeEnv* env = CCoeEnv::Static();
1.651 +
1.652 + if (iScreenNumber > 0)
1.653 + {
1.654 + // Video ctls start at 0 in index for display 1
1.655 + iVideoCtl = iVideoCtls[iScreenNumber - 1];
1.656 + }
1.657 +
1.658 + TRect extent = iVideoExtentSet ? iVideoExtent : iVideoCtl->Rect();
1.659 + TRect clip = iWindowClipRectSet ? iWindowClipRect : iVideoCtl->Rect();
1.660 + iVideoPlayAgent->AddDisplayWindowL(env->WsSession(), *(env->ScreenDevice(iScreenNumber)), iVideoCtl->ControlWindow(), extent, clip);
1.661 + iDisplayAdded = ETrue;
1.662 +
1.663 + if (iPip)
1.664 + {
1.665 + // Picture-in-picture has been enabled.
1.666 + TSize videoFrameSize;
1.667 + iVideoPlayAgent->VideoFrameSizeL(videoFrameSize);
1.668 + TSize winSize = iVideoCtl->Size();
1.669 +
1.670 + // Picture-in-picture should be an 8th of original
1.671 + videoFrameSize.iHeight /= 4;
1.672 + videoFrameSize.iWidth /= 4;
1.673 +
1.674 + TPoint pipLoc(winSize.iWidth - (videoFrameSize.iWidth + 4), 4);
1.675 +
1.676 + iVideoCtl->Pip().SetExtent(pipLoc, videoFrameSize);
1.677 +
1.678 + if (iCrp)
1.679 + {
1.680 + iVideoCtl->EnablePip(CMVSPipControl::EUseCrp);
1.681 + iVideoPlayAgent->AddDisplayL(env->WsSession(), iScreenNumber, iVideoCtl->Pip());
1.682 + }
1.683 + else
1.684 + {
1.685 + iVideoCtl->EnablePip(CMVSPipControl::EUseMmf);
1.686 + iVideoPlayAgent->AddDisplayWindowL(env->WsSession(), *(env->ScreenDevice(iScreenNumber)), iVideoCtl->Pip().ControlWindow());
1.687 + iVideoPlayAgent->SetAutoScaleL(iVideoCtl->Pip().ControlWindow(), EAutoScaleBestFit, EHorizontalAlignCenter, EVerticalAlignCenter);
1.688 + }
1.689 + }
1.690 + else
1.691 + {
1.692 + // Picture-in-picture has been disabled.
1.693 + iVideoCtl->DisablePip();
1.694 + }
1.695 + }
1.696 +
1.697 +void CMVSAppUi::SetPosition(TTimeIntervalMicroSeconds& aPos)
1.698 + {
1.699 + if(iMode == EAudioPlay)
1.700 + {
1.701 + iAudioPlayAgent->SetPosition(aPos);
1.702 + }
1.703 + else if(iMode == EAudioRecord)
1.704 + {
1.705 + iAudioRecordAgent->SetPosition(aPos);
1.706 + }
1.707 + }
1.708 +
1.709 +//Opens a file for playing
1.710 +void CMVSAppUi::FileOpenL()
1.711 + {
1.712 + //Open the file dialog
1.713 + CEikFileOpenDialog* dialog = new (ELeave) CEikFileOpenDialog(&iSrcFName);
1.714 + TInt val = dialog->ExecuteLD(R_EIK_DIALOG_FILE_OPEN);
1.715 + if(val != 0)
1.716 + {
1.717 + TUid mediatype = iPluginInfo->GetMediaTypeL(iSrcFName);
1.718 + if(mediatype == KUidMediaTypeVideo)
1.719 + {
1.720 + TRect rect, clipRect;
1.721 + rect = clipRect = TRect(iAppView->iMainWindowControl->PositionRelativeToScreen(), iAppView->iMainWindowControl->Size());
1.722 +
1.723 + rect.Shrink(2,2);
1.724 + clipRect.Shrink(2,2);
1.725 +
1.726 + // Clear the area where the video will be displayed
1.727 +#ifdef SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS
1.728 + iVideoPlayAgent->SetVideoOutputL(iCoeEnv->WsSession(),
1.729 + *iCoeEnv->ScreenDevice(iScreenNumber),
1.730 + iVideoCtl->ControlWindow(),
1.731 + rect,
1.732 + clipRect);
1.733 +#else
1.734 + iVideoPlayAgent->SetVideoOutputL(iCoeEnv->WsSession(),
1.735 + *iCoeEnv->ScreenDevice(),
1.736 + iVideoCtl->ControlWindow(),
1.737 + rect,
1.738 + clipRect);
1.739 +#endif // SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS
1.740 +
1.741 + TInt res = iVideoPlayAgent->SetScreenNumber(iScreenNumber);
1.742 + if(res == KErrNotSupported)
1.743 + {
1.744 + User::InfoPrint(KMultiScreenNotsupported);
1.745 + }
1.746 + //Enable AP&R for register notification made before opening the file
1.747 + if(iRegistered)
1.748 + {
1.749 + TInt regerr = iVideoPlayAgent->RegisterForNotification();
1.750 + if(regerr == KErrNone)
1.751 + {
1.752 + User::InfoPrint(KRegisterSuccess);
1.753 + }
1.754 + else
1.755 + {
1.756 + User::InfoPrint(KRegisterFailure);
1.757 + }
1.758 + }
1.759 + else if(iAlreadyRegistered)
1.760 + {
1.761 + TInt cancelerr = iVideoPlayAgent->CancelNotification();
1.762 + if(cancelerr == KErrNone)
1.763 + {
1.764 + iAlreadyRegistered = EFalse;
1.765 + User::InfoPrint(KRegisterCancelation);
1.766 + }
1.767 + else
1.768 + {
1.769 + User::InfoPrint(KCancelationFailure);
1.770 + }
1.771 + }
1.772 + iVideoPlayAgent->OpenFileL(iSrcFName);
1.773 + iMode = EVideoPlay;
1.774 + }
1.775 + else if(mediatype == KUidMediaTypeAudio)
1.776 + {
1.777 + iAudioPlayAgent->OpenFileL(iSrcFName);
1.778 + iMode = EAudioPlay;
1.779 + iButtons->DimCommand(EMVSCmdSetVolume,EFalse);
1.780 + iButtons->DrawNow();
1.781 + }
1.782 + else
1.783 + {
1.784 + User::InfoPrint(KNotSupported);
1.785 + }
1.786 + }
1.787 + return;
1.788 + }
1.789 +
1.790 +//Opens a new or existing file to record.
1.791 +void CMVSAppUi::FileOpenForRecordL()
1.792 + {
1.793 + iExtArray->Reset();
1.794 + iPluginArray->Reset();
1.795 + iCodecArray->Reset();
1.796 + iSelectedPluginIdx = KBeforeSelectingController;
1.797 + iSelectPluginsDialog->SetupDialogLD(iPluginArray,iExtArray, iCodecArray, this);
1.798 + //Indicates that the controller wasnt selected, leave it to the MMF to select
1.799 + //tha appropriate controller.
1.800 + if(iSelectedPluginIdx == KControllerNotSelected)
1.801 + {
1.802 + iControllerUid = TUid::Null();
1.803 + }
1.804 + else
1.805 + {
1.806 + if(iMediaType)
1.807 + {
1.808 + iControllerUid = iVideoUidArray[iSelectedPluginIdx];
1.809 + }
1.810 + else
1.811 + {
1.812 + iControllerUid = iAudioUidArray[iSelectedPluginIdx];
1.813 + }
1.814 + }
1.815 + if(!iMediaType)
1.816 + {
1.817 + iMode = EAudioRecord;
1.818 + }
1.819 + else if(iMediaType)
1.820 + {
1.821 + iMode = EVideoRecord;
1.822 + }
1.823 + SaveAsDialogL();
1.824 + }
1.825 +
1.826 +void CMVSAppUi::FileClose()
1.827 + {
1.828 + iButtons->DimCommand(EMVSCmdSetVolume, ETrue);
1.829 + iButtons->DimCommand(EMVSCmdRecord, ETrue);
1.830 + switch(iMode)
1.831 + {
1.832 + case EAudioPlay:
1.833 + {
1.834 + iAudioPlayAgent->Stop();
1.835 + iLogger.Write(_L("AudioPlayAgent Close"));
1.836 + }
1.837 + break;
1.838 +
1.839 + case EAudioRecord:
1.840 + {
1.841 + iAudioRecordAgent->Stop();
1.842 + iLogger.Write(_L("AudioRecordAgent Close"));
1.843 + }
1.844 + break;
1.845 +
1.846 + case EVideoPlay:
1.847 + {
1.848 + iVideoPlayAgent->Close();
1.849 + iLogger.Write(_L("VideoPlayAgent Close"));
1.850 + iAppView->DrawNow();
1.851 + }
1.852 + break;
1.853 +
1.854 + case EVideoRecord:
1.855 + {
1.856 + iVideoRecordAgent->Close();
1.857 + iLogger.Write(_L("VideoRecordAgent Close"));
1.858 + }
1.859 + break;
1.860 +
1.861 + default:
1.862 + break;
1.863 + }
1.864 + Reset();
1.865 + }
1.866 +
1.867 +
1.868 +void CMVSAppUi::SaveAsDialogL()
1.869 + {
1.870 + iFileReplace = ETrue;
1.871 + TInt errVal = iSaveAsDialog->SetupDialogLD(iDestFilename, &iFileReplace);
1.872 + if(errVal)
1.873 + {
1.874 + DetermineFinalFNameL();
1.875 + if(iProceed)
1.876 + {
1.877 + iOpeningForRecord=ETrue;
1.878 + RFs fs = CCoeEnv::Static()->FsSession();
1.879 + if(iMode==EAudioRecord)
1.880 + {
1.881 + TInt uidcount = iAudioPlayUidArray.Count();
1.882 + TUid playcontrollerUid = TUid::Null();
1.883 + if(uidcount)
1.884 + {
1.885 + playcontrollerUid = iAudioPlayUidArray[0];
1.886 + }
1.887 + if(iFileReplace)
1.888 + {
1.889 + fs.Delete(iDestFilename);
1.890 + }
1.891 + iAudioRecordAgent->CreateNewFileL(iDestFilename,iControllerUid,playcontrollerUid);
1.892 + iLogger.Write(_L("Opened file for Audio Record"));
1.893 + iRecFName.Copy(iDestFilename);
1.894 + iButtons->DimCommand(EMVSCmdRecord, EFalse);
1.895 + iButtons->DrawNow();
1.896 + }
1.897 +
1.898 + else if(iMode==EVideoRecord)
1.899 + {
1.900 + if(iFileReplace)
1.901 + {
1.902 + fs.Delete(iDestFilename);
1.903 + }
1.904 + TInt err = iVideoRecordAgent->OpenFileL(iDestFilename,iControllerUid);
1.905 + if(err != KErrNone)
1.906 + {
1.907 + iLogger.Write(_L("ECam Object creation failed"));
1.908 + User::InfoPrint(KVideoError);
1.909 + }
1.910 + else
1.911 + {
1.912 + iLogger.Write(_L("Opened file for Video Record"));
1.913 + iRecFName.Copy(iDestFilename);
1.914 + iButtons->DimCommand(EMVSCmdRecord, EFalse);
1.915 + iButtons->DrawNow();
1.916 + }
1.917 + }
1.918 + }
1.919 + }
1.920 + else
1.921 + {
1.922 + iMode = EIdle;
1.923 + UpdateStateChange(ENotReady , KErrNone);
1.924 + }
1.925 + }
1.926 +
1.927 +//The state change calls from the agents
1.928 +void CMVSAppUi::UpdateStateChange(TMVSState aState, TInt aError)
1.929 + {
1.930 + TInt error = aError;
1.931 + //if state changes from EVideoRecording and view finder is running, stop it.
1.932 + if(iState == EVideoRecording && aState != EVideoRecording)
1.933 + {
1.934 + StopViewFinder();
1.935 + }
1.936 + //if playback stops, redraw the app view
1.937 + if(iState == EVideoPlaying && aState != EVideoPlaying)
1.938 + {
1.939 + // the last frame is still on the display, but nothing is in charge
1.940 + // of redrawing it. this would otherwise lead to graphical glitches
1.941 + // as the frame is partially erased over time.
1.942 + iAppView->iMainWindowControl->DrawNow();
1.943 + }
1.944 + iState=aState;
1.945 + if(error == KErrNone)
1.946 + {
1.947 + if(aState == EAudioOpened)
1.948 + {
1.949 + iAppView->ResetProgressBar();
1.950 + iButtons->DimCommand(EMVSCmdPlay,EFalse);
1.951 + iButtons->DrawNow();
1.952 + if(iMode == EAudioPlay)
1.953 + {
1.954 + iButtons->DimCommand(EMVSCmdRecord,ETrue);
1.955 + iDuration = iAudioPlayAgent->Duration();
1.956 + if((iStart == 0) && (iEnd == 0))
1.957 + {
1.958 + iStart = 0;
1.959 + iEnd = iDuration;
1.960 + }
1.961 + }
1.962 + if(iButtons->IsCommandDimmed(EMVSCmdSetRepeats))
1.963 + {
1.964 + iButtons->DimCommand(EMVSCmdSetRepeats,EFalse);
1.965 + iButtons->DrawNow();
1.966 + }
1.967 + if(iButtons->IsCommandDimmed(EMVSCmdSetPlayBalance))
1.968 + {
1.969 + iButtons->DimCommand(EMVSCmdSetPlayBalance,EFalse);
1.970 + iButtons->DrawNow();
1.971 + }
1.972 + //Provided to automatically start playing, when the play button is selected
1.973 + //without opening a file through the file menu.
1.974 + if(iAutoplay)
1.975 + {
1.976 + iAudioPlayAgent->Play();
1.977 + iAutoplay=EFalse;
1.978 + }
1.979 + if(iMode == EAudioRecord && !iOpeningForRecord)
1.980 + {
1.981 + iButtons->DimCommand(EMVSCmdRecord,EFalse);
1.982 + iButtons->DimCommand(EMVSCmdPlay,EFalse);
1.983 + iButtons->DrawNow();
1.984 + }
1.985 + //Pop the Audio Record Settings Dialogue
1.986 + if(iMode == EAudioRecord && iOpeningForRecord && iSelectedPluginIdx !=-2)
1.987 + {
1.988 + iButtons->DimCommand(EMVSCmdSetPlayBalance,EFalse);
1.989 + if(iButtons->IsCommandDimmed(EMVSCmdRecord))
1.990 + {
1.991 + iButtons->DimCommand(EMVSCmdRecord,EFalse);
1.992 + iButtons->DrawNow();
1.993 + }
1.994 + //if appending to an existing file no need to re-enter the controller configuration.
1.995 + if(iFileReplace)
1.996 + {
1.997 + if(!iMediaType && iSelectedPluginIdx !=-1)
1.998 + {
1.999 + TRAP(error, iConfigFormatDialog->SetupDialogLD(this,iAudioUidArray[iSelectedPluginIdx],iSettingManager) );
1.1000 + iOpeningForRecord = EFalse;
1.1001 + }
1.1002 + }
1.1003 + }
1.1004 + }
1.1005 + else if(aState == EAudioPlaying)
1.1006 + {
1.1007 + iButtons->DimCommand(EMVSCmdPlay, ETrue);
1.1008 + iButtons->DimCommand(EMVSCmdRecord,ETrue);
1.1009 + iButtons->DimCommand(EMVSCmdPause, EFalse);
1.1010 + iButtons->DimCommand(EMVSCmdStop, EFalse);
1.1011 + iButtons->DrawNow();
1.1012 + }
1.1013 + else if(aState == ENotReady)
1.1014 + {
1.1015 + iButtons->DimCommand(EMVSCmdSetPlayBalance,EFalse);
1.1016 + iButtons->DimCommand(EMVSCmdSetVolume, ETrue);
1.1017 + iButtons->DimCommand(EMVSCmdRecord, ETrue);
1.1018 + iButtons->DimCommand(EMVSCmdPlay, EFalse);
1.1019 + iButtons->DrawNow();
1.1020 +
1.1021 + // File has been closed. Remove the display window if it was added.
1.1022 + if (iDisplayAdded)
1.1023 + {
1.1024 + TRAP(error, iVideoPlayAgent->RemoveDisplayWindowL(iVideoCtl->ControlWindow()));
1.1025 + TRAP(error, iVideoPlayAgent->RemoveDisplayWindowL(iVideoCtl->Pip().ControlWindow()));
1.1026 + iVideoPlayAgent->RemoveDisplay(iVideoCtl->ScreenNumber());
1.1027 + iVideoCtl->Pip().Clear();
1.1028 + iDisplayAdded = EFalse;
1.1029 + }
1.1030 + }
1.1031 + else if(aState == EAudioOpening)
1.1032 + {
1.1033 + iButtons->DimCommand(EMVSCmdSetVolume,EFalse);
1.1034 + }
1.1035 + else if(aState == EAudioPaused)
1.1036 + {
1.1037 + iButtons->DimCommand(EMVSCmdPause, ETrue);
1.1038 + iButtons->DrawNow();
1.1039 + }
1.1040 + else if(aState == EAudioStopped)
1.1041 + {
1.1042 + iAppView->ResetProgressBar();
1.1043 + iButtons->DimCommand(EMVSCmdStop, ETrue);
1.1044 + iButtons->DimCommand(EMVSCmdPause, ETrue);
1.1045 + iButtons->DrawNow();
1.1046 + }
1.1047 + else if(aState == EVideoPaused)
1.1048 + {
1.1049 + iButtons->DimCommand(EMVSCmdPause,ETrue);
1.1050 + iButtons->DrawNow();
1.1051 + }
1.1052 + else if(aState == EVideoStopped)
1.1053 + {
1.1054 + iButtons->DimCommand(EMVSCmdStop,ETrue);
1.1055 + iButtons->DimCommand(EMVSCmdPause, ETrue);
1.1056 + iButtons->DrawNow();
1.1057 + }
1.1058 + else if(aState == EVideoPlaying)
1.1059 + {
1.1060 + iButtons->DimCommand(EMVSCmdPlay, ETrue);
1.1061 + iButtons->DimCommand(EMVSCmdRecord,ETrue);
1.1062 + iButtons->DimCommand(EMVSCmdPause,ETrue);
1.1063 + iButtons->DimCommand(EMVSCmdStop,EFalse);
1.1064 + iButtons->DrawNow();
1.1065 + }
1.1066 + else if(aState == EVideoRecording)
1.1067 + {
1.1068 + iButtons->DimCommand(EMVSCmdPlay, ETrue);
1.1069 + iButtons->DimCommand(EMVSCmdRecord, ETrue);
1.1070 + iButtons->DimCommand(EMVSCmdPause,EFalse);
1.1071 + iButtons->DimCommand(EMVSCmdSetRepeats,ETrue);
1.1072 + iButtons->DrawNow();
1.1073 + }
1.1074 +
1.1075 + else if(aState == EAudioRecording)
1.1076 + {
1.1077 + iButtons->DimCommand(EMVSCmdPlay, ETrue);
1.1078 + iButtons->DimCommand(EMVSCmdRecord,ETrue);
1.1079 + iButtons->DimCommand(EMVSCmdPause,ETrue);
1.1080 + iButtons->DrawNow();
1.1081 + }
1.1082 + else if(aState == EVideoOpened )
1.1083 + {
1.1084 + //Pop the Video Record Settings Dialogue
1.1085 + iButtons->DimCommand(EMVSCmdPlay,EFalse);
1.1086 + iButtons->DimCommand(EMVSCmdPause,ETrue);
1.1087 + iButtons->DimCommand(EMVSCmdSetRepeats,ETrue);
1.1088 + iButtons->DrawNow();
1.1089 + if(iButtons->IsCommandDimmed(EMVSCmdSetPlayBalance))
1.1090 + {
1.1091 + iButtons->DimCommand(EMVSCmdSetPlayBalance,EFalse);
1.1092 + iButtons->DrawNow();
1.1093 + }
1.1094 + if(iMode==EVideoRecord && iOpeningForRecord)
1.1095 + {
1.1096 + iButtons->DimCommand(EMVSCmdSetPlayBalance,ETrue);
1.1097 + if(iFileReplace)
1.1098 + {
1.1099 + if(iMediaType && iSelectedPluginIdx !=-1)
1.1100 + {
1.1101 + TRAP(error, iVideoFormatDialog->SetupDialogLD(this,iVideoUidArray[iSelectedPluginIdx],iSettingManager) );
1.1102 + iOpeningForRecord=EFalse;
1.1103 + }
1.1104 + }
1.1105 + }
1.1106 + }
1.1107 + if(error != KErrNone)
1.1108 + {
1.1109 + LogErrors(error);
1.1110 + }
1.1111 + }
1.1112 + else if ((error == KErrEof) && (aState == EAudioStopped))
1.1113 + {
1.1114 + iButtons->DimCommand(EMVSCmdPlay, EFalse);
1.1115 + iButtons->DimCommand(EMVSCmdRecord,ETrue);
1.1116 + iButtons->DimCommand(EMVSCmdPause,EFalse);
1.1117 + iButtons->DimCommand(EMVSCmdStop,EFalse);
1.1118 + iButtons->DrawNow();
1.1119 + }
1.1120 + else
1.1121 + {
1.1122 + LogErrors(error);
1.1123 + }
1.1124 +
1.1125 + //As the state changes the display windows(views) contents also needs to be changed
1.1126 + TRAPD(err,UpdateDisplayL(iState));
1.1127 + if(err)
1.1128 + {
1.1129 + LogErrors(err);
1.1130 + iState = ENotReady;
1.1131 + FileClose();
1.1132 + }
1.1133 + }
1.1134 +
1.1135 +void CMVSAppUi::MvsResourceNotification(const TDesC8& /*aNotificationData*/)
1.1136 + {
1.1137 + if(iMode == EVideoPlay)
1.1138 + {
1.1139 + iVideoPlayAgent->Play();
1.1140 + }
1.1141 + }
1.1142 +//Return the current mode of the App
1.1143 +void CMVSAppUi::Reset()
1.1144 + {
1.1145 + iMode =EIdle;
1.1146 + iState =ENotReady;
1.1147 + iBitRate = 0;
1.1148 + iSampleRate = 0;
1.1149 + iChannels =0;
1.1150 + iAutoplay = EFalse;
1.1151 + iStart = 0;
1.1152 + iEnd = 0;
1.1153 + iDuration = 0;
1.1154 + }
1.1155 +
1.1156 +
1.1157 +//GetCropStart()
1.1158 +TTimeIntervalMicroSeconds CMVSAppUi::GetCropStart() const
1.1159 + {
1.1160 + return iCropStart;
1.1161 + }
1.1162 +
1.1163 +
1.1164 +// Returns the cropping end-point in microseconds
1.1165 +TTimeIntervalMicroSeconds CMVSAppUi::GetCropEnd() const
1.1166 + {
1.1167 + return iCropEnd;
1.1168 + }
1.1169 +
1.1170 +//Volume setting
1.1171 +void CMVSAppUi::SetVolumeL(TInt aVolume, TTimeIntervalMicroSeconds aRamp)
1.1172 + {
1.1173 + //Initialise the volume settings based on the parameters
1.1174 + iVolumeOrGain = aVolume;
1.1175 + iRamp = aRamp;
1.1176 + switch(iMode)
1.1177 + {
1.1178 + case EAudioPlay:
1.1179 + {
1.1180 + //And set the maximum volume based on the device's audio capabilities
1.1181 + iMaxVolume = iAudioPlayAgent->MaxVolume();
1.1182 + //Set the volume, and volume ramps.
1.1183 + iAudioPlayAgent->SetVolume((iVolumeOrGain*iMaxVolume)/100, iRamp);
1.1184 + }
1.1185 + break;
1.1186 +
1.1187 + case EAudioRecord:
1.1188 + {
1.1189 + //And set the maximum volume based on the device's audio capabilities
1.1190 + iMaxVolume = iAudioRecordAgent->MaxGain();
1.1191 + //Set the volume, and volume ramps.
1.1192 + iAudioRecordAgent->SetGain((iVolumeOrGain*iMaxVolume)/100);
1.1193 + }
1.1194 + break;
1.1195 +
1.1196 + case EVideoPlay:
1.1197 + {
1.1198 + iMaxVolume = iVideoPlayAgent->MaxVolume();
1.1199 + iVideoPlayAgent->SetVolumeL((iVolumeOrGain*iMaxVolume)/100);
1.1200 + }
1.1201 + break;
1.1202 +
1.1203 + case EVideoRecord:
1.1204 + {
1.1205 + iMaxVolume = iVideoRecordAgent->MaxGainL();
1.1206 + iVideoRecordAgent->SetGainL((iVolumeOrGain*iMaxVolume)/100);
1.1207 + }
1.1208 + break;
1.1209 +
1.1210 + case EIdle:
1.1211 + break;
1.1212 +
1.1213 + default:
1.1214 + ASSERT(EFalse);
1.1215 + break;
1.1216 + }
1.1217 + }
1.1218 +
1.1219 +
1.1220 +//Set repeats
1.1221 +void CMVSAppUi::SetRepeats(TInt aNoRepeats, TTimeIntervalMicroSeconds aDelay)
1.1222 + {
1.1223 + //Initialise the repeat variables based on the parameters
1.1224 + iNoRepeats = aNoRepeats;
1.1225 + iRepeatDelay = aDelay;
1.1226 + switch(iMode)
1.1227 + {
1.1228 + case EAudioPlay:
1.1229 + //Set the repeat settings based on these values
1.1230 + iAudioPlayAgent->SetRepeats(iNoRepeats, iRepeatDelay);
1.1231 + break;
1.1232 +
1.1233 + case EAudioRecord:
1.1234 + //Set the repeat settings based on these values
1.1235 + iAudioRecordAgent->SetRepeats(iNoRepeats, iRepeatDelay);
1.1236 + break;
1.1237 + default:
1.1238 + break;
1.1239 + }
1.1240 + }
1.1241 +
1.1242 +//Balance settings
1.1243 +//
1.1244 +//
1.1245 +//
1.1246 +// Sets the balance, based on the argument. This value is translated to both
1.1247 +// the playback AND recording balance for the device.
1.1248 +//
1.1249 +void CMVSAppUi::SetBalanceL(TInt aBalance)
1.1250 + {
1.1251 + iBalance = aBalance;
1.1252 + switch(iMode)
1.1253 + {
1.1254 + case EAudioPlay:
1.1255 + iAudioPlayAgent->SetBalance(iBalance);
1.1256 + break;
1.1257 +
1.1258 + case EAudioRecord:
1.1259 + iAudioRecordAgent->SetRecordBalance(iBalance);
1.1260 + break;
1.1261 +
1.1262 + case EVideoPlay:
1.1263 + iVideoPlayAgent->SetBalanceL(iBalance);
1.1264 + break;
1.1265 +
1.1266 + case EVideoRecord:
1.1267 + User::InfoPrint(KNotsupported);
1.1268 + break;
1.1269 +
1.1270 + case EIdle:
1.1271 + break;
1.1272 +
1.1273 + default:
1.1274 + ASSERT(EFalse);
1.1275 + break;
1.1276 +
1.1277 + }
1.1278 + }
1.1279 +
1.1280 +
1.1281 +//
1.1282 +//SetPriorityL(...)
1.1283 +//
1.1284 +// Sets the audio priority, and the priority preference, based on the
1.1285 +// arguments.
1.1286 +//
1.1287 +void CMVSAppUi::SetPriorityL(TInt aPriority,
1.1288 + TMdaPriorityPreference aPriorityPreference)
1.1289 + {
1.1290 + iPriority = aPriority;
1.1291 + iPriorityPreference = aPriorityPreference;
1.1292 + switch(iMode)
1.1293 + {
1.1294 + case EAudioPlay:
1.1295 + iAudioPlayAgent->SetPriority(iPriority,iPriorityPreference);
1.1296 + break;
1.1297 +
1.1298 + case EVideoPlay:
1.1299 + iVideoPlayAgent->SetPriorityL(iPriority,iPriorityPreference);
1.1300 + break;
1.1301 +
1.1302 + case EAudioRecord:
1.1303 + iAudioRecordAgent->SetPriority(iPriority,iPriorityPreference);
1.1304 + break;
1.1305 +
1.1306 + case EVideoRecord:
1.1307 + iVideoRecordAgent->SetPriorityL(iPriority,iPriorityPreference);
1.1308 + break;
1.1309 +
1.1310 + case EIdle:
1.1311 + break;
1.1312 +
1.1313 + default:
1.1314 + ASSERT(EFalse);
1.1315 + break;
1.1316 + }
1.1317 + }
1.1318 +
1.1319 +
1.1320 +//
1.1321 +//SetPlayWindow(...)
1.1322 +//
1.1323 +// Sets the play window, based on the
1.1324 +// arguments.
1.1325 +// return value indicates if the operation is successful or not.
1.1326 +TBool CMVSAppUi::SetPlayWindow(TTimeIntervalMicroSeconds aStart,
1.1327 + TTimeIntervalMicroSeconds aEnd)
1.1328 + {
1.1329 + iStart = aStart;
1.1330 + iEnd = aEnd;
1.1331 + TInt err = iAudioPlayAgent->SetPlayWindow(iStart,iEnd);
1.1332 + if(err != KErrNone)
1.1333 + {
1.1334 + LogErrors(err);
1.1335 + iStart = 0;
1.1336 + iEnd = iDuration;
1.1337 + return EFalse;
1.1338 + }
1.1339 + else
1.1340 + {
1.1341 + return ETrue;
1.1342 + }
1.1343 + }
1.1344 +
1.1345 +
1.1346 +//
1.1347 +//SetMetaDataL(...)
1.1348 +//
1.1349 +// Sets the MetaData, based on the arguments
1.1350 +//
1.1351 +void CMVSAppUi::SetMetaDataL(RPointerArray<CMMFMetaDataEntry> aMetaArray)
1.1352 + {
1.1353 + switch(iMode)
1.1354 + {
1.1355 + case EAudioRecord:
1.1356 + iAudioRecordAgent->SetMetaDataL(aMetaArray);
1.1357 + break;
1.1358 +
1.1359 + case EVideoRecord:
1.1360 + iVideoRecordAgent->SetMetaDataL(aMetaArray);
1.1361 + break;
1.1362 + default:
1.1363 + ASSERT(EFalse);
1.1364 + break;
1.1365 + }
1.1366 +
1.1367 + }
1.1368 +
1.1369 +
1.1370 +//
1.1371 +//GetMetaDataL(...)
1.1372 +//
1.1373 +// Sets the MetaData, based on the arguments
1.1374 +//
1.1375 +void CMVSAppUi::GetMetaDataL(RPointerArray<CMMFMetaDataEntry>& aMetaArray)
1.1376 + {
1.1377 + switch(iMode)
1.1378 + {
1.1379 + case EAudioPlay:
1.1380 + iAudioPlayAgent->GetMetaArrayL(aMetaArray);
1.1381 + break;
1.1382 +
1.1383 + case EVideoPlay:
1.1384 + iVideoPlayAgent->GetMetaDataArrayL(aMetaArray);
1.1385 + break;
1.1386 + default:
1.1387 + ASSERT(EFalse);
1.1388 + break;
1.1389 + }
1.1390 +
1.1391 + }
1.1392 +
1.1393 +
1.1394 +
1.1395 +//
1.1396 +//SetCrop(...)
1.1397 +//
1.1398 +// Sets the crop window, and also whether to crop from begining
1.1399 +// or end, based on the arguments passed
1.1400 +//
1.1401 +void CMVSAppUi::SetCropL(TTimeIntervalMicroSeconds aCropStart,TBool aCropFromBeginning)
1.1402 + {
1.1403 + iAudioRecordAgent->CropClipL(aCropStart,aCropFromBeginning);
1.1404 + iCropStart=aCropStart;
1.1405 + iCropFromBeginning=aCropFromBeginning;
1.1406 + }
1.1407 +
1.1408 +
1.1409 +void CMVSAppUi::SetBitRateL(TUint aBitRate)
1.1410 + {
1.1411 + TRAPD(err,iAudioRecordAgent->SetDestinationBitRateL(aBitRate));
1.1412 + if(err != KErrNone)
1.1413 + {
1.1414 + iLogger.Write(_L("SetDestinationBitRateL returned err"));
1.1415 + }
1.1416 + else
1.1417 + {
1.1418 + iBitRate = aBitRate;
1.1419 + }
1.1420 + }
1.1421 +
1.1422 +
1.1423 +void CMVSAppUi::SetSampleRateL(TUint aSampleRate)
1.1424 + {
1.1425 + iAudioRecordAgent->SetDestinationSampleRateL(aSampleRate);
1.1426 + iSampleRate = aSampleRate;
1.1427 + }
1.1428 +
1.1429 +void CMVSAppUi::SetChannelsL(TUint aNumberOfChannels)
1.1430 + {
1.1431 + iAudioRecordAgent->SetDestinationNumberOfChannelsL(aNumberOfChannels);
1.1432 + iChannels = aNumberOfChannels;
1.1433 + }
1.1434 +
1.1435 +void CMVSAppUi::SetCodecsL(TFourCC aDataType)
1.1436 + {
1.1437 + iAudioRecordAgent->SetDestinationDataTypeL(aDataType);
1.1438 + }
1.1439 +
1.1440 +
1.1441 +
1.1442 +void CMVSAppUi::InitializeMetaArrayL()
1.1443 + {
1.1444 + //Reset the meta array
1.1445 + iMetaArray.Reset();
1.1446 + if(iMetaTitle != NULL)
1.1447 + {
1.1448 + iMetaArray.AppendL(iMetaTitle);
1.1449 + }
1.1450 +
1.1451 + if(iMetaAuthor != NULL)
1.1452 + {
1.1453 + iMetaArray.AppendL(iMetaAuthor);
1.1454 + }
1.1455 +
1.1456 + if(iMetaCopyright != NULL)
1.1457 + {
1.1458 + iMetaArray.AppendL(iMetaCopyright);
1.1459 + }
1.1460 +
1.1461 + if(iMetaRevision != NULL)
1.1462 + {
1.1463 + iMetaArray.AppendL(iMetaRevision);
1.1464 + }
1.1465 +
1.1466 + if(iMetaCategory != NULL)
1.1467 + {
1.1468 + iMetaArray.AppendL(iMetaCategory);
1.1469 + }
1.1470 +
1.1471 + if(iMetaComments != NULL)
1.1472 + {
1.1473 + iMetaArray.AppendL(iMetaComments);
1.1474 + }
1.1475 + }
1.1476 +
1.1477 +//
1.1478 +//DynInitMenuPaneL(...) *** This method can LEAVE ***
1.1479 +//
1.1480 +// Initialises the availibility of controls on the menu bar depending on the
1.1481 +// current state of the MVSApp. This allows the application to
1.1482 +// constrain the availibility of controls which are inappropriate in certain
1.1483 +// states.
1.1484 +//
1.1485 +
1.1486 +void CMVSAppUi::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
1.1487 + {
1.1488 + switch(iMode)
1.1489 + {
1.1490 + case (EAudioRecord):
1.1491 + //File menu
1.1492 + if(aResourceId == R_MVS_FILE_MENU)
1.1493 + {
1.1494 + aMenuPane->SetItemDimmed(EMVSCmdNew,ETrue);
1.1495 + aMenuPane->SetItemDimmed(EMVSCmdOpen,ETrue);
1.1496 + aMenuPane->SetItemDimmed(EMVSCmdClose,EFalse);
1.1497 + aMenuPane->SetItemDimmed(EMVSCmdSystemInfo,EFalse);
1.1498 + aMenuPane->SetItemDimmed(EMVSCmdExit,EFalse);
1.1499 + }
1.1500 +
1.1501 + //Edit Menu
1.1502 + if(aResourceId == R_MVS_EDIT_MENU)
1.1503 + {
1.1504 + aMenuPane->SetItemDimmed(EMVSCmdSetCropWindow,EFalse);
1.1505 + aMenuPane->SetItemDimmed(EMVSCmdSetPlayWindow,ETrue);
1.1506 + aMenuPane->SetItemDimmed(EMVSCmdClearPlayWindow,ETrue);
1.1507 + }
1.1508 +
1.1509 + //Settings menu >
1.1510 + if(aResourceId == R_MVS_SETTINGS_MENU)
1.1511 + {
1.1512 + aMenuPane->SetItemDimmed(EMVSCmdAudioSetting,EFalse);
1.1513 + aMenuPane->SetItemDimmed(EMVSVideoCmdSettings,ETrue);
1.1514 + aMenuPane->SetItemDimmed(EMVSCmdEditMetadata,EFalse);
1.1515 + aMenuPane->SetItemDimmed(EMVSCmdClearLog,ETrue);
1.1516 +#ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
1.1517 + aMenuPane->SetItemDimmed(EMVSCmdEnableSubtitles, ETrue);
1.1518 + aMenuPane->SetItemDimmed(EMVSCmdDisableSubtitles, ETrue);
1.1519 +#endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
1.1520 + }
1.1521 +
1.1522 + if(iState == EAudioRecording)
1.1523 + {
1.1524 + //Controls menu
1.1525 + if(aResourceId == R_MVS_CONTROLS_MENU)
1.1526 + {
1.1527 + aMenuPane->SetItemDimmed(EMVSCmdPlay,ETrue);
1.1528 + aMenuPane->SetItemDimmed(EMVSCmdPause,ETrue);
1.1529 + aMenuPane->SetItemDimmed(EMVSCmdStop,EFalse);
1.1530 + aMenuPane->SetItemDimmed(EMVSCmdRewind,ETrue);
1.1531 + aMenuPane->SetItemDimmed(EMVSCmdFastForward,ETrue);
1.1532 + aMenuPane->SetItemDimmed(EMVSCmdRecord,ETrue);
1.1533 + }
1.1534 + }
1.1535 + else
1.1536 + {
1.1537 + if(aResourceId == R_MVS_CONTROLS_MENU)
1.1538 + {
1.1539 + aMenuPane->SetItemDimmed(EMVSCmdPlay,ETrue);
1.1540 + aMenuPane->SetItemDimmed(EMVSCmdPause,ETrue);
1.1541 + aMenuPane->SetItemDimmed(EMVSCmdStop,ETrue);
1.1542 + aMenuPane->SetItemDimmed(EMVSCmdRewind,ETrue);
1.1543 + aMenuPane->SetItemDimmed(EMVSCmdFastForward,ETrue);
1.1544 + aMenuPane->SetItemDimmed(EMVSCmdRecord,EFalse);
1.1545 + }
1.1546 + }
1.1547 + break;
1.1548 +
1.1549 +
1.1550 + case (EVideoRecord):
1.1551 + //File menu
1.1552 + if(aResourceId == R_MVS_FILE_MENU)
1.1553 + {
1.1554 + aMenuPane->SetItemDimmed(EMVSCmdNew,ETrue);
1.1555 + aMenuPane->SetItemDimmed(EMVSCmdOpen,ETrue);
1.1556 + aMenuPane->SetItemDimmed(EMVSCmdClose,EFalse);
1.1557 + aMenuPane->SetItemDimmed(EMVSCmdSystemInfo,EFalse);
1.1558 + aMenuPane->SetItemDimmed(EMVSCmdExit,EFalse);
1.1559 + }
1.1560 +
1.1561 + //Edit Menu
1.1562 + if(aResourceId == R_MVS_EDIT_MENU)
1.1563 + {
1.1564 + aMenuPane->SetItemDimmed(EMVSCmdSetCropWindow,ETrue);
1.1565 + aMenuPane->SetItemDimmed(EMVSCmdSetPlayWindow,ETrue);
1.1566 + aMenuPane->SetItemDimmed(EMVSCmdClearPlayWindow,ETrue);
1.1567 + }
1.1568 +
1.1569 + //Settings menu >
1.1570 + if(aResourceId == R_MVS_SETTINGS_MENU)
1.1571 + {
1.1572 + aMenuPane->SetItemDimmed(EMVSCmdAudioSetting,ETrue);
1.1573 + aMenuPane->SetItemDimmed(EMVSVideoCmdSettings,ETrue);
1.1574 + aMenuPane->SetItemDimmed(EMVSCmdEditMetadata,EFalse);
1.1575 + aMenuPane->SetItemDimmed(EMVSCmdClearLog,ETrue);
1.1576 +#ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
1.1577 + aMenuPane->SetItemDimmed(EMVSCmdEnableSubtitles, ETrue);
1.1578 + aMenuPane->SetItemDimmed(EMVSCmdDisableSubtitles, ETrue);
1.1579 +#endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
1.1580 + }
1.1581 +
1.1582 + if(iState == EVideoRecording)
1.1583 + {
1.1584 + //File menu
1.1585 + if(aResourceId == R_MVS_FILE_MENU)
1.1586 + {
1.1587 + aMenuPane->SetItemDimmed(EMVSCmdNew,ETrue);
1.1588 + aMenuPane->SetItemDimmed(EMVSCmdOpen,ETrue);
1.1589 + aMenuPane->SetItemDimmed(EMVSCmdClose,EFalse);
1.1590 + aMenuPane->SetItemDimmed(EMVSCmdSystemInfo,EFalse);
1.1591 + aMenuPane->SetItemDimmed(EMVSCmdExit,EFalse);
1.1592 + }
1.1593 +
1.1594 + //Controls menu
1.1595 + if(aResourceId == R_MVS_CONTROLS_MENU)
1.1596 + {
1.1597 + aMenuPane->SetItemDimmed(EMVSCmdPlay,ETrue);
1.1598 + aMenuPane->SetItemDimmed(EMVSCmdPause,ETrue);
1.1599 + aMenuPane->SetItemDimmed(EMVSCmdStop,EFalse);
1.1600 + aMenuPane->SetItemDimmed(EMVSCmdRewind,ETrue);
1.1601 + aMenuPane->SetItemDimmed(EMVSCmdFastForward,ETrue);
1.1602 + aMenuPane->SetItemDimmed(EMVSCmdRecord,ETrue);
1.1603 + }
1.1604 + }
1.1605 + else
1.1606 + {
1.1607 + if(aResourceId == R_MVS_CONTROLS_MENU)
1.1608 + {
1.1609 + aMenuPane->SetItemDimmed(EMVSCmdPlay,ETrue);
1.1610 + aMenuPane->SetItemDimmed(EMVSCmdPause,ETrue);
1.1611 + aMenuPane->SetItemDimmed(EMVSCmdStop,ETrue);
1.1612 + aMenuPane->SetItemDimmed(EMVSCmdRewind,ETrue);
1.1613 + aMenuPane->SetItemDimmed(EMVSCmdFastForward,ETrue);
1.1614 + aMenuPane->SetItemDimmed(EMVSCmdRecord,EFalse);
1.1615 + }
1.1616 + }
1.1617 + if(iState == EVideoOpened)
1.1618 + {
1.1619 + //File menu
1.1620 + if(aResourceId == R_MVS_FILE_MENU)
1.1621 + {
1.1622 + aMenuPane->SetItemDimmed(EMVSCmdNew,ETrue);
1.1623 + aMenuPane->SetItemDimmed(EMVSCmdOpen,ETrue);
1.1624 + aMenuPane->SetItemDimmed(EMVSCmdClose,EFalse);
1.1625 + aMenuPane->SetItemDimmed(EMVSCmdSystemInfo,EFalse);
1.1626 + aMenuPane->SetItemDimmed(EMVSCmdExit,EFalse);
1.1627 + }
1.1628 + }
1.1629 + if(iState == EVideoStopped)
1.1630 + {
1.1631 + //File menu
1.1632 + if(aResourceId == R_MVS_FILE_MENU)
1.1633 + {
1.1634 + aMenuPane->SetItemDimmed(EMVSCmdNew,ETrue);
1.1635 + aMenuPane->SetItemDimmed(EMVSCmdOpen,ETrue);
1.1636 + aMenuPane->SetItemDimmed(EMVSCmdClose,EFalse);
1.1637 + aMenuPane->SetItemDimmed(EMVSCmdSystemInfo,EFalse);
1.1638 + aMenuPane->SetItemDimmed(EMVSCmdExit,EFalse);
1.1639 + }
1.1640 + }
1.1641 + break;
1.1642 +
1.1643 + case (EAudioPlay):
1.1644 +
1.1645 + if(iState == EAudioOpened)
1.1646 + {
1.1647 + //File menu
1.1648 + if(aResourceId == R_MVS_FILE_MENU)
1.1649 + {
1.1650 + aMenuPane->SetItemDimmed(EMVSCmdNew,ETrue);
1.1651 + aMenuPane->SetItemDimmed(EMVSCmdOpen,EFalse);
1.1652 + aMenuPane->SetItemDimmed(EMVSCmdClose,EFalse);
1.1653 + aMenuPane->SetItemDimmed(EMVSCmdSystemInfo,EFalse);
1.1654 + aMenuPane->SetItemDimmed(EMVSCmdExit,EFalse);
1.1655 + }
1.1656 +
1.1657 + //Edit Menu
1.1658 + if(aResourceId == R_MVS_EDIT_MENU)
1.1659 + {
1.1660 + aMenuPane->SetItemDimmed(EMVSCmdSetCropWindow,ETrue);
1.1661 + aMenuPane->SetItemDimmed(EMVSCmdSetPlayWindow,EFalse);
1.1662 + aMenuPane->SetItemDimmed(EMVSCmdClearPlayWindow,EFalse);
1.1663 + }
1.1664 +
1.1665 + //Settings menu
1.1666 + if(aResourceId == R_MVS_SETTINGS_MENU)
1.1667 + {
1.1668 + aMenuPane->SetItemDimmed(EMVSCmdAudioSetting,EFalse);
1.1669 + aMenuPane->SetItemDimmed(EMVSVideoCmdSettings,ETrue);
1.1670 + //aMenuPane->SetItemDimmed(EMVSCmdEditMetadata,ETrue);
1.1671 + aMenuPane->SetItemDimmed(EMVSCmdClearLog,EFalse);
1.1672 +#ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
1.1673 + aMenuPane->SetItemDimmed(EMVSCmdEnableSubtitles, ETrue);
1.1674 + aMenuPane->SetItemDimmed(EMVSCmdDisableSubtitles, ETrue);
1.1675 +#endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
1.1676 + }
1.1677 +
1.1678 + //Controls menu
1.1679 + if(aResourceId == R_MVS_CONTROLS_MENU)
1.1680 + {
1.1681 + aMenuPane->SetItemDimmed(EMVSCmdPlay,EFalse);
1.1682 + aMenuPane->SetItemDimmed(EMVSCmdPause,ETrue);
1.1683 + aMenuPane->SetItemDimmed(EMVSCmdStop,ETrue);
1.1684 + aMenuPane->SetItemDimmed(EMVSCmdRewind,ETrue);
1.1685 + aMenuPane->SetItemDimmed(EMVSCmdFastForward,ETrue);
1.1686 + aMenuPane->SetItemDimmed(EMVSCmdRecord,ETrue);
1.1687 + }
1.1688 + }
1.1689 +
1.1690 + else if(iState == EAudioPlaying)
1.1691 + {
1.1692 + //File menu
1.1693 + if(aResourceId == R_MVS_FILE_MENU)
1.1694 + {
1.1695 + aMenuPane->SetItemDimmed(EMVSCmdNew,ETrue);
1.1696 + aMenuPane->SetItemDimmed(EMVSCmdOpen,ETrue);
1.1697 + aMenuPane->SetItemDimmed(EMVSCmdClose,EFalse);
1.1698 + aMenuPane->SetItemDimmed(EMVSCmdSystemInfo,EFalse);
1.1699 + aMenuPane->SetItemDimmed(EMVSCmdExit,EFalse);
1.1700 + }
1.1701 +
1.1702 + //Edit Menu
1.1703 + if(aResourceId == R_MVS_EDIT_MENU)
1.1704 + {
1.1705 + aMenuPane->SetItemDimmed(EMVSCmdSetCropWindow,ETrue);
1.1706 + aMenuPane->SetItemDimmed(EMVSCmdSetPlayWindow,ETrue);
1.1707 + aMenuPane->SetItemDimmed(EMVSCmdClearPlayWindow,ETrue);
1.1708 + }
1.1709 +
1.1710 + //Settings menu
1.1711 + if(aResourceId == R_MVS_SETTINGS_MENU)
1.1712 + {
1.1713 + aMenuPane->SetItemDimmed(EMVSCmdAudioSetting,ETrue);
1.1714 + aMenuPane->SetItemDimmed(EMVSVideoCmdSettings,ETrue);
1.1715 + aMenuPane->SetItemDimmed(EMVSCmdEditMetadata,ETrue);
1.1716 + aMenuPane->SetItemDimmed(EMVSCmdClearLog,EFalse);
1.1717 +#ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
1.1718 + aMenuPane->SetItemDimmed(EMVSCmdEnableSubtitles, ETrue);
1.1719 + aMenuPane->SetItemDimmed(EMVSCmdDisableSubtitles, ETrue);
1.1720 +#endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
1.1721 + }
1.1722 +
1.1723 + //Controls menu
1.1724 + if(aResourceId == R_MVS_CONTROLS_MENU)
1.1725 + {
1.1726 + aMenuPane->SetItemDimmed(EMVSCmdPlay,ETrue);
1.1727 + aMenuPane->SetItemDimmed(EMVSCmdPause,EFalse);
1.1728 + aMenuPane->SetItemDimmed(EMVSCmdStop,EFalse);
1.1729 + aMenuPane->SetItemDimmed(EMVSCmdRewind,ETrue);
1.1730 + aMenuPane->SetItemDimmed(EMVSCmdFastForward,ETrue);
1.1731 + aMenuPane->SetItemDimmed(EMVSCmdRecord,ETrue);
1.1732 + }
1.1733 + }
1.1734 +
1.1735 + else if(iState == EAudioPaused)
1.1736 + {
1.1737 + //File menu
1.1738 + if(aResourceId == R_MVS_FILE_MENU)
1.1739 + {
1.1740 + aMenuPane->SetItemDimmed(EMVSCmdNew,ETrue);
1.1741 + aMenuPane->SetItemDimmed(EMVSCmdOpen,EFalse);
1.1742 + aMenuPane->SetItemDimmed(EMVSCmdClose,EFalse);
1.1743 + aMenuPane->SetItemDimmed(EMVSCmdSystemInfo,EFalse);
1.1744 + aMenuPane->SetItemDimmed(EMVSCmdExit,EFalse);
1.1745 + }
1.1746 +
1.1747 + //Edit Menu
1.1748 + if(aResourceId == R_MVS_EDIT_MENU)
1.1749 + {
1.1750 + aMenuPane->SetItemDimmed(EMVSCmdSetCropWindow,ETrue);
1.1751 + aMenuPane->SetItemDimmed(EMVSCmdSetPlayWindow,EFalse);
1.1752 + aMenuPane->SetItemDimmed(EMVSCmdClearPlayWindow,EFalse);
1.1753 + }
1.1754 +
1.1755 + //Settings menu
1.1756 + if(aResourceId == R_MVS_SETTINGS_MENU)
1.1757 + {
1.1758 + aMenuPane->SetItemDimmed(EMVSCmdAudioSetting,EFalse);
1.1759 + aMenuPane->SetItemDimmed(EMVSVideoCmdSettings,ETrue);
1.1760 + aMenuPane->SetItemDimmed(EMVSCmdEditMetadata,ETrue);
1.1761 + aMenuPane->SetItemDimmed(EMVSCmdClearLog,EFalse);
1.1762 +#ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
1.1763 + aMenuPane->SetItemDimmed(EMVSCmdEnableSubtitles, ETrue);
1.1764 + aMenuPane->SetItemDimmed(EMVSCmdDisableSubtitles, ETrue);
1.1765 +#endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
1.1766 + }
1.1767 +
1.1768 + //Controls menu
1.1769 + if(aResourceId == R_MVS_CONTROLS_MENU)
1.1770 + {
1.1771 + aMenuPane->SetItemDimmed(EMVSCmdPlay,EFalse);
1.1772 + aMenuPane->SetItemDimmed(EMVSCmdPause,ETrue);
1.1773 + aMenuPane->SetItemDimmed(EMVSCmdStop,EFalse);
1.1774 + aMenuPane->SetItemDimmed(EMVSCmdRewind,ETrue);
1.1775 + aMenuPane->SetItemDimmed(EMVSCmdFastForward,ETrue);
1.1776 + aMenuPane->SetItemDimmed(EMVSCmdRecord,ETrue);
1.1777 + }
1.1778 + }
1.1779 + else if(iState == EAudioStopped)
1.1780 + {
1.1781 + //File menu
1.1782 + if(aResourceId == R_MVS_FILE_MENU)
1.1783 + {
1.1784 + aMenuPane->SetItemDimmed(EMVSCmdNew,ETrue);
1.1785 + aMenuPane->SetItemDimmed(EMVSCmdOpen,EFalse);
1.1786 + aMenuPane->SetItemDimmed(EMVSCmdClose,EFalse);
1.1787 + aMenuPane->SetItemDimmed(EMVSCmdSystemInfo,EFalse);
1.1788 + aMenuPane->SetItemDimmed(EMVSCmdExit,EFalse);
1.1789 + }
1.1790 +
1.1791 + //Edit Menu
1.1792 + if(aResourceId == R_MVS_EDIT_MENU)
1.1793 + {
1.1794 + aMenuPane->SetItemDimmed(EMVSCmdSetCropWindow,ETrue);
1.1795 + aMenuPane->SetItemDimmed(EMVSCmdSetPlayWindow,EFalse);
1.1796 + aMenuPane->SetItemDimmed(EMVSCmdClearPlayWindow,EFalse);
1.1797 + }
1.1798 +
1.1799 + //Settings menu
1.1800 + if(aResourceId == R_MVS_SETTINGS_MENU)
1.1801 + {
1.1802 + aMenuPane->SetItemDimmed(EMVSCmdAudioSetting,EFalse);
1.1803 + aMenuPane->SetItemDimmed(EMVSVideoCmdSettings,ETrue);
1.1804 + aMenuPane->SetItemDimmed(EMVSCmdEditMetadata,ETrue);
1.1805 + aMenuPane->SetItemDimmed(EMVSCmdClearLog,EFalse);
1.1806 +#ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
1.1807 + aMenuPane->SetItemDimmed(EMVSCmdEnableSubtitles, ETrue);
1.1808 + aMenuPane->SetItemDimmed(EMVSCmdDisableSubtitles, ETrue);
1.1809 +#endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
1.1810 + }
1.1811 +
1.1812 + //Controls menu
1.1813 + if(aResourceId == R_MVS_CONTROLS_MENU)
1.1814 + {
1.1815 + aMenuPane->SetItemDimmed(EMVSCmdPlay,EFalse);
1.1816 + aMenuPane->SetItemDimmed(EMVSCmdPause,ETrue);
1.1817 + aMenuPane->SetItemDimmed(EMVSCmdStop,ETrue);
1.1818 + aMenuPane->SetItemDimmed(EMVSCmdRewind,ETrue);
1.1819 + aMenuPane->SetItemDimmed(EMVSCmdFastForward,ETrue);
1.1820 + aMenuPane->SetItemDimmed(EMVSCmdRecord,ETrue);
1.1821 + }
1.1822 + }
1.1823 + break;
1.1824 +
1.1825 + case (EVideoPlay):
1.1826 + if(iState == EVideoOpened)
1.1827 + {
1.1828 + //File menu
1.1829 + if(aResourceId == R_MVS_FILE_MENU)
1.1830 + {
1.1831 + aMenuPane->SetItemDimmed(EMVSCmdNew,ETrue);
1.1832 + aMenuPane->SetItemDimmed(EMVSCmdOpen,ETrue);
1.1833 + aMenuPane->SetItemDimmed(EMVSCmdClose,EFalse);
1.1834 + aMenuPane->SetItemDimmed(EMVSCmdSystemInfo,EFalse);
1.1835 + aMenuPane->SetItemDimmed(EMVSCmdExit,EFalse);
1.1836 + }
1.1837 +
1.1838 + //Edit Menu
1.1839 + if(aResourceId == R_MVS_EDIT_MENU)
1.1840 + {
1.1841 + aMenuPane->SetItemDimmed(EMVSCmdSetCropWindow,ETrue);
1.1842 + aMenuPane->SetItemDimmed(EMVSCmdSetPlayWindow,ETrue);
1.1843 + aMenuPane->SetItemDimmed(EMVSCmdClearPlayWindow,ETrue);
1.1844 + }
1.1845 +
1.1846 + //Settings menu
1.1847 + if(aResourceId == R_MVS_SETTINGS_MENU)
1.1848 + {
1.1849 + aMenuPane->SetItemDimmed(EMVSCmdAudioSetting,ETrue);
1.1850 + aMenuPane->SetItemDimmed(EMVSVideoCmdSettings,EFalse);
1.1851 + aMenuPane->SetItemDimmed(EMVSCmdEditMetadata,ETrue);
1.1852 + aMenuPane->SetItemDimmed(EMVSCmdMultiScreen,EFalse);
1.1853 + aMenuPane->SetItemDimmed(EMVSCmdClearLog,EFalse);
1.1854 +#ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
1.1855 + TBool subAvail = iVideoPlayAgent->SubtitlesAvailable();
1.1856 + aMenuPane->SetItemDimmed(EMVSCmdEnableSubtitles, !subAvail);
1.1857 + aMenuPane->SetItemDimmed(EMVSCmdDisableSubtitles, !subAvail);
1.1858 +#endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
1.1859 + }
1.1860 +
1.1861 + //Controls menu
1.1862 + if(aResourceId == R_MVS_CONTROLS_MENU)
1.1863 + {
1.1864 + aMenuPane->SetItemDimmed(EMVSCmdPlay,EFalse);
1.1865 + aMenuPane->SetItemDimmed(EMVSCmdPause,ETrue);
1.1866 + aMenuPane->SetItemDimmed(EMVSCmdStop,ETrue);
1.1867 + aMenuPane->SetItemDimmed(EMVSCmdRewind,ETrue);
1.1868 + aMenuPane->SetItemDimmed(EMVSCmdFastForward,ETrue);
1.1869 + aMenuPane->SetItemDimmed(EMVSCmdRecord,ETrue);
1.1870 + }
1.1871 + }
1.1872 +
1.1873 + else if(iState == EVideoPlaying)
1.1874 + {
1.1875 + //File menu
1.1876 + if(aResourceId == R_MVS_FILE_MENU)
1.1877 + {
1.1878 + aMenuPane->SetItemDimmed(EMVSCmdNew,ETrue);
1.1879 + aMenuPane->SetItemDimmed(EMVSCmdOpen,ETrue);
1.1880 + aMenuPane->SetItemDimmed(EMVSCmdClose,EFalse);
1.1881 + aMenuPane->SetItemDimmed(EMVSCmdSystemInfo,ETrue);
1.1882 + aMenuPane->SetItemDimmed(EMVSCmdExit,EFalse);
1.1883 + }
1.1884 +
1.1885 + //Edit Menu
1.1886 + if(aResourceId == R_MVS_EDIT_MENU)
1.1887 + {
1.1888 + aMenuPane->SetItemDimmed(EMVSCmdSetCropWindow,ETrue);
1.1889 + aMenuPane->SetItemDimmed(EMVSCmdSetPlayWindow,ETrue);
1.1890 + aMenuPane->SetItemDimmed(EMVSCmdClearPlayWindow,ETrue);
1.1891 + }
1.1892 +
1.1893 + //Settings menu
1.1894 + if(aResourceId == R_MVS_SETTINGS_MENU)
1.1895 + {
1.1896 + aMenuPane->SetItemDimmed(EMVSCmdAudioSetting,ETrue);
1.1897 + aMenuPane->SetItemDimmed(EMVSVideoCmdSettings,EFalse);
1.1898 + aMenuPane->SetItemDimmed(EMVSCmdEditMetadata,ETrue);
1.1899 + aMenuPane->SetItemDimmed(EMVSCmdClearLog,EFalse);
1.1900 +#ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
1.1901 + TBool subAvail = iVideoPlayAgent->SubtitlesAvailable();
1.1902 + aMenuPane->SetItemDimmed(EMVSCmdEnableSubtitles, !subAvail);
1.1903 + aMenuPane->SetItemDimmed(EMVSCmdDisableSubtitles, !subAvail);
1.1904 +#endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
1.1905 + }
1.1906 +
1.1907 + //Controls menu
1.1908 + if(aResourceId == R_MVS_CONTROLS_MENU)
1.1909 + {
1.1910 + aMenuPane->SetItemDimmed(EMVSCmdPlay,ETrue);
1.1911 + aMenuPane->SetItemDimmed(EMVSCmdPause,ETrue);
1.1912 + aMenuPane->SetItemDimmed(EMVSCmdStop,EFalse);
1.1913 + aMenuPane->SetItemDimmed(EMVSCmdRewind,ETrue);
1.1914 + aMenuPane->SetItemDimmed(EMVSCmdFastForward,ETrue);
1.1915 + aMenuPane->SetItemDimmed(EMVSCmdRecord,ETrue);
1.1916 + }
1.1917 + }
1.1918 + else if(iState == EVideoPaused)
1.1919 + {
1.1920 + //File menu
1.1921 + if(aResourceId == R_MVS_FILE_MENU)
1.1922 + {
1.1923 + aMenuPane->SetItemDimmed(EMVSCmdNew,ETrue);
1.1924 + aMenuPane->SetItemDimmed(EMVSCmdOpen,EFalse);
1.1925 + aMenuPane->SetItemDimmed(EMVSCmdClose,EFalse);
1.1926 + aMenuPane->SetItemDimmed(EMVSCmdSystemInfo,EFalse);
1.1927 + aMenuPane->SetItemDimmed(EMVSCmdExit,EFalse);
1.1928 + }
1.1929 +
1.1930 + //Edit Menu
1.1931 + if(aResourceId == R_MVS_EDIT_MENU)
1.1932 + {
1.1933 + aMenuPane->SetItemDimmed(EMVSCmdSetCropWindow,ETrue);
1.1934 + aMenuPane->SetItemDimmed(EMVSCmdSetPlayWindow,ETrue);
1.1935 + aMenuPane->SetItemDimmed(EMVSCmdClearPlayWindow,ETrue);
1.1936 + }
1.1937 +
1.1938 + //Settings menu
1.1939 + if(aResourceId == R_MVS_SETTINGS_MENU)
1.1940 + {
1.1941 + aMenuPane->SetItemDimmed(EMVSCmdAudioSetting,ETrue);
1.1942 + aMenuPane->SetItemDimmed(EMVSVideoCmdSettings,EFalse);
1.1943 + aMenuPane->SetItemDimmed(EMVSCmdEditMetadata,ETrue);
1.1944 + aMenuPane->SetItemDimmed(EMVSCmdClearLog,EFalse);
1.1945 +#ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
1.1946 + TBool subAvail = iVideoPlayAgent->SubtitlesAvailable();
1.1947 + aMenuPane->SetItemDimmed(EMVSCmdEnableSubtitles, !subAvail);
1.1948 + aMenuPane->SetItemDimmed(EMVSCmdDisableSubtitles, !subAvail);
1.1949 +#endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
1.1950 + }
1.1951 +
1.1952 + //Controls menu
1.1953 + if(aResourceId == R_MVS_CONTROLS_MENU)
1.1954 + {
1.1955 + aMenuPane->SetItemDimmed(EMVSCmdPlay,EFalse);
1.1956 + aMenuPane->SetItemDimmed(EMVSCmdPause,ETrue);
1.1957 + aMenuPane->SetItemDimmed(EMVSCmdStop,EFalse);
1.1958 + aMenuPane->SetItemDimmed(EMVSCmdRewind,ETrue);
1.1959 + aMenuPane->SetItemDimmed(EMVSCmdFastForward,ETrue);
1.1960 + aMenuPane->SetItemDimmed(EMVSCmdRecord,ETrue);
1.1961 + }
1.1962 + }
1.1963 + else if(iState == EVideoStopped)
1.1964 + {
1.1965 + //File menu
1.1966 + if(aResourceId == R_MVS_FILE_MENU)
1.1967 + {
1.1968 + aMenuPane->SetItemDimmed(EMVSCmdNew,ETrue);
1.1969 + aMenuPane->SetItemDimmed(EMVSCmdOpen,EFalse);
1.1970 + aMenuPane->SetItemDimmed(EMVSCmdClose,EFalse);
1.1971 + aMenuPane->SetItemDimmed(EMVSCmdSystemInfo,EFalse);
1.1972 + aMenuPane->SetItemDimmed(EMVSCmdExit,EFalse);
1.1973 + }
1.1974 +
1.1975 + //Edit Menu
1.1976 + if(aResourceId == R_MVS_EDIT_MENU)
1.1977 + {
1.1978 + aMenuPane->SetItemDimmed(EMVSCmdSetCropWindow,ETrue);
1.1979 + aMenuPane->SetItemDimmed(EMVSCmdSetPlayWindow,ETrue);
1.1980 + aMenuPane->SetItemDimmed(EMVSCmdClearPlayWindow,ETrue);
1.1981 + }
1.1982 +
1.1983 + //Settings menu
1.1984 + if(aResourceId == R_MVS_SETTINGS_MENU)
1.1985 + {
1.1986 + aMenuPane->SetItemDimmed(EMVSCmdAudioSetting,ETrue);
1.1987 + aMenuPane->SetItemDimmed(EMVSVideoCmdSettings,EFalse);
1.1988 + aMenuPane->SetItemDimmed(EMVSCmdEditMetadata,ETrue);
1.1989 + aMenuPane->SetItemDimmed(EMVSCmdClearLog,EFalse);
1.1990 +#ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
1.1991 + TBool subAvail = iVideoPlayAgent->SubtitlesAvailable();
1.1992 + aMenuPane->SetItemDimmed(EMVSCmdEnableSubtitles, !subAvail);
1.1993 + aMenuPane->SetItemDimmed(EMVSCmdDisableSubtitles, !subAvail);
1.1994 +#endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
1.1995 + }
1.1996 +
1.1997 + //Controls menu
1.1998 + if(aResourceId == R_MVS_CONTROLS_MENU)
1.1999 + {
1.2000 + aMenuPane->SetItemDimmed(EMVSCmdPlay,EFalse);
1.2001 + aMenuPane->SetItemDimmed(EMVSCmdPause,ETrue);
1.2002 + aMenuPane->SetItemDimmed(EMVSCmdStop,ETrue);
1.2003 + aMenuPane->SetItemDimmed(EMVSCmdRewind,ETrue);
1.2004 + aMenuPane->SetItemDimmed(EMVSCmdFastForward,ETrue);
1.2005 + aMenuPane->SetItemDimmed(EMVSCmdRecord,ETrue);
1.2006 + }
1.2007 + }
1.2008 + break;
1.2009 +
1.2010 + case (EIdle):
1.2011 + //File menu
1.2012 + if(aResourceId == R_MVS_FILE_MENU)
1.2013 + {
1.2014 + aMenuPane->SetItemDimmed(EMVSCmdNew,EFalse);
1.2015 + aMenuPane->SetItemDimmed(EMVSCmdOpen,EFalse);
1.2016 + aMenuPane->SetItemDimmed(EMVSCmdClose,ETrue);
1.2017 + aMenuPane->SetItemDimmed(EMVSCmdSystemInfo,EFalse);
1.2018 + aMenuPane->SetItemDimmed(EMVSCmdExit,EFalse);
1.2019 + }
1.2020 +
1.2021 + //Edit Menu
1.2022 + if(aResourceId == R_MVS_EDIT_MENU)
1.2023 + {
1.2024 + aMenuPane->SetItemDimmed(EMVSCmdSetCropWindow,ETrue);
1.2025 + aMenuPane->SetItemDimmed(EMVSCmdSetPlayWindow,ETrue);
1.2026 + aMenuPane->SetItemDimmed(EMVSCmdClearPlayWindow,ETrue);
1.2027 + }
1.2028 +
1.2029 + //Settings menu >
1.2030 + if(aResourceId == R_MVS_SETTINGS_MENU)
1.2031 + {
1.2032 + aMenuPane->SetItemDimmed(EMVSCmdAudioSetting,ETrue);
1.2033 + aMenuPane->SetItemDimmed(EMVSVideoCmdSettings,ETrue);
1.2034 + aMenuPane->SetItemDimmed(EMVSCmdEditMetadata,ETrue);
1.2035 + aMenuPane->SetItemDimmed(EMVSCmdMultiScreen,EFalse);
1.2036 + aMenuPane->SetItemDimmed(EMVSCmdClearLog,EFalse);
1.2037 +#ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
1.2038 + aMenuPane->SetItemDimmed(EMVSCmdEnableSubtitles, ETrue);
1.2039 + aMenuPane->SetItemDimmed(EMVSCmdDisableSubtitles, ETrue);
1.2040 +#endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
1.2041 + }
1.2042 +
1.2043 + //Controls menu
1.2044 + if(aResourceId == R_MVS_CONTROLS_MENU)
1.2045 + {
1.2046 + aMenuPane->SetItemDimmed(EMVSCmdPlay,ETrue);
1.2047 + aMenuPane->SetItemDimmed(EMVSCmdPause,ETrue);
1.2048 + aMenuPane->SetItemDimmed(EMVSCmdStop,ETrue);
1.2049 + aMenuPane->SetItemDimmed(EMVSCmdRewind,ETrue);
1.2050 + aMenuPane->SetItemDimmed(EMVSCmdFastForward,ETrue);
1.2051 + aMenuPane->SetItemDimmed(EMVSCmdRecord,ETrue);
1.2052 + }
1.2053 + break;
1.2054 +
1.2055 + default:
1.2056 + ASSERT(EFalse);
1.2057 + break;
1.2058 + }
1.2059 + }
1.2060 +
1.2061 +
1.2062 +void CMVSAppUi::InternalizeL(RReadStream& aStream)
1.2063 + {
1.2064 + iVolumeOrGain = aStream.ReadInt32L();
1.2065 + iBalance = aStream.ReadInt32L();
1.2066 + iNoRepeats = aStream.ReadInt32L();
1.2067 + iRepeatDelay = aStream.ReadReal64L();
1.2068 + }
1.2069 +
1.2070 +void CMVSAppUi::ExternalizeL(RWriteStream& aStream)
1.2071 + {
1.2072 + aStream.WriteInt32L(iVolumeOrGain);
1.2073 + aStream.WriteInt32L(iBalance);
1.2074 + aStream.WriteInt32L(iNoRepeats);
1.2075 + aStream.WriteReal64L(iRepeatDelay.Int64());
1.2076 + }
1.2077 +
1.2078 +//Returns the selected controller plugin from the UI
1.2079 +void CMVSAppUi::SelectedPluginIdx(TInt aIdx)
1.2080 + {
1.2081 + iSelectedPluginIdx = aIdx;
1.2082 + }
1.2083 +
1.2084 +//Returns the selected Extension from the UI
1.2085 +void CMVSAppUi::SelectedExtension(TDesC16& aDes)
1.2086 + {
1.2087 + iControllerExt = aDes;
1.2088 + }
1.2089 +
1.2090 +
1.2091 +TInt CMVSAppUi::GetExtensionListL(CDesCArrayFlat* aExtArray,
1.2092 + TBool aMediaType)
1.2093 + {
1.2094 + return iPluginInfo->GetExtensionListL(aMediaType,aExtArray);
1.2095 + }
1.2096 +
1.2097 +
1.2098 +TInt CMVSAppUi::GetPluginListL(TInt8 aExtIdx,CDesCArrayFlat* aExtArray,CDesCArrayFlat* aPluginArray,TBool aMediaType)
1.2099 + {
1.2100 + iControllerExt.Copy(aExtArray->operator[](aExtIdx));
1.2101 + iAudioUidArray.Reset();
1.2102 + iAudioPlayUidArray.Reset();
1.2103 + iVideoUidArray.Reset();
1.2104 + if(!aMediaType)
1.2105 + {
1.2106 + return iPluginInfo->GetAudioPluginListL(aPluginArray,iAudioUidArray,iAudioPlayUidArray,&iControllerExt);
1.2107 + }
1.2108 + else
1.2109 + {
1.2110 + return iPluginInfo->GetVideoPluginListL(aPluginArray,iVideoUidArray,&iControllerExt);
1.2111 + }
1.2112 + }
1.2113 +
1.2114 +TInt CMVSAppUi::GetSystemInfoL(CDesCArrayFlat* aPluginArray)
1.2115 + {
1.2116 + return iPluginInfo->GetPluginListL(aPluginArray,iUidArray);
1.2117 + }
1.2118 +
1.2119 +//Returnd the selected media type, ie Audio or Video
1.2120 +void CMVSAppUi::SelectedMedia(TBool aMediaType)
1.2121 + {
1.2122 + iMediaType = aMediaType;
1.2123 + }
1.2124 +
1.2125 +
1.2126 +void CMVSAppUi::GetSupportedBitRatesL(RArray <TUint>& aBitRateArray)
1.2127 + {
1.2128 + iAudioRecordAgent->GetSupportedBitRatesArrayL(aBitRateArray);
1.2129 + }
1.2130 +
1.2131 +void CMVSAppUi::GetSupportedSampleRatesArrayL(RArray<TUint>& aSampleRatesArray)
1.2132 + {
1.2133 + iAudioRecordAgent->GetSupportedSampleRatesArrayL(aSampleRatesArray);
1.2134 + }
1.2135 +
1.2136 +void CMVSAppUi::GetSupportedNoChannelsArrayL(RArray<TUint>& aNoChannelsArray)
1.2137 + {
1.2138 + iAudioRecordAgent->GetSupportedNoChannelsArrayL(aNoChannelsArray);
1.2139 + }
1.2140 +
1.2141 +void CMVSAppUi::GetSupportedCodecsArrayL(RArray<TFourCC>& aCodecsArray)
1.2142 + {
1.2143 + iAudioRecordAgent->GetSupportedCodecsArrayL(aCodecsArray);
1.2144 + }
1.2145 +
1.2146 +void CMVSAppUi::GetSupportedFrameRatesL(RArray <TReal32>& aFrameRateArray)
1.2147 + {
1.2148 + iVideoRecordAgent->GetSupportedFrameRatesArrayL(aFrameRateArray);
1.2149 + }
1.2150 +
1.2151 +void CMVSAppUi::GetSupportedFrameSizeArrayL(RArray <TSize>& aFrameSizeArray)
1.2152 + {
1.2153 + iVideoRecordAgent->GetSupportedFrameSizesArrayL(aFrameSizeArray);
1.2154 + }
1.2155 +
1.2156 +void CMVSAppUi::SetVideoFrameRateL(TReal32 aFrameRate)
1.2157 + {
1.2158 + TRAPD(err,iVideoRecordAgent->SetVideoFrameRateL(aFrameRate));
1.2159 + if(err != KErrNone)
1.2160 + {
1.2161 + iLogger.Write(_L("SetVideoFrameRateL returned err"));
1.2162 + }
1.2163 + else
1.2164 + {
1.2165 + iVideoFrameRate = aFrameRate;
1.2166 + }
1.2167 + }
1.2168 +
1.2169 +void CMVSAppUi::SetVideoFrameSizeL(TSize aFrameSize)
1.2170 + {
1.2171 + TRAPD(err,iVideoRecordAgent->SetVideoFrameSizeL(aFrameSize));
1.2172 + if(err != KErrNone)
1.2173 + {
1.2174 + iLogger.Write(_L("SetVideoFrameRateL returned err"));
1.2175 + }
1.2176 + else
1.2177 + {
1.2178 + iFrameSize = aFrameSize;
1.2179 + }
1.2180 + }
1.2181 +
1.2182 +void CMVSAppUi::SetAudioEnabledL(TBool aAudioEnabled)
1.2183 + {
1.2184 + iAudioEnabled = aAudioEnabled;
1.2185 + iVideoRecordAgent->SetAudioEnabledL(iAudioEnabled);
1.2186 + iLogger.Write(_L("Audio Enabled for Video"));
1.2187 + }
1.2188 +
1.2189 +void CMVSAppUi::GetSupportedVideoTypesL(CDesC8ArrayFlat& aMimeArray)
1.2190 + {
1.2191 + iVideoRecordAgent->GetSupportedVideoTypesL(aMimeArray);
1.2192 + }
1.2193 +
1.2194 +void CMVSAppUi::SetVideoTypeL(const TDesC8 &aType)
1.2195 + {
1.2196 + iVideoRecordAgent->SetVideoTypeL(aType);
1.2197 + }
1.2198 +
1.2199 +void CMVSAppUi::WriteAudioDataL(CMVSConfigAudioFormatDialog* aAudioFormatDlg,
1.2200 + const TUid& aUid)
1.2201 + {
1.2202 + iSettingManager->WriteAudioDataL(aAudioFormatDlg,aUid);
1.2203 + }
1.2204 +
1.2205 +void CMVSAppUi::WriteVideoDataL(CMVSConfigVideoFormatDialog* aVideoFormatDlg,
1.2206 + const TUid& aUid)
1.2207 + {
1.2208 + iSettingManager->WriteVideoDataL(aVideoFormatDlg,aUid);
1.2209 + }
1.2210 +
1.2211 +TReal32 CMVSAppUi::GetVideoFrameRateL()
1.2212 + {
1.2213 + if(iMode == EVideoRecord)
1.2214 + {
1.2215 + iVideoFrameRate=iVideoRecordAgent->VideoFrameRateL();
1.2216 + }
1.2217 + else if(iMode == EVideoPlay)
1.2218 + {
1.2219 + iVideoFrameRate=iVideoPlayAgent->VideoFrameRateL();
1.2220 + }
1.2221 + return iVideoFrameRate;
1.2222 + }
1.2223 +
1.2224 +TVideoRotation CMVSAppUi::GetRotationL()
1.2225 + {
1.2226 + iVideoRotation = iVideoPlayAgent->RotationL();
1.2227 + return iVideoRotation;
1.2228 + }
1.2229 +
1.2230 +void CMVSAppUi::SetRotationL(TVideoRotation aRotation)
1.2231 + {
1.2232 + TRAPD(err, iVideoPlayAgent->SetRotationL(aRotation));
1.2233 + if (err == KErrNotSupported)
1.2234 + {
1.2235 + User::InfoPrint(KNotsupported);
1.2236 + iLogger.Write(_L("Error,This feature not supported by the controller"));
1.2237 + }
1.2238 + else if (err == KErrNotReady)
1.2239 + {
1.2240 + iLogger.Write(_L("Error, Videoplayer not yet created in the agent"));
1.2241 + }
1.2242 + else
1.2243 + {
1.2244 + iRotation = aRotation;
1.2245 + }
1.2246 + }
1.2247 +
1.2248 +void CMVSAppUi::GetScaleFactorL(TReal32& aScaleWidth, TReal32& aScaleHeight, TBool& aAntiAliasFiltering)
1.2249 + {
1.2250 + TRAPD(err, iVideoPlayAgent->GetScaleFactorL(aScaleWidth, aScaleHeight, aAntiAliasFiltering));
1.2251 + if (err == KErrNotSupported)
1.2252 + {
1.2253 + User::InfoPrint(KNotsupported);
1.2254 + }
1.2255 + else if (err == KErrNotReady)
1.2256 + {
1.2257 + iLogger.Write(_L("Error, Videoplayer not yet created in the agent"));
1.2258 + }
1.2259 + }
1.2260 +
1.2261 +void CMVSAppUi::SetScaleFactorL(TReal32 aScaleWidth,TReal32 aScaleHeight,TBool aAntiAliasFiltering)
1.2262 + {
1.2263 + TRAPD(err, iVideoPlayAgent->SetScaleFactorL(aScaleWidth,aScaleHeight,aAntiAliasFiltering));
1.2264 + if (err == KErrNotSupported)
1.2265 + {
1.2266 + User::InfoPrint(KNotsupported);
1.2267 + }
1.2268 + else if (err == KErrNotReady)
1.2269 + {
1.2270 + iLogger.Write(_L("Error, Videoplayer not yet created in the agent"));
1.2271 + }
1.2272 + }
1.2273 +
1.2274 +void CMVSAppUi::SetCropRegionL(const TRect& aCropRegion)
1.2275 + {
1.2276 + TRAPD(err, iVideoPlayAgent->SetCropRegionL(aCropRegion));
1.2277 + if (err == KErrNotSupported)
1.2278 + {
1.2279 + User::InfoPrint(KNotsupported);
1.2280 + }
1.2281 + else if (err == KErrNotReady)
1.2282 + {
1.2283 + iLogger.Write(_L("Error, Videoplayer not yet created in the agent"));
1.2284 + }
1.2285 + }
1.2286 +
1.2287 +void CMVSAppUi::GetCropRegionL(TRect& aCropRegion)
1.2288 + {
1.2289 + TRAPD(err, iVideoPlayAgent->GetCropRegionL(aCropRegion));
1.2290 + if (err == KErrNotSupported)
1.2291 + {
1.2292 + User::InfoPrint(KNotsupported);
1.2293 + }
1.2294 + else if (err == KErrNotReady)
1.2295 + {
1.2296 + iLogger.Write(_L("Error, Videoplayer not yet created in the agent"));
1.2297 + }
1.2298 + }
1.2299 +
1.2300 +void CMVSAppUi::SetVideoExtent(const TRect& aVideoExtent)
1.2301 + {
1.2302 + TRAPD(err, iVideoPlayAgent->SetVideoExtentL(aVideoExtent));
1.2303 + if (err != KErrNone)
1.2304 + {
1.2305 + TBuf<50> text;
1.2306 + text.AppendFormat(_L("SetVideoExtentL - %d"), err);
1.2307 + User::InfoPrint(text);
1.2308 + return;
1.2309 + }
1.2310 + iVideoExtentSet = ETrue;
1.2311 + iVideoExtent = aVideoExtent;
1.2312 + }
1.2313 +
1.2314 +void CMVSAppUi::SetWindowClippingRect(const TRect& aWindowClipRect)
1.2315 + {
1.2316 + TRAPD(err, iVideoPlayAgent->SetWindowClipRectL(aWindowClipRect));
1.2317 + if (err != KErrNone)
1.2318 + {
1.2319 + TBuf<50> text;
1.2320 + text.AppendFormat(_L("SetWindowClippingRectL - %d"), err);
1.2321 + User::InfoPrint(text);
1.2322 + return;
1.2323 + }
1.2324 +
1.2325 + iWindowClipRectSet = ETrue;
1.2326 + iWindowClipRect = aWindowClipRect;
1.2327 + }
1.2328 +
1.2329 +void CMVSAppUi::SetOverlayTextL(const TDesC& aOverlayText)
1.2330 + {
1.2331 + iOverlayText.Close();
1.2332 + iOverlayText.CreateL(aOverlayText);
1.2333 +
1.2334 + iAppView->iMainWindowControl->SetOverlayTextL(aOverlayText);
1.2335 + }
1.2336 +
1.2337 +const TDesC& CMVSAppUi::OverlayText() const
1.2338 + {
1.2339 + return iOverlayText;
1.2340 + }
1.2341 +
1.2342 +void CMVSAppUi::SetAutoScaleL(TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos)
1.2343 + {
1.2344 + iVideoPlayAgent->SetAutoScaleL(aScaleType, aHorizPos, aVertPos);
1.2345 + iAutoScaleType = aScaleType;
1.2346 + iAutoScaleHorizPos = aHorizPos;
1.2347 + iAutoScaleVertPos = aVertPos;
1.2348 + }
1.2349 +
1.2350 +void CMVSAppUi::GetAutoScale(TAutoScaleType& aScaleType, TInt& aHorizPos, TInt& aVertPos)
1.2351 + {
1.2352 + aScaleType = iAutoScaleType;
1.2353 + aHorizPos = iAutoScaleHorizPos;
1.2354 + aVertPos = iAutoScaleVertPos;
1.2355 + }
1.2356 +
1.2357 +void CMVSAppUi::SetOutputScreen(TInt aScreenNumber)
1.2358 + {
1.2359 + iScreenNumber = aScreenNumber;
1.2360 + }
1.2361 +
1.2362 +void CMVSAppUi::RegisterForNotification(TBool aRegistered)
1.2363 + {
1.2364 + if(iRegistered)
1.2365 + {
1.2366 + iAlreadyRegistered = ETrue;
1.2367 + }
1.2368 + iRegistered = aRegistered;
1.2369 + if(iMode == EVideoPlay)
1.2370 + {
1.2371 + if(iRegistered && iAlreadyRegistered == EFalse)
1.2372 + {
1.2373 + TInt regerr = iVideoPlayAgent->RegisterForNotification();
1.2374 + if(regerr == KErrNone)
1.2375 + {
1.2376 + User::InfoPrint(KRegisterSuccess);
1.2377 + }
1.2378 + else
1.2379 + {
1.2380 + User::InfoPrint(KRegisterFailure);
1.2381 + }
1.2382 + }
1.2383 + else if(iAlreadyRegistered && iRegistered == EFalse)
1.2384 + {
1.2385 + TInt cancelerr = iVideoPlayAgent->CancelNotification();
1.2386 + if(cancelerr == KErrNone)
1.2387 + {
1.2388 + iAlreadyRegistered = EFalse;
1.2389 + User::InfoPrint(KRegisterCancelation);
1.2390 + }
1.2391 + else
1.2392 + {
1.2393 + User::InfoPrint(KCancelationFailure);
1.2394 + }
1.2395 + }
1.2396 + }
1.2397 + else if(iMode == EAudioPlay && iRegistered)
1.2398 + {
1.2399 + }
1.2400 + }
1.2401 +
1.2402 +void CMVSAppUi::SetPip(TBool aPip)
1.2403 + {
1.2404 + iPip = aPip;
1.2405 + }
1.2406 +
1.2407 +void CMVSAppUi::SetCrp(TBool aCrp)
1.2408 + {
1.2409 + iCrp = aCrp;
1.2410 + }
1.2411 +/*
1.2412 +UpdteDisplay(....)
1.2413 +Used to populate all the view windows,based
1.2414 +on the arguments passed this includes updating the time bar,the file name
1.2415 +and the state of the app.
1.2416 +*/
1.2417 +void CMVSAppUi::UpdateDisplayL(TMVSState aState)
1.2418 + {
1.2419 + TBuf<KTimeValueLength> disTime;
1.2420 + TFileName disFName;
1.2421 + TBuf<32> disState;
1.2422 + disTime.Append(iDisplayTime);
1.2423 + disFName.Append(iDisplayFName);
1.2424 + disState.Append(iDisplayState);
1.2425 +
1.2426 + iDisplayFName.Zero();
1.2427 + iDisplayState.Zero();
1.2428 + iDisplayTime.Zero();
1.2429 +
1.2430 + switch(aState)
1.2431 + {
1.2432 + case(ENotReady):
1.2433 + iCoeEnv->ReadResourceL(iDisplayFName, R_NOFILE);
1.2434 + iCoeEnv->ReadResourceL(iDisplayState, R_IDLE);
1.2435 + iCoeEnv->ReadResourceL(iDisplayTime, R_ZEROTIME);
1.2436 + break;
1.2437 + case(EAudioOpened):
1.2438 + case(EVideoOpened):
1.2439 + if(iMode == EAudioPlay || iMode == EVideoPlay)
1.2440 + {
1.2441 + iDisplayFName.Append(iSrcFName);
1.2442 + }
1.2443 + if(iMode == EAudioRecord || iMode == EVideoRecord)
1.2444 + {
1.2445 + iDisplayFName.Append(iRecFName);
1.2446 + }
1.2447 + iCoeEnv->ReadResourceL(iDisplayState, R_OPEN);
1.2448 + break;
1.2449 +
1.2450 + case(EAudioStopped):
1.2451 + case(EVideoStopped):
1.2452 + if(iMode == EAudioPlay || iMode == EVideoPlay)
1.2453 + {
1.2454 + iDisplayFName.Append(iSrcFName);
1.2455 + }
1.2456 + if(iMode == EAudioRecord || iMode == EVideoRecord)
1.2457 + {
1.2458 + iDisplayFName.Append(iRecFName);
1.2459 + }
1.2460 + iCoeEnv->ReadResourceL(iDisplayState, R_READY);
1.2461 + break;
1.2462 +
1.2463 + case(EAudioPlaying):
1.2464 + case(EVideoPlaying):
1.2465 + if(iMode == EAudioPlay || iMode == EVideoPlay)
1.2466 + {
1.2467 + iDisplayFName.Append(iSrcFName);
1.2468 + }
1.2469 + if(iMode == EAudioRecord || iMode == EVideoRecord)
1.2470 + {
1.2471 + iDisplayFName.Append(iRecFName);
1.2472 + }
1.2473 + iCoeEnv->ReadResourceL(iDisplayState, R_PLAYING);
1.2474 + break;
1.2475 +
1.2476 + case(EAudioRecording):
1.2477 + iDisplayFName.Append(iRecFName);
1.2478 + iCoeEnv->ReadResourceL(iDisplayState, R_RECORDING);
1.2479 + ConvertTimeToDes(iAudioRecordAgent->Position(), iDisplayTime);
1.2480 + break;
1.2481 +
1.2482 + case(EVideoRecording):
1.2483 + iDisplayFName.Append(iRecFName);
1.2484 + iCoeEnv->ReadResourceL(iDisplayState, R_RECORDING);
1.2485 + ConvertTimeToDes(iVideoRecordAgent->DurationL(), iDisplayTime);
1.2486 + break;
1.2487 +
1.2488 + case(EAudioPaused):
1.2489 + case(EVideoPaused):
1.2490 + if(iMode == EAudioPlay || iMode == EVideoPlay)
1.2491 + {
1.2492 + iDisplayFName.Append(iSrcFName);
1.2493 + }
1.2494 + if(iMode == EAudioRecord || iMode == EVideoRecord)
1.2495 + {
1.2496 + iDisplayFName.Append(iRecFName);
1.2497 + }
1.2498 + iCoeEnv->ReadResourceL(iDisplayState, R_PAUSED);
1.2499 + break;
1.2500 +
1.2501 + default:
1.2502 + iCoeEnv->ReadResourceL(iDisplayFName, R_NOFILE);
1.2503 + iCoeEnv->ReadResourceL(iDisplayState, R_IDLE);
1.2504 + iCoeEnv->ReadResourceL(iDisplayTime, R_ZEROTIME);
1.2505 + break;
1.2506 + }
1.2507 +
1.2508 + if (iMode == EVideoPlay)
1.2509 + {
1.2510 + if (aState != EVideoPlaying && iVideoPlayAgent->SupportVideoPlayerUtility2() && iDisplayAdded)
1.2511 + {
1.2512 + iVideoCtl->Pip().Clear();
1.2513 + PrepareVideoControlsL();
1.2514 + }
1.2515 + }
1.2516 +
1.2517 + PopulateInfoWindowDataL(aState);
1.2518 +
1.2519 + if(disFName.CompareF(iDisplayFName) != 0)
1.2520 + {
1.2521 + iAppView->iStatusWindowFNameControl->SetTextL(iDisplayFName);
1.2522 + iAppView->iStatusWindowFNameControl->DrawNow();
1.2523 + }
1.2524 + if(disTime.CompareF(iDisplayTime) != 0)
1.2525 + {
1.2526 + iAppView->iStatusWindowTimeControl->SetTextL(iDisplayTime);
1.2527 + iAppView->iStatusWindowTimeControl->DrawNow();
1.2528 + }
1.2529 + if(disState.CompareF(iDisplayState) != 0)
1.2530 + {
1.2531 + iAppView->iStatusWindowStateControl->SetTextL(iDisplayState);
1.2532 + iAppView->iStatusWindowStateControl->DrawNow();
1.2533 + }
1.2534 +
1.2535 + TBuf<256> dollarDes;
1.2536 + BuildDollarDesFromArrayL(dollarDes);
1.2537 + if(iDollarDes.CompareF(dollarDes) != 0)
1.2538 + {
1.2539 + iDollarDes.Zero();
1.2540 + iDollarDes.Append(dollarDes);
1.2541 + iAppView->iInfoWindowControl->SetTextL(dollarDes);
1.2542 + iAppView->iInfoWindowControl->DrawNow();
1.2543 + }
1.2544 + }
1.2545 +
1.2546 +
1.2547 +
1.2548 +//
1.2549 +//PopulateMainWindowData(...) ***TRAPPED ERRORS***
1.2550 +//
1.2551 +// Adds data to the array used to hold playback or recording data
1.2552 +// such as the volume, cropping window and balance. This is then used to
1.2553 +// build a $$-separated descriptor which is sent to the view to be
1.2554 +// displayed as lines of text within the main window.
1.2555 +//
1.2556 +void CMVSAppUi::PopulateInfoWindowDataL(TMVSState aState)
1.2557 + {
1.2558 + TInt balance;
1.2559 + TBuf<256> infoBuf;
1.2560 + TBuf<75> welcome;
1.2561 + iCoeEnv->ReadResourceL(welcome, R_WELCOME);
1.2562 +
1.2563 + TBuf<32> format;
1.2564 + iCoeEnv->ReadResourceL(format, R_FORMAT);
1.2565 +
1.2566 + TBuf<10> left;
1.2567 + iCoeEnv->ReadResourceL(left, R_LEFT);
1.2568 +
1.2569 + TBuf<10> right;
1.2570 + iCoeEnv->ReadResourceL(right, R_RIGHT);
1.2571 +
1.2572 + TBuf<1> close;
1.2573 + iCoeEnv->ReadResourceL(close, R_CLOSE);
1.2574 +
1.2575 + TBuf<56> noCrop;
1.2576 + iCoeEnv->ReadResourceL(noCrop, R_NOCROP);
1.2577 +
1.2578 + TBuf<KLabelCaptionMaxLength> center;
1.2579 + iCoeEnv->ReadResourceL(center, R_CENTER);
1.2580 +
1.2581 + TBuf<KLabelCaptionMaxLength> volume;
1.2582 + iCoeEnv->ReadResourceL(volume, R_VOLUME);
1.2583 +
1.2584 + TBuf<KLabelCaptionMaxLength> ramp;
1.2585 + iCoeEnv->ReadResourceL(ramp, R_RAMP);
1.2586 +
1.2587 + TBuf<KLabelCaptionMaxLength> balanceDes;
1.2588 + iCoeEnv->ReadResourceL(balanceDes, R_BALANCE);
1.2589 +
1.2590 + TBuf<KLabelCaptionMaxLength> cropStart;
1.2591 + iCoeEnv->ReadResourceL(cropStart, R_CROPSTART);
1.2592 +
1.2593 + TBuf<KLabelCaptionMaxLength> cropEnd;
1.2594 + iCoeEnv->ReadResourceL(cropEnd, R_CROPEND);
1.2595 +
1.2596 + TBuf<KLabelCaptionMaxLength> noRepeats;
1.2597 + iCoeEnv->ReadResourceL(noRepeats, R_NOREPEATS);
1.2598 +
1.2599 + TBuf<32> audioPriority;
1.2600 + iCoeEnv->ReadResourceL(audioPriority, R_AUDIOPRIORITY);
1.2601 +
1.2602 + TBuf<KLabelCaptionMaxLength> gain;
1.2603 + iCoeEnv->ReadResourceL(gain, R_GAIN);
1.2604 +
1.2605 + TBuf<KLabelCaptionMaxLength> clipLength;
1.2606 + iCoeEnv->ReadResourceL(clipLength, R_CLIPLENGTH);
1.2607 +
1.2608 + TBuf<KLabelCaptionMaxLength> bitRate;
1.2609 + iCoeEnv->ReadResourceL(bitRate, R_BITRATE);
1.2610 +
1.2611 + TBuf<KLabelCaptionMaxLength> sampleRate;
1.2612 + iCoeEnv->ReadResourceL(sampleRate, R_SAMPLERATE);
1.2613 +
1.2614 + TBuf<KLabelCaptionMaxLength> channels;
1.2615 + iCoeEnv->ReadResourceL(channels,R_CHANNELS);
1.2616 +
1.2617 + TBuf<KLabelCaptionMaxLength> AudioEnabled;
1.2618 + iCoeEnv->ReadResourceL(AudioEnabled, R_AUDIOENABLED);
1.2619 +
1.2620 + TBuf<KLabelCaptionMaxLength> AudioNotEnabled;
1.2621 + iCoeEnv->ReadResourceL(AudioNotEnabled, R_AUDIONOTENABLED);
1.2622 +
1.2623 + _LIT(KPercent, "%");
1.2624 +
1.2625 + TBuf<KTimeValueLength> clipLengthDes;
1.2626 +
1.2627 + //If the window text has anything in it, clear it out
1.2628 + if(iMainWindowText.Count() > 0)
1.2629 + {
1.2630 + iMainWindowText.Reset();
1.2631 + }
1.2632 + TTimeIntervalMicroSeconds duration;
1.2633 + TInt64 clipLengthVal =0;
1.2634 + TUint bitrateValue = 0;
1.2635 + TInt frameHeight = 0;
1.2636 + TInt frameWidth = 0;
1.2637 + TInt frameRate = 0;
1.2638 + //Populate the array based on the current state
1.2639 + switch(aState)
1.2640 + {
1.2641 + //Idle, the main window is all but empty
1.2642 + case(ENotReady):
1.2643 + iMainWindowText.AppendL(welcome);
1.2644 + if(iButtons->IsCommandDimmed(EMVSCmdPause))
1.2645 + {
1.2646 + iButtons->DimCommand(EMVSCmdPause,EFalse);
1.2647 + iButtons->DrawNow();
1.2648 + }
1.2649 + if(iButtons->IsCommandDimmed(EMVSCmdPlay))
1.2650 + {
1.2651 + iButtons->DimCommand(EMVSCmdPlay,EFalse);
1.2652 + iButtons->DrawNow();
1.2653 + }
1.2654 + if(iButtons->IsCommandDimmed(EMVSCmdStop))
1.2655 + {
1.2656 + iButtons->DimCommand(EMVSCmdStop,EFalse);
1.2657 + iButtons->DrawNow();
1.2658 + }
1.2659 + break;
1.2660 +
1.2661 + //Recording: show the gain, balance and crop window.
1.2662 + case(EAudioRecording):
1.2663 + if(iButtons->IsCommandDimmed(EMVSCmdStop))
1.2664 + {
1.2665 + iButtons->DimCommand(EMVSCmdStop,EFalse);
1.2666 + iButtons->DrawNow();
1.2667 + }
1.2668 + infoBuf.Append(KAudioRecording);
1.2669 + iMainWindowText.AppendL(infoBuf);
1.2670 + infoBuf.Zero();
1.2671 + infoBuf.Append(gain);
1.2672 + infoBuf.AppendNum(iVolumeOrGain);
1.2673 + infoBuf.Append(KPercent);
1.2674 + iMainWindowText.AppendL(infoBuf);
1.2675 + infoBuf.Zero();
1.2676 + infoBuf.Append(balanceDes);
1.2677 + //Convert the balance to a number between 0 and 100
1.2678 + iAudioRecordAgent->GetRecordBalance(iBalance);
1.2679 + balance = (iBalance/2) + 50;
1.2680 + //Translate this figure into 'Left', 'Right' or 'Center'
1.2681 + if(balance < 50)
1.2682 + {
1.2683 + infoBuf.Append(left);
1.2684 + infoBuf.AppendNum(balance);
1.2685 + infoBuf.Append(close);
1.2686 + }
1.2687 + else if(balance == 50)
1.2688 + {
1.2689 + infoBuf.Append(center);
1.2690 + }
1.2691 + else
1.2692 + {
1.2693 + infoBuf.Append(right);
1.2694 + infoBuf.AppendNum(balance);
1.2695 + infoBuf.Append(close);
1.2696 + }
1.2697 + iMainWindowText.AppendL(infoBuf);
1.2698 + infoBuf.Zero();
1.2699 + infoBuf.Append(bitRate);
1.2700 + if(iBitRate == 0)
1.2701 + {
1.2702 + infoBuf.Append(KNotSupported);
1.2703 + }
1.2704 + else
1.2705 + {
1.2706 + infoBuf.AppendNum(iBitRate);
1.2707 + }
1.2708 + iMainWindowText.AppendL(infoBuf);
1.2709 + infoBuf.Zero();
1.2710 + infoBuf.Append(sampleRate);
1.2711 + infoBuf.AppendNum(iSampleRate);
1.2712 + iMainWindowText.AppendL(infoBuf);
1.2713 + infoBuf.Zero();
1.2714 + if(iChannels == 1)
1.2715 + {
1.2716 + infoBuf.Append(channels);
1.2717 + infoBuf.Append(KMono);
1.2718 + iMainWindowText.AppendL(infoBuf);
1.2719 + infoBuf.Zero();
1.2720 + }
1.2721 + else if(iChannels == 2)
1.2722 + {
1.2723 + infoBuf.Append(channels);
1.2724 + infoBuf.Append(KStereo);
1.2725 + iMainWindowText.AppendL(infoBuf);
1.2726 + infoBuf.Zero();
1.2727 + }
1.2728 + break;
1.2729 +
1.2730 + case(EVideoRecording):
1.2731 + if(iButtons->IsCommandDimmed(EMVSCmdStop))
1.2732 + {
1.2733 + iButtons->DimCommand(EMVSCmdStop,EFalse);
1.2734 + iButtons->DrawNow();
1.2735 + }
1.2736 + infoBuf.Append(KVideoRecording);
1.2737 + iMainWindowText.AppendL(infoBuf);
1.2738 + infoBuf.Zero();
1.2739 + if(iVideoRecordAgent->AudioEnabledL())
1.2740 + {
1.2741 + infoBuf.Zero();
1.2742 + infoBuf.Append(AudioEnabled);
1.2743 + iMainWindowText.AppendL(infoBuf);
1.2744 + infoBuf.Zero();
1.2745 + infoBuf.Append(gain);
1.2746 + infoBuf.AppendNum(iVolumeOrGain);
1.2747 + infoBuf.Append(KPercent);
1.2748 + iMainWindowText.AppendL(infoBuf);
1.2749 + infoBuf.Zero();
1.2750 + }
1.2751 + else
1.2752 + {
1.2753 + infoBuf.Zero();
1.2754 + infoBuf.Append(AudioNotEnabled);
1.2755 + iMainWindowText.AppendL(infoBuf);
1.2756 + infoBuf.Zero();
1.2757 + }
1.2758 + infoBuf.Append(KFrameSize);
1.2759 + frameHeight = iFrameSize.iHeight;
1.2760 + frameWidth = iFrameSize.iWidth;
1.2761 + infoBuf.AppendNum(frameWidth);
1.2762 + infoBuf.Append(KComma);
1.2763 + infoBuf.AppendNum(frameHeight);
1.2764 + iMainWindowText.AppendL(infoBuf);
1.2765 + infoBuf.Zero();
1.2766 + infoBuf.Append(KFrameRate);
1.2767 + frameRate = TInt(iVideoFrameRate);
1.2768 + infoBuf.AppendNum(frameRate);
1.2769 + iMainWindowText.AppendL(infoBuf);
1.2770 + infoBuf.Zero();
1.2771 + break;
1.2772 +
1.2773 + //The default state displays all playback information such as
1.2774 + //Volume, balance, cropping points, audio priority & the number of
1.2775 + //repeats.
1.2776 + case(EAudioOpened):
1.2777 + if(iMode == EAudioPlay)
1.2778 + {
1.2779 + infoBuf.Append(volume);
1.2780 + }
1.2781 + if(iMode == EAudioRecord)
1.2782 + {
1.2783 + infoBuf.Append(KGain);
1.2784 + }
1.2785 + infoBuf.AppendNum(iVolumeOrGain);
1.2786 + infoBuf.Append(KPercent);
1.2787 + iMainWindowText.AppendL(infoBuf);
1.2788 + infoBuf.Zero();
1.2789 + infoBuf.Append(balanceDes);
1.2790 + balance = (iBalance/2) + 50;
1.2791 + if(balance < 50)
1.2792 + {
1.2793 + infoBuf.Append(left);
1.2794 + infoBuf.AppendNum(balance);
1.2795 + infoBuf.Append(close);
1.2796 + }
1.2797 + else if(balance == 50)
1.2798 + {
1.2799 + infoBuf.Append(center);
1.2800 + }
1.2801 + else
1.2802 + {
1.2803 + infoBuf.Append(right);
1.2804 + infoBuf.AppendNum(balance);
1.2805 + infoBuf.Append(close);
1.2806 + }
1.2807 + iMainWindowText.AppendL(infoBuf);
1.2808 + infoBuf.Zero();
1.2809 + infoBuf.Append(noRepeats);
1.2810 + infoBuf.AppendNum(iNoRepeats);
1.2811 + iMainWindowText.AppendL(infoBuf);
1.2812 + infoBuf.Zero();
1.2813 + //Audio Priority
1.2814 + infoBuf.Append(audioPriority);
1.2815 + infoBuf.AppendNum(iPriority);
1.2816 + iMainWindowText.AppendL(infoBuf);
1.2817 + infoBuf.Zero();
1.2818 + infoBuf.Append(KDuration);
1.2819 + if(iMode == EAudioPlay)
1.2820 + {
1.2821 + duration = iAudioPlayAgent->Duration();
1.2822 + }
1.2823 + else if(iMode == EAudioRecord)
1.2824 + {
1.2825 + duration = iAudioRecordAgent->Duration();
1.2826 + if(duration > 0)
1.2827 + {
1.2828 + iButtons->DimCommand(EMVSCmdPlay,EFalse);
1.2829 + }
1.2830 + else
1.2831 + {
1.2832 + iButtons->DimCommand(EMVSCmdPlay,ETrue);
1.2833 + }
1.2834 + iButtons->DimCommand(EMVSCmdPause,ETrue);
1.2835 + iButtons->DimCommand(EMVSCmdStop,ETrue);
1.2836 + iButtons->DrawNow();
1.2837 + }
1.2838 + clipLengthVal = duration.Int64();
1.2839 + infoBuf.AppendNum(clipLengthVal);
1.2840 + infoBuf.Append(KMs);
1.2841 + iMainWindowText.AppendL(infoBuf);
1.2842 + infoBuf.Zero();
1.2843 + infoBuf.Append(KBitRate);
1.2844 + if(iMode == EAudioPlay)
1.2845 + {
1.2846 + iAudioPlayAgent->GetBitRate(bitrateValue);
1.2847 + infoBuf.AppendNum(bitrateValue);
1.2848 + }
1.2849 + else if(iMode == EAudioRecord)
1.2850 + {
1.2851 + if(iBitRate == 0)
1.2852 + {
1.2853 + infoBuf.Append(KNotSupported);
1.2854 + }
1.2855 + else
1.2856 + {
1.2857 + infoBuf.AppendNum(iBitRate);
1.2858 + }
1.2859 + }
1.2860 + iMainWindowText.AppendL(infoBuf);
1.2861 + infoBuf.Zero();
1.2862 + break;
1.2863 +
1.2864 + case(EAudioStopped):
1.2865 + infoBuf.Append(KStopped);
1.2866 + iMainWindowText.AppendL(infoBuf);
1.2867 + infoBuf.Zero();
1.2868 + infoBuf.Append(volume);
1.2869 + infoBuf.AppendNum(iVolumeOrGain);
1.2870 + infoBuf.Append(KPercent);
1.2871 + iMainWindowText.AppendL(infoBuf);
1.2872 + infoBuf.Zero();
1.2873 + infoBuf.Append(balanceDes);
1.2874 + balance = (iBalance/2) + 50;
1.2875 + if(balance < 50)
1.2876 + {
1.2877 + infoBuf.Append(left);
1.2878 + infoBuf.AppendNum(balance);
1.2879 + infoBuf.Append(close);
1.2880 + }
1.2881 + else if(balance == 50)
1.2882 + {
1.2883 + infoBuf.Append(center);
1.2884 + }
1.2885 + else
1.2886 + {
1.2887 + infoBuf.Append(right);
1.2888 + infoBuf.AppendNum(balance);
1.2889 + infoBuf.Append(close);
1.2890 + }
1.2891 + iMainWindowText.AppendL(infoBuf);
1.2892 + infoBuf.Zero();
1.2893 + infoBuf.Append(noRepeats);
1.2894 + infoBuf.AppendNum(iNoRepeats);
1.2895 + iMainWindowText.AppendL(infoBuf);
1.2896 + infoBuf.Zero();
1.2897 + //Audio Priority
1.2898 + infoBuf.Append(audioPriority);
1.2899 + infoBuf.AppendNum(iPriority);
1.2900 + iMainWindowText.AppendL(infoBuf);
1.2901 + infoBuf.Zero();
1.2902 + infoBuf.Append(KDuration);
1.2903 + if(iMode == EAudioPlay)
1.2904 + {
1.2905 + duration = iAudioPlayAgent->Duration();
1.2906 + }
1.2907 + else if(iMode == EAudioRecord)
1.2908 + {
1.2909 + duration = iAudioRecordAgent->Duration();
1.2910 + }
1.2911 + clipLengthVal = duration.Int64();
1.2912 + infoBuf.AppendNum(clipLengthVal);
1.2913 + infoBuf.Append(KMs);
1.2914 + iMainWindowText.AppendL(infoBuf);
1.2915 + infoBuf.Zero();
1.2916 + infoBuf.Append(KBitRate);
1.2917 + if(iMode == EAudioPlay)
1.2918 + {
1.2919 + iAudioPlayAgent->GetBitRate(bitrateValue);
1.2920 + infoBuf.AppendNum(bitrateValue);
1.2921 + }
1.2922 + else if(iMode == EAudioRecord)
1.2923 + {
1.2924 + if(iBitRate == 0)
1.2925 + {
1.2926 + infoBuf.Append(KNotSupported);
1.2927 + }
1.2928 + else
1.2929 + {
1.2930 + infoBuf.AppendNum(iBitRate);
1.2931 + }
1.2932 + }
1.2933 + iMainWindowText.AppendL(infoBuf);
1.2934 + infoBuf.Zero();
1.2935 + break;
1.2936 +
1.2937 + case(EAudioPlaying):
1.2938 + infoBuf.Append(KAudioPlaying);
1.2939 + iMainWindowText.AppendL(infoBuf);
1.2940 + infoBuf.Zero();
1.2941 + infoBuf.Append(volume);
1.2942 + infoBuf.AppendNum(iVolumeOrGain);
1.2943 + infoBuf.Append(KPercent);
1.2944 + iMainWindowText.AppendL(infoBuf);
1.2945 + infoBuf.Zero();
1.2946 + infoBuf.Append(balanceDes);
1.2947 + balance = (iBalance/2) + 50;
1.2948 + if(balance < 50)
1.2949 + {
1.2950 + infoBuf.Append(left);
1.2951 + infoBuf.AppendNum(balance);
1.2952 + infoBuf.Append(close);
1.2953 + }
1.2954 + else if(balance == 50)
1.2955 + {
1.2956 + infoBuf.Append(center);
1.2957 + }
1.2958 + else
1.2959 + {
1.2960 + infoBuf.Append(right);
1.2961 + infoBuf.AppendNum(balance);
1.2962 + infoBuf.Append(close);
1.2963 + }
1.2964 + iMainWindowText.AppendL(infoBuf);
1.2965 + infoBuf.Zero();
1.2966 + infoBuf.Append(noRepeats);
1.2967 + infoBuf.AppendNum(iNoRepeats);
1.2968 + iMainWindowText.AppendL(infoBuf);
1.2969 + infoBuf.Zero();
1.2970 + //Audio Priority
1.2971 + infoBuf.Append(audioPriority);
1.2972 + infoBuf.AppendNum(iPriority);
1.2973 + iMainWindowText.AppendL(infoBuf);
1.2974 + infoBuf.Zero();
1.2975 + infoBuf.Append(KDuration);
1.2976 + if(iMode == EAudioPlay)
1.2977 + {
1.2978 + duration = iAudioPlayAgent->Duration();
1.2979 + }
1.2980 + else if(iMode == EAudioRecord)
1.2981 + {
1.2982 + duration = iAudioRecordAgent->Duration();
1.2983 + }
1.2984 + clipLengthVal = duration.Int64();
1.2985 + infoBuf.AppendNum(clipLengthVal);
1.2986 + infoBuf.Append(KMs);
1.2987 + iMainWindowText.AppendL(infoBuf);
1.2988 + infoBuf.Zero();
1.2989 + infoBuf.Append(KBitRate);
1.2990 + if(iMode == EAudioPlay)
1.2991 + {
1.2992 + iAudioPlayAgent->GetBitRate(bitrateValue);
1.2993 + infoBuf.AppendNum(bitrateValue);
1.2994 + }
1.2995 + else if(iMode == EAudioRecord)
1.2996 + {
1.2997 + if(iBitRate == 0)
1.2998 + {
1.2999 + infoBuf.Append(KNotSupported);
1.3000 + }
1.3001 + else
1.3002 + {
1.3003 + infoBuf.AppendNum(iBitRate);
1.3004 + }
1.3005 + }
1.3006 + iMainWindowText.AppendL(infoBuf);
1.3007 + infoBuf.Zero();
1.3008 + break;
1.3009 +
1.3010 + case(EAudioPaused):
1.3011 + infoBuf.Append(KPaused);
1.3012 + iMainWindowText.AppendL(infoBuf);
1.3013 + infoBuf.Zero();
1.3014 + infoBuf.Append(volume);
1.3015 + infoBuf.AppendNum(iVolumeOrGain);
1.3016 + infoBuf.Append(KPercent);
1.3017 + iMainWindowText.AppendL(infoBuf);
1.3018 + infoBuf.Zero();
1.3019 + infoBuf.Append(balanceDes);
1.3020 + balance = (iBalance/2) + 50;
1.3021 + if(balance < 50)
1.3022 + {
1.3023 + infoBuf.Append(left);
1.3024 + infoBuf.AppendNum(balance);
1.3025 + infoBuf.Append(close);
1.3026 + }
1.3027 + else if(balance == 50)
1.3028 + {
1.3029 + infoBuf.Append(center);
1.3030 + }
1.3031 + else
1.3032 + {
1.3033 + infoBuf.Append(right);
1.3034 + infoBuf.AppendNum(balance);
1.3035 + infoBuf.Append(close);
1.3036 + }
1.3037 + iMainWindowText.AppendL(infoBuf);
1.3038 + infoBuf.Zero();
1.3039 + infoBuf.Append(noRepeats);
1.3040 + infoBuf.AppendNum(iNoRepeats);
1.3041 + iMainWindowText.AppendL(infoBuf);
1.3042 + infoBuf.Zero();
1.3043 + //Audio Priority
1.3044 + infoBuf.Append(audioPriority);
1.3045 + infoBuf.AppendNum(iPriority);
1.3046 + iMainWindowText.AppendL(infoBuf);
1.3047 + infoBuf.Zero();
1.3048 + infoBuf.Append(KDuration);
1.3049 + if(iMode == EAudioPlay)
1.3050 + {
1.3051 + duration = iAudioPlayAgent->Duration();
1.3052 + }
1.3053 + else if(iMode == EAudioRecord)
1.3054 + {
1.3055 + duration = iAudioRecordAgent->Duration();
1.3056 + }
1.3057 + clipLengthVal = duration.Int64();
1.3058 + infoBuf.AppendNum(clipLengthVal);
1.3059 + infoBuf.Append(KMs);
1.3060 + iMainWindowText.AppendL(infoBuf);
1.3061 + infoBuf.Zero();
1.3062 + infoBuf.Append(KBitRate);
1.3063 + if(iMode == EAudioPlay)
1.3064 + {
1.3065 + iAudioPlayAgent->GetBitRate(bitrateValue);
1.3066 + infoBuf.AppendNum(bitrateValue);
1.3067 + }
1.3068 + else if(iMode == EAudioRecord)
1.3069 + {
1.3070 + if(iBitRate == 0)
1.3071 + {
1.3072 + infoBuf.Append(KNotSupported);
1.3073 + }
1.3074 + else
1.3075 + {
1.3076 + infoBuf.AppendNum(iBitRate);
1.3077 + }
1.3078 + }
1.3079 + iMainWindowText.AppendL(infoBuf);
1.3080 + infoBuf.Zero();
1.3081 + break;
1.3082 +
1.3083 + case(EVideoOpened):
1.3084 + if(iMode == EVideoPlay)
1.3085 + {
1.3086 + infoBuf.Append(KVideoOpened);
1.3087 + iMainWindowText.AppendL(infoBuf);
1.3088 + infoBuf.Zero();
1.3089 + if(iVideoPlayAgent->AudioEnabledL())
1.3090 + {
1.3091 + infoBuf.Zero();
1.3092 + infoBuf.Append(AudioEnabled);
1.3093 + iMainWindowText.AppendL(infoBuf);
1.3094 + infoBuf.Zero();
1.3095 + infoBuf.Append(volume);
1.3096 + infoBuf.AppendNum(iVolumeOrGain);
1.3097 + infoBuf.Append(KPercent);
1.3098 + iMainWindowText.AppendL(infoBuf);
1.3099 + infoBuf.Zero();
1.3100 + if(iButtons->IsCommandDimmed(EMVSCmdSetVolume))
1.3101 + {
1.3102 + iButtons->DimCommand(EMVSCmdSetVolume,EFalse);
1.3103 + iButtons->DrawNow();
1.3104 + }
1.3105 + }
1.3106 + else
1.3107 + {
1.3108 + infoBuf.Zero();
1.3109 + infoBuf.Append(AudioNotEnabled);
1.3110 + iMainWindowText.AppendL(infoBuf);
1.3111 + infoBuf.Zero();
1.3112 + }
1.3113 + infoBuf.Append(KDuration);
1.3114 + duration = iVideoPlayAgent->DurationL();
1.3115 + clipLengthVal = duration.Int64();
1.3116 + infoBuf.AppendNum(clipLengthVal);
1.3117 + iMainWindowText.AppendL(infoBuf);
1.3118 + infoBuf.Zero();
1.3119 + iVideoPlayAgent->VideoFrameSizeL(iFrameSize);
1.3120 + frameHeight = iFrameSize.iHeight;
1.3121 + frameWidth = iFrameSize.iWidth;
1.3122 + infoBuf.Append(KFrameSize);
1.3123 + infoBuf.AppendNum(frameWidth);
1.3124 + infoBuf.Append(KComma);
1.3125 + infoBuf.AppendNum(frameHeight);
1.3126 + iMainWindowText.AppendL(infoBuf);
1.3127 + infoBuf.Zero();
1.3128 + iVideoFrameRate = GetVideoFrameRateL();
1.3129 + }
1.3130 + else if(iMode == EVideoRecord)
1.3131 + {
1.3132 + iButtons->DimCommand(EMVSCmdPlay,ETrue);
1.3133 + iButtons->DimCommand(EMVSCmdPause,ETrue);
1.3134 + iButtons->DimCommand(EMVSCmdStop,ETrue);
1.3135 + iButtons->DrawNow();
1.3136 + infoBuf.Append(KVideoOpenedForRecord);
1.3137 + iMainWindowText.AppendL(infoBuf);
1.3138 + if(iVideoRecordAgent->AudioEnabledL())
1.3139 + {
1.3140 + iButtons->DimCommand(EMVSCmdSetVolume, EFalse);
1.3141 + iButtons->DrawNow();
1.3142 + infoBuf.Zero();
1.3143 + infoBuf.Append(AudioEnabled);
1.3144 + iMainWindowText.AppendL(infoBuf);
1.3145 + infoBuf.Zero();
1.3146 + infoBuf.Append(gain);
1.3147 + infoBuf.AppendNum(iVolumeOrGain);
1.3148 + infoBuf.Append(KPercent);
1.3149 + iMainWindowText.AppendL(infoBuf);
1.3150 + infoBuf.Zero();
1.3151 + }
1.3152 + else
1.3153 + {
1.3154 + infoBuf.Zero();
1.3155 + infoBuf.Append(AudioNotEnabled);
1.3156 + iMainWindowText.AppendL(infoBuf);
1.3157 + infoBuf.Zero();
1.3158 + }
1.3159 + infoBuf.Append(KFrameSize);
1.3160 + frameHeight =iFrameSize.iHeight;
1.3161 + frameWidth =iFrameSize.iWidth;
1.3162 + infoBuf.AppendNum(frameWidth);
1.3163 + infoBuf.Append(KComma);
1.3164 + infoBuf.AppendNum(frameHeight);
1.3165 + iMainWindowText.AppendL(infoBuf);
1.3166 + infoBuf.Zero();
1.3167 + }
1.3168 + infoBuf.Zero();
1.3169 + infoBuf.Append(KFrameRate);
1.3170 + frameRate = TInt(iVideoFrameRate);
1.3171 + infoBuf.AppendNum(frameRate);
1.3172 + iMainWindowText.AppendL(infoBuf);
1.3173 + infoBuf.Zero();
1.3174 + break;
1.3175 +
1.3176 + case(EVideoPlaying):
1.3177 + infoBuf.Append(KVideoPlaying);
1.3178 + iMainWindowText.AppendL(infoBuf);
1.3179 + infoBuf.Zero();
1.3180 + if( iVideoPlayAgent->AudioEnabledL())
1.3181 + {
1.3182 + infoBuf.Zero();
1.3183 + infoBuf.Append(AudioEnabled);
1.3184 + iMainWindowText.AppendL(infoBuf);
1.3185 + infoBuf.Zero();
1.3186 + infoBuf.Append(volume);
1.3187 + infoBuf.AppendNum(iVolumeOrGain);
1.3188 + infoBuf.Append(KPercent);
1.3189 + iMainWindowText.AppendL(infoBuf);
1.3190 + infoBuf.Zero();
1.3191 + }
1.3192 + else
1.3193 + {
1.3194 + infoBuf.Zero();
1.3195 + infoBuf.Append(AudioNotEnabled);
1.3196 + iMainWindowText.AppendL(infoBuf);
1.3197 + infoBuf.Zero();
1.3198 + }
1.3199 + infoBuf.Append(KDuration);
1.3200 + duration = iVideoPlayAgent->DurationL();
1.3201 + clipLengthVal = duration.Int64();
1.3202 + infoBuf.AppendNum(clipLengthVal);
1.3203 + iMainWindowText.AppendL(infoBuf);
1.3204 + infoBuf.Zero();
1.3205 + iVideoPlayAgent->VideoFrameSizeL(iFrameSize);
1.3206 + frameHeight = iFrameSize.iHeight;
1.3207 + frameWidth = iFrameSize.iWidth;
1.3208 + infoBuf.Append(KFrameSize);
1.3209 + infoBuf.AppendNum(frameWidth);
1.3210 + infoBuf.Append(KComma);
1.3211 + infoBuf.AppendNum(frameHeight);
1.3212 + iMainWindowText.AppendL(infoBuf);
1.3213 + infoBuf.Zero();
1.3214 + infoBuf.Append(KFrameRate);
1.3215 + iVideoFrameRate = GetVideoFrameRateL();
1.3216 + frameRate = TInt(iVideoFrameRate);
1.3217 + infoBuf.AppendNum(frameRate);
1.3218 + iMainWindowText.AppendL(infoBuf);
1.3219 + infoBuf.Zero();
1.3220 + break;
1.3221 +
1.3222 + case(EVideoPaused):
1.3223 + infoBuf.Append(KPaused);
1.3224 + iMainWindowText.AppendL(infoBuf);
1.3225 + if(iMode == EVideoRecord)
1.3226 + {
1.3227 + if(iVideoRecordAgent->AudioEnabledL())
1.3228 + {
1.3229 + infoBuf.Zero();
1.3230 + infoBuf.Append(AudioEnabled);
1.3231 + iMainWindowText.AppendL(infoBuf);
1.3232 + infoBuf.Zero();
1.3233 + }
1.3234 + else
1.3235 + {
1.3236 + infoBuf.Zero();
1.3237 + infoBuf.Append(AudioNotEnabled);
1.3238 + iMainWindowText.AppendL(infoBuf);
1.3239 + infoBuf.Zero();
1.3240 + }
1.3241 + infoBuf.Append(KDuration);
1.3242 + duration = iVideoRecordAgent->DurationL();
1.3243 + clipLengthVal = duration.Int64();
1.3244 + infoBuf.AppendNum(clipLengthVal);
1.3245 + iMainWindowText.AppendL(infoBuf);
1.3246 + infoBuf.Zero();
1.3247 +
1.3248 + }
1.3249 + if(iMode == EVideoPlay)
1.3250 + {
1.3251 + if(iVideoPlayAgent->AudioEnabledL())
1.3252 + {
1.3253 + infoBuf.Zero();
1.3254 + infoBuf.Append(AudioEnabled);
1.3255 + iMainWindowText.AppendL(infoBuf);
1.3256 + infoBuf.Zero();
1.3257 + infoBuf.Append(volume);
1.3258 + infoBuf.AppendNum(iVolumeOrGain);
1.3259 + infoBuf.Append(KPercent);
1.3260 + iMainWindowText.AppendL(infoBuf);
1.3261 + infoBuf.Zero();
1.3262 + }
1.3263 + else
1.3264 + {
1.3265 + infoBuf.Zero();
1.3266 + infoBuf.Append(AudioNotEnabled);
1.3267 + iMainWindowText.AppendL(infoBuf);
1.3268 + infoBuf.Zero();
1.3269 + }
1.3270 + infoBuf.Append(KDuration);
1.3271 + duration = iVideoPlayAgent->DurationL();
1.3272 + clipLengthVal = duration.Int64();
1.3273 + infoBuf.AppendNum(clipLengthVal);
1.3274 + iMainWindowText.AppendL(infoBuf);
1.3275 + infoBuf.Zero();
1.3276 + iVideoPlayAgent->VideoFrameSizeL(iFrameSize);
1.3277 + frameHeight = iFrameSize.iHeight;
1.3278 + frameWidth = iFrameSize.iWidth;
1.3279 + infoBuf.Append(KFrameSize);
1.3280 + infoBuf.AppendNum(frameWidth);
1.3281 + infoBuf.Append(KComma);
1.3282 + infoBuf.AppendNum(frameHeight);
1.3283 + iMainWindowText.AppendL(infoBuf);
1.3284 + infoBuf.Zero();
1.3285 + infoBuf.Append(KFrameRate);
1.3286 + iVideoFrameRate = GetVideoFrameRateL();
1.3287 + frameRate = TInt(iVideoFrameRate);
1.3288 + infoBuf.AppendNum(frameRate);
1.3289 + iMainWindowText.AppendL(infoBuf);
1.3290 + infoBuf.Zero();
1.3291 + }
1.3292 + break;
1.3293 +
1.3294 + case(EVideoStopped):
1.3295 + infoBuf.Append(KStopped);
1.3296 + iMainWindowText.AppendL(infoBuf);
1.3297 + if(iMode == EVideoPlay)
1.3298 + {
1.3299 + if(iVideoPlayAgent->AudioEnabledL())
1.3300 + {
1.3301 + infoBuf.Zero();
1.3302 + infoBuf.Append(AudioEnabled);
1.3303 + iMainWindowText.AppendL(infoBuf);
1.3304 + infoBuf.Zero();
1.3305 + infoBuf.Append(volume);
1.3306 + infoBuf.AppendNum(iVolumeOrGain);
1.3307 + infoBuf.Append(KPercent);
1.3308 + iMainWindowText.AppendL(infoBuf);
1.3309 + infoBuf.Zero();
1.3310 + }
1.3311 + else
1.3312 + {
1.3313 + infoBuf.Zero();
1.3314 + infoBuf.Append(AudioNotEnabled);
1.3315 + iMainWindowText.AppendL(infoBuf);
1.3316 + infoBuf.Zero();
1.3317 + }
1.3318 + infoBuf.Append(KDuration);
1.3319 + duration = iVideoPlayAgent->DurationL();
1.3320 + clipLengthVal = duration.Int64();
1.3321 + infoBuf.AppendNum(clipLengthVal);
1.3322 + iMainWindowText.AppendL(infoBuf);
1.3323 + infoBuf.Zero();
1.3324 + iVideoPlayAgent->VideoFrameSizeL(iFrameSize);
1.3325 + frameHeight = iFrameSize.iHeight;
1.3326 + frameWidth = iFrameSize.iWidth;
1.3327 + infoBuf.Append(KFrameSize);
1.3328 + infoBuf.AppendNum(frameWidth);
1.3329 + infoBuf.Append(KComma);
1.3330 + infoBuf.AppendNum(frameHeight);
1.3331 + iMainWindowText.AppendL(infoBuf);
1.3332 + infoBuf.Zero();
1.3333 + iVideoFrameRate = GetVideoFrameRateL();
1.3334 + }
1.3335 + else if(iMode == EVideoRecord)
1.3336 + {
1.3337 + if(iVideoRecordAgent->AudioEnabledL())
1.3338 + {
1.3339 + infoBuf.Zero();
1.3340 + infoBuf.Append(AudioEnabled);
1.3341 + iMainWindowText.AppendL(infoBuf);
1.3342 + infoBuf.Zero();
1.3343 + infoBuf.Append(gain);
1.3344 + infoBuf.AppendNum(iVolumeOrGain);
1.3345 + infoBuf.Append(KPercent);
1.3346 + iMainWindowText.AppendL(infoBuf);
1.3347 + }
1.3348 + else
1.3349 + {
1.3350 + infoBuf.Zero();
1.3351 + infoBuf.Append(AudioNotEnabled);
1.3352 + iMainWindowText.AppendL(infoBuf);
1.3353 + infoBuf.Zero();
1.3354 + }
1.3355 + infoBuf.Zero();
1.3356 + infoBuf.Append(KDuration);
1.3357 + duration = iVideoRecordAgent->DurationL();
1.3358 + clipLengthVal = duration.Int64();
1.3359 + infoBuf.AppendNum(clipLengthVal);
1.3360 + iMainWindowText.AppendL(infoBuf);
1.3361 + infoBuf.Zero();
1.3362 + infoBuf.Append(KFrameSize);
1.3363 + frameHeight =iFrameSize.iHeight;
1.3364 + frameWidth =iFrameSize.iWidth;
1.3365 + infoBuf.AppendNum(frameWidth);
1.3366 + infoBuf.Append(KComma);
1.3367 + infoBuf.AppendNum(frameHeight);
1.3368 + iMainWindowText.AppendL(infoBuf);
1.3369 + infoBuf.Zero();
1.3370 + }
1.3371 + infoBuf.Zero();
1.3372 + infoBuf.Append(KFrameRate);
1.3373 + frameRate = TInt(iVideoFrameRate);
1.3374 + infoBuf.AppendNum(frameRate);
1.3375 + iMainWindowText.AppendL(infoBuf);
1.3376 + infoBuf.Zero();
1.3377 + break;
1.3378 + }
1.3379 + TInt clipLen = I64INT(clipLengthVal);
1.3380 + iAppView->SetClipLength(clipLen);
1.3381 + }
1.3382 +
1.3383 +void CMVSAppUi::BuildDollarDesFromArrayL(TDes& aDollarDes)
1.3384 + {
1.3385 + //take the CDesCArrayFlat and build a dollar separated descriptor
1.3386 + TInt counter;
1.3387 + TBuf<2> dollar;
1.3388 + for(counter = 0; counter < iMainWindowText.Count(); ++counter)
1.3389 + {
1.3390 + aDollarDes.Append(iMainWindowText[counter]);
1.3391 + iCoeEnv->ReadResourceL(dollar, R_DOLLARDOLLAR);
1.3392 + aDollarDes.Append(dollar);
1.3393 + }
1.3394 + return;
1.3395 + }
1.3396 +
1.3397 +//
1.3398 +//ConvertTimeToDes(...)
1.3399 +//
1.3400 +// Converts the time to a descriptor for display purposes. The display is
1.3401 +// in the format HH:MM:SS:SS.
1.3402 +//
1.3403 +void CMVSAppUi::ConvertTimeToDes(TTimeIntervalMicroSeconds aPosition,
1.3404 + TDes& aDes)
1.3405 + {
1.3406 + _LIT(KColon, ":");
1.3407 + _LIT(KZeroDes, "0");
1.3408 + RArray<TInt> addZero; //array to record whether we need to append a '0'
1.3409 + //to each value in the times array.
1.3410 + RArray<TInt> times; //The array of times, stored hour, minute, second...
1.3411 +
1.3412 + TInt64 milliseconds = I64INT(aPosition.Int64())/1000;
1.3413 + TInt seconds = milliseconds/1000;
1.3414 + milliseconds = milliseconds - (seconds * 1000);
1.3415 +
1.3416 + TInt hundreds = milliseconds/10; //hundreds of seconds
1.3417 +
1.3418 + TInt minutes = seconds/60;
1.3419 + seconds = seconds - minutes*60; //seconds
1.3420 +
1.3421 + TInt hours = minutes/60; //hours
1.3422 + minutes = minutes - hours*60; //minutes
1.3423 +
1.3424 + times.Append(hours);
1.3425 + times.Append(minutes);
1.3426 + times.Append(seconds);
1.3427 + times.Append(hundreds); //fill the array
1.3428 +
1.3429 + TBuf<256> timeDes; //descriptor holding each element of the times array
1.3430 + //in turn.
1.3431 +
1.3432 + TInt counter = 0; //counter
1.3433 + for(counter = 0; counter < 4; ++counter)
1.3434 + {
1.3435 + timeDes.Zero();
1.3436 + timeDes.AppendNum(times[counter]);
1.3437 +
1.3438 + if(timeDes.Length() == 1)
1.3439 + {
1.3440 + //If the time value is a single digit, we need to add a '0'
1.3441 + addZero.Append(1);
1.3442 + }
1.3443 + else
1.3444 + {
1.3445 + //Otherwise, we do not.
1.3446 + addZero.Append(0);
1.3447 + }
1.3448 + }
1.3449 +
1.3450 + //Add zeros where required.
1.3451 + if(addZero[0])
1.3452 + aDes.Append(KZeroDes);
1.3453 + aDes.AppendNum(hours);
1.3454 + aDes.Append(KColon);
1.3455 + if(addZero[1])
1.3456 + aDes.Append(KZeroDes);
1.3457 + aDes.AppendNum(minutes);
1.3458 + aDes.Append(KColon);
1.3459 + if(addZero[2])
1.3460 + aDes.Append(KZeroDes);
1.3461 + aDes.AppendNum(seconds);
1.3462 + aDes.Append(KColon);
1.3463 + if(addZero[3])
1.3464 + aDes.Append(KZeroDes);
1.3465 + aDes.AppendNum(hundreds);
1.3466 +
1.3467 + //Close the RArrays and return
1.3468 + addZero.Close();
1.3469 + times.Close();
1.3470 + return;
1.3471 + }
1.3472 +
1.3473 +//
1.3474 +//UpdatePositionViewL()
1.3475 +//
1.3476 +// Updates the view if the state is recording or playing. Otherwise, this is
1.3477 +// unnecessary.
1.3478 +//
1.3479 +void CMVSAppUi::UpdatePositionViewL()
1.3480 + {
1.3481 + TBuf<64> dispStr1;
1.3482 + TBuf<256> temp;
1.3483 + TInt64 currentposition = 0;
1.3484 + if(iState == EAudioRecording || iState == EAudioPlaying || iState == EVideoRecording
1.3485 + || iState == EVideoPlaying || iState == EAudioPaused || iState == EVideoPaused
1.3486 + || iState == EVideoStopped || iState == EAudioStopped)
1.3487 + {
1.3488 + iDisplayTime.Zero();
1.3489 + if(iMode==EAudioRecord)
1.3490 + {
1.3491 + TBuf<64> dispStr2;
1.3492 + TBuf<32> recTimeLeft;
1.3493 + TTimeIntervalMicroSeconds timeLeft = iAudioRecordAgent->RecordTimeAvailable();
1.3494 + if(iRecordLimitSet && iState == EAudioRecording)
1.3495 + {
1.3496 + ConvertTimeToDes(timeLeft, recTimeLeft);
1.3497 + dispStr2.Copy(_L("Time Left:"));
1.3498 + dispStr2.Append(recTimeLeft);
1.3499 + iAppView->iStatusWindowTimeControl->SetText2L(dispStr2);
1.3500 + dispStr1.Copy(_L("Rec. Time:"));
1.3501 + }
1.3502 + }
1.3503 + if(iMode==EAudioRecord && iState==EAudioRecording)
1.3504 + {
1.3505 + iClipLength = iAudioRecordAgent->Duration();
1.3506 + iTimeElapsed = iAudioRecordAgent->Position();
1.3507 + TInt64 duration = iClipLength.Int64();
1.3508 + TInt64 position = iTimeElapsed.Int64();
1.3509 + currentposition = duration + position;
1.3510 + iTimeElapsed = TTimeIntervalMicroSeconds(currentposition);
1.3511 + }
1.3512 + else if(iMode==EAudioRecord && iState==EAudioPlaying)
1.3513 + {
1.3514 + iTimeElapsed=iAudioRecordAgent->Position();
1.3515 + iAppView->UpdatePlayProgress(iTimeElapsed);
1.3516 + }
1.3517 + else if(iMode==EAudioPlay)
1.3518 + {
1.3519 + iAudioPlayAgent->GetPosition(iTimeElapsed);
1.3520 + iAppView->UpdatePlayProgress(iTimeElapsed);
1.3521 + }
1.3522 + else if(iMode==EVideoPlay)
1.3523 + {
1.3524 + iTimeElapsed = iVideoPlayAgent->PositionL();
1.3525 + }
1.3526 + else if(iMode==EVideoRecord)
1.3527 + {
1.3528 + iTimeElapsed = iVideoRecordAgent->DurationL();
1.3529 + }
1.3530 + temp.AppendNum(currentposition);
1.3531 +
1.3532 + ConvertTimeToDes(iTimeElapsed, iDisplayTime);
1.3533 + dispStr1.Append(iDisplayTime);
1.3534 + iAppView->iStatusWindowTimeControl->SetTextL(dispStr1);
1.3535 + iAppView->iStatusWindowTimeControl->DrawNow();
1.3536 + }
1.3537 + }
1.3538 +
1.3539 +
1.3540 +void CMVSAppUi::SetMaxFileSize(TInt& aVal)
1.3541 + {
1.3542 + if(aVal>0)
1.3543 + {
1.3544 + iRecordLimitSet = ETrue;
1.3545 + iAudioRecordAgent->SetMaxWriteLength(aVal);
1.3546 + }
1.3547 + else
1.3548 + {
1.3549 + iRecordLimitSet = EFalse;
1.3550 + iAudioRecordAgent->SetMaxWriteLength(aVal);
1.3551 + TRAP_IGNORE(iAppView->iStatusWindowTimeControl->ResetText2L());
1.3552 + }
1.3553 + }
1.3554 +
1.3555 +//Handling the errors and logging it to the
1.3556 +//log file
1.3557 +void CMVSAppUi::LogErrors(TInt aError)
1.3558 + {
1.3559 + TBuf<KErrorTextLength> erorrDes;
1.3560 + CEikonEnv::Static()->GetErrorText(erorrDes,aError);
1.3561 + CEikonEnv::Static()->AlertWin(erorrDes);
1.3562 + iLogger.Write(erorrDes);
1.3563 + }
1.3564 +
1.3565 +
1.3566 +void CMVSAppUi::DetermineFinalFNameL()
1.3567 + {
1.3568 + //check whether the extension and the controller
1.3569 + //has been selected or not.If not selected proceed
1.3570 + //to the next dialog, nothing to be appended here to
1.3571 + //the filename.Else append the selected extension to
1.3572 + //the filename.
1.3573 + if(iSelectedPluginIdx == KControllerNotSelected)
1.3574 + {
1.3575 + iProceed = ETrue;
1.3576 + }
1.3577 + TFileName givenExt;
1.3578 + TParsePtr parser(iDestFilename);
1.3579 + TPtrC extensionval = parser.Ext();
1.3580 + if(extensionval.Length() == 0)
1.3581 + {
1.3582 + iDestFilename.Append(iControllerExt);
1.3583 + iProceed = ETrue;
1.3584 + return;
1.3585 + }
1.3586 + else
1.3587 + {
1.3588 + //If the extension is too long, report an error.
1.3589 + if(extensionval.Length() > 4)
1.3590 + {
1.3591 + _LIT(KExtTooLong, "Extension TOO long");
1.3592 + User::InfoPrint(KExtTooLong);
1.3593 + iProceed = EFalse;
1.3594 + }
1.3595 +
1.3596 + //Otherwise record the extension given in the filename
1.3597 + if(extensionval.CompareF(iControllerExt)==0)
1.3598 + {
1.3599 + iProceed = ETrue;
1.3600 + return;
1.3601 + }
1.3602 +
1.3603 + //Otherwise, append the right extension to the filename and return.
1.3604 + else
1.3605 + {
1.3606 + _LIT(KWrongExt, "Wrong Extension");
1.3607 + _LIT(KWrongExtBody, "Extension mismatch,Please re-enter");
1.3608 + CEikonEnv::Static()->InfoWinL(KWrongExt, KWrongExtBody);
1.3609 + SaveAsDialogL();
1.3610 + iProceed = EFalse;
1.3611 + }
1.3612 + }
1.3613 + }
1.3614 +
1.3615 +TPoint CMVSAppUi::DrawBorders(const TSize& aSize) const
1.3616 + {
1.3617 + CWindowGc& gc = iAppView->iMainWindowControl->SystemGc();
1.3618 + gc.Activate(iAppView->iMainWindowControl->ControlWindow());
1.3619 + TRect rect(iAppView->iMainWindowControl->Size());
1.3620 + TPoint pos( rect.iTl.iX + rect.Width()/2 - aSize.iWidth/2,
1.3621 + rect.iTl.iY + rect.Height()/2 - aSize.iHeight/2);
1.3622 + TRect drawRect(pos,aSize);
1.3623 + gc.SetPenColor(KRgbBlack);
1.3624 + drawRect.Grow(1,1);
1.3625 + gc.DrawRect(drawRect);
1.3626 + gc.Deactivate();
1.3627 + iAppView->iMainWindowControl->ControlEnv()->WsSession().Flush();
1.3628 + return pos;
1.3629 + }
1.3630 +
1.3631 +void CMVSAppUi::StopViewFinder()
1.3632 + {
1.3633 + if(!iVideoRecordAgent)
1.3634 + {
1.3635 + return;
1.3636 + }
1.3637 + CCamera *camera = iVideoRecordAgent->Camera();
1.3638 + if (camera->ViewFinderActive())
1.3639 + {
1.3640 + camera->StopViewFinder();
1.3641 + iAppView->iMainWindowControl->DrawNow();
1.3642 + }
1.3643 + }