Update contrib.
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include "TestPlayer.h"
17 #include "OpenFileByHandle0034.h"
24 CTestMmfVclntOpenFile0034::CTestMmfVclntOpenFile0034(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay)
27 // store the name of this test case
28 // this is the name that is used by the script file
29 // Each test step initialises it's own name
30 iTestStepName = aTestName;
31 iSectName = aSectName;
34 // expand heap, so we can load 80k video
38 CTestMmfVclntOpenFile0034* CTestMmfVclntOpenFile0034::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay)
40 CTestMmfVclntOpenFile0034* self = new (ELeave) CTestMmfVclntOpenFile0034(aTestName,aSectName,aKeyName,aPlay);
44 CTestMmfVclntOpenFile0034* CTestMmfVclntOpenFile0034::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay)
46 CTestMmfVclntOpenFile0034* self = CTestMmfVclntOpenFile0034::NewLC(aTestName,aSectName,aKeyName,aPlay);
47 CleanupStack::PushL(self);
51 void CTestMmfVclntOpenFile0034::MvpuoOpenComplete(TInt aError)
54 INFO_PRINTF1(_L("Open Complete callback"));
55 CActiveScheduler::Stop();
58 void CTestMmfVclntOpenFile0034::MvpuoPrepareComplete(TInt aError)
61 INFO_PRINTF1(_L("Prepare Complete callback"));
62 CActiveScheduler::Stop();
65 void CTestMmfVclntOpenFile0034::MvpuoFrameReady(CFbsBitmap& /*aFrame*/, TInt aError)
68 INFO_PRINTF1(_L("Frame Ready callback"));
71 void CTestMmfVclntOpenFile0034::MvpuoPlayComplete(TInt aError)
74 INFO_PRINTF1(_L("Play Complete callback"));
75 CActiveScheduler::Stop();
78 void CTestMmfVclntOpenFile0034::MvpuoEvent(const TMMFEvent& /*aEvent*/)
84 * Load and initialise an audio file.
86 TVerdict CTestMmfVclntOpenFile0034::DoTestStepL()
90 return( PerformTestStepL() );
93 TVerdict CTestMmfVclntOpenFile0034::PerformTestStepL()
96 iError = KErrTimedOut;
98 INFO_PRINTF1(_L("Test : Video Player - OpenFileL(RFile&)"));
103 User::LeaveIfError(fs.Connect());
104 CleanupClosePushL(fs);
105 User::LeaveIfError(fs.ShareProtected());
108 if(!GetStringFromConfig(iSectName,iKeyName,filename))
110 return EInconclusive;
113 User::LeaveIfError(file.Open(fs,filename,EFileRead));
114 CleanupClosePushL(file);
116 TRect rect, clipRect;
117 CVideoPlayerUtility* player = CVideoPlayerUtility::NewL(*this, EMdaPriorityNormal,
118 EMdaPriorityPreferenceTimeAndQuality,
119 iWs, *iScreen, *iWindow, rect, clipRect);
120 CleanupStack::PushL(player);
121 TRAP(iError,player->OpenFileL(file));
123 if(iError == KErrNone)
125 // Wait for initialisation callback
126 INFO_PRINTF1(_L("CVideoPlayerUtility: Opening file"));
127 CActiveScheduler::Start();
130 if(iError == KErrNotSupported)
136 if (iError == KErrNone && player != NULL)
139 CActiveScheduler::Start();
143 if (iError == KErrNone && player != NULL)
147 iError = KErrTimedOut;
149 INFO_PRINTF1(_L("CVideoPlayerUtility: Playing file"));
150 // Wait for init callback
151 CActiveScheduler::Start();
152 if(iError == KErrNone)
163 User::After(1000000);
167 INFO_PRINTF1(_L("CVideoPlayerUtility: Destroying"));
168 CleanupStack::PopAndDestroy(player);
169 if(iError != KErrNone)
171 ERR_PRINTF2( _L("CVideoPlayerUtility failed with error %d"),iError );
174 CleanupStack::PopAndDestroy(2, &fs);