1 /* ------------------------------------------------------------------ 2 * Copyright (C) 1998-2009 PacketVideo 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 * express or implied. 14 * See the License for the specific language governing permissions 15 * and limitations under the License. 16 * ------------------------------------------------------------------- 17 */ 18 /* 19 * ============================================================================== 20 * Name : pv_plugin_interfaces.h 21 * Part of : 22 * Interface : 23 * Description : Defines the general plugin interfaces for the PV engines 24 * Version : (see RELEASE field in copyright header above) 25 * 26 * ============================================================================== 27 */ 28 29 #ifndef PV_PLUGIN_INTERFACES_H_INCLUDED 30 #define PV_PLUGIN_INTERFACES_H_INCLUDED 31 32 33 // INCLUDES 34 #include "pv_common_symbian_types.h" 35 36 // CONSTANTS 37 /** 38 * MPVDataSourceBase Event categories 39 * 40 * These are the UIDs of the categories that should be returned via the MAsyncEventHandler 41 * interface for the async event callbacks. 42 **/ 43 const TInt KPVUidDataSrcPrime = 0xFFFFFF08; 44 const TInt KPVUidDataSrcPlay = 0xFFFFFF09; 45 const TInt KPVUidDataSrcPause = 0xFFFFFF0A; 46 const TInt KPVUidDataSrcStop = 0xFFFFFF0B; 47 48 /** 49 * MPVDataSourceBase Error Codes 50 * 51 * Any System Wide codes or PV defined error codes can be returned. If a new error code needs to 52 * be defined specific to this interface, it should be added here. 53 **/ 54 55 /** 56 * MPVDataSinkBase Event categories 57 * 58 * These are the UIDs of the categories that should be returned via the MAsyncEventHandler 59 * interface for the async event callbacks. 60 **/ 61 const TInt KPVUidDataSinkPrime = 0xFFFFFF0C; 62 const TInt KPVUidDataSinkPlay = 0xFFFFFF0D; 63 const TInt KPVUidDataSinkPause = 0xFFFFFF0E; 64 const TInt KPVUidDataSinkStop = 0xFFFFFF0F; 65 66 67 /** 68 * MPVDataSinkBase Error Codes 69 * 70 * Any System Wide codes or PV defined error codes can be returned. If a new error code needs to 71 * be defined specific to this interface, it should be added here. 72 **/ 73 74 /** 75 * Uid for MPVYuvFrameBuffer interface 76 */ 77 const TUid KPVUidYUVFrameBuffer = {0xFFFFFF0d}; 78 79 80 // MACROS 81 /** 82 * Uuid for Querying the MPVAudioInput interface 83 */ 84 #define KPVUidAudioInputInterface TPVUuid(0x194e8655,0x944c,0x402c,0xb0,0xc2,0xf7,0xbd,0xd5,0xe5,0x43,0x2f) 85 /** 86 * Uuid for Querying the MPVDevSoundAudioInput interface 87 */ 88 #define KPVUidDevSoundAudioInputInterface TPVUuid(0x9e2c416e,0x0299,0x4775,0x88,0xfa,0x42,0x53,0xbc,0xbc,0x58,0xbf) 89 /** 90 * Uuid for Querying the MPVAudioOutput interface 91 */ 92 #define KPVUidAudioOutputInterface TPVUuid(0xf5c5b825,0x90eb,0x4091,0xbe,0xea,0xa0,0xc3,0x9b,0xe2,0x00,0xaf) 93 /** 94 * Uuid for Querying the MPVDevSoundAudioInput interface 95 */ 96 #define KPVUidDevSoundAudioOutputInterface TPVUuid(0x48edb46a,0x60e4,0x4e83,0xb1,0xad,0x92,0xa8,0xd4,0x07,0x04,0x7a) 97 /** 98 * Uuid for Querying the MPVVideoInput interface 99 */ 100 #define KPVUidVideoInputInterface TPVUuid(0xfb320151,0x6d06,0x4bd5,0xa2,0x68,0x61,0x01,0xdb,0x25,0x1c,0x0e) 101 /** 102 * Uuid for Querying the MPVVideoOutput interface 103 */ 104 #define KPVUidVideoOutputInterface TPVUuid(0x0bb9d8a8,0x9623,0x4dec,0x84,0x0b,0xb9,0xf2,0x66,0xf8,0x4e,0x3d) 105 /** 106 * Uuid for Querying the Proxied version of any interface 107 */ 108 #define KPVUidProxiedInterface TPVUuid(0xf7076653,0x6088,0x47c6,0x88,0xc1,0xb7,0xed,0x28,0xe7,0x2b,0xea) 109 110 111 // DATA TYPES 112 113 114 // FUNCTION PROTOTYPES 115 116 117 // FORWARD DECLARATIONS 118 119 120 121 // CLASS DECLARATION 122 /** 123 * MPVPluginBase Class 124 * 125 * Base class for all supported plugins 126 **/ 127 class MPVPluginBase 128 { 129 public: ~MPVPluginBase()130 virtual ~MPVPluginBase() {} 131 132 /** 133 * This API returns multimedias type supported by the data source/sink - 134 * Audio, Video, Data etc. Each supported type is indicated by a MIME type structure. 135 * @return Multimedia types supported by the data source/sink. The reference 136 * is valid until the MPVPluginBase derived object is destroyed. 137 **/ 138 IMPORT_C virtual const RArray<TPVMIMEType *>& GetMultimediaTypesL() const = 0; 139 140 /** 141 * This API is to allow for extensibility of the plugin interface. 142 * It allows a caller to ask for all UUIDs associated with a particular MIME type. 143 * If interfaces of the requested MIME type are found within the plugin, they are added 144 * to the UUIDs array. 145 * 146 * Also added to the UUIDs array will be all interfaces which have the requested MIME 147 * type as a base MIME type. This functionality can be turned off. 148 * 149 * @param aMimeType The MIME type of the desired interfaces 150 * @param aUuids An array to hold the discovered UUIDs 151 * @param aExactUuidsOnly Turns on/off the retrival of UUIDs with aMimeType as a base type 152 **/ 153 IMPORT_C virtual void QueryUUID(const TPVMIMEType& aMimeType, RArray<TPVUuid>& aUuids, bool aExactUuidsOnly = false) = 0; 154 155 /** 156 * This API is to allow for extensibility of the plugin interface. 157 * It allows a caller to ask for an instance of a particular interface object to be returned. 158 * The mechanism is analogous to the COM IUnknown method. The interfaces are identified with 159 * an interface ID that is a UUID as in DCE and a pointer to the interface object is 160 * returned if it is supported. Otherwise the returned pointer is NULL. 161 * TBD: Define the UIID, InterfacePtr structures 162 * @param aUuid The UUID of the desired interface 163 * @param aInterfacePtr The output pointer to the desired interface 164 **/ 165 IMPORT_C virtual void QueryInterface(const TPVUuid& aUuid, TPVInterfacePtr& aInterfacePtr) = 0; 166 }; 167 168 //#define USE_MMF_DATA_PATH 1 169 170 #if defined USE_MMF_DATA_PATH 171 172 #define MPVDataSourceBase MDataSource 173 #define MPVDataSinkBase MDataSink 174 175 #else /* USE_MMF_DATA_PATH */ 176 177 // forward declaration 178 class MPVDataSinkBase; 179 180 /** 181 * MPVDataSourceBase Class 182 * 183 * Base class for data sources 184 **/ 185 class MPVDataSourceBase 186 { 187 public: MPVDataSourceBase(TUid aType)188 MPVDataSourceBase(TUid aType): iDataSourceType(aType) {} ~MPVDataSourceBase()189 virtual ~MPVDataSourceBase() {} 190 191 /** 192 * Method called by a MDataSink to request the data source to fill aBuffer with data. 193 * 194 * This is a pure virtual function that each derived class must implement. 195 * This method is used when a data source is passively waiting for requests from a consumer ie a data sink 196 * to fill a buffer. The data source must call the BufferFilledL member on aConsumer when it has filled 197 * the buffer with data - the data source can either make this callback synchronously or asynchronously. 198 * 199 * @param "aBuffer" 200 * The buffer that needs filling with data 201 * 202 * @param "aConsumer" 203 * The data sink that consumes the data. The data source needs this to make the BufferFilledL 204 * callback on aConsumer when the data source has completed filling the aBuffer. 205 * 206 * @param "aMediaId" 207 * This identifies the type of media eg audio or video and the stream id. 208 * This parameter is required in cases where the source can supply data 209 * of more than one media type and/or multiple strams of data eg a multimedia file 210 */ 211 virtual void FillBufferL(CMMFBuffer* aBuffer, MPVDataSinkBase* aConsumer, TMediaId /*aMediaId*/) = 0; 212 213 /** 214 * Method called by a data sink to pass back an emptied buffer to the source 215 * 216 * This is a pure virtual function that each derived class must implement. 217 * This method is used as the callback when the data source actively requests a consumer ie a data sink 218 * to empty a buffer by calling the data sinks EmptyBufferL. 219 * When the data source gets this callback it knows that the buffer has been emptied and can be reused 220 * 221 * @param "aBuffer" 222 * The buffer that has been emptied by a data sink and is now available for reuse 223 */ 224 virtual void BufferEmptiedL(CMMFBuffer* aBuffer) = 0; 225 226 /** 227 * Method to indicate whether the data source can create a buffer. 228 * 229 * This is a pure virtual function that each derived class must implement. 230 * 231 * @return ETrue if the data source can create a buffer else EFalse 232 */ 233 virtual TBool CanCreateSourceBuffer() = 0; 234 235 /** 236 * Returns a buffer created by the data source 237 * 238 * This is a pure virtual function that each derived class must implement. 239 * 240 * @param "aMediaId" 241 * This identifies the type of media eg audio or video and the stream id. 242 * This parameter is required in cases where the source can supply data 243 * of more than one media type and/or multiple strams of data eg a multimedia file 244 * 245 * @param "aReference" 246 * This must be written to by the method to indicate whether the created buffer is 247 * a 'reference' buffer. A 'reference' buffer is a buffer that is owned by the source 248 * and should be used in preference to the sink buffer provided the sink buffer 249 * is also not a reference buffer 250 * . 251 * @return The created buffer 252 */ CreateSourceBufferL(TMediaId,TBool &)253 virtual CMMFBuffer* CreateSourceBufferL(TMediaId /*aMediaId*/, TBool &/*aReference*/) 254 { 255 return NULL; 256 } 257 258 259 /** 260 * Returns a buffer created by the data source 261 * 262 * This is a virtual function that a derived class can implement. 263 * This can be used in preference to the above CreateSourceBufferL method in cases where 264 * the source buffer creation has a dependancy on the sink buffer 265 * 266 * @param "aMediaId" 267 * This identifies the type of media eg audio or video and the stream id. 268 * This parameter is required in cases where the source can supply data 269 * of more than one media type and/or multiple strams of data eg a multimedia file 270 * 271 * @param "aSinkBuffer" 272 * The sink buffer the nature of which may influence the creation of the source buffer 273 * 274 * @param "aReference" 275 * This must be written to by the method to indicate whether the created buffer is 276 * a 'reference' buffer. A 'reference' buffer is a buffer that is owned by the source 277 * and should be used in preference to the sink buffer provided the sink buffer is not a reference buffer 278 * . 279 * @return The created buffer 280 */ CreateSourceBufferL(TMediaId,CMMFBuffer &,TBool &)281 virtual CMMFBuffer* CreateSourceBufferL(TMediaId /*aMediaId*/, CMMFBuffer& /*aSinkBuffer*/, TBool &/*aReference*/) 282 { 283 return NULL; 284 } 285 286 287 /** 288 * Method to 'logon' the data source to the same thread that source will be supplying data in. 289 * 290 * This method may be required as the thread that the data source was created in is not always 291 * the same thread that the data transfer will take place in. Therefore any thread specific 292 * initialisation needs to be performed in the SourceThreadLogon rather than in the creation 293 * of the data source. 294 * 295 * This is a virtual function that a derrived data source can implement if any thread specific 296 * initialisation is required and/or the data source can create any asynchronous events. 297 * 298 * 299 * @param "aEventHandler" 300 * This is an MAsyncEventHandler to handle asynchronous events that occur during the 301 * transfer of multimedia data. The event handler must be in the same thread as the data transfer 302 * thread - hence the reason it is passed in the SourceThreadLogon as opposed to say the constructor. 303 * 304 * 305 * @return KErrNone if successful, otherwise a system wide error code. 306 */ SourceThreadLogon(MAsyncEventHandler &)307 virtual TInt SourceThreadLogon(MAsyncEventHandler& /*aEventHandler*/) 308 { 309 return KErrNone; 310 } 311 312 /** 313 * Method to 'logoff' the data source from the same thread that source supplies data in. 314 * 315 * This method may be required as the thread that the data source is deleted in may not be 316 * the same thread that the data transfer took place in. Therefore any thread specific 317 * releasing of resources needs to be performed in the SourceThreadLogoff rather than in the destructor 318 * 319 * This is a virtual function that a derrived data source can implement if any thread specific 320 * releasing of resources is required. 321 */ SourceThreadLogoff()322 virtual void SourceThreadLogoff() {}; 323 324 /** 325 * Method to 'prime' the data source 326 * 327 * This is a virtual function that a derrived data source can implement if 328 * any data source specific 'priming' is required 329 */ SourcePrimeL()330 virtual TInt SourcePrimeL() 331 { 332 return 0; 333 } 334 335 /** 336 * Method to 'play' the data source 337 * 338 * This is a virtual function that a derrived data source can implement if 339 * any data source specific action is required prior to 'playing'ie the start of data transfer 340 */ SourcePlayL()341 virtual TInt SourcePlayL() 342 { 343 return 0; 344 }; 345 346 /** 347 * Method to 'pause' the data source 348 * 349 * This is a virtual function that a derrived data source can implement if 350 * any data source specific action is required to 'pause' 351 */ SourcePauseL()352 virtual TInt SourcePauseL() 353 { 354 return 0; 355 }; 356 357 /** 358 * Method to 'stop' the data source 359 * 360 * This is a virtual function that a derrived data source can implement if 361 * any data source specific action is required to 'stop' 362 */ SourceStopL()363 virtual TInt SourceStopL() 364 { 365 return 0; 366 }; 367 private: 368 TUid iDataSourceType; 369 }; 370 371 372 /** 373 * MPVDataSourceBase Class 374 * 375 * Base class for data sinks 376 **/ 377 class MPVDataSinkBase 378 { 379 public: MPVDataSinkBase(TUid aType)380 MPVDataSinkBase(TUid aType): iDataSinkType(aType) {} ~MPVDataSinkBase()381 virtual ~MPVDataSinkBase() {} 382 383 /** 384 * Method called by a MDataSource to request the data sink to empty aBuffer of data. 385 * 386 * This is a pure virtual function that each derived class must implement. 387 * This method is used when a data sink is passively waiting for requests from a supplier ie a data source 388 * to empty a buffer. The data sink must call the BufferEmptiedL member on aSupplier when it has emptied 389 * the buffer of it's data - the data sink can either make this callback synchronously or asynchronously. 390 * 391 * @param "aBuffer" 392 * The full buffer that needs emptying of it's data 393 * 394 * @param "aSupplier" 395 * The data source that supplied the data. The data sink needs this to make the BufferEmptiedL 396 * callback on aSupplier to indicate to the data source that the data sink has finished with the buffer. 397 * 398 * @param "aMediaId" 399 * This identifies the type of media eg audio or video and the stream id. 400 * This parameter is required in cases where the source can supply data 401 * of more than one media type and/or multiple strams of data 402 */ 403 virtual void EmptyBufferL(CMMFBuffer* aBuffer, MPVDataSourceBase* aSupplier, TMediaId /*aMediaId*/) = 0; 404 405 /** 406 * Method called by a data source to pass back an filled buffer to the sink 407 * 408 * This is a pure virtual function that each derived class must implement. 409 * This method is used as the callback when the data sink actively requests a supplier ie a data source 410 * to fill a buffer by calling the data sources FillBufferL. 411 * When the data sink gets this callback it knows that the buffer has been filled and is ready to be emptied 412 * 413 * @param "aBuffer" 414 * The buffer that has been filled by a data source and is now available for processing 415 */ 416 virtual void BufferFilledL(CMMFBuffer* aBuffer) = 0; 417 418 /** 419 * Method to indicate whether the data sink can create a buffer. 420 * 421 * This is a pure virtual function that each derived class must implement. 422 * 423 * @return ETrue if the data sink can create a buffer else EFalse 424 */ 425 virtual TBool CanCreateSinkBuffer() = 0; 426 427 /** 428 * Returns a buffer created by the data sink 429 * 430 * This is a pure virtual function that each derived class must implement. 431 * 432 * @param "aMediaId" 433 * This identifies the type of media eg audio or video and the stream id. 434 * This parameter is required in cases where the source can supply data 435 * of more than one media type and/or multiple strams of data. 436 * 437 * @param "aReference" 438 * This must be written to by the method to indicate whether the created buffer is 439 * a 'reference' buffer. A 'reference' buffer is a buffer that is owned by the sink 440 * and should be used in preference to the source buffer provided the source buffer 441 * is also not a reference buffer. 442 * . 443 * @return The created buffer 444 */ CreateSinkBufferL(TMediaId,TBool &)445 virtual CMMFBuffer* CreateSinkBufferL(TMediaId /*aMediaId*/, TBool &/*aReference*/) 446 { 447 return NULL; 448 } 449 450 /** 451 * Method to 'logon' the data sink to the same thread that sink will be consuming data in. 452 * 453 * This method may be required as the thread that the data sink was created in is not always 454 * the same thread that the data transfer will take place in. Therefore any thread specific 455 * initialisation needs to be performed in the SinkThreadLogon rather than in the creation 456 * of the data sink. 457 * 458 * This is a virtual function that a derrived data sink can implement if any thread specific 459 * initialisation is required and/or the data sink can create any asynchronous events. 460 * 461 * 462 * @param "aEventHandler" 463 * This is an MAsyncEventHandler to handle asynchronous events that occur during the 464 * transfer of multimedia data. The event handler must be in the same thread as the data transfer 465 * thread - hence the reason it is passed in the SinkThreadLogon as opposed to say the constructor. 466 * 467 * 468 * @return KErrNone if successful, otherwise a system wide error code. 469 */ SinkThreadLogon(MAsyncEventHandler &)470 virtual TInt SinkThreadLogon(MAsyncEventHandler& /*aEventHandler*/) 471 { 472 return KErrNone; 473 }; 474 475 /** 476 * Method to 'logoff' the data sink from the same thread that sink consumes data in. 477 * 478 * This method may be required as the thread that the data sink is deleted in may not be 479 * the same thread that the data transfer took place in. Therefore any thread specific 480 * releasing of resources needs to be performed in the SinkThreadLogoff rather than in the destructor 481 * 482 * This is a virtual function that a derrived data sink can implement if any thread specific 483 * releasing of resources is required. 484 */ SinkThreadLogoff()485 virtual void SinkThreadLogoff() {}; 486 487 /** 488 * Method to 'prime' the data sink 489 * 490 * This is a virtual function that a derrived data sink can implement if 491 * any data sink specific 'priming' is required 492 */ SinkPrimeL()493 virtual TInt SinkPrimeL() 494 { 495 return 0; 496 }; 497 498 /** 499 * Method to 'play' the data sink 500 * 501 * This is a virtual function that a derrived data sink can implement if 502 * any data sink specific action is required prior to 'playing'ie the start of data transfer 503 */ SinkPlayL()504 virtual TInt SinkPlayL() 505 { 506 return 0; 507 }; 508 509 /** 510 * Method to 'pause' the data sink 511 * 512 * This is a virtual function that a derrived data sink can implement if 513 * any data sink specific action is required to 'pause' 514 */ SinkPauseL()515 virtual TInt SinkPauseL() 516 { 517 return 0; 518 }; 519 520 /** 521 * Method to 'stop' the data sink 522 * 523 * This is a virtual function that a derrived data sink can implement if 524 * any data sink specific action is required to 'stop' 525 */ SinkStopL()526 virtual TInt SinkStopL() 527 { 528 return 0; 529 }; 530 private: 531 TUid iDataSinkType; 532 }; 533 534 #endif 535 536 537 538 /** 539 * MPVDataSource Class 540 * 541 * PV extension to MDataSource that supports basic PV requirements like exposing 542 * capabilities, configuration interfaces etc 543 **/ 544 class MPVDataSource : public MPVPluginBase, public MPVDataSourceBase 545 { 546 public: MPVDataSource(TUid aSourceType)547 MPVDataSource(TUid aSourceType) : MPVDataSourceBase(aSourceType) {} ~MPVDataSource()548 virtual ~MPVDataSource() {} 549 }; 550 551 552 /** 553 * MPVDataSink Class 554 * 555 * PV extension to MDataSource that supports basic PV requirements like exposing 556 * capabilities, configuration interfaces etc 557 **/ 558 class MPVDataSink : public MPVPluginBase, public MPVDataSinkBase 559 { 560 public: MPVDataSink(TUid aSinkType)561 MPVDataSink(TUid aSinkType) : MPVDataSinkBase(aSinkType) {} ~MPVDataSink()562 virtual ~MPVDataSink() {} 563 }; 564 565 566 /** 567 * Supports the basic functionality of both PV Data Sources 568 * and Sinks. 569 */ 570 class MPVDataSourceAndSink : 571 public MPVPluginBase, 572 public MPVDataSourceBase, 573 public MPVDataSinkBase 574 { 575 public: MPVDataSourceAndSink(TUid aSourceType,TUid aSinkType)576 MPVDataSourceAndSink(TUid aSourceType, TUid aSinkType) : 577 MPVDataSourceBase(aSourceType), 578 MPVDataSinkBase(aSinkType) 579 {} ~MPVDataSourceAndSink()580 virtual ~MPVDataSourceAndSink() {} 581 }; 582 583 584 /** 585 * Supported interfaces for external data sinks and sources 586 * 587 * The following are additional interfaces that can be implemented by external data sources 588 * and sinks to allow the SDKs to access a richer set of configuration APIs. 589 **/ 590 591 592 /** 593 * MPVAudioInput Class 594 * 595 * MPVAudioInput cab be implemented by any audio data source that needs to work with 596 * PV SDKs. 597 **/ 598 class MPVAudioInput 599 { 600 public: 601 //To set data format using MIME string. 602 IMPORT_C virtual void SetFormatL(const TDesC8& aFormat, const TDesC8& aFmtSpecific, TInt &aMaxRequestSize) = 0; 603 604 //To set sample rate and number of channels using MIME string. 605 IMPORT_C virtual void SetConfigL(const TDesC8& aSampleRate 606 , const TDesC8& aChannels) = 0; 607 608 //To cancel current command. 609 IMPORT_C virtual void CancelCommand() = 0; 610 611 //To reset hardware. 612 IMPORT_C virtual TInt Reset() = 0; 613 }; 614 615 616 //Additional methods for DevSound audio source. 617 class MPVDevSoundAudioInput 618 { 619 public: 620 IMPORT_C virtual void SetPrioritySettings(const TMMFPrioritySettings &aSettings) = 0; 621 IMPORT_C virtual void SetInputFormatL(const TDesC8& aFormat, MPVDataSourceBase *) = 0; 622 IMPORT_C virtual TPVAudioOutputSwitch OutputSwitch() = 0; 623 IMPORT_C virtual TBool FillAmrBuffersToEnd() = 0; 624 }; 625 626 627 /** 628 * MPVAudioOutput Class 629 * 630 * MPVAudioOutput can be implemented by any audio data sink that needs to work with 631 * PV SDKs. 632 **/ 633 class MPVAudioOutput 634 { 635 public: 636 //To set data format using MIME string. 637 IMPORT_C virtual void SetFormatL(const TDesC8& aFormat) = 0; 638 //To set sample rate and number of channels using MIME string. 639 IMPORT_C virtual void SetConfigL(const TDesC8& aSampleRate 640 , const TDesC8& aChannels) = 0; 641 //To cancel current command. 642 IMPORT_C virtual void CancelCommand() = 0; 643 //To reset hardware. 644 IMPORT_C virtual TInt Reset() = 0; 645 }; 646 647 648 //Additional methods for DevSound audio sink. 649 class MPVDevSoundAudioOutput 650 { 651 public: 652 IMPORT_C virtual void SetPrioritySettings(const TMMFPrioritySettings &aSettings) = 0; 653 IMPORT_C virtual void ConcealErrorForNextBuffer() = 0; 654 IMPORT_C virtual void SetOutputFormatL(const TDesC8& aFormat, const TDesC8& aFmtSpecific, MPVDataSinkBase* aConsumer, TInt &aMaxRequestSize) = 0; 655 IMPORT_C virtual TPVAudioOutputSwitch OutputSwitch() = 0; 656 IMPORT_C virtual TBool FillAmrBuffersToEnd() = 0; 657 }; 658 659 660 /** 661 * MPVVideoInput Class 662 * 663 * MPVVideoInput can be implemented by any video data source that needs to work with 664 * PV SDKs. 665 **/ 666 class MPVVideoInput 667 { 668 public: 669 670 /** 671 * Set the video frame format. This must be from the list of supported formats. 672 * @param "aFormat" The mime string describing the video frame format. 673 * @exception Can leave with one of the system wide error codes 674 */ 675 IMPORT_C virtual void SetFormatL(const TDesC8& aFormat) = 0; 676 677 /** 678 * Set the video frame rate. This must be within the range of supported frame rates 679 * for the current frame size. 680 * @param "aFrameRate" The video frame rate to set. 681 * @exception Can leave with one of the system wide error codes 682 */ 683 IMPORT_C virtual void SetFrameRateL(TReal32 aFrameRate) = 0; 684 685 /** 686 * Set the video frame size 687 * @param "aSize" The video frame size, in pixels 688 * @exception Can leave with one of the system wide error codes 689 */ 690 IMPORT_C virtual void SetVideoFrameSizeL(const TSize& aSize) = 0; 691 692 /** 693 * Get the video frame size 694 * @param "aSize" The video frame size, in pixels 695 * @exception Can leave with one of the system wide error codes 696 */ 697 IMPORT_C virtual void GetVideoFrameSizeL(TSize& aSize) const = 0; 698 }; 699 700 701 /** 702 * MPVVideoOutput Class 703 * 704 * MPVVideoOutput can be implemented by any video data sink that needs to work with 705 * PV SDKs. 706 **/ 707 class MPVVideoOutput 708 { 709 public: 710 /** 711 * Set the video frame format. This must be from the list of supported formats. 712 * @param "aFormat" A mime string describing the video frame format. 713 * @exception Can leave with one of the system wide error codes 714 */ 715 IMPORT_C virtual void SetFormatL(const TDesC8& aFormat) = 0; 716 717 /** 718 * Set the video frame size 719 * @param "aSize" The video frame size, in pixels 720 * @exception Can leave with one of the system wide error codes 721 */ 722 IMPORT_C virtual void SetVideoFrameSizeL(const TSize& aSize) = 0; 723 724 /** 725 * Get the video frame size 726 * @param "aSize" The video frame size, in pixels 727 * @exception Can leave with one of the system wide error codes 728 */ 729 IMPORT_C virtual void GetVideoFrameSizeL(TSize& aSize) const = 0; 730 }; 731 732 733 typedef TAny* RPvCommServer; 734 735 /** 736 * MPVCommServerBase Class 737 * 738 * MPVCommServerBase is to be implemented by a server for COMM source and sink interfaces. 739 * It could be based on a serial comms interface in which case it aggregates a single comm 740 * source and sink. In the case of sockets it could support multiple sources and sinks 741 **/ 742 typedef MPVPluginBase MPVCommServerBase; 743 744 class MPVYuvFrameBuffer 745 { 746 public: ~MPVYuvFrameBuffer()747 virtual ~MPVYuvFrameBuffer() {} 748 virtual TSize GetFrameSize()const = 0; 749 }; 750 751 752 #define PV_YUV_BUFFER_DEF_WIDTH 176 753 #define PV_YUV_BUFFER_DEF_HEIGHT 144 754 class CPVMMFPointerBuffer : public CMMFDataBuffer, public MPVYuvFrameBuffer 755 { 756 public: NewL()757 static CPVMMFPointerBuffer* NewL() 758 { 759 CPVMMFPointerBuffer* buf = new(ELeave) CPVMMFPointerBuffer(); 760 return buf; 761 } ~CPVMMFPointerBuffer()762 ~CPVMMFPointerBuffer() 763 { 764 } Data()765 virtual TDes8& Data() 766 { 767 return iPtr; 768 } Data()769 virtual const TDesC8& Data() const 770 { 771 return iPtr; 772 } SetRequestSizeL(TInt aSize)773 virtual void SetRequestSizeL(TInt aSize) 774 { 775 (void)(aSize); 776 } BufferSize()777 virtual TUint BufferSize() const 778 { 779 return iPtr.Size(); 780 } SetData(TUint8 * aData,TInt aLength)781 void SetData(TUint8* aData, TInt aLength) 782 { 783 iPtr.Set(aData, aLength, aLength); 784 } 785 SetFrameSize(const TSize & size)786 void SetFrameSize(const TSize& size) 787 { 788 iFrameSize = size; 789 } 790 791 /* MPVYuvFrameBuffer virtuals */ GetFrameSize()792 virtual TSize GetFrameSize()const 793 { 794 return iFrameSize; 795 } 796 private: CPVMMFPointerBuffer()797 CPVMMFPointerBuffer() : CMMFDataBuffer(KPVUidYUVFrameBuffer), 798 iPtr(0, 0, 0), 799 iFrameSize(TSize(PV_YUV_BUFFER_DEF_WIDTH, PV_YUV_BUFFER_DEF_HEIGHT)) {}; 800 801 private: 802 TPtr8 iPtr; 803 TSize iFrameSize; 804 }; 805 #endif // 806 807 808