mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
整理代码
This commit is contained in:
parent
ddd3438fc3
commit
e695d76ce9
@ -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<SdpTrack> Ptr;
|
||||
using Ptr = std::shared_ptr<SdpTrack>;
|
||||
|
||||
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<SdpParser> Ptr;
|
||||
using Ptr = std::shared_ptr<SdpParser>;
|
||||
|
||||
SdpParser() {}
|
||||
SdpParser(const string &sdp) { load(sdp); }
|
||||
~SdpParser() {}
|
||||
|
||||
void load(const string &sdp);
|
||||
bool available() const;
|
||||
SdpTrack::Ptr getTrack(TrackType type) const;
|
||||
vector<SdpTrack::Ptr> getAvailableTrack() const;
|
||||
string toString() const ;
|
||||
string toString() const;
|
||||
|
||||
private:
|
||||
vector<SdpTrack::Ptr> _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<Sdp> Ptr;
|
||||
using Ptr = std::shared_ptr<Sdp>;
|
||||
|
||||
/**
|
||||
* 构造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<Socket::Ptr, Socket::Ptr> &pair, const string &local_ip);
|
||||
//十六进制方式打印ssrc
|
||||
string printSSRC(uint32_t ui32Ssrc);
|
||||
|
||||
} //namespace mediakit
|
||||
|
Loading…
Reference in New Issue
Block a user