mmdevicefw/mdf/src/openmax/omxcomponentbody.h
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 // Copyright (c) 2005-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 // Implementation of the Class COmxComponent
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef OMXPROCESSINGUNITBODY_H
       
    19 #define OMXPROCESSINGUNITBODY_H
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <openmax/il/khronos/v1_x/OMX_Component.h>
       
    23 #include <omxprocessingunit.h>
       
    24 #include "omxcomponentimpl.h"
       
    25 
       
    26 enum TOmxPortPanics
       
    27 	{
       
    28 	EObserverNotSet,
       
    29 	EBodyNotCreated
       
    30 	};
       
    31 
       
    32 class CMMFBuffer;
       
    33 class MMdfInputPortObserver;
       
    34 class MMdfOutputPortObserver;
       
    35 
       
    36 class COmxProcessingUnit::CBody : public CBase
       
    37 	{
       
    38 public:
       
    39 	virtual ~CBody();
       
    40 	static CBody* NewL(const TDesC8& aComponentName, 
       
    41 						MOmxPuCallbacks& aPuCallbacks, 
       
    42 						COmxProcessingUnit* aParent, 
       
    43 						const MMdfProcessingUnitObserver& aObserver);
       
    44 
       
    45 	// Processing unit calls
       
    46 	TInt GetInputPorts(RPointerArray<MMdfInputPort>& aComponentInputPorts);
       
    47 	TInt GetOutputPorts(RPointerArray<MMdfOutputPort>& aComponentOutputPorts);
       
    48 	TInt Configure(const TPuConfig& aConfigurationSetup);
       
    49 	TInt GetConfig(TPuConfig& aConfigurationSetup);
       
    50 	void Initialize();
       
    51 	TInt Pause();
       
    52 	void Stop();
       
    53 	void Execute();
       
    54 	TProcessingUnitState State();
       
    55 	TInt CreateCustomInterface(TUid aUid);
       
    56 	TAny* CustomInterface(TUid aUid);
       
    57 	
       
    58 	// OMX Processing Unit calls	
       
    59 	TInt AddInputPort(MMdfInputPort* aInputPort);
       
    60 	TInt AddOutputPort(MMdfOutputPort* aOutputPort);
       
    61 	void SetPuState(TProcessingUnitState aState);	
       
    62 	MMdfProcessingUnitObserver* Observer();
       
    63 
       
    64 	// OMX calls 
       
    65 	TInt GetComponentVersion(const TDesC8& aComponentName, OMX_VERSIONTYPE* aComponentVersion, OMX_VERSIONTYPE* aSpecVersion, OMX_UUIDTYPE* aComponentUUID);
       
    66 	TInt SendCommand(OMX_COMMANDTYPE aCmd, TUint aParam1, TAny* aCmdData);
       
    67 	TInt GetParameter(OMX_INDEXTYPE aParamIndex, TAny* aComponentParameterStructure);
       
    68 	TInt SetParameter(OMX_INDEXTYPE aIndex, TAny* aComponentParameterStructure);
       
    69 	TInt GetConfig(OMX_INDEXTYPE aIndex, TAny* aValue);
       
    70 	TInt SetConfig(OMX_INDEXTYPE aIndex, TAny* aValue);
       
    71 	TInt GetExtensionIndex(const TDesC8& aParameterName, OMX_INDEXTYPE* aIndexType);
       
    72 	TInt GetState(OMX_STATETYPE* aState);
       
    73 	TInt ComponentTunnelRequest(TUint aPortInput, OMX_HANDLETYPE aOutput, TUint aPortOutput, OMX_TUNNELSETUPTYPE* aTunnelSetup);
       
    74 	TInt UseBuffer(CMMFBuffer* aBuffer, TUint aPortIndex);
       
    75 	CMMFBuffer* AllocateBufferL(TUint aPortIndex, TUint aSizeBytes);
       
    76 	TInt FreeBuffer(CMMFBuffer* aBuffer);
       
    77 	TInt EmptyThisBuffer(const CMMFBuffer* aBuffer, MOmxInputPortCallbacks* aCallback);
       
    78 	TInt FillThisBuffer(CMMFBuffer* aBuffer, MOmxOutputPortCallbacks* aCallback);
       
    79 	TInt SetCallbacks(MOmxPuCallbacks& aPuCallbacks);
       
    80 	
       
    81 	TInt EventHandler(OMX_HANDLETYPE aComponent, OMX_EVENTTYPE aEvent, TUint32 aData1,
       
    82 		 TUint32 aData2, TAny* aExtraInfo);
       
    83 private:
       
    84 	CBody();
       
    85 	void ConstructL(const TDesC8& aComponentName, 
       
    86 						MOmxPuCallbacks& aPuCallbacks, 
       
    87 						COmxProcessingUnit* aBody,
       
    88 						const MMdfProcessingUnitObserver& aObserver);
       
    89 						
       
    90 	
       
    91 	
       
    92 private:
       
    93 
       
    94 	void GetExtensionIndexL(const TDesC8& aParameterName, OMX_INDEXTYPE* aIndexType);
       
    95 	// Processing Unit Data
       
    96 	CMdfProcessingUnit* iParent;
       
    97 	MMdfProcessingUnitObserver* iObserver;
       
    98 	TProcessingUnitState 		iPuState;
       
    99 	RPointerArray<MMdfInputPort> iInputPorts;
       
   100 	RPointerArray<MMdfOutputPort> iOutputPorts;	
       
   101 
       
   102 
       
   103 	COmxBufferManager* iBufferManager;
       
   104 	OMX_COMPONENTTYPE* iHandle;
       
   105 	COmxCallbacks* iCallbacks;
       
   106 
       
   107 	};
       
   108 	
       
   109 // Prototypes for OMX callback handler functions
       
   110 OMX_ERRORTYPE EventHandler(OMX_OUT OMX_HANDLETYPE aComponent, 
       
   111 					OMX_OUT TAny* aAppData,
       
   112         			OMX_OUT OMX_EVENTTYPE aEvent, 
       
   113         			OMX_OUT TUint32 aData1,
       
   114         			OMX_OUT TUint32 aData2,
       
   115         			OMX_OUT TAny* aExtra);
       
   116         			
       
   117 OMX_ERRORTYPE EmptyBufferDone(
       
   118        OMX_HANDLETYPE aComponent,
       
   119        TAny* aAppData,
       
   120        OMX_BUFFERHEADERTYPE* aBuffer);
       
   121         
       
   122 OMX_ERRORTYPE FillBufferDone(
       
   123        OMX_HANDLETYPE aComponent,
       
   124        TAny* aAppData,
       
   125        OMX_BUFFERHEADERTYPE* aBuffer);
       
   126 
       
   127 
       
   128 #endif // OMXPROCESSINGUNITBODY_H