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

MNRTPEncoderSH.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_RTP_ENCODER_STREAM_HANDLER_H 00025 #define MN_RTP_ENCODER_STREAM_HANDLER_H 00026 00027 #include <sys/types.h> 00028 #include <sys/time.h> 00029 00030 #include "SH.h" 00031 #include "SHEndpoint.h" 00032 #include "SHEndpointSpec.h" 00033 #include "MNTimerCall.h" 00034 #include "MNValid.h" 00035 #include "var_type.h" 00036 #include "MNRTPutildefs.h" 00037 #include "lcrtp/MNLCRTPdefs.h" 00038 #include "lcrtp/MNLCRTPLossList.h" 00039 #include "MNTFRCSend.h" 00040 #include "sdp/PayloadTypes.h" 00041 #include "sdp/PayloadTypeEntry.h" 00042 00043 class MNRTP; 00044 class MNUDPSocket; 00045 class MNRTPEncoderBase; 00046 class RetransBase; 00047 class MNRope; 00048 class MNRTPPacket; 00049 class MNStreamer; 00050 00051 #define RTP_NAME "LCTZ" 00052 #define TIMED_OUT 200 00053 #define PACK_SIZE 512 00054 00055 namespace SH 00056 { 00057 00058 class RTPEncoderSH; 00059 class RTPEncoderSinkEndpointSpec; 00060 class RTPEncoderSourceEndpointSpec; 00061 class RTPEncoderSinkEndpoint; 00062 class RTPEncoderSourceEndpoint; 00063 00068 class CBPointer : public TimerCall<RTPEncoderSH> 00069 { 00070 typedef void (RTPEncoderSH::*callback)( void* data, TimerCallBase* self ); 00071 int _idx; 00072 public: 00073 CBPointer( int idx, RTPEncoderSH* encSH, callback cb ); 00074 virtual ~CBPointer( ) { }; 00075 00076 int getIndex( ) { return _idx; } 00077 }; 00078 00079 /**********************************************************************/ 00080 /* RTPEncoderSinkEndpoint */ 00081 /**********************************************************************/ 00082 00086 class RTPEncoderSinkEndpoint 00087 : public SinkEndpoint 00088 { 00089 public: 00090 RTPEncoderSinkEndpoint( RTPEncoderSH* mySH ); 00091 virtual ~RTPEncoderSinkEndpoint( ); 00092 }; 00093 00094 /**********************************************************************/ 00095 /* RTPEncoderSourceEndpoint */ 00096 /**********************************************************************/ 00097 00101 class RTPEncoderSourceEndpoint 00102 : public SourceEndpoint 00103 { 00104 public: 00105 RTPEncoderSourceEndpoint( RTPEncoderSH* mySH ); 00106 virtual ~RTPEncoderSourceEndpoint( ); 00107 }; 00108 00109 /**********************************************************************/ 00110 /* RTPEncoderSH */ 00111 /**********************************************************************/ 00112 00113 class RTPEncoderSH 00114 : public Base 00115 { 00116 DECLARE_VALID 00117 00118 MNRTPEncoderBase* _codec; 00119 RetransBase* _retrans; 00120 // int _fd; 00121 CBPointer** _cbp; 00122 00125 MNTimer _timer; 00126 Timeval _last_playtime_packet; 00127 00131 SH_RC verify_codec( ); 00132 00134 SA_RTP_MAX_PACKET_SIZE _max_packet_size; 00135 00136 SA_RTP_RTP_PAYLOAD_TYPE _rtp_pt; // indicates RTP packet header pt 00137 SA_RTP_INT_PAYLOAD_TYPE _int_pt; // indicates true pt 00138 SA_RTP_INT_RETRANS_TYPE _int_rt; // indicates retransmission type 00139 00142 SA_ACTIVE_DELAY _delay; 00143 00152 SA_RTP_PLAYOUT_SCALE _playout_scale; 00153 SA_RTP_BANDWIDTH _bandwidth; 00154 SA_HAS_ORDERED_DATA _hasOrderedData; 00155 SA_RTP_SSRC _ssrc; 00156 SA_TCPF _tcpf; 00157 SA_CLIENT_MAX_BW _client_max_bw; 00158 00164 SA_LCRTP_REPEAT_TIMES _repeat_times_attr; 00165 00186 struct timeval _media_time; 00187 MNMutex _block_pull; 00188 bool _resync_required; 00189 00194 struct timeval _construction_time; 00195 00199 struct timeval _pause_time; 00200 00205 struct timeval _delta_paused; 00206 00207 /* Experimental for TFRC - MZ */ 00208 MNTFRCSend* _tfrc; 00209 MNMutex _tfrc_mutex; 00210 // int64 _help_packet; 00211 00214 MediaState _streamer_state; 00215 00216 struct timeval _timeneu; 00217 00218 /* for lcrtp */ 00219 MNMutex _send_mutex; 00220 Timeval _resend_timeout; 00221 ProtectedU_int32 _repeat_timeouts; 00222 bool _isEndReached; 00223 00224 void evalRTCPPacket( u_int32 ssrc, 00225 void* data, 00226 int len, 00227 int subtype, 00228 char* name, 00229 bool inCallback ); 00230 00231 // SH_RC push_decode( MNRope* data ); 00232 // SH_RC pull_encode( DataPtr& item, int cbindex ); 00233 SH_RC pull_encode( DataPtr& item ); 00234 00235 void set_retrans( ); 00236 // void send_end(); 00237 00238 public: 00239 RTPEncoderSH( SHGraphManager* mgr, 00240 u_int32_t runtimeId, 00241 MNSelector& sel ); 00242 00243 virtual ~RTPEncoderSH(); 00244 void send_end(); 00245 00246 private: 00247 00252 RTPEncoderSH( const RTPEncoderSH& ); 00253 00258 RTPEncoderSH& operator=( const RTPEncoderSH& ); 00259 00260 public: 00263 virtual SH_RC initSH(); 00266 virtual SH_RC uninitSH(); 00267 00270 virtual SH_RC startStreaming(); 00273 virtual SH_RC stopStreaming(); 00274 00275 // Attributes have been moved to SH.h 00276 00277 public: 00280 SH_RC pause( ); 00281 00282 bool isEndReached() const; 00283 void setEndIsReached(); 00284 00285 /******************************************************************/ 00286 /* functions required for Status */ 00287 /******************************************************************/ 00288 protected: 00289 friend class RTPEncoderSinkEndpoint; 00290 friend class RTPEncoderSourceEndpoint; 00291 00292 SinkEndpoint* _in_ep_a[1]; 00293 SourceEndpoint* _out_ep_a[1]; 00294 RTPEncoderSinkEndpoint _inEP; 00295 RTPEncoderSourceEndpoint _outEP; 00296 00297 void pushReport( ReportPtr report, Base::Direction d ); 00298 00299 public: 00300 virtual SinkEndpoint** getSinkSpecs(); 00301 virtual SourceEndpoint** getSourceSpecs(); 00302 00312 virtual bool isConnected() const; 00313 00316 void send_timer_callback( void* timer, TimerCallBase* ptr ); 00317 00320 void resend_timer_callback( void* timer, TimerCallBase* ptr ); 00321 00322 void notifyEndIsReached( void* timer, TimerCallBase* ptr); 00323 }; 00324 00326 00327 }; // namespace SH 00328 00329 #endif /* MN_RTP_ENCODER_STREAM_HANDLER_H */ 00330

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