sl@0
|
1 |
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#ifndef OMX_COMPONENTIMPL_H
|
sl@0
|
17 |
#define OMX_COMPONENTIMPL_H
|
sl@0
|
18 |
|
sl@0
|
19 |
#include <e32msgqueue.h>
|
sl@0
|
20 |
|
sl@0
|
21 |
class CMMFBuffer;
|
sl@0
|
22 |
|
sl@0
|
23 |
class COmxBufferManager : public CBase
|
sl@0
|
24 |
{
|
sl@0
|
25 |
public:
|
sl@0
|
26 |
|
sl@0
|
27 |
class COmxBuffer : public CBase
|
sl@0
|
28 |
{
|
sl@0
|
29 |
public:
|
sl@0
|
30 |
static COmxBuffer* NewL(OMX_BUFFERHEADERTYPE* aBufferHeader, CMMFBuffer* aBuffer);
|
sl@0
|
31 |
~COmxBuffer();
|
sl@0
|
32 |
|
sl@0
|
33 |
CMMFBuffer* MmfBuffer() const;
|
sl@0
|
34 |
OMX_BUFFERHEADERTYPE* BufferHeader() const;
|
sl@0
|
35 |
|
sl@0
|
36 |
void SetInputPortCallbacks(MOmxInputPortCallbacks* aCallbacks);
|
sl@0
|
37 |
void SetOutputPortCallbacks(MOmxOutputPortCallbacks* aCallbacks);
|
sl@0
|
38 |
|
sl@0
|
39 |
MOmxInputPortCallbacks* InputPortCallbacks() const;
|
sl@0
|
40 |
MOmxOutputPortCallbacks* OutputPortCallbacks() const;
|
sl@0
|
41 |
|
sl@0
|
42 |
private:
|
sl@0
|
43 |
COmxBuffer();
|
sl@0
|
44 |
void ConstructL(OMX_BUFFERHEADERTYPE* aBufferHeader, CMMFBuffer* aBuffer);
|
sl@0
|
45 |
|
sl@0
|
46 |
OMX_BUFFERHEADERTYPE* iBufferHeader;
|
sl@0
|
47 |
CMMFBuffer* iMmfBuffer;
|
sl@0
|
48 |
|
sl@0
|
49 |
TBool iOwnsMmfBuffer;
|
sl@0
|
50 |
MOmxInputPortCallbacks* iInputPortCallbacks;
|
sl@0
|
51 |
MOmxOutputPortCallbacks* iOutputPortCallbacks;
|
sl@0
|
52 |
};
|
sl@0
|
53 |
|
sl@0
|
54 |
public:
|
sl@0
|
55 |
COmxBufferManager(OMX_COMPONENTTYPE* aHandle);
|
sl@0
|
56 |
~COmxBufferManager();
|
sl@0
|
57 |
|
sl@0
|
58 |
// Buffer lookup
|
sl@0
|
59 |
COmxBuffer* FindBuffer(const CMMFBuffer* aBuffer) const;
|
sl@0
|
60 |
COmxBuffer* FindBuffer(OMX_BUFFERHEADERTYPE* aBuffer) const;
|
sl@0
|
61 |
|
sl@0
|
62 |
// OMX Calls
|
sl@0
|
63 |
TInt UseBuffer(CMMFBuffer& aBuffer, TUint nPortIndex);
|
sl@0
|
64 |
CMMFBuffer* AllocateBufferL(TUint nPortIndex, TUint nSizeBytes);
|
sl@0
|
65 |
TInt FreeBuffer(CMMFBuffer* aBuffer);
|
sl@0
|
66 |
|
sl@0
|
67 |
TInt EmptyThisBuffer(const CMMFBuffer* aBuffer, MOmxInputPortCallbacks* aObserver);
|
sl@0
|
68 |
TInt FillThisBuffer(CMMFBuffer* aBuffer, MOmxOutputPortCallbacks* aObserver);
|
sl@0
|
69 |
|
sl@0
|
70 |
// Store OMX buffer pointer
|
sl@0
|
71 |
void StoreBufferL(OMX_BUFFERHEADERTYPE* aBufferHeader, CMMFBuffer* aBuffer);
|
sl@0
|
72 |
|
sl@0
|
73 |
|
sl@0
|
74 |
private:
|
sl@0
|
75 |
RPointerArray<COmxBuffer> iBuffers;
|
sl@0
|
76 |
OMX_COMPONENTTYPE* iHandle;
|
sl@0
|
77 |
};
|
sl@0
|
78 |
|
sl@0
|
79 |
class COmxCallbacks : public CActive
|
sl@0
|
80 |
{
|
sl@0
|
81 |
public:
|
sl@0
|
82 |
enum TMessageType
|
sl@0
|
83 |
{
|
sl@0
|
84 |
EFillBufferCallback,
|
sl@0
|
85 |
EEmptyBufferCallback,
|
sl@0
|
86 |
EEventCallback
|
sl@0
|
87 |
};
|
sl@0
|
88 |
|
sl@0
|
89 |
class TEventParams
|
sl@0
|
90 |
{
|
sl@0
|
91 |
public:
|
sl@0
|
92 |
OMX_EVENTTYPE iEvent;
|
sl@0
|
93 |
TUint iData1;
|
sl@0
|
94 |
TUint iData2;
|
sl@0
|
95 |
TAny* iExtra;
|
sl@0
|
96 |
};
|
sl@0
|
97 |
|
sl@0
|
98 |
class TOmxMessage
|
sl@0
|
99 |
{
|
sl@0
|
100 |
public:
|
sl@0
|
101 |
TMessageType iType;
|
sl@0
|
102 |
OMX_HANDLETYPE iComponent;
|
sl@0
|
103 |
union
|
sl@0
|
104 |
{
|
sl@0
|
105 |
COmxBufferManager::COmxBuffer* iBuffer;
|
sl@0
|
106 |
TEventParams iEventParams;
|
sl@0
|
107 |
};
|
sl@0
|
108 |
};
|
sl@0
|
109 |
public:
|
sl@0
|
110 |
static COmxCallbacks* NewL(MOmxPuCallbacks& aPuCallbacks);
|
sl@0
|
111 |
operator OMX_CALLBACKTYPE*();
|
sl@0
|
112 |
void RunL();
|
sl@0
|
113 |
void DoCancel();
|
sl@0
|
114 |
TInt FillBufferDone(OMX_HANDLETYPE aComponent, COmxBufferManager::COmxBuffer* aBuffer);
|
sl@0
|
115 |
TInt EmptyBufferDone(OMX_HANDLETYPE aComponent, COmxBufferManager::COmxBuffer* aBuffer);
|
sl@0
|
116 |
TInt EventHandler(OMX_HANDLETYPE aComponent, TEventParams aParams);
|
sl@0
|
117 |
virtual ~COmxCallbacks();
|
sl@0
|
118 |
private:
|
sl@0
|
119 |
void ConstructL();
|
sl@0
|
120 |
COmxCallbacks(MOmxPuCallbacks& aPuCallbacks);
|
sl@0
|
121 |
int iState;
|
sl@0
|
122 |
MOmxPuCallbacks* iPuCallbacks;
|
sl@0
|
123 |
RMsgQueue<TOmxMessage> iMsgQueue;
|
sl@0
|
124 |
OMX_CALLBACKTYPE iHandle;
|
sl@0
|
125 |
};
|
sl@0
|
126 |
|
sl@0
|
127 |
#endif // OMX_COMPONENTIMPL_H
|