|
1 /* |
|
2 * Copyright (c) 2006 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 |
|
20 |
|
21 #ifndef MCCRESOURCEPOOL_H |
|
22 #define MCCRESOURCEPOOL_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 |
|
27 #include "mccresources.h" |
|
28 |
|
29 // CONSTANTS |
|
30 |
|
31 // MACROS |
|
32 |
|
33 // DATA TYPES |
|
34 |
|
35 // FUNCTION PROTOTYPES |
|
36 |
|
37 // FORWARD DECLARATIONS |
|
38 class CMccResourceContainer; |
|
39 class CMccResourceItem; |
|
40 class MDataSink; |
|
41 class MDataSource; |
|
42 class CMccCameraHandler; |
|
43 class CMccTimerManager; |
|
44 |
|
45 // CLASS DECLARATION |
|
46 |
|
47 /** |
|
48 * |
|
49 */ |
|
50 class CMccResourcePool : public CBase, public MMccResources |
|
51 { |
|
52 public: // Constructors and destructor |
|
53 |
|
54 /** |
|
55 * Two-phased constructor. |
|
56 */ |
|
57 static CMccResourcePool* NewL(); |
|
58 |
|
59 /** |
|
60 * Destructor. |
|
61 */ |
|
62 virtual ~CMccResourcePool(); |
|
63 |
|
64 public: // New functions |
|
65 |
|
66 void ReuseL( TUint32 aEndpointId ); |
|
67 |
|
68 void ReferenceCountL( TUint32 aEndpointId, TInt& aRefCount ); |
|
69 |
|
70 MDataSource* SourceCandidate(); |
|
71 |
|
72 MDataSink* SinkCandidate(); |
|
73 |
|
74 void SetEnableRtcpL( TUint32 aStreamId, TBool aEnableRtcp ); |
|
75 |
|
76 TBool EnableRtcp( TUint32 aStreamId ); |
|
77 |
|
78 /** |
|
79 * Gets existing camerahandler. |
|
80 */ |
|
81 CMccCameraHandler& CameraHandlerL( TBool aCurrentCamera = ETrue, |
|
82 TInt aCameraIndex = 0 ); |
|
83 |
|
84 /** |
|
85 * Gets new camerahandler. |
|
86 * @return CMccCameraHandler; ownership is transferred |
|
87 */ |
|
88 CMccCameraHandler* CreateNewCameraHandlerL( TInt aCameraIndex = 0 ); |
|
89 |
|
90 void UpdateResourceL( TUint32 aEndpointId, const TDesC8& aVal ); |
|
91 |
|
92 public: // Functions from MMccResources |
|
93 |
|
94 void ReserveSinkL( MDataSink* aSink, TUint32 aEndpointId ); |
|
95 |
|
96 void ReserveSourceL( MDataSource* aSource, TUint32 aEndpointId ); |
|
97 |
|
98 void PrepareEndpointRemovalL( |
|
99 TUint32 aEndpointId, |
|
100 RArray<TMccResourceParams>& aAffectedStreams ); |
|
101 |
|
102 void RemoveEndpointL( TUint32 aEndpointId ); |
|
103 |
|
104 void ReserveResourcesL( const TMccResourceParams& aParams ); |
|
105 |
|
106 void FreeResources( TUint32 aStreamId ); |
|
107 |
|
108 TBool IsResourceUsageAllowed( TUint32 aStreamId ); |
|
109 |
|
110 void SetUserInitiationModeL( TUint32 aStreamId, |
|
111 TBool iIsUserInititated ); |
|
112 |
|
113 void SetResourceStateL( TUint32 aStreamId, |
|
114 TUint32 aEndpointId, |
|
115 TResourceState aState, |
|
116 TBool& aControlNetworkResources, |
|
117 RArray<TUint32>& aControlledEndpoints, |
|
118 RArray<TUint32>& aUncontrolledEndpoints ); |
|
119 |
|
120 |
|
121 void ResourceStateSetL(); |
|
122 |
|
123 TInt EventReceived( TMccEvent& aEvent, |
|
124 TBool& aDiscardEvent, |
|
125 TBool& aEffectiveStandby, |
|
126 TMccEvent** aAdditionalEvent ); |
|
127 |
|
128 const RPointerArray<MDataSink>& Sinks( TBool aOnlyInternals ); |
|
129 |
|
130 const RPointerArray<MDataSource>& Sources( TBool aOnlyInternals ); |
|
131 |
|
132 CMccMultiplexer* MultiplexerL( MDataSource* aSource ); |
|
133 |
|
134 TInt FindResource( TUint32 aLinkId, |
|
135 TUint32 aEndpointId, |
|
136 TUid aResourceUid, |
|
137 MDataSource** aSource, |
|
138 MDataSink** aSink ); |
|
139 |
|
140 TInt FindNetworkResourceByRtpStreamId( |
|
141 const TUint32 aMccSessionId, |
|
142 const TRtpId& aRtpStreamId, |
|
143 MDataSource** aSource, |
|
144 MDataSink** aSink ); |
|
145 |
|
146 TInt FindNetworkResourceByRtpSsrc( |
|
147 const TRtpSSRC& aRtpSsrc, |
|
148 MDataSource** aSource, |
|
149 MDataSink** aSink ); |
|
150 |
|
151 MMccTimerManager& TimerManager(); |
|
152 |
|
153 void StoreKeyFrameInfoL( TUint32 aEndpointId, CMMFBuffer& aKeyFrame ); |
|
154 |
|
155 TBool IsKeyFrame( TUint32 aEndpointId, CMMFBuffer& aBuffer ); |
|
156 |
|
157 void EnableViewFinderL( TMccVideoSinkSetting& aSetting ); |
|
158 |
|
159 void DisableViewFinderL(); |
|
160 |
|
161 protected: // New functions |
|
162 |
|
163 protected: // Functions from base classes |
|
164 |
|
165 private: |
|
166 |
|
167 CMccResourceContainer* FindResourceContainer( TUint32 aStreamId ); |
|
168 |
|
169 CMccResourceItem* FindResourceItem( TUint32 aEndpointId ); |
|
170 |
|
171 void ClearCandidates(); |
|
172 |
|
173 void HandleCameraResourcesL(); |
|
174 |
|
175 TInt GetEndpoint( CMccResourceItem& aItem, |
|
176 TUid aResourceUid, |
|
177 MDataSource** aSource, |
|
178 MDataSink** aSink ); |
|
179 |
|
180 void CheckStandbyPropertiesL( const TMccResourceParams& aParams, |
|
181 MDataSink& aSink, |
|
182 MDataSource& aSource ); |
|
183 |
|
184 void CheckResourceAvailabilityL( MDataSink& aSink, MDataSource& aSource ); |
|
185 |
|
186 TMccEvent* StandbyLogicL( TMccEvent& aEvent, |
|
187 TBool& aDiscardEvent, |
|
188 TBool& aEffectiveStandby ); |
|
189 |
|
190 void StandbyInactivityL( CMccResourceContainer& aContainer, |
|
191 TMccEvent& aEvent, |
|
192 TBool& aDiscardEvent, |
|
193 TBool& aEffectiveStandby ); |
|
194 |
|
195 TMccEvent* StandbyActivityL( CMccResourceContainer& aContainer, |
|
196 TMccEvent& aEvent, |
|
197 TBool& aDiscardEvent, |
|
198 TBool& aEffectiveStandby ); |
|
199 |
|
200 private: |
|
201 |
|
202 /** |
|
203 * C++ default constructor. |
|
204 */ |
|
205 CMccResourcePool(); |
|
206 |
|
207 /** |
|
208 * By default Symbian 2nd phase constructor is private. |
|
209 */ |
|
210 void ConstructL(); |
|
211 |
|
212 public: // Data |
|
213 |
|
214 protected: // Data |
|
215 |
|
216 private: // Data |
|
217 |
|
218 // Not owned |
|
219 MDataSink* iSinkCandidate; |
|
220 |
|
221 TUint32 iSinkCandidateEndpointId; |
|
222 |
|
223 // Not owned |
|
224 MDataSource* iSourceCandidate; |
|
225 |
|
226 TUint32 iSourceCandidateEndpointId; |
|
227 |
|
228 RPointerArray<CMccResourceContainer> iResources; |
|
229 |
|
230 RPointerArray<CMccResourceItem> iEndpoints; |
|
231 |
|
232 RPointerArray<MDataSink> iTempSinks; |
|
233 |
|
234 RPointerArray<MDataSource> iTempSources; |
|
235 |
|
236 // Camera handle shared by all components |
|
237 CMccCameraHandler* iCameraHandler; |
|
238 |
|
239 CMccTimerManager* iTimerManager; |
|
240 |
|
241 private: // Friend classes |
|
242 |
|
243 #ifdef EUNIT_TEST |
|
244 friend class UT_CMccController; |
|
245 friend class UT_CMccResourcePool; |
|
246 friend class UT_CMccQosController; |
|
247 #endif |
|
248 |
|
249 |
|
250 public: // Friend classes |
|
251 |
|
252 protected: // Friend classes |
|
253 |
|
254 private: // Friend classes |
|
255 |
|
256 }; |
|
257 |
|
258 #endif // MCCRESOURCEPOOL_H |
|
259 |
|
260 // End of File |