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

MNStreamer.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 MN_STREAMER_H 00025 #define MN_STREAMER_H 00026 00027 #include "MNString.h" 00028 #include "MNSocket.h" 00029 #include "MNValid.h" 00030 #include "dataPump.h" 00031 #include "sdp/PayloadTypes.h" 00032 #include "sdp/RetransTypes.h" 00033 #include "sdp/TransportTypes.h" 00034 00035 #include <vector> 00036 00037 class KomServer; 00038 00039 class FileStreamerGM; 00040 class SendBlockStreamerGM; 00041 class LCRTPFileRecorderGM; 00042 class LCRTPCachingReflectorGM; 00043 class RTPReflectorGM; 00044 class PatchGM; 00045 class MNUDPSocket; 00046 class SDPSessionDescription; 00047 class TranscodingGM; 00048 class ServerGM; 00049 class ClientSideReflectorGM; 00050 00051 class MNStreamer : public dataPump 00052 { 00053 DECLARE_VALID 00054 typedef std::vector<int> IntVector; 00055 typedef std::vector<int32_t*> BwVector; 00056 typedef std::vector<MNSocket*> SocketVector; 00057 typedef std::vector<SDP::PayloadTypes*> PayloadTypeVector; 00058 private: 00063 union GMChoice 00064 { 00065 ServerGM* all; 00066 ServerGM* fs; // default works for FileStreamerGM 00067 LCRTPFileRecorderGM* lcrecord; 00068 LCRTPCachingReflectorGM* lcreflect; 00069 RTPReflectorGM* reflect; 00070 PatchGM* patch; 00071 TranscodingGM* trans; // GM for Transcoding streams in realtime (hopefully) 00072 ClientSideReflectorGM* clientSideReflectorGM; 00073 }; 00074 00075 int _bandwidth; 00076 BwVector _bandwidth_vec; 00077 long _BytesPerSecond; 00078 GMChoice RTPServer; 00079 int _ClientPortDesired; 00080 IntVector _ClientPortDesiredVec; 00081 struct DescFile 00082 { 00083 bool _useLCRTP; 00084 00086 int _plannedPort; 00087 00089 bool _mc; 00090 00091 // SDP::PayloadTypes _payload; 00092 // SDP::PayloadTypes _payload_codec; 00093 PayloadTypeVector _payload_vec; 00094 PayloadTypeVector _payload_codec_vec; 00095 SDP::RetransTypes _retrans; 00096 00097 float _playtime; 00098 00099 DescFile( ) 00100 { 00101 _useLCRTP = false; 00102 _plannedPort = -1; 00103 _mc = false; 00104 //_payload = SDP::PT_DEFAULT; 00105 //_payload_codec = SDP::PT_DEFAULT; 00106 // _payload_vec = PayloadTypeVector(getSessionDescription()->getMediaDescriptionCount(), SDP::PT_DEFAULT); 00107 //_payload_codec_vec = PayloadTypeVector(getSessionDescription()->getMediaDescriptionCount(), SDP::PT_DEFAULT); 00108 _retrans = SDP::NONE; 00109 } 00110 }; 00111 00112 DescFile _d; 00113 00115 MNString _mcHost; 00116 00118 // int _mcPort; 00119 // MNSocket* _remote_up_main_rtp; 00120 //MNSocket* _remote_up_main_rtcp; 00121 SocketVector _remote_up_main_rtp_vec; 00122 SocketVector _remote_up_main_rtcp_vec; 00123 00125 bool _gleaning; 00126 00128 int _memThreshold; 00129 00131 int _bufferSize; 00132 00134 RTSP::TransportTypes _req_transport; 00135 00136 private: 00138 MNStreamer( const MNStreamer& ); 00139 00141 MNStreamer& operator=( const MNStreamer& ); 00142 00143 public: 00144 MNStreamer( MNSelector& sel, DataPumpResponse* resp ); 00145 00147 MNStreamer( MNSelector& sel, DataPumpResponse* resp, SDPSessionDescription* sdesc ); 00148 00149 virtual ~MNStreamer ( ); 00150 00151 int getBandwidth( const MNString& DescFileName ); 00152 int getBandwidth(int idx, const MNString& DescFileName); 00153 static bool check_time( const MNString& DescFileName, MNString& time ); 00154 // virtual int init ( KomServer* streamer, StreamingType type = StreamingFromFileToPort ); 00155 virtual int init ( KomServer* streamer, StreamingType type ); 00156 00173 virtual bool createUpstreamSocks( int idx, 00174 int& requested, 00175 RTPSockets::FactoryMode mode, 00176 RTSP::TransportTypes requested_transport = RTSP::RTP_AVP_UDP ); 00177 00196 virtual bool createDownstreamSocks( int idx, 00197 int& requested, 00198 RTPSockets::FactoryMode mode, 00199 RTSP::TransportTypes requested_transport = RTSP::RTP_AVP_UDP ); 00200 00205 virtual bool fillTransportString( int idx, MNString& out, bool mc ) const; 00206 00207 virtual int stream_start ( int idx, 00208 const MNString& filename, 00209 const MNString& DescFileName, 00210 const MNString& client, 00211 const MNString& server, 00212 int ClientPortAnnounced, 00213 int ServerPortAnnounced ); 00214 virtual void setupNewServerSideReflectorGM(int idx); 00215 virtual void setupExistingServerSideReflectorGM(int idx); 00216 virtual int play ( int start, int stop ); 00217 virtual int stop ( ); 00218 void detach(); 00219 virtual int pause ( ); 00220 virtual int jump ( int cont_time ); 00221 virtual void fileComplete( const char* filename, bool comp ); 00222 virtual long getFilePos(); 00223 00224 virtual void set_client_port( int a ) { _ClientPortDesired = a;} ; 00225 virtual void set_client_port( int idx, int a ) { _ClientPortDesiredVec[idx] = a;} ; 00226 00228 void examineSDP(); 00229 00238 /* 00239 virtual void setMulticastInformation( MNString server, 00240 MNSocket* main_rtp, 00241 MNSocket* main_rtcp ); 00242 */ 00243 virtual void setMulticastInformation( int idx, 00244 MNString server, 00245 MNSocket* main_rtp, 00246 MNSocket* main_rtcp ); 00247 virtual void setBufferInformation( int threshold, int size ); 00248 00249 virtual bool isPatchingCapable() const { return true; } 00250 00251 virtual void setNptSeek(int npt); 00252 virtual int getNptSeconds(); 00253 virtual void setRTPTimestamp(int idx, u_int32 rtptime); 00254 00255 00256 private: 00258 int private_open_file( int idx, const MNString& FileName ); 00259 }; 00260 00261 #endif /* MN_STREAMER_H */ 00262

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