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

MNRTSPClient.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_RTSP_CLIENT_H 00025 #define MN_RTSP_CLIENT_H 00026 00027 #include <stdio.h> 00028 00029 #include "MNSessionState.h" 00030 #include "RTSPClient.h" 00031 #include "MNList.h" 00032 #include "MNString.h" 00033 #include "MNValid.h" 00034 #include "TimeDefs.h" 00035 #include "GMUser.h" 00036 00037 class GUIPanel; 00038 class RTSPParserBase; 00039 class MNRTSPClient; 00040 class KomPlayer; 00041 class RTSPClientSocket; 00042 class MNSelector; 00043 class MNPipeNotifier; 00044 class MNSocketBase; 00045 class TimerCallBase; 00046 00047 /*********************************************************************** 00048 * MNRTSPClient 00049 ***********************************************************************/ 00050 00051 class MNRTSPClient 00052 : public RTSPClient 00053 , public GMUser 00054 { 00055 DECLARE_VALID 00056 00057 struct CurrentRequest 00058 { 00059 int cseq; 00060 u_short type; 00061 }; 00062 00063 private: 00064 MNSessionState _session_state; 00065 RTSPClientSocket* _socket; 00066 CurrentRequest _last_request; /* code for last request message sent */ 00067 00072 MNSelector& _selector; 00073 00074 int _multicastPort; 00075 bool _encrypt; 00076 00079 int _sessionsSetup; 00082 int _numSessions; 00085 MNString _setupUrl; 00086 00101 struct sockaddr_in* _client_interface_address; 00102 MNString _destination; 00103 bool _isRealServer; 00104 bool _isDarwinServer; 00105 bool _isJVCCamera; 00106 ParseTimeRange* _play_time; 00107 00108 // protected: 00109 // RTSPClientSocket* socket() const; 00110 // 00111 private: 00112 // void handle_options_request(void); 00113 // void handle_options_reply(int status, RTSPParserBase* base); 00114 // void handle_pause_reply(int status, RTSPParserBase* base); 00115 // void handle_getpara_reply(int status, RTSPParserBase* base); 00116 int handle_describe_reply( int status, RTSPParserBase* base ); 00117 void handle_setup_reply( int status, RTSPParserBase* base ); 00118 void handle_pause_reply( int status, RTSPParserBase* base ); 00119 void handle_teardown_reply( int status, RTSPParserBase* base); 00120 void handle_play_reply( int status, RTSPParserBase* base ); 00121 00130 virtual void init_stage_2( ) = 0; 00131 virtual void open_stage_2( ) = 0; 00132 virtual void play_stage_2( ) = 0; 00133 virtual void pause_stage_2( ) = 0; 00134 virtual void stop_stage_2( ) = 0; 00135 00147 virtual void init_stage_2_failed( const char* file, 00148 int line, 00149 const char* text ) = 0; 00150 virtual void open_stage_2_failed( const char* file, 00151 int line, 00152 const char* text ) = 0; 00153 virtual void play_stage_2_failed( const char* file, 00154 int line, 00155 const char* text ) = 0; 00156 virtual void pause_stage_2_failed( const char* file, 00157 int line, 00158 const char* text ) = 0; 00159 virtual void stop_stage_2_failed( const char* file, 00160 int line, 00161 const char* text ) = 0; 00162 00174 virtual void unknown_stage_2( const char* file, 00175 int line, 00176 const char* text ) = 0; 00177 00178 public: 00179 // KomPlayer* _interface; 00180 00181 MNRTSPClient( MNSelector& selector ); 00182 virtual ~MNRTSPClient ( ); 00183 00184 inline MNSelector& mainSelector( ) { 00185 return _selector; 00186 } 00187 00190 void insert( MNSocketBase* sock ); 00191 void remove( MNSocketBase* sock ); 00192 00198 void set_local_sockaddr( const struct sockaddr_in& addr ); 00199 00200 void send_options_request( const char* url ); 00204 void send_teardown_request( int idx, const MNString& url ); 00205 void send_describe_request( const MNString& url ); 00212 void send_setup_request( int rtpPort, const MNString& Url ); 00218 void send_play_request( int startpos, int endpos, const MNString& Url ); 00219 void send_pause_request( const MNString& url ); 00220 // void send_getpara_request(const MNString& parameter, const MNString& type, 00221 // MNString Url); 00222 private: 00223 bool private_parse_url( const char* url, 00224 MNString& server, 00225 u_short& port, 00226 MNString& file_name ); 00227 void private_store_last_request( int cseq, u_short req ); 00228 void send_play_range_request( char *range, const MNString& Url ); 00229 00230 virtual void handle_event(int seq, RTSPParserBase* base); 00231 // int getFreePort( int port ); 00232 // 00233 // /* funcions for Komplayer FSA */ 00234 protected: 00235 bool protected_connect( const char* url ); 00236 void protected_disconnect( ); 00237 00238 bool isConnected( ) const; 00239 bool isInitialized( ) const; 00240 bool isPlaying( ) const; 00241 // int getClientPort(); 00242 int getServerPort(); 00243 // u_short lastRequest( ); 00244 // void teardown( MNString Url ); 00245 // void pause( MNString Url ); 00246 // void stop( MNString Url ); 00247 // 00248 // bool connectedToServer() const; 00249 bool getMulticast() const; 00250 int getMulticastPort() const; 00251 bool getBandwidth() const; 00252 const char* getServerHostname() const; 00253 const char* getHostName(); 00254 00269 int getPlayTimeSeconds() const; 00270 00274 MDescPtr getMediaDesc() const; 00275 MDescPtr getMediaDesc(int i) const; 00276 00280 int getNumSessions() const; 00281 00282 protected: 00283 //some methods inherited from GMUser 00285 virtual const SDP::PayloadTypeTable* getPayloadTypes(int idx); 00287 virtual SDP::PayloadTypes getInternalPayloadType(int idx); 00289 virtual int getRTPPayloadType(int idx); 00290 00291 protected: 00299 bool setNotifyEnd( ); 00300 private: 00309 void notifyEndTimeout( void* data, TimerCallBase* self ); 00310 }; 00311 00312 #endif /* MN_RTSP_CLIENT_H */

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