mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Refactor code to split implementation to cpp
This commit is contained in:
parent
6f2b78f16a
commit
b3a0284db5
14 changed files with 363 additions and 110 deletions
|
@ -198,6 +198,71 @@ int SrsRtpHeader::nb_bytes()
|
|||
return kRtpHeaderFixedSize + cc * 4 + (extension ? (extension_length + 1) * 4 : 0);
|
||||
}
|
||||
|
||||
void SrsRtpHeader::set_marker(bool v)
|
||||
{
|
||||
marker = v;
|
||||
}
|
||||
|
||||
bool SrsRtpHeader::get_marker() const
|
||||
{
|
||||
return marker;
|
||||
}
|
||||
|
||||
void SrsRtpHeader::set_payload_type(uint8_t v)
|
||||
{
|
||||
payload_type = v;
|
||||
}
|
||||
|
||||
uint8_t SrsRtpHeader::get_payload_type() const
|
||||
{
|
||||
return payload_type;
|
||||
}
|
||||
|
||||
void SrsRtpHeader::set_sequence(uint16_t v)
|
||||
{
|
||||
sequence = v;
|
||||
}
|
||||
|
||||
uint16_t SrsRtpHeader::get_sequence() const
|
||||
{
|
||||
return sequence;
|
||||
}
|
||||
|
||||
void SrsRtpHeader::set_timestamp(int64_t v)
|
||||
{
|
||||
timestamp = (uint32_t)v;
|
||||
}
|
||||
|
||||
int64_t SrsRtpHeader::get_timestamp() const
|
||||
{
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
void SrsRtpHeader::set_ssrc(uint32_t v)
|
||||
{
|
||||
ssrc = v;
|
||||
}
|
||||
|
||||
uint32_t SrsRtpHeader::get_ssrc() const
|
||||
{
|
||||
return ssrc;
|
||||
}
|
||||
|
||||
void SrsRtpHeader::set_padding(bool v)
|
||||
{
|
||||
padding = v;
|
||||
}
|
||||
|
||||
void SrsRtpHeader::set_padding_length(uint8_t v)
|
||||
{
|
||||
padding_length = v;
|
||||
}
|
||||
|
||||
uint8_t SrsRtpHeader::get_padding_length() const
|
||||
{
|
||||
return padding_length;
|
||||
}
|
||||
|
||||
ISrsRtpPacketDecodeHandler::ISrsRtpPacketDecodeHandler()
|
||||
{
|
||||
}
|
||||
|
@ -285,6 +350,17 @@ SrsRtpFUAPayload2* SrsRtpPacket2::reuse_fua()
|
|||
return cache_fua;
|
||||
}
|
||||
|
||||
void SrsRtpPacket2::set_decode_handler(ISrsRtpPacketDecodeHandler* h)
|
||||
{
|
||||
decode_handler = h;
|
||||
}
|
||||
|
||||
void SrsRtpPacket2::set_original_bytes(char* buf, int nn_buf)
|
||||
{
|
||||
original_bytes = buf;
|
||||
nn_original_bytes = nn_buf;
|
||||
}
|
||||
|
||||
int SrsRtpPacket2::nb_bytes()
|
||||
{
|
||||
if (!cache_payload) {
|
||||
|
|
|
@ -78,19 +78,19 @@ public:
|
|||
virtual srs_error_t encode(SrsBuffer* buf);
|
||||
virtual int nb_bytes();
|
||||
public:
|
||||
inline void set_marker(bool v) { marker = v; }
|
||||
bool get_marker() const { return marker; }
|
||||
inline void set_payload_type(uint8_t v) { payload_type = v; }
|
||||
uint8_t get_payload_type() const { return payload_type; }
|
||||
inline void set_sequence(uint16_t v) { sequence = v; }
|
||||
uint16_t get_sequence() const { return sequence; }
|
||||
inline void set_timestamp(int64_t v) { timestamp = (uint32_t)v; }
|
||||
int64_t get_timestamp() const { return timestamp; }
|
||||
inline void set_ssrc(uint32_t v) { ssrc = v; }
|
||||
uint32_t get_ssrc() const { return ssrc; }
|
||||
inline void set_padding(bool v) { padding = v; }
|
||||
inline void set_padding_length(uint8_t v) { padding_length = v; }
|
||||
uint8_t get_padding_length() const { return padding_length; }
|
||||
void set_marker(bool v);
|
||||
bool get_marker() const;
|
||||
void set_payload_type(uint8_t v);
|
||||
uint8_t get_payload_type() const;
|
||||
void set_sequence(uint16_t v);
|
||||
uint16_t get_sequence() const;
|
||||
void set_timestamp(int64_t v);
|
||||
int64_t get_timestamp() const;
|
||||
void set_ssrc(uint32_t v);
|
||||
uint32_t get_ssrc() const;
|
||||
void set_padding(bool v);
|
||||
void set_padding_length(uint8_t v);
|
||||
uint8_t get_padding_length() const;
|
||||
};
|
||||
|
||||
class ISrsRtpPacketDecodeHandler
|
||||
|
@ -150,9 +150,9 @@ public:
|
|||
// Reuse the cached fua message as payload.
|
||||
SrsRtpFUAPayload2* reuse_fua();
|
||||
// Set the decode handler.
|
||||
void set_decode_handler(ISrsRtpPacketDecodeHandler* h) { decode_handler = h; }
|
||||
void set_decode_handler(ISrsRtpPacketDecodeHandler* h);
|
||||
// Set the original bytes.
|
||||
void set_original_bytes(char* buf, int nn_buf) { original_bytes = buf; nn_original_bytes = nn_buf; }
|
||||
void set_original_bytes(char* buf, int nn_buf);
|
||||
// interface ISrsEncoder
|
||||
public:
|
||||
virtual int nb_bytes();
|
||||
|
@ -304,6 +304,7 @@ public:
|
|||
SrsRtpH264Header& operator=(const SrsRtpH264Header& rhs);
|
||||
};
|
||||
|
||||
// TODO: FIXME: Merge it with shared message.
|
||||
class SrsRtpSharedPacket
|
||||
{
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue