19
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 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: This file contains testclass implementation.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// [INCLUDE FILES] - do not remove
|
|
19 |
#include <e32svr.h>
|
|
20 |
#include <StifParser.h>
|
|
21 |
#include <StifTestInterface.h>
|
|
22 |
#include "openmaxaltestmodule.h"
|
|
23 |
|
|
24 |
// EXTERNAL DATA STRUCTURES
|
|
25 |
//extern ?external_data;
|
|
26 |
|
|
27 |
// EXTERNAL FUNCTION PROTOTYPES
|
|
28 |
//extern ?external_function( ?arg_type,?arg_type );
|
|
29 |
|
|
30 |
// CONSTANTS
|
|
31 |
//const ?type ?constant_var = ?constant;
|
|
32 |
|
|
33 |
// MACROS
|
|
34 |
//#define ?macro ?macro_def
|
|
35 |
|
|
36 |
// LOCAL CONSTANTS AND MACROS
|
|
37 |
//const ?type ?constant_var = ?constant;
|
|
38 |
//#define ?macro_name ?macro_def
|
|
39 |
|
|
40 |
// MODULE DATA STRUCTURES
|
|
41 |
//enum ?declaration
|
|
42 |
//typedef ?declaration
|
|
43 |
|
|
44 |
// LOCAL FUNCTION PROTOTYPES
|
|
45 |
//?type ?function_name( ?arg_type, ?arg_type );
|
|
46 |
|
|
47 |
// FORWARD DECLARATIONS
|
|
48 |
//class ?FORWARD_CLASSNAME;
|
|
49 |
void StreamEventChangeCallback (
|
|
50 |
XAStreamInformationItf caller,
|
|
51 |
XAuint32 eventId,
|
|
52 |
XAuint32 streamIndex,
|
|
53 |
void * pEventData,
|
|
54 |
void * pContext
|
|
55 |
);
|
|
56 |
|
|
57 |
|
|
58 |
// ============================= LOCAL FUNCTIONS ===============================
|
|
59 |
|
|
60 |
// -----------------------------------------------------------------------------
|
|
61 |
// ?function_name ?description.
|
|
62 |
// ?description
|
|
63 |
// Returns: ?value_1: ?description
|
|
64 |
// ?value_n: ?description_line1
|
|
65 |
// ?description_line2
|
|
66 |
// -----------------------------------------------------------------------------
|
|
67 |
//
|
|
68 |
/*
|
|
69 |
?type ?function_name(
|
|
70 |
?arg_type arg, // ?description
|
|
71 |
?arg_type arg) // ?description
|
|
72 |
{
|
|
73 |
|
|
74 |
?code // ?comment
|
|
75 |
|
|
76 |
// ?comment
|
|
77 |
?code
|
|
78 |
}
|
|
79 |
*/
|
|
80 |
|
|
81 |
TInt COpenMAXALTestModule::al_strminfoitf_QueryMediaContainerInformation( CStifItemParser& /*aItem*/ )
|
|
82 |
{
|
|
83 |
TInt status(KErrNone);
|
|
84 |
XAresult res;
|
|
85 |
XAMediaContainerInformation info;
|
|
86 |
|
|
87 |
if(m_StrInfoItf)
|
|
88 |
{
|
|
89 |
res = (*m_StrInfoItf)->QueryMediaContainerInformation(m_StrInfoItf,&info);
|
|
90 |
status = res;
|
|
91 |
}
|
|
92 |
else
|
|
93 |
{
|
|
94 |
status = KErrNotFound;
|
|
95 |
}
|
|
96 |
return status;
|
|
97 |
}
|
|
98 |
|
|
99 |
TInt COpenMAXALTestModule::al_strminfoitf_QueryStreamType( CStifItemParser& aItem )
|
|
100 |
{
|
|
101 |
TInt status(KErrNone);
|
|
102 |
XAresult res;
|
|
103 |
TInt index(0);
|
|
104 |
XAuint32 streamType;
|
|
105 |
|
|
106 |
status = aItem.GetNextInt(index);
|
|
107 |
if(!status)
|
|
108 |
{
|
|
109 |
if(m_StrInfoItf)
|
|
110 |
{
|
|
111 |
res = (*m_StrInfoItf)->QueryStreamType(m_StrInfoItf,index, &streamType);
|
|
112 |
status = res;
|
|
113 |
}
|
|
114 |
else
|
|
115 |
{
|
|
116 |
status = KErrNotFound;
|
|
117 |
}
|
|
118 |
}
|
|
119 |
else
|
|
120 |
{
|
|
121 |
status = KErrGeneral;
|
|
122 |
}
|
|
123 |
return status;
|
|
124 |
}
|
|
125 |
|
|
126 |
TInt COpenMAXALTestModule::al_strminfoitf_QueryStreamInformation( CStifItemParser& aItem )
|
|
127 |
{
|
|
128 |
TInt status(KErrNone);
|
|
129 |
XAresult res;
|
|
130 |
TInt streamindex(0);
|
|
131 |
void* info = NULL;
|
|
132 |
XAuint32 domain;
|
|
133 |
XAAudioStreamInformation audioinfo;
|
|
134 |
XAVideoStreamInformation videoinfo;
|
|
135 |
|
|
136 |
status = aItem.GetNextInt(streamindex);
|
|
137 |
RET_ERR_IF_ERR(status);
|
|
138 |
|
|
139 |
if(m_StrInfoItf)
|
|
140 |
{
|
|
141 |
res = (*m_StrInfoItf)->QueryStreamType(m_StrInfoItf,streamindex, &domain);
|
|
142 |
status = res;
|
|
143 |
}
|
|
144 |
else
|
|
145 |
{
|
|
146 |
status = KErrNotFound;
|
|
147 |
}
|
|
148 |
|
|
149 |
if(domain == XA_DOMAINTYPE_AUDIO)
|
|
150 |
{
|
|
151 |
info = &audioinfo;
|
|
152 |
}
|
|
153 |
else if ( domain == XA_DOMAINTYPE_VIDEO)
|
|
154 |
{
|
|
155 |
info = &videoinfo;
|
|
156 |
}
|
|
157 |
|
|
158 |
if(!status)
|
|
159 |
{
|
|
160 |
if(m_StrInfoItf)
|
|
161 |
{
|
|
162 |
res = (*m_StrInfoItf)->QueryStreamInformation(m_StrInfoItf,streamindex, info);
|
|
163 |
status = res;
|
|
164 |
}
|
|
165 |
else
|
|
166 |
{
|
|
167 |
status = KErrNotFound;
|
|
168 |
}
|
|
169 |
}
|
|
170 |
else
|
|
171 |
{
|
|
172 |
status = KErrGeneral;
|
|
173 |
}
|
|
174 |
return status;
|
|
175 |
}
|
|
176 |
|
|
177 |
TInt COpenMAXALTestModule::al_strminfoitf_QueryStreamName( CStifItemParser& aItem )
|
|
178 |
{
|
|
179 |
TInt status(KErrNone);
|
|
180 |
XAresult res;
|
|
181 |
TInt streamindex(0);
|
|
182 |
XAuint16 size;
|
|
183 |
|
|
184 |
status = aItem.GetNextInt(streamindex);
|
|
185 |
if(!status)
|
|
186 |
{
|
|
187 |
if(m_StrInfoItf)
|
|
188 |
{
|
|
189 |
res = (*m_StrInfoItf)->QueryStreamName(m_StrInfoItf,streamindex, &size, NULL);
|
|
190 |
status = res;
|
|
191 |
}
|
|
192 |
else
|
|
193 |
{
|
|
194 |
status = KErrNotFound;
|
|
195 |
}
|
|
196 |
}
|
|
197 |
else
|
|
198 |
{
|
|
199 |
status = KErrGeneral;
|
|
200 |
}
|
|
201 |
return status;
|
|
202 |
}
|
|
203 |
|
|
204 |
TInt COpenMAXALTestModule::al_strminfoitf_RegisterStreamChangeCallback( CStifItemParser& /*aItem*/ )
|
|
205 |
{
|
|
206 |
TInt status(KErrNone);
|
|
207 |
XAresult res;
|
|
208 |
if(m_StrInfoItf)
|
|
209 |
{
|
|
210 |
res = (*m_StrInfoItf)->RegisterStreamChangeCallback(m_StrInfoItf,StreamEventChangeCallback,(void*)this);
|
|
211 |
status = res;
|
|
212 |
}
|
|
213 |
else
|
|
214 |
{
|
|
215 |
status = KErrNotFound;
|
|
216 |
}
|
|
217 |
return status;
|
|
218 |
}
|
|
219 |
|
|
220 |
TInt COpenMAXALTestModule::al_strminfoitf_QueryActiveStreams( CStifItemParser& aItem )
|
|
221 |
{
|
|
222 |
TInt status(KErrNone);
|
|
223 |
XAresult res;
|
|
224 |
XAuint32 size(0);
|
|
225 |
TInt inpsize;
|
|
226 |
XAboolean arr[2];
|
|
227 |
|
|
228 |
status = aItem.GetNextInt(inpsize);
|
|
229 |
if(!status)
|
|
230 |
{
|
|
231 |
if(m_StrInfoItf)
|
|
232 |
{
|
|
233 |
size = inpsize;
|
|
234 |
res = (*m_StrInfoItf)->QueryActiveStreams(m_StrInfoItf, &size, arr);
|
|
235 |
status = res;
|
|
236 |
}
|
|
237 |
else
|
|
238 |
{
|
|
239 |
status = KErrNotFound;
|
|
240 |
}
|
|
241 |
}
|
|
242 |
else
|
|
243 |
{
|
|
244 |
if(m_StrInfoItf)
|
|
245 |
{
|
|
246 |
res = (*m_StrInfoItf)->QueryActiveStreams(m_StrInfoItf,&size, NULL);
|
|
247 |
status = res;
|
|
248 |
}
|
|
249 |
else
|
|
250 |
{
|
|
251 |
status = KErrNotFound;
|
|
252 |
}
|
|
253 |
}
|
|
254 |
return status;
|
|
255 |
}
|
|
256 |
|
|
257 |
TInt COpenMAXALTestModule::al_strminfoitf_SetActiveStream( CStifItemParser& aItem )
|
|
258 |
{
|
|
259 |
TInt status(KErrNone);
|
|
260 |
XAresult res;
|
|
261 |
TInt streamindex(0);
|
|
262 |
XAboolean active;
|
|
263 |
XAboolean commitnow;
|
|
264 |
TInt value;
|
|
265 |
|
|
266 |
status = aItem.GetNextInt(streamindex);
|
|
267 |
RET_ERR_IF_ERR(status);
|
|
268 |
|
|
269 |
status = aItem.GetNextInt(value);
|
|
270 |
RET_ERR_IF_ERR(status);
|
|
271 |
active = value;
|
|
272 |
|
|
273 |
status = aItem.GetNextInt(value);
|
|
274 |
RET_ERR_IF_ERR(status);
|
|
275 |
commitnow = value;
|
|
276 |
|
|
277 |
if(m_StrInfoItf)
|
|
278 |
{
|
|
279 |
res = (*m_StrInfoItf)->SetActiveStream(m_StrInfoItf,streamindex, active, commitnow);
|
|
280 |
status = res;
|
|
281 |
}
|
|
282 |
else
|
|
283 |
{
|
|
284 |
status = KErrNotFound;
|
|
285 |
}
|
|
286 |
return status;
|
|
287 |
}
|
|
288 |
|
|
289 |
void StreamEventChangeCallback (
|
|
290 |
XAStreamInformationItf caller,
|
|
291 |
XAuint32 eventId,
|
|
292 |
XAuint32 streamIndex,
|
|
293 |
void * pEventData,
|
|
294 |
void * pContext
|
|
295 |
)
|
|
296 |
{
|
|
297 |
|
|
298 |
}
|