mmlibs/mmfw/inc/mmf/server/mmfdatapathproxy.h
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __MMFDATAPATHPROXY_H__
       
    17 #define __MMFDATAPATHPROXY_H__
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <e32std.h>
       
    21 #include <ecom/ecom.h>
       
    22 #include <mmf/server/mmfdatapath.h>
       
    23 #include <mmf/server/mmfsubthreadbase.h>
       
    24 
       
    25 #define KMMFDataPathProxyVersion TVersion(8,0,0)
       
    26 
       
    27 /**
       
    28 The amount of time that is allowed for the datapath to close down before the its thread is killed.
       
    29 */
       
    30 #define  KMMFDataPathProxyShutdownTimeout TTimeIntervalMicroSeconds32(10000000)
       
    31 
       
    32 
       
    33 /**
       
    34 @publishedAll
       
    35 @released
       
    36 
       
    37 Mixin class that the user of the class CMMFDataPathEventMonitor must derive from.
       
    38 
       
    39 @since 7.0s
       
    40 */
       
    41 class MMMFDataPathEventMonitorObserver
       
    42 	{
       
    43 public:
       
    44 
       
    45 	/**
       
    46 	Handles an event that has been generated by the datapath.
       
    47 
       
    48 	Called by CMMFDataPathEventMonitor::RunL().
       
    49 
       
    50 	@param  aEvent
       
    51 	        The event to be handled.
       
    52 
       
    53 	@since  7.0s
       
    54 	*/
       
    55 	virtual void HandleEvent(const TMMFEvent& aEvent) = 0;
       
    56 	};
       
    57 
       
    58 class RMMFDataPathProxy; //forward reference
       
    59 
       
    60 /**
       
    61 @publishedAll
       
    62 @released
       
    63 
       
    64 Active object utility class that can be used to monitor a datapath that is running in its own
       
    65 thread for events. If an event occurs, the client will be notified via the
       
    66 MMMFDataPathEventMonitorObserver interface.
       
    67 
       
    68 @since  7.0s
       
    69 */
       
    70 class CMMFDataPathEventMonitor : public CActive
       
    71 	{
       
    72 public:
       
    73 
       
    74 	IMPORT_C static CMMFDataPathEventMonitor* NewL(MMMFDataPathEventMonitorObserver& aObserver,
       
    75 		RMMFDataPathProxy& aMMFDataPathProxy);
       
    76 
       
    77 	IMPORT_C ~CMMFDataPathEventMonitor();
       
    78 
       
    79 	IMPORT_C void Start();
       
    80 
       
    81 	IMPORT_C void RunL();
       
    82 protected:
       
    83 
       
    84 	void DoCancel();
       
    85 private:
       
    86 
       
    87 	/**
       
    88 	Constructs a datapath event monitor object.
       
    89 
       
    90 	@param  aObserver
       
    91 	        A reference to the observer of the active object. The observer will be
       
    92 	        notified when an event occurs.
       
    93 	@param  aMMFDataPathProxy
       
    94 	        A reference to the datapath proxy class.
       
    95 
       
    96 	@since  7.0s
       
    97 	*/
       
    98 	CMMFDataPathEventMonitor(MMMFDataPathEventMonitorObserver& aObserver, 
       
    99 		RMMFDataPathProxy& aMMFDataPathProxy);
       
   100 private:
       
   101 	MMMFDataPathEventMonitorObserver& iObserver;
       
   102 	RMMFDataPathProxy& iMMFDataPathProxy;
       
   103 	TMMFEventPckg iEventPckg;
       
   104 	};
       
   105 
       
   106 /**
       
   107 @publishedAll
       
   108 @released
       
   109 
       
   110 Proxy class used to create a datapath in a new subthread.
       
   111 */
       
   112 class RMMFDataPathProxy : public RMMFSubThreadBase
       
   113 
       
   114 	{
       
   115 public:
       
   116 
       
   117 	/**
       
   118 	Constuctor.
       
   119 	*/
       
   120 	RMMFDataPathProxy() : RMMFSubThreadBase(KMMFDataPathProxyShutdownTimeout) {};
       
   121 
       
   122 	IMPORT_C TInt CreateSubThread();
       
   123 
       
   124 	IMPORT_C TInt LoadDataPath();
       
   125 
       
   126 	IMPORT_C TInt LoadDataPath(TMediaId aMediaId);
       
   127 
       
   128 	IMPORT_C TInt LoadDataPath(TUid aCodecUid); 
       
   129 
       
   130 	IMPORT_C TInt LoadDataPath(TUid aCodecUid, TMediaId aMediaId);
       
   131 
       
   132 	IMPORT_C TInt AddDataSource(MDataSource* aSource);
       
   133 
       
   134 	IMPORT_C TInt AddDataSink(MDataSink* aSink);
       
   135 
       
   136 	IMPORT_C TInt Prime();
       
   137 
       
   138 	IMPORT_C TInt Play();
       
   139 
       
   140 	IMPORT_C TInt Pause();
       
   141 
       
   142 	IMPORT_C TInt Stop();
       
   143 
       
   144 	IMPORT_C TInt GetPosition(TTimeIntervalMicroSeconds& aPosition) const;
       
   145 
       
   146 	IMPORT_C TInt SetPosition(const TTimeIntervalMicroSeconds& aPosition);
       
   147 
       
   148 	IMPORT_C TInt SetPlayWindow( const TTimeIntervalMicroSeconds& aStart, const TTimeIntervalMicroSeconds& aEnd ) ;
       
   149 
       
   150 	IMPORT_C TInt ClearPlayWindow() ;
       
   151 
       
   152 	IMPORT_C TInt State( TInt& aState ) ;
       
   153 
       
   154 	IMPORT_C void Close();
       
   155 	};
       
   156 
       
   157 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
       
   158 #include <mmf/server/mmfdatapathproxyserver.h>
       
   159 #endif
       
   160 
       
   161 #endif
       
   162