1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/vclnt/TestPlayer.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,1208 @@
1.4 +// Copyright (c) 2002-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 +//
1.18 +
1.19 +#include "TestPlayer.h"
1.20 +
1.21 +#include <e32math.h>
1.22 +
1.23 +/**
1.24 + * Constructor
1.25 + */
1.26 +CTestVclntVideoFile::CTestVclntVideoFile(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay)
1.27 + :iPlay (aPlay)
1.28 + {
1.29 + // store the name of this test case
1.30 + // this is the name that is used by the script file
1.31 + // Each test step initialises it's own name
1.32 + iTestStepName = aTestName;
1.33 + iSectName = aSectName;
1.34 + iKeyName = aKeyName;
1.35 +
1.36 + // expand heap, so we can load 80k video
1.37 + iHeapSize = 150000;
1.38 + }
1.39 +
1.40 +CTestVclntVideoFile* CTestVclntVideoFile::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay)
1.41 + {
1.42 + CTestVclntVideoFile* self = new (ELeave) CTestVclntVideoFile(aTestName,aSectName,aKeyName,aPlay);
1.43 + return self;
1.44 + }
1.45 +
1.46 +CTestVclntVideoFile* CTestVclntVideoFile::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay)
1.47 + {
1.48 + CTestVclntVideoFile* self = CTestVclntVideoFile::NewLC(aTestName,aSectName,aKeyName,aPlay);
1.49 + CleanupStack::PushL(self);
1.50 + return self;
1.51 + }
1.52 +
1.53 +void CTestVclntVideoFile::MvpuoOpenComplete(TInt aError)
1.54 + {
1.55 + iError = aError;
1.56 + INFO_PRINTF1(_L("Open Complete callback"));
1.57 + CActiveScheduler::Stop();
1.58 + }
1.59 +
1.60 +void CTestVclntVideoFile::MvpuoPrepareComplete(TInt aError)
1.61 + {
1.62 + iError = aError;
1.63 + INFO_PRINTF1(_L("Open Complete callback"));
1.64 + CActiveScheduler::Stop();
1.65 + }
1.66 +
1.67 +void CTestVclntVideoFile::MvpuoFrameReady(CFbsBitmap& /*aFrame*/, TInt aError)
1.68 + {
1.69 + iError = aError;
1.70 + INFO_PRINTF1(_L("Frame Ready callback"));
1.71 + }
1.72 +
1.73 +void CTestVclntVideoFile::MvpuoPlayComplete(TInt aError)
1.74 + {
1.75 + iError = aError;
1.76 + INFO_PRINTF1(_L("Play Complete callback"));
1.77 + CActiveScheduler::Stop();
1.78 + }
1.79 +
1.80 +void CTestVclntVideoFile::MvpuoEvent(const TMMFEvent& /*aEvent*/)
1.81 + {
1.82 + }
1.83 +
1.84 +
1.85 +/**
1.86 + * Load and initialise an audio file.
1.87 + */
1.88 +TVerdict CTestVclntVideoFile::DoTestStepL()
1.89 + {
1.90 + TVerdict ret = EFail;
1.91 + iError = KErrTimedOut;
1.92 +
1.93 + INFO_PRINTF1(_L("Test : Video Player - File"));
1.94 +
1.95 + TPtrC filename;
1.96 + if(!GetStringFromConfig(iSectName,iKeyName,filename))
1.97 + return EInconclusive;
1.98 +
1.99 + InitWservL();
1.100 +
1.101 + TRect rect, clipRect;
1.102 + CVideoPlayerUtility* player = CVideoPlayerUtility::NewL(*this, EMdaPriorityNormal,
1.103 + EMdaPriorityPreferenceTimeAndQuality,
1.104 + iWs, *iScreen, *iWindow, rect, clipRect);
1.105 + CleanupStack::PushL(player);
1.106 + TRAP(iError,player->OpenFileL(filename));
1.107 +
1.108 + if(iError == KErrNone)
1.109 + {
1.110 + // Wait for initialisation callback
1.111 + INFO_PRINTF1(_L("CVideoPlayerUtility: Opening file"));
1.112 + CActiveScheduler::Start();
1.113 + }
1.114 +
1.115 + // Until JetStream
1.116 +#ifndef JETSTREAM_TESTS
1.117 + if(iError == KErrNotSupported)
1.118 + ret = EPass;
1.119 +#endif
1.120 +
1.121 + // Check for errors.
1.122 + if (iError == KErrNone && player != NULL)
1.123 + {
1.124 + player->Prepare();
1.125 + CActiveScheduler::Start();
1.126 + }
1.127 +
1.128 + // Check for errors.
1.129 + if (iError == KErrNone && player != NULL)
1.130 + ret = DoTestL(player);
1.131 +
1.132 + INFO_PRINTF1(_L("CVideoPlayerUtility: Destroying"));
1.133 + CleanupStack::PopAndDestroy(player);
1.134 + if(iError != KErrNone)
1.135 + ERR_PRINTF2( _L("CVideoPlayerUtility failed with error %d"),iError );
1.136 + return ret;
1.137 + }
1.138 +
1.139 +TVerdict CTestVclntVideoFile::DoTestL(CVideoPlayerUtility* aPlayer)
1.140 + {
1.141 + TVerdict ret = EFail;
1.142 +
1.143 +// #ifdef JETSTREAM_TESTS
1.144 + if(iPlay)
1.145 + {
1.146 + iError = KErrTimedOut;
1.147 + aPlayer->Play();
1.148 + INFO_PRINTF1(_L("CVideoPlayerUtility: Playing file"));
1.149 + // Wait for init callback
1.150 + CActiveScheduler::Start();
1.151 + if(iError == KErrNone)
1.152 + ret = EPass;
1.153 + }
1.154 + else
1.155 + ret = EPass;
1.156 +// #else
1.157 +// aPlayer->Stop();
1.158 +// #endif
1.159 +
1.160 + return ret;
1.161 + }
1.162 +
1.163 +//------------------------------------------------------------------
1.164 +
1.165 +/**
1.166 + * Constructor
1.167 + */
1.168 +CTestVclntVideoDes::CTestVclntVideoDes(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, const TBool aPlay)
1.169 + :iPlay (aPlay)
1.170 +
1.171 + {
1.172 + // store the name of this test case
1.173 + // this is the name that is used by the script file
1.174 + // Each test step initialises it's own name
1.175 + iTestStepName = aTestName;
1.176 + iSectName = aSectName;
1.177 + iKeyName = aKeyName;
1.178 +
1.179 + // *** Jim : expand heap, so we can load 80k video
1.180 + iHeapSize = 150000;
1.181 + }
1.182 +
1.183 +CTestVclntVideoDes* CTestVclntVideoDes::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay)
1.184 + {
1.185 + CTestVclntVideoDes* self = new (ELeave) CTestVclntVideoDes(aTestName,aSectName,aKeyName,aPlay);
1.186 + return self;
1.187 + }
1.188 +
1.189 +CTestVclntVideoDes* CTestVclntVideoDes::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay)
1.190 + {
1.191 + CTestVclntVideoDes* self = CTestVclntVideoDes::NewLC(aTestName,aSectName,aKeyName,aPlay);
1.192 + CleanupStack::PushL(self);
1.193 + return self;
1.194 + }
1.195 +
1.196 +void CTestVclntVideoDes::MvpuoOpenComplete(TInt aError)
1.197 + {
1.198 + iError = aError;
1.199 + CActiveScheduler::Stop();
1.200 + }
1.201 +
1.202 +void CTestVclntVideoDes::MvpuoPrepareComplete(TInt aError)
1.203 + {
1.204 + iError = aError;
1.205 + CActiveScheduler::Stop();
1.206 + }
1.207 +
1.208 +void CTestVclntVideoDes::MvpuoFrameReady(CFbsBitmap& /*aFrame*/,TInt aError)
1.209 + {
1.210 + iError = aError;
1.211 + // Will this function require a Active Scheduler Stop?
1.212 + }
1.213 +
1.214 +void CTestVclntVideoDes::MvpuoPlayComplete(TInt aError)
1.215 + {
1.216 + iError = aError;
1.217 + CActiveScheduler::Stop();
1.218 + }
1.219 +
1.220 +void CTestVclntVideoDes::MvpuoEvent(const TMMFEvent& /*aEvent*/)
1.221 + {
1.222 + }
1.223 +
1.224 +
1.225 +TVerdict CTestVclntVideoDes::DoTestStepPreambleL()
1.226 + {
1.227 + TPtrC filename;
1.228 + if(!GetStringFromConfig(iSectName, iKeyName, filename))
1.229 + return EInconclusive;
1.230 +
1.231 + RFs fs;
1.232 + RFile file;
1.233 + TInt size = 0;
1.234 +
1.235 + // connect to file system and open file
1.236 + User::LeaveIfError(fs.Connect());
1.237 + User::LeaveIfError(file.Open(fs,filename,EFileRead));
1.238 + CleanupClosePushL(file);
1.239 +
1.240 + // Set HBuf size
1.241 + User::LeaveIfError(file.Size(size));
1.242 + INFO_PRINTF2(_L("size of file = %d\n"),size);//Statement Changed under DEF105143
1.243 +
1.244 + iVideo = HBufC8::NewMaxL(size);
1.245 +
1.246 + // read data into Hbuf
1.247 + TPtr8 bufferDes(iVideo->Des());
1.248 + User::LeaveIfError(file.Read(bufferDes));
1.249 +
1.250 + CleanupStack::PopAndDestroy(); //file
1.251 + return CTestMmfVclntStep::DoTestStepPreambleL();
1.252 + }
1.253 +
1.254 +TVerdict CTestVclntVideoDes::DoTestStepPostambleL()
1.255 + {
1.256 + delete iVideo;
1.257 + iVideo = NULL;
1.258 + return CTestMmfVclntStep::DoTestStepPostambleL();
1.259 + }
1.260 +
1.261 +/**
1.262 + * Load and initialise an audio descriptor.
1.263 + */
1.264 +TVerdict CTestVclntVideoDes::DoTestStepL()
1.265 + {
1.266 + TVerdict ret = EFail;
1.267 +
1.268 + INFO_PRINTF1(_L("Test : Video Player - Descriptor"));
1.269 +
1.270 + iError = KErrTimedOut;
1.271 +
1.272 + InitWservL();
1.273 +
1.274 + TRect rect, clipRect;
1.275 + CVideoPlayerUtility* player = CVideoPlayerUtility::NewL(*this, EMdaPriorityNormal,
1.276 + EMdaPriorityPreferenceTimeAndQuality,
1.277 + iWs, *iScreen, *iWindow, rect, clipRect);
1.278 + CleanupStack::PushL(player);
1.279 +
1.280 +
1.281 + TRAP(iError, player->OpenDesL(iVideo->Des()));
1.282 +
1.283 + if(iError == KErrNone)
1.284 + {
1.285 + INFO_PRINTF1(_L("CVideoPlayerUtility: Opening descriptor"));
1.286 + // Wait for init callback
1.287 + CActiveScheduler::Start();
1.288 + }
1.289 +
1.290 + // Until JetStream
1.291 +#ifndef JETSTREAM_TESTS
1.292 + if(iError == KErrNotSupported)
1.293 + ret = EPass;
1.294 +#endif
1.295 +
1.296 + if (iError == KErrNone && player != NULL)
1.297 + {
1.298 + player->Prepare();
1.299 + CActiveScheduler::Start();
1.300 + }
1.301 +
1.302 +
1.303 + if ((iError == KErrNone) && (player != NULL))
1.304 + ret = DoTestL(player);
1.305 +
1.306 + INFO_PRINTF1(_L("CVideoPlayerUtility: Destroying"));
1.307 + CleanupStack::PopAndDestroy(player);
1.308 + if(iError != KErrNone)
1.309 + ERR_PRINTF2( _L("CVideoPlayerUtility failed with error %d"),iError );
1.310 + return ret;
1.311 + }
1.312 +
1.313 +TVerdict CTestVclntVideoDes::DoTestL(CVideoPlayerUtility* aPlayer)
1.314 + {
1.315 + TVerdict ret = EFail;
1.316 +// #ifdef JETSTREAM_TESTS
1.317 +
1.318 + if(iPlay)
1.319 + {
1.320 + iError = KErrTimedOut;
1.321 + aPlayer->Play();
1.322 + INFO_PRINTF1(_L("CVideoPlayerUtility: Playing descriptor"));
1.323 + // Wait for init callback
1.324 + CActiveScheduler::Start();
1.325 + if(iError == KErrNone)
1.326 + ret = EPass;
1.327 + }
1.328 + else
1.329 + ret = EPass;
1.330 +//#else
1.331 +// aPlayer->Stop();
1.332 +//#endif
1.333 + return ret;
1.334 + }
1.335 +
1.336 +
1.337 +//------------------------------------------------------------------
1.338 +
1.339 +/**
1.340 + * Constructor
1.341 + */
1.342 +CTestVclntVideoUrl::CTestVclntVideoUrl(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay)
1.343 + :iPlay (aPlay)
1.344 + {
1.345 + // store the name of this test case
1.346 + // this is the name that is used by the script file
1.347 + // Each test step initialises it's own name
1.348 + iTestStepName = aTestName;
1.349 + iSectName = aSectName;
1.350 + iKeyName = aKeyName;
1.351 + }
1.352 +
1.353 +CTestVclntVideoUrl* CTestVclntVideoUrl::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay)
1.354 + {
1.355 + CTestVclntVideoUrl* self = CTestVclntVideoUrl::NewLC(aTestName,aSectName,aKeyName,aPlay);
1.356 + CleanupStack::Pop();
1.357 + return self;
1.358 + }
1.359 +
1.360 +CTestVclntVideoUrl* CTestVclntVideoUrl::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay)
1.361 + {
1.362 + CTestVclntVideoUrl* self = new (ELeave) CTestVclntVideoUrl(aTestName,aSectName,aKeyName,aPlay);
1.363 + CleanupStack::PushL(self);
1.364 + return self;
1.365 + }
1.366 +
1.367 +void CTestVclntVideoUrl::MvpuoOpenComplete(TInt aError)
1.368 + {
1.369 + iError = aError;
1.370 + INFO_PRINTF1(_L("Open complete callback"));
1.371 + CActiveScheduler::Stop();
1.372 + }
1.373 +
1.374 +void CTestVclntVideoUrl::MvpuoPrepareComplete(TInt aError)
1.375 + {
1.376 + iError = aError;
1.377 + INFO_PRINTF1(_L("Open complete callback"));
1.378 + CActiveScheduler::Stop();
1.379 + }
1.380 +
1.381 +void CTestVclntVideoUrl::MvpuoFrameReady(CFbsBitmap& /*aFrame*/, TInt aError)
1.382 + {
1.383 + iError = aError;
1.384 + // ???
1.385 + INFO_PRINTF1(_L("Frame Ready callback"));
1.386 + }
1.387 +
1.388 +void CTestVclntVideoUrl::MvpuoPlayComplete(TInt aError)
1.389 + {
1.390 + iError = aError;
1.391 + INFO_PRINTF1(_L("Play complete callback"));
1.392 + CActiveScheduler::Stop();
1.393 + }
1.394 +
1.395 +void CTestVclntVideoUrl::MvpuoEvent(const TMMFEvent& /*aEvent*/)
1.396 + {
1.397 + }
1.398 +
1.399 +
1.400 +/**
1.401 + * Open audio from a URL and play.
1.402 + */
1.403 +TVerdict CTestVclntVideoUrl::DoTestStepL()
1.404 + {
1.405 + TVerdict ret = EFail;
1.406 +
1.407 + INFO_PRINTF1(_L("Test : Video Player - URL"));
1.408 +
1.409 + iError = KErrTimedOut;
1.410 +
1.411 + TPtrC urlname;
1.412 + if(!GetStringFromConfig(iSectName,iKeyName,urlname))
1.413 + return EInconclusive;
1.414 +
1.415 + InitWservL();
1.416 +
1.417 + TRect rect, clipRect;
1.418 + CVideoPlayerUtility* player = CVideoPlayerUtility::NewL(*this, EMdaPriorityNormal,
1.419 + EMdaPriorityPreferenceTimeAndQuality,
1.420 + iWs, *iScreen, *iWindow, rect, clipRect);
1.421 + // wait for init to complete
1.422 + CleanupStack::PushL(player);
1.423 + player->OpenUrlL(urlname);
1.424 + INFO_PRINTF1(_L("CVideoPlayerUtility: Opening URL"));
1.425 + CActiveScheduler::Start();
1.426 +
1.427 + // Until JetStream
1.428 +#ifndef JETSTREAM_TESTS
1.429 + if(iError == KErrNotSupported)
1.430 + ret = EPass;
1.431 +#endif
1.432 +
1.433 + if (iError == KErrNone)
1.434 + {
1.435 + player->Prepare();
1.436 + CActiveScheduler::Start();
1.437 + }
1.438 +
1.439 + if (iError == KErrNone)
1.440 + ret = DoTestL(player);
1.441 +
1.442 + INFO_PRINTF1(_L("CVideoPlayerUtility: Destroying"));
1.443 + CleanupStack::PopAndDestroy(player);
1.444 + if(iError != KErrNone)
1.445 + ERR_PRINTF2( _L("CVideoPlayerUtility failed with error %d"),iError );
1.446 + return ret;
1.447 + }
1.448 +
1.449 +TVerdict CTestVclntVideoUrl::DoTestL(CVideoPlayerUtility* aPlayer)
1.450 + {
1.451 + TVerdict ret = EFail;
1.452 +
1.453 +//#ifdef JETSTREAM_TESTS
1.454 +
1.455 + iError = KErrTimedOut;
1.456 +
1.457 + aPlayer->Play();
1.458 + INFO_PRINTF1(_L("CVideoPlayerUtility: Playing URL"));
1.459 + // Wait for play to complete
1.460 + CActiveScheduler::Start();
1.461 +
1.462 + if(iError == KErrNone)
1.463 + ret = EPass;
1.464 +//#else
1.465 +// aPlayer->Stop();
1.466 +//#endif
1.467 +
1.468 + return ret;
1.469 + }
1.470 +
1.471 +
1.472 +//------------------------------------------------------------------
1.473 +
1.474 +
1.475 +CTestVclntEnqFrameRate::CTestVclntEnqFrameRate(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TInt aFrameRate)
1.476 + : CTestVclntVideoFile(aTestName,aSectName,aKeyName,EFalse)
1.477 + {
1.478 + iFrameRate = aFrameRate;
1.479 + }
1.480 +
1.481 +CTestVclntEnqFrameRate* CTestVclntEnqFrameRate::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TInt aFrameRate)
1.482 + {
1.483 + CTestVclntEnqFrameRate* self = new (ELeave) CTestVclntEnqFrameRate(aTestName,aSectName,aKeyName,aFrameRate);
1.484 + return self;
1.485 + }
1.486 +
1.487 +TVerdict CTestVclntEnqFrameRate::DoTestL(CVideoPlayerUtility* aPlayer)
1.488 + {
1.489 + INFO_PRINTF1(_L("Test : Video Player - Enquire Frame Rate"));
1.490 +
1.491 + TVerdict ret = EFail;
1.492 +
1.493 + TInt32 theFrameRate;
1.494 + Math::Int(theFrameRate, aPlayer->VideoFrameRateL());
1.495 + INFO_PRINTF2(_L("(Frame rate : %d)"), theFrameRate);
1.496 +
1.497 + // if we get here, we pass. The player does not have a SetVideoFrameRate()
1.498 + ret = EPass;
1.499 +
1.500 + return ret;
1.501 + }
1.502 +
1.503 +
1.504 +//------------------------------------------------------------------
1.505 +
1.506 +CTestVclntPosition::CTestVclntPosition(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTimeIntervalMicroSeconds aPosition)
1.507 + : CTestVclntVideoFile(aTestName,aSectName,aKeyName,EFalse)
1.508 + {
1.509 + iPosition = aPosition;
1.510 + }
1.511 +
1.512 +CTestVclntPosition* CTestVclntPosition::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTimeIntervalMicroSeconds aPosition)
1.513 + {
1.514 + CTestVclntPosition* self = new (ELeave) CTestVclntPosition(aTestName,aSectName,aKeyName,aPosition);
1.515 + return self;
1.516 + }
1.517 +
1.518 +TVerdict CTestVclntPosition::DoTestL(CVideoPlayerUtility* aPlayer)
1.519 + {
1.520 + // NB test video controller is stubbing certain functions. May have to rewrite this
1.521 + // for Jet Stream
1.522 +
1.523 + TVerdict ret = EFail;
1.524 +
1.525 + INFO_PRINTF1(_L("Test : Video Player - Position"));
1.526 +
1.527 + TBool validPosition = EFalse;
1.528 +
1.529 + INFO_PRINTF3(_L("Set Position %d Duration = %d"),
1.530 + I64INT(iPosition.Int64()), I64INT(aPlayer->DurationL().Int64()));
1.531 +
1.532 + // Set position: middle of clip.
1.533 + if (I64INT(iPosition.Int64()) == 0)
1.534 + iPosition = I64INT(aPlayer->DurationL().Int64()) / 2;
1.535 + // Set position: end of clip.
1.536 + if (I64INT(iPosition.Int64()) == -1)
1.537 + iPosition = aPlayer->DurationL();
1.538 +
1.539 + // Position is beyond the end of the clips duration
1.540 + // so check that the value is clipped.
1.541 + if(aPlayer->DurationL() < iPosition)
1.542 + {
1.543 + INFO_PRINTF2(_L("Longer than duration : Setting position to %d"), I64INT(iPosition.Int64()));
1.544 + aPlayer->SetPositionL(iPosition);
1.545 + INFO_PRINTF3(_L("Set : position = %d (if clipped : %d)"),
1.546 + I64INT(aPlayer->PositionL().Int64()), I64INT(aPlayer->DurationL().Int64()));
1.547 + if(aPlayer->PositionL() == aPlayer->DurationL())
1.548 + validPosition = ETrue;
1.549 + }
1.550 + // Position is negative
1.551 + // so check that the value is clipped.
1.552 + else if (I64INT(iPosition.Int64()) < 0)
1.553 + {
1.554 + INFO_PRINTF2(_L("Negative value : Setting position to %d"), I64INT(iPosition.Int64()));
1.555 + aPlayer->SetPositionL(iPosition);
1.556 + INFO_PRINTF2(_L("Set : position = %d (if clipped : 0)"), I64INT(aPlayer->PositionL().Int64()));
1.557 + if (I64INT(aPlayer->PositionL().Int64()) == 0)
1.558 + validPosition = ETrue;
1.559 + }
1.560 + else
1.561 + {
1.562 + INFO_PRINTF2(_L("Normal : Setting position to %d"), I64INT(iPosition.Int64()));
1.563 + aPlayer->SetPositionL(iPosition);
1.564 + INFO_PRINTF3(_L("Set : position = %d (if clipped : %d)"),
1.565 + I64INT(aPlayer->PositionL().Int64()), I64INT(iPosition.Int64()));
1.566 + if(aPlayer->PositionL() == iPosition)
1.567 + validPosition = ETrue;
1.568 + }
1.569 +
1.570 + // Position was set to a valid value.
1.571 + if(validPosition)
1.572 + {
1.573 + aPlayer->Play();
1.574 + INFO_PRINTF1(_L("CVideoPlayerUtility: Playing"));
1.575 + // wait for play to complete
1.576 + CActiveScheduler::Start();
1.577 +
1.578 + INFO_PRINTF2(_L("Error : %d"), iError);
1.579 + if (iError == KErrNone)
1.580 + ret = EPass;
1.581 + }
1.582 + else
1.583 + {
1.584 + // We've got an invalid position, attempt to play anyway...
1.585 + // the test controller should handle it
1.586 + aPlayer->Play();
1.587 + INFO_PRINTF1(_L("CVideoPlayerUtility: Playing from invalid position"));
1.588 + // wait for play to complete
1.589 + CActiveScheduler::Start();
1.590 +
1.591 + INFO_PRINTF2(_L("Error : %d"), iError);
1.592 + if (iError == KErrNone)
1.593 + ret = EPass;
1.594 +
1.595 + }
1.596 +
1.597 + return ret;
1.598 + }
1.599 +
1.600 +
1.601 +//------------------------------------------------------------------
1.602 +
1.603 +CTestVclntPriority::CTestVclntPriority(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TInt aPriority)
1.604 + : CTestVclntVideoFile(aTestName,aSectName,aKeyName,EFalse)
1.605 + {
1.606 + iPriority = aPriority;
1.607 + }
1.608 +
1.609 +CTestVclntPriority* CTestVclntPriority::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TInt aPriority)
1.610 + {
1.611 + CTestVclntPriority* self = new (ELeave) CTestVclntPriority(aTestName,aSectName,aKeyName,aPriority);
1.612 + return self;
1.613 + }
1.614 +
1.615 +TVerdict CTestVclntPriority::DoTestL(CVideoPlayerUtility* aPlayer)
1.616 + {
1.617 + TVerdict ret = EFail;
1.618 +
1.619 + INFO_PRINTF1(_L("Test : Video Player - Priority"));
1.620 +
1.621 + aPlayer->SetPriorityL(iPriority, EMdaPriorityPreferenceNone);
1.622 + TInt thePriority;
1.623 + TMdaPriorityPreference thePref;
1.624 + aPlayer->PriorityL(thePriority, thePref);
1.625 + INFO_PRINTF3(_L("Priority = %d (expecting %d)"), thePriority, iPriority);
1.626 + INFO_PRINTF3(_L("Pref = %d (expecting %d)"), thePref, EMdaPriorityPreferenceNone);
1.627 + if( (thePriority == iPriority) && (thePref == EMdaPriorityPreferenceNone) )
1.628 + return EPass;
1.629 + return ret;
1.630 + }
1.631 +
1.632 +
1.633 +//------------------------------------------------------------------
1.634 +
1.635 +CTestVclntDuration::CTestVclntDuration(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTimeIntervalMicroSeconds aDuration)
1.636 + : CTestVclntVideoFile(aTestName,aSectName,aKeyName,EFalse)
1.637 + {
1.638 + iDuration = aDuration;
1.639 + }
1.640 +
1.641 +CTestVclntDuration* CTestVclntDuration::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTimeIntervalMicroSeconds aDuration)
1.642 + {
1.643 + CTestVclntDuration* self = new (ELeave) CTestVclntDuration(aTestName,aSectName,aKeyName,aDuration);
1.644 + return self;
1.645 + }
1.646 +
1.647 +TVerdict CTestVclntDuration::DoTestL(CVideoPlayerUtility* aPlayer)
1.648 + {
1.649 + TVerdict ret = EFail;
1.650 +
1.651 + INFO_PRINTF1(_L("Test : Video Player - Duration"));
1.652 +
1.653 + if (I64INT(iDuration.Int64()) == 0)
1.654 + {
1.655 + TInt duration = I64INT(aPlayer->DurationL().Int64());
1.656 + aPlayer->Play();
1.657 + INFO_PRINTF1(_L("CVideoPlayerUtility: Playing"));
1.658 + TTime start;
1.659 + start.HomeTime();
1.660 + CActiveScheduler::Start();
1.661 + TTime stop;
1.662 + stop.HomeTime();
1.663 +
1.664 + TUint actualDuration = I64INT(stop.MicroSecondsFrom(start).Int64());
1.665 +
1.666 + INFO_PRINTF6(_L("Error : %d Start = %d Stop = %d Duration = %d ActualDuration = %d"),
1.667 + iError, I64INT(start.Int64()), I64INT(stop.Int64()), duration, actualDuration);
1.668 + if((iError == KErrNone) && (TimeComparison(actualDuration, duration, KExpectedDeviation)))
1.669 + ret = EPass;
1.670 + }
1.671 + else
1.672 + {
1.673 + if(aPlayer->DurationL() == iDuration)
1.674 + ret = EPass;
1.675 + }
1.676 + return ret;
1.677 + }
1.678 +
1.679 +//------------------------------------------------------------------
1.680 +
1.681 +CTestVclntVolume::CTestVclntVolume(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TInt aVolume)
1.682 + : CTestVclntVideoFile(aTestName,aSectName,aKeyName,EFalse)
1.683 + {
1.684 + iVolume = aVolume;
1.685 + }
1.686 +
1.687 +CTestVclntVolume* CTestVclntVolume::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TInt aVolume)
1.688 + {
1.689 + CTestVclntVolume* self = new (ELeave) CTestVclntVolume(aTestName,aSectName,aKeyName,aVolume);
1.690 + return self;
1.691 + }
1.692 +
1.693 +TVerdict CTestVclntVolume::DoTestL(CVideoPlayerUtility* aPlayer)
1.694 + {
1.695 + TVerdict ret = EFail;
1.696 +
1.697 + // NB : test video controller does not adjust invalid volumes
1.698 + // comment the checks back in for JS
1.699 +
1.700 + INFO_PRINTF1(_L("Test : Video Player - Volume"));
1.701 +
1.702 + INFO_PRINTF1(_L("Warning : test video controller does not adjust invalid volumes"));
1.703 +
1.704 + // Check maxvolume function
1.705 + if(iVolume == -1)
1.706 + {
1.707 + iVolume = aPlayer->MaxVolume();
1.708 + INFO_PRINTF3(_L("Volume = %d MaxVolume = %d"), iVolume, KMaxVolume);
1.709 + //if(iVolume == KMaxVolume)
1.710 + ret = EPass;
1.711 + }
1.712 + // Volume is truncated to maxvolume
1.713 + else if(iVolume > aPlayer->MaxVolume())
1.714 + {
1.715 + aPlayer->SetVolumeL(iVolume);
1.716 + INFO_PRINTF3(_L("Volume = %d MaxVolume = %d"), aPlayer->Volume(), aPlayer->MaxVolume());
1.717 + //if(aPlayer->Volume() == aPlayer->MaxVolume())
1.718 + ret = EPass;
1.719 + }
1.720 + // Volume is truncated to 0
1.721 + else if(iVolume < 0)
1.722 + {
1.723 + aPlayer->SetVolumeL(iVolume);
1.724 + INFO_PRINTF2(_L("Volume = %d (expecting 0)"), aPlayer->Volume());
1.725 + //if(aPlayer->Volume() == 0)
1.726 + ret = EPass;
1.727 + }
1.728 + // Set volume and check
1.729 + else
1.730 + {
1.731 + aPlayer->SetVolumeL(iVolume);
1.732 + INFO_PRINTF3(_L("Volume = %d (expecting %d)"), aPlayer->Volume(), iVolume);
1.733 + if(aPlayer->Volume() == iVolume)
1.734 + ret = EPass;
1.735 + }
1.736 +
1.737 + return ret;
1.738 + }
1.739 +
1.740 +//------------------------------------------------------------------
1.741 +
1.742 +CTestVclntCloseOpen::CTestVclntCloseOpen(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
1.743 + : CTestVclntVideoFile(aTestName,aSectName,aKeyName,EFalse)
1.744 + {}
1.745 +
1.746 +CTestVclntCloseOpen* CTestVclntCloseOpen::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
1.747 + {
1.748 + CTestVclntCloseOpen* self = new (ELeave) CTestVclntCloseOpen(aTestName,aSectName,aKeyName);
1.749 + return self;
1.750 + }
1.751 +
1.752 +TVerdict CTestVclntCloseOpen::DoTestL(CVideoPlayerUtility* aPlayer)
1.753 + {
1.754 + TVerdict ret = EFail;
1.755 +
1.756 + INFO_PRINTF1(_L("Test : Video Player - Close/Open"));
1.757 +
1.758 +//#ifdef JETSTREAM_TESTS
1.759 +
1.760 + TPtrC filename;
1.761 + if(!GetStringFromConfig(iSectName,iKeyName,filename))
1.762 + return EInconclusive;
1.763 +
1.764 + aPlayer->Close();
1.765 + User::After(KOneSecond);
1.766 +
1.767 + TRAP(iError,aPlayer->OpenFileL(filename));
1.768 + if(iError == KErrNone)
1.769 + {
1.770 + // Wait for initialisation callback
1.771 + INFO_PRINTF1(_L("CVideoPlayerUtility: Opening file"));
1.772 + ret = EPass;
1.773 + }
1.774 +
1.775 +//#else
1.776 +// aPlayer->Stop();
1.777 +//#endif
1.778 +
1.779 + return ret;
1.780 + }
1.781 +
1.782 +//------------------------------------------------------------------
1.783 +
1.784 +CTestVclntPause::CTestVclntPause(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
1.785 + : CTestVclntVideoFile(aTestName,aSectName,aKeyName,EFalse)
1.786 + {}
1.787 +
1.788 +CTestVclntPause* CTestVclntPause::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
1.789 + {
1.790 + CTestVclntPause* self = new (ELeave) CTestVclntPause(aTestName,aSectName,aKeyName);
1.791 + return self;
1.792 + }
1.793 +
1.794 +TVerdict CTestVclntPause::DoTestL(CVideoPlayerUtility* aPlayer)
1.795 + {
1.796 + TVerdict ret = EFail;
1.797 +
1.798 + INFO_PRINTF1(_L("Test : Video Player - Pause"));
1.799 +
1.800 + // Tests pause functionality
1.801 + // NB : not implemented in test controller
1.802 + INFO_PRINTF1(_L("CVideoPlayerUtility: Playing"));
1.803 + aPlayer->Play();
1.804 + CActiveScheduler::Start();
1.805 + aPlayer->PauseL();
1.806 +
1.807 +#ifdef JETSTREAM_TESTS
1.808 + TInt duration = I64INT(aPlayer->DurationL().Int64());
1.809 +
1.810 + iError = KErrTimedOut;
1.811 + aPlayer->Play();
1.812 + INFO_PRINTF1(_L("CVideoPlayerUtility: Playing"));
1.813 + TTime start;
1.814 + start.HomeTime();
1.815 + CActiveScheduler::Start();
1.816 + TTime stop;
1.817 + stop.HomeTime();
1.818 +
1.819 + TUint actualDuration = I64INT(stop.MicroSecondsFrom(start).Int64());
1.820 +
1.821 + INFO_PRINTF6(_L("Error : %d Start = %d Stop = %d Duration = %d ActualDuration = %d"),
1.822 + iError, I64INT(start.Int64()), I64INT(stop.Int64()), duration, actualDuration);
1.823 + if((iError == KErrNone) && (TimeComparison(actualDuration, duration, KExpectedDeviation)))
1.824 + ret = EPass;
1.825 +#else
1.826 + INFO_PRINTF1(_L("Warning : PauseL() functionality not supported in test controller"));
1.827 + aPlayer->Stop();
1.828 + ret = EPass;
1.829 +#endif
1.830 +
1.831 + return ret;
1.832 + }
1.833 +
1.834 +//------------------------------------------------------------------
1.835 +
1.836 +CTestVclntBalance::CTestVclntBalance(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TInt aBalance)
1.837 + : CTestVclntVideoFile(aTestName,aSectName,aKeyName,EFalse)
1.838 + {
1.839 + iBalance = aBalance;
1.840 + }
1.841 +
1.842 +CTestVclntBalance* CTestVclntBalance::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TInt aBalance)
1.843 + {
1.844 + CTestVclntBalance* self = new (ELeave) CTestVclntBalance(aTestName,aSectName,aKeyName,aBalance);
1.845 + return self;
1.846 + }
1.847 +
1.848 +TVerdict CTestVclntBalance::DoTestL(CVideoPlayerUtility* aPlayer)
1.849 + {
1.850 + INFO_PRINTF1(_L("Test : Video Player - Balance"));
1.851 +
1.852 +#ifdef JETSTREAM_TESTS
1.853 + if (iBalance < KMinBalance)
1.854 + {
1.855 + aPlayer->SetBalanceL(iBalance);
1.856 + INFO_PRINTF3(_L("Balance = %d (expecting %d)"), aPlayer->Balance(), KMinBalance);
1.857 + if(aPlayer->Balance() == KMinBalance)
1.858 + return EPass;
1.859 + }
1.860 + else if (iBalance > KMaxBalance)
1.861 + {
1.862 + aPlayer->SetBalanceL(iBalance);
1.863 + INFO_PRINTF3(_L("Balance = %d (expecting %d)"), aPlayer->Balance(), KMaxBalance);
1.864 + if(aPlayer->Balance() == KMaxBalance)
1.865 + return EPass;
1.866 + }
1.867 + else
1.868 + {
1.869 + aPlayer->SetBalanceL(iBalance);
1.870 + INFO_PRINTF3(_L("Balance = %d (expecting %d)"), aPlayer->Balance(), iBalance);
1.871 + if(aPlayer->Balance() == iBalance)
1.872 + return EPass;
1.873 + }
1.874 +#else
1.875 + // the test video controller returns 1 for all calls of Balance()
1.876 + // call SetBalanceL() to show it doesn't leave
1.877 + aPlayer->SetBalanceL(iBalance);
1.878 + INFO_PRINTF1(_L("Test controller should return 1 for all calls of Balance()"));
1.879 + INFO_PRINTF2(_L("Balance = %d (expecting 1)"), aPlayer->Balance());
1.880 + if(aPlayer->Balance() == 1)
1.881 + return EPass;
1.882 +#endif
1.883 +
1.884 + return EFail;
1.885 + }
1.886 +
1.887 +
1.888 +//------------------------------------------------------------------
1.889 +
1.890 +CTestVclntPlayWindow::CTestVclntPlayWindow(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTimeIntervalMicroSeconds aStart, const TTimeIntervalMicroSeconds aEnd)
1.891 + : CTestVclntVideoFile(aTestName,aSectName,aKeyName,EFalse)
1.892 + {
1.893 + iStart = aStart;
1.894 + iEnd = aEnd;
1.895 + }
1.896 +
1.897 +CTestVclntPlayWindow* CTestVclntPlayWindow::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTimeIntervalMicroSeconds aStart, const TTimeIntervalMicroSeconds aEnd)
1.898 + {
1.899 + CTestVclntPlayWindow* self = new (ELeave) CTestVclntPlayWindow(aTestName,aSectName,aKeyName,aStart,aEnd);
1.900 + return self;
1.901 + }
1.902 +
1.903 +TVerdict CTestVclntPlayWindow::DoTestL(CVideoPlayerUtility* aPlayer)
1.904 + {
1.905 + TVerdict ret = EFail;
1.906 +
1.907 + INFO_PRINTF1(_L("Test : Video Player - Window"));
1.908 +
1.909 +// InitWservL();
1.910 +
1.911 + TRect rect, clipRect;
1.912 + TRAPD(err, aPlayer->SetDisplayWindowL(iWs, *iScreen, *iWindow, rect, clipRect));
1.913 + if(err)
1.914 + {
1.915 + ERR_PRINTF2(_L("SetDisplayWindowL() failed, error %d"), err);
1.916 + ret = EFail;
1.917 + }
1.918 + else
1.919 + {
1.920 + ret = EPass;
1.921 + }
1.922 +
1.923 + // removed an attempt at opening a window server manually - it seemed to work, but a RWsSession
1.924 + // couldn't Connect(), connectL() claimed no asynchronous operation...
1.925 +
1.926 + // we have no window server, so the test can't run -
1.927 + // so call it with dummy parameters and add explanatory note to the test
1.928 +
1.929 + // NB ws.Connect() will panic on the target, hence don't run it
1.930 +/*
1.931 +#if defined (__WINS__)
1.932 + TBool testInvalid = EFalse;
1.933 + RWsSession ws;
1.934 + if(ws.Connect() != KErrNone)
1.935 + testInvalid = ETrue;
1.936 +
1.937 + // we can't call it at all - SetDisplayWindowL() will cause an access violation if ws is null
1.938 + if(testInvalid)
1.939 + {
1.940 + INFO_PRINTF1(_L("Warning : SetDisplayWindowL() cannot be tested, no window server available"));
1.941 + ret = EPass;
1.942 + }
1.943 + else
1.944 + {
1.945 + // TBD - arguments to be correctly set
1.946 + CWsScreenDevice sd;
1.947 + RBlankWindow window;
1.948 + TRect rect, clipRect;
1.949 +
1.950 + TRAPD(err, aPlayer->SetDisplayWindowL(ws, sd, window, rect, clipRect));
1.951 + if(err)
1.952 + {
1.953 + ERR_PRINTF2(_L("SetDisplayWindowL() failed, error %d"), err);
1.954 + ret = EFail;
1.955 + }
1.956 + else
1.957 + ret = EPass;
1.958 +
1.959 + }
1.960 +#else
1.961 + INFO_PRINTF1(_L("Warning : SetDisplayWindowL() cannot be tested on target"));
1.962 + ret = EPass;
1.963 +#endif
1.964 +*/
1.965 + aPlayer->Stop();
1.966 + return ret;
1.967 + }
1.968 +
1.969 +
1.970 +//------------------------------------------------------------------
1.971 +
1.972 +CTestVclntMeta::CTestVclntMeta(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
1.973 + : CTestVclntVideoFile(aTestName,aSectName,aKeyName,EFalse)
1.974 + {}
1.975 +
1.976 +CTestVclntMeta* CTestVclntMeta::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
1.977 + {
1.978 + CTestVclntMeta* self = new (ELeave) CTestVclntMeta(aTestName,aSectName,aKeyName);
1.979 + return self;
1.980 + }
1.981 +
1.982 +TVerdict CTestVclntMeta::DoTestL(CVideoPlayerUtility* aPlayer)
1.983 + {
1.984 + INFO_PRINTF1(_L("Test : Video Player - Metadata"));
1.985 +
1.986 + TInt numOfMeta = -1;
1.987 + TRAPD(err, numOfMeta = aPlayer->NumberOfMetaDataEntriesL() );
1.988 + INFO_PRINTF3(_L("Error : %d Entries = %d"), err, numOfMeta);
1.989 + if (err != KErrNone || numOfMeta != 0)
1.990 + return EFail;
1.991 + // call that goes to the dummy controller
1.992 + // NB we expect zero metadata entries
1.993 + CMMFMetaDataEntry* theEntry=NULL;
1.994 + TRAP(err, theEntry = aPlayer->MetaDataEntryL(1));
1.995 + INFO_PRINTF2(_L("Error : %d"), err);
1.996 + if (err != KErrNone)
1.997 + return EFail;
1.998 + else
1.999 + {
1.1000 + delete theEntry;
1.1001 + return EPass;
1.1002 + }
1.1003 + }
1.1004 +
1.1005 +
1.1006 +//------------------------------------------------------------------
1.1007 +
1.1008 +CTestVclntFrameSize::CTestVclntFrameSize(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TInt aFrameSize)
1.1009 + : CTestVclntVideoFile(aTestName,aSectName,aKeyName,EFalse)
1.1010 + {
1.1011 + iFrameSize = aFrameSize;
1.1012 + }
1.1013 +
1.1014 +CTestVclntFrameSize* CTestVclntFrameSize::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TInt aFrameSize)
1.1015 + {
1.1016 + CTestVclntFrameSize* self = new (ELeave) CTestVclntFrameSize(aTestName,aSectName,aKeyName,aFrameSize);
1.1017 + return self;
1.1018 + }
1.1019 +
1.1020 +TVerdict CTestVclntFrameSize::DoTestL(CVideoPlayerUtility* aPlayer)
1.1021 + {
1.1022 + TVerdict ret = EFail;
1.1023 +
1.1024 + INFO_PRINTF1(_L("Test : Video Player - Frame Size"));
1.1025 +
1.1026 + TSize frameSize;
1.1027 + TRAPD(err, aPlayer->VideoFrameSizeL(frameSize) );
1.1028 +
1.1029 + INFO_PRINTF4(_L("Error : %d, Frame size : (%d, %d)"), err, frameSize.iWidth, frameSize.iHeight);
1.1030 + if (err == KErrNone &&
1.1031 + frameSize.iWidth >= 0 && frameSize.iHeight >= 0 )
1.1032 + return EPass;
1.1033 +
1.1034 + return ret;
1.1035 + }
1.1036 +
1.1037 +//------------------------------------------------------------------
1.1038 +
1.1039 +CTestVclntMimeType::CTestVclntMimeType(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
1.1040 + : CTestVclntVideoFile(aTestName,aSectName,aKeyName,EFalse)
1.1041 + {
1.1042 + }
1.1043 +
1.1044 +CTestVclntMimeType* CTestVclntMimeType::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
1.1045 + {
1.1046 + CTestVclntMimeType* self = new (ELeave) CTestVclntMimeType(aTestName,aSectName,aKeyName);
1.1047 + return self;
1.1048 + }
1.1049 +
1.1050 +TVerdict CTestVclntMimeType::DoTestL(CVideoPlayerUtility* aPlayer)
1.1051 + {
1.1052 + INFO_PRINTF1(_L("Test : Video Player - MimeType"));
1.1053 +
1.1054 + // NB we cannot check whether the mime type returned is valid, or even exists.
1.1055 + TPtrC8 mimeType = aPlayer->VideoFormatMimeType();
1.1056 +
1.1057 + // take it to a 16-bit string
1.1058 + TBuf<64> mimeType16;
1.1059 + mimeType16.Copy(mimeType);
1.1060 + INFO_PRINTF2(_L("Mime type : \'%S\'"), &mimeType16);
1.1061 + return EPass;
1.1062 + }
1.1063 +
1.1064 +//------------------------------------------------------------------
1.1065 +
1.1066 +CTestVclntRebuffering::CTestVclntRebuffering(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
1.1067 + : CTestVclntVideoFile(aTestName,aSectName,aKeyName,EFalse)
1.1068 + {
1.1069 + }
1.1070 +
1.1071 +CTestVclntRebuffering* CTestVclntRebuffering::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
1.1072 + {
1.1073 + CTestVclntRebuffering* self = new (ELeave) CTestVclntRebuffering(aTestName,aSectName,aKeyName);
1.1074 + return self;
1.1075 + }
1.1076 +
1.1077 +TVerdict CTestVclntRebuffering::DoTestL(CVideoPlayerUtility* aPlayer)
1.1078 + {
1.1079 + INFO_PRINTF1(_L("Test : Video Player - Rebuffering"));
1.1080 +
1.1081 + aPlayer->RegisterForVideoLoadingNotification(*this);
1.1082 +
1.1083 + INFO_PRINTF1(_L("Rebuffering request completed"));
1.1084 + return EPass;
1.1085 + }
1.1086 +
1.1087 +// from MRebufferCallback
1.1088 +void CTestVclntRebuffering::MvloLoadingStarted()
1.1089 + {
1.1090 + INFO_PRINTF1(_L("CTestVclntRebuffering::MvloLoadingStarted"));
1.1091 + }
1.1092 +
1.1093 +void CTestVclntRebuffering::MvloLoadingComplete()
1.1094 + {
1.1095 + INFO_PRINTF1(_L("CTestVclntRebuffering::MvloLoadingComplete"));
1.1096 + }
1.1097 +
1.1098 +//------------------------------------------------------------------
1.1099 +
1.1100 +CTestVclntRepeat::CTestVclntRepeat(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TInt aRepeat)
1.1101 + : CTestVclntVideoFile(aTestName,aSectName,aKeyName,EFalse)
1.1102 + {
1.1103 + iRepeat = aRepeat;
1.1104 + }
1.1105 +
1.1106 +CTestVclntRepeat* CTestVclntRepeat::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TInt aRepeat)
1.1107 + {
1.1108 + CTestVclntRepeat* self = new (ELeave) CTestVclntRepeat(aTestName,aSectName,aKeyName,aRepeat);
1.1109 + return self;
1.1110 + }
1.1111 +
1.1112 +TVerdict CTestVclntRepeat::DoTestL(CVideoPlayerUtility* aPlayer)
1.1113 + {
1.1114 + TVerdict ret = EFail;
1.1115 +
1.1116 + INFO_PRINTF1(_L("Test : Video Player - Repeats"));
1.1117 +
1.1118 + TInt duration = I64INT(aPlayer->DurationL().Int64());
1.1119 +
1.1120 + // SetRepeats() doesn't exist in the video controller, so set iRepeat to 1
1.1121 + iRepeat = 1;
1.1122 + INFO_PRINTF1(_L("Warning : SetRepeats() does not exist in player API. Repeat count set to 1"));
1.1123 +
1.1124 + aPlayer->Play();
1.1125 + INFO_PRINTF1(_L("CVideoPlayerUtility: Playing"));
1.1126 + TTime start;
1.1127 + start.HomeTime();
1.1128 + CActiveScheduler::Start();
1.1129 + TTime stop;
1.1130 + stop.HomeTime();
1.1131 +
1.1132 + TUint actualDuration = I64INT(stop.MicroSecondsFrom(start).Int64());
1.1133 +
1.1134 + INFO_PRINTF6(_L("Error : %d Start = %d Stop = %d Duration = %d ActualDuration = %d"),
1.1135 + iError, I64INT(start.Int64()), I64INT(stop.Int64()), duration, actualDuration);
1.1136 + if((iError == KErrNone) && (TimeComparison(actualDuration, duration * (iRepeat + 1),
1.1137 + KExpectedDeviation * iRepeat)))
1.1138 + ret = EPass;
1.1139 +
1.1140 + return ret;
1.1141 + }
1.1142 +
1.1143 +//------------------------------------------------------------------
1.1144 +
1.1145 +CTestVclntDelete::CTestVclntDelete(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
1.1146 + : CTestVclntVideoFile(aTestName,aSectName,aKeyName,EFalse)
1.1147 + {}
1.1148 +
1.1149 +CTestVclntDelete* CTestVclntDelete::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
1.1150 + {
1.1151 + CTestVclntDelete* self = new (ELeave) CTestVclntDelete(aTestName,aSectName,aKeyName);
1.1152 + return self;
1.1153 + }
1.1154 +
1.1155 +TVerdict CTestVclntDelete::DoTestL(CVideoPlayerUtility* /* aPlayer */)
1.1156 + {
1.1157 + // this is never called
1.1158 + return EFail;
1.1159 + }
1.1160 +
1.1161 +TVerdict CTestVclntDelete::DoTestStepL()
1.1162 + {
1.1163 + TVerdict ret = EFail;
1.1164 +
1.1165 + INFO_PRINTF1(_L("Test : Video Player - Delete"));
1.1166 +
1.1167 + TPtrC filename;
1.1168 + if(!GetStringFromConfig(iSectName,iKeyName,filename))
1.1169 + return EInconclusive;
1.1170 +
1.1171 + InitWservL();
1.1172 +
1.1173 + TRect rect, clipRect;
1.1174 + CVideoPlayerUtility* player = CVideoPlayerUtility::NewL(*this, EMdaPriorityNormal,
1.1175 + EMdaPriorityPreferenceTimeAndQuality,
1.1176 + iWs, *iScreen, *iWindow, rect, clipRect);
1.1177 + CleanupStack::PushL(player);
1.1178 +
1.1179 + iError = KErrTimedOut;
1.1180 + INFO_PRINTF2(_L("Attempting to open file %S"), &filename);
1.1181 + TRAP(iError,player->OpenFileL(filename));
1.1182 +
1.1183 + if(iError == KErrNone)
1.1184 + {
1.1185 + // Wait for initialisation callback
1.1186 + INFO_PRINTF1(_L("CVideoPlayerUtility: Opening file"));
1.1187 + CActiveScheduler::Start();
1.1188 + }
1.1189 +
1.1190 + if (iError == KErrNone)
1.1191 + {
1.1192 + player->Prepare();
1.1193 + CActiveScheduler::Start();
1.1194 + }
1.1195 +
1.1196 + if(iError == KErrNone)
1.1197 + {
1.1198 + player->Play();
1.1199 + INFO_PRINTF1(_L("CVideoPlayerUtility: Playing"));
1.1200 + INFO_PRINTF1(_L("CVideoPlayerUtility: Destroying before play complete"));
1.1201 + CleanupStack::Pop(player); // destroy player before play has completed
1.1202 +
1.1203 + User::Heap().Check();
1.1204 + return EPass;
1.1205 + }
1.1206 +
1.1207 + CleanupStack::Pop(player);
1.1208 + ERR_PRINTF2( _L("CVideoPlayerUtility failed with error %d"),iError );
1.1209 + return ret;
1.1210 + }
1.1211 +