|
1 /* |
|
2 * Copyright (c) 2004-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 #ifndef MVTENGMEDIAHANDLER_H |
|
20 #define MVTENGMEDIAHANDLER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <mmfdatabuffer.h> |
|
25 #include <mmfutilities.h> |
|
26 #include <mmfcontrollerframework.h> |
|
27 |
|
28 typedef TInt TVtCommandId; |
|
29 typedef TInt TVtCommandStatus; |
|
30 typedef TDesC8 TVtMIMEType; |
|
31 |
|
32 const TUid KVTUidYUVFrameBuffer = {0xFFFFFF0d}; |
|
33 const TInt KVtUidDataSrcPrime = 0xFFFFFF08; |
|
34 const TInt KVtUidDataSrcPlay = 0xFFFFFF09; |
|
35 const TInt KVtUidDataSrcPause = 0xFFFFFF0A; |
|
36 const TInt KVtUidDataSrcStop = 0xFFFFFF0B; |
|
37 |
|
38 _LIT8(KVtVideoMIMETypeH263, "/video/x-pv/compressed/h263"); |
|
39 _LIT8(KVtVideoMIMETypeM4V, "/video/x-pv/compressed/m4v"); |
|
40 _LIT8(KVtVideoMIMETypeH264, "/video/x-pv/compressed/h264"); |
|
41 _LIT8(KVtAudioMIMETypeAMRIF2, "/audio/x-pv/compressed/amr/if2"); |
|
42 _LIT8(KVtAudioMIMETypeAMRWBIF2, "/audio/x-pv/compressed/amrwb/if2"); |
|
43 _LIT8(KVtVideoMIMETypeYUV420, "/video/x-pv/raw/yuv420"); |
|
44 |
|
45 enum TVt3G324MSupported |
|
46 { |
|
47 EVt3G324MMissing, |
|
48 EVt3G324MSupported |
|
49 }; |
|
50 |
|
51 enum TVtConfigType |
|
52 { |
|
53 EVtH324Config, |
|
54 EVtVideoEncoderConfig |
|
55 }; |
|
56 |
|
57 enum TVtCommandType { |
|
58 EVtCommandInit, |
|
59 EVtCommandGetSDKInfo, |
|
60 EVtCommandGetProtocolState = 3, |
|
61 EVtCommandReset, |
|
62 EVtCommandAddDataSource = 6, |
|
63 EVtCommandRemoveDataSource, |
|
64 EVtCommandAddDataSink, |
|
65 EVtCommandRemoveDataSink, |
|
66 EVtCommandConnect, |
|
67 EVtCommandDisconnect, |
|
68 EVtCommandPause, |
|
69 EVtCommandResume, |
|
70 EVtCommandGetProtocolInterface =20, |
|
71 EVtCommandDeleteProtocolInterface, |
|
72 EVtCommandCancelAllCommands |
|
73 }; |
|
74 |
|
75 enum TVtIndicationType |
|
76 { |
|
77 EVtIndicationVideoSpatialTamporalTradeOffCommand, |
|
78 EVtIndicationVideoSpatialTamporalTradeOffIndication, |
|
79 EVtIndicationUserInputCapability = 6, |
|
80 EVtIndicationIncomingTrack = 41, |
|
81 EVtIndicationOutgoingTrack, |
|
82 EVtIndicationDisconnect, |
|
83 EVtIndicationClosingTrack, |
|
84 EVtIndicationCloseTrack, |
|
85 EVtIndicationPauseTrack, |
|
86 EVtIndicationResumeTrack |
|
87 }; |
|
88 |
|
89 enum TVtMediaType |
|
90 { |
|
91 EVtAudio = 1, |
|
92 EVtVideo, |
|
93 EVtControl, |
|
94 EVtData, |
|
95 EVtUserInput, |
|
96 EVtMediaNone |
|
97 }; |
|
98 |
|
99 enum TVtAudioOutputControlCommand |
|
100 { |
|
101 EVtAudioOutputControlGetMaxVolume, |
|
102 EVtAudioOutputControlGetVolume, |
|
103 EVtAudioOutputControlSetVolume, |
|
104 EVtAudioOutputControlGetBalance, |
|
105 EVtAudioOutputControlSetBalance |
|
106 }; |
|
107 |
|
108 const TUint8 EVtIncoming = 1; |
|
109 |
|
110 enum TUserInputType |
|
111 { |
|
112 EVtUiiDTFM, |
|
113 EVtUiiAlphaNumeric |
|
114 }; |
|
115 |
|
116 struct TVtInitInfo |
|
117 { |
|
118 TBool iAMRWBOn; |
|
119 TBool iDisableMpeg4; |
|
120 }; |
|
121 |
|
122 struct TVtIndicationEvent |
|
123 { |
|
124 public: |
|
125 /** |
|
126 * Constructor. |
|
127 */ |
|
128 TVtIndicationEvent(TInt aEventType, const TUint8 *aLocalBuffer) : iEventType(aEventType), iLocalBuffer(aLocalBuffer) |
|
129 {} |
|
130 public: |
|
131 TInt iEventType; |
|
132 const TUint8 *iLocalBuffer; |
|
133 }; |
|
134 |
|
135 struct TVtCommandResponse |
|
136 { |
|
137 public: |
|
138 /** |
|
139 * Constructor. |
|
140 */ |
|
141 TVtCommandResponse(TVtCommandType aCmdType, TInt aCmdId, TInt iCmdStatus) : iCmdType(aCmdType), iCmdId(aCmdId), iCmdStatus(iCmdStatus) |
|
142 {} |
|
143 public: |
|
144 TVtCommandType iCmdType; |
|
145 TInt iCmdId; |
|
146 TInt iCmdStatus; |
|
147 }; |
|
148 |
|
149 struct TVtErrorEvent |
|
150 { |
|
151 public: |
|
152 /** |
|
153 * Constructor. |
|
154 */ |
|
155 TVtErrorEvent(TInt aEventType) : iEventType(aEventType) {} |
|
156 public: |
|
157 TInt iEventType; |
|
158 }; |
|
159 |
|
160 struct TVtMMFDataBuffer |
|
161 { |
|
162 public: |
|
163 /** |
|
164 * Constructor. |
|
165 */ |
|
166 TVtMMFDataBuffer(CMMFBuffer* aMmfBuffer,TSize aFrameSize, TPtr8& aPtr) : iMmfBuffer(aMmfBuffer), iFrameSize(aFrameSize), iPtr(aPtr) {} |
|
167 |
|
168 /** |
|
169 * Get the YUV frame size. |
|
170 * @return The frame size, in pixels |
|
171 */ |
|
172 TSize GetFrameSize() {return iFrameSize;} |
|
173 |
|
174 /** |
|
175 * Get MMF buffer. |
|
176 * @return the MMF buffer |
|
177 */ |
|
178 CMMFBuffer* GetMMFBuffer() {return iMmfBuffer;} |
|
179 |
|
180 /** |
|
181 * Get MMF buffer. |
|
182 * @return the MMF buffer |
|
183 */ |
|
184 const CMMFBuffer* GetMMFBuffer() const {return iMmfBuffer;} |
|
185 |
|
186 /** |
|
187 * @return Returns a reference to the data buffer |
|
188 **/ |
|
189 TPtr8& Data() {return iPtr;} |
|
190 |
|
191 /** |
|
192 * @return Returns the frame size of the contained buffer. |
|
193 **/ |
|
194 const TSize GetFrameSize() const {return iFrameSize;} |
|
195 |
|
196 /** |
|
197 * @return Returns a reference to the data buffer |
|
198 **/ |
|
199 const TPtr8& Data() const {return iPtr;} |
|
200 private: |
|
201 CMMFBuffer* iMmfBuffer; |
|
202 TSize iFrameSize; |
|
203 TPtr8& iPtr; |
|
204 }; |
|
205 |
|
206 class MVTVideoInput |
|
207 { |
|
208 public: |
|
209 |
|
210 /** |
|
211 * Set the video frame format. This must be from the list of supported formats. |
|
212 * @param "aFormat" The mime string describing the video frame format. |
|
213 * @exception Can leave with one of the system wide error codes |
|
214 */ |
|
215 virtual void SetFormatL(const TDesC8& aFormat) {} |
|
216 |
|
217 /** |
|
218 * Set the video frame rate. This must be within the range of supported frame rates |
|
219 * for the current frame size. |
|
220 * @param "aFrameRate" The video frame rate to set. |
|
221 * @exception Can leave with one of the system wide error codes |
|
222 */ |
|
223 virtual void SetFrameRateL(TReal32 aFrameRate) {} |
|
224 |
|
225 /** |
|
226 * Set the video frame size |
|
227 * @param "aSize" The video frame size, in pixels |
|
228 * @exception Can leave with one of the system wide error codes |
|
229 */ |
|
230 virtual void SetVideoFrameSizeL(const TSize& aSize) {} |
|
231 |
|
232 /** |
|
233 * Get the video frame size |
|
234 * @param "aSize" The video frame size, in pixels |
|
235 * @exception Can leave with one of the system wide error codes |
|
236 */ |
|
237 virtual void GetVideoFrameSizeL(TSize& aSize) const {} |
|
238 |
|
239 /** |
|
240 * This API returns multimedias type supported by the data source/sink - |
|
241 * Audio, Video, Data etc. Each supported type is indicated by a MIME type structure. |
|
242 * @return |
|
243 **/ |
|
244 virtual const RArray<TDesC8* >& GetMultimediaTypesL() const {} |
|
245 }; |
|
246 |
|
247 class MVTVideoOutput |
|
248 { |
|
249 public: |
|
250 |
|
251 /** |
|
252 * Sets the data format using MIME string. |
|
253 * @param aFormat The format as a MIME string. |
|
254 **/ |
|
255 virtual void SetFormatL(const TDesC8& aFormat) {} |
|
256 |
|
257 /** |
|
258 * Set the video frame size |
|
259 * @param "aSize" The video frame size, in pixels |
|
260 * @exception Can leave with one of the system wide error codes |
|
261 **/ |
|
262 virtual void SetVideoFrameSizeL(const TSize& aSize) {} |
|
263 |
|
264 /** |
|
265 * Get the video frame size |
|
266 * @param "aSize" The video frame size, in pixels |
|
267 * @exception Can leave with one of the system wide error codes |
|
268 **/ |
|
269 virtual void GetVideoFrameSizeL(TSize& aSize) const {} |
|
270 |
|
271 /** |
|
272 * This API returns multimedias type supported by the data source/sink - |
|
273 * Audio, Video, Data etc. Each supported type is indicated by a MIME type structure. |
|
274 * @return |
|
275 **/ |
|
276 virtual const RArray<TDesC8* >& GetMultimediaTypesL() const {} |
|
277 }; |
|
278 |
|
279 //This class is empty |
|
280 class MVTAudioSource |
|
281 { |
|
282 }; |
|
283 |
|
284 //This class is empty |
|
285 class MVTAudioSink |
|
286 { |
|
287 }; |
|
288 |
|
289 class MVTVideoSource; |
|
290 class MVTVideoSink : public MVTVideoOutput |
|
291 { |
|
292 public: |
|
293 /** |
|
294 * Constructor. |
|
295 */ |
|
296 MVTVideoSink(TUid aType): iDataSinkType(aType) {} |
|
297 |
|
298 /** |
|
299 * Method called by a data source to request the data sink to empty aBuffer of data. |
|
300 * |
|
301 * This is a pure virtual function that each derived class must implement. |
|
302 * This method is used when a data sink is passively waiting for requests from a supplier ie a data source |
|
303 * to empty a buffer. The data sink must call the BufferEmptiedL member on aSupplier when it has emptied |
|
304 * the buffer of it's data - the data sink can either make this callback synchronously or asynchronously. |
|
305 * |
|
306 * @param "aBuffer" |
|
307 * The full buffer that needs emptying of it's data |
|
308 * |
|
309 * @param "aSupplier" |
|
310 * The data source that supplied the data. The data sink needs this to make the BufferEmptiedL |
|
311 * callback on aSupplier to indicate to the data source that the data sink has finished with the buffer. |
|
312 * |
|
313 * @param "aMediaId" |
|
314 * This identifies the type of media eg audio or video and the stream id. |
|
315 * This parameter is required in cases where the source can supply data |
|
316 * of more than one media type and/or multiple strams of data |
|
317 */ |
|
318 virtual void EmptyBufferL( |
|
319 TVtMMFDataBuffer aDataBuffer, |
|
320 MVTVideoSource* aSupplier, |
|
321 TMediaId aMediaId ) {} |
|
322 |
|
323 /** |
|
324 * Method called by a data source to pass back an filled buffer to the sink |
|
325 * |
|
326 * This is a pure virtual function that each derived class must implement. |
|
327 * This method is used as the callback when the data sink actively requests a supplier ie a data source |
|
328 * to fill a buffer by calling the data sources FillBufferL. |
|
329 * When the data sink gets this callback it knows that the buffer has been filled and is ready to be emptied |
|
330 * |
|
331 * @param "aBuffer" |
|
332 * The buffer that has been filled by a data source and is now available for processing |
|
333 */ |
|
334 virtual void BufferFilledL( CMMFBuffer* aBuffer ) = 0; |
|
335 |
|
336 /** |
|
337 * Method to indicate whether the data sink can create a buffer. |
|
338 * |
|
339 * This is a pure virtual function that each derived class must implement. |
|
340 * |
|
341 * @return ETrue if the data sink can create a buffer else EFalse |
|
342 */ |
|
343 virtual TBool CanCreateSinkBuffer() {return EFalse;} |
|
344 |
|
345 /** |
|
346 * Returns a buffer created by the data sink |
|
347 * |
|
348 * This is a pure virtual function that each derived class must implement. |
|
349 * |
|
350 * @param "aMediaId" |
|
351 * This identifies the type of media eg audio or video and the stream id. |
|
352 * This parameter is required in cases where the source can supply data |
|
353 * of more than one media type and/or multiple strams of data. |
|
354 * |
|
355 * @param "aReference" |
|
356 * This must be written to by the method to indicate whether the created buffer is |
|
357 * a 'reference' buffer. A 'reference' buffer is a buffer that is owned by the sink |
|
358 * and should be used in preference to the source buffer provided the source buffer |
|
359 * is also not a reference buffer. |
|
360 * . |
|
361 * @return The created buffer |
|
362 */ |
|
363 virtual CMMFBuffer* CreateSinkBufferL( |
|
364 TMediaId aMediaId, |
|
365 TBool &aReference ) {return NULL;} |
|
366 |
|
367 /** |
|
368 * Method to 'logon' the data sink to the same thread that sink will be consuming data in. |
|
369 * |
|
370 * This method may be required as the thread that the data sink was created in is not always |
|
371 * the same thread that the data transfer will take place in. Therefore any thread specific |
|
372 * initialisation needs to be performed in the SinkThreadLogon rather than in the creation |
|
373 * of the data sink. |
|
374 * |
|
375 * This is a virtual function that a derrived data sink can implement if any thread specific |
|
376 * initialisation is required and/or the data sink can create any asynchronous events. |
|
377 * |
|
378 * |
|
379 * @param "aEventHandler" |
|
380 * This is an MAsyncEventHandler to handle asynchronous events that occur during the |
|
381 * transfer of multimedia data. The event handler must be in the same thread as the data transfer |
|
382 * thread - hence the reason it is passed in the SinkThreadLogon as opposed to say the constructor. |
|
383 * |
|
384 * |
|
385 * @return KErrNone if successful, otherwise a system wide error code. |
|
386 */ |
|
387 virtual TInt SinkThreadLogon( MAsyncEventHandler& aEventHandler ) {return KErrNone;} |
|
388 |
|
389 /** |
|
390 * Method to 'logoff' the data sink from the same thread that sink consumes data in. |
|
391 * |
|
392 * This method may be required as the thread that the data sink is deleted in may not be |
|
393 * the same thread that the data transfer took place in. Therefore any thread specific |
|
394 * releasing of resources needs to be performed in the SinkThreadLogoff rather than in the destructor |
|
395 * |
|
396 * This is a virtual function that a derrived data sink can implement if any thread specific |
|
397 * releasing of resources is required. |
|
398 */ |
|
399 virtual void SinkThreadLogoff() {} |
|
400 |
|
401 /** |
|
402 * Method to 'prime' the data sink |
|
403 * |
|
404 * This is a virtual function that a derrived data sink can implement if |
|
405 * any data sink specific 'priming' is required |
|
406 */ |
|
407 virtual TInt SinkPrimeL() {return 0;} |
|
408 |
|
409 /** |
|
410 * Method to 'play' the data sink |
|
411 * |
|
412 * This is a virtual function that a derrived data sink can implement if |
|
413 * any data sink specific action is required prior to 'playing'ie the start of data transfer |
|
414 */ |
|
415 virtual TInt SinkPlayL() {return 0;} |
|
416 |
|
417 /** |
|
418 * Method to 'pause' the data sink |
|
419 * |
|
420 * This is a virtual function that a derrived data sink can implement if |
|
421 * any data sink specific action is required to 'pause' |
|
422 */ |
|
423 virtual TInt SinkPauseL() {return 0;} |
|
424 |
|
425 /** |
|
426 * Method to 'stop' the data sink |
|
427 * |
|
428 * This is a virtual function that a derrived data sink can implement if |
|
429 * any data sink specific action is required to 'stop' |
|
430 */ |
|
431 virtual TInt SinkStopL() {return 0;} |
|
432 private: |
|
433 TUid iDataSinkType; |
|
434 }; |
|
435 |
|
436 class MVTVideoSource : public MVTVideoInput |
|
437 { |
|
438 public: |
|
439 |
|
440 /** |
|
441 * Constructor. |
|
442 */ |
|
443 MVTVideoSource(TUid aType): iDataSourceType(aType) {} |
|
444 |
|
445 /** |
|
446 * Method called by a data sink to request the data source to fill aBuffer with data. |
|
447 * |
|
448 * This is a pure virtual function that each derived class must implement. |
|
449 * This method is used when a data source is passively waiting for requests from a consumer ie a data sink |
|
450 * to fill a buffer. The data source must call the BufferFilledL member on aConsumer when it has filled |
|
451 * the buffer with data - the data source can either make this callback synchronously or asynchronously. |
|
452 * |
|
453 * @param "aBuffer" |
|
454 * The buffer that needs filling with data |
|
455 * |
|
456 * @param "aConsumer" |
|
457 * The data sink that consumes the data. The data source needs this to make the BufferFilledL |
|
458 * callback on aConsumer when the data source has completed filling the aBuffer. |
|
459 * |
|
460 * @param "aMediaId" |
|
461 * This identifies the type of media eg audio or video and the stream id. |
|
462 * This parameter is required in cases where the source can supply data |
|
463 * of more than one media type and/or multiple strams of data eg a multimedia file |
|
464 */ |
|
465 virtual void FillBufferL( |
|
466 CMMFBuffer* aBuffer, |
|
467 MVTVideoSink* aConsumer, |
|
468 TMediaId aMediaId ) {} |
|
469 |
|
470 /** |
|
471 * Method called by a data sink to pass back an emptied buffer to the source |
|
472 * |
|
473 * This is a pure virtual function that each derived class must implement. |
|
474 * This method is used as the callback when the data source actively requests a consumer ie a data sink |
|
475 * to empty a buffer by calling the data sinks EmptyBufferL. |
|
476 * When the data source gets this callback it knows that the buffer has been emptied and can be reused |
|
477 * |
|
478 * @param "aBuffer" |
|
479 * The buffer that has been emptied by a data sink and is now available for reuse |
|
480 */ |
|
481 virtual void BufferEmptiedL( CMMFBuffer* aBuffer ) = 0; |
|
482 |
|
483 /** |
|
484 * Method to indicate whether the data source can create a buffer. |
|
485 * |
|
486 * This is a pure virtual function that each derived class must implement. |
|
487 * |
|
488 * @return ETrue if the data source can create a buffer else EFalse |
|
489 */ |
|
490 virtual TBool CanCreateSourceBuffer() {return EFalse;} |
|
491 |
|
492 /** |
|
493 * Returns a buffer created by the data source |
|
494 * |
|
495 * This is a pure virtual function that each derived class must implement. |
|
496 * |
|
497 * @param "aMediaId" |
|
498 * This identifies the type of media eg audio or video and the stream id. |
|
499 * This parameter is required in cases where the source can supply data |
|
500 * of more than one media type and/or multiple strams of data eg a multimedia file |
|
501 * |
|
502 * @param "aReference" |
|
503 * This must be written to by the method to indicate whether the created buffer is |
|
504 * a 'reference' buffer. A 'reference' buffer is a buffer that is owned by the source |
|
505 * and should be used in preference to the sink buffer provided the sink buffer |
|
506 * is also not a reference buffer |
|
507 * . |
|
508 * @return The created buffer |
|
509 */ |
|
510 virtual CMMFBuffer* CreateSourceBufferL( |
|
511 TMediaId aMediaId, |
|
512 TBool &aReference ) {return NULL;} |
|
513 |
|
514 /** |
|
515 * Returns a buffer created by the data source |
|
516 * |
|
517 * This is a virtual function that a derived class can implement. |
|
518 * This can be used in preference to the above CreateSourceBufferL method in cases where |
|
519 * the source buffer creation has a dependancy on the sink buffer |
|
520 * |
|
521 * @param "aMediaId" |
|
522 * This identifies the type of media eg audio or video and the stream id. |
|
523 * This parameter is required in cases where the source can supply data |
|
524 * of more than one media type and/or multiple strams of data eg a multimedia file |
|
525 * |
|
526 * @param "aSinkBuffer" |
|
527 * The sink buffer the nature of which may influence the creation of the source buffer |
|
528 * |
|
529 * @param "aReference" |
|
530 * This must be written to by the method to indicate whether the created buffer is |
|
531 * a 'reference' buffer. A 'reference' buffer is a buffer that is owned by the source |
|
532 * and should be used in preference to the sink buffer provided the sink buffer is not a reference buffer |
|
533 * . |
|
534 * @return The created buffer |
|
535 */ |
|
536 virtual CMMFBuffer* CreateSourceBufferL( |
|
537 TMediaId aMediaId, |
|
538 CMMFBuffer& aSinkBuffer, |
|
539 TBool &aReference ) {return NULL;} |
|
540 |
|
541 /** |
|
542 * Method to 'logon' the data source to the same thread that source will be supplying data in. |
|
543 * |
|
544 * This method may be required as the thread that the data source was created in is not always |
|
545 * the same thread that the data transfer will take place in. Therefore any thread specific |
|
546 * initialisation needs to be performed in the SourceThreadLogon rather than in the creation |
|
547 * of the data source. |
|
548 * |
|
549 * This is a virtual function that a derrived data source can implement if any thread specific |
|
550 * initialisation is required and/or the data source can create any asynchronous events. |
|
551 * |
|
552 * |
|
553 * @param "aEventHandler" |
|
554 * This is an MAsyncEventHandler to handle asynchronous events that occur during the |
|
555 * transfer of multimedia data. The event handler must be in the same thread as the data transfer |
|
556 * thread - hence the reason it is passed in the SourceThreadLogon as opposed to say the constructor. |
|
557 * |
|
558 * |
|
559 * @return KErrNone if successful, otherwise a system wide error code. |
|
560 */ |
|
561 virtual TInt SourceThreadLogon( MAsyncEventHandler& aEventHandler ) {return KErrNone;} |
|
562 |
|
563 /** |
|
564 * Method to 'logoff' the data source from the same thread that source supplies data in. |
|
565 * |
|
566 * This method may be required as the thread that the data source is deleted in may not be |
|
567 * the same thread that the data transfer took place in. Therefore any thread specific |
|
568 * releasing of resources needs to be performed in the SourceThreadLogoff rather than in the destructor |
|
569 * |
|
570 * This is a virtual function that a derrived data source can implement if any thread specific |
|
571 * releasing of resources is required. |
|
572 */ |
|
573 virtual void SourceThreadLogoff() {} |
|
574 |
|
575 /** |
|
576 * Method to 'prime' the data source |
|
577 * |
|
578 * This is a virtual function that a derrived data source can implement if |
|
579 * any data source specific 'priming' is required |
|
580 */ |
|
581 virtual TInt SourcePrimeL() {return 0;} |
|
582 |
|
583 /** |
|
584 * Method to 'play' the data source |
|
585 * |
|
586 * This is a virtual function that a derrived data source can implement if |
|
587 * any data source specific action is required prior to 'playing'ie the start of data transfer |
|
588 */ |
|
589 virtual TInt SourcePlayL() {return 0;} |
|
590 |
|
591 /** |
|
592 * Method to 'pause' the data source |
|
593 * |
|
594 * This is a virtual function that a derrived data source can implement if |
|
595 * any data source specific action is required to 'pause' |
|
596 */ |
|
597 virtual TInt SourcePauseL() {return 0;} |
|
598 |
|
599 /** |
|
600 * Method to 'stop' the data source |
|
601 * |
|
602 * This is a virtual function that a derrived data source can implement if |
|
603 * any data source specific action is required to 'stop' |
|
604 */ |
|
605 virtual TInt SourceStopL() {return 0;} |
|
606 private: |
|
607 TUid iDataSourceType; |
|
608 }; |
|
609 |
|
610 class MCommServer |
|
611 { |
|
612 }; |
|
613 |
|
614 class MVtProtocolCommand |
|
615 { |
|
616 public: |
|
617 enum TVtProtocolState |
|
618 { |
|
619 EIdle, |
|
620 EInitializing, |
|
621 ESetup, |
|
622 EConnecting, |
|
623 EConnected, |
|
624 EDisconnecting, |
|
625 EResetting |
|
626 }; |
|
627 }; |
|
628 |
|
629 class MVtProtocolHandler |
|
630 { |
|
631 public: |
|
632 |
|
633 /** |
|
634 * Handle an event that has been generated. |
|
635 * |
|
636 * @param "aResponse" "The response to a previously issued command." |
|
637 */ |
|
638 virtual void HandleSessionCommandEventL(const TVtCommandResponse& aResponse) = 0; |
|
639 |
|
640 /** |
|
641 * Handle an informational event that has been generated. |
|
642 * |
|
643 * @param "aEvent" "The event to be handled." |
|
644 */ |
|
645 virtual void HandleSessionInformationalEventL(const TVtIndicationEvent& aEvent) = 0; |
|
646 |
|
647 /** |
|
648 * Handle an error event that has been generated. |
|
649 * |
|
650 * @param "aEvent" "The event to be handled." |
|
651 */ |
|
652 virtual void HandleSessionErrorEventL(const TVtErrorEvent& aEvent) = 0; |
|
653 |
|
654 /** |
|
655 * Signals completion of the audio output control command. |
|
656 * @param aId The command id of the completed command. |
|
657 * @param aCmd The command type. |
|
658 * @param aContextData The context data passed in with the command. |
|
659 * @param aStatus The command completion status. |
|
660 **/ |
|
661 virtual void HandleAudioOutputControlCommandComplete(TInt aId, TVtAudioOutputControlCommand aCmd, TAny *aContextData ,TInt aStatus) = 0; |
|
662 /** |
|
663 * Handle an event that has been generated. |
|
664 * |
|
665 * @param "aResponse" "The response to a previously issued command." |
|
666 */ |
|
667 virtual void HandleVideoEncoderCommandCompletedL(const TVtCommandResponse& aResponse) = 0; |
|
668 |
|
669 /** |
|
670 * Handle an event that has been generated. |
|
671 * |
|
672 * @param "aEvent" "The event to be handled." |
|
673 */ |
|
674 virtual void HandleVideoEncoderInformationalEventL(const TVtIndicationEvent& aEvent) = 0; |
|
675 |
|
676 /** |
|
677 * Handle an event that has been generated. |
|
678 * |
|
679 * @param "aResponse" "The response to a previously issued command." |
|
680 */ |
|
681 virtual void HandleH324MConfigCommandCompletedL(const TVtCommandResponse& aResponse) = 0; |
|
682 |
|
683 /** |
|
684 * Handle an event that has been generated. |
|
685 * |
|
686 * @param "aEvent" "The event to be handled." |
|
687 */ |
|
688 virtual void HandleH324MConfigInformationalEventL(const TVtIndicationEvent& aEvent) = 0; |
|
689 virtual ~MVtProtocolHandler() {} |
|
690 }; |
|
691 |
|
692 |
|
693 class MVtSessionCommand : public MVtProtocolCommand |
|
694 { |
|
695 public: |
|
696 /** |
|
697 * This function is valid only in the EIdle state. It is a no-op when |
|
698 * invoked in any other state. It causes the protocol to transition |
|
699 * to the ESetup state. The terminal remains in the EInitializing state during |
|
700 * the transition. |
|
701 * |
|
702 * |
|
703 * @param aInitInfo |
|
704 * A reference to a TVtInitInfo structure which set Mona on and off |
|
705 * |
|
706 * @leave This method can leave with one of the following error codes |
|
707 * KErrNoMemory if the SDK failed to allocate memory during this operation |
|
708 * @returns A unique command id for asynchronous completion |
|
709 **/ |
|
710 virtual TInt InitProtocolL(TVtInitInfo& aInitInfo) = 0; |
|
711 |
|
712 /** |
|
713 * For an incoming track (MVTVideoSink) this function pauses sending |
|
714 * media to the sink (output device) and stops the sink. It then does the protocol |
|
715 * negotiations with the remote terminal to pause the logical channel for |
|
716 * the specified track. |
|
717 * |
|
718 * For outgoing, it pauses the sending of media from the source and calls Stop() on the |
|
719 * source. It also performs any necessary protocol negotiations with the remote terminal. |
|
720 * EVtCommandPause will be sent to the observer when the processing completes. |
|
721 * |
|
722 * @returns A unique command id for asynchronous completion |
|
723 **/ |
|
724 virtual TInt PauseVideoL(MVTVideoSource& aDataSource) = 0; |
|
725 virtual TInt PauseVideoL(MVTVideoSink& aDataSink) = 0; |
|
726 virtual TInt PauseAudioL(MVTAudioSource& aAudioSource) = 0; |
|
727 |
|
728 /** |
|
729 * Resume a previously paused incoming or outgoing track. For incoming, |
|
730 * this function starts resumes playing out the media to the appropriate |
|
731 * sink based on the current settings. For outgoing it resumes encoding |
|
732 * and sending media from the source. |
|
733 * EVtCommandResume will be invoked will be invoked on the observer when the processing completes. |
|
734 * |
|
735 * @returns A unique command id for asynchronous completion |
|
736 **/ |
|
737 virtual TInt ResumeVideoL(MVTVideoSource& aDataSource) = 0; |
|
738 virtual TInt ResumeVideoL(MVTVideoSink& aDataSink) = 0; |
|
739 virtual TInt ResumeAudioL(MVTAudioSource& aAudioSource) = 0; |
|
740 |
|
741 /** |
|
742 * This function is valid only in the ESetup and EInitializing state. It is a |
|
743 * no-op when invoked in the EIdle state |
|
744 * |
|
745 * It causes the protocol to transition back to the EIdle state. The |
|
746 * terminal remains in the EResetting state during the transition. |
|
747 * |
|
748 * While resetting, the protocol de-allocates all resources resources that |
|
749 * had been previously allocated. When it completes, ResetComplete is called |
|
750 * and the protocol reverts to the EIdle state. |
|
751 * |
|
752 * @leave This method can leave with one of the following error codes |
|
753 * KErrNoMemory if the SDK failed to allocate memory during this operation |
|
754 * @returns A unique command id for asynchronous completion |
|
755 **/ |
|
756 virtual TInt ResetProtocolL() = 0; |
|
757 |
|
758 /** |
|
759 * This function can be invoked only in the ESetup state. The terminal starts connecting with the remote |
|
760 * terminal based on the specified options and capabilities. |
|
761 * The EVtCommandConnect command completion event will be passed to the observer |
|
762 * when connect completes. |
|
763 * Details about the negotiated session may be obtained by calling the GetSessionParamsL API. |
|
764 * GetSessionParamsL may be called after call setup is started to get the list of available channels |
|
765 * and their capabilities. |
|
766 * Incoming tracks may be opened before ConnectL completes and will be indicated via the |
|
767 * EVtIndicationIncommingTrack event. |
|
768 * |
|
769 * @param aComm |
|
770 * An optional pointer to a comm server to provide comm source and sink end-points. |
|
771 * @returns A unique command id for asynchronous completion |
|
772 **/ |
|
773 virtual TInt ConnectToProtocolL(MCommServer* aComm) = 0; |
|
774 |
|
775 /** |
|
776 * Allows an application to provide a media source to be associated with a logical channel |
|
777 * of communication with the peer. Sources should be added after the EVtIndicationOutgoingTrack |
|
778 * indication is received for a newly established logical channel. The media type and |
|
779 * channel id associated with the logical channel are specified as part of the indication. |
|
780 * This function accepts a MVtVideoSource which provides additional functionality |
|
781 * for advertizing capability and exposing configuration APIs. |
|
782 * Data sources could be of the following types: |
|
783 * a)raw media sources like camera, microphone etc. |
|
784 * b)sources of compressed data like file, gateway component etc. |
|
785 * |
|
786 * @param aChannelId |
|
787 * Indicates the channel id to be associated with this source. |
|
788 * @param aDataSource |
|
789 * reference to the data source |
|
790 * @leave This method can leave with one of the following error codes |
|
791 * KErrNotSupported if the format of the sources/sinks is incomtible with what the SDK can handle |
|
792 * KErrNoMemory if the SDK failed to allocate memory during this operation |
|
793 * @return A unique command id for asynchronous completion |
|
794 */ |
|
795 virtual TInt AddVideoSourceL(const TUint aChannelId, MVTVideoSource &aDataSource) = 0; |
|
796 virtual TInt AddAudioSourceL(const TUint aChannelId, MVTAudioSource &aDataSource) = 0; |
|
797 |
|
798 /** |
|
799 * Allows an application to provide a media sink for rendering an incoming media bitstream in a |
|
800 * logical channel of communication with the peer. |
|
801 * AddDataSinkL can be called only for established incoming logical channels identified by a unique |
|
802 * channel id. |
|
803 * Regular incoming channels are established by the peer and are |
|
804 * indicated using the EVtIndicationIncomingTrack indication. |
|
805 * This function takes in PV extension to MVtVideoSink or MVtAudioSink which provides additional functionality |
|
806 * for advertizing capability and exposing configuration APIs. |
|
807 * EVtCommandAddDataSink event is sent to the observer on completion of this call. |
|
808 * |
|
809 * @param aChannelId |
|
810 * Indicates the channel id to be associated with this sink. |
|
811 * @param aDataSink The data sink to be added |
|
812 * |
|
813 * @return A unique command id for asynchronous completion |
|
814 **/ |
|
815 virtual TInt AddVideoSinkL(const TUint aChannelId, MVTVideoSink &aDataSink) = 0; |
|
816 virtual TInt AddAudioSinkL(const TUint aChannelId, MVTAudioSink &aDataSink) = 0; |
|
817 |
|
818 /** |
|
819 * This API is to allow the user to cancel all pending requests. The current request being |
|
820 * processed, if any, will also be aborted. |
|
821 * EVtCommandCancelAllCommands will be passed to the command observer on completion. |
|
822 * @returns A unique command id for asynchronous completion |
|
823 **/ |
|
824 virtual TInt CancelAllCommandsL( ) = 0; |
|
825 |
|
826 /** |
|
827 * The Disconnect call is valid only when invoked in the EConnecting, and |
|
828 * EConnected states. It causes the terminal to transition to the |
|
829 * EDisconnecting state. All the media tracks both incoming and outgoing |
|
830 * will be closed on invoking Disconnect. On completion, the terminal |
|
831 * goes to the ESetup state. |
|
832 * |
|
833 * It is a no-op when called in any other state. |
|
834 * |
|
835 * This is an asynchronous request. The EvtCommandDisconnect event will be |
|
836 * sent to the observer when the request processing is complete. This |
|
837 * is the only event the Phone application should expect after calling |
|
838 * Disconnect. |
|
839 * |
|
840 * @returns A unique command id for asynchronous completion |
|
841 **/ |
|
842 virtual TInt DisconnectFromProtocolL() = 0; |
|
843 |
|
844 /** |
|
845 * This API is to allow for extensibility of the protocol interface. |
|
846 * It allows a caller to ask for an instance of a particular interface object to be returned. |
|
847 * The mechanism is analogous to the COM IUnknown method. The interfaces are identified with |
|
848 * an interface ID that is a UUID as in DCE and a pointer to the interface object is |
|
849 * returned if it is supported. Otherwise the returned pointer is NULL. |
|
850 * @param aType |
|
851 * @param aProtocolCommand |
|
852 * @exception not_supported |
|
853 * leaves if the specified interface id is not supported. |
|
854 **/ |
|
855 virtual TInt GetProtocolInterfaceL(TVtConfigType aType, MVtProtocolCommand*& aProtocolCommand) = 0; |
|
856 |
|
857 /** |
|
858 * This APIis to be used to release an interface that was previously obtained using |
|
859 * QueryInterfaceL. |
|
860 * @param aType |
|
861 * @param |
|
862 * @exception not_supported |
|
863 * leaves if the specified interface id is not supported. |
|
864 **/ |
|
865 virtual TInt DeleteProtocolInterfaceL(TVtConfigType aType, MVtProtocolCommand*) = 0; |
|
866 |
|
867 /** |
|
868 * Destructor. |
|
869 */ |
|
870 virtual ~MVtSessionCommand() {} |
|
871 }; |
|
872 |
|
873 class MVTUserInput |
|
874 { |
|
875 public: |
|
876 |
|
877 /** |
|
878 * @returns Returns the user input type. |
|
879 **/ |
|
880 virtual TUserInputType GetType() = 0; |
|
881 virtual ~MVTUserInput() {} |
|
882 }; |
|
883 |
|
884 class MVtH324ConfigCommand : public MVtProtocolCommand |
|
885 { |
|
886 public: |
|
887 |
|
888 /** |
|
889 * This API allows the user to specify observers for the 324m interface. |
|
890 * |
|
891 * @param aHandler the observer for command status and unsolicited informational events |
|
892 **/ |
|
893 virtual void SetObserverL(MVtProtocolHandler* aHandler) = 0; |
|
894 |
|
895 /** |
|
896 * Sets the vendor identification data. This does not cause the stack to issue a vendor identifiation request. |
|
897 * Set to NULL to disable sending vendor id. If set to a valid parameter before Connect, it will cause the stack |
|
898 * to automatically send it along with the TCS message. |
|
899 * @param cc |
|
900 * T35 Country code |
|
901 * @param ext |
|
902 * T35 Extension |
|
903 * @param mc |
|
904 * T35 Manufacturer code |
|
905 * @param aProduct |
|
906 * Product number |
|
907 * @param aVersion |
|
908 * Version number |
|
909 **/ |
|
910 virtual TInt SetVendorId(TUint8 cc, TUint8 ext, TUint32 mc, const TDesC8* aProduct, const TDesC8* aVersion) = 0; |
|
911 /** |
|
912 * This API allows the user to send a videoTemporalSpatialTradeOff command to the peer. |
|
913 * It is a request to the remote encoder to adjust its encoding in accordance with the tradeoff value. |
|
914 * A value of 0 indicates a high spatial resolution and a value of 31 indicates a high frame rate. |
|
915 * The values from 0 to 31 indicate monotonically a higher frame rate. Actual values do not correspond |
|
916 * to precise values of spatial resolution or frame rate. |
|
917 * |
|
918 **/ |
|
919 virtual TInt SendVideoTemporalSpatialTradeoffCommand(TUint aLogicalChannel, TUint8 aTradeoff)=0; |
|
920 |
|
921 /** |
|
922 * This API allows the user to send a videoTemporalSpatialTradeOff command to the peer. |
|
923 * It is an indication to the remote decoder that the local encoder has adjusted its encoding parameters |
|
924 * according to the tradeoff value. |
|
925 * A value of 0 indicates a high spatial resolution and a value of 31 indicates a high frame rate. |
|
926 * The values from 0 to 31 indicate monotonically a higher frame rate. Actual values do not correspond |
|
927 * to precise values of spatial resolution or frame rate. |
|
928 * |
|
929 **/ |
|
930 virtual TInt SendVideoTemporalSpatialTradeoffIndication(TUint aLogicalChannel, TUint8 aTradeoff)=0; |
|
931 |
|
932 /** |
|
933 * This API allows the user to specify the supported resolutions for video for transmit and receive. |
|
934 * |
|
935 **/ |
|
936 virtual TInt SetSupportedResolutions( ) = 0; |
|
937 |
|
938 /** |
|
939 * This API allows the user to set options for fast call setup procedures |
|
940 **/ |
|
941 |
|
942 virtual TInt SetFastCsupOptions( ) = 0; |
|
943 |
|
944 /** |
|
945 * Causes the protocol to send the specified user input to the remote terminal using |
|
946 * control channel. The user input can be either DTMF ot Alphanumeric |
|
947 * @param user_input A pointer to MVTUserInput |
|
948 * @returns A unique command id for asynchronous completion |
|
949 **/ |
|
950 virtual TInt SendUserInputMessageL(MVTUserInput& user_input) = 0; |
|
951 }; |
|
952 |
|
953 class MVtVideoConfigCommand : public MVtProtocolCommand |
|
954 { |
|
955 public: |
|
956 |
|
957 /** |
|
958 * This API allows the user to specify separate observers for the extension interface. |
|
959 * |
|
960 * @param aHandler the observer for unsolicited informational events |
|
961 **/ |
|
962 virtual void SetObserverL(MVtProtocolHandler* aHandler) = 0; |
|
963 |
|
964 /** |
|
965 * Sets the I-Frame refresh rate of the encoded output. |
|
966 * |
|
967 * @param aIFrameInterval I-Frame rate in seconds per I-Frame |
|
968 * @return True if successful, else false |
|
969 */ |
|
970 virtual TInt SetIntraFrameInterval(TUint32 aIFrameInterval) = 0; |
|
971 |
|
972 /** |
|
973 * Requests the encoder to encode the next frame as an I-Frame. If successful, the next encoded |
|
974 * frame will be an I-Frame. |
|
975 * |
|
976 * @return True for success, else false |
|
977 */ |
|
978 virtual TInt RequestNextIntraFrame() = 0; |
|
979 |
|
980 /** |
|
981 * Sets the frame rate of encoded output for the specified layer. |
|
982 * @param aFrameRate Frame rate for the specified layer in frames per second. |
|
983 * @return True if successful, else false. |
|
984 */ |
|
985 virtual TInt SetVideoFrameRate(TUint32 aFrameRate) = 0; |
|
986 }; |
|
987 |
|
988 class MVtAudioConfigCommand : public MVtProtocolCommand |
|
989 { |
|
990 public: |
|
991 |
|
992 /** |
|
993 * This API allows the user to specify observers for the 324m interface. |
|
994 * |
|
995 * @param aHandler |
|
996 **/ |
|
997 virtual void SetObserverL(MVtProtocolHandler* aHandler) = 0; |
|
998 |
|
999 /** |
|
1000 * Method to set the playback volume to the specified value. |
|
1001 * |
|
1002 * This is a pure virtual function that each derived class must implement. |
|
1003 * It is also an asynchronous function which will be answered with a callback. |
|
1004 * |
|
1005 * @param aNewVolume |
|
1006 * An input parameter to hold the value for the requested playback volume. |
|
1007 * |
|
1008 * @returns Returns a command ID that can be used to identify a command completion result with corresponding request. |
|
1009 */ |
|
1010 virtual TInt SetAudioVolumeL(TInt aVolume) = 0; |
|
1011 |
|
1012 /** |
|
1013 * Method to get the maximum valid value for the playback volume. |
|
1014 * |
|
1015 * This is a pure virtual function that each derived class must implement. |
|
1016 * It is also an asynchronous function which will be answered with a callback. |
|
1017 * |
|
1018 * @param aMaxVolume |
|
1019 * An output parameter to hold the value for the maximum valid playback volume. |
|
1020 * Note that the parameter should not be used until the callback indicates that the |
|
1021 * method has completed. |
|
1022 * |
|
1023 * @returns Returns a command ID that can be used to identify a command completion result with corresponding request. |
|
1024 */ |
|
1025 virtual TInt GetMaxAudioVolumeL(TInt& aMaxVolume) = 0; |
|
1026 }; |
|
1027 |
|
1028 class VTProtocolFactory |
|
1029 { |
|
1030 public: |
|
1031 |
|
1032 /** |
|
1033 * Create one instance. |
|
1034 */ |
|
1035 IMPORT_C static MVtSessionCommand* CreateSessionCommandL(MVtProtocolHandler* aProtocolHandler, TBool aEnableProxy, TVt3G324MSupported& a3G324MSupported); |
|
1036 |
|
1037 /** |
|
1038 * This function allows the application to delete an instance of a terminal |
|
1039 * and reclaim all allocated resources. A terminal should be deleted only in |
|
1040 * the EIdle state. An attempt to delete a terminal in any other state will |
|
1041 * result in unpredictable behavior. |
|
1042 * |
|
1043 * @param terminal the terminal to be deleted. |
|
1044 * |
|
1045 **/ |
|
1046 IMPORT_C static void DeleteSessionCommand( MVtSessionCommand* aSessionCommand ); |
|
1047 |
|
1048 /** |
|
1049 * Creates an instance of a DevSound audio data source. |
|
1050 * |
|
1051 * @param None |
|
1052 * |
|
1053 * @returns A pointer to the interface |
|
1054 **/ |
|
1055 IMPORT_C static MVTAudioSource* CreateAudioSource(); |
|
1056 |
|
1057 /** |
|
1058 * Deletes an instance of a DevSound audio data source |
|
1059 * that was previously created with CreateAudioSource(); |
|
1060 * |
|
1061 * @param aSource The audio data source to be deleted. |
|
1062 * |
|
1063 * @returns status |
|
1064 **/ |
|
1065 IMPORT_C static TInt DeletAudioSource(MVTAudioSource *aSource); |
|
1066 |
|
1067 /** |
|
1068 * Creates an instance of a DevSound audio data sink. |
|
1069 * |
|
1070 * @param None |
|
1071 * |
|
1072 * @returns A pointer to the interface |
|
1073 **/ |
|
1074 IMPORT_C static MVTAudioSink* CreateAudioSink(); |
|
1075 |
|
1076 /** |
|
1077 * Deletes an instance of a DevSound audio data sink |
|
1078 * that was previously created with CreateAudioSink(); |
|
1079 * |
|
1080 * @param The audio data sink to be deleted. |
|
1081 * |
|
1082 * @returns status |
|
1083 **/ |
|
1084 IMPORT_C static TInt DeleteAudioSink(MVTAudioSink *aSink); |
|
1085 |
|
1086 /** |
|
1087 * Creates an instance of a comm server of a particular name, to be used to |
|
1088 * initialize the terminal. |
|
1089 * |
|
1090 * |
|
1091 * @returns A pointer to a terminal or leaves if the type is invalid or the system is out of resources |
|
1092 **/ |
|
1093 IMPORT_C static MCommServer* CreateCommServerL(const TDesC & aName, TBool aEnableBitReversal=EFalse); |
|
1094 |
|
1095 /** |
|
1096 * This function allows the application to delete an instance of a comm server |
|
1097 * and reclaim all allocated resources. A comm server should be deleted only when the |
|
1098 * protocol is in the EIdle state. An attempt to delete a comm server in any other state |
|
1099 * could result in memory corruption within the protocol. This function will leave with |
|
1100 * KErrInUse if the comm server is still in use. However it will not check the state of the |
|
1101 * protocol that is using the comm server. |
|
1102 * |
|
1103 * @param aCommServer the comm server to be deleted. |
|
1104 * |
|
1105 * @returns a status code indicating success or failure |
|
1106 **/ |
|
1107 IMPORT_C static void DeleteCommServerL(MCommServer* aCommServer); |
|
1108 |
|
1109 /** |
|
1110 * Create instance. |
|
1111 * @param aUIITyep |
|
1112 * @param aTone |
|
1113 */ |
|
1114 IMPORT_C static MVTUserInput* CreateUserInputIndication(TUserInputType aUIIType, TUint8 aTone); |
|
1115 |
|
1116 /** |
|
1117 * Delete instance. |
|
1118 * @param aUII |
|
1119 */ |
|
1120 IMPORT_C static void DeleteUserInputIndication(MVTUserInput* aUII); |
|
1121 |
|
1122 /** |
|
1123 * |
|
1124 * @param aAudioSink |
|
1125 */ |
|
1126 IMPORT_C static MVtAudioConfigCommand* GetAudioConfigCommandL(MVTAudioSink* aAudioSink); |
|
1127 }; |
|
1128 |
|
1129 #endif |
|
1130 // End of File |
|
1131 |