diff --git a/src/Rtsp/Rtsp.h b/src/Rtsp/Rtsp.h index 605dfe4e..d9ba975d 100644 --- a/src/Rtsp/Rtsp.h +++ b/src/Rtsp/Rtsp.h @@ -166,32 +166,22 @@ public: uint32_t sample_rate; }; -Buffer::Ptr makeRtpOverTcpPrefix(uint16_t size, uint8_t interleaved); - -class RtpPayload{ +class RtpPayload { public: static int getClockRate(int pt); static TrackType getTrackType(int pt); static int getAudioChannel(int pt); static const char *getName(int pt); static CodecId getCodecId(int pt); + private: RtpPayload() = delete; ~RtpPayload() = delete; }; -class RtcpCounter { -public: - uint32_t pktCnt = 0; - uint32_t octCount = 0; - //网络字节序 - uint32_t timeStamp = 0; - uint32_t lastTimeStamp = 0; -}; - class SdpTrack { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; string _m; string _o; @@ -211,36 +201,40 @@ public: string toString() const; string getName() const; + public: int _pt; - string _codec; - int _samplerate; int _channel; + int _samplerate; + TrackType _type; + string _codec; string _fmtp; string _control; string _control_surffix; - TrackType _type; + public: - uint8_t _interleaved = 0; bool _inited = false; - uint32_t _ssrc = 0; + uint8_t _interleaved = 0; uint16_t _seq = 0; + uint32_t _ssrc = 0; //时间戳,单位毫秒 uint32_t _time_stamp = 0; }; class SdpParser { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; SdpParser() {} SdpParser(const string &sdp) { load(sdp); } ~SdpParser() {} + void load(const string &sdp); bool available() const; SdpTrack::Ptr getTrack(TrackType type) const; vector getAvailableTrack() const; - string toString() const ; + string toString() const; + private: vector _track_vec; }; @@ -250,16 +244,18 @@ private: */ class RtspUrl{ public: + bool _is_ssl; + uint16_t _port; string _url; string _user; string _passwd; string _host; - uint16_t _port; - bool _is_ssl; + public: RtspUrl() = default; ~RtspUrl() = default; bool parse(const string &url); + private: bool setup(bool,const string &, const string &, const string &); }; @@ -269,7 +265,7 @@ private: */ class Sdp : public CodecInfo{ public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; /** * 构造sdp @@ -304,6 +300,7 @@ public: uint32_t getSampleRate() const{ return _sample_rate; } + private: uint8_t _payload_type; uint32_t _sample_rate; @@ -357,7 +354,11 @@ private: _StrPrinter _printer; }; +//创建rtp over tcp4个字节的头 +Buffer::Ptr makeRtpOverTcpPrefix(uint16_t size, uint8_t interleaved); +//创建rtp-rtcp端口对 void makeSockPair(std::pair &pair, const string &local_ip); +//十六进制方式打印ssrc string printSSRC(uint32_t ui32Ssrc); } //namespace mediakit