|
1 // Copyright (c) 2007-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 #ifndef SBCENCODERCI_H |
|
17 #define SBCENCODERCI_H |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <mmf/common/mmfipc.h> |
|
21 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
22 #include <mmf/common/mmfipcserver.h> |
|
23 #endif |
|
24 #include <mmf/server/mmfdevsoundcustominterface.h> |
|
25 #include <mmf/server/mmfdevsoundcustomcommands.h> |
|
26 #include <mmf/server/devsoundstandardcustominterfaces.h> |
|
27 #include <mmf/plugin/mmfdevsoundcustominterface.hrh> |
|
28 |
|
29 /** |
|
30 Enum to represent the methods called by this custom interface |
|
31 @internalComponent |
|
32 @prototype |
|
33 @file |
|
34 */ |
|
35 enum TMMFDevSoundCISbcEncoderCommands |
|
36 { |
|
37 EMMFDevSoundCISbcEncoderGetSupportedSamplingFrequenciesCount = 0, |
|
38 EMMFDevSoundCISbcEncoderGetSupportedSamplingFrequenciesArray, |
|
39 EMMFDevSoundCISbcEncoderGetSupportedChannelModesCount, |
|
40 EMMFDevSoundCISbcEncoderGetSupportedChannelModesArray, |
|
41 EMMFDevSoundCISbcEncoderGetSupportedSubbandsCount, |
|
42 EMMFDevSoundCISbcEncoderGetSupportedSubbandsArray, |
|
43 EMMFDevSoundCISbcEncoderGetSupportedAllocationMethodsCount, |
|
44 EMMFDevSoundCISbcEncoderGetSupportedAllocationMethodsArray, |
|
45 EMMFDevSoundCISbcEncoderGetSupportedBlocksCount, |
|
46 EMMFDevSoundCISbcEncoderGetSupportedBlocksArray, |
|
47 EMMFDevSoundCISbcEncoderGetSupportedBitpoolRange, |
|
48 EMMFDevSoundCISbcEncoderSetSamplingFrequency, |
|
49 EMMFDevSoundCISbcEncoderSetChannelMode, |
|
50 EMMFDevSoundCISbcEncoderSetSubbands, |
|
51 EMMFDevSoundCISbcEncoderSetBlocks, |
|
52 EMMFDevSoundCISbcEncoderSetAllocationMethod, |
|
53 EMMFDevSoundCISbcEncoderSetBitpoolSize, |
|
54 EMMFDevSoundCISbcEncoderApplyConfig, |
|
55 EMMFDevSoundCISbcEncoderGetSamplingFrequency, |
|
56 EMMFDevSoundCISbcEncoderGetChannelMode, |
|
57 EMMFDevSoundCISbcEncoderGetSubbands, |
|
58 EMMFDevSoundCISbcEncoderGetBlocks, |
|
59 EMMFDevSoundCISbcEncoderGetAllocationMethod, |
|
60 EMMFDevSoundCISbcEncoderGetBitpoolSize |
|
61 }; |
|
62 |
|
63 |
|
64 /** |
|
65 CMMFSbcEncoderMux implementation of the SBC encoder custom interface pair |
|
66 @internalComponent |
|
67 @prototype |
|
68 @file |
|
69 */ |
|
70 class CMMFSbcEncoderMux : public CBase, |
|
71 public MMMFDevSoundCustomInterfaceMuxPlugin, |
|
72 public MSbcEncoderIntfc |
|
73 { |
|
74 public: |
|
75 |
|
76 // from MMMFDevSoundCustomInterfaceMuxPlugin |
|
77 /** |
|
78 Attempt to open the interface. |
|
79 @param aInterfaceId |
|
80 The UID of the interface to open. |
|
81 @return One of the system wide error codes |
|
82 */ |
|
83 virtual TInt OpenInterface(TUid aInterfaceId); |
|
84 |
|
85 /** |
|
86 Equivalent to destructor. Called to destroy plugin. |
|
87 */ |
|
88 virtual void Release(); |
|
89 |
|
90 /** |
|
91 Pass destructor key. |
|
92 Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() |
|
93 @param aDestructorKey |
|
94 The Uid returned by REComSession::CreateImplementationL() or similar |
|
95 */ |
|
96 virtual void PassDestructorKey(TUid aDestructorKey); |
|
97 |
|
98 /** |
|
99 Complete construction. |
|
100 Pass additional values from the construction phase, used subsequently by the plugin. |
|
101 @param aCustomUtility |
|
102 The custom interface utility used by the plugin to communicate with the remote |
|
103 server side DeMux plugin |
|
104 @leave This method may leave with one of the system-wide error codes. |
|
105 */ |
|
106 virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility); |
|
107 |
|
108 /** |
|
109 Return the custom interface |
|
110 @param aInterfaceId |
|
111 The UID of the required custom interface |
|
112 @return The custom interface supported by this plugin |
|
113 */ |
|
114 virtual TAny* CustomInterface(TUid aInterfaceId); |
|
115 |
|
116 /** |
|
117 Instantiate a CI Mux class |
|
118 @leave This method may leave with one of the system-wide error codes. |
|
119 @return The pointer to the new class, cast to the Mux plugin mixin |
|
120 */ |
|
121 static MMMFDevSoundCustomInterfaceMuxPlugin* NewL(); |
|
122 |
|
123 // from MSbcEncoderIntfc |
|
124 /** |
|
125 @see MSbcEncoderIntfc |
|
126 */ |
|
127 virtual TInt GetSupportedSamplingFrequencies(RArray<TUint>& aSamplingFrequencies); |
|
128 |
|
129 /** |
|
130 @see MSbcEncoderIntfc |
|
131 */ |
|
132 virtual TInt GetSupportedChannelModes(RArray<TSbcChannelMode>& aChannelModes); |
|
133 |
|
134 /** |
|
135 @see MSbcEncoderIntfc |
|
136 */ |
|
137 virtual TInt GetSupportedNumOfSubbands(RArray<TUint>& aNumOfSubbands); |
|
138 |
|
139 /** |
|
140 @see MSbcEncoderIntfc |
|
141 */ |
|
142 virtual TInt GetSupportedAllocationMethods(RArray<TSbcAllocationMethod>& aAllocationMethods); |
|
143 |
|
144 /** |
|
145 @see MSbcEncoderIntfc |
|
146 */ |
|
147 virtual TInt GetSupportedNumOfBlocks(RArray<TUint>& aNumOfBlocks); |
|
148 |
|
149 /** |
|
150 @see MSbcEncoderIntfc |
|
151 */ |
|
152 virtual TInt GetSupportedBitpoolRange(TUint& aMinSupportedBitpoolSize, TUint& aMaxSupportedBitpoolSize); |
|
153 |
|
154 /** |
|
155 @see MSbcEncoderIntfc |
|
156 */ |
|
157 virtual void SetSamplingFrequency(TUint aSamplingFrequency); |
|
158 |
|
159 /** |
|
160 @see MSbcEncoderIntfc |
|
161 */ |
|
162 virtual void SetChannelMode(TSbcChannelMode aChannelMode); |
|
163 |
|
164 /** |
|
165 @see MSbcEncoderIntfc |
|
166 */ |
|
167 virtual void SetNumOfSubbands(TUint aNumOfSubbands); |
|
168 |
|
169 /** |
|
170 @see MSbcEncoderIntfc |
|
171 */ |
|
172 virtual void SetNumOfBlocks(TUint aNumOfBlocks); |
|
173 |
|
174 /** |
|
175 @see MSbcEncoderIntfc |
|
176 */ |
|
177 virtual void SetAllocationMethod(TSbcAllocationMethod aAllocationMethod); |
|
178 |
|
179 /** |
|
180 @see MSbcEncoderIntfc |
|
181 */ |
|
182 virtual void SetBitpoolSize(TUint aBitpoolSize); |
|
183 |
|
184 /** |
|
185 @see MSbcEncoderIntfc |
|
186 */ |
|
187 virtual TInt ApplyConfig(); |
|
188 |
|
189 /** |
|
190 @see MSbcEncoderIntfc |
|
191 */ |
|
192 virtual TInt GetSamplingFrequency(TUint& aSamplingFrequency); |
|
193 |
|
194 /** |
|
195 @see MSbcEncoderIntfc |
|
196 */ |
|
197 virtual TInt GetChannelMode(TSbcChannelMode& aChannelMode); |
|
198 |
|
199 /** |
|
200 @see MSbcEncoderIntfc |
|
201 */ |
|
202 virtual TInt GetNumOfSubbands(TUint& aNumOfSubbands); |
|
203 |
|
204 /** |
|
205 @see MSbcEncoderIntfc |
|
206 */ |
|
207 virtual TInt GetNumOfBlocks(TUint& aNumOfBlocks); |
|
208 |
|
209 /** |
|
210 @see MSbcEncoderIntfc |
|
211 */ |
|
212 virtual TInt GetAllocationMethod(TSbcAllocationMethod& aAllocationMethod); |
|
213 |
|
214 /** |
|
215 @see MSbcEncoderIntfc |
|
216 */ |
|
217 virtual TInt GetBitpoolSize(TUint& aBitpoolSize); |
|
218 |
|
219 protected: |
|
220 CMMFSbcEncoderMux(); |
|
221 ~CMMFSbcEncoderMux(); |
|
222 |
|
223 private: |
|
224 void DoGetTUintArrayL(RArray<TUint>& aArray, TInt aCount, TMMFDevSoundCISbcEncoderCommands aCommand); |
|
225 void DoGetChannelModesArrayL(RArray<TSbcChannelMode>& aChannelModes, TInt aCount); |
|
226 void DoGetAllocMethodsArrayL(RArray<TSbcAllocationMethod>& aAllocationMethods, TInt aCount); |
|
227 void DoWriteArrayToClientL(const RMmfIpcMessage& aMessage); |
|
228 |
|
229 protected: |
|
230 TUid iDestructorKey; |
|
231 TInt iRemoteHandle; |
|
232 MMMFDevSoundCustomInterfaceMuxUtility* iUtility; |
|
233 }; |
|
234 |
|
235 /** |
|
236 CMMFSbcEncoderDeMux - DeMux side of pair |
|
237 @internalComponent |
|
238 @prototype |
|
239 @file |
|
240 */ |
|
241 class CMMFSbcEncoderDeMux : public CBase, |
|
242 public MMMFDevSoundCustomInterfaceDeMuxPlugin |
|
243 { |
|
244 public: |
|
245 /** |
|
246 Instantiate a CMMFSbcEncoderDeMux class |
|
247 @leave This method may leave with one of the system-wide error codes. |
|
248 @return A pointer to the new class cast to the DeMux plugin mixin |
|
249 */ |
|
250 static MMMFDevSoundCustomInterfaceDeMuxPlugin* NewL(); |
|
251 |
|
252 /** |
|
253 Attempt to open the interface. |
|
254 @param aInterfaceId |
|
255 The UID of the interface to open. |
|
256 @return a handle to the remote plugin |
|
257 */ |
|
258 virtual TInt OpenInterface(TUid aInterfaceId); |
|
259 |
|
260 /** |
|
261 Equivalent to destructor. Called to destroy plugin. |
|
262 */ |
|
263 virtual void Release(); |
|
264 |
|
265 /** |
|
266 Pass destructor key. |
|
267 Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() |
|
268 @param aDestructorKey |
|
269 The Uid returned by REComSession::CreateImplementationL() or similar |
|
270 */ |
|
271 virtual void PassDestructorKey(TUid aDestructorKey); |
|
272 |
|
273 /** |
|
274 Set the target of the custom interface call |
|
275 @param aTarget |
|
276 The DevSound to call the custom interface on. |
|
277 */ |
|
278 virtual void SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget); |
|
279 |
|
280 /** |
|
281 Complete construction. |
|
282 @param aUtility |
|
283 The DeMux utility to use |
|
284 @leave This method may leave with one of the system-wide error codes. |
|
285 */ |
|
286 virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aUtility); |
|
287 |
|
288 /** |
|
289 Refresh the current custom interface connections |
|
290 @leave This method may leave with one of the system-wide error codes. |
|
291 */ |
|
292 virtual void RefreshL(); |
|
293 |
|
294 // from MMMFDevSoundCustomInterfaceDeMuxPlugin |
|
295 /** |
|
296 Open the slave |
|
297 @param aInterface |
|
298 The UID of the requested interface |
|
299 @param aPackageBuf |
|
300 A package of data that can be supplied for initialisation |
|
301 @leave This method may leave with one of the system-wide error codes. |
|
302 @return The result of the operation |
|
303 */ |
|
304 virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf); |
|
305 |
|
306 /** |
|
307 Close the slave |
|
308 @param aHandle |
|
309 The handle of the slave plugin |
|
310 @leave This method may leave with one of the system-wide error codes. |
|
311 */ |
|
312 virtual void DoCloseSlaveL(TInt aHandle); |
|
313 |
|
314 // original RMessage is supplied so that remote demux plugin can extract necessary details |
|
315 // using DeMux utility |
|
316 |
|
317 /** |
|
318 Relay the synchronous custom command onto the slave |
|
319 @param aMessage |
|
320 The IPC message to be sent to the slave |
|
321 @leave This method may leave with one of the system-wide error codes. |
|
322 @return The result of the operation |
|
323 */ |
|
324 virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage); |
|
325 |
|
326 /** |
|
327 Relay the synchronous custom command onto the slave and obtain a result |
|
328 @param aMessage |
|
329 The IPC message to be sent to the slave |
|
330 @leave This method may leave with one of the system-wide error codes. |
|
331 @return The result of the operation |
|
332 */ |
|
333 virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage); |
|
334 |
|
335 /** |
|
336 Relay an asynchronous command onto the slave |
|
337 @param aMessage |
|
338 The IPC message to be sent to the slave |
|
339 @leave This method may leave with one of the system-wide error codes. |
|
340 */ |
|
341 virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage); |
|
342 |
|
343 /** |
|
344 Relay an asynchronous command onto the slave and obtain a result |
|
345 @param aMessage |
|
346 The IPC message to be sent to the slave@param aMessage |
|
347 @leave This method may leave with one of the system-wide error codes. |
|
348 */ |
|
349 virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage); |
|
350 |
|
351 protected: |
|
352 ~CMMFSbcEncoderDeMux(); |
|
353 CMMFSbcEncoderDeMux(); |
|
354 |
|
355 // mirrors MSbcEncoderIntfc methods. |
|
356 TInt DoGetSupportedSamplingFrequencies (RArray<TUint>& aSamplingFrequencies ); |
|
357 TInt DoGetSupportedChannelModes (RArray<MSbcEncoderIntfc::TSbcChannelMode>& aChannelModes ); |
|
358 TInt DoGetSupportedNumOfSubbands (RArray<TUint>& aNumOfSubbands ); |
|
359 TInt DoGetSupportedAllocationMethods (RArray<MSbcEncoderIntfc::TSbcAllocationMethod>& aAllocationMethods ); |
|
360 TInt DoGetSupportedNumOfBlocks (RArray<TUint>& aNumOfBlocks ); |
|
361 TInt DoGetSupportedBitpoolRange (TUint& aMinSupportedBitpoolSize, TUint& aMaxSupportedBitpoolSize); |
|
362 void DoSetSamplingFrequency (TUint aSamplingFrequency ); |
|
363 void DoSetChannelMode (MSbcEncoderIntfc::TSbcChannelMode aChannelMode ); |
|
364 void DoSetNumOfSubbands (TUint aNumOfSubbands ); |
|
365 void DoSetNumOfBlocks (TUint aNumOfBlocks ); |
|
366 void DoSetAllocationMethod (MSbcEncoderIntfc::TSbcAllocationMethod aAllocationMethod ); |
|
367 void DoSetBitpoolSize (TUint aBitpoolSize ); |
|
368 TInt DoApplyConfig(); |
|
369 TInt DoGetSamplingFrequency (TUint& aSamplingFrequency ); |
|
370 TInt DoGetChannelMode (MSbcEncoderIntfc::TSbcChannelMode& aChannelMode ); |
|
371 TInt DoGetNumOfSubbands (TUint& aNumOfSubbands ); |
|
372 TInt DoGetNumOfBlocks (TUint& aNumOfBlocks ); |
|
373 TInt DoGetAllocationMethod (MSbcEncoderIntfc::TSbcAllocationMethod& aAllocationMethod ); |
|
374 TInt DoGetBitpoolSize (TUint& aBitpoolSize ); |
|
375 |
|
376 private: |
|
377 void DoWriteArrayToClientL(const RMmfIpcMessage& aMessage, RArray<TUint>& aArray); |
|
378 void DoWriteArrayToClientL(const RMmfIpcMessage& aMessage, TBool aWriteChannelModeArray); |
|
379 |
|
380 protected: |
|
381 MMMFDevSoundCustomInterfaceDeMuxUtility* iUtility; |
|
382 MMMFDevSoundCustomInterfaceTarget* iTarget; |
|
383 TUid iDestructorKey; |
|
384 MSbcEncoderIntfc* iInterfaceSbcEncoder; |
|
385 |
|
386 private: |
|
387 RArray<TUint> iSamplingFrequencies; |
|
388 RArray<TUint> iNumOfSubbands; |
|
389 RArray<TUint> iNumOfBlocks; |
|
390 RArray<MSbcEncoderIntfc::TSbcAllocationMethod> iAllocationMethods; |
|
391 RArray<MSbcEncoderIntfc::TSbcChannelMode> iChannelModes; |
|
392 }; |
|
393 |
|
394 #endif // SBCENCODERCI_H |