Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

dataPump.h

Go to the documentation of this file.
00001 /* Copyright (C) 2000 KOM/Darmstadt University of Technology 00002 * 00003 * You are allowed to use all other parts of the code under the following terms: 00004 * 00005 * For non-commercial use, code may be used in unmodified form provided 00006 * that this copyright notice and this permission notice appear in 00007 * supporting documentation. 00008 * 00009 * This software is provided "as is" and without any express or implied 00010 * warranties, including, without limitation, the implied warranty of 00011 * fitness for a particular purpose. 00012 * 00013 * The code may be subjected to the GNU General Public License, Version 2, 00014 * and re-distributed under the terms of this license. 00015 * As a special exception, permission is granted to link this code 00016 * with the Qt library and distribute executables, as long as you 00017 * follow the requirements of the GNU GPL in regard to all of the 00018 * software in the executable aside from Qt. 00019 * 00020 * Commercial use other than under the terms of the GNU General Public 00021 * License is allowed only after express negotiation of conditions 00022 * with the authors. 00023 */ 00024 #ifndef DATA_PUMP_H 00025 #define DATA_PUMP_H 00026 00027 #include "mnstream.h" 00028 #include "MNString.h" 00029 #include "GMUser.h" // includes the base class GMUser 00030 #include "MNRTPSockets.h" // includes the base class GMUser 00031 #include "RTSPProxySession.h" 00032 #include "var_type.h" 00033 #include "sdp/TransportTypes.h" 00034 00035 #include <vector> 00036 00037 class KomServer; 00038 class SDPSessionDescription; 00039 00040 00041 enum StreamingType 00042 { 00043 StreamingFromFileToPort, 00044 StreamingFromFileToPortTuned, 00045 StreamingFromPortToPortAndFile, 00046 StreamingFromPortToPort, 00047 StreamingFromPortToPortDynReflection, 00048 StreamingFromPortToFile, 00049 PatchStreaming, 00052 PatchGleaning, 00056 NoStreaming 00057 }; 00058 00059 ostream& operator<<( ostream& ostr, StreamingType s ); 00060 00061 class DataPumpResponse 00062 { 00063 public: 00064 virtual int stream_started( int serverport ) = 0; 00065 virtual int formatswitching_suggested( int new_pt, long old_ssrc, long old_bytepos, 00066 long new_ssrc, long new_bytepos ) = 0; 00067 virtual void fileComplete( const char* filename, bool comp ) = 0; 00068 }; 00069 00070 class dataPump : public GMUser 00071 { 00072 MNSelector& _main_selector; 00073 SDPSessionDescription* _sdesc; 00074 00075 typedef std::vector<int> PortVector; 00076 typedef std::vector<MNSocket*> SocketVector; 00077 public: 00078 enum Server_Type 00079 { 00080 MN_SERVER, 00081 VC_SERVER 00082 }; 00083 00084 Server_Type _stype; 00085 DataPumpResponse* _resp; 00086 00087 protected: 00088 StreamingType _StreamingType; 00089 00103 //int _DistantPortDownstream; 00104 PortVector _DistantPortDownstream; 00105 00108 //int _DistantPortUpstream; 00109 PortVector _DistantPortUpstream; 00110 00111 /* Experimental for TFRC - MZ */ 00112 bool _tfrc; 00113 00115 int _client_bw; 00116 PortVector _client_bw_vec; // added 00117 00119 MNString _clientname; 00120 00121 MNString _url; 00122 00123 private: 00125 // MNSocket* _local_down_rtpsock; 00126 SocketVector _local_down_rtpsock_vec; 00127 00129 // MNSocket* _local_down_rtcpsock; 00130 SocketVector _local_down_rtcpsock_vec; 00131 00135 // MNSocket* _local_up_rtpsock; 00136 SocketVector _local_up_rtpsock_vec; 00137 00141 // MNSocket* _local_up_rtcpsock; 00142 SocketVector _local_up_rtcpsock_vec; 00143 00144 public: 00145 dataPump( MNSelector& sel, DataPumpResponse* resp, SDPSessionDescription* sdesc ); 00146 virtual ~dataPump ( ); 00147 00148 DataPumpResponse* responder ( ); 00149 00150 MNSelector& mainSelector( ); 00151 00152 // griff 31aug2001 00153 // THIS FUNCTION IS EVIL - IT IS THE REASON FOR LOTS 'N LOTS OF CORE DUMPS 00154 // virtual int getFreePort( int ); 00155 00156 virtual int init ( KomServer*, StreamingType type ) = 0; 00157 00158 void setUrl(MNString& url); 00159 00160 virtual void setNptSeek(int npt); 00161 virtual int getNptSeconds(); 00162 virtual void setRTPTimestamp(int idx, u_int32 rtptime); 00163 00185 virtual bool createUpstreamSocks(int idx, 00186 int& requested, 00187 RTPSockets::FactoryMode mode, 00188 RTSP::TransportTypes requested_transport = RTSP::RTP_AVP_UDP ) = 0; 00189 00190 00211 virtual bool createDownstreamSocks( int idx, 00212 int& requested, 00213 RTPSockets::FactoryMode mode, 00214 RTSP::TransportTypes requested_transport = RTSP::RTP_AVP_UDP ) = 0; 00215 00216 virtual int stream_start ( int idx, 00217 const MNString& filename, 00218 const MNString& DescFileName, 00219 const MNString& client, 00220 const MNString& server, 00221 int ClientPortAnnounced, 00222 int ServerPortAnnounced ) = 0; 00223 virtual void setupNewServerSideReflectorGM(int idx); 00224 virtual void setupExistingServerSideReflectorGM(int idx); 00225 virtual int play ( int start, int stop ) = 0; 00226 virtual int stop ( ) = 0; 00227 virtual int pause ( ); 00228 virtual int jump ( int startpos ); 00229 virtual void fileComplete( const char* filename, bool comp ); 00230 00235 virtual long getFilePos(); 00236 00237 // virtual int print_all_movies ( MNString& listofAssets ); 00238 00239 Server_Type getServerType ( ); 00240 void setServerType ( Server_Type stype ); 00241 00242 /* 00243 inline bool upStreamReady() const { 00244 return ( getLocalUpRtp() != NULL ); 00245 } 00246 */ 00247 00248 inline bool upStreamReady(int idx) const { 00249 return (getLocalUpRtp(idx) != NULL ); 00250 } 00251 00252 inline bool downStreamReady(int idx) const { 00253 return ( getLocalDownRtp(idx) != NULL ); 00254 } 00255 00256 virtual MNSocket* getLocalDownRtp(int idx ) const; 00257 virtual MNSocket* getLocalDownRtcp(int idx ) const; 00258 virtual MNSocket* getLocalUpRtp(int idx ) const; 00259 virtual MNSocket* getLocalUpRtcp(int idx ) const; 00260 00277 virtual bool fillTransportString( int idx, MNString& out, bool mc ) const = 0; 00278 00279 virtual void setLocalDownSocks( int idx, MNSocket* rtp, MNSocket* rtcp ); 00280 virtual void setLocalUpSocks( int idx, MNSocket* rtp, MNSocket* rtcp ); 00281 00282 virtual int getDistantPortDownstream(int idx ) const; 00283 virtual void setDistantPortDownstream( int idx, int ); 00284 virtual int getDistantPortUpstream( int idx) const; 00285 virtual void setDistantPortUpstream( int idx, int ); 00286 00287 virtual int getLocalPortDownstream(int idx ) const; 00288 virtual int getLocalPortUpstream(int idx ) const; 00289 00290 virtual StreamingType getStreamingType() const { 00291 return _StreamingType; 00292 } 00293 00294 virtual void set_client_port( int /*idx*/, int ) {}; 00295 00299 virtual long getCorrespondingSsrc( int payloadtype ); 00300 00320 virtual void addFmtSsrcMapping( SDPSessionDescription* sdesc ); 00321 00322 virtual void switchFormat() { }; 00323 00324 void setSessionDescription( SDPSessionDescription* desc ); 00325 SDPSessionDescription* getSessionDescription( ); 00326 00328 virtual const SDP::PayloadTypeTable* getPayloadTypes(); 00329 00330 virtual SDP::PayloadTypes getInternalPayloadType(); 00331 virtual int getRTPPayloadType(); 00332 virtual const SDP::PayloadTypeTable* getPayloadTypes(int idx); 00333 00334 virtual SDP::PayloadTypes getInternalPayloadType(int idx); 00335 virtual int getRTPPayloadType(int idx); 00336 virtual int getPlayTimeSeconds(); 00337 00344 virtual bool isPatchingCapable() const { 00345 return false; 00346 } 00347 00351 virtual void setMulticastInformation( MNString /*server*/, 00352 MNSocket* /*main_rtp*/, 00353 MNSocket* /*main_rtcp*/ ) 00354 { } 00355 00359 virtual void setBufferInformation( int /*threshold*/, 00360 int /*size*/ ) 00361 { } 00362 00367 static int getLegalEvenPortnum(); 00368 00369 private: 00370 unsigned _proxy_formatswitching : 1; 00371 00372 public: 00373 void setProxyFormatswitching( bool yesno ); 00374 bool getProxyFormatswitching( ) const; 00375 void setTCPfriendly( bool yesno ); 00376 void setClientHostname( MNString client ); 00377 bool getTCPfriendly( ) const; 00378 void setClientBandwidth( int client_bw); 00379 int getClientBandwidth( ) const; 00380 void setClientBandwidth( int idx, int client_bw); 00381 int getClientBandwidth( int idx ) const; 00382 }; 00383 00384 #endif /* DATA_PUMP_H */ 00385

Generated on Sun Mar 6 13:35:49 2005 for Komssys by doxygen 1.3.8