os/mm/mmlibs/mmfw/src/server/BaseClasses/mmfdatapathproxy.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmlibs/mmfw/src/server/BaseClasses/mmfdatapathproxy.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,676 @@
     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 <e32math.h>
    1.20 +#include <mmf/server/mmfdatapathproxy.h>
    1.21 +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    1.22 +#include <mmf/server/mmfdatapathproxyserver.h>
    1.23 +#endif
    1.24 +
    1.25 +/**
    1.26 +Constructs a datapath event monitor object.
    1.27 +
    1.28 +@param  aObserver
    1.29 +        A reference to the observer of the active object. The observer will be notified when an
    1.30 +        event occurs.
    1.31 +@param  aMMFDataPathProxy
    1.32 +        A reference to the client datapath proxy class.
    1.33 +
    1.34 +@return A pointer to the new event monitor.
    1.35 +
    1.36 +@since 7.0s
    1.37 +*/
    1.38 +EXPORT_C CMMFDataPathEventMonitor* CMMFDataPathEventMonitor::NewL(MMMFDataPathEventMonitorObserver& aObserver,
    1.39 +															 RMMFDataPathProxy& aMMFDataPathProxy)
    1.40 +	{
    1.41 +	return (new(ELeave) CMMFDataPathEventMonitor(aObserver, aMMFDataPathProxy));
    1.42 +	}
    1.43 +
    1.44 +CMMFDataPathEventMonitor::CMMFDataPathEventMonitor(MMMFDataPathEventMonitorObserver& aObserver, 
    1.45 +													   RMMFDataPathProxy& aMMFDataPathProxy) :
    1.46 +	CActive(EPriorityStandard),
    1.47 +	iObserver(aObserver), 
    1.48 +	iMMFDataPathProxy(aMMFDataPathProxy)
    1.49 +	{
    1.50 +	CActiveScheduler::Add(this);
    1.51 +	}
    1.52 +
    1.53 +/**
    1.54 +Destructor.
    1.55 +
    1.56 +Calls Cancel().
    1.57 +*/
    1.58 +EXPORT_C CMMFDataPathEventMonitor::~CMMFDataPathEventMonitor()
    1.59 +	{
    1.60 +	Cancel();
    1.61 +	}
    1.62 +
    1.63 +/**
    1.64 +Tells the datapath event monitor to start listening for events.
    1.65 +
    1.66 +The datapath proxy must have been opened before this method is called.
    1.67 +
    1.68 +@since  7.0s
    1.69 +*/
    1.70 +EXPORT_C void CMMFDataPathEventMonitor::Start()
    1.71 +	{
    1.72 +	iMMFDataPathProxy.ReceiveEvents(iEventPckg, iStatus);
    1.73 +	SetActive();
    1.74 +	}
    1.75 +
    1.76 +/**
    1.77 +Internal active object function.
    1.78 +
    1.79 +Starts the data path event monitor and handles an event if there is no error status.
    1.80 +
    1.81 +Calls HandleEvent on iObserver.
    1.82 +
    1.83 +@since  7.0s
    1.84 +*/
    1.85 +EXPORT_C void CMMFDataPathEventMonitor::RunL()
    1.86 +	{
    1.87 +	if (iStatus.Int() == KErrNone)
    1.88 +		{
    1.89 +		iObserver.HandleEvent(iEventPckg());
    1.90 +		Start();
    1.91 +		}
    1.92 +	else
    1.93 +		{
    1.94 +		//something's gone wrong with trying to receive events (e.g. server died etc)
    1.95 +		TMMFEvent event(KMMFErrorCategoryDataPathGeneralError, iStatus.Int());
    1.96 +		iObserver.HandleEvent(event);
    1.97 +		//we don't want to receive events again here...
    1.98 +		}
    1.99 +	}
   1.100 +
   1.101 +/**
   1.102 +Cancels the outstanding request on iMMFDataPathProxy.
   1.103 +
   1.104 +@since  7.0s
   1.105 +*/
   1.106 +void CMMFDataPathEventMonitor::DoCancel()
   1.107 +	{
   1.108 +	iMMFDataPathProxy.CancelReceiveEvents();
   1.109 +	}
   1.110 +
   1.111 +/**
   1.112 +Creates a subthread that will contain the datapath.
   1.113 +
   1.114 +@return An error code indicating if the function call was successful. KErrNone on success, otherwise
   1.115 +        another of the system-wide error codes.
   1.116 +
   1.117 +@since 7.0s
   1.118 +*/
   1.119 +EXPORT_C TInt RMMFDataPathProxy::CreateSubThread()
   1.120 +	{
   1.121 +	//start the subthread with a unique name
   1.122 +	TName subThreadName(_L("MMFDataPathThread"));
   1.123 +	subThreadName.AppendNum(Math::Random(),EHex);
   1.124 +	
   1.125 +	TInt error = DoCreateSubThread(subThreadName, &CMMFDataPathProxyServer::StartThread);
   1.126 +	if (error)
   1.127 +		return error;
   1.128 +
   1.129 +	//now create a session with the subthread
   1.130 +	error = CreateSession(subThreadName, KMMFDataPathProxyVersion);
   1.131 +
   1.132 +	return error;
   1.133 +	}
   1.134 +
   1.135 +// Note: in the following, we can pass straight addresses for writing since both client and server
   1.136 +// are in the same process.
   1.137 +/**
   1.138 +Load the datapath in the new thread. Use this method if the codec UID is not known
   1.139 +and there is no datapath ambiguity, ie. only one datapath is possible.
   1.140 +
   1.141 +@return An error code indicating if the function call was successful. KErrNone on success, otherwise
   1.142 +        another of the system-wide error codes.
   1.143 +
   1.144 +@since 7.0s
   1.145 +*/
   1.146 +EXPORT_C TInt RMMFDataPathProxy::LoadDataPath()
   1.147 +	{
   1.148 +	return SendReceive(EMMFDataPathProxyLoadDataPathBy);
   1.149 +	}
   1.150 +
   1.151 +/**
   1.152 +Load the datapath in the new thread. 
   1.153 +
   1.154 +Use this method if the codec UID is not known but the TMediaId can be used to select which codec 
   1.155 +to use.
   1.156 +
   1.157 +@param  aMediaId
   1.158 +	    The type of media to be handled by this datapath.
   1.159 +
   1.160 +@return An error code indicating if the function call was successful. KErrNone on success, otherwise
   1.161 +        another of the system-wide error codes.
   1.162 +
   1.163 +@since  7.0s
   1.164 +*/
   1.165 +EXPORT_C TInt RMMFDataPathProxy::LoadDataPath(TMediaId aMediaId)
   1.166 +	{
   1.167 +	return SendReceive (EMMFDataPathProxyLoadDataPathByMediaId, TInt(&aMediaId));
   1.168 +	}
   1.169 +
   1.170 +/**
   1.171 +Load the datapath in the new thread. 
   1.172 +
   1.173 +Use this method if the codec UID is known and there is no datapath ambiguity, ie. only one datapath
   1.174 +is possible.
   1.175 +
   1.176 +@param  aCodecUid
   1.177 +        The UID of the codec plugin to be used by the datapath.
   1.178 +
   1.179 +@return An error code indicating if the function call was successful. KErrNone on success, otherwise
   1.180 +        another of the system-wide error codes.
   1.181 +
   1.182 +@since  7.0s
   1.183 +*/
   1.184 +EXPORT_C TInt RMMFDataPathProxy::LoadDataPath(TUid aCodecUid) 
   1.185 +	{
   1.186 +	return SendReceive(EMMFDataPathProxyLoadDataPathByCodecUid, TInt(&aCodecUid));
   1.187 +	}
   1.188 +
   1.189 +/**
   1.190 +Loads the datapath in the new thread. 
   1.191 +
   1.192 +Use this method if the codec UID is known and there is datapath ambiguity. The TMediaId will be
   1.193 +used to choose the correct path.
   1.194 +
   1.195 +@param  aCodecUid
   1.196 +        The UID of the codec plugin to be used by the datapath.
   1.197 +@param  aMediaId
   1.198 +        The type of media to be handled by this datapath.
   1.199 +
   1.200 +@return An error code indicating if the function call was successful. KErrNone on success, otherwise
   1.201 +        another of the system-wide error codes.
   1.202 +
   1.203 +@since  7.0s
   1.204 +*/
   1.205 +EXPORT_C TInt RMMFDataPathProxy::LoadDataPath(TUid aCodecUid, TMediaId aMediaId)
   1.206 +	{
   1.207 +	return SendReceive(EMMFDataPathProxyLoadDataPathByMediaIdCodecUid, TInt(&aCodecUid), TInt(&aMediaId));
   1.208 +	}
   1.209 +	
   1.210 +/**
   1.211 +Specify the data source for this datapath.
   1.212 +
   1.213 +If the sink already exists, this function tries to establish a connection between the source and 
   1.214 +sink. Note that only one data source can be added to the datapath.
   1.215 +
   1.216 +@param  aSource
   1.217 +        A pointer to the data source.
   1.218 +
   1.219 +@return An error code indicating if the function call was successful. KErrNone on success, otherwise
   1.220 +        another of the system-wide error codes.
   1.221 +
   1.222 +@since 7.0s
   1.223 +*/
   1.224 +EXPORT_C TInt RMMFDataPathProxy::AddDataSource(MDataSource* aSource)
   1.225 +	{
   1.226 +	return SendReceive(EMMFDataPathProxyAddDataSource, TInt(aSource));
   1.227 +	}
   1.228 +	
   1.229 +/**
   1.230 +Specify the data sink for this datapath.  
   1.231 +
   1.232 +If the source already exists, this function tries to establish a connection between the source and 
   1.233 +the sink. Note that only one data sink can be added to the datapath.
   1.234 +
   1.235 +@param  aSink
   1.236 +        A pointer to the data sink.
   1.237 +
   1.238 +@return An error code indicating if the function call was successful. KErrNone on success, otherwise
   1.239 +        another of the system-wide error codes.
   1.240 +
   1.241 +@since  7.0s
   1.242 +*/
   1.243 +EXPORT_C TInt RMMFDataPathProxy::AddDataSink(MDataSink* aSink)
   1.244 +	{
   1.245 +	return SendReceive(EMMFDataPathProxyAddDataSink, TInt(aSink));
   1.246 +	}
   1.247 +	
   1.248 +/**
   1.249 +Transfer the datapath from the stopped into the primed state.
   1.250 +
   1.251 +This function allocates buffers in preparation to play and must be called before calling PlayL().
   1.252 +
   1.253 +@return An error code indicating if the function call was successful. KErrNone on success, otherwise
   1.254 +        another of the system-wide error codes.
   1.255 +
   1.256 +@since  7.0s
   1.257 +*/
   1.258 +EXPORT_C TInt RMMFDataPathProxy::Prime()
   1.259 +	{
   1.260 +	return SendReceive(EMMFDataPathProxyPrime);
   1.261 +	}
   1.262 +
   1.263 +/**
   1.264 +Transfer the datapath from the primed into the playing state.
   1.265 +
   1.266 +This function starts an active scheduler play loop and can only play from the primed state.
   1.267 +
   1.268 +@return An error code indicating if the function call was successful. KErrNone on success, otherwise
   1.269 +        another of the system-wide error codes.
   1.270 +
   1.271 +@since 7.0s
   1.272 +*/
   1.273 +EXPORT_C TInt RMMFDataPathProxy::Play()
   1.274 +	{
   1.275 +	return SendReceive(EMMFDataPathProxyPlay);
   1.276 +	}
   1.277 +
   1.278 +/**
   1.279 +Pauses playing.
   1.280 +
   1.281 +This function transfers the datapath from the playing into the primed state and sends 
   1.282 +KMMFErrorCategoryDataPathGeneralError to the client if an error occurs.
   1.283 +
   1.284 +@return An error code indicating if the function call was successful. KErrNone on success, otherwise
   1.285 +        another of the system-wide error codes.
   1.286 +
   1.287 +@since  7.0s
   1.288 +*/
   1.289 +EXPORT_C TInt RMMFDataPathProxy::Pause()
   1.290 +	{
   1.291 +	return SendReceive(EMMFDataPathProxyPause);
   1.292 +	}
   1.293 +	
   1.294 +/**
   1.295 +Stops playing.
   1.296 +
   1.297 +This function transfers the datapath from the primed into the stopped state and resets the data 
   1.298 +path position, but does not clean up buffers. It also sends KMMFErrorCategoryDataPathGeneralError 
   1.299 +to the client if an error occurs.
   1.300 +
   1.301 +@return An error code indicating if the function call was successful. KErrNone on success, otherwise
   1.302 +        another of the system-wide error codes.
   1.303 +
   1.304 +@since  7.0s
   1.305 +*/
   1.306 +EXPORT_C TInt RMMFDataPathProxy::Stop()
   1.307 +	{
   1.308 +	return SendReceive(EMMFDataPathProxyStop);
   1.309 +	}
   1.310 +	
   1.311 +/**
   1.312 +Gets the current position of the datapath in units of time.
   1.313 +
   1.314 +@param  aPosition
   1.315 +        The current position in micro seconds will be copied into this variable.
   1.316 +
   1.317 +@return An error code indicating if the function call was successful. KErrNone on success, otherwise
   1.318 +        another of the system-wide error codes.
   1.319 +
   1.320 +@since  7.0s
   1.321 +*/
   1.322 +EXPORT_C TInt RMMFDataPathProxy::GetPosition(TTimeIntervalMicroSeconds& aPosition) const
   1.323 +	{
   1.324 +	return SendReceive(EMMFDataPathProxyGetPosition, TInt(&aPosition));
   1.325 +	}
   1.326 +
   1.327 +/**
   1.328 +Sets the current position of the datapath in units of time.
   1.329 +
   1.330 +@param  aPosition
   1.331 +        The required position in micro seconds.
   1.332 +
   1.333 +@return An error code indicating if the function call was successful. KErrNone on success, otherwise
   1.334 +        another of the system-wide error codes.
   1.335 +
   1.336 +@since 7.0s
   1.337 +**/
   1.338 +EXPORT_C TInt RMMFDataPathProxy::SetPosition(const TTimeIntervalMicroSeconds& aPosition)
   1.339 +	{
   1.340 +	return SendReceive(EMMFDataPathProxySetPosition, TInt(&aPosition));
   1.341 +	}
   1.342 +	
   1.343 +/**
   1.344 +Sets the play window relative to the start of the entire clip.
   1.345 +
   1.346 +@param  aStart
   1.347 +        The start position in micro seconds relative to the start of the clip.
   1.348 +@param  aEnd
   1.349 +        The end position in micro seconds relative to the start of the clip.
   1.350 +
   1.351 +@return An error code indicating if the function call was successful. KErrNone on success, otherwise
   1.352 +        another of the system-wide error codes.
   1.353 +
   1.354 +@since  7.0s
   1.355 +*/
   1.356 +EXPORT_C TInt RMMFDataPathProxy::SetPlayWindow( const TTimeIntervalMicroSeconds& aStart, const TTimeIntervalMicroSeconds& aEnd )
   1.357 +	{
   1.358 +	return SendReceive( EMMFDataPathProxySetPlayWindow, TInt(&aStart), TInt(&aEnd)) ;
   1.359 +	}
   1.360 +	
   1.361 +/**
   1.362 +Removes a previously defined play window.
   1.363 +
   1.364 +@return An error code indicating if the function call was successful. KErrNone on success, otherwise
   1.365 +        another of the system-wide error codes.
   1.366 +
   1.367 +@since  7.0s
   1.368 +*/
   1.369 +EXPORT_C TInt RMMFDataPathProxy::ClearPlayWindow()
   1.370 +	{
   1.371 +	return SendReceive( EMMFDataPathProxyClearPlayWindow) ;
   1.372 +	}
   1.373 +	
   1.374 +/**
   1.375 +Gets the current datapath state.
   1.376 +
   1.377 +@param  aState
   1.378 +        The current state of the datapath will be copied into this variable.
   1.379 +
   1.380 +@return An error code indicating if the function call was successful. KErrNone on success, otherwise
   1.381 +        another of the system-wide error codes.
   1.382 +
   1.383 +@since  7.0s
   1.384 +*/
   1.385 +EXPORT_C TInt RMMFDataPathProxy::State( TInt& aState )
   1.386 +	{
   1.387 +	return SendReceive( EMMFDataPathProxyState, TInt(&aState) ) ; // pass address, not value
   1.388 +	}
   1.389 +
   1.390 +/**
   1.391 +Deletes the datapath and shuts down the datapath proxy thread.
   1.392 +
   1.393 +Calls RMMFSubThreadBase::Shutdown(). This function will not return until the subthread has 
   1.394 +exited, or a timeout has occurred.
   1.395 +
   1.396 +@since  7.0s
   1.397 +*/
   1.398 +EXPORT_C void RMMFDataPathProxy::Close()
   1.399 +	{
   1.400 +	Shutdown();
   1.401 +	}
   1.402 +
   1.403 +
   1.404 +
   1.405 +
   1.406 +
   1.407 +
   1.408 +CMMFDataPathProxyServer* CMMFDataPathProxyServer::NewL()
   1.409 +	{
   1.410 +	CMMFDataPathProxyServer* s = new(ELeave) CMMFDataPathProxyServer();
   1.411 +	CleanupStack::PushL(s);
   1.412 +	s->ConstructL();
   1.413 +	CleanupStack::Pop();
   1.414 +	return s;
   1.415 +	}
   1.416 +
   1.417 +CMMFDataPathProxyServer::CMMFDataPathProxyServer() :
   1.418 +	CMMFSubThreadServer(EPriorityStandard)
   1.419 +	{
   1.420 +	}
   1.421 +
   1.422 +void CMMFDataPathProxyServer::ConstructL()
   1.423 +	{
   1.424 +	//just need to call baseclass's constructL here
   1.425 +	CMMFSubThreadServer::ConstructL();
   1.426 +	}
   1.427 +
   1.428 +CMMFDataPathProxyServer::~CMMFDataPathProxyServer()
   1.429 +	{
   1.430 +	}
   1.431 +
   1.432 +CMmfIpcSession* CMMFDataPathProxyServer::NewSessionL(const TVersion& aVersion) const
   1.433 +	{
   1.434 +	if (!User::QueryVersionSupported(KMMFDataPathProxyVersion, aVersion))
   1.435 +		User::Leave(KErrNotSupported);
   1.436 +
   1.437 +	return CMMFDataPathProxySession::NewL();
   1.438 +	}
   1.439 +
   1.440 +TInt CMMFDataPathProxyServer::StartThread(TAny*)
   1.441 +	{
   1.442 +	TInt err = KErrNone;
   1.443 +	//create cleanupstack
   1.444 +	CTrapCleanup* cleanup=CTrapCleanup::New(); // get clean-up stack
   1.445 +	if (!cleanup)
   1.446 +		err = KErrNoMemory;
   1.447 +	if (!err)
   1.448 +		{
   1.449 +		TRAP(err, DoStartThreadL());
   1.450 +		}
   1.451 +	delete cleanup;
   1.452 +	return err;
   1.453 +	}
   1.454 +
   1.455 +void CMMFDataPathProxyServer::DoStartThreadL()
   1.456 +	{
   1.457 +	// create and install the active scheduler we need
   1.458 +	CActiveScheduler* s=new(ELeave) CActiveScheduler;
   1.459 +	CleanupStack::PushL(s);
   1.460 +	CActiveScheduler::Install(s);
   1.461 +	// create the server (leave it on the cleanup stack)
   1.462 +	CleanupStack::PushL(CMMFDataPathProxyServer::NewL());
   1.463 +	// Initialisation complete, now signal the client
   1.464 +	RThread::Rendezvous(KErrNone);
   1.465 +	// Ready to run
   1.466 +	CActiveScheduler::Start();
   1.467 +	// Cleanup the server and scheduler
   1.468 +	CleanupStack::PopAndDestroy(2);
   1.469 +	REComSession::FinalClose(); // fix 047933
   1.470 +	}
   1.471 +
   1.472 +
   1.473 +
   1.474 +
   1.475 +
   1.476 +CMMFDataPathProxySession* CMMFDataPathProxySession::NewL()
   1.477 +	{
   1.478 +	return new(ELeave) CMMFDataPathProxySession();
   1.479 +	}
   1.480 +
   1.481 +CMMFDataPathProxySession::CMMFDataPathProxySession()
   1.482 +	{
   1.483 +	}
   1.484 +
   1.485 +
   1.486 +CMMFDataPathProxySession::~CMMFDataPathProxySession()
   1.487 +	{
   1.488 +	delete iDataPath;
   1.489 +	}
   1.490 +
   1.491 +void CMMFDataPathProxySession::ServiceL(const RMmfIpcMessage& aMessage)
   1.492 +	{
   1.493 +	TBool complete = EFalse;
   1.494 +	switch(aMessage.Function())
   1.495 +		{
   1.496 +	case EMMFDataPathProxyLoadDataPathBy:
   1.497 +		complete = LoadDataPathByL(aMessage);
   1.498 +		break;
   1.499 +	case EMMFDataPathProxyLoadDataPathByMediaId:
   1.500 +		complete = LoadDataPathByMediaIdL(aMessage);
   1.501 +		break;
   1.502 +	case EMMFDataPathProxyLoadDataPathByCodecUid:
   1.503 +		complete = LoadDataPathByCodecUidL(aMessage);
   1.504 +		break;
   1.505 +	case EMMFDataPathProxyLoadDataPathByMediaIdCodecUid:
   1.506 +		complete = LoadDataPathByMediaIdCodecUidL(aMessage);
   1.507 +		break;
   1.508 +	case EMMFDataPathProxyAddDataSource:
   1.509 +		complete = AddDataSourceL(aMessage);
   1.510 +		break;
   1.511 +	case EMMFDataPathProxyAddDataSink:
   1.512 +		complete = AddDataSinkL(aMessage);
   1.513 +		break;
   1.514 +	case EMMFDataPathProxyPrime:
   1.515 +		complete = PrimeL(aMessage);
   1.516 +		break;
   1.517 +	case EMMFDataPathProxyPlay:
   1.518 +		complete = PlayL(aMessage);
   1.519 +		break;
   1.520 +	case EMMFDataPathProxyPause:
   1.521 +		complete = PauseL(aMessage);
   1.522 +		break;
   1.523 +	case EMMFDataPathProxyStop:
   1.524 +		complete = StopL(aMessage);
   1.525 +		break;
   1.526 +	case EMMFDataPathProxyGetPosition:
   1.527 +		complete = GetPositionL(aMessage);
   1.528 +		break;
   1.529 +	case EMMFDataPathProxySetPosition:
   1.530 +		complete = SetPositionL(aMessage);
   1.531 +		break;
   1.532 +	case EMMFDataPathProxySetPlayWindow :
   1.533 +		complete = SetPlayWindowL(aMessage) ;
   1.534 +		break;
   1.535 +	case EMMFDataPathProxyClearPlayWindow:
   1.536 +		complete = ClearPlayWindowL(aMessage);
   1.537 +		break;
   1.538 +	case EMMFDataPathProxyState:
   1.539 +		complete = StateL(aMessage);
   1.540 +		break;
   1.541 +	case EMMFSubThreadReceiveEvents:
   1.542 +		complete = ReceiveEventsL(aMessage);//provided by baseclass
   1.543 +		break;
   1.544 +	case EMMFSubThreadCancelReceiveEvents:
   1.545 +		complete = CancelReceiveEvents();//provided by baseclass
   1.546 +		break;
   1.547 +	case EMMFSubThreadShutdown:
   1.548 +		complete = ShutDown();//provided by baseclass
   1.549 +		break;
   1.550 +	default:
   1.551 +		User::Leave(KErrNotSupported);
   1.552 +		break;
   1.553 +		}
   1.554 +
   1.555 +	if (complete)
   1.556 +		aMessage.Complete(KErrNone);
   1.557 +	}
   1.558 +
   1.559 +
   1.560 +TBool CMMFDataPathProxySession::LoadDataPathByL(const RMmfIpcMessage& /*aMessage*/)
   1.561 +	{
   1.562 +	if (iDataPath)
   1.563 +		User::Leave(KErrAlreadyExists);
   1.564 +	iDataPath = CMMFDataPath::NewL(*this);
   1.565 +	return ETrue;
   1.566 +	}
   1.567 +
   1.568 +TBool CMMFDataPathProxySession::LoadDataPathByMediaIdL(const RMmfIpcMessage& aMessage)
   1.569 +	{
   1.570 +	if (iDataPath)
   1.571 +		User::Leave(KErrAlreadyExists);
   1.572 +	TMediaId* mediaId = REINTERPRET_CAST(TMediaId*, aMessage.Int0());
   1.573 +	iDataPath = CMMFDataPath::NewL(*mediaId, *this);
   1.574 +	return ETrue;
   1.575 +	}
   1.576 +
   1.577 +TBool CMMFDataPathProxySession::LoadDataPathByCodecUidL(const RMmfIpcMessage& aMessage)
   1.578 +	{
   1.579 +	if (iDataPath)
   1.580 +		User::Leave(KErrAlreadyExists);
   1.581 +	TUid* uid = REINTERPRET_CAST(TUid*, aMessage.Int0());
   1.582 +	iDataPath = CMMFDataPath::NewL(*uid, *this);
   1.583 +	return ETrue;
   1.584 +	}
   1.585 +
   1.586 +TBool CMMFDataPathProxySession::LoadDataPathByMediaIdCodecUidL(const RMmfIpcMessage& aMessage)
   1.587 +	{
   1.588 +	if (iDataPath)
   1.589 +		User::Leave(KErrAlreadyExists);
   1.590 +	TUid* uid = REINTERPRET_CAST(TUid*, aMessage.Int0());
   1.591 +	TMediaId* mediaId = REINTERPRET_CAST(TMediaId*, aMessage.Int1());
   1.592 +	iDataPath = CMMFDataPath::NewL(*uid, *mediaId, *this);
   1.593 +	return ETrue;
   1.594 +	}
   1.595 +
   1.596 +TBool CMMFDataPathProxySession::AddDataSourceL(const RMmfIpcMessage& aMessage)
   1.597 +	{
   1.598 +	CheckDataPathExistsL();
   1.599 +	MDataSource* source = REINTERPRET_CAST(MDataSource*, aMessage.Int0());
   1.600 +	iDataPath->AddDataSourceL(source);
   1.601 +	return ETrue;
   1.602 +	}
   1.603 +
   1.604 +TBool CMMFDataPathProxySession::AddDataSinkL(const RMmfIpcMessage& aMessage)
   1.605 +	{
   1.606 +	CheckDataPathExistsL();
   1.607 +	MDataSink* sink = REINTERPRET_CAST(MDataSink*, aMessage.Int0());
   1.608 +	iDataPath->AddDataSinkL(sink);
   1.609 +	return ETrue;
   1.610 +	}
   1.611 +
   1.612 +TBool CMMFDataPathProxySession::PrimeL(const RMmfIpcMessage& /*aMessage*/)
   1.613 +	{
   1.614 +	CheckDataPathExistsL();
   1.615 +	iDataPath->PrimeL();
   1.616 +	return ETrue;
   1.617 +	}
   1.618 +
   1.619 +TBool CMMFDataPathProxySession::PlayL(const RMmfIpcMessage& /*aMessage*/)
   1.620 +	{
   1.621 +	CheckDataPathExistsL();
   1.622 +	iDataPath->PlayL();
   1.623 +	return ETrue;
   1.624 +	}
   1.625 +
   1.626 +TBool CMMFDataPathProxySession::PauseL(const RMmfIpcMessage& /*aMessage*/)
   1.627 +	{
   1.628 +	CheckDataPathExistsL();
   1.629 +	iDataPath->Pause();
   1.630 +	return ETrue;
   1.631 +	}
   1.632 +
   1.633 +TBool CMMFDataPathProxySession::StopL(const RMmfIpcMessage& /*aMessage*/)
   1.634 +	{
   1.635 +	CheckDataPathExistsL();
   1.636 +	iDataPath->Stop();
   1.637 +	return ETrue;
   1.638 +	}
   1.639 +
   1.640 +TBool CMMFDataPathProxySession::GetPositionL(const RMmfIpcMessage& aMessage) const
   1.641 +	{
   1.642 +	CheckDataPathExistsL();
   1.643 +	TTimeIntervalMicroSeconds* t = REINTERPRET_CAST(TTimeIntervalMicroSeconds*, aMessage.Int0());
   1.644 +	*t = iDataPath->Position();
   1.645 +	return ETrue;
   1.646 +	}
   1.647 +
   1.648 +TBool CMMFDataPathProxySession::SetPositionL(const RMmfIpcMessage& aMessage)
   1.649 +	{
   1.650 +	CheckDataPathExistsL();
   1.651 +	TTimeIntervalMicroSeconds* t = REINTERPRET_CAST(TTimeIntervalMicroSeconds*, aMessage.Int0());
   1.652 +	iDataPath->SetPositionL(*t);
   1.653 +	return ETrue;
   1.654 +	}
   1.655 +
   1.656 +TBool CMMFDataPathProxySession::SetPlayWindowL(const RMmfIpcMessage& aMessage) 
   1.657 +	{
   1.658 +	CheckDataPathExistsL() ;
   1.659 +	TTimeIntervalMicroSeconds* start = REINTERPRET_CAST( TTimeIntervalMicroSeconds*, aMessage.Int0() ) ;
   1.660 +	TTimeIntervalMicroSeconds* end = REINTERPRET_CAST( TTimeIntervalMicroSeconds*, aMessage.Int1() ) ;
   1.661 +	iDataPath->SetPlayWindowL( *start, *end ) ;
   1.662 +	return ETrue;
   1.663 +	}
   1.664 +
   1.665 +TBool CMMFDataPathProxySession::ClearPlayWindowL(const RMmfIpcMessage& /*aMessage*/)
   1.666 +	{
   1.667 +	CheckDataPathExistsL() ;
   1.668 +	iDataPath->ClearPlayWindowL() ;
   1.669 +	return ETrue ;
   1.670 +	}
   1.671 +
   1.672 +TBool CMMFDataPathProxySession::StateL(const RMmfIpcMessage& aMessage)
   1.673 +	{
   1.674 +	CheckDataPathExistsL() ;
   1.675 +	TInt* state = REINTERPRET_CAST( TInt*, aMessage.Int0() ) ;
   1.676 +	*state = iDataPath->State();
   1.677 +	return ETrue ;
   1.678 +	}
   1.679 +