mmdevicefw/mdf/inc/openmax/omxprocessingunit.h
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     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  @file
       
    18  @publishedPartner
       
    19  @released
       
    20 */
       
    21 
       
    22 #ifndef OMXPROCESSINGUNIT_H
       
    23 #define OMXPROCESSINGUNIT_H
       
    24 
       
    25 #include <e32std.h>
       
    26 #include <e32base.h>
       
    27 #include <mdf/mdfprocessingunit.h>
       
    28 #include <openmax/il/khronos/v1_x/OMX_Component.h>
       
    29 
       
    30 class COmxInputPort;
       
    31 class COmxOutputPort;
       
    32 
       
    33 /**
       
    34 OpenMAX Processing Unit observer class.
       
    35 */
       
    36 class MOmxPuCallbacks
       
    37 	{
       
    38 public:
       
    39 	virtual TInt MopcEventHandler(OMX_HANDLETYPE aComponent, OMX_EVENTTYPE aEvent, TUint32 aData1, TUint32 aData2, TAny* aExtraInfo) =0;
       
    40 	};
       
    41 
       
    42 /**
       
    43 OpenMAX Input Port observer class.
       
    44 */
       
    45 class MOmxInputPortCallbacks
       
    46 	{
       
    47 public:
       
    48 	/**
       
    49 	 * Returns the buffer that has been emptied.
       
    50 	 * @param 	aComponent
       
    51 	 *	   	The handle to the OpenMAX component sending the callback.
       
    52 	 * @param 	aBuffer
       
    53 	 * 		The buffer returned by the OpenMAX component.
       
    54 	 * @return	
       
    55 	 *		KErrNone, if successful; otherwise one of the other system-wide error codes. 
       
    56 	 *
       
    57 	 */
       
    58 	virtual TInt EmptyBufferDone(OMX_HANDLETYPE aComponent, const CMMFBuffer* aBuffer) =0;	
       
    59 	};
       
    60 
       
    61 
       
    62 /**
       
    63 OpenMAX Output Port observer class.
       
    64 */
       
    65 class MOmxOutputPortCallbacks
       
    66 	{
       
    67 public:
       
    68 	/**
       
    69 	 * Returns the buffer that has been filled.
       
    70 	 * @param 	aComponent
       
    71 	 *	   	The handle to the OpenMAX component sending the callback.
       
    72 	 * @param 	aBuffer
       
    73 	 * 		The buffer returned by the OpenMAX component.
       
    74 	 * @return	
       
    75 	 *		KErrNone, if successful; otherwise one of the other system-wide error codes. 
       
    76 	 */
       
    77 	virtual TInt FillBufferDone(OMX_HANDLETYPE aComponent, CMMFBuffer* aBuffer) =0;
       
    78 	};
       
    79 
       
    80 /**
       
    81 OpenMAX Processing Unit class.
       
    82 */
       
    83 class COmxProcessingUnit : public CMdfProcessingUnit, public MOmxPuCallbacks
       
    84 	{
       
    85 public:
       
    86 	class CBody;
       
    87 public:
       
    88 	// from CMdfProcessingUnit
       
    89 	IMPORT_C TInt Create(const MMdfProcessingUnitObserver& aProcessingUnitObserver);
       
    90 	IMPORT_C TInt GetInputPorts(RPointerArray<MMdfInputPort>& aComponentInputPorts);
       
    91 	IMPORT_C TInt GetOutputPorts(RPointerArray<MMdfOutputPort>& aComponentOutputPorts);
       
    92 	IMPORT_C TInt Configure(const TPuConfig& aConfigurationSetup);
       
    93 	IMPORT_C TInt GetConfig(TPuConfig& aConfigurationSetup);
       
    94 	IMPORT_C void Initialize();
       
    95 	IMPORT_C void Execute ();
       
    96 	IMPORT_C TInt Pause ();
       
    97 	IMPORT_C void Stop ();
       
    98 	IMPORT_C TProcessingUnitState State();
       
    99 	IMPORT_C TInt CreateCustomInterface(TUid aUid);
       
   100 	IMPORT_C TAny* CustomInterface(TUid aUid);
       
   101 	IMPORT_C ~COmxProcessingUnit();
       
   102 
       
   103 	// from MOmxPuCallbacks
       
   104 	IMPORT_C TInt MopcEventHandler(OMX_HANDLETYPE aComponent, OMX_EVENTTYPE aEvent, TUint32 aData1, TUint32 aData2, TAny* aExtraInfo);
       
   105 
       
   106 	// Accessors for Omx Component
       
   107 	IMPORT_C TInt OmxGetComponentVersion(const TDesC8& aComponentName, OMX_VERSIONTYPE* aComponentVersion, OMX_VERSIONTYPE* aSpecVersion, OMX_UUIDTYPE* aComponentUUID);
       
   108 	IMPORT_C TInt OmxSendCommand(OMX_COMMANDTYPE aCmd, TUint32 aParam1, TAny* aCmdData);
       
   109 	IMPORT_C TInt OmxGetParameter(OMX_INDEXTYPE aParamIndex, TAny* aComponentParameterStructure);
       
   110 	IMPORT_C TInt OmxSetParameter(OMX_INDEXTYPE aIndex, TAny* aComponentParameterStructure);
       
   111 	IMPORT_C TInt OmxGetConfig(OMX_INDEXTYPE aIndex, TAny* aValue);
       
   112 	IMPORT_C TInt OmxSetConfig(OMX_INDEXTYPE aIndex, TAny* aValue);
       
   113 	IMPORT_C TInt OmxGetExtensionIndex(const TDesC8& aParameterName, OMX_INDEXTYPE* aIndexType);
       
   114 	IMPORT_C TInt OmxGetState(OMX_STATETYPE* aState);
       
   115 	IMPORT_C TInt OmxComponentTunnelRequest(TUint32 aPortInput, OMX_HANDLETYPE aOutput, TUint32 aPortOutput, OMX_TUNNELSETUPTYPE* aTunnelSetup);
       
   116 	IMPORT_C TInt OmxUseBuffer(CMMFBuffer* aBuffer, TUint32 aPortIndex);
       
   117 	IMPORT_C CMMFBuffer* OmxAllocateBufferL(TUint32 aPortIndex, TUint32 aSizeBytes);
       
   118 	IMPORT_C TInt OmxFreeBuffer(CMMFBuffer* aBuffer);
       
   119 	IMPORT_C TInt OmxEmptyThisBuffer(const CMMFBuffer* aBuffer, MOmxInputPortCallbacks* aObserver);
       
   120 	IMPORT_C TInt OmxFillThisBuffer(CMMFBuffer* aBuffer, MOmxOutputPortCallbacks* aObserver);
       
   121 	IMPORT_C TInt OmxSetCallbacks(MOmxPuCallbacks& aPuCallbacks);
       
   122 
       
   123 protected:
       
   124 	IMPORT_C void ConstructL(const TDesC8& aComponentName, const MMdfProcessingUnitObserver& aProcessingUnitObserver);
       
   125 	IMPORT_C COmxProcessingUnit();
       
   126 	IMPORT_C TInt AddInputPort(MMdfInputPort* aInputPort);
       
   127 	IMPORT_C TInt AddOutputPort(MMdfOutputPort* aOutputPort);
       
   128 	IMPORT_C void SetPuState(TProcessingUnitState aState);	
       
   129 	IMPORT_C const MMdfProcessingUnitObserver* Observer();
       
   130 private:
       
   131 	CBody*	iBody;
       
   132 	};
       
   133 
       
   134 #endif // OMXPROCESSINGUNIT_H
       
   135