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 #ifndef PVT_COMMON_H_INCLUDED 20 #define PVT_COMMON_H_INCLUDED 21 22 #ifndef OSCL_MEM_H_INCLUDED 23 #include "oscl_mem.h" 24 #endif 25 26 #ifndef OSCL_DEFALLOC_H_INCLUDED 27 #include "oscl_defalloc.h" 28 #endif 29 30 #ifndef OSCL_MEM_MEMPOOL_H_INCLUDED 31 #include "oscl_mem_mempool.h" 32 #endif 33 34 #ifndef OSCL_SHARED_PTR_H_INCLUDED 35 #include "oscl_shared_ptr.h" 36 #endif 37 38 #ifndef OSCL_STRING_CONTAINERS_H_INCLUDED 39 #include "oscl_string_containers.h" 40 #endif 41 42 #ifndef PVT_2WAY_BASIC_TYPES_H_INCLUDED 43 #include "pv_2way_basic_types.h" 44 #endif 45 46 #ifndef PVMF_FORMAT_TYPE_H_INCLUDED 47 #include "pvmf_format_type.h" 48 #endif 49 50 #ifndef PVMF_RETURN_CODES_H 51 #include "pvmf_return_codes.h" 52 #endif 53 54 #ifndef PVMF_VIDEO_H_INCLUDED 55 #include "pvmf_video.h" 56 #endif 57 58 #ifndef PVMF_TIMESTAMP_H_INCLUDED 59 #include "pvmf_timestamp.h" 60 #endif 61 62 #ifndef PV_INTERFACE_H 63 #include "pv_interface.h" 64 #endif 65 66 #ifndef PV_2WAY_H324M_TYPES_H_INCLUDED 67 #include "pv_2way_h324m_types.h" 68 #endif 69 70 #include "h245def.h" 71 72 #define REVERSE_DIR(dir) (TPVDirection)(PV_DIRECTION_BOTH-dir) 73 74 typedef int TPVStatusCode; 75 76 /** 77 * TPV2wayDirectionality Enum 78 * 79 * TPV2wayDirectionality enum is used to convey the directionality of a pv2way track 80 **/ 81 enum TPV2wayDirectionality 82 { 83 EPvtUnidirectional = 1, 84 EPvtBiDirectional 85 }; 86 87 88 typedef enum 89 { 90 PV_MUX_COMPONENT_MUX, 91 PV_MUX_COMPONENT_LOGICAL_CHANNEL, 92 } TPVMuxComponent; 93 94 /** 95 Enumeration of format types 96 **/ 97 typedef enum 98 { 99 PV_INVALID_CODEC_TYPE, 100 PV_AUD_TYPE_G723 = 1, 101 PV_AUD_TYPE_GSM, 102 PV_VID_TYPE_H263 = 20, 103 PV_VID_TYPE_MPEG4, 104 PV_VID_TYPE_H264, 105 PV_UI_BASIC_STRING = 40, 106 PV_UI_IA5_STRING, 107 PV_UI_GENERAL_STRING, 108 PV_UI_DTMF, 109 PV_CODEC_TYPE_NONE = 99 110 } PVCodecType_t; 111 112 typedef uint32 TPVChannelId; 113 #define CHANNEL_ID_UNKNOWN 0xFFFFFFFF 114 #define CHANNEL_ID_DEFAULT 0xFFFFFFFF 115 116 /*********************************/ 117 /* H324 System Definition Value */ 118 /*********************************/ 119 //#define OK 1 120 #define NG 0 121 #define ON 1 122 #define OFF 0 123 #define PVT_NOT_SET (-1) 124 125 const int KPVDefaultVideoBitRate = 42000; // bits/s 126 const int KPVDefaultFrameRate = 5; // frames/s 127 const int KPVDefaultIFrameInterval = 10000; // s 128 const int KPVDefaultIFrameRequestInterval = 10000; // s 129 130 131 typedef bool TPVRemoteTerminalType; /* same = true, other = false */ 132 133 enum TPVTerminalIdentifier 134 { 135 EPVT_NONE = 0, 136 EPVT_LOCAL = 1, 137 EPVT_REMOTE = 2, 138 EPVT_BOTH = 3, 139 EPVT_TERMINAL_IDENTIFIER_MAX = EPVT_BOTH + 1 140 }; 141 142 enum TPVDirectionality 143 { 144 EPVT_UNI_DIRECTIONAL = 1, 145 EPVT_BI_DIRECTIONAL 146 }; 147 148 enum TPVChannelSegmentableType 149 { 150 NONSEGMENTABLE = 0, 151 SEGMENTABLE 152 }; 153 154 155 typedef enum 156 { 157 EPVT_Failed = 0, 158 EPVT_Success, 159 EPVT_Pending, 160 161 EPVT_ErrorBusy = 0x03000000, 162 //Terminal busy 163 EPVT_ErrorNotImplemented, 164 //feature or command is not implemented. 165 EPVT_ErrorInvalidParameter, 166 //invalid parameter in the command 167 EPVT_ErrorInvalidCodecType, 168 // invalid codec type specified in the command 169 EPVT_ErrorInvalidState, 170 //command is not valid for the current authoring state. 171 EPVT_ErrorNoMemory, 172 //system dynamic memory error 173 EPVT_ErrorLocalCapability, 174 // We cant handle it 175 EPVT_ErrorRemoteCapability, 176 // the other terminal cant handle it 177 EPVT_ErrorRemoteRejected, 178 // The remote terminal rejected it 179 EPVT_Timeout, 180 // No response received from the remote terminal 181 EPVT_FailedToInitialize, 182 // The specified component failed to initialize properly 183 EPVT_FailedToSetup, 184 // Could not setup the specified components with the specified parameters 185 EPVT_FailedToNegotiate, 186 // Failed to negotiate a set of parameters with the remote terminal 187 EPVT_ErrorRemoteDisconnected 188 // remote terminal disconnected while establishing connection 189 } TPVTReturnStatus; 190 191 192 enum TPVSeverity 193 { 194 PVT_INFORMATIONAL = 0, 195 PVT_WARNING, 196 PVT_ERROR 197 }; 198 199 typedef enum 200 { 201 E_EP_LOW = 1, 202 E_EP_MEDIUM, 203 E_EP_HIGH 204 } ErrorProtectionLevel_t; 205 206 207 // Used to convey audio type down (App->324) 208 typedef enum 209 { 210 PV_AUD_TYPE_GSM_475 = 1, 211 PV_AUD_TYPE_GSM_515, 212 PV_AUD_TYPE_GSM_590, 213 PV_AUD_TYPE_GSM_670, 214 PV_AUD_TYPE_GSM_740, 215 PV_AUD_TYPE_GSM_795, 216 PV_AUD_TYPE_GSM_102, 217 PV_AUD_TYPE_GSM_122, 218 PV_AUD_TYPE_G723_53, 219 PV_AUD_TYPE_G723_63, 220 PV_AUD_TYPE_NONE = 99 221 } PVAudType_t; 222 223 224 const PVCodecType_t PV_VID_TYPE_NONE = PV_CODEC_TYPE_NONE ; 225 const PVCodecType_t PV_SIMPLE_AUD_TYPE_NONE = PV_CODEC_TYPE_NONE ; 226 227 typedef PVCodecType_t PVAudTypeSimple_t; 228 229 // Used to convey video type (up or down) 230 typedef PVCodecType_t PVVidType_t; 231 232 /** 233 CPVParam class 234 Base class for audio/video/mux parameters 235 **/ 236 class CPVParam 237 { 238 public: CPVParam()239 CPVParam() {} ~CPVParam()240 virtual ~CPVParam() {} 241 virtual CPVParam* Copy() = 0; 242 }; 243 244 class CPVMediaParam : public CPVParam 245 { 246 public: 247 OSCL_IMPORT_REF CPVMediaParam(PVCodecType_t aCodecType = PV_CODEC_TYPE_NONE); 248 virtual ~CPVMediaParam(); 249 virtual PV2WayMediaType GetMediaType() = 0; 250 OSCL_IMPORT_REF PVCodecType_t GetCodecType(); 251 private: 252 PVCodecType_t iCodecType; 253 }; 254 255 256 257 class CPVAudioParam : public CPVMediaParam 258 { 259 public: 260 OSCL_IMPORT_REF CPVParam* Copy(); 261 OSCL_IMPORT_REF PV2WayMediaType GetMediaType(); 262 protected: 263 CPVAudioParam(PVCodecType_t aCodecType = PV_CODEC_TYPE_NONE); 264 private: 265 }; 266 267 class CPVVideoParam : public CPVMediaParam 268 { 269 public: 270 OSCL_IMPORT_REF ~CPVVideoParam(); 271 272 OSCL_IMPORT_REF PV2WayMediaType GetMediaType(); 273 274 OSCL_IMPORT_REF CPVParam* Copy(); 275 276 OSCL_IMPORT_REF uint16 GetWidth(); 277 278 OSCL_IMPORT_REF uint16 GetHeight(); 279 protected: 280 CPVVideoParam(uint16 aWidth, uint16 aHeight, PVCodecType_t aCodecType = PV_CODEC_TYPE_NONE); 281 private: 282 uint16 iWidth; 283 uint16 iHeight; 284 }; 285 286 287 class CPVAMRAudioParam : public CPVAudioParam 288 { 289 public: 290 OSCL_IMPORT_REF CPVAMRAudioParam(); 291 OSCL_IMPORT_REF ~CPVAMRAudioParam(); 292 }; 293 294 class CPVG723AudioParam : public CPVAudioParam 295 { 296 public: 297 OSCL_IMPORT_REF CPVG723AudioParam(); 298 OSCL_IMPORT_REF ~CPVG723AudioParam(); 299 }; 300 301 class CPVH263VideoParam : public CPVVideoParam 302 { 303 public: 304 OSCL_IMPORT_REF CPVH263VideoParam(uint16 w, uint16 h); 305 OSCL_IMPORT_REF ~CPVH263VideoParam(); 306 }; 307 308 309 class CPVM4vVideoParam : public CPVVideoParam 310 { 311 public: 312 OSCL_IMPORT_REF CPVM4vVideoParam(uint16 w, uint16 h, uint16 sz, uint8 *cfg); 313 314 OSCL_IMPORT_REF ~CPVM4vVideoParam(); 315 316 OSCL_IMPORT_REF OsclAny Set(uint16 config_sz, uint8* cfg); 317 318 OSCL_IMPORT_REF uint16 GetDecoderConfigSize(); 319 320 OSCL_IMPORT_REF uint8 *GetDecoderConfig(); 321 322 OSCL_IMPORT_REF CPVParam* Copy(); 323 324 private: 325 uint16 iSz; 326 uint8 *iCfg; 327 }; 328 329 class CPVTrackInfo 330 { 331 public: ~CPVTrackInfo()332 virtual ~CPVTrackInfo() {} 333 virtual TPVDirection GetDirection() = 0; 334 virtual TPVChannelId GetChannelId() = 0; 335 virtual TPVDirectionality GetDirectionality() = 0; 336 virtual int GetNumSduSizes() = 0; 337 virtual int GetSduSize(int index = 0) = 0; 338 virtual int* GetSduSizes() = 0; 339 virtual CPVMediaParam* GetMediaParam() = 0; 340 virtual CPVTrackInfo* Copy() = 0; 341 // friend bool operator== (CPVTrackInfo &a, CPVTrackInfo &b); 342 }; 343 344 OSCL_IMPORT_REF bool operator==(CPVTrackInfo &a, CPVTrackInfo &b); 345 346 class CPvtMediaCapability 347 { 348 public: 349 CPvtMediaCapability(PVMFFormatType format_type, uint32 bitrate = 0, bool aMandatory = false) iFormatType(format_type)350 : iFormatType(format_type), iBitrate(bitrate), iMandatory(aMandatory) {} ~CPvtMediaCapability()351 virtual ~CPvtMediaCapability() {} GetFormatType()352 virtual PVMFFormatType GetFormatType()const 353 { 354 return iFormatType; 355 } GetBitrate()356 virtual uint32 GetBitrate()const 357 { 358 return iBitrate; 359 } IsMandatory()360 virtual bool IsMandatory() const 361 { 362 return iMandatory; 363 } 364 365 PVMFFormatType iFormatType; 366 uint32 iBitrate; 367 bool iMandatory; 368 }; 369 370 class CPvtAudioCapability : public CPvtMediaCapability 371 { 372 public: 373 CPvtAudioCapability(PVMFFormatType format_type, uint32 bitrate = 0, bool aMandatory = false) CPvtMediaCapability(format_type,bitrate,aMandatory)374 : CPvtMediaCapability(format_type, bitrate, aMandatory) {} ~CPvtAudioCapability()375 ~CPvtAudioCapability() {} 376 }; 377 378 #define PV2WAY_MAX_AMR_NB_BITRATE 12200 379 class CPvtAmrNbCapability : public CPvtAudioCapability 380 { 381 public: 382 CPvtAmrNbCapability(uint32 bitrate = 0) CPvtAudioCapability(PVMF_MIME_AMR_IF2,PV2WAY_MAX_AMR_NB_BITRATE,true)383 : CPvtAudioCapability(PVMF_MIME_AMR_IF2, PV2WAY_MAX_AMR_NB_BITRATE, true) 384 { 385 OSCL_UNUSED_ARG(bitrate); 386 OSCL_UNUSED_ARG(bitrate); 387 } 388 }; 389 390 391 class CPvtVideoCapability : public CPvtMediaCapability 392 { 393 public: 394 CPvtVideoCapability(PVMFFormatType format_type, uint32 bitrate = 0, bool aMandatory = false) CPvtMediaCapability(format_type,bitrate,aMandatory)395 : CPvtMediaCapability(format_type, bitrate, aMandatory) {} ~CPvtVideoCapability()396 virtual ~CPvtVideoCapability() { } GetFormatType()397 PVMFFormatType GetFormatType()const 398 { 399 return iFormatType; 400 } GetBitrate()401 uint32 GetBitrate()const 402 { 403 return iBitrate; 404 } 405 virtual PVMFVideoResolution* GetMaxResolution(uint32& frame_rate) = 0; 406 virtual void SetMaxResolution(uint32 width, uint32 height, uint32 frame_rate) = 0; 407 virtual uint16 Getfsi(uint8*& aDecoderConfig) = 0; 408 409 410 }; 411 412 class CPvtMpeg4Capability : public CPvtVideoCapability 413 { 414 public: CPvtVideoCapability(PVMF_MIME_M4V,bitrate,false)415 CPvtMpeg4Capability(uint32 bitrate = 0) : CPvtVideoCapability(PVMF_MIME_M4V, bitrate, false), iDecoderConfig(NULL) 416 { 417 iProfile = -1; 418 iLevel = -1; 419 iDecoderConfigLen = 0; 420 iVideoResolution = OSCL_NEW(PVMFVideoResolution, (0, 0)); 421 iGenericCapability = NULL; 422 iFrameRate = 0; 423 424 } ~CPvtMpeg4Capability()425 ~CPvtMpeg4Capability() 426 { 427 if (iDecoderConfig) 428 { 429 OSCL_DEFAULT_FREE(iDecoderConfig); 430 } 431 if (iVideoResolution) 432 { 433 OSCL_DELETE(iVideoResolution); 434 iVideoResolution = NULL; 435 } 436 } 437 SetMaxResolution(uint32 width,uint32 height,uint32 frame_rate)438 void SetMaxResolution(uint32 width, uint32 height, uint32 frame_rate) 439 { 440 iVideoResolution->width = (uint16)width; 441 iVideoResolution->height = (uint16)height; 442 iFrameRate = frame_rate; 443 } 444 GetMaxResolution(uint32 & frame_rate)445 PVMFVideoResolution* GetMaxResolution(uint32& frame_rate) 446 { 447 frame_rate = iFrameRate; 448 return iVideoResolution; 449 } 450 Getfsi(uint8 * & aDecoderConfig)451 uint16 Getfsi(uint8*& aDecoderConfig) 452 { 453 aDecoderConfig = iDecoderConfig; 454 return iDecoderConfigLen; 455 } 456 457 458 459 int32 iProfile; 460 int32 iLevel; 461 uint8* iDecoderConfig; 462 uint16 iDecoderConfigLen; 463 PS_GenericCapability iGenericCapability; 464 PVMFVideoResolution *iVideoResolution; 465 uint32 iFrameRate; 466 }; 467 468 class CPvtH263Capability : public CPvtVideoCapability 469 { 470 public: CPvtVideoCapability(PVMF_MIME_H2632000,bitrate,true)471 CPvtH263Capability(uint32 bitrate = 0) : CPvtVideoCapability(PVMF_MIME_H2632000, bitrate, true) 472 { 473 iVideoResolution = OSCL_NEW(PVMFVideoResolution, (0, 0)); 474 iH263VideoCapability = NULL; 475 iFrameRate = 0; 476 } ~CPvtH263Capability()477 ~CPvtH263Capability() 478 { 479 if (iVideoResolution) 480 OSCL_DELETE(iVideoResolution); 481 } 482 483 SetMaxResolution(uint32 width,uint32 height,uint32 frame_rate)484 void SetMaxResolution(uint32 width, uint32 height, uint32 frame_rate) 485 { 486 iVideoResolution->width = (uint16)width; 487 iVideoResolution->height = (uint16)height; 488 iFrameRate = frame_rate; 489 490 } 491 GetMaxResolution(uint32 & frame_rate)492 PVMFVideoResolution* GetMaxResolution(uint32& frame_rate) 493 { 494 495 frame_rate = iFrameRate; 496 return iVideoResolution; 497 } Getfsi(uint8 * & aDecoderConfig)498 uint16 Getfsi(uint8*& aDecoderConfig) 499 { 500 OSCL_UNUSED_ARG(aDecoderConfig); 501 return 0; 502 } 503 504 505 PVMFVideoResolution *iVideoResolution; 506 uint32 iFrameRate; 507 PS_H263VideoCapability iH263VideoCapability; 508 }; 509 510 511 class CPvtTerminalCapability 512 { 513 public: CPvtTerminalCapability(Oscl_Vector<CPvtMediaCapability *,OsclMemAllocator> & capability_items)514 CPvtTerminalCapability(Oscl_Vector<CPvtMediaCapability*, OsclMemAllocator>& capability_items): 515 iCapabilityItems(capability_items) 516 { 517 } ~CPvtTerminalCapability()518 ~CPvtTerminalCapability() 519 { 520 for (uint16 i = 0; i < iCapabilityItems.size(); i++) 521 OSCL_DELETE(iCapabilityItems[i]); 522 } GetNumCapabilityItems()523 uint16 GetNumCapabilityItems()const 524 { 525 return (uint16)iCapabilityItems.size(); 526 } GetCapabilityItem(uint16 index)527 CPvtMediaCapability* GetCapabilityItem(uint16 index) 528 { 529 return iCapabilityItems[index]; 530 } 531 private: 532 Oscl_Vector<CPvtMediaCapability*, OsclMemAllocator> iCapabilityItems; 533 }; 534 535 /** 536 CPVUserInput class 537 Base class for User Input mesages 538 **/ 539 class CPVUserInput 540 { 541 public: 542 /** 543 * Virtual destructor 544 **/ ~CPVUserInput()545 virtual ~CPVUserInput() {}; 546 /** 547 * Virtual function to return the user input type 548 **/ 549 virtual TPVUserInputType GetType() = 0; 550 551 /** 552 * Virtual function to return a copy of self 553 **/ 554 virtual CPVUserInput* Copy() = 0; 555 }; 556 class CPVUserInputDtmf : public HeapBase, public CPVUserInput 557 { 558 public: 559 OSCL_IMPORT_REF CPVUserInputDtmf(uint8 input, bool update, uint16 duration = 0); 560 561 OSCL_IMPORT_REF TPVUserInputType GetType(); 562 563 OSCL_IMPORT_REF uint8 GetInput(); 564 565 OSCL_IMPORT_REF bool IsUpdate(); 566 567 OSCL_IMPORT_REF uint16 GetDuration(); 568 569 OSCL_IMPORT_REF CPVUserInput* Copy(); 570 private: 571 uint8 iInput; 572 bool iIsUpdate; 573 uint16 iDuration; 574 }; 575 576 class CPVUserInputAlphanumeric : public HeapBase, public CPVUserInput 577 { 578 public: 579 OSCL_IMPORT_REF CPVUserInputAlphanumeric(uint8* input, uint16 len); 580 OSCL_IMPORT_REF ~CPVUserInputAlphanumeric(); 581 OSCL_IMPORT_REF TPVUserInputType GetType(); 582 OSCL_IMPORT_REF uint8* GetInput(); 583 OSCL_IMPORT_REF uint16 GetLength(); 584 OSCL_IMPORT_REF CPVUserInput* Copy(); 585 protected: 586 uint8* iInput; /* We own the memory*/ 587 uint16 iLength; /* length of the string */ 588 }; 589 590 591 typedef enum 592 { 593 EObjectIdentifier, 594 EH221NonStandard 595 } TPVH245VendorType; 596 597 class TPVH245Vendor 598 { 599 public: ~TPVH245Vendor()600 virtual ~TPVH245Vendor() {} 601 virtual TPVH245VendorType GetVendorType() = 0; 602 virtual TPVH245Vendor* Copy() = 0; 603 }; 604 605 class TPVH245VendorObjectIdentifier : public TPVH245Vendor 606 { 607 public: 608 OSCL_IMPORT_REF TPVH245VendorObjectIdentifier(uint8* vendor, uint16 vendorLength); 609 OSCL_IMPORT_REF ~TPVH245VendorObjectIdentifier(); 610 OSCL_IMPORT_REF TPVH245VendorType GetVendorType(); 611 OSCL_IMPORT_REF uint8* GetVendor(uint16* length); 612 OSCL_IMPORT_REF TPVH245Vendor* Copy(); 613 614 protected: 615 uint8* iVendor; 616 uint16 iVendorLength; 617 }; 618 619 class TPVVendorH221NonStandard : public TPVH245Vendor 620 { 621 public: 622 OSCL_IMPORT_REF TPVVendorH221NonStandard(uint8 t35countryCode, uint8 t35extension, uint32 manufacturerCode); 623 OSCL_IMPORT_REF ~TPVVendorH221NonStandard(); 624 OSCL_IMPORT_REF TPVH245VendorType GetVendorType(); 625 OSCL_IMPORT_REF TPVH245Vendor* Copy(); 626 OSCL_IMPORT_REF uint8 GetT35CountryCode(); 627 OSCL_IMPORT_REF uint8 GetT35Extension(); 628 OSCL_IMPORT_REF uint32 GetManufacturerCode(); 629 private: 630 uint8 iT35CountryCode; /* INTEGER (0..255) */ 631 uint8 iT35Extension; /* INTEGER (0..255) */ 632 uint32 iManufacturerCode; /* INTEGER (0..65535) */ 633 }; 634 635 // Vendor identification classes 636 class TPVVendorIdentification 637 { 638 public: 639 OSCL_IMPORT_REF TPVVendorIdentification(); 640 OSCL_IMPORT_REF TPVVendorIdentification(TPVH245Vendor* vendor, 641 uint8* pn, uint16 pn_len, 642 uint8* vn, uint16 vn_len); 643 OSCL_IMPORT_REF ~TPVVendorIdentification(); 644 TPVH245Vendor* iVendor; 645 uint8* iProductNumber; 646 uint16 iProductNumberLen; 647 uint8* iVersionNumber; 648 uint16 iVersionNumberLen; 649 }; 650 651 typedef uint16 TPVTerminalEvent; 652 653 typedef enum 654 { 655 H324_INITIALIZED, 656 H245_CE_STARTED, 657 H245_CE_RECEIVED, 658 H245_CE_COMPLETED, 659 H245_CE_ERROR, 660 H245_MSD_STARTED, 661 H245_MSD_RECEIVED, 662 H245_MSD_COMPLETED, 663 H245_MSD_ERROR, 664 H245_MT_STARTED, 665 H245_MT_RECEIVED, 666 H245_MT_SEND_COMPLETED, 667 H245_MT_ERROR, 668 H245_OLC_STARTED, 669 H245_OLC_RECEIVED, 670 H245_OLC_COMPLETED, 671 H245_OLC_ERROR, 672 H245_OBLC_STARTED, 673 H245_OBLC_RECEIVED, 674 H245_OBLC_COMPLETED, 675 H245_OBLC_ERROR, 676 H245_RTD_STARTED, 677 H245_RTD_RECEIVED, 678 H245_RTD_COMPLETED, 679 H245_RTD_ERROR, 680 H245_END_SESSION_STARTED, 681 H245_END_SESSION_RECEIVED, 682 683 SRP_TIMEOUT = H245_END_SESSION_RECEIVED + 20, 684 SRP_MAX_RETRIES, 685 SRP_CRC_ERROR, 686 AUDIO_ERROR_RATE 687 } TPVH324mEvent; 688 689 class CPvtDiagnosticIndication 690 { 691 public: 692 OSCL_IMPORT_REF CPvtDiagnosticIndication(TPVTerminalEvent aEvent, int aParam1, int aParam2, int aParam3) ; 693 694 OSCL_IMPORT_REF ~CPvtDiagnosticIndication(); 695 TPVTerminalEvent iEvent; 696 int iParam1; 697 int iParam2; 698 int iParam3; 699 }; 700 701 typedef int TPVLogLevel; 702 703 typedef enum 704 { 705 PV_START_LOG, 706 PV_STOP_LOG, 707 } TPVLogEvent; 708 709 typedef enum 710 { 711 LOG_NONE = 0x00000000, 712 LOG_ALL = 0xFFFFFFFF, 713 ENGINE_MODULE = 0x00000001, 714 TSC_MODULE = 0x00000002, 715 H223_MODULE = 0x00000004, 716 VID_DEC_MODULE = 0x00000020, 717 AUD_DEC_MODULE = 0x00000040, 718 VID_ENC_MODULE = 0x00000080, 719 AUD_ENC_MODULE = 0x00000100, 720 SYS_TOOLS_MODULE = 0x00000008, 721 H223_IN_BITSTREAM = 0x00000200, 722 H223_OUT_BITSTREAM = 0x00000400, 723 IN_CONTROL_BITSTREAM = 0x00000800, 724 OUT_CONTROL_BITSTREAM = 0x00001000, 725 IN_AUD_BISTREAM = 0x00002000, 726 OUT_AUD_BITSREAM = 0x00004000, 727 IN_VID_BITSTREAM = 0x00008000, 728 OUT_VID_BITSTREAM = 0x00010000 729 } TPVLogComponent; 730 731 #define PARAM_DEFAULT -1 732 typedef enum 733 { 734 MUX_GENERIC = 0, 735 MUX_H223, 736 MUX_RTP 737 } TPVMuxType; 738 739 class CPVGenericMuxParam : public CPVParam 740 { 741 public: 742 OSCL_IMPORT_REF CPVGenericMuxParam(TPVMuxType aType = MUX_GENERIC); 743 OSCL_IMPORT_REF TPVMuxType GetMuxType(); 744 OSCL_IMPORT_REF virtual CPVParam* Copy(); 745 OSCL_IMPORT_REF virtual OsclAny Copy(CPVGenericMuxParam* param); 746 747 int16 discard_corrupt_video; 748 uint32 max_discard_video_sdu_size; 749 uint32 err_rate_threshold_to_req_I_frame; 750 uint32 audio_err_rate_update_interval; 751 uint32 audio_encode_frame_delay; 752 uint32 audio_decode_frame_delay; 753 protected: 754 TPVMuxType iMuxType; 755 }; 756 757 #define MAX_H223_LEVELS 5 758 typedef enum 759 { 760 H223_LEVEL0 = 0, 761 H223_LEVEL1, 762 H223_LEVEL1_DF, /* Double flag */ 763 H223_LEVEL2, 764 H223_LEVEL2_OH, /* Optional header */ 765 H223_LEVEL3, 766 H223_LEVEL_UNKNOWN 767 } TPVH223Level; 768 769 typedef enum 770 { 771 H223_PDU_SIMPLE, /* Audio only, Video only, Control only */ 772 H223_PDU_COMBINED /* A+V */ 773 } TPVH223MuxPduType; 774 775 typedef enum 776 { 777 H223_IDLE_SYNC_NONE = 0, 778 H223_IDLE_SYNC_OCTET, /* Idle sync is a repeatition of a particular octet - 0, 1, F etc */ 779 H223_IDLE_SYNC_FLAGS /* Idle sync is a repeatition of flags of the current level */ 780 } TPVH223MuxIdleSyncType; 781 782 783 class CPVH223MuxParam : public CPVGenericMuxParam 784 { 785 public: 786 OSCL_IMPORT_REF CPVH223MuxParam(); 787 OSCL_IMPORT_REF ~CPVH223MuxParam(); 788 789 OSCL_IMPORT_REF CPVParam* Copy(); 790 int iBitrate; 791 TPVH223Level iLevel; 792 int16 iMaxAl1SduSize; 793 int16 iMaxAl2SduSize; 794 int16 iMaxAl3SduSize; 795 int16 iMaxAl1SduSizeR; 796 int16 iMaxAl2SduSizeR; 797 int16 iMaxAl3SduSizeR; 798 bool iParseOnResyncMarkers; 799 TPVH223MuxPduType iOutgoingPduType; /* The pdu type for outgoing packets. */ 800 int16 iMaxPduSize; /* Limits the max outgoing pdu size */ 801 TPVH223MuxIdleSyncType iIdleSyncType; 802 uint8 iIdleSyncByte; /* Specify when using H223_IDLE_SYNC_OCTET */ 803 protected: 804 }; 805 806 class CPVH245Param : public CPVParam 807 { 808 public: 809 OSCL_IMPORT_REF CPVH245Param(); 810 OSCL_IMPORT_REF CPVParam* Copy(); 811 }; 812 813 class CPVSrpParam : public CPVParam 814 { 815 public: 816 OSCL_IMPORT_REF CPVSrpParam(); 817 OSCL_IMPORT_REF CPVParam* Copy(); 818 }; 819 820 class CPVTerminalParam : public CPVParam 821 { 822 public: 823 OSCL_IMPORT_REF CPVTerminalParam(CPVGenericMuxParam* muxParam = NULL); 824 OSCL_IMPORT_REF CPVTerminalParam(CPVTerminalParam& that); 825 virtual ~CPVTerminalParam(); 826 virtual TPVTerminalType GetTerminalType() = 0; 827 OSCL_IMPORT_REF CPVParam* Copy(CPVTerminalParam* param); 828 OSCL_IMPORT_REF OsclAny SetMuxParam(CPVGenericMuxParam* muxParam); 829 OSCL_IMPORT_REF CPVGenericMuxParam* GetMuxParam(); 830 protected: 831 CPVGenericMuxParam* iMuxParam; 832 }; 833 834 /* MasterSlaveDetermination Decision */ 835 typedef enum 836 { 837 PVT_SLAVE = 0, 838 PVT_MSD_INDETERMINATE = 128, 839 PVT_MASTER = 255 840 } TPVMasterSlave; 841 842 typedef enum 843 { 844 PVT_AL1, 845 PVT_AL2, 846 PVT_AL3, 847 PVT_AL_UNKNOWN 848 } TPVAdaptationLayer; 849 850 OSCL_IMPORT_REF int IndexForAdaptationLayer(TPVAdaptationLayer al); 851 OSCL_IMPORT_REF TPVAdaptationLayer AdaptationLayerForIndex(int al_index); 852 OSCL_IMPORT_REF ErrorProtectionLevel_t EplForAdaptationLayer(TPVAdaptationLayer al); 853 854 class CPVH324MParam : public CPVTerminalParam 855 { 856 public: 857 OSCL_IMPORT_REF CPVH324MParam(CPVH223MuxParam* h223param = NULL); 858 OSCL_IMPORT_REF CPVH324MParam(const CPVH324MParam& that); 859 OSCL_IMPORT_REF ~CPVH324MParam(); 860 OSCL_IMPORT_REF TPVTerminalType GetTerminalType(); 861 OSCL_IMPORT_REF CPVParam* Copy(); 862 OSCL_IMPORT_REF OsclAny SetH223Param(CPVH223MuxParam* h223Param); 863 OSCL_IMPORT_REF CPVH223MuxParam* GetH223Param(); 864 OSCL_IMPORT_REF OsclAny SetSRPParam(CPVSrpParam* srpParam); 865 OSCL_IMPORT_REF OsclAny SetH245Param(CPVH245Param* h245Param); 866 867 bool iAllowAl1Video; /* Local terminal */ 868 bool iAllowAl2Video; /* Local terminal */ 869 bool iAllowAl3Video; /* (These are sent in outgoing CE) */ 870 /* The above flags determine if support for the layers will be indicate in the 871 TSC. The following determine if they will be used or not */ 872 bool iUseAl1Video; 873 bool iUseAl2Video; 874 bool iUseAl3Video; 875 TPVAdaptationLayer iVideoLayer; /* Layer to use, decided by local terminal */ 876 TPVAdaptationLayer iForceVideoLayerIfMaster; /* Force the terminal to use this layer - for testing purposes */ 877 TPVAdaptationLayer iForceVideoLayerIfSlave; /* Force the terminal to use this layer - for testing purposes */ 878 TPVMasterSlave iMasterSlave; 879 bool iSpecifyReceiveAndTransmitCapability; 880 bool iSendRme; /* Send Request Multiplex Entry to the remote terminal */ 881 bool iSkipMsd; /* 1 = Skip MSD */ 882 uint16 iRequestMaxMuxPduSize; /* Requests maxMuxPduSize to the remote terminal if > 0. This is done after TCS 883 if the remote terminal supports the maxMuxPduCapability */ 884 CPVH245Param* iH245Param; 885 CPVSrpParam* iSrpParam; 886 }; 887 888 class TPVVideoEncoderParam 889 { 890 public: 891 OSCL_IMPORT_REF TPVVideoEncoderParam(); 892 893 int video_bitrate; 894 PVCodecType_t codec; 895 int16 video_frame_rate; 896 int16 air; 897 int16 intra_refresh; 898 int16 data_partitioning; 899 int16 advanced; 900 int16 use_gov; 901 int16 rvlc; 902 int16 use_resync; 903 int16 use_hec; 904 int16 use_gobsync; 905 int16 vos; 906 int16 ref_frame_rate; 907 int16 orig_frameskip; 908 int16 chosen_frame_skip; 909 int16 qp; 910 int16 qpi; 911 int cam_low_light_mode; 912 int cam_saturation_level; 913 int cam_contrast_level; 914 int cam_edge_enhance; 915 int cam_brightness; 916 int deblocking_filter; 917 int prefilter; 918 int prefilter_coeff1; 919 int prefilter_coeff2; 920 int prefilter_coeff3; 921 int buffer_backlog; 922 int16 qp_max; 923 int16 qp_min; 924 int16 qp_delta_frame; 925 int16 qp_delta_slice; 926 int iframe_interval; 927 int iframe_request_interval; 928 929 public: 930 }; 931 932 typedef enum 933 { 934 PV_PANIC_ON_ERROR = 0x0001, 935 PV_RELEASE_ON_ERROR = 0x0002, 936 PV_RESYNC_ON_ERROR = 0x0003 937 } TPVGCErrorHandleMode; 938 939 class CPVTerminalStatistics 940 { 941 942 }; 943 944 class CPVH324TerminalStatistics : public CPVTerminalStatistics 945 { 946 947 }; 948 949 OSCL_IMPORT_REF PVMFFormatType PVCodecTypeToPVMFFormatType(PVCodecType_t aCodecType); 950 OSCL_IMPORT_REF PVCodecType_t PVMFFormatTypeToPVCodecType(PVMFFormatType aFormatType); 951 OSCL_IMPORT_REF PV2WayMediaType PVMFFormatTypeToPVMediaType(PVMFFormatType aFormatType); 952 953 #define min2(a, b) ((a > b) ? b : a) 954 955 #define __STR2__(x) #x 956 #define __STR1__(x) __STR2__(x) 957 #define __LOC__ __FILE__ "("__STR1__(__LINE__)") : Warning Msg: " 958 959 class BasicAlloc : public Oscl_DefAlloc 960 { 961 public: allocate(const uint32 size)962 void* allocate(const uint32 size) 963 { 964 void* tmp = (void*)OSCL_DEFAULT_MALLOC(size); 965 OSCL_ASSERT(tmp != 0); 966 return tmp; 967 } deallocate(void * p)968 void deallocate(void* p) 969 { 970 OSCL_DEFAULT_FREE(p); 971 } 972 }; 973 974 typedef enum 975 { 976 PV_H324COMPONENT_H245_USER, 977 PV_H324COMPONENT_H245, 978 PV_H324COMPONENT_SRP, 979 PV_H324COMPONENT_H223 980 } TPVH324Component; 981 982 const PVMFStatus PV2WayH324ErrorStatusStart = (-10600); 983 const PVMFStatus PV2WayH324ErrorSymmetryViolation = PV2WayH324ErrorStatusStart; 984 985 class CodecCapabilityInfo 986 { 987 public: 988 OSCL_IMPORT_REF CodecCapabilityInfo(); ~CodecCapabilityInfo()989 virtual ~CodecCapabilityInfo() {} 990 OSCL_IMPORT_REF virtual CodecCapabilityInfo* Copy(); 991 PVCodecType_t codec; 992 TPVDirection dir; 993 uint32 max_bitrate; 994 uint32 min_sample_size; 995 uint32 max_sample_size; 996 }; 997 998 class VideoCodecCapabilityInfo : public CodecCapabilityInfo 999 { 1000 public: 1001 OSCL_IMPORT_REF VideoCodecCapabilityInfo(); ~VideoCodecCapabilityInfo()1002 ~VideoCodecCapabilityInfo() 1003 { 1004 if (codec_specific_info) 1005 { 1006 OSCL_DEFAULT_FREE(codec_specific_info); 1007 } 1008 } 1009 OSCL_IMPORT_REF CodecCapabilityInfo* Copy(); 1010 Oscl_Vector<PVMFVideoResolutionRange, OsclMemAllocator> resolutions; 1011 uint8* codec_specific_info; 1012 uint16 codec_specific_info_len; 1013 }; 1014 1015 1016 typedef enum 1017 { 1018 APP, 1019 ENG 1020 } TPVPriority; 1021 1022 class FormatCapabilityInfo 1023 { 1024 public: FormatCapabilityInfo()1025 FormatCapabilityInfo() : id(CHANNEL_ID_UNKNOWN), 1026 format(PVMF_MIME_FORMAT_UNKNOWN), 1027 dir(PV_DIRECTION_NONE), 1028 bitrate(0), 1029 min_sample_size(0), 1030 max_sample_size(0), 1031 capabilities(1), 1032 fsi(NULL), fsi_len(0) {} FormatCapabilityInfo(PVMFFormatType aFormat,TPVDirection aDir,uint32 aCapabilities)1033 FormatCapabilityInfo(PVMFFormatType aFormat, 1034 TPVDirection aDir, 1035 uint32 aCapabilities) 1036 : format(aFormat), 1037 dir(aDir), 1038 bitrate(0), 1039 min_sample_size(0), 1040 max_sample_size(0), 1041 capabilities(aCapabilities), 1042 fsi(NULL), fsi_len(0) {} ~FormatCapabilityInfo()1043 ~FormatCapabilityInfo() 1044 { 1045 if (fsi) 1046 { 1047 OSCL_DEFAULT_FREE(fsi); 1048 fsi = NULL; 1049 } 1050 } 1051 TPVChannelId id; 1052 PVMFFormatType format; 1053 TPVDirection dir; 1054 uint32 bitrate; 1055 uint32 min_sample_size; 1056 uint32 max_sample_size; 1057 uint32 capabilities; // additional capabilities 1058 uint8* fsi; 1059 uint32 fsi_len; 1060 /* Enum for Priority */ 1061 TPVPriority iPriority; 1062 }; 1063 1064 class H324ChannelParameters 1065 { 1066 public: 1067 OSCL_IMPORT_REF H324ChannelParameters(TPVDirection dir, PVMFFormatType mediaType, unsigned bandwidth); 1068 OSCL_IMPORT_REF H324ChannelParameters(const H324ChannelParameters& that); 1069 OSCL_IMPORT_REF ~H324ChannelParameters(); 1070 OSCL_IMPORT_REF void SetCodecs(Oscl_Vector<FormatCapabilityInfo, OsclMemAllocator>& codecs); 1071 OSCL_IMPORT_REF Oscl_Vector<FormatCapabilityInfo, OsclMemAllocator>* GetCodecs(); 1072 1073 OSCL_IMPORT_REF PV2WayMediaType GetMediaType(); 1074 OSCL_IMPORT_REF unsigned GetBandwidth(); 1075 private: 1076 Oscl_Vector<FormatCapabilityInfo, OsclMemAllocator>* iCodecs; 1077 unsigned iBandwidth; 1078 }; 1079 1080 typedef enum 1081 { 1082 EH324Timer, 1083 EH324Counter 1084 } TPVH324TimerCounter; 1085 1086 1087 #define PVH324MLogicalChannelInfoUuid PVUuid(0x200306a0,0xffab,0x11d9,0xba,0x43,0x00,0x02,0xa5,0xd5,0xc5,0x1b) 1088 /* Base class for media logical channels */ 1089 class LogicalChannelInfo 1090 { 1091 public: ~LogicalChannelInfo()1092 virtual ~LogicalChannelInfo() {} 1093 1094 virtual TPVDirection GetDirection() = 0; 1095 1096 virtual TPVChannelId GetLogicalChannelNumber() = 0; 1097 1098 virtual uint32 GetSduSize() = 0; 1099 1100 virtual bool IsSegmentable() = 0; 1101 1102 virtual uint32 GetBitrate() = 0; 1103 1104 virtual uint32 GetSampleInterval() = 0; 1105 1106 virtual const uint8* GetFormatSpecificInfo(uint32* format_specific_info_len) = 0; 1107 1108 virtual PVMFTimestamp GetLastSduTimestamp() = 0; 1109 1110 virtual PVMFFormatType GetFormatType() = 0; 1111 1112 }; 1113 1114 #define PV_H324_MUX_INPUT_FORMATS "x-pvmf/multiplexed/input_formats" 1115 #define PV_H324_MUX_INPUT_FORMATS_VALTYPE "x-pvmf/multiplexed/formattype;valtype=int32" 1116 #define PV_H324_MUX_OUTPUT_FORMATS "x-pvmf/multiplexed/output_formats" 1117 #define PV_H324_MUX_OUTPUT_FORMATS_VALTYPE "x-pvmf/multiplexed/formattype;valtype=int32" 1118 1119 #define PV_H324_VIDEO_INPUT_FORMATS "x-pvmf/video/decode/input_formats" 1120 #define PV_H324_VIDEO_INPUT_FORMATS_VALTYPE "x-pvmf/video/decode/formattype;valtype=int32" 1121 #define PV_H324_AUDIO_INPUT_FORMATS "x-pvmf/audio/decode/input_formats" 1122 #define PV_H324_AUDIO_INPUT_FORMATS_VALTYPE "x-pvmf/audio/decode/formattype;valtype=int32" 1123 1124 #define PV_H324_VIDEO_OUTPUT_FORMATS "x-pvmf/video/encode/output_formats" 1125 #define PV_H324_VIDEO_OUTPUT_FORMATS_VALTYPE "x-pvmf/video/encode/formattype;valtype=int32" 1126 #define PV_H324_AUDIO_OUTPUT_FORMATS "x-pvmf/audio/encode/output_formats" 1127 #define PV_H324_AUDIO_OUTPUT_FORMATS_VALTYPE "x-pvmf/audio/encode/formattype;valtype=int32" 1128 1129 OSCL_IMPORT_REF const char* GetFormatsString(TPVDirection aDir, PV2WayMediaType aMediaType); 1130 OSCL_IMPORT_REF const char* GetFormatsValtypeString(TPVDirection aDir, PV2WayMediaType aMediaType); 1131 1132 template<class elementalClass> 1133 class Basic2WayDestructDealloc : public OsclDestructDealloc 1134 { 1135 public: destruct_and_dealloc(OsclAny * ptr)1136 virtual void destruct_and_dealloc(OsclAny *ptr) 1137 { 1138 OSCL_DEFAULT_FREE(ptr); 1139 } 1140 }; 1141 1142 OSCL_IMPORT_REF void GetSampleSize(PVMFFormatType aFormatType, uint32* aMin, uint32* aMax); 1143 1144 /** 1145 * CPV2WayM4VConfigInfo Class 1146 * 1147 * The CPV2WayM4VConfigInfo class contains configuration information for an M4V encoder. This information can be used to configure a encoded source or sink. 1148 **/ 1149 1150 class CPV2WayM4VConfigInfo 1151 { 1152 public: CPV2WayM4VConfigInfo()1153 CPV2WayM4VConfigInfo() : m4v_VOLHeaderSize(0), frameWidth(176), frameHeight(144), frameRate(5), profileLevelID(0) {}; 1154 CPV2WayM4VConfigInfo(OsclSharedPtr<uint8> am4v_VOLHeader,uint32 am4v_VOLHeaderSize,int aframeWidth,int aframeHeight,int aprofileLevelID,int aframeRate)1155 CPV2WayM4VConfigInfo(OsclSharedPtr<uint8> am4v_VOLHeader, 1156 uint32 am4v_VOLHeaderSize, 1157 int aframeWidth, 1158 int aframeHeight, 1159 int aprofileLevelID, 1160 int aframeRate) 1161 { 1162 m4v_VOLHeader.Bind(am4v_VOLHeader); 1163 m4v_VOLHeaderSize = am4v_VOLHeaderSize; 1164 frameWidth = aframeWidth; 1165 frameHeight = aframeHeight; 1166 profileLevelID = aprofileLevelID; 1167 frameRate = aframeRate; 1168 } 1169 1170 1171 CPV2WayM4VConfigInfo & operator=(const CPV2WayM4VConfigInfo& aInfo) 1172 { 1173 m4v_VOLHeader.Bind(aInfo.m4v_VOLHeader); 1174 m4v_VOLHeaderSize = aInfo.m4v_VOLHeaderSize; 1175 frameWidth = aInfo.frameWidth; 1176 frameHeight = aInfo.frameHeight; 1177 frameRate = aInfo.frameRate; 1178 profileLevelID = aInfo.profileLevelID; 1179 return *this; 1180 } 1181 1182 1183 OsclSharedPtr<uint8> m4v_VOLHeader; 1184 uint32 m4v_VOLHeaderSize; 1185 int frameWidth; 1186 int frameHeight; 1187 int frameRate; 1188 int profileLevelID; 1189 1190 }; 1191 1192 /** 1193 * CPV2WayH263ConfigInfo Class 1194 * 1195 * The CPV2WayH263ConfigInfo class contains configuration information for an H263 encoder. This information can be used to configure a encoded source or sink. 1196 **/ 1197 1198 class CPV2WayH263ConfigInfo 1199 { 1200 public: CPV2WayH263ConfigInfo()1201 CPV2WayH263ConfigInfo() : profile(0), level(10), frameWidth(176), frameHeight(144), frameRate(5) {}; 1202 1203 CPV2WayH263ConfigInfo & operator=(const CPV2WayH263ConfigInfo& aInfo) 1204 { 1205 profile = aInfo.profile; 1206 level = aInfo.level; 1207 frameWidth = aInfo.frameWidth; 1208 frameHeight = aInfo.frameHeight; 1209 frameRate = aInfo.frameRate; 1210 return *this; 1211 } 1212 1213 1214 int profile; 1215 int level; 1216 int frameWidth; 1217 int frameHeight; 1218 int frameRate; 1219 }; 1220 1221 1222 class OlcFormatInfo 1223 { 1224 public: OlcFormatInfo()1225 OlcFormatInfo() : iId(CHANNEL_ID_UNKNOWN), 1226 iCodec(PV_CODEC_TYPE_NONE), 1227 isSymmetric(true) {} 1228 TPVChannelId iId; 1229 PVCodecType_t iCodec; 1230 bool isSymmetric; 1231 }; 1232 1233 template < uint32 numchunk, uint32 chunksize = 0 > 1234 class PoolMemAlloc : public OsclMemPoolFixedChunkAllocator 1235 { 1236 public: PoolMemAlloc()1237 PoolMemAlloc(): OsclMemPoolFixedChunkAllocator(numchunk, chunksize) {} 1238 }; 1239 typedef PoolMemAlloc<10> PoolMemAlloc_OsclMemAllocator_10; 1240 1241 #define PORT_TYPE_FOR_DIRECTION(dir) ((dir == OUTGOING) ? EPVInputPort : EPVOutputPort) 1242 OSCL_IMPORT_REF PV2WayMediaType GetMediaType(PVCodecType_t codec); 1243 OSCL_IMPORT_REF void GetSampleSize(PVMFFormatType aFormatType, uint32* aMin, uint32* aMax); 1244 OSCL_IMPORT_REF bool CodecRequiresFsi(PVCodecType_t codec); 1245 1246 #endif 1247