0
|
1 |
/*
|
|
2 |
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: DRM Player
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include <StifTestInterface.h>
|
|
19 |
#include "DRMAudioPlay.h"
|
|
20 |
#include "SimpleSoundPlayer.h"
|
|
21 |
#include <badesca.h>
|
|
22 |
//#include "RecordFormats.h"
|
|
23 |
|
|
24 |
TInt CDRMAudioPlay::TestCasePlayFileMetaInfoL(CStifSectionParser *section , TTestResult &aResult)
|
|
25 |
{
|
|
26 |
TPtrC FileNamePtr;
|
|
27 |
if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) )
|
|
28 |
{
|
|
29 |
TFileName FileName = FileNamePtr;
|
|
30 |
iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr);
|
|
31 |
CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewLC( FileName, TestModuleIf() , *iLogger);
|
|
32 |
|
|
33 |
sndPlayer->iMetaInfo = true;
|
|
34 |
|
|
35 |
CStifItemParser *item;
|
|
36 |
TBool MetaInfoTest = 0;
|
|
37 |
item = section->GetItemLineL(KTagMetaInfoTest);
|
|
38 |
if (item)
|
|
39 |
{
|
|
40 |
CleanupStack::PushL(item);
|
|
41 |
item->GetInt(KTagMetaInfoTest, MetaInfoTest);
|
|
42 |
CleanupStack::PopAndDestroy(item);
|
|
43 |
|
|
44 |
if (MetaInfoTest)
|
|
45 |
{
|
|
46 |
sndPlayer->iMetaInfoTest = true;
|
|
47 |
}
|
|
48 |
}
|
|
49 |
|
|
50 |
iLogger->Log(_L("Starting scheduler"));
|
|
51 |
CActiveScheduler::Start();
|
|
52 |
|
|
53 |
iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError );
|
|
54 |
aResult.iResult = sndPlayer->iFinalError;
|
|
55 |
if (aResult.iResult)
|
|
56 |
{
|
|
57 |
iLogger->Log(_L("Test failed, error code %d"), aResult.iResult);
|
|
58 |
aResult.iResultDes.Copy(KTestCaseResultFail());
|
|
59 |
}
|
|
60 |
else
|
|
61 |
{
|
|
62 |
iLogger->Log(_L("Test was successful"));
|
|
63 |
aResult.iResultDes.Copy(KTestCaseResultSuccess());
|
|
64 |
}
|
|
65 |
CleanupStack::PopAndDestroy(sndPlayer);
|
|
66 |
return KErrExecuted;
|
|
67 |
}
|
|
68 |
else
|
|
69 |
{
|
|
70 |
aResult.iResultDes.Copy(KConfigInvalid());
|
|
71 |
aResult.iResult = KErrNotExecuted;
|
|
72 |
return KErrConfigInvalid;
|
|
73 |
}
|
|
74 |
}
|
|
75 |
|
|
76 |
#define USE_FILE_FORMATS
|
|
77 |
TInt CDRMAudioPlay::TestCasePlayFileFormatsL(CStifSectionParser * section , TTestResult & aResult)
|
|
78 |
{
|
|
79 |
#ifndef USE_FILE_FORMATS
|
|
80 |
return KErrNotSupported;
|
|
81 |
#endif
|
|
82 |
#ifdef USE_FILE_FORMATS
|
|
83 |
|
|
84 |
//=/TInt KErrRecFormats = -1130;
|
|
85 |
//[*]TPtrC FileNamePtr;
|
5
|
86 |
|
0
|
87 |
//[*]if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) )
|
|
88 |
//[*] {
|
|
89 |
//[*] TFileName FileName = FileNamePtr;
|
|
90 |
//[*] iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr);
|
|
91 |
//[*] CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewLC( FileName, TestModuleIf() , *iLogger);
|
|
92 |
|
|
93 |
// * ************************************************
|
|
94 |
|
|
95 |
REComSession session;
|
|
96 |
TRAPD(err,session = REComSession::OpenL());
|
|
97 |
if (err != KErrNone)
|
|
98 |
{
|
|
99 |
iLogger->Log(_L("Error (%d) opening REComSession"),err);
|
|
100 |
aResult.iResult = err;
|
|
101 |
aResult.iResultDes.Copy( KTestCaseResultFail() );
|
|
102 |
return KErrExecuted;
|
|
103 |
}
|
|
104 |
|
|
105 |
//-/for (TInt i=0; i<1; i++)
|
|
106 |
//-/{
|
|
107 |
//TUid id;
|
|
108 |
//id.iUid = KUidInterfaceMMFController; //KMmfUidPluginInterfaceController; //KMmfUidPluginInterfaceFormatDecode; //KMmfUidPluginInterfaceFormatEncode
|
|
109 |
//TUid id = KUidInterfaceMMFController;
|
|
110 |
TBool UsingDefault;
|
|
111 |
TUid id;
|
|
112 |
id.iUid = GetIntL(section, KTagInterfaceId, UsingDefault, KUidInterfaceMMFController.iUid);
|
|
113 |
RImplInfoPtrArray aArray;
|
|
114 |
|
|
115 |
iLogger->Log(_L("Calling REComSession::ListImplementationsL()") );
|
|
116 |
TRAPD(err2,REComSession::ListImplementationsL(id,aArray));
|
|
117 |
if (err2 != KErrNone)
|
|
118 |
{
|
|
119 |
iLogger->Log(_L("Error (%d) getting implementations (ListImplementationsL)"),err2);
|
|
120 |
aResult.iResult = err;
|
|
121 |
aResult.iResultDes.Copy( KTestCaseResultFail() );
|
|
122 |
return KErrExecuted;
|
|
123 |
//return KErrRecFormats;
|
|
124 |
}
|
|
125 |
|
|
126 |
for (TInt j=0; j<aArray.Count() ; j++)
|
|
127 |
{
|
|
128 |
CMMFControllerImplementationInformation* controller = NULL;
|
|
129 |
|
|
130 |
iLogger->Log(_L("Calling CMMFControllerImplementationInformation::NewL()"));
|
|
131 |
TRAPD(err3, controller=CMMFControllerImplementationInformation::NewL(id));
|
|
132 |
//TRAPD(err3,controller = CMMFControllerImplementationInformation::NewL( *(aArray[j]) ) );
|
|
133 |
|
|
134 |
if (err3 != KErrNone)
|
|
135 |
{
|
|
136 |
iLogger->Log(_L("Error %d openning controller"),err3);
|
5
|
137 |
aResult.iResult = err3;
|
0
|
138 |
break;
|
|
139 |
//continue;
|
|
140 |
}
|
|
141 |
CleanupStack::PushL(controller);
|
|
142 |
|
|
143 |
iLogger->Log(_L("Calling CMMFControllerImplementationInformation::PlayFormats()"));
|
|
144 |
RMMFFormatImplInfoArray formats = controller->PlayFormats();
|
|
145 |
for (TInt k = 0; k < formats.Count(); k++)
|
|
146 |
{
|
|
147 |
CMMFFormatImplementationInformation* info = formats[k];
|
|
148 |
CleanupStack::PushL(info);
|
|
149 |
|
|
150 |
for (TInt l = 0; l < (info->SupportedFileExtensions()).Count(); l++)
|
|
151 |
{
|
|
152 |
iLogger->Log(_L("Calling CMMFFormatImplementationInformation::SupportedFileExtensions()"));
|
5
|
153 |
//iLogger->Log(_L("Format supported: %S"),(info->SupportedFileExtensions())[l]);
|
0
|
154 |
}
|
|
155 |
CleanupStack::PopAndDestroy();
|
|
156 |
}
|
|
157 |
formats.Close();
|
|
158 |
CleanupStack::PopAndDestroy(controller);
|
|
159 |
CleanupStack::PopAndDestroy();
|
|
160 |
}
|
|
161 |
//-/}
|
|
162 |
aArray.Close();
|
|
163 |
|
|
164 |
session.Close();
|
|
165 |
|
|
166 |
//return KErrNone;
|
|
167 |
|
|
168 |
// * ************************************************
|
|
169 |
//[*]iLogger->Log(_L("Starting scheduler"));
|
|
170 |
//[*]CActiveScheduler::Start();
|
|
171 |
|
|
172 |
//[*]iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError );
|
|
173 |
//[*]aResult.iResult = sndPlayer->iFinalError ;
|
|
174 |
if (aResult.iResult)
|
|
175 |
{
|
|
176 |
iLogger->Log(_L("Test failed, error code %d"), aResult.iResult);
|
|
177 |
aResult.iResultDes.Copy(KTestCaseResultFail());
|
|
178 |
}
|
|
179 |
else
|
|
180 |
{
|
|
181 |
iLogger->Log(_L("Test was successful"));
|
|
182 |
aResult.iResultDes.Copy(KTestCaseResultSuccess());
|
|
183 |
}
|
|
184 |
//[*]CleanupStack::PopAndDestroy(sndPlayer);
|
|
185 |
return KErrExecuted;
|
|
186 |
//[*] }
|
|
187 |
//[*]else
|
|
188 |
//[*] {
|
|
189 |
//[*] //Falta el nombre del archivo a reproducir
|
|
190 |
//[*] aResult.iResultDes.Copy(KConfigInvalid());
|
|
191 |
//[*] aResult.iResult = KErrNotExecuted;
|
|
192 |
//[*] return KErrConfigInvalid;
|
|
193 |
//[*] }
|
|
194 |
#endif
|
|
195 |
}
|
|
196 |
|
|
197 |
TInt CDRMAudioPlay::GetIntL(CStifSectionParser *aSection, const TDesC &aTag, TBool &aUsingDefault, const TInt &aDefaultInt, TBool aContinue)
|
|
198 |
{
|
|
199 |
TInt ParseError=KErrNotFound;
|
|
200 |
TInt TempDelay=0;
|
|
201 |
TInt ReturnValue=aDefaultInt;
|
|
202 |
|
|
203 |
CStifItemParser *item;
|
|
204 |
if (aContinue)
|
|
205 |
{
|
|
206 |
item = aSection->GetNextItemLineL(aTag);
|
|
207 |
}
|
|
208 |
else
|
|
209 |
{
|
|
210 |
item = aSection->GetItemLineL(aTag);
|
|
211 |
}
|
|
212 |
if (item)
|
|
213 |
{
|
|
214 |
CleanupStack::PushL(item);
|
|
215 |
ParseError = item->GetInt(aTag, TempDelay) ;
|
|
216 |
CleanupStack::PopAndDestroy(item);
|
|
217 |
}
|
|
218 |
|
|
219 |
if (ParseError)
|
|
220 |
{ //Integer not found, using defaults
|
|
221 |
aUsingDefault=ETrue;
|
|
222 |
}
|
|
223 |
else
|
|
224 |
{ //Integer found.
|
|
225 |
aUsingDefault=EFalse;
|
|
226 |
ReturnValue=TempDelay;
|
|
227 |
}
|
|
228 |
|
|
229 |
if (ParseError) {iLogger->Log(_L("Error retrieving integer, [%S] not found"), &aTag);}
|
|
230 |
iLogger->Log(_L("Integer read, value (%d)") , ReturnValue);
|
|
231 |
return ReturnValue;
|
|
232 |
}
|