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 // This Software is an original work of authorship of PacketVideo Corporation. 21 // Portions of the Software were developed in collaboration with NTT DoCoMo, 22 // Inc. or were derived from the public domain or materials licensed from 23 // third parties. Title and ownership, including all intellectual property 24 // rights in and to the Software shall remain with PacketVideo Corporation 25 // and NTT DoCoMo, Inc. 26 // 27 // ----------------------------------------------------------------------- 28 /*****************************************************************************/ 29 /* file name : tsc_capability.h */ 30 /* file contents : */ 31 /* draw : '96.10.09 */ 32 /*---------------------------------------------------------------------------*/ 33 /* amendment */ 34 /* Copyright (C) 1996 NTT DoCoMo */ 35 /*****************************************************************************/ 36 37 #ifndef TSCCAPABILILTY_H_INCLUDED 38 #define TSCCAPABILILTY_H_INCLUDED 39 40 41 #ifndef PVLOGGER_H_INCLUDED 42 #include "pvlogger.h" 43 #endif 44 45 #ifndef TSC_H_INCLUDED 46 #include "tsc.h" 47 #endif 48 49 #ifndef H245DEF_H_INCLUDED 50 #include "h245def.h" 51 #endif 52 53 #ifndef H245PRI_H_INCLUDED 54 #include "h245pri.h" 55 #endif 56 57 #ifndef TSC_CONSTANTS_H_INCLUDED 58 #include "tsc_constants.h" 59 #endif 60 61 62 class TSC_statemanager; 63 class TSC_component; 64 65 class TSC_capability 66 { 67 public: TSC_capability(TSC_statemanager & aTSCstatemanager)68 TSC_capability(TSC_statemanager& aTSCstatemanager) : 69 iTSCstatemanager(aTSCstatemanager), 70 iRemoteCapability(NULL) 71 { 72 iLogger = PVLogger::GetLoggerObject("3g324m.h245user"); 73 }; 74 75 ~TSC_capability(); 76 SetMembers(TSC_component * aTSCcomponent)77 void SetMembers(TSC_component* aTSCcomponent) 78 { 79 iTSCcomponent = aTSCcomponent; 80 } 81 void InitVarsSession(); 82 void InitVarsLocal(); 83 84 CPvtTerminalCapability* GetRemoteCapability(); 85 uint32 GetRemoteBitrate(PVCodecType_t codec_type); 86 void ResetCapability(); CreateNewCapability(Oscl_Vector<CPvtMediaCapability *,OsclMemAllocator> aCapabilityItems)87 void CreateNewCapability(Oscl_Vector<CPvtMediaCapability*, OsclMemAllocator> aCapabilityItems) 88 { 89 iRemoteCapability = new CPvtTerminalCapability(aCapabilityItems); 90 } 91 void ExtractTcsParameters(PS_VideoCapability apVideo, CPvtH263Capability *aMedia_capability); 92 void ExtractTcsParameters(PS_VideoCapability pVideo, CPvtMpeg4Capability *aMedia_capability); 93 void ParseTcsCapabilities(S_Capability &aCapability, Oscl_Vector<CPvtMediaCapability*, OsclMemAllocator> &aMedia_capability, uint32 userInputCapabilities, S_UserInputCapability *aUserInputCapability); 94 bool IsSegmentable(TPVDirection direction, PV2WayMediaType media_type); 95 96 PS_DataType GetOutgoingDataType(PVCodecType_t codecType, uint32 bitrate, uint16 csi_len, uint8* csi); 97 PS_H223LogicalChannelParameters GetOutgoingLcnParams(PV2WayMediaType media_type, 98 PS_AdaptationLayerType adaptation_layer); 99 PVMFStatus ValidateIncomingDataType(bool forRev, PS_DataType pDataType); 100 PVMFStatus ValidateIncomingH223LcnParams(PS_H223LogicalChannelParameters h223params, TPVDirection dir); 101 PVMFStatus ValidateForwardReverseParams(PS_ForwardReverseParam forRevParams, TPVDirection dir); 102 bool VerifyReverseParameters(PS_ForwardReverseParam forRevParams, 103 TSCObserver* aObserver, 104 PVMFStatus& status); 105 uint32 GetMaxBitrateForOutgoingChannel(PVCodecType_t codecType); 106 PS_DataType GetDataType(PVCodecType_t codecType, uint32 bitrate, const uint8* dci, uint16 dci_len); 107 uint16 GetSupportedCodecCapabilityInfo(TPVDirection dir, 108 PV2WayMediaType mediaType, 109 Oscl_Vector<CodecCapabilityInfo*, OsclMemAllocator>& cci); 110 bool HasSymmetryConstraint(Oscl_Vector<CodecCapabilityInfo*, OsclMemAllocator>& codec_list); 111 CodecCapabilityInfo* SelectOutgoingCodec(Oscl_Vector<CodecCapabilityInfo*, OsclMemAllocator>* remote_list, 112 Oscl_Vector<CodecCapabilityInfo*, OsclMemAllocator>* local_list); 113 CodecCapabilityInfo* SelectOutgoingCodec(Oscl_Vector<CodecCapabilityInfo*, OsclMemAllocator>* remote_list); 114 115 116 Oscl_Vector<PVMFVideoResolutionRange, OsclMemAllocator> GetResolutions(TPVDirection dir); 117 void SetVideoResolutions(TPVDirection dir, 118 Oscl_Vector<PVMFVideoResolutionRange, OsclMemAllocator>& resolutions); 119 120 121 private: 122 123 // ------------------------------------------------- 124 // Parameters extracted from incoming TCS (RAN-32K) 125 // ------------------------------------------------- 126 uint32 iTcsIn_H263_sqcifMPI; // Units 1/30 second 127 uint32 iTcsIn_H263_qcifMPI; // Units 1/30 second 128 uint32 iTcsIn_H263_cifMPI; // Units 1/30 second 129 uint32 iTcsIn_H263_4cifMPI; // Units 1/30 second 130 uint32 iTcsIn_H263_16cifMPI; // Units 1/30 second 131 132 133 /* Video resolutions */ 134 Oscl_Vector<PVMFVideoResolutionRange, OsclMemAllocator> iResolutionsRx; 135 Oscl_Vector<PVMFVideoResolutionRange, OsclMemAllocator> iResolutionsTx; 136 137 TSC_statemanager& iTSCstatemanager; 138 /* Capability of local and remote and mutual capabiliites */ 139 CPvtTerminalCapability* iRemoteCapability; 140 PVLogger* iLogger; 141 142 143 TSC_component* iTSCcomponent; 144 }; 145 146 #endif 147 148