omxil_generic/omxilcomplib/src/omxilincontextcallbackmanager.h
changeset 0 0e4a32b9112d
child 5 fb6faddbb212
equal deleted inserted replaced
-1:000000000000 0:0e4a32b9112d
       
     1 // Copyright (c) 2008-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 
       
    17 /**
       
    18    @file
       
    19    @internalComponent
       
    20 */
       
    21 
       
    22 #ifndef OMXILINCONTEXTCALLBACKMANAGER_H
       
    23 #define OMXILINCONTEXTCALLBACKMANAGER_H
       
    24 
       
    25 #include "omxilcallbackmanager.h"
       
    26 
       
    27 /**
       
    28    OpenMAX IL call backs and buffer marks manager. This is a synchronous
       
    29    implementation of MOmxILCallbackManagerIf.
       
    30 
       
    31  */
       
    32 NONSHARABLE_CLASS(COmxILInContextCallbackManager) :
       
    33 	public CBase,
       
    34 	public MOmxILCallbackManagerIf,
       
    35 	private XOmxILCallbackManagerIfImpl
       
    36 	{
       
    37 
       
    38 public:
       
    39 
       
    40 	static COmxILInContextCallbackManager* NewL(
       
    41 		OMX_HANDLETYPE apComponentHandle,
       
    42 		OMX_PTR apAppData,
       
    43 		OMX_CALLBACKTYPE* apCallbacks);
       
    44 
       
    45 	~COmxILInContextCallbackManager();
       
    46 
       
    47 	void SetPortManager(MOmxILPortManagerIf& apPortManager);
       
    48 
       
    49 	void SetFsm(COmxILFsm& apFsm);
       
    50 
       
    51 	//
       
    52 	// Methods for Callback Registration (from MOmxILCallbackManagerIf)
       
    53 	//
       
    54 	OMX_ERRORTYPE RegisterComponentHandle(
       
    55 		OMX_HANDLETYPE aComponentHandle);
       
    56 
       
    57 	OMX_ERRORTYPE RegisterILClientCallbacks(
       
    58 		const OMX_CALLBACKTYPE* apCallbacks,
       
    59 		const OMX_PTR apAppData);
       
    60 
       
    61 	OMX_ERRORTYPE RegisterTunnelCallback(
       
    62 		OMX_U32 aLocalPortIndex,
       
    63 		OMX_DIRTYPE aLocalPortDirection,
       
    64 		OMX_HANDLETYPE aTunnelledComponentHandle,
       
    65 		OMX_U32 aTunnelledPortIndex
       
    66 		);
       
    67 
       
    68 	OMX_ERRORTYPE DeregisterTunnelCallback(
       
    69 		OMX_U32 aLocalPortIndex);
       
    70 
       
    71 	OMX_ERRORTYPE RegisterBufferMarkPropagationPort(
       
    72 		OMX_U32 aPortIndex,
       
    73 		OMX_U32 aPropagationPortIndex);
       
    74 
       
    75 	TBool BufferRemovalIndication(
       
    76 		OMX_BUFFERHEADERTYPE* apBufferHeader,
       
    77 		OMX_DIRTYPE aDirection);
       
    78 
       
    79 
       
    80 	//
       
    81 	// Methods for Callback Notification (from MOmxILCallbackManagerIf)
       
    82 	//
       
    83 
       
    84 	OMX_ERRORTYPE TransitionCompleteNotification(
       
    85 		OMX_STATETYPE aOmxState);
       
    86 
       
    87 	OMX_ERRORTYPE CommandCompleteNotification(
       
    88 		OMX_COMMANDTYPE aOmxCommand,
       
    89 		OMX_U32 aOmxPortIndex);
       
    90 
       
    91 #ifdef _OMXIL_COMMON_IL516C_ON
       
    92 	OMX_ERRORTYPE EjectBuffersRequest(
       
    93 		OMX_U32 aLocalOmxPortIndex);
       
    94 #endif
       
    95 
       
    96 	//
       
    97 	// Methods for Callback Notification (from MOmxILCallbackManagerIf)
       
    98 	//
       
    99 
       
   100 	OMX_ERRORTYPE ErrorEventNotification(
       
   101 		OMX_ERRORTYPE aOmxError);
       
   102 
       
   103 	OMX_ERRORTYPE EventNotification(
       
   104 		OMX_EVENTTYPE aEvent,
       
   105 		TUint32 aData1,
       
   106 		TUint32 aData2,
       
   107 		OMX_STRING aExtraInfo);
       
   108 
       
   109 	OMX_ERRORTYPE BufferDoneNotification(
       
   110 		OMX_BUFFERHEADERTYPE* apBufferHeader,
       
   111 		OMX_U32 aLocalPortIndex,
       
   112 		OMX_DIRTYPE aLocalPortDirection);
       
   113 
       
   114 	OMX_ERRORTYPE ClockBufferDoneNotification(
       
   115 		OMX_BUFFERHEADERTYPE* apBufferHeader,
       
   116 		OMX_U32 aLocalPortIndex,
       
   117 		OMX_DIRTYPE aLocalPortDirection);
       
   118 
       
   119 	OMX_ERRORTYPE PortSettingsChangeNotification(
       
   120 		OMX_U32 aLocalPortIndex,
       
   121 		TUint aPortSettingsIndex,
       
   122 		const TDesC8& aPortSettings);
       
   123 
       
   124 
       
   125 private:
       
   126 
       
   127 	class TOmxILBuffer
       
   128 		{
       
   129 
       
   130 	public:
       
   131 
       
   132 		OMX_BUFFERHEADERTYPE* ipBufferHeader;
       
   133 		OMX_U32 iLocalPortIndex;
       
   134 		OMX_DIRTYPE iLocalPortDirection;
       
   135 
       
   136 	// Default Constructor
       
   137 	inline TOmxILBuffer();
       
   138 
       
   139 	// Constructor
       
   140 	inline TOmxILBuffer(
       
   141 		OMX_BUFFERHEADERTYPE* apBufferHeader,
       
   142 		OMX_U32 aLocalPortIndex,
       
   143 		OMX_DIRTYPE aLocalPortDirection);
       
   144 
       
   145 		};
       
   146 
       
   147 private:
       
   148 
       
   149 	// Convenience typedef
       
   150 	typedef RArray<TOmxILBuffer> RCbMgrBufferQueue;
       
   151 
       
   152 
       
   153 private:
       
   154 
       
   155 	COmxILInContextCallbackManager(OMX_HANDLETYPE apComponentHandle,
       
   156 								   OMX_PTR apAppData,
       
   157 								   OMX_CALLBACKTYPE* apCallbacks);
       
   158 	void ConstructL();
       
   159 
       
   160 	void LockCallbackManager();
       
   161 	void UnlockCallbackManager();
       
   162 
       
   163 	void SignalOrPropagateBufferMarks(
       
   164 		OMX_BUFFERHEADERTYPE* apBufferHeader,
       
   165 		OMX_U32 aLocalPortIndex);
       
   166 
       
   167 	void ProcessBufferDoneNotification(
       
   168 		OMX_BUFFERHEADERTYPE* apBufferHeader,
       
   169 		OMX_U32 aLocalPortIndex,
       
   170 		OMX_DIRTYPE aLocalPortDirection);
       
   171 
       
   172 	void FlushQueue(RCbMgrBufferQueue& aQueue);
       
   173 
       
   174 	TBool RemoveBuffersByBufferHeader(
       
   175 		RCbMgrBufferQueue& aQueue,
       
   176 		OMX_BUFFERHEADERTYPE* apBufferHeader,
       
   177 		const OMX_DIRTYPE aDirection);
       
   178 
       
   179 	void FlushBuffersByPortIndex(RCbMgrBufferQueue& aQueue,
       
   180 								 const OMX_U32 aLocalPortIndex);
       
   181 
       
   182 
       
   183 private:
       
   184 
       
   185 	RFastLock iLock;
       
   186 
       
   187 	// Queue of buffer done notifications that need to be queued during
       
   188 	// OMX_StatePaused state
       
   189 	RCbMgrBufferQueue iPendingQueue;
       
   190 
       
   191 	// Flag to enable unconditional flushing of buffer done notifications
       
   192 	TBool iFlushPendingQueue;
       
   193 
       
   194 	OMX_STATETYPE iCurrentState;
       
   195 	OMX_STATETYPE iPreviousState;
       
   196 
       
   197 	};
       
   198 
       
   199 inline
       
   200 COmxILInContextCallbackManager::TOmxILBuffer::TOmxILBuffer()
       
   201 	:
       
   202 	ipBufferHeader(0),
       
   203 	iLocalPortIndex(0),
       
   204 	iLocalPortDirection(OMX_DirMax)
       
   205 	{
       
   206 	}
       
   207 
       
   208 inline
       
   209 COmxILInContextCallbackManager::TOmxILBuffer::TOmxILBuffer(
       
   210 	OMX_BUFFERHEADERTYPE* apBufferHeader,
       
   211 	OMX_U32 aLocalPortIndex,
       
   212 	OMX_DIRTYPE aLocalPortDirection
       
   213 	)
       
   214 	:
       
   215 	ipBufferHeader(apBufferHeader),
       
   216 	iLocalPortIndex(aLocalPortIndex),
       
   217 	iLocalPortDirection(aLocalPortDirection)
       
   218 	{
       
   219 	}
       
   220 
       
   221 
       
   222 #endif // OMXILINCONTEXTCALLBACKMANAGER_H