0
|
1 |
/*
|
|
2 |
* Copyright (c) 2008-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 |
@file
|
|
20 |
@internalComponent
|
|
21 |
*/
|
|
22 |
|
|
23 |
#ifndef OMXILGRAPHICSINKPROCESSINGFUNCTION_H
|
|
24 |
#define OMXILGRAPHICSINKPROCESSINGFUNCTION_H
|
|
25 |
|
|
26 |
#include <e32msgqueue.h>
|
|
27 |
#include <openmax/il/common/omxilprocessingfunction.h>
|
|
28 |
#include <openmax/il/extensions/omxilsymbianvideographicsinkextensions.h>
|
|
29 |
#include <openmax/il/khronos/v1_x/OMX_Video.h>
|
|
30 |
#include <graphics/surface.h>
|
|
31 |
#include <graphics/surfacemanager.h>
|
|
32 |
#include <graphics/surfaceupdateclient.h>
|
|
33 |
#include <graphics/surfaceconfiguration.h>
|
|
34 |
#include "mmfbuffershared.h"
|
|
35 |
|
|
36 |
|
|
37 |
class COmxILGraphicSinkVPB0Port;
|
|
38 |
/**
|
|
39 |
The class for GraphicSink processing functions. This provides the main processing engine behind the graphic sink.
|
|
40 |
*/
|
|
41 |
class COmxILGraphicSinkProcessingFunction :
|
|
42 |
public COmxILProcessingFunction
|
|
43 |
{
|
|
44 |
private:
|
|
45 |
class TGraphicSurfaceSettings
|
|
46 |
{
|
|
47 |
public:
|
|
48 |
TGraphicSurfaceSettings() : iSurfaceAttributes(iSurfaceAttributesBuf()) {};
|
|
49 |
|
|
50 |
public:
|
|
51 |
// Surface configuration
|
|
52 |
TSurfaceConfiguration iSurfaceConfig;
|
|
53 |
// A package for surface attribute.
|
|
54 |
RSurfaceManager::TSurfaceCreationAttributesBuf iSurfaceAttributesBuf;
|
|
55 |
// A surface attribute.
|
|
56 |
RSurfaceManager::TSurfaceCreationAttributes& iSurfaceAttributes;
|
|
57 |
} iGraphicSurfaceSettings;
|
|
58 |
|
|
59 |
public:
|
|
60 |
static COmxILGraphicSinkProcessingFunction* NewL(
|
|
61 |
MOmxILCallbackNotificationIf& aCallbacks);
|
|
62 |
|
|
63 |
~COmxILGraphicSinkProcessingFunction();
|
|
64 |
|
|
65 |
OMX_ERRORTYPE StateTransitionIndication(TStateIndex aNewState);
|
|
66 |
|
|
67 |
OMX_ERRORTYPE BufferFlushingIndication(TUint32 aPortIndex,
|
|
68 |
OMX_DIRTYPE aDirection);
|
|
69 |
|
|
70 |
OMX_ERRORTYPE ParamIndication(OMX_INDEXTYPE aParamIndex,
|
|
71 |
const TAny* apComponentParameterStructure);
|
|
72 |
|
|
73 |
OMX_ERRORTYPE ConfigIndication(OMX_INDEXTYPE aConfigIndex,
|
|
74 |
const TAny* apComponentConfigStructure);
|
|
75 |
|
|
76 |
OMX_ERRORTYPE BufferIndication(
|
|
77 |
OMX_BUFFERHEADERTYPE* apBufferHeader,
|
|
78 |
OMX_DIRTYPE aDirection);
|
|
79 |
|
|
80 |
OMX_BOOL BufferRemovalIndication(
|
|
81 |
OMX_BUFFERHEADERTYPE* apBufferHeader,
|
|
82 |
OMX_DIRTYPE aDirection);
|
|
83 |
|
|
84 |
void CreateBufferL(OMX_U8*& aPortSpecificBuffer, OMX_PTR& aPortPrivate, OMX_U32 aBufferCountActual);
|
|
85 |
void DestroyBuffer(OMX_PTR apPortPrivate);
|
|
86 |
void InitBufferL(OMX_U32 aSizeBytes, OMX_U8* apBuffer, OMX_U32 aBufferCountActual);
|
|
87 |
void DeInitBuffer();
|
|
88 |
void WaitForTransitionToPauseToFinish();
|
|
89 |
void TransitionToPauseFinished();
|
|
90 |
|
|
91 |
TUidPixelFormat ConvertPixelFormat(OMX_COLOR_FORMATTYPE aColorFormat);
|
|
92 |
|
|
93 |
// Access private member (read and write)
|
|
94 |
inline MOmxILCallbackNotificationIf& GetCallbacks();
|
|
95 |
inline TSurfaceConfiguration& GetSurfaceConfiguration();
|
|
96 |
inline RPointerArray<OMX_BUFFERHEADERTYPE>& BuffersToEmpty();
|
|
97 |
inline TGraphicSurfaceSettings& GraphicSurfaceSettings();
|
|
98 |
inline OMX_STATETYPE State();
|
|
99 |
inline void SetState(OMX_STATETYPE aState);
|
|
100 |
inline RSurfaceManager& SurfaceManager();
|
|
101 |
inline TInt GetFastCounterFrequency();
|
|
102 |
|
|
103 |
void SetSharedChunkBufConfig(TMMSharedChunkBufConfig aSharedChunkBufConfig);
|
|
104 |
void GetSharedChunkMetadata(OMX_U32& aHandleId, OMX_U64& aThreadId) const;
|
|
105 |
|
|
106 |
public:
|
|
107 |
//Not own, just points to related graphic sink port, so set it to public data member.
|
|
108 |
COmxILGraphicSinkVPB0Port* iGraphicSinkPort;
|
|
109 |
private:
|
|
110 |
COmxILGraphicSinkProcessingFunction(MOmxILCallbackNotificationIf& aCallbacks);
|
|
111 |
void ConstructL();
|
|
112 |
|
|
113 |
void InitSurfaceAttributes();
|
|
114 |
|
|
115 |
private:
|
|
116 |
RPointerArray<OMX_BUFFERHEADERTYPE> iBuffersToEmpty;
|
|
117 |
OMX_BUFFERHEADERTYPE* iBufferOnScreen;
|
|
118 |
RMutex iBufferMutex;
|
|
119 |
OMX_STATETYPE iState;
|
|
120 |
TInt iFastCounterFrequency;
|
|
121 |
// A surface manager.
|
|
122 |
RSurfaceManager iSurfaceManager;
|
|
123 |
TThreadId iOwnerThreadId;
|
|
124 |
CActiveSchedulerWait* iTransitionToPauseWait;
|
|
125 |
RSemaphore iTransitionToPauseWaitSemaphore;
|
|
126 |
|
|
127 |
/**
|
|
128 |
* Mediates access to the RSurfaceUpdateSession.
|
|
129 |
*/
|
|
130 |
class CGraphicSurfaceAccess : public CActive
|
|
131 |
{
|
|
132 |
public:
|
|
133 |
static CGraphicSurfaceAccess* NewL(COmxILGraphicSinkProcessingFunction& aParent);
|
|
134 |
~CGraphicSurfaceAccess();
|
|
135 |
|
|
136 |
// from CActive
|
|
137 |
void RunL();
|
|
138 |
void DoCancel();
|
|
139 |
|
|
140 |
TInt OpenDevice();
|
|
141 |
void CloseDevice();
|
|
142 |
TInt Execute();
|
|
143 |
TInt Pause();
|
|
144 |
TInt Stop();
|
|
145 |
|
|
146 |
void CreateBufferL(OMX_U8*& aPortSpecificBuffer, OMX_PTR& aPortPrivate, OMX_U32 aBufferCountActual);
|
|
147 |
void InitBufferL(OMX_U32 aSizeBytes, OMX_U8* apBuffer, OMX_U32 aBufferCountActual);
|
|
148 |
|
|
149 |
TInt ProcessNextBuffer();
|
|
150 |
|
|
151 |
void ResetSurfaceId();
|
|
152 |
void CloseChunk();
|
|
153 |
|
|
154 |
public:
|
|
155 |
TInt iSharedChunkHandleId;
|
|
156 |
TUint64 iSharedChunkThreadId;
|
|
157 |
TMMSharedChunkBufConfig iSharedChunkBufConfig;
|
|
158 |
TBool iIsLocalChunk;
|
|
159 |
|
|
160 |
private:
|
|
161 |
CGraphicSurfaceAccess(COmxILGraphicSinkProcessingFunction& aParent);
|
|
162 |
|
|
163 |
public:
|
|
164 |
TInt iBufferIdGenerator;
|
|
165 |
|
|
166 |
private:
|
|
167 |
OMX_BUFFERHEADERTYPE* iCurrentBuffer;
|
|
168 |
COmxILGraphicSinkProcessingFunction& iParent;
|
|
169 |
|
|
170 |
// Memory chunk
|
|
171 |
RChunk iChunk;
|
|
172 |
|
|
173 |
#ifdef ILCOMPONENTCONFORMANCE
|
|
174 |
// These are added for the ILComponentConformance Suite
|
|
175 |
// Handles copy of data in case of Non-buffer supplier, while running IL Component conformance suite
|
|
176 |
TBool iIsBufferSupplier;
|
|
177 |
// Conformance suite does not handle chunks therefore offsets from base chunk address are held in this array
|
|
178 |
RArray<TInt> iArrayOffsets;
|
|
179 |
#endif
|
|
180 |
|
|
181 |
// Surface Id
|
|
182 |
TSurfaceId iSurfaceId;
|
|
183 |
// A surface update session.
|
|
184 |
RSurfaceUpdateSession iSurfaceUpdateSession;
|
|
185 |
// Time stamp of the display notification event
|
|
186 |
TTimeStamp iTimeStamp;
|
|
187 |
// An indicator for first frame displayed
|
|
188 |
TBool iFirstFrameDisplayed;
|
|
189 |
|
|
190 |
RArray<TInt> iOffsetArray;
|
|
191 |
|
|
192 |
} *iGraphicSurfaceAccess;
|
|
193 |
|
|
194 |
/**
|
|
195 |
* Serializes operations into the 'main' thread hosting the Active Scheduler.
|
|
196 |
*/
|
|
197 |
class CPFHelper : public CActive
|
|
198 |
{
|
|
199 |
public:
|
|
200 |
static CPFHelper* NewL(COmxILGraphicSinkProcessingFunction& aParent, CGraphicSurfaceAccess& aGraphicSurfaceAccess);
|
|
201 |
~CPFHelper();
|
|
202 |
|
|
203 |
// from CActive
|
|
204 |
void RunL();
|
|
205 |
void DoCancel();
|
|
206 |
|
|
207 |
OMX_ERRORTYPE OpenDevice();
|
|
208 |
OMX_ERRORTYPE CloseDevice();
|
|
209 |
OMX_ERRORTYPE ExecuteAsync();
|
|
210 |
OMX_ERRORTYPE StopAsync();
|
|
211 |
OMX_ERRORTYPE StopSync();
|
|
212 |
OMX_ERRORTYPE Pause();
|
|
213 |
OMX_ERRORTYPE BufferIndication();
|
|
214 |
|
|
215 |
enum TMessageType
|
|
216 |
{
|
|
217 |
EOpenDevice,
|
|
218 |
ECloseDevice,
|
|
219 |
EExecuteCommand,
|
|
220 |
EStopCommand,
|
|
221 |
EPauseCommand,
|
|
222 |
EBufferIndication
|
|
223 |
};
|
|
224 |
|
|
225 |
RMsgQueue<TMessageType> iMsgQueue;
|
|
226 |
|
|
227 |
private:
|
|
228 |
CPFHelper(COmxILGraphicSinkProcessingFunction& aParent, CGraphicSurfaceAccess& aGraphicSurfaceAccess);
|
|
229 |
void ConstructL();
|
|
230 |
|
|
231 |
TInt ProcessQueue();
|
|
232 |
|
|
233 |
OMX_ERRORTYPE ConvertError(TInt aError);
|
|
234 |
|
|
235 |
private:
|
|
236 |
static const TInt KMaxMsgQueueEntries = 25;
|
|
237 |
|
|
238 |
COmxILGraphicSinkProcessingFunction& iParent;
|
|
239 |
CGraphicSurfaceAccess& iGraphicSurfaceAccess;
|
|
240 |
} *iPFHelper;
|
|
241 |
};
|
|
242 |
|
|
243 |
#include "omxilgraphicsinkprocessingfunction.inl"
|
|
244 |
|
|
245 |
#endif // OMXILGRAPHICSINKPROCESSINGFUNCTION_H
|
|
246 |
|