|
1 // Copyright (c) 2008-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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 #ifndef PORTBUFFERHANDLER_H |
|
18 #define PORTBUFFERHANDLER_H |
|
19 |
|
20 #include <e32base.h> |
|
21 #include <f32file.h> |
|
22 #include <openmax/il/khronos/v1_x/OMX_Core.h> |
|
23 #include <openmax/il/khronos/v1_x/OMX_Component.h> |
|
24 #include <openmax/il/khronos/v1_x/OMX_Types.h> |
|
25 |
|
26 #include "omx_xml_script.h" |
|
27 |
|
28 #if defined(__WINSCW__) |
|
29 _LIT(KPortDirectoryPath, "c:\\mm\\omxlogicalil\\"); |
|
30 #else |
|
31 _LIT(KPortDirectoryPath, "e:\\unittest\\mm\\omxlogicalil\\"); |
|
32 #endif |
|
33 |
|
34 const OMX_VERSIONTYPE KOmxLILVersion = { 1, 1, 1, 0 }; |
|
35 |
|
36 NONSHARABLE_CLASS(CPortBufferHandler) : public CBase |
|
37 { |
|
38 public: |
|
39 void AddPortL( OMX_COMPONENTTYPE* aComp, |
|
40 TInt aPortNum, |
|
41 const TDesC& aFileName, |
|
42 OMX_BUFFERSUPPLIERTYPE aSupplier, |
|
43 OMX_DIRTYPE aPortDir, |
|
44 MOmxScriptTestLogger& aLogger, |
|
45 TInt aHeaderLength); |
|
46 |
|
47 void AllocateBuffersL(OMX_COMPONENTTYPE* aComp); |
|
48 void BufferDone(OMX_COMPONENTTYPE* aComp, OMX_BUFFERHEADERTYPE* aBufHdr, TBool aSource); |
|
49 void FreeBuffers(OMX_COMPONENTTYPE* aComp); |
|
50 void Start(OMX_COMPONENTTYPE* aComp, TInt aPortNum); |
|
51 void Resume(OMX_COMPONENTTYPE* aComp, TInt aPortNum); |
|
52 void Pause(OMX_COMPONENTTYPE* aComp, TInt aPortNum); |
|
53 void Stop(OMX_COMPONENTTYPE* aComp, TInt aPortNum); |
|
54 |
|
55 CPortBufferHandler(); |
|
56 ~CPortBufferHandler(); |
|
57 |
|
58 private: |
|
59 NONSHARABLE_CLASS(CPortInfo) : public CBase |
|
60 { |
|
61 public: |
|
62 static CPortInfo* NewL( OMX_COMPONENTTYPE* aComp, |
|
63 TInt aPortNum, |
|
64 const TDesC& aFileName, |
|
65 OMX_BUFFERSUPPLIERTYPE aSupplier, |
|
66 OMX_DIRTYPE aPortDir, |
|
67 MOmxScriptTestLogger& aLogger, |
|
68 TInt aHeaderLength); |
|
69 |
|
70 CPortInfo( OMX_COMPONENTTYPE* aComp, |
|
71 TInt aPortNum, |
|
72 OMX_BUFFERSUPPLIERTYPE aSupplier, |
|
73 OMX_DIRTYPE aPortDir, |
|
74 MOmxScriptTestLogger& aLogger, |
|
75 TInt aHeaderLength); |
|
76 ~CPortInfo(); |
|
77 void AllocateBuffersL(); |
|
78 void BufferDone(OMX_BUFFERHEADERTYPE* aBufHdr); |
|
79 void FreeBuffers(); |
|
80 void DeleteAllBuffers(); |
|
81 static TBool ComparePortNum(const TInt* aPortNum, const CPortInfo& aPortInfo); |
|
82 void Start(); |
|
83 void Stop(); |
|
84 void Resume(); |
|
85 void Pause(); |
|
86 OMX_DIRTYPE& PortDir(); |
|
87 void LogExtra(const TText8* aFile, TInt aLine, TOmxScriptSeverity aSeverity, |
|
88 TRefByValue<const TDesC16> aFmt,...); |
|
89 |
|
90 enum |
|
91 { |
|
92 EBufferFree, |
|
93 EBufferUnderUse |
|
94 }; |
|
95 |
|
96 private: |
|
97 TBuf<KMaxFileName> iFileName; |
|
98 RFs iFs; |
|
99 RFile iFileObject; |
|
100 OMX_COMPONENTTYPE* iComp; |
|
101 TInt iPortNum; |
|
102 TInt iNumBufs; |
|
103 OMX_BUFFERSUPPLIERTYPE iSupplier; |
|
104 RPointerArray<OMX_U8> iBuffers; |
|
105 RPointerArray<OMX_BUFFERHEADERTYPE> iBufferHeaders; |
|
106 OMX_DIRTYPE iPortDir; |
|
107 TInt iPosInputData; |
|
108 TInt iFileHeaderLength; |
|
109 TInt iFileFillingLength; |
|
110 MOmxScriptTestLogger& iLogger; |
|
111 TBool iEOSReached; |
|
112 TUint32 iTimeStamp; |
|
113 }; |
|
114 |
|
115 NONSHARABLE_CLASS(CComponentInfo) : public CBase |
|
116 { |
|
117 public: |
|
118 CComponentInfo(OMX_COMPONENTTYPE* aComp); |
|
119 ~CComponentInfo(); |
|
120 CPortInfo* AddPortL(TInt aPortNum, const TDesC& aFileName,OMX_BUFFERSUPPLIERTYPE aSupplier, OMX_DIRTYPE aPortDir, MOmxScriptTestLogger& aLogger, TInt aHeaderLength); |
|
121 void AllocateBuffersL(); |
|
122 void FillBuffers(); |
|
123 void BufferDone(OMX_BUFFERHEADERTYPE* aBufHdr, TBool aSource); |
|
124 void HoldBuffers(); |
|
125 void FreeBuffers(); |
|
126 static TBool CompareComp(const OMX_COMPONENTTYPE* aSource, const CComponentInfo& aComponentInfo); |
|
127 |
|
128 void Start(TInt aPortNum); |
|
129 void Stop(TInt aPortNum); |
|
130 void Resume(TInt aPortNum); |
|
131 void Pause(TInt aPortNum); |
|
132 |
|
133 private: |
|
134 OMX_COMPONENTTYPE* iComp; |
|
135 RPointerArray<CPortInfo> iPorts; |
|
136 OMX_STATETYPE iState; |
|
137 }; |
|
138 |
|
139 |
|
140 RPointerArray<CComponentInfo> iComponents; |
|
141 }; |
|
142 |
|
143 #endif // PORTBUFFERHANDLER_H |