First public contribution.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef OMX_COMPONENTIMPL_H
17 #define OMX_COMPONENTIMPL_H
19 #include <e32msgqueue.h>
23 class COmxBufferManager : public CBase
27 class COmxBuffer : public CBase
30 static COmxBuffer* NewL(OMX_BUFFERHEADERTYPE* aBufferHeader, CMMFBuffer* aBuffer);
33 CMMFBuffer* MmfBuffer() const;
34 OMX_BUFFERHEADERTYPE* BufferHeader() const;
36 void SetInputPortCallbacks(MOmxInputPortCallbacks* aCallbacks);
37 void SetOutputPortCallbacks(MOmxOutputPortCallbacks* aCallbacks);
39 MOmxInputPortCallbacks* InputPortCallbacks() const;
40 MOmxOutputPortCallbacks* OutputPortCallbacks() const;
44 void ConstructL(OMX_BUFFERHEADERTYPE* aBufferHeader, CMMFBuffer* aBuffer);
46 OMX_BUFFERHEADERTYPE* iBufferHeader;
47 CMMFBuffer* iMmfBuffer;
50 MOmxInputPortCallbacks* iInputPortCallbacks;
51 MOmxOutputPortCallbacks* iOutputPortCallbacks;
55 COmxBufferManager(OMX_COMPONENTTYPE* aHandle);
59 COmxBuffer* FindBuffer(const CMMFBuffer* aBuffer) const;
60 COmxBuffer* FindBuffer(OMX_BUFFERHEADERTYPE* aBuffer) const;
63 TInt UseBuffer(CMMFBuffer& aBuffer, TUint nPortIndex);
64 CMMFBuffer* AllocateBufferL(TUint nPortIndex, TUint nSizeBytes);
65 TInt FreeBuffer(CMMFBuffer* aBuffer);
67 TInt EmptyThisBuffer(const CMMFBuffer* aBuffer, MOmxInputPortCallbacks* aObserver);
68 TInt FillThisBuffer(CMMFBuffer* aBuffer, MOmxOutputPortCallbacks* aObserver);
70 // Store OMX buffer pointer
71 void StoreBufferL(OMX_BUFFERHEADERTYPE* aBufferHeader, CMMFBuffer* aBuffer);
75 RPointerArray<COmxBuffer> iBuffers;
76 OMX_COMPONENTTYPE* iHandle;
79 class COmxCallbacks : public CActive
102 OMX_HANDLETYPE iComponent;
105 COmxBufferManager::COmxBuffer* iBuffer;
106 TEventParams iEventParams;
110 static COmxCallbacks* NewL(MOmxPuCallbacks& aPuCallbacks);
111 operator OMX_CALLBACKTYPE*();
114 TInt FillBufferDone(OMX_HANDLETYPE aComponent, COmxBufferManager::COmxBuffer* aBuffer);
115 TInt EmptyBufferDone(OMX_HANDLETYPE aComponent, COmxBufferManager::COmxBuffer* aBuffer);
116 TInt EventHandler(OMX_HANDLETYPE aComponent, TEventParams aParams);
117 virtual ~COmxCallbacks();
120 COmxCallbacks(MOmxPuCallbacks& aPuCallbacks);
122 MOmxPuCallbacks* iPuCallbacks;
123 RMsgQueue<TOmxMessage> iMsgQueue;
124 OMX_CALLBACKTYPE iHandle;
127 #endif // OMX_COMPONENTIMPL_H