sl@0
|
1 |
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include <e32math.h>
|
sl@0
|
17 |
#include <mmf/server/mmfdatapathproxy.h>
|
sl@0
|
18 |
#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
|
sl@0
|
19 |
#include <mmf/server/mmfdatapathproxyserver.h>
|
sl@0
|
20 |
#endif
|
sl@0
|
21 |
|
sl@0
|
22 |
/**
|
sl@0
|
23 |
Constructs a datapath event monitor object.
|
sl@0
|
24 |
|
sl@0
|
25 |
@param aObserver
|
sl@0
|
26 |
A reference to the observer of the active object. The observer will be notified when an
|
sl@0
|
27 |
event occurs.
|
sl@0
|
28 |
@param aMMFDataPathProxy
|
sl@0
|
29 |
A reference to the client datapath proxy class.
|
sl@0
|
30 |
|
sl@0
|
31 |
@return A pointer to the new event monitor.
|
sl@0
|
32 |
|
sl@0
|
33 |
@since 7.0s
|
sl@0
|
34 |
*/
|
sl@0
|
35 |
EXPORT_C CMMFDataPathEventMonitor* CMMFDataPathEventMonitor::NewL(MMMFDataPathEventMonitorObserver& aObserver,
|
sl@0
|
36 |
RMMFDataPathProxy& aMMFDataPathProxy)
|
sl@0
|
37 |
{
|
sl@0
|
38 |
return (new(ELeave) CMMFDataPathEventMonitor(aObserver, aMMFDataPathProxy));
|
sl@0
|
39 |
}
|
sl@0
|
40 |
|
sl@0
|
41 |
CMMFDataPathEventMonitor::CMMFDataPathEventMonitor(MMMFDataPathEventMonitorObserver& aObserver,
|
sl@0
|
42 |
RMMFDataPathProxy& aMMFDataPathProxy) :
|
sl@0
|
43 |
CActive(EPriorityStandard),
|
sl@0
|
44 |
iObserver(aObserver),
|
sl@0
|
45 |
iMMFDataPathProxy(aMMFDataPathProxy)
|
sl@0
|
46 |
{
|
sl@0
|
47 |
CActiveScheduler::Add(this);
|
sl@0
|
48 |
}
|
sl@0
|
49 |
|
sl@0
|
50 |
/**
|
sl@0
|
51 |
Destructor.
|
sl@0
|
52 |
|
sl@0
|
53 |
Calls Cancel().
|
sl@0
|
54 |
*/
|
sl@0
|
55 |
EXPORT_C CMMFDataPathEventMonitor::~CMMFDataPathEventMonitor()
|
sl@0
|
56 |
{
|
sl@0
|
57 |
Cancel();
|
sl@0
|
58 |
}
|
sl@0
|
59 |
|
sl@0
|
60 |
/**
|
sl@0
|
61 |
Tells the datapath event monitor to start listening for events.
|
sl@0
|
62 |
|
sl@0
|
63 |
The datapath proxy must have been opened before this method is called.
|
sl@0
|
64 |
|
sl@0
|
65 |
@since 7.0s
|
sl@0
|
66 |
*/
|
sl@0
|
67 |
EXPORT_C void CMMFDataPathEventMonitor::Start()
|
sl@0
|
68 |
{
|
sl@0
|
69 |
iMMFDataPathProxy.ReceiveEvents(iEventPckg, iStatus);
|
sl@0
|
70 |
SetActive();
|
sl@0
|
71 |
}
|
sl@0
|
72 |
|
sl@0
|
73 |
/**
|
sl@0
|
74 |
Internal active object function.
|
sl@0
|
75 |
|
sl@0
|
76 |
Starts the data path event monitor and handles an event if there is no error status.
|
sl@0
|
77 |
|
sl@0
|
78 |
Calls HandleEvent on iObserver.
|
sl@0
|
79 |
|
sl@0
|
80 |
@since 7.0s
|
sl@0
|
81 |
*/
|
sl@0
|
82 |
EXPORT_C void CMMFDataPathEventMonitor::RunL()
|
sl@0
|
83 |
{
|
sl@0
|
84 |
if (iStatus.Int() == KErrNone)
|
sl@0
|
85 |
{
|
sl@0
|
86 |
iObserver.HandleEvent(iEventPckg());
|
sl@0
|
87 |
Start();
|
sl@0
|
88 |
}
|
sl@0
|
89 |
else
|
sl@0
|
90 |
{
|
sl@0
|
91 |
//something's gone wrong with trying to receive events (e.g. server died etc)
|
sl@0
|
92 |
TMMFEvent event(KMMFErrorCategoryDataPathGeneralError, iStatus.Int());
|
sl@0
|
93 |
iObserver.HandleEvent(event);
|
sl@0
|
94 |
//we don't want to receive events again here...
|
sl@0
|
95 |
}
|
sl@0
|
96 |
}
|
sl@0
|
97 |
|
sl@0
|
98 |
/**
|
sl@0
|
99 |
Cancels the outstanding request on iMMFDataPathProxy.
|
sl@0
|
100 |
|
sl@0
|
101 |
@since 7.0s
|
sl@0
|
102 |
*/
|
sl@0
|
103 |
void CMMFDataPathEventMonitor::DoCancel()
|
sl@0
|
104 |
{
|
sl@0
|
105 |
iMMFDataPathProxy.CancelReceiveEvents();
|
sl@0
|
106 |
}
|
sl@0
|
107 |
|
sl@0
|
108 |
/**
|
sl@0
|
109 |
Creates a subthread that will contain the datapath.
|
sl@0
|
110 |
|
sl@0
|
111 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
sl@0
|
112 |
another of the system-wide error codes.
|
sl@0
|
113 |
|
sl@0
|
114 |
@since 7.0s
|
sl@0
|
115 |
*/
|
sl@0
|
116 |
EXPORT_C TInt RMMFDataPathProxy::CreateSubThread()
|
sl@0
|
117 |
{
|
sl@0
|
118 |
//start the subthread with a unique name
|
sl@0
|
119 |
TName subThreadName(_L("MMFDataPathThread"));
|
sl@0
|
120 |
subThreadName.AppendNum(Math::Random(),EHex);
|
sl@0
|
121 |
|
sl@0
|
122 |
TInt error = DoCreateSubThread(subThreadName, &CMMFDataPathProxyServer::StartThread);
|
sl@0
|
123 |
if (error)
|
sl@0
|
124 |
return error;
|
sl@0
|
125 |
|
sl@0
|
126 |
//now create a session with the subthread
|
sl@0
|
127 |
error = CreateSession(subThreadName, KMMFDataPathProxyVersion);
|
sl@0
|
128 |
|
sl@0
|
129 |
return error;
|
sl@0
|
130 |
}
|
sl@0
|
131 |
|
sl@0
|
132 |
// Note: in the following, we can pass straight addresses for writing since both client and server
|
sl@0
|
133 |
// are in the same process.
|
sl@0
|
134 |
/**
|
sl@0
|
135 |
Load the datapath in the new thread. Use this method if the codec UID is not known
|
sl@0
|
136 |
and there is no datapath ambiguity, ie. only one datapath is possible.
|
sl@0
|
137 |
|
sl@0
|
138 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
sl@0
|
139 |
another of the system-wide error codes.
|
sl@0
|
140 |
|
sl@0
|
141 |
@since 7.0s
|
sl@0
|
142 |
*/
|
sl@0
|
143 |
EXPORT_C TInt RMMFDataPathProxy::LoadDataPath()
|
sl@0
|
144 |
{
|
sl@0
|
145 |
return SendReceive(EMMFDataPathProxyLoadDataPathBy);
|
sl@0
|
146 |
}
|
sl@0
|
147 |
|
sl@0
|
148 |
/**
|
sl@0
|
149 |
Load the datapath in the new thread.
|
sl@0
|
150 |
|
sl@0
|
151 |
Use this method if the codec UID is not known but the TMediaId can be used to select which codec
|
sl@0
|
152 |
to use.
|
sl@0
|
153 |
|
sl@0
|
154 |
@param aMediaId
|
sl@0
|
155 |
The type of media to be handled by this datapath.
|
sl@0
|
156 |
|
sl@0
|
157 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
sl@0
|
158 |
another of the system-wide error codes.
|
sl@0
|
159 |
|
sl@0
|
160 |
@since 7.0s
|
sl@0
|
161 |
*/
|
sl@0
|
162 |
EXPORT_C TInt RMMFDataPathProxy::LoadDataPath(TMediaId aMediaId)
|
sl@0
|
163 |
{
|
sl@0
|
164 |
return SendReceive (EMMFDataPathProxyLoadDataPathByMediaId, TInt(&aMediaId));
|
sl@0
|
165 |
}
|
sl@0
|
166 |
|
sl@0
|
167 |
/**
|
sl@0
|
168 |
Load the datapath in the new thread.
|
sl@0
|
169 |
|
sl@0
|
170 |
Use this method if the codec UID is known and there is no datapath ambiguity, ie. only one datapath
|
sl@0
|
171 |
is possible.
|
sl@0
|
172 |
|
sl@0
|
173 |
@param aCodecUid
|
sl@0
|
174 |
The UID of the codec plugin to be used by the datapath.
|
sl@0
|
175 |
|
sl@0
|
176 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
sl@0
|
177 |
another of the system-wide error codes.
|
sl@0
|
178 |
|
sl@0
|
179 |
@since 7.0s
|
sl@0
|
180 |
*/
|
sl@0
|
181 |
EXPORT_C TInt RMMFDataPathProxy::LoadDataPath(TUid aCodecUid)
|
sl@0
|
182 |
{
|
sl@0
|
183 |
return SendReceive(EMMFDataPathProxyLoadDataPathByCodecUid, TInt(&aCodecUid));
|
sl@0
|
184 |
}
|
sl@0
|
185 |
|
sl@0
|
186 |
/**
|
sl@0
|
187 |
Loads the datapath in the new thread.
|
sl@0
|
188 |
|
sl@0
|
189 |
Use this method if the codec UID is known and there is datapath ambiguity. The TMediaId will be
|
sl@0
|
190 |
used to choose the correct path.
|
sl@0
|
191 |
|
sl@0
|
192 |
@param aCodecUid
|
sl@0
|
193 |
The UID of the codec plugin to be used by the datapath.
|
sl@0
|
194 |
@param aMediaId
|
sl@0
|
195 |
The type of media to be handled by this datapath.
|
sl@0
|
196 |
|
sl@0
|
197 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
sl@0
|
198 |
another of the system-wide error codes.
|
sl@0
|
199 |
|
sl@0
|
200 |
@since 7.0s
|
sl@0
|
201 |
*/
|
sl@0
|
202 |
EXPORT_C TInt RMMFDataPathProxy::LoadDataPath(TUid aCodecUid, TMediaId aMediaId)
|
sl@0
|
203 |
{
|
sl@0
|
204 |
return SendReceive(EMMFDataPathProxyLoadDataPathByMediaIdCodecUid, TInt(&aCodecUid), TInt(&aMediaId));
|
sl@0
|
205 |
}
|
sl@0
|
206 |
|
sl@0
|
207 |
/**
|
sl@0
|
208 |
Specify the data source for this datapath.
|
sl@0
|
209 |
|
sl@0
|
210 |
If the sink already exists, this function tries to establish a connection between the source and
|
sl@0
|
211 |
sink. Note that only one data source can be added to the datapath.
|
sl@0
|
212 |
|
sl@0
|
213 |
@param aSource
|
sl@0
|
214 |
A pointer to the data source.
|
sl@0
|
215 |
|
sl@0
|
216 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
sl@0
|
217 |
another of the system-wide error codes.
|
sl@0
|
218 |
|
sl@0
|
219 |
@since 7.0s
|
sl@0
|
220 |
*/
|
sl@0
|
221 |
EXPORT_C TInt RMMFDataPathProxy::AddDataSource(MDataSource* aSource)
|
sl@0
|
222 |
{
|
sl@0
|
223 |
return SendReceive(EMMFDataPathProxyAddDataSource, TInt(aSource));
|
sl@0
|
224 |
}
|
sl@0
|
225 |
|
sl@0
|
226 |
/**
|
sl@0
|
227 |
Specify the data sink for this datapath.
|
sl@0
|
228 |
|
sl@0
|
229 |
If the source already exists, this function tries to establish a connection between the source and
|
sl@0
|
230 |
the sink. Note that only one data sink can be added to the datapath.
|
sl@0
|
231 |
|
sl@0
|
232 |
@param aSink
|
sl@0
|
233 |
A pointer to the data sink.
|
sl@0
|
234 |
|
sl@0
|
235 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
sl@0
|
236 |
another of the system-wide error codes.
|
sl@0
|
237 |
|
sl@0
|
238 |
@since 7.0s
|
sl@0
|
239 |
*/
|
sl@0
|
240 |
EXPORT_C TInt RMMFDataPathProxy::AddDataSink(MDataSink* aSink)
|
sl@0
|
241 |
{
|
sl@0
|
242 |
return SendReceive(EMMFDataPathProxyAddDataSink, TInt(aSink));
|
sl@0
|
243 |
}
|
sl@0
|
244 |
|
sl@0
|
245 |
/**
|
sl@0
|
246 |
Transfer the datapath from the stopped into the primed state.
|
sl@0
|
247 |
|
sl@0
|
248 |
This function allocates buffers in preparation to play and must be called before calling PlayL().
|
sl@0
|
249 |
|
sl@0
|
250 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
sl@0
|
251 |
another of the system-wide error codes.
|
sl@0
|
252 |
|
sl@0
|
253 |
@since 7.0s
|
sl@0
|
254 |
*/
|
sl@0
|
255 |
EXPORT_C TInt RMMFDataPathProxy::Prime()
|
sl@0
|
256 |
{
|
sl@0
|
257 |
return SendReceive(EMMFDataPathProxyPrime);
|
sl@0
|
258 |
}
|
sl@0
|
259 |
|
sl@0
|
260 |
/**
|
sl@0
|
261 |
Transfer the datapath from the primed into the playing state.
|
sl@0
|
262 |
|
sl@0
|
263 |
This function starts an active scheduler play loop and can only play from the primed state.
|
sl@0
|
264 |
|
sl@0
|
265 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
sl@0
|
266 |
another of the system-wide error codes.
|
sl@0
|
267 |
|
sl@0
|
268 |
@since 7.0s
|
sl@0
|
269 |
*/
|
sl@0
|
270 |
EXPORT_C TInt RMMFDataPathProxy::Play()
|
sl@0
|
271 |
{
|
sl@0
|
272 |
return SendReceive(EMMFDataPathProxyPlay);
|
sl@0
|
273 |
}
|
sl@0
|
274 |
|
sl@0
|
275 |
/**
|
sl@0
|
276 |
Pauses playing.
|
sl@0
|
277 |
|
sl@0
|
278 |
This function transfers the datapath from the playing into the primed state and sends
|
sl@0
|
279 |
KMMFErrorCategoryDataPathGeneralError to the client if an error occurs.
|
sl@0
|
280 |
|
sl@0
|
281 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
sl@0
|
282 |
another of the system-wide error codes.
|
sl@0
|
283 |
|
sl@0
|
284 |
@since 7.0s
|
sl@0
|
285 |
*/
|
sl@0
|
286 |
EXPORT_C TInt RMMFDataPathProxy::Pause()
|
sl@0
|
287 |
{
|
sl@0
|
288 |
return SendReceive(EMMFDataPathProxyPause);
|
sl@0
|
289 |
}
|
sl@0
|
290 |
|
sl@0
|
291 |
/**
|
sl@0
|
292 |
Stops playing.
|
sl@0
|
293 |
|
sl@0
|
294 |
This function transfers the datapath from the primed into the stopped state and resets the data
|
sl@0
|
295 |
path position, but does not clean up buffers. It also sends KMMFErrorCategoryDataPathGeneralError
|
sl@0
|
296 |
to the client if an error occurs.
|
sl@0
|
297 |
|
sl@0
|
298 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
sl@0
|
299 |
another of the system-wide error codes.
|
sl@0
|
300 |
|
sl@0
|
301 |
@since 7.0s
|
sl@0
|
302 |
*/
|
sl@0
|
303 |
EXPORT_C TInt RMMFDataPathProxy::Stop()
|
sl@0
|
304 |
{
|
sl@0
|
305 |
return SendReceive(EMMFDataPathProxyStop);
|
sl@0
|
306 |
}
|
sl@0
|
307 |
|
sl@0
|
308 |
/**
|
sl@0
|
309 |
Gets the current position of the datapath in units of time.
|
sl@0
|
310 |
|
sl@0
|
311 |
@param aPosition
|
sl@0
|
312 |
The current position in micro seconds will be copied into this variable.
|
sl@0
|
313 |
|
sl@0
|
314 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
sl@0
|
315 |
another of the system-wide error codes.
|
sl@0
|
316 |
|
sl@0
|
317 |
@since 7.0s
|
sl@0
|
318 |
*/
|
sl@0
|
319 |
EXPORT_C TInt RMMFDataPathProxy::GetPosition(TTimeIntervalMicroSeconds& aPosition) const
|
sl@0
|
320 |
{
|
sl@0
|
321 |
return SendReceive(EMMFDataPathProxyGetPosition, TInt(&aPosition));
|
sl@0
|
322 |
}
|
sl@0
|
323 |
|
sl@0
|
324 |
/**
|
sl@0
|
325 |
Sets the current position of the datapath in units of time.
|
sl@0
|
326 |
|
sl@0
|
327 |
@param aPosition
|
sl@0
|
328 |
The required position in micro seconds.
|
sl@0
|
329 |
|
sl@0
|
330 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
sl@0
|
331 |
another of the system-wide error codes.
|
sl@0
|
332 |
|
sl@0
|
333 |
@since 7.0s
|
sl@0
|
334 |
**/
|
sl@0
|
335 |
EXPORT_C TInt RMMFDataPathProxy::SetPosition(const TTimeIntervalMicroSeconds& aPosition)
|
sl@0
|
336 |
{
|
sl@0
|
337 |
return SendReceive(EMMFDataPathProxySetPosition, TInt(&aPosition));
|
sl@0
|
338 |
}
|
sl@0
|
339 |
|
sl@0
|
340 |
/**
|
sl@0
|
341 |
Sets the play window relative to the start of the entire clip.
|
sl@0
|
342 |
|
sl@0
|
343 |
@param aStart
|
sl@0
|
344 |
The start position in micro seconds relative to the start of the clip.
|
sl@0
|
345 |
@param aEnd
|
sl@0
|
346 |
The end position in micro seconds relative to the start of the clip.
|
sl@0
|
347 |
|
sl@0
|
348 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
sl@0
|
349 |
another of the system-wide error codes.
|
sl@0
|
350 |
|
sl@0
|
351 |
@since 7.0s
|
sl@0
|
352 |
*/
|
sl@0
|
353 |
EXPORT_C TInt RMMFDataPathProxy::SetPlayWindow( const TTimeIntervalMicroSeconds& aStart, const TTimeIntervalMicroSeconds& aEnd )
|
sl@0
|
354 |
{
|
sl@0
|
355 |
return SendReceive( EMMFDataPathProxySetPlayWindow, TInt(&aStart), TInt(&aEnd)) ;
|
sl@0
|
356 |
}
|
sl@0
|
357 |
|
sl@0
|
358 |
/**
|
sl@0
|
359 |
Removes a previously defined play window.
|
sl@0
|
360 |
|
sl@0
|
361 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
sl@0
|
362 |
another of the system-wide error codes.
|
sl@0
|
363 |
|
sl@0
|
364 |
@since 7.0s
|
sl@0
|
365 |
*/
|
sl@0
|
366 |
EXPORT_C TInt RMMFDataPathProxy::ClearPlayWindow()
|
sl@0
|
367 |
{
|
sl@0
|
368 |
return SendReceive( EMMFDataPathProxyClearPlayWindow) ;
|
sl@0
|
369 |
}
|
sl@0
|
370 |
|
sl@0
|
371 |
/**
|
sl@0
|
372 |
Gets the current datapath state.
|
sl@0
|
373 |
|
sl@0
|
374 |
@param aState
|
sl@0
|
375 |
The current state of the datapath will be copied into this variable.
|
sl@0
|
376 |
|
sl@0
|
377 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
sl@0
|
378 |
another of the system-wide error codes.
|
sl@0
|
379 |
|
sl@0
|
380 |
@since 7.0s
|
sl@0
|
381 |
*/
|
sl@0
|
382 |
EXPORT_C TInt RMMFDataPathProxy::State( TInt& aState )
|
sl@0
|
383 |
{
|
sl@0
|
384 |
return SendReceive( EMMFDataPathProxyState, TInt(&aState) ) ; // pass address, not value
|
sl@0
|
385 |
}
|
sl@0
|
386 |
|
sl@0
|
387 |
/**
|
sl@0
|
388 |
Deletes the datapath and shuts down the datapath proxy thread.
|
sl@0
|
389 |
|
sl@0
|
390 |
Calls RMMFSubThreadBase::Shutdown(). This function will not return until the subthread has
|
sl@0
|
391 |
exited, or a timeout has occurred.
|
sl@0
|
392 |
|
sl@0
|
393 |
@since 7.0s
|
sl@0
|
394 |
*/
|
sl@0
|
395 |
EXPORT_C void RMMFDataPathProxy::Close()
|
sl@0
|
396 |
{
|
sl@0
|
397 |
Shutdown();
|
sl@0
|
398 |
}
|
sl@0
|
399 |
|
sl@0
|
400 |
|
sl@0
|
401 |
|
sl@0
|
402 |
|
sl@0
|
403 |
|
sl@0
|
404 |
|
sl@0
|
405 |
CMMFDataPathProxyServer* CMMFDataPathProxyServer::NewL()
|
sl@0
|
406 |
{
|
sl@0
|
407 |
CMMFDataPathProxyServer* s = new(ELeave) CMMFDataPathProxyServer();
|
sl@0
|
408 |
CleanupStack::PushL(s);
|
sl@0
|
409 |
s->ConstructL();
|
sl@0
|
410 |
CleanupStack::Pop();
|
sl@0
|
411 |
return s;
|
sl@0
|
412 |
}
|
sl@0
|
413 |
|
sl@0
|
414 |
CMMFDataPathProxyServer::CMMFDataPathProxyServer() :
|
sl@0
|
415 |
CMMFSubThreadServer(EPriorityStandard)
|
sl@0
|
416 |
{
|
sl@0
|
417 |
}
|
sl@0
|
418 |
|
sl@0
|
419 |
void CMMFDataPathProxyServer::ConstructL()
|
sl@0
|
420 |
{
|
sl@0
|
421 |
//just need to call baseclass's constructL here
|
sl@0
|
422 |
CMMFSubThreadServer::ConstructL();
|
sl@0
|
423 |
}
|
sl@0
|
424 |
|
sl@0
|
425 |
CMMFDataPathProxyServer::~CMMFDataPathProxyServer()
|
sl@0
|
426 |
{
|
sl@0
|
427 |
}
|
sl@0
|
428 |
|
sl@0
|
429 |
CMmfIpcSession* CMMFDataPathProxyServer::NewSessionL(const TVersion& aVersion) const
|
sl@0
|
430 |
{
|
sl@0
|
431 |
if (!User::QueryVersionSupported(KMMFDataPathProxyVersion, aVersion))
|
sl@0
|
432 |
User::Leave(KErrNotSupported);
|
sl@0
|
433 |
|
sl@0
|
434 |
return CMMFDataPathProxySession::NewL();
|
sl@0
|
435 |
}
|
sl@0
|
436 |
|
sl@0
|
437 |
TInt CMMFDataPathProxyServer::StartThread(TAny*)
|
sl@0
|
438 |
{
|
sl@0
|
439 |
TInt err = KErrNone;
|
sl@0
|
440 |
//create cleanupstack
|
sl@0
|
441 |
CTrapCleanup* cleanup=CTrapCleanup::New(); // get clean-up stack
|
sl@0
|
442 |
if (!cleanup)
|
sl@0
|
443 |
err = KErrNoMemory;
|
sl@0
|
444 |
if (!err)
|
sl@0
|
445 |
{
|
sl@0
|
446 |
TRAP(err, DoStartThreadL());
|
sl@0
|
447 |
}
|
sl@0
|
448 |
delete cleanup;
|
sl@0
|
449 |
return err;
|
sl@0
|
450 |
}
|
sl@0
|
451 |
|
sl@0
|
452 |
void CMMFDataPathProxyServer::DoStartThreadL()
|
sl@0
|
453 |
{
|
sl@0
|
454 |
// create and install the active scheduler we need
|
sl@0
|
455 |
CActiveScheduler* s=new(ELeave) CActiveScheduler;
|
sl@0
|
456 |
CleanupStack::PushL(s);
|
sl@0
|
457 |
CActiveScheduler::Install(s);
|
sl@0
|
458 |
// create the server (leave it on the cleanup stack)
|
sl@0
|
459 |
CleanupStack::PushL(CMMFDataPathProxyServer::NewL());
|
sl@0
|
460 |
// Initialisation complete, now signal the client
|
sl@0
|
461 |
RThread::Rendezvous(KErrNone);
|
sl@0
|
462 |
// Ready to run
|
sl@0
|
463 |
CActiveScheduler::Start();
|
sl@0
|
464 |
// Cleanup the server and scheduler
|
sl@0
|
465 |
CleanupStack::PopAndDestroy(2);
|
sl@0
|
466 |
REComSession::FinalClose(); // fix 047933
|
sl@0
|
467 |
}
|
sl@0
|
468 |
|
sl@0
|
469 |
|
sl@0
|
470 |
|
sl@0
|
471 |
|
sl@0
|
472 |
|
sl@0
|
473 |
CMMFDataPathProxySession* CMMFDataPathProxySession::NewL()
|
sl@0
|
474 |
{
|
sl@0
|
475 |
return new(ELeave) CMMFDataPathProxySession();
|
sl@0
|
476 |
}
|
sl@0
|
477 |
|
sl@0
|
478 |
CMMFDataPathProxySession::CMMFDataPathProxySession()
|
sl@0
|
479 |
{
|
sl@0
|
480 |
}
|
sl@0
|
481 |
|
sl@0
|
482 |
|
sl@0
|
483 |
CMMFDataPathProxySession::~CMMFDataPathProxySession()
|
sl@0
|
484 |
{
|
sl@0
|
485 |
delete iDataPath;
|
sl@0
|
486 |
}
|
sl@0
|
487 |
|
sl@0
|
488 |
void CMMFDataPathProxySession::ServiceL(const RMmfIpcMessage& aMessage)
|
sl@0
|
489 |
{
|
sl@0
|
490 |
TBool complete = EFalse;
|
sl@0
|
491 |
switch(aMessage.Function())
|
sl@0
|
492 |
{
|
sl@0
|
493 |
case EMMFDataPathProxyLoadDataPathBy:
|
sl@0
|
494 |
complete = LoadDataPathByL(aMessage);
|
sl@0
|
495 |
break;
|
sl@0
|
496 |
case EMMFDataPathProxyLoadDataPathByMediaId:
|
sl@0
|
497 |
complete = LoadDataPathByMediaIdL(aMessage);
|
sl@0
|
498 |
break;
|
sl@0
|
499 |
case EMMFDataPathProxyLoadDataPathByCodecUid:
|
sl@0
|
500 |
complete = LoadDataPathByCodecUidL(aMessage);
|
sl@0
|
501 |
break;
|
sl@0
|
502 |
case EMMFDataPathProxyLoadDataPathByMediaIdCodecUid:
|
sl@0
|
503 |
complete = LoadDataPathByMediaIdCodecUidL(aMessage);
|
sl@0
|
504 |
break;
|
sl@0
|
505 |
case EMMFDataPathProxyAddDataSource:
|
sl@0
|
506 |
complete = AddDataSourceL(aMessage);
|
sl@0
|
507 |
break;
|
sl@0
|
508 |
case EMMFDataPathProxyAddDataSink:
|
sl@0
|
509 |
complete = AddDataSinkL(aMessage);
|
sl@0
|
510 |
break;
|
sl@0
|
511 |
case EMMFDataPathProxyPrime:
|
sl@0
|
512 |
complete = PrimeL(aMessage);
|
sl@0
|
513 |
break;
|
sl@0
|
514 |
case EMMFDataPathProxyPlay:
|
sl@0
|
515 |
complete = PlayL(aMessage);
|
sl@0
|
516 |
break;
|
sl@0
|
517 |
case EMMFDataPathProxyPause:
|
sl@0
|
518 |
complete = PauseL(aMessage);
|
sl@0
|
519 |
break;
|
sl@0
|
520 |
case EMMFDataPathProxyStop:
|
sl@0
|
521 |
complete = StopL(aMessage);
|
sl@0
|
522 |
break;
|
sl@0
|
523 |
case EMMFDataPathProxyGetPosition:
|
sl@0
|
524 |
complete = GetPositionL(aMessage);
|
sl@0
|
525 |
break;
|
sl@0
|
526 |
case EMMFDataPathProxySetPosition:
|
sl@0
|
527 |
complete = SetPositionL(aMessage);
|
sl@0
|
528 |
break;
|
sl@0
|
529 |
case EMMFDataPathProxySetPlayWindow :
|
sl@0
|
530 |
complete = SetPlayWindowL(aMessage) ;
|
sl@0
|
531 |
break;
|
sl@0
|
532 |
case EMMFDataPathProxyClearPlayWindow:
|
sl@0
|
533 |
complete = ClearPlayWindowL(aMessage);
|
sl@0
|
534 |
break;
|
sl@0
|
535 |
case EMMFDataPathProxyState:
|
sl@0
|
536 |
complete = StateL(aMessage);
|
sl@0
|
537 |
break;
|
sl@0
|
538 |
case EMMFSubThreadReceiveEvents:
|
sl@0
|
539 |
complete = ReceiveEventsL(aMessage);//provided by baseclass
|
sl@0
|
540 |
break;
|
sl@0
|
541 |
case EMMFSubThreadCancelReceiveEvents:
|
sl@0
|
542 |
complete = CancelReceiveEvents();//provided by baseclass
|
sl@0
|
543 |
break;
|
sl@0
|
544 |
case EMMFSubThreadShutdown:
|
sl@0
|
545 |
complete = ShutDown();//provided by baseclass
|
sl@0
|
546 |
break;
|
sl@0
|
547 |
default:
|
sl@0
|
548 |
User::Leave(KErrNotSupported);
|
sl@0
|
549 |
break;
|
sl@0
|
550 |
}
|
sl@0
|
551 |
|
sl@0
|
552 |
if (complete)
|
sl@0
|
553 |
aMessage.Complete(KErrNone);
|
sl@0
|
554 |
}
|
sl@0
|
555 |
|
sl@0
|
556 |
|
sl@0
|
557 |
TBool CMMFDataPathProxySession::LoadDataPathByL(const RMmfIpcMessage& /*aMessage*/)
|
sl@0
|
558 |
{
|
sl@0
|
559 |
if (iDataPath)
|
sl@0
|
560 |
User::Leave(KErrAlreadyExists);
|
sl@0
|
561 |
iDataPath = CMMFDataPath::NewL(*this);
|
sl@0
|
562 |
return ETrue;
|
sl@0
|
563 |
}
|
sl@0
|
564 |
|
sl@0
|
565 |
TBool CMMFDataPathProxySession::LoadDataPathByMediaIdL(const RMmfIpcMessage& aMessage)
|
sl@0
|
566 |
{
|
sl@0
|
567 |
if (iDataPath)
|
sl@0
|
568 |
User::Leave(KErrAlreadyExists);
|
sl@0
|
569 |
TMediaId* mediaId = REINTERPRET_CAST(TMediaId*, aMessage.Int0());
|
sl@0
|
570 |
iDataPath = CMMFDataPath::NewL(*mediaId, *this);
|
sl@0
|
571 |
return ETrue;
|
sl@0
|
572 |
}
|
sl@0
|
573 |
|
sl@0
|
574 |
TBool CMMFDataPathProxySession::LoadDataPathByCodecUidL(const RMmfIpcMessage& aMessage)
|
sl@0
|
575 |
{
|
sl@0
|
576 |
if (iDataPath)
|
sl@0
|
577 |
User::Leave(KErrAlreadyExists);
|
sl@0
|
578 |
TUid* uid = REINTERPRET_CAST(TUid*, aMessage.Int0());
|
sl@0
|
579 |
iDataPath = CMMFDataPath::NewL(*uid, *this);
|
sl@0
|
580 |
return ETrue;
|
sl@0
|
581 |
}
|
sl@0
|
582 |
|
sl@0
|
583 |
TBool CMMFDataPathProxySession::LoadDataPathByMediaIdCodecUidL(const RMmfIpcMessage& aMessage)
|
sl@0
|
584 |
{
|
sl@0
|
585 |
if (iDataPath)
|
sl@0
|
586 |
User::Leave(KErrAlreadyExists);
|
sl@0
|
587 |
TUid* uid = REINTERPRET_CAST(TUid*, aMessage.Int0());
|
sl@0
|
588 |
TMediaId* mediaId = REINTERPRET_CAST(TMediaId*, aMessage.Int1());
|
sl@0
|
589 |
iDataPath = CMMFDataPath::NewL(*uid, *mediaId, *this);
|
sl@0
|
590 |
return ETrue;
|
sl@0
|
591 |
}
|
sl@0
|
592 |
|
sl@0
|
593 |
TBool CMMFDataPathProxySession::AddDataSourceL(const RMmfIpcMessage& aMessage)
|
sl@0
|
594 |
{
|
sl@0
|
595 |
CheckDataPathExistsL();
|
sl@0
|
596 |
MDataSource* source = REINTERPRET_CAST(MDataSource*, aMessage.Int0());
|
sl@0
|
597 |
iDataPath->AddDataSourceL(source);
|
sl@0
|
598 |
return ETrue;
|
sl@0
|
599 |
}
|
sl@0
|
600 |
|
sl@0
|
601 |
TBool CMMFDataPathProxySession::AddDataSinkL(const RMmfIpcMessage& aMessage)
|
sl@0
|
602 |
{
|
sl@0
|
603 |
CheckDataPathExistsL();
|
sl@0
|
604 |
MDataSink* sink = REINTERPRET_CAST(MDataSink*, aMessage.Int0());
|
sl@0
|
605 |
iDataPath->AddDataSinkL(sink);
|
sl@0
|
606 |
return ETrue;
|
sl@0
|
607 |
}
|
sl@0
|
608 |
|
sl@0
|
609 |
TBool CMMFDataPathProxySession::PrimeL(const RMmfIpcMessage& /*aMessage*/)
|
sl@0
|
610 |
{
|
sl@0
|
611 |
CheckDataPathExistsL();
|
sl@0
|
612 |
iDataPath->PrimeL();
|
sl@0
|
613 |
return ETrue;
|
sl@0
|
614 |
}
|
sl@0
|
615 |
|
sl@0
|
616 |
TBool CMMFDataPathProxySession::PlayL(const RMmfIpcMessage& /*aMessage*/)
|
sl@0
|
617 |
{
|
sl@0
|
618 |
CheckDataPathExistsL();
|
sl@0
|
619 |
iDataPath->PlayL();
|
sl@0
|
620 |
return ETrue;
|
sl@0
|
621 |
}
|
sl@0
|
622 |
|
sl@0
|
623 |
TBool CMMFDataPathProxySession::PauseL(const RMmfIpcMessage& /*aMessage*/)
|
sl@0
|
624 |
{
|
sl@0
|
625 |
CheckDataPathExistsL();
|
sl@0
|
626 |
iDataPath->Pause();
|
sl@0
|
627 |
return ETrue;
|
sl@0
|
628 |
}
|
sl@0
|
629 |
|
sl@0
|
630 |
TBool CMMFDataPathProxySession::StopL(const RMmfIpcMessage& /*aMessage*/)
|
sl@0
|
631 |
{
|
sl@0
|
632 |
CheckDataPathExistsL();
|
sl@0
|
633 |
iDataPath->Stop();
|
sl@0
|
634 |
return ETrue;
|
sl@0
|
635 |
}
|
sl@0
|
636 |
|
sl@0
|
637 |
TBool CMMFDataPathProxySession::GetPositionL(const RMmfIpcMessage& aMessage) const
|
sl@0
|
638 |
{
|
sl@0
|
639 |
CheckDataPathExistsL();
|
sl@0
|
640 |
TTimeIntervalMicroSeconds* t = REINTERPRET_CAST(TTimeIntervalMicroSeconds*, aMessage.Int0());
|
sl@0
|
641 |
*t = iDataPath->Position();
|
sl@0
|
642 |
return ETrue;
|
sl@0
|
643 |
}
|
sl@0
|
644 |
|
sl@0
|
645 |
TBool CMMFDataPathProxySession::SetPositionL(const RMmfIpcMessage& aMessage)
|
sl@0
|
646 |
{
|
sl@0
|
647 |
CheckDataPathExistsL();
|
sl@0
|
648 |
TTimeIntervalMicroSeconds* t = REINTERPRET_CAST(TTimeIntervalMicroSeconds*, aMessage.Int0());
|
sl@0
|
649 |
iDataPath->SetPositionL(*t);
|
sl@0
|
650 |
return ETrue;
|
sl@0
|
651 |
}
|
sl@0
|
652 |
|
sl@0
|
653 |
TBool CMMFDataPathProxySession::SetPlayWindowL(const RMmfIpcMessage& aMessage)
|
sl@0
|
654 |
{
|
sl@0
|
655 |
CheckDataPathExistsL() ;
|
sl@0
|
656 |
TTimeIntervalMicroSeconds* start = REINTERPRET_CAST( TTimeIntervalMicroSeconds*, aMessage.Int0() ) ;
|
sl@0
|
657 |
TTimeIntervalMicroSeconds* end = REINTERPRET_CAST( TTimeIntervalMicroSeconds*, aMessage.Int1() ) ;
|
sl@0
|
658 |
iDataPath->SetPlayWindowL( *start, *end ) ;
|
sl@0
|
659 |
return ETrue;
|
sl@0
|
660 |
}
|
sl@0
|
661 |
|
sl@0
|
662 |
TBool CMMFDataPathProxySession::ClearPlayWindowL(const RMmfIpcMessage& /*aMessage*/)
|
sl@0
|
663 |
{
|
sl@0
|
664 |
CheckDataPathExistsL() ;
|
sl@0
|
665 |
iDataPath->ClearPlayWindowL() ;
|
sl@0
|
666 |
return ETrue ;
|
sl@0
|
667 |
}
|
sl@0
|
668 |
|
sl@0
|
669 |
TBool CMMFDataPathProxySession::StateL(const RMmfIpcMessage& aMessage)
|
sl@0
|
670 |
{
|
sl@0
|
671 |
CheckDataPathExistsL() ;
|
sl@0
|
672 |
TInt* state = REINTERPRET_CAST( TInt*, aMessage.Int0() ) ;
|
sl@0
|
673 |
*state = iDataPath->State();
|
sl@0
|
674 |
return ETrue ;
|
sl@0
|
675 |
}
|
sl@0
|
676 |
|