sl@0: // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: // All rights reserved.
sl@0: // This component and the accompanying materials are made available
sl@0: // under the terms of "Eclipse Public License v1.0"
sl@0: // which accompanies this distribution, and is available
sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: //
sl@0: // Initial Contributors:
sl@0: // Nokia Corporation - initial contribution.
sl@0: //
sl@0: // Contributors:
sl@0: //
sl@0: // Description:
sl@0: //
sl@0: 
sl@0: #ifndef __MMFDATAPATHPROXY_H__
sl@0: #define __MMFDATAPATHPROXY_H__
sl@0: 
sl@0: #include <e32base.h>
sl@0: #include <e32std.h>
sl@0: #include <ecom/ecom.h>
sl@0: #include <mmf/server/mmfdatapath.h>
sl@0: #include <mmf/server/mmfsubthreadbase.h>
sl@0: 
sl@0: #define KMMFDataPathProxyVersion TVersion(8,0,0)
sl@0: 
sl@0: /**
sl@0: The amount of time that is allowed for the datapath to close down before the its thread is killed.
sl@0: */
sl@0: #define  KMMFDataPathProxyShutdownTimeout TTimeIntervalMicroSeconds32(10000000)
sl@0: 
sl@0: 
sl@0: /**
sl@0: @publishedAll
sl@0: @released
sl@0: 
sl@0: Mixin class that the user of the class CMMFDataPathEventMonitor must derive from.
sl@0: 
sl@0: @since 7.0s
sl@0: */
sl@0: class MMMFDataPathEventMonitorObserver
sl@0: 	{
sl@0: public:
sl@0: 
sl@0: 	/**
sl@0: 	Handles an event that has been generated by the datapath.
sl@0: 
sl@0: 	Called by CMMFDataPathEventMonitor::RunL().
sl@0: 
sl@0: 	@param  aEvent
sl@0: 	        The event to be handled.
sl@0: 
sl@0: 	@since  7.0s
sl@0: 	*/
sl@0: 	virtual void HandleEvent(const TMMFEvent& aEvent) = 0;
sl@0: 	};
sl@0: 
sl@0: class RMMFDataPathProxy; //forward reference
sl@0: 
sl@0: /**
sl@0: @publishedAll
sl@0: @released
sl@0: 
sl@0: Active object utility class that can be used to monitor a datapath that is running in its own
sl@0: thread for events. If an event occurs, the client will be notified via the
sl@0: MMMFDataPathEventMonitorObserver interface.
sl@0: 
sl@0: @since  7.0s
sl@0: */
sl@0: class CMMFDataPathEventMonitor : public CActive
sl@0: 	{
sl@0: public:
sl@0: 
sl@0: 	IMPORT_C static CMMFDataPathEventMonitor* NewL(MMMFDataPathEventMonitorObserver& aObserver,
sl@0: 		RMMFDataPathProxy& aMMFDataPathProxy);
sl@0: 
sl@0: 	IMPORT_C ~CMMFDataPathEventMonitor();
sl@0: 
sl@0: 	IMPORT_C void Start();
sl@0: 
sl@0: 	IMPORT_C void RunL();
sl@0: protected:
sl@0: 
sl@0: 	void DoCancel();
sl@0: private:
sl@0: 
sl@0: 	/**
sl@0: 	Constructs a datapath event monitor object.
sl@0: 
sl@0: 	@param  aObserver
sl@0: 	        A reference to the observer of the active object. The observer will be
sl@0: 	        notified when an event occurs.
sl@0: 	@param  aMMFDataPathProxy
sl@0: 	        A reference to the datapath proxy class.
sl@0: 
sl@0: 	@since  7.0s
sl@0: 	*/
sl@0: 	CMMFDataPathEventMonitor(MMMFDataPathEventMonitorObserver& aObserver, 
sl@0: 		RMMFDataPathProxy& aMMFDataPathProxy);
sl@0: private:
sl@0: 	MMMFDataPathEventMonitorObserver& iObserver;
sl@0: 	RMMFDataPathProxy& iMMFDataPathProxy;
sl@0: 	TMMFEventPckg iEventPckg;
sl@0: 	};
sl@0: 
sl@0: /**
sl@0: @publishedAll
sl@0: @released
sl@0: 
sl@0: Proxy class used to create a datapath in a new subthread.
sl@0: */
sl@0: class RMMFDataPathProxy : public RMMFSubThreadBase
sl@0: 
sl@0: 	{
sl@0: public:
sl@0: 
sl@0: 	/**
sl@0: 	Constuctor.
sl@0: 	*/
sl@0: 	RMMFDataPathProxy() : RMMFSubThreadBase(KMMFDataPathProxyShutdownTimeout) {};
sl@0: 
sl@0: 	IMPORT_C TInt CreateSubThread();
sl@0: 
sl@0: 	IMPORT_C TInt LoadDataPath();
sl@0: 
sl@0: 	IMPORT_C TInt LoadDataPath(TMediaId aMediaId);
sl@0: 
sl@0: 	IMPORT_C TInt LoadDataPath(TUid aCodecUid); 
sl@0: 
sl@0: 	IMPORT_C TInt LoadDataPath(TUid aCodecUid, TMediaId aMediaId);
sl@0: 
sl@0: 	IMPORT_C TInt AddDataSource(MDataSource* aSource);
sl@0: 
sl@0: 	IMPORT_C TInt AddDataSink(MDataSink* aSink);
sl@0: 
sl@0: 	IMPORT_C TInt Prime();
sl@0: 
sl@0: 	IMPORT_C TInt Play();
sl@0: 
sl@0: 	IMPORT_C TInt Pause();
sl@0: 
sl@0: 	IMPORT_C TInt Stop();
sl@0: 
sl@0: 	IMPORT_C TInt GetPosition(TTimeIntervalMicroSeconds& aPosition) const;
sl@0: 
sl@0: 	IMPORT_C TInt SetPosition(const TTimeIntervalMicroSeconds& aPosition);
sl@0: 
sl@0: 	IMPORT_C TInt SetPlayWindow( const TTimeIntervalMicroSeconds& aStart, const TTimeIntervalMicroSeconds& aEnd ) ;
sl@0: 
sl@0: 	IMPORT_C TInt ClearPlayWindow() ;
sl@0: 
sl@0: 	IMPORT_C TInt State( TInt& aState ) ;
sl@0: 
sl@0: 	IMPORT_C void Close();
sl@0: 	};
sl@0: 
sl@0: #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
sl@0: #include <mmf/server/mmfdatapathproxyserver.h>
sl@0: #endif
sl@0: 
sl@0: #endif
sl@0: