omxilcomp/omxiltestcomp/md5sink/src/omxiltestmd5sinkprocessingfunction.h
changeset 0 58be5850fb6c
equal deleted inserted replaced
-1:000000000000 0:58be5850fb6c
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 /**
       
    20 @file
       
    21 @internalComponent
       
    22 */
       
    23 #ifndef COMXILTESTMD5SINKPROCESSINGFUNCTION_H
       
    24 #define COMXILTESTMD5SINKPROCESSINGFUNCTION_H
       
    25 
       
    26 #include <e32base.h>
       
    27 #include <e32msgqueue.h>
       
    28 #include <f32file.h>
       
    29 #include <openmax/il/khronos/v1_x/OMX_Index.h>
       
    30 #include <openmax/il/khronos/v1_x/OMX_Component.h>
       
    31 #include <openmax/il/common/omxilprocessingfunction.h>
       
    32 
       
    33 class COmxILTestMD5SinkConfigManager;
       
    34 class CMD5Active;
       
    35 class CFlushActive;
       
    36 
       
    37 class COmxILTestMD5SinkProcessingFunction : public COmxILProcessingFunction
       
    38 	{
       
    39 public:
       
    40 	static COmxILTestMD5SinkProcessingFunction* NewL(MOmxILCallbackNotificationIf&);
       
    41 	~COmxILTestMD5SinkProcessingFunction();
       
    42 
       
    43 	void SetConfigManager(COmxILTestMD5SinkConfigManager* aConfigManager);
       
    44 	
       
    45 	OMX_ERRORTYPE StateTransitionIndication(TStateIndex aNewState);
       
    46 	OMX_ERRORTYPE BufferFlushingIndication(TUint32 aPortIndex, OMX_DIRTYPE aDirection);
       
    47 	OMX_ERRORTYPE ParamIndication(OMX_INDEXTYPE aParamIndex, const TAny* apComponentParameterStructure);
       
    48 	OMX_ERRORTYPE ConfigIndication(OMX_INDEXTYPE aConfigIndex, const TAny* apComponentConfigStructure);
       
    49 	OMX_ERRORTYPE BufferIndication(OMX_BUFFERHEADERTYPE* apBufferHeader, OMX_DIRTYPE aDirection);
       
    50 	OMX_BOOL BufferRemovalIndication(OMX_BUFFERHEADERTYPE* apBufferHeader, OMX_DIRTYPE aDirection);
       
    51 
       
    52 private:
       
    53 	COmxILTestMD5SinkProcessingFunction(MOmxILCallbackNotificationIf&);
       
    54 	void ConstructL(MOmxILCallbackNotificationIf&);
       
    55 			
       
    56 private:
       
    57 	CMD5Active* iMD5Active;
       
    58 	CFlushActive* iFlushHandler;
       
    59 	};
       
    60 
       
    61 class CMD5;
       
    62 
       
    63 class CMD5Active : public CActive
       
    64 	{
       
    65 public:
       
    66 	static CMD5Active* NewL(MOmxILCallbackNotificationIf& aCallback);
       
    67 	~CMD5Active();
       
    68 	
       
    69 	OMX_ERRORTYPE DeliverBuffer(OMX_BUFFERHEADERTYPE*);
       
    70 	OMX_BOOL RemoveBuffer(OMX_BUFFERHEADERTYPE*);
       
    71 	
       
    72 	void FlushHeaders();
       
    73 	void SetConfigManager(COmxILTestMD5SinkConfigManager* aConfigManager);
       
    74 		
       
    75 protected:
       
    76 	void RunL();
       
    77 	void DoCancel();
       
    78 	
       
    79 private:
       
    80 	CMD5Active(MOmxILCallbackNotificationIf& aCallback);
       
    81 	void ConstructL();
       
    82 	
       
    83 	TBool RemoveFromQueueL(RMsgQueue<OMX_BUFFERHEADERTYPE*>& aQueue, OMX_BUFFERHEADERTYPE* aBufferHeader);
       
    84 
       
    85 	COmxILTestMD5SinkConfigManager* iConfigManager;
       
    86 	RMsgQueue<OMX_BUFFERHEADERTYPE*> iBuffers;
       
    87 	MOmxILCallbackNotificationIf& iCallback;
       
    88 	CMD5* iMD5;
       
    89 	};
       
    90 
       
    91 /*
       
    92  * Dependant on whether the client has an Active Scheduler or not the active objects may be running in a 
       
    93  * different thread context to that of the caller, in which case for flush to work it needs to run in this
       
    94  * context to ensure we don't complete while CMD5Active::RunL() is executing concurrently which would 
       
    95  * fail the conformance suite and the spec. because we complete the flush call yet still own a buffer.
       
    96  */
       
    97 class CFlushActive : public CActive
       
    98     {
       
    99 public:
       
   100     static CFlushActive* NewL(CMD5Active& aBufferHandler);
       
   101     ~CFlushActive();
       
   102     
       
   103     void Flush();
       
   104     
       
   105 protected:
       
   106     CFlushActive(CMD5Active& aBufferHandler);
       
   107     void ConstructL();
       
   108     
       
   109     void RunL();
       
   110     void DoCancel();
       
   111     
       
   112 private:
       
   113     CMD5Active& iBufferHandler;
       
   114     RSemaphore iWaitSemaphore;
       
   115     RThread iRunLContext;
       
   116     };
       
   117 
       
   118 #endif //COMXILTESTMD5SINKPROCESSINGFUNCTION_H