1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmdevicefw/mdf/src/openmax/omxcomponentimpl.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,127 @@
1.4 +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#ifndef OMX_COMPONENTIMPL_H
1.20 +#define OMX_COMPONENTIMPL_H
1.21 +
1.22 +#include <e32msgqueue.h>
1.23 +
1.24 +class CMMFBuffer;
1.25 +
1.26 +class COmxBufferManager : public CBase
1.27 + {
1.28 +public:
1.29 +
1.30 + class COmxBuffer : public CBase
1.31 + {
1.32 + public:
1.33 + static COmxBuffer* NewL(OMX_BUFFERHEADERTYPE* aBufferHeader, CMMFBuffer* aBuffer);
1.34 + ~COmxBuffer();
1.35 +
1.36 + CMMFBuffer* MmfBuffer() const;
1.37 + OMX_BUFFERHEADERTYPE* BufferHeader() const;
1.38 +
1.39 + void SetInputPortCallbacks(MOmxInputPortCallbacks* aCallbacks);
1.40 + void SetOutputPortCallbacks(MOmxOutputPortCallbacks* aCallbacks);
1.41 +
1.42 + MOmxInputPortCallbacks* InputPortCallbacks() const;
1.43 + MOmxOutputPortCallbacks* OutputPortCallbacks() const;
1.44 +
1.45 + private:
1.46 + COmxBuffer();
1.47 + void ConstructL(OMX_BUFFERHEADERTYPE* aBufferHeader, CMMFBuffer* aBuffer);
1.48 +
1.49 + OMX_BUFFERHEADERTYPE* iBufferHeader;
1.50 + CMMFBuffer* iMmfBuffer;
1.51 +
1.52 + TBool iOwnsMmfBuffer;
1.53 + MOmxInputPortCallbacks* iInputPortCallbacks;
1.54 + MOmxOutputPortCallbacks* iOutputPortCallbacks;
1.55 + };
1.56 +
1.57 +public:
1.58 + COmxBufferManager(OMX_COMPONENTTYPE* aHandle);
1.59 + ~COmxBufferManager();
1.60 +
1.61 + // Buffer lookup
1.62 + COmxBuffer* FindBuffer(const CMMFBuffer* aBuffer) const;
1.63 + COmxBuffer* FindBuffer(OMX_BUFFERHEADERTYPE* aBuffer) const;
1.64 +
1.65 + // OMX Calls
1.66 + TInt UseBuffer(CMMFBuffer& aBuffer, TUint nPortIndex);
1.67 + CMMFBuffer* AllocateBufferL(TUint nPortIndex, TUint nSizeBytes);
1.68 + TInt FreeBuffer(CMMFBuffer* aBuffer);
1.69 +
1.70 + TInt EmptyThisBuffer(const CMMFBuffer* aBuffer, MOmxInputPortCallbacks* aObserver);
1.71 + TInt FillThisBuffer(CMMFBuffer* aBuffer, MOmxOutputPortCallbacks* aObserver);
1.72 +
1.73 + // Store OMX buffer pointer
1.74 + void StoreBufferL(OMX_BUFFERHEADERTYPE* aBufferHeader, CMMFBuffer* aBuffer);
1.75 +
1.76 +
1.77 +private:
1.78 + RPointerArray<COmxBuffer> iBuffers;
1.79 + OMX_COMPONENTTYPE* iHandle;
1.80 + };
1.81 +
1.82 +class COmxCallbacks : public CActive
1.83 + {
1.84 +public:
1.85 + enum TMessageType
1.86 + {
1.87 + EFillBufferCallback,
1.88 + EEmptyBufferCallback,
1.89 + EEventCallback
1.90 + };
1.91 +
1.92 + class TEventParams
1.93 + {
1.94 + public:
1.95 + OMX_EVENTTYPE iEvent;
1.96 + TUint iData1;
1.97 + TUint iData2;
1.98 + TAny* iExtra;
1.99 + };
1.100 +
1.101 + class TOmxMessage
1.102 + {
1.103 + public:
1.104 + TMessageType iType;
1.105 + OMX_HANDLETYPE iComponent;
1.106 + union
1.107 + {
1.108 + COmxBufferManager::COmxBuffer* iBuffer;
1.109 + TEventParams iEventParams;
1.110 + };
1.111 + };
1.112 +public:
1.113 + static COmxCallbacks* NewL(MOmxPuCallbacks& aPuCallbacks);
1.114 + operator OMX_CALLBACKTYPE*();
1.115 + void RunL();
1.116 + void DoCancel();
1.117 + TInt FillBufferDone(OMX_HANDLETYPE aComponent, COmxBufferManager::COmxBuffer* aBuffer);
1.118 + TInt EmptyBufferDone(OMX_HANDLETYPE aComponent, COmxBufferManager::COmxBuffer* aBuffer);
1.119 + TInt EventHandler(OMX_HANDLETYPE aComponent, TEventParams aParams);
1.120 + virtual ~COmxCallbacks();
1.121 +private:
1.122 + void ConstructL();
1.123 + COmxCallbacks(MOmxPuCallbacks& aPuCallbacks);
1.124 + int iState;
1.125 + MOmxPuCallbacks* iPuCallbacks;
1.126 + RMsgQueue<TOmxMessage> iMsgQueue;
1.127 + OMX_CALLBACKTYPE iHandle;
1.128 + };
1.129 +
1.130 +#endif // OMX_COMPONENTIMPL_H