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 #ifndef PVRTSP_ENGINE_NODE_EXTENSION_INTERFACE_H_INCLUDED 19 #define PVRTSP_ENGINE_NODE_EXTENSION_INTERFACE_H_INCLUDED 20 21 #ifndef PV_INTERFACE_H 22 #include "pv_interface.h" 23 #endif 24 25 #ifndef PVMF_RETURN_CODES_H_INCLUDED 26 #include "pvmf_return_codes.h" 27 #endif 28 29 #ifndef OSCL_STRING_H_INCLUDED 30 #include "oscl_string.h" 31 #endif 32 33 #ifndef OSCL_SOCKET_H_INCLUDED 34 #include "oscl_socket.h" 35 #endif 36 37 #ifndef PVMF_STREAMING_REAL_INTERFACES_INCLUDED 38 #include "pvmf_streaming_real_interfaces.h" 39 #endif 40 41 #ifndef PAYLOAD_PARSER_H_INCLUDED 42 #include "payload_parser.h" 43 #endif 44 45 #ifndef PVMF_EVENT_HANDLING_H_INCLUDED 46 #include "pvmf_event_handling.h" 47 #endif 48 49 #ifndef PVMF_SM_CONFIG_H_INCLUDED 50 #include "pvmf_sm_config.h" 51 #endif 52 53 // UUID for the extension interface 54 #define KPVRTSPEngineNodeExtensionUuid PVUuid(0x00000000,0x0000,0x4887,0xB1,0x0B,0x7E,0xE6,0x48,0x47,0xB2,0x05) 55 56 //Mimetypes for the custom interface 57 #define PVMF_RTSPENGINENODE_CUSTOM1_MIMETYPE "pvmf/RTSPEngineNode/Custom1" 58 #define PVMF_RTSPENGINENODE_MIMETYPE "pvmf/RTSPEngineNode" 59 #define PVMF_RTSPENGINENODE_BASEMIMETYPE "pvmf" 60 61 class SDPInfo; 62 63 struct RtspRangeType; 64 65 /** Enumerated list of port tags supported by this port */ 66 typedef enum 67 { 68 PVMF_RTSP_NODE_PORT_TYPE_INPUT, 69 PVMF_RTSP_NODE_PORT_TYPE_OUTPUT, 70 PVMF_RTSP_NODE_PORT_TYPE_INPUT_OUTPUT 71 } PVMFRTSPNodePortTag; 72 73 enum PVRTSPStreamingType 74 { 75 PVRTSP_3GPP_UDP, 76 PVRTSP_3GPP_TCP, 77 PVRTSP_RM_HTTP,//Real http cloaking 78 PVRTSP_MS_UDP, 79 PVRTSP_MS_TCP 80 }; 81 82 83 struct StreamInfo 84 { 85 int32 iSDPStreamId; 86 87 bool ssrcIsSet; 88 uint32 iSSRC; 89 90 uint32 iCliRTCPPort; 91 uint32 iCliRTPPort; 92 93 //As a default, RTCP packets are sent 94 //on the first available channel higher than the RTP channel. 95 //for UDP as transport, they are just the UDP port number 96 //for TCP as transport, they are the interleaved channel ID 97 uint32 iSerRTPPort; 98 uint32 iSerRTCPPort; 99 100 bool rtptimeIsSet; 101 uint32 rtptime; 102 103 bool seqIsSet; 104 uint32 seq; 105 106 bool b3gppAdaptationIsSet; 107 uint32 iBufSize; //bytes 108 uint32 iTargetTime; //ms 109 110 OsclNameString<PVNETWORKADDRESS_LEN> iSerIpAddr; 111 112 OSCL_HeapString<OsclMemAllocator> iMediaURI; 113 }; 114 115 class PVRTSPEngineNodeServerInfo 116 { 117 public: PVRTSPEngineNodeServerInfo()118 PVRTSPEngineNodeServerInfo() 119 { 120 iIsPVServer = false; 121 iRoundTripDelayInMS = 0; 122 iServerVersionNumber = 0; 123 } 124 ~PVRTSPEngineNodeServerInfo()125 virtual ~PVRTSPEngineNodeServerInfo() 126 { 127 }; 128 129 bool iIsPVServer; 130 uint32 iRoundTripDelayInMS; 131 OSCL_HeapString<OsclMemAllocator> iServerName; 132 uint32 iServerVersionNumber; 133 }; 134 135 #define PVRTSPENGINENODE_DEFAULT_KEEP_ALIVE_INTERVAL 55 136 #define PVRTSPENGINENODE_DEFAULT_RTSP_INACTIVITY_TIMER 15 137 #define PVRTSPENGINENODE_DEFAULT_NUMBER_OF_REDIRECT_TRIALS 1 138 139 //Forward Declarations 140 class PVMFPortInterface; 141 142 class PVRTSPEngineNodeExtensionInterface : public PVInterface 143 { 144 public: ~PVRTSPEngineNodeExtensionInterface()145 virtual ~PVRTSPEngineNodeExtensionInterface() {} 146 //**********begin PVInterface 147 OSCL_IMPORT_REF virtual void addRef() = 0; 148 OSCL_IMPORT_REF virtual void removeRef() = 0; 149 OSCL_IMPORT_REF virtual bool queryInterface(const PVUuid& uuid, PVInterface*& iface) = 0; 150 //**********end PVInterface 151 152 OSCL_IMPORT_REF virtual PVMFStatus SetStreamingType(PVRTSPStreamingType aType = PVRTSP_3GPP_UDP) = 0; 153 154 //Either SetSessionURL() or SetSDPInfo() must be called before Init() 155 OSCL_IMPORT_REF virtual PVMFStatus SetSessionURL(OSCL_wString& aURL) = 0; 156 OSCL_IMPORT_REF virtual PVMFStatus GetSDP(OsclRefCounterMemFrag& aSDPBuf) = 0; 157 158 OSCL_IMPORT_REF virtual PVMFStatus SetRtspProxy(OSCL_String& aRtspProxyName, uint32 aRtspProxyPort) = 0; 159 OSCL_IMPORT_REF virtual PVMFStatus GetRtspProxy(OSCL_String& aRtspProxyName, uint32& aRtspProxyPort) = 0; 160 161 // to be called before init 162 OSCL_IMPORT_REF virtual bool IsRdtTransport() = 0; 163 164 OSCL_IMPORT_REF virtual void SetPortRdtStreamId(PVMFPortInterface* pPort, 165 int iRdtStreamId) = 0; 166 167 OSCL_IMPORT_REF virtual PVMFStatus SetSDPInfo(OsclSharedPtr<SDPInfo>& aSDPinfo, Oscl_Vector<StreamInfo, OsclMemAllocator> &aSelectedStream) = 0; 168 OSCL_IMPORT_REF virtual PVMFStatus GetServerInfo(PVRTSPEngineNodeServerInfo& aServerInfo) = 0; 169 OSCL_IMPORT_REF virtual PVMFStatus GetStreamInfo(Oscl_Vector<StreamInfo, OsclMemAllocator> &aSelectedStream) = 0; 170 171 172 // API to pass in Real related parameters 173 OSCL_IMPORT_REF virtual void SetRealChallengeCalculator(IRealChallengeGen* pChallengeCalc) = 0; 174 OSCL_IMPORT_REF virtual void SetRdtParser(IPayloadParser* pRdtParser) = 0; 175 176 //One of these must be called before Start() 177 OSCL_IMPORT_REF virtual PVMFStatus SetRequestPlayRange(const RtspRangeType& aRange) = 0; 178 OSCL_IMPORT_REF virtual PVMFStatus GetActualPlayRange(RtspRangeType& aRange) = 0; 179 180 181 OSCL_IMPORT_REF virtual PVMFStatus GetUserAgent(OSCL_wString& aUserAgent) = 0; 182 183 OSCL_IMPORT_REF virtual PVMFStatus SetClientParameters(OSCL_wString& aUserAgent, 184 OSCL_wString& aUserNetwork, 185 OSCL_wString& aDeviceInfo) = 0; 186 187 OSCL_IMPORT_REF virtual PVMFStatus SetAuthenticationParameters(OSCL_wString& aUserID, 188 OSCL_wString& aAuthentication, 189 OSCL_wString& aExpiration, 190 OSCL_wString& aApplicationSpecificString, 191 OSCL_wString& aVerification, 192 OSCL_wString& aSignature) = 0; 193 //OSCL_IMPORT_REF virtual PVMFStatus SetTimeout(uint32 aTimeout)=0; 194 //OSCL_IMPORT_REF virtual PVMFStatus GetTimeout(uint32& aTimeout)=0; 195 196 /** 197 * This API is to set the keep-alive mechanism for rtsp client. 198 * 199 * @param aTimeout The interval in milliseconds of sending the RTSP keep-alive commands. 200 * 0 to use server defined timeout value. 201 * @param aUseSetParameter true to use SET_PARAMETER; false to use OPTIONS 202 * @param aKeepAliveInPlay Turns on/off the sending RTSP keep-alive commands during PLAY 203 * @returns Completion status 204 */ 205 //OSCL_IMPORT_REF virtual PVMFStatus SetKeepAliveMethod(int32 aTimeout=0, bool aUseSetParameter=false, bool aKeepAliveInPlay=false)=0; 206 OSCL_IMPORT_REF virtual PVMFStatus SetKeepAliveMethod_timeout(int32 aTimeout = 0) = 0; 207 OSCL_IMPORT_REF virtual PVMFStatus SetKeepAliveMethod_use_SET_PARAMETER(bool aUseSetParameter = false) = 0; 208 OSCL_IMPORT_REF virtual PVMFStatus SetKeepAliveMethod_keep_alive_in_play(bool aKeepAliveInPlay = false) = 0; 209 210 OSCL_IMPORT_REF virtual PVMFStatus GetKeepAliveMethod(int32 &aTimeout, bool &aUseSetParameter, bool &aKeepAliveInPlay) = 0; 211 212 /** 213 * This method is called to enable/disable X-STR http header to be a part of the HTTP GET or POST methods 214 * 215 * @param aAddXSTRHeader boolean which indicates whether to set the header to ON or OFF 216 * 217 */ 218 219 OSCL_IMPORT_REF virtual PVMFStatus GetRTSPTimeOut(int32 &aTimeout) = 0; 220 OSCL_IMPORT_REF virtual PVMFStatus SetRTSPTimeOut(int32 aTimeout) = 0; 221 OSCL_IMPORT_REF virtual void UpdateSessionCompletionStatus(bool aSessionCompleted) = 0; 222 }; 223 224 #endif //PVRTSP_ENGINE_NODE_EXTENSION_INTERFACE_H_INCLUDED 225 226