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