mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
for #742, refine the u_intxx_t to uintxx_t
This commit is contained in:
parent
011ac4f6a9
commit
b16ab038ce
49 changed files with 278 additions and 275 deletions
|
@ -136,8 +136,8 @@ int main(int argc, char** argv)
|
|||
}
|
||||
srs_human_trace("publish stream success");
|
||||
|
||||
u_int32_t timestamp = 0;
|
||||
u_int32_t time_delta = 45;
|
||||
uint32_t timestamp = 0;
|
||||
uint32_t time_delta = 45;
|
||||
// @remark, to decode the file.
|
||||
char* p = audio_raw;
|
||||
for (;p < audio_raw + file_size;) {
|
||||
|
|
|
@ -134,8 +134,8 @@ int main(int argc, char** argv)
|
|||
}
|
||||
srs_human_trace("publish stream success");
|
||||
|
||||
u_int32_t timestamp = 0;
|
||||
u_int32_t time_delta = 17;
|
||||
uint32_t timestamp = 0;
|
||||
uint32_t time_delta = 17;
|
||||
// @remark, to decode the file.
|
||||
char* p = audio_raw;
|
||||
for (;p < audio_raw + file_size;) {
|
||||
|
|
|
@ -38,7 +38,7 @@ int main(int argc, char** argv)
|
|||
int size;
|
||||
char type;
|
||||
char* data;
|
||||
u_int32_t timestamp;
|
||||
uint32_t timestamp;
|
||||
|
||||
// srs debug info.
|
||||
char srs_server_ip[128];
|
||||
|
|
|
@ -51,8 +51,8 @@ int main(int argc, char** argv)
|
|||
int size;
|
||||
char type;
|
||||
char* data;
|
||||
u_int32_t timestamp;
|
||||
u_int32_t basetime = 0;
|
||||
uint32_t timestamp;
|
||||
uint32_t basetime = 0;
|
||||
|
||||
// user options
|
||||
const char* rtmp_url = NULL;
|
||||
|
|
|
@ -189,7 +189,7 @@ int build_keyframes(srs_flv_t ic, srs_amf0_t *pname, srs_amf0_t* pdata, srs_amf0
|
|||
|
||||
// packet data
|
||||
char type;
|
||||
u_int32_t timestamp = 0;
|
||||
uint32_t timestamp = 0;
|
||||
char* data = NULL;
|
||||
int32_t size;
|
||||
int64_t offset = 0;
|
||||
|
@ -294,7 +294,7 @@ int do_inject_flv(srs_flv_t ic, srs_flv_t oc, srs_amf0_t amf0_name, srs_amf0_t a
|
|||
char header[13];
|
||||
// packet data
|
||||
char type;
|
||||
u_int32_t timestamp = 0;
|
||||
uint32_t timestamp = 0;
|
||||
char* data = NULL;
|
||||
int32_t size;
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ int parse_flv(srs_flv_t flv)
|
|||
char header[13];
|
||||
// packet data
|
||||
char type;
|
||||
u_int32_t timestamp = 0;
|
||||
uint32_t timestamp = 0;
|
||||
char* data = NULL;
|
||||
int32_t size;
|
||||
int64_t offset = 0;
|
||||
|
|
|
@ -183,7 +183,7 @@ int main(int argc, char** argv)
|
|||
// 5bits, 7.3.1 NAL unit syntax,
|
||||
// ISO_IEC_14496-10-AVC-2003.pdf, page 44.
|
||||
// 7: SPS, 8: PPS, 5: I Frame, 1: P Frame, 9: AUD, 6: SEI
|
||||
u_int8_t nut = (char)data[nb_start_code] & 0x1f;
|
||||
uint8_t nut = (char)data[nb_start_code] & 0x1f;
|
||||
srs_human_trace("sent packet: type=%s, time=%d, size=%d, fps=%.2f, b[%d]=%#x(%s)",
|
||||
srs_human_flv_tag_type2string(SRS_RTMP_TYPE_VIDEO), dts, size, fps, nb_start_code, (char)data[nb_start_code],
|
||||
(nut == 7? "SPS":(nut == 8? "PPS":(nut == 5? "I":(nut == 1? "P":(nut == 9? "AUD":(nut == 6? "SEI":"Unknown")))))));
|
||||
|
|
|
@ -40,8 +40,8 @@ int connect_oc(srs_rtmp_t ortmp);
|
|||
#define RE_PULSE_MS 300
|
||||
#define RE_PULSE_JITTER_MS 3000
|
||||
int64_t re_create();
|
||||
void re_update(int64_t re, int32_t starttime, u_int32_t time);
|
||||
void re_cleanup(int64_t re, int32_t starttime, u_int32_t time);
|
||||
void re_update(int64_t re, int32_t starttime, uint32_t time);
|
||||
void re_cleanup(int64_t re, int32_t starttime, uint32_t time);
|
||||
|
||||
int64_t tools_main_entrance_startup_time;
|
||||
int main(int argc, char** argv)
|
||||
|
@ -128,7 +128,7 @@ int main(int argc, char** argv)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int do_proxy(srs_flv_t flv, srs_rtmp_t ortmp, int64_t re, int32_t* pstarttime, u_int32_t* ptimestamp)
|
||||
int do_proxy(srs_flv_t flv, srs_rtmp_t ortmp, int64_t re, int32_t* pstarttime, uint32_t* ptimestamp)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
|
@ -160,7 +160,7 @@ int do_proxy(srs_flv_t flv, srs_rtmp_t ortmp, int64_t re, int32_t* pstarttime, u
|
|||
return ret;
|
||||
}
|
||||
|
||||
u_int32_t timestamp = *ptimestamp;
|
||||
uint32_t timestamp = *ptimestamp;
|
||||
|
||||
if ((ret = srs_human_print_rtmp_packet(type, timestamp, data, size)) != 0) {
|
||||
srs_human_trace("print packet failed. ret=%d", ret);
|
||||
|
@ -185,7 +185,7 @@ int do_proxy(srs_flv_t flv, srs_rtmp_t ortmp, int64_t re, int32_t* pstarttime, u
|
|||
int proxy(srs_flv_t flv, srs_rtmp_t ortmp)
|
||||
{
|
||||
int ret = 0;
|
||||
u_int32_t timestamp = 0;
|
||||
uint32_t timestamp = 0;
|
||||
int32_t starttime = -1;
|
||||
|
||||
char header[13];
|
||||
|
@ -252,7 +252,7 @@ int64_t re_create()
|
|||
|
||||
return re;
|
||||
}
|
||||
void re_update(int64_t re, int32_t starttime, u_int32_t time)
|
||||
void re_update(int64_t re, int32_t starttime, uint32_t time)
|
||||
{
|
||||
// send by pulse algorithm.
|
||||
int64_t now = srs_utils_time_ms();
|
||||
|
@ -261,7 +261,7 @@ void re_update(int64_t re, int32_t starttime, u_int32_t time)
|
|||
usleep((useconds_t)(diff * 1000));
|
||||
}
|
||||
}
|
||||
void re_cleanup(int64_t re, int32_t starttime, u_int32_t time)
|
||||
void re_cleanup(int64_t re, int32_t starttime, uint32_t time)
|
||||
{
|
||||
// for the last pulse, always sleep.
|
||||
// for the virtual live encoder long time publishing.
|
||||
|
|
|
@ -117,8 +117,8 @@ int proxy(srs_rtmp_t irtmp, srs_rtmp_t ortmp)
|
|||
int size;
|
||||
char type;
|
||||
char* data;
|
||||
u_int32_t timestamp;
|
||||
u_int64_t nb_msgs = 0;
|
||||
uint32_t timestamp;
|
||||
uint64_t nb_msgs = 0;
|
||||
|
||||
if ((ret = connect_ic(irtmp)) != 0) {
|
||||
return ret;
|
||||
|
|
|
@ -69,7 +69,7 @@ int main(int argc, char** argv)
|
|||
int size;
|
||||
char type;
|
||||
char* data;
|
||||
u_int32_t timestamp;
|
||||
uint32_t timestamp;
|
||||
|
||||
if (srs_rtmp_read_packet(rtmp, &type, ×tamp, &data, &size) != 0) {
|
||||
goto rtmp_destroy;
|
||||
|
|
|
@ -73,7 +73,7 @@ int main(int argc, char** argv)
|
|||
}
|
||||
srs_human_trace("publish stream success");
|
||||
|
||||
u_int32_t timestamp = 0;
|
||||
uint32_t timestamp = 0;
|
||||
for (;;) {
|
||||
char type = SRS_RTMP_TYPE_VIDEO;
|
||||
int size = 4096;
|
||||
|
|
|
@ -275,14 +275,14 @@ int main(int argc, char** argv)
|
|||
}
|
||||
|
||||
int64_t nb_packets = 0;
|
||||
u_int32_t pre_timestamp = 0;
|
||||
uint32_t pre_timestamp = 0;
|
||||
int64_t pre_now = -1;
|
||||
int64_t start_time = -1;
|
||||
for (;;) {
|
||||
int size;
|
||||
char type;
|
||||
char* data;
|
||||
u_int32_t timestamp;
|
||||
uint32_t timestamp;
|
||||
|
||||
if (srs_rtmp_read_packet(rtmp, &type, ×tamp, &data, &size) != 0) {
|
||||
srs_human_trace("read rtmp packet failed.");
|
||||
|
|
|
@ -203,7 +203,7 @@ int SrsDynamicHttpConn::do_proxy(ISrsHttpResponseReader* rr, SrsFlvDecoder* dec)
|
|||
|
||||
char type;
|
||||
int32_t size;
|
||||
u_int32_t time;
|
||||
uint32_t time;
|
||||
if ((ret = dec->read_tag_header(&type, &size, &time)) != ERROR_SUCCESS) {
|
||||
if (!srs_is_client_gracefully_close(ret)) {
|
||||
srs_error("flv: proxy tag header failed. ret=%d", ret);
|
||||
|
|
|
@ -581,7 +581,7 @@ SrsConnection* SrsHttpMessage::connection()
|
|||
return conn;
|
||||
}
|
||||
|
||||
u_int8_t SrsHttpMessage::method()
|
||||
uint8_t SrsHttpMessage::method()
|
||||
{
|
||||
if (jsonp && !jsonp_method.empty()) {
|
||||
if (jsonp_method == "GET") {
|
||||
|
@ -595,12 +595,12 @@ u_int8_t SrsHttpMessage::method()
|
|||
}
|
||||
}
|
||||
|
||||
return (u_int8_t)_header.method;
|
||||
return (uint8_t)_header.method;
|
||||
}
|
||||
|
||||
u_int16_t SrsHttpMessage::status_code()
|
||||
uint16_t SrsHttpMessage::status_code()
|
||||
{
|
||||
return (u_int16_t)_header.status_code;
|
||||
return (uint16_t)_header.status_code;
|
||||
}
|
||||
|
||||
string SrsHttpMessage::method_str()
|
||||
|
|
|
@ -215,8 +215,8 @@ public:
|
|||
public:
|
||||
virtual SrsConnection* connection();
|
||||
public:
|
||||
virtual u_int8_t method();
|
||||
virtual u_int16_t status_code();
|
||||
virtual uint8_t method();
|
||||
virtual uint16_t status_code();
|
||||
/**
|
||||
* method helpers.
|
||||
*/
|
||||
|
|
|
@ -349,8 +349,8 @@ int SrsMpegtsOverUdp::on_ts_video(SrsTsMessage* msg, SrsBuffer* avs)
|
|||
}
|
||||
|
||||
// ts tbn to flv tbn.
|
||||
u_int32_t dts = (u_int32_t)(msg->dts / 90);
|
||||
u_int32_t pts = (u_int32_t)(msg->dts / 90);
|
||||
uint32_t dts = (uint32_t)(msg->dts / 90);
|
||||
uint32_t pts = (uint32_t)(msg->dts / 90);
|
||||
|
||||
// send each frame.
|
||||
while (!avs->empty()) {
|
||||
|
@ -419,7 +419,7 @@ int SrsMpegtsOverUdp::on_ts_video(SrsTsMessage* msg, SrsBuffer* avs)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsMpegtsOverUdp::write_h264_sps_pps(u_int32_t dts, u_int32_t pts)
|
||||
int SrsMpegtsOverUdp::write_h264_sps_pps(uint32_t dts, uint32_t pts)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -447,7 +447,7 @@ int SrsMpegtsOverUdp::write_h264_sps_pps(u_int32_t dts, u_int32_t pts)
|
|||
}
|
||||
|
||||
// the timestamp in rtmp message header is dts.
|
||||
u_int32_t timestamp = dts;
|
||||
uint32_t timestamp = dts;
|
||||
if ((ret = rtmp_write_packet(SrsCodecFlvTagVideo, timestamp, flv, nb_flv)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
@ -460,7 +460,7 @@ int SrsMpegtsOverUdp::write_h264_sps_pps(u_int32_t dts, u_int32_t pts)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsMpegtsOverUdp::write_h264_ipb_frame(char* frame, int frame_size, u_int32_t dts, u_int32_t pts)
|
||||
int SrsMpegtsOverUdp::write_h264_ipb_frame(char* frame, int frame_size, uint32_t dts, uint32_t pts)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -494,7 +494,7 @@ int SrsMpegtsOverUdp::write_h264_ipb_frame(char* frame, int frame_size, u_int32_
|
|||
}
|
||||
|
||||
// the timestamp in rtmp message header is dts.
|
||||
u_int32_t timestamp = dts;
|
||||
uint32_t timestamp = dts;
|
||||
return rtmp_write_packet(SrsCodecFlvTagVideo, timestamp, flv, nb_flv);
|
||||
}
|
||||
|
||||
|
@ -508,7 +508,7 @@ int SrsMpegtsOverUdp::on_ts_audio(SrsTsMessage* msg, SrsBuffer* avs)
|
|||
}
|
||||
|
||||
// ts tbn to flv tbn.
|
||||
u_int32_t dts = (u_int32_t)(msg->dts / 90);
|
||||
uint32_t dts = (uint32_t)(msg->dts / 90);
|
||||
|
||||
// send each frame.
|
||||
while (!avs->empty()) {
|
||||
|
@ -551,7 +551,7 @@ int SrsMpegtsOverUdp::on_ts_audio(SrsTsMessage* msg, SrsBuffer* avs)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsMpegtsOverUdp::write_audio_raw_frame(char* frame, int frame_size, SrsRawAacStreamCodec* codec, u_int32_t dts)
|
||||
int SrsMpegtsOverUdp::write_audio_raw_frame(char* frame, int frame_size, SrsRawAacStreamCodec* codec, uint32_t dts)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -564,7 +564,7 @@ int SrsMpegtsOverUdp::write_audio_raw_frame(char* frame, int frame_size, SrsRawA
|
|||
return rtmp_write_packet(SrsCodecFlvTagAudio, dts, data, size);
|
||||
}
|
||||
|
||||
int SrsMpegtsOverUdp::rtmp_write_packet(char type, u_int32_t timestamp, char* data, int size)
|
||||
int SrsMpegtsOverUdp::rtmp_write_packet(char type, uint32_t timestamp, char* data, int size)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
|
|
@ -113,12 +113,12 @@ public:
|
|||
virtual int on_ts_message(SrsTsMessage* msg);
|
||||
private:
|
||||
virtual int on_ts_video(SrsTsMessage* msg, SrsBuffer* avs);
|
||||
virtual int write_h264_sps_pps(u_int32_t dts, u_int32_t pts);
|
||||
virtual int write_h264_ipb_frame(char* frame, int frame_size, u_int32_t dts, u_int32_t pts);
|
||||
virtual int write_h264_sps_pps(uint32_t dts, uint32_t pts);
|
||||
virtual int write_h264_ipb_frame(char* frame, int frame_size, uint32_t dts, uint32_t pts);
|
||||
virtual int on_ts_audio(SrsTsMessage* msg, SrsBuffer* avs);
|
||||
virtual int write_audio_raw_frame(char* frame, int frame_size, SrsRawAacStreamCodec* codec, u_int32_t dts);
|
||||
virtual int write_audio_raw_frame(char* frame, int frame_size, SrsRawAacStreamCodec* codec, uint32_t dts);
|
||||
private:
|
||||
virtual int rtmp_write_packet(char type, u_int32_t timestamp, char* data, int size);
|
||||
virtual int rtmp_write_packet(char type, uint32_t timestamp, char* data, int size);
|
||||
private:
|
||||
// Connect to RTMP server.
|
||||
virtual int connect();
|
||||
|
|
|
@ -437,8 +437,8 @@ int SrsRtspConn::on_rtp_video(SrsRtpPacket* pkt, int64_t dts, int64_t pts)
|
|||
|
||||
char* bytes = pkt->payload->bytes();
|
||||
int length = pkt->payload->length();
|
||||
u_int32_t fdts = (u_int32_t)(dts / 90);
|
||||
u_int32_t fpts = (u_int32_t)(pts / 90);
|
||||
uint32_t fdts = (uint32_t)(dts / 90);
|
||||
uint32_t fpts = (uint32_t)(pts / 90);
|
||||
if ((ret = write_h264_ipb_frame(bytes, length, fdts, fpts)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
@ -481,7 +481,7 @@ int SrsRtspConn::kickoff_audio_cache(SrsRtpPacket* pkt, int64_t dts)
|
|||
int nb_frame = acache->audio_samples->sample_units[i].size;
|
||||
int64_t timestamp = (acache->dts + delta * i) / 90;
|
||||
acodec->aac_packet_type = 1;
|
||||
if ((ret = write_audio_raw_frame(frame, nb_frame, acodec, (u_int32_t)timestamp)) != ERROR_SUCCESS) {
|
||||
if ((ret = write_audio_raw_frame(frame, nb_frame, acodec, (uint32_t)timestamp)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
@ -502,7 +502,7 @@ int SrsRtspConn::write_sequence_header()
|
|||
int64_t dts = vjitter->timestamp() / 90;
|
||||
|
||||
// send video sps/pps
|
||||
if ((ret = write_h264_sps_pps((u_int32_t)dts, (u_int32_t)dts)) != ERROR_SUCCESS) {
|
||||
if ((ret = write_h264_sps_pps((uint32_t)dts, (uint32_t)dts)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -540,7 +540,7 @@ int SrsRtspConn::write_sequence_header()
|
|||
break;
|
||||
};
|
||||
|
||||
if ((ret = write_audio_raw_frame((char*)sh.data(), (int)sh.length(), acodec, (u_int32_t)dts)) != ERROR_SUCCESS) {
|
||||
if ((ret = write_audio_raw_frame((char*)sh.data(), (int)sh.length(), acodec, (uint32_t)dts)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
@ -548,7 +548,7 @@ int SrsRtspConn::write_sequence_header()
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsRtspConn::write_h264_sps_pps(u_int32_t dts, u_int32_t pts)
|
||||
int SrsRtspConn::write_h264_sps_pps(uint32_t dts, uint32_t pts)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -568,7 +568,7 @@ int SrsRtspConn::write_h264_sps_pps(u_int32_t dts, u_int32_t pts)
|
|||
}
|
||||
|
||||
// the timestamp in rtmp message header is dts.
|
||||
u_int32_t timestamp = dts;
|
||||
uint32_t timestamp = dts;
|
||||
if ((ret = rtmp_write_packet(SrsCodecFlvTagVideo, timestamp, flv, nb_flv)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
@ -576,7 +576,7 @@ int SrsRtspConn::write_h264_sps_pps(u_int32_t dts, u_int32_t pts)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsRtspConn::write_h264_ipb_frame(char* frame, int frame_size, u_int32_t dts, u_int32_t pts)
|
||||
int SrsRtspConn::write_h264_ipb_frame(char* frame, int frame_size, uint32_t dts, uint32_t pts)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -604,11 +604,11 @@ int SrsRtspConn::write_h264_ipb_frame(char* frame, int frame_size, u_int32_t dts
|
|||
}
|
||||
|
||||
// the timestamp in rtmp message header is dts.
|
||||
u_int32_t timestamp = dts;
|
||||
uint32_t timestamp = dts;
|
||||
return rtmp_write_packet(SrsCodecFlvTagVideo, timestamp, flv, nb_flv);
|
||||
}
|
||||
|
||||
int SrsRtspConn::write_audio_raw_frame(char* frame, int frame_size, SrsRawAacStreamCodec* codec, u_int32_t dts)
|
||||
int SrsRtspConn::write_audio_raw_frame(char* frame, int frame_size, SrsRawAacStreamCodec* codec, uint32_t dts)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -621,7 +621,7 @@ int SrsRtspConn::write_audio_raw_frame(char* frame, int frame_size, SrsRawAacStr
|
|||
return rtmp_write_packet(SrsCodecFlvTagAudio, dts, data, size);
|
||||
}
|
||||
|
||||
int SrsRtspConn::rtmp_write_packet(char type, u_int32_t timestamp, char* data, int size)
|
||||
int SrsRtspConn::rtmp_write_packet(char type, uint32_t timestamp, char* data, int size)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
|
|
@ -172,10 +172,10 @@ private:
|
|||
virtual int kickoff_audio_cache(SrsRtpPacket* pkt, int64_t dts);
|
||||
private:
|
||||
virtual int write_sequence_header();
|
||||
virtual int write_h264_sps_pps(u_int32_t dts, u_int32_t pts);
|
||||
virtual int write_h264_ipb_frame(char* frame, int frame_size, u_int32_t dts, u_int32_t pts);
|
||||
virtual int write_audio_raw_frame(char* frame, int frame_size, SrsRawAacStreamCodec* codec, u_int32_t dts);
|
||||
virtual int rtmp_write_packet(char type, u_int32_t timestamp, char* data, int size);
|
||||
virtual int write_h264_sps_pps(uint32_t dts, uint32_t pts);
|
||||
virtual int write_h264_ipb_frame(char* frame, int frame_size, uint32_t dts, uint32_t pts);
|
||||
virtual int write_audio_raw_frame(char* frame, int frame_size, SrsRawAacStreamCodec* codec, uint32_t dts);
|
||||
virtual int rtmp_write_packet(char type, uint32_t timestamp, char* data, int size);
|
||||
private:
|
||||
// Connect to RTMP server.
|
||||
virtual int connect();
|
||||
|
|
|
@ -399,8 +399,8 @@ public:
|
|||
class SrsMixQueue
|
||||
{
|
||||
private:
|
||||
u_int32_t nb_videos;
|
||||
u_int32_t nb_audios;
|
||||
uint32_t nb_videos;
|
||||
uint32_t nb_audios;
|
||||
std::multimap<int64_t, SrsSharedPtrMessage*> msgs;
|
||||
public:
|
||||
SrsMixQueue();
|
||||
|
|
|
@ -1025,7 +1025,7 @@ bool srs_net_device_is_internet(string ifname)
|
|||
|
||||
bool srs_net_device_is_internet(in_addr_t addr)
|
||||
{
|
||||
u_int32_t addr_h = ntohl(addr);
|
||||
uint32_t addr_h = ntohl(addr);
|
||||
|
||||
// lo, 127.0.0.0-127.0.0.1
|
||||
if (addr_h >= 0x7f000000 && addr_h <= 0x7f000001) {
|
||||
|
@ -1289,7 +1289,7 @@ string srs_get_public_internet_address()
|
|||
for (int i = 0; i < (int)ips.size(); i++) {
|
||||
std::string ip = ips[i];
|
||||
in_addr_t addr = inet_addr(ip.c_str());
|
||||
u_int32_t addr_h = ntohl(addr);
|
||||
uint32_t addr_h = ntohl(addr);
|
||||
// lo, 127.0.0.0-127.0.0.1
|
||||
if (addr_h >= 0x7f000000 && addr_h <= 0x7f000001) {
|
||||
srs_trace("ignore private address: %s", ip.c_str());
|
||||
|
@ -1320,7 +1320,7 @@ string srs_get_public_internet_address()
|
|||
for (int i = 0; i < (int)ips.size(); i++) {
|
||||
std::string ip = ips[i];
|
||||
in_addr_t addr = inet_addr(ip.c_str());
|
||||
u_int32_t addr_h = ntohl(addr);
|
||||
uint32_t addr_h = ntohl(addr);
|
||||
// lo, 127.0.0.0-127.0.0.1
|
||||
if (addr_h >= 0x7f000000 && addr_h <= 0x7f000001) {
|
||||
srs_trace("ignore private address: %s", ip.c_str());
|
||||
|
|
|
@ -481,14 +481,14 @@ public:
|
|||
// data of /proc/meminfo
|
||||
public:
|
||||
// MemActive = MemTotal - MemFree
|
||||
u_int64_t MemActive;
|
||||
uint64_t MemActive;
|
||||
// RealInUse = MemActive - Buffers - Cached
|
||||
u_int64_t RealInUse;
|
||||
uint64_t RealInUse;
|
||||
// NotInUse = MemTotal - RealInUse
|
||||
// = MemTotal - MemActive + Buffers + Cached
|
||||
// = MemTotal - MemTotal + MemFree + Buffers + Cached
|
||||
// = MemFree + Buffers + Cached
|
||||
u_int64_t NotInUse;
|
||||
uint64_t NotInUse;
|
||||
|
||||
unsigned long MemTotal;
|
||||
unsigned long MemFree;
|
||||
|
|
|
@ -35,7 +35,7 @@ SrsLbRoundRobin::~SrsLbRoundRobin()
|
|||
{
|
||||
}
|
||||
|
||||
u_int32_t SrsLbRoundRobin::current()
|
||||
uint32_t SrsLbRoundRobin::current()
|
||||
{
|
||||
return index;
|
||||
}
|
||||
|
|
|
@ -42,14 +42,14 @@ private:
|
|||
// current selected index.
|
||||
int index;
|
||||
// total scheduled count.
|
||||
u_int32_t count;
|
||||
uint32_t count;
|
||||
// current selected server.
|
||||
std::string elem;
|
||||
public:
|
||||
SrsLbRoundRobin();
|
||||
virtual ~SrsLbRoundRobin();
|
||||
public:
|
||||
virtual u_int32_t current();
|
||||
virtual uint32_t current();
|
||||
virtual std::string selected();
|
||||
virtual std::string select(const std::vector<std::string>& servers);
|
||||
};
|
||||
|
|
|
@ -216,7 +216,7 @@ class SrsBitBuffer
|
|||
{
|
||||
private:
|
||||
int8_t cb;
|
||||
u_int8_t cb_left;
|
||||
uint8_t cb_left;
|
||||
SrsBuffer* stream;
|
||||
public:
|
||||
SrsBitBuffer();
|
||||
|
|
|
@ -600,8 +600,8 @@ int SrsAvcAacCodec::audio_aac_sequence_header_demux(char* data, int size)
|
|||
srs_error("audio codec decode aac sequence header failed. ret=%d", ret);
|
||||
return ret;
|
||||
}
|
||||
u_int8_t profile_ObjectType = stream->read_1bytes();
|
||||
u_int8_t samplingFrequencyIndex = stream->read_1bytes();
|
||||
uint8_t profile_ObjectType = stream->read_1bytes();
|
||||
uint8_t samplingFrequencyIndex = stream->read_1bytes();
|
||||
|
||||
aac_channels = (samplingFrequencyIndex >> 3) & 0x0f;
|
||||
samplingFrequencyIndex = ((profile_ObjectType << 1) & 0x0e) | ((samplingFrequencyIndex >> 7) & 0x01);
|
||||
|
@ -976,7 +976,7 @@ int SrsAvcAacCodec::avc_demux_sps_rbsp(char* rbsp, int nb_rbsp)
|
|||
srs_error("sps shall atleast 3bytes. ret=%d", ret);
|
||||
return ret;
|
||||
}
|
||||
u_int8_t profile_idc = stream.read_1bytes();
|
||||
uint8_t profile_idc = stream.read_1bytes();
|
||||
if (!profile_idc) {
|
||||
ret = ERROR_HLS_DECODE_ERROR;
|
||||
srs_error("sps the profile_idc invalid. ret=%d", ret);
|
||||
|
@ -990,7 +990,7 @@ int SrsAvcAacCodec::avc_demux_sps_rbsp(char* rbsp, int nb_rbsp)
|
|||
return ret;
|
||||
}
|
||||
|
||||
u_int8_t level_idc = stream.read_1bytes();
|
||||
uint8_t level_idc = stream.read_1bytes();
|
||||
if (!level_idc) {
|
||||
ret = ERROR_HLS_DECODE_ERROR;
|
||||
srs_error("sps the level_idc invalid. ret=%d", ret);
|
||||
|
|
|
@ -571,9 +571,9 @@ public:
|
|||
SrsAvcLevel avc_level;
|
||||
// lengthSizeMinusOne, ISO_IEC_14496-15-AVC-format-2012.pdf, page 16
|
||||
int8_t NAL_unit_length;
|
||||
u_int16_t sequenceParameterSetLength;
|
||||
uint16_t sequenceParameterSetLength;
|
||||
char* sequenceParameterSetNALUnit;
|
||||
u_int16_t pictureParameterSetLength;
|
||||
uint16_t pictureParameterSetLength;
|
||||
char* pictureParameterSetNALUnit;
|
||||
private:
|
||||
// the avc payload format.
|
||||
|
@ -589,11 +589,11 @@ public:
|
|||
/**
|
||||
* samplingFrequencyIndex
|
||||
*/
|
||||
u_int8_t aac_sample_rate;
|
||||
uint8_t aac_sample_rate;
|
||||
/**
|
||||
* channelConfiguration
|
||||
*/
|
||||
u_int8_t aac_channels;
|
||||
uint8_t aac_channels;
|
||||
public:
|
||||
/**
|
||||
* the avc extra data, the AVC sequence header,
|
||||
|
|
|
@ -128,7 +128,7 @@ void SrsMessageHeader::initialize_amf0_script(int size, int stream)
|
|||
perfer_cid = RTMP_CID_OverConnection2;
|
||||
}
|
||||
|
||||
void SrsMessageHeader::initialize_audio(int size, u_int32_t time, int stream)
|
||||
void SrsMessageHeader::initialize_audio(int size, uint32_t time, int stream)
|
||||
{
|
||||
message_type = RTMP_MSG_AudioMessage;
|
||||
payload_length = (int32_t)size;
|
||||
|
@ -140,7 +140,7 @@ void SrsMessageHeader::initialize_audio(int size, u_int32_t time, int stream)
|
|||
perfer_cid = RTMP_CID_Audio;
|
||||
}
|
||||
|
||||
void SrsMessageHeader::initialize_video(int size, u_int32_t time, int stream)
|
||||
void SrsMessageHeader::initialize_video(int size, uint32_t time, int stream)
|
||||
{
|
||||
message_type = RTMP_MSG_VideoMessage;
|
||||
payload_length = (int32_t)size;
|
||||
|
@ -755,7 +755,7 @@ int SrsFlvDecoder::read_header(char header[9])
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsFlvDecoder::read_tag_header(char* ptype, int32_t* pdata_size, u_int32_t* ptime)
|
||||
int SrsFlvDecoder::read_tag_header(char* ptype, int32_t* pdata_size, uint32_t* ptime)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
|
|
@ -248,11 +248,11 @@ public:
|
|||
/**
|
||||
* create a audio header, set the size, timestamp and stream_id.
|
||||
*/
|
||||
void initialize_audio(int size, u_int32_t time, int stream);
|
||||
void initialize_audio(int size, uint32_t time, int stream);
|
||||
/**
|
||||
* create a video header, set the size, timestamp and stream_id.
|
||||
*/
|
||||
void initialize_video(int size, u_int32_t time, int stream);
|
||||
void initialize_video(int size, uint32_t time, int stream);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -543,7 +543,7 @@ public:
|
|||
* read the tag header infos.
|
||||
* @remark assert ptype/pdata_size/ptime not NULL.
|
||||
*/
|
||||
virtual int read_tag_header(char* ptype, int32_t* pdata_size, u_int32_t* ptime);
|
||||
virtual int read_tag_header(char* ptype, int32_t* pdata_size, uint32_t* ptime);
|
||||
/**
|
||||
* read the tag data.
|
||||
* @remark assert data not NULL.
|
||||
|
|
|
@ -818,7 +818,7 @@ SrsTsPacket* SrsTsPacket::create_pmt(SrsTsContext* context, int16_t pmt_number,
|
|||
}
|
||||
|
||||
SrsTsPacket* SrsTsPacket::create_pes_first(SrsTsContext* context,
|
||||
int16_t pid, SrsTsPESStreamId sid, u_int8_t continuity_counter, bool discontinuity,
|
||||
int16_t pid, SrsTsPESStreamId sid, uint8_t continuity_counter, bool discontinuity,
|
||||
int64_t pcr, int64_t dts, int64_t pts, int size
|
||||
) {
|
||||
SrsTsPacket* pkt = new SrsTsPacket(context);
|
||||
|
@ -853,7 +853,7 @@ SrsTsPacket* SrsTsPacket::create_pes_first(SrsTsContext* context,
|
|||
}
|
||||
|
||||
pes->packet_start_code_prefix = 0x01;
|
||||
pes->stream_id = (u_int8_t)sid;
|
||||
pes->stream_id = (uint8_t)sid;
|
||||
pes->PES_packet_length = (size > 0xFFFF)? 0:size;
|
||||
pes->PES_scrambling_control = 0;
|
||||
pes->PES_priority = 0;
|
||||
|
@ -874,7 +874,7 @@ SrsTsPacket* SrsTsPacket::create_pes_first(SrsTsContext* context,
|
|||
}
|
||||
|
||||
SrsTsPacket* SrsTsPacket::create_pes_continue(SrsTsContext* context,
|
||||
int16_t pid, SrsTsPESStreamId sid, u_int8_t continuity_counter
|
||||
int16_t pid, SrsTsPESStreamId sid, uint8_t continuity_counter
|
||||
) {
|
||||
SrsTsPacket* pkt = new SrsTsPacket(context);
|
||||
pkt->sync_byte = 0x47;
|
||||
|
@ -1052,7 +1052,7 @@ int SrsTsAdaptationField::decode(SrsBuffer* stream)
|
|||
srs_error("ts: demux af transport_private_data_flag failed. ret=%d", ret);
|
||||
return ret;
|
||||
}
|
||||
transport_private_data_length = (u_int8_t)stream->read_1bytes();
|
||||
transport_private_data_length = (uint8_t)stream->read_1bytes();
|
||||
|
||||
if (transport_private_data_length> 0) {
|
||||
if (!stream->require(transport_private_data_length)) {
|
||||
|
@ -1074,7 +1074,7 @@ int SrsTsAdaptationField::decode(SrsBuffer* stream)
|
|||
srs_error("ts: demux af adaptation_field_extension_flag failed. ret=%d", ret);
|
||||
return ret;
|
||||
}
|
||||
adaptation_field_extension_length = (u_int8_t)stream->read_1bytes();
|
||||
adaptation_field_extension_length = (uint8_t)stream->read_1bytes();
|
||||
int8_t ltwfv = stream->read_1bytes();
|
||||
|
||||
piecewise_rate_flag = (ltwfv >> 6) & 0x01;
|
||||
|
@ -1705,7 +1705,7 @@ int SrsTsPayloadPES::decode(SrsBuffer* stream, SrsTsMessage** ppmsg)
|
|||
// first PES_packet_data_byte.
|
||||
/**
|
||||
* when actual packet length > 0xffff(65535),
|
||||
* which exceed the max u_int16_t packet length,
|
||||
* which exceed the max uint16_t packet length,
|
||||
* use 0 packet length, the next unit start indicates the end of packet.
|
||||
*/
|
||||
if (PES_packet_length > 0) {
|
||||
|
@ -2043,7 +2043,7 @@ int SrsTsPayloadPES::decode_33bits_dts_pts(SrsBuffer* stream, int64_t* pv)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsTsPayloadPES::encode_33bits_dts_pts(SrsBuffer* stream, u_int8_t fb, int64_t v)
|
||||
int SrsTsPayloadPES::encode_33bits_dts_pts(SrsBuffer* stream, uint8_t fb, int64_t v)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -2167,7 +2167,7 @@ int SrsTsPayloadPSI::decode(SrsBuffer* stream, SrsTsMessage** /*ppmsg*/)
|
|||
// all stuffing must be 0xff.
|
||||
// TODO: FIXME: maybe need to remove the following.
|
||||
for (int i = 0; i < nb_stuffings; i++) {
|
||||
if ((u_int8_t)stuffing[i] != 0xff) {
|
||||
if ((uint8_t)stuffing[i] != 0xff) {
|
||||
srs_warn("ts: stuff is not 0xff, actual=%#x", stuffing[i]);
|
||||
break;
|
||||
}
|
||||
|
@ -2892,7 +2892,7 @@ int SrsTsCache::do_cache_aac(SrsAvcAacCodec* codec, SrsCodecSample* sample)
|
|||
// 6.2 Audio Data Transport Stream, ADTS
|
||||
// in aac-iso-13818-7.pdf, page 26.
|
||||
// fixed 7bytes header
|
||||
u_int8_t adts_header[7] = {0xff, 0xf9, 0x00, 0x00, 0x00, 0x0f, 0xfc};
|
||||
uint8_t adts_header[7] = {0xff, 0xf9, 0x00, 0x00, 0x00, 0x0f, 0xfc};
|
||||
/*
|
||||
// adts_fixed_header
|
||||
// 2B, 16bits
|
||||
|
@ -2984,8 +2984,8 @@ void srs_avc_insert_aud(SrsSimpleStream* payload, bool& aud_inserted)
|
|||
* annexb 3B header, 406B nalu(nal_unit_type:1)(non-IDR,P/B)
|
||||
* @remark we use the sequence of apple samples http://ossrs.net/apple-sample/bipbopall.m3u8
|
||||
*/
|
||||
static u_int8_t fresh_nalu_header[] = { 0x00, 0x00, 0x00, 0x01 };
|
||||
static u_int8_t cont_nalu_header[] = { 0x00, 0x00, 0x01 };
|
||||
static uint8_t fresh_nalu_header[] = { 0x00, 0x00, 0x00, 0x01 };
|
||||
static uint8_t cont_nalu_header[] = { 0x00, 0x00, 0x01 };
|
||||
|
||||
if (!aud_inserted) {
|
||||
aud_inserted = true;
|
||||
|
@ -3034,7 +3034,7 @@ int SrsTsCache::do_cache_avc(SrsAvcAacCodec* codec, SrsCodecSample* sample)
|
|||
// 8, SP (SP slice)
|
||||
// 9, SI (SI slice)
|
||||
// ISO_IEC_14496-10-AVC-2012.pdf, page 105.
|
||||
static u_int8_t default_aud_nalu[] = { 0x09, 0xf0};
|
||||
static uint8_t default_aud_nalu[] = { 0x09, 0xf0};
|
||||
srs_avc_insert_aud(video->payload, aud_inserted);
|
||||
video->payload->append((const char*)default_aud_nalu, 2);
|
||||
}
|
||||
|
|
|
@ -179,7 +179,7 @@ struct SrsTsChannel
|
|||
SrsTsMessage* msg;
|
||||
SrsTsContext* context;
|
||||
// for encoder.
|
||||
u_int8_t continuity_counter;
|
||||
uint8_t continuity_counter;
|
||||
|
||||
SrsTsChannel();
|
||||
virtual ~SrsTsChannel();
|
||||
|
@ -274,9 +274,9 @@ public:
|
|||
// @remark use is_audio() and is_video() to check it, and stream_number() to finger it out.
|
||||
SrsTsPESStreamId sid;
|
||||
// the size of payload, 0 indicates the length() of payload.
|
||||
u_int16_t PES_packet_length;
|
||||
uint16_t PES_packet_length;
|
||||
// the chunk id.
|
||||
u_int8_t continuity_counter;
|
||||
uint8_t continuity_counter;
|
||||
// the payload bytes.
|
||||
SrsSimpleStream* payload;
|
||||
public:
|
||||
|
@ -505,7 +505,7 @@ public:
|
|||
* The continuity counter may be discontinuous when the discontinuity_indicator is set to '1' (refer to 2.4.3.4). In the case of
|
||||
* a null packet the value of the continuity_counter is undefined.
|
||||
*/
|
||||
u_int8_t continuity_counter; //4bits
|
||||
uint8_t continuity_counter; //4bits
|
||||
private:
|
||||
SrsTsAdaptationField* adaptation_field;
|
||||
SrsTsPayload* payload;
|
||||
|
@ -529,11 +529,11 @@ public:
|
|||
int16_t apid, SrsTsStream as
|
||||
);
|
||||
static SrsTsPacket* create_pes_first(SrsTsContext* context,
|
||||
int16_t pid, SrsTsPESStreamId sid, u_int8_t continuity_counter, bool discontinuity,
|
||||
int16_t pid, SrsTsPESStreamId sid, uint8_t continuity_counter, bool discontinuity,
|
||||
int64_t pcr, int64_t dts, int64_t pts, int size
|
||||
);
|
||||
static SrsTsPacket* create_pes_continue(SrsTsContext* context,
|
||||
int16_t pid, SrsTsPESStreamId sid, u_int8_t continuity_counter
|
||||
int16_t pid, SrsTsPESStreamId sid, uint8_t continuity_counter
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -559,7 +559,7 @@ public:
|
|||
* This is the only method of stuffing allowed for Transport Stream packets carrying PES packets. For Transport Stream
|
||||
* packets carrying PSI, an alternative stuffing method is described in 2.4.4.
|
||||
*/
|
||||
u_int8_t adaption_field_length; //8bits
|
||||
uint8_t adaption_field_length; //8bits
|
||||
// 1B
|
||||
/**
|
||||
* This is a 1-bit field which when set to '1' indicates that the discontinuity state is true for the
|
||||
|
@ -742,7 +742,7 @@ public:
|
|||
* private_data bytes immediately following the transport private_data_length field. The number of private_data bytes shall
|
||||
* not be such that private data extends beyond the adaptation field.
|
||||
*/
|
||||
u_int8_t transport_private_data_length; //8bits
|
||||
uint8_t transport_private_data_length; //8bits
|
||||
char* transport_private_data; //[transport_private_data_length]bytes
|
||||
|
||||
// if adaptation_field_extension_flag, 2+x B
|
||||
|
@ -750,7 +750,7 @@ public:
|
|||
* The adaptation_field_extension_length is an 8-bit field. It indicates the number of
|
||||
* bytes of the extended adaptation field data immediately following this field, including reserved bytes if present.
|
||||
*/
|
||||
u_int8_t adaptation_field_extension_length; //8bits
|
||||
uint8_t adaptation_field_extension_length; //8bits
|
||||
/**
|
||||
* This is a 1-bit field which when set to '1' indicates the presence of the ltw_offset
|
||||
* field.
|
||||
|
@ -920,14 +920,14 @@ public:
|
|||
* Program Specific Information as specified in 2.4.4.
|
||||
*/
|
||||
// @see SrsTsPESStreamId, value can be SrsTsPESStreamIdAudioCommon or SrsTsPESStreamIdVideoCommon.
|
||||
u_int8_t stream_id; //8bits
|
||||
uint8_t stream_id; //8bits
|
||||
// 2B
|
||||
/**
|
||||
* A 16-bit field specifying the number of bytes in the PES packet following the last byte of the
|
||||
* field. A value of 0 indicates that the PES packet length is neither specified nor bounded and is allowed only in
|
||||
* PES packets whose payload consists of bytes from a video elementary stream contained in Transport Stream packets.
|
||||
*/
|
||||
u_int16_t PES_packet_length; //16bits
|
||||
uint16_t PES_packet_length; //16bits
|
||||
|
||||
// 1B
|
||||
/**
|
||||
|
@ -1013,7 +1013,7 @@ public:
|
|||
* stuffing bytes contained in this PES packet header. The presence of optional fields is indicated in the byte that precedes
|
||||
* the PES_header_data_length field.
|
||||
*/
|
||||
u_int8_t PES_header_data_length; //8bits
|
||||
uint8_t PES_header_data_length; //8bits
|
||||
|
||||
// 5B
|
||||
/**
|
||||
|
@ -1157,7 +1157,7 @@ public:
|
|||
/**
|
||||
* This is an 8-bit field which indicates the length, in bytes, of the pack_header_field().
|
||||
*/
|
||||
u_int8_t pack_field_length; //8bits
|
||||
uint8_t pack_field_length; //8bits
|
||||
char* pack_field; //[pack_field_length] bytes
|
||||
|
||||
// 2B
|
||||
|
@ -1208,7 +1208,7 @@ public:
|
|||
* This is a 7-bit field which specifies the length, in bytes, of the data following this field in
|
||||
* the PES extension field up to and including any reserved bytes.
|
||||
*/
|
||||
u_int8_t PES_extension_field_length; //7bits
|
||||
uint8_t PES_extension_field_length; //7bits
|
||||
char* PES_extension_field; //[PES_extension_field_length] bytes
|
||||
|
||||
// NB
|
||||
|
@ -1249,7 +1249,7 @@ public:
|
|||
virtual int encode(SrsBuffer* stream);
|
||||
private:
|
||||
virtual int decode_33bits_dts_pts(SrsBuffer* stream, int64_t* pv);
|
||||
virtual int encode_33bits_dts_pts(SrsBuffer* stream, u_int8_t fb, int64_t v);
|
||||
virtual int encode_33bits_dts_pts(SrsBuffer* stream, uint8_t fb, int64_t v);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1295,7 +1295,7 @@ public:
|
|||
* of bytes of the section, starting immediately following the section_length field, and including the CRC. The value in this
|
||||
* field shall not exceed 1021 (0x3FD).
|
||||
*/
|
||||
u_int16_t section_length; //12bits
|
||||
uint16_t section_length; //12bits
|
||||
public:
|
||||
// the specified psi info, for example, PAT fields.
|
||||
public:
|
||||
|
@ -1371,7 +1371,7 @@ public:
|
|||
* This is a 16-bit field which serves as a label to identify this Transport Stream from any other
|
||||
* multiplex within a network. Its value is defined by the user.
|
||||
*/
|
||||
u_int16_t transport_stream_id; //16bits
|
||||
uint16_t transport_stream_id; //16bits
|
||||
|
||||
// 1B
|
||||
/**
|
||||
|
@ -1399,14 +1399,14 @@ public:
|
|||
* Program Association Table shall be 0x00. It shall be incremented by 1 with each additional section in the Program
|
||||
* Association Table.
|
||||
*/
|
||||
u_int8_t section_number; //8bits
|
||||
uint8_t section_number; //8bits
|
||||
|
||||
// 1B
|
||||
/**
|
||||
* This 8-bit field specifies the number of the last section (that is, the section with the highest
|
||||
* section_number) of the complete Program Association Table.
|
||||
*/
|
||||
u_int8_t last_section_number; //8bits
|
||||
uint8_t last_section_number; //8bits
|
||||
|
||||
// multiple 4B program data.
|
||||
std::vector<SrsTsPayloadPATProgram*> programs;
|
||||
|
@ -1488,7 +1488,7 @@ public:
|
|||
* can be concatenated together to form a continuous set of streams using a program_number. For examples of applications
|
||||
* refer to Annex C.
|
||||
*/
|
||||
u_int16_t program_number; //16bits
|
||||
uint16_t program_number; //16bits
|
||||
|
||||
// 1B
|
||||
/**
|
||||
|
@ -1514,13 +1514,13 @@ public:
|
|||
/**
|
||||
* The value of this 8-bit field shall be 0x00.
|
||||
*/
|
||||
u_int8_t section_number; //8bits
|
||||
uint8_t section_number; //8bits
|
||||
|
||||
// 1B
|
||||
/**
|
||||
* The value of this 8-bit field shall be 0x00.
|
||||
*/
|
||||
u_int8_t last_section_number; //8bits
|
||||
uint8_t last_section_number; //8bits
|
||||
|
||||
// 2B
|
||||
/**
|
||||
|
@ -1541,7 +1541,7 @@ public:
|
|||
* This is a 12-bit field, the first two bits of which shall be '00'. The remaining 10 bits specify the
|
||||
* number of bytes of the descriptors immediately following the program_info_length field.
|
||||
*/
|
||||
u_int16_t program_info_length; //12bits
|
||||
uint16_t program_info_length; //12bits
|
||||
char* program_info_desc; //[program_info_length]bytes
|
||||
|
||||
// array of TSPMTESInfo.
|
||||
|
|
|
@ -598,7 +598,7 @@ bool srs_aac_startswith_adts(SrsBuffer* stream)
|
|||
}
|
||||
|
||||
// @see http://www.stmc.edu.hk/~vincent/ffmpeg_0.4.9-pre1/libavformat/mpegtsenc.c
|
||||
unsigned int __mpegts_crc32(const u_int8_t *data, int len)
|
||||
unsigned int __mpegts_crc32(const uint8_t *data, int len)
|
||||
{
|
||||
/*
|
||||
* MPEG2 transport stream (aka DVB) mux
|
||||
|
@ -618,7 +618,7 @@ unsigned int __mpegts_crc32(const u_int8_t *data, int len)
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
static const u_int32_t table[256] = {
|
||||
static const uint32_t table[256] = {
|
||||
0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b,
|
||||
0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61,
|
||||
0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7,
|
||||
|
@ -664,7 +664,7 @@ unsigned int __mpegts_crc32(const u_int8_t *data, int len)
|
|||
0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4
|
||||
};
|
||||
|
||||
u_int32_t crc = 0xffffffff;
|
||||
uint32_t crc = 0xffffffff;
|
||||
|
||||
for (int i=0; i<len; i++) {
|
||||
crc = (crc << 8) ^ table[((crc >> 24) ^ *data++) & 0xff];
|
||||
|
@ -674,7 +674,7 @@ unsigned int __mpegts_crc32(const u_int8_t *data, int len)
|
|||
}
|
||||
|
||||
// @see https://github.com/ETrun/crc32/blob/master/crc32.c
|
||||
u_int32_t __crc32_ieee(u_int32_t init, const u_int8_t* buf, size_t nb_buf)
|
||||
uint32_t __crc32_ieee(uint32_t init, const uint8_t* buf, size_t nb_buf)
|
||||
{
|
||||
/*----------------------------------------------------------------------------*\
|
||||
* CRC-32 version 2.0.0 by Craig Bruce, 2006-04-29.
|
||||
|
@ -697,7 +697,7 @@ u_int32_t __crc32_ieee(u_int32_t init, const u_int8_t* buf, size_t nb_buf)
|
|||
* v2.0.0: rewrote to use memory buffer & static table, 2006-04-29.
|
||||
* v2.1.0: modified by Nico, 2013-04-20
|
||||
\*----------------------------------------------------------------------------*/
|
||||
static const u_int32_t table[256] = {
|
||||
static const uint32_t table[256] = {
|
||||
0x00000000,0x77073096,0xEE0E612C,0x990951BA,0x076DC419,0x706AF48F,0xE963A535,
|
||||
0x9E6495A3,0x0EDB8832,0x79DCB8A4,0xE0D5E91E,0x97D2D988,0x09B64C2B,0x7EB17CBD,
|
||||
0xE7B82D07,0x90BF1D91,0x1DB71064,0x6AB020F2,0xF3B97148,0x84BE41DE,0x1ADAD47D,
|
||||
|
@ -737,7 +737,7 @@ u_int32_t __crc32_ieee(u_int32_t init, const u_int8_t* buf, size_t nb_buf)
|
|||
0xB40BBE37,0xC30C8EA1,0x5A05DF1B,0x2D02EF8D
|
||||
};
|
||||
|
||||
u_int32_t crc = init ^ 0xFFFFFFFF;
|
||||
uint32_t crc = init ^ 0xFFFFFFFF;
|
||||
|
||||
for (size_t i = 0; i < nb_buf; i++) {
|
||||
crc = table[(crc ^ buf[i]) & 0xff] ^ (crc >> 8);
|
||||
|
@ -746,14 +746,14 @@ u_int32_t __crc32_ieee(u_int32_t init, const u_int8_t* buf, size_t nb_buf)
|
|||
return crc^0xFFFFFFFF;
|
||||
}
|
||||
|
||||
u_int32_t srs_crc32_mpegts(const void* buf, int size)
|
||||
uint32_t srs_crc32_mpegts(const void* buf, int size)
|
||||
{
|
||||
return __mpegts_crc32((const u_int8_t*)buf, size);
|
||||
return __mpegts_crc32((const uint8_t*)buf, size);
|
||||
}
|
||||
|
||||
u_int32_t srs_crc32_ieee(const void* buf, int size, u_int32_t previous)
|
||||
uint32_t srs_crc32_ieee(const void* buf, int size, uint32_t previous)
|
||||
{
|
||||
return __crc32_ieee(previous, (const u_int8_t*)buf, size);
|
||||
return __crc32_ieee(previous, (const uint8_t*)buf, size);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -782,19 +782,19 @@ u_int32_t srs_crc32_ieee(const void* buf, int size, u_int32_t previous)
|
|||
|
||||
#ifndef AV_RB32
|
||||
# define AV_RB32(x) \
|
||||
(((uint32_t)((const u_int8_t*)(x))[0] << 24) | \
|
||||
(((const u_int8_t*)(x))[1] << 16) | \
|
||||
(((const u_int8_t*)(x))[2] << 8) | \
|
||||
((const u_int8_t*)(x))[3])
|
||||
(((uint32_t)((const uint8_t*)(x))[0] << 24) | \
|
||||
(((const uint8_t*)(x))[1] << 16) | \
|
||||
(((const uint8_t*)(x))[2] << 8) | \
|
||||
((const uint8_t*)(x))[3])
|
||||
#endif
|
||||
|
||||
#ifndef AV_WL32
|
||||
# define AV_WL32(p, darg) do { \
|
||||
unsigned d = (darg); \
|
||||
((u_int8_t*)(p))[0] = (d); \
|
||||
((u_int8_t*)(p))[1] = (d)>>8; \
|
||||
((u_int8_t*)(p))[2] = (d)>>16; \
|
||||
((u_int8_t*)(p))[3] = (d)>>24; \
|
||||
((uint8_t*)(p))[0] = (d); \
|
||||
((uint8_t*)(p))[1] = (d)>>8; \
|
||||
((uint8_t*)(p))[2] = (d)>>16; \
|
||||
((uint8_t*)(p))[3] = (d)>>24; \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
|
@ -814,7 +814,7 @@ u_int32_t srs_crc32_ieee(const void* buf, int size, u_int32_t previous)
|
|||
#define AV_BSWAP32C(x) (AV_BSWAP16C(x) << 16 | AV_BSWAP16C((x) >> 16))
|
||||
|
||||
#ifndef av_bswap32
|
||||
static const u_int32_t av_bswap32(u_int32_t x)
|
||||
static const uint32_t av_bswap32(uint32_t x)
|
||||
{
|
||||
return AV_BSWAP32C(x);
|
||||
}
|
||||
|
@ -829,7 +829,7 @@ static const u_int32_t av_bswap32(u_int32_t x)
|
|||
*/
|
||||
|
||||
/* ---------------- private code */
|
||||
static const u_int8_t map2[256] =
|
||||
static const uint8_t map2[256] =
|
||||
{
|
||||
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
|
@ -875,12 +875,12 @@ static const u_int8_t map2[256] =
|
|||
v = i ? (v << 6) + bits : bits; \
|
||||
} while(0)
|
||||
|
||||
int srs_av_base64_decode(u_int8_t* out, const char* in_str, int out_size)
|
||||
int srs_av_base64_decode(uint8_t* out, const char* in_str, int out_size)
|
||||
{
|
||||
u_int8_t *dst = out;
|
||||
u_int8_t *end = out + out_size;
|
||||
uint8_t *dst = out;
|
||||
uint8_t *end = out + out_size;
|
||||
// no sign extension
|
||||
const u_int8_t *in = (const u_int8_t*)in_str;
|
||||
const uint8_t *in = (const uint8_t*)in_str;
|
||||
unsigned bits = 0xff;
|
||||
unsigned v;
|
||||
|
||||
|
@ -934,7 +934,7 @@ out0:
|
|||
* Fixed edge cases and made it work from data (vs. strings) by Ryan.
|
||||
*****************************************************************************/
|
||||
|
||||
char* srs_av_base64_encode(char* out, int out_size, const u_int8_t* in, int in_size)
|
||||
char* srs_av_base64_encode(char* out, int out_size, const uint8_t* in, int in_size)
|
||||
{
|
||||
static const char b64[] =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
@ -982,7 +982,7 @@ int av_toupper(int c)
|
|||
return c;
|
||||
}
|
||||
|
||||
int ff_hex_to_data(u_int8_t* data, const char* p)
|
||||
int ff_hex_to_data(uint8_t* data, const char* p)
|
||||
{
|
||||
int c, len, v;
|
||||
|
||||
|
@ -1011,7 +1011,7 @@ int ff_hex_to_data(u_int8_t* data, const char* p)
|
|||
}
|
||||
|
||||
int srs_chunk_header_c0(
|
||||
int perfer_cid, u_int32_t timestamp, int32_t payload_length,
|
||||
int perfer_cid, uint32_t timestamp, int32_t payload_length,
|
||||
int8_t message_type, int32_t stream_id,
|
||||
char* cache, int nb_cache
|
||||
) {
|
||||
|
@ -1089,7 +1089,7 @@ int srs_chunk_header_c0(
|
|||
}
|
||||
|
||||
int srs_chunk_header_c3(
|
||||
int perfer_cid, u_int32_t timestamp,
|
||||
int perfer_cid, uint32_t timestamp,
|
||||
char* cache, int nb_cache
|
||||
) {
|
||||
// to directly set the field.
|
||||
|
|
|
@ -129,12 +129,12 @@ extern bool srs_aac_startswith_adts(SrsBuffer* stream);
|
|||
/**
|
||||
* cacl the crc32 of bytes in buf, for ffmpeg.
|
||||
*/
|
||||
extern u_int32_t srs_crc32_mpegts(const void* buf, int size);
|
||||
extern uint32_t srs_crc32_mpegts(const void* buf, int size);
|
||||
|
||||
/**
|
||||
* calc the crc32 of bytes in buf by IEEE, for zip.
|
||||
*/
|
||||
extern u_int32_t srs_crc32_ieee(const void* buf, int size, u_int32_t previous = 0);
|
||||
extern uint32_t srs_crc32_ieee(const void* buf, int size, uint32_t previous = 0);
|
||||
|
||||
/**
|
||||
* Decode a base64-encoded string.
|
||||
|
@ -146,7 +146,7 @@ extern u_int32_t srs_crc32_ieee(const void* buf, int size, u_int32_t previous =
|
|||
* @return number of bytes written, or a negative value in case of
|
||||
* invalid input
|
||||
*/
|
||||
extern int srs_av_base64_decode(u_int8_t* out, const char* in, int out_size);
|
||||
extern int srs_av_base64_decode(uint8_t* out, const char* in, int out_size);
|
||||
|
||||
/**
|
||||
* Encode data to base64 and null-terminate.
|
||||
|
@ -158,7 +158,7 @@ extern int srs_av_base64_decode(u_int8_t* out, const char* in, int out_size);
|
|||
* @param in_size size in bytes of the in buffer
|
||||
* @return out or NULL in case of error
|
||||
*/
|
||||
extern char* srs_av_base64_encode(char* out, int out_size, const u_int8_t* in, int in_size);
|
||||
extern char* srs_av_base64_encode(char* out, int out_size, const uint8_t* in, int in_size);
|
||||
|
||||
/**
|
||||
* Calculate the output size needed to base64-encode x bytes to a
|
||||
|
@ -171,7 +171,7 @@ extern char* srs_av_base64_encode(char* out, int out_size, const u_int8_t* in, i
|
|||
* for example, p=config='139056E5A0'
|
||||
* output hex to data={0x13, 0x90, 0x56, 0xe5, 0xa0}
|
||||
*/
|
||||
extern int ff_hex_to_data(u_int8_t* data, const char* p);
|
||||
extern int ff_hex_to_data(uint8_t* data, const char* p);
|
||||
|
||||
/**
|
||||
* generate the c0 chunk header for msg.
|
||||
|
@ -180,7 +180,7 @@ extern int ff_hex_to_data(u_int8_t* data, const char* p);
|
|||
* @return the size of header. 0 if cache not enough.
|
||||
*/
|
||||
extern int srs_chunk_header_c0(
|
||||
int perfer_cid, u_int32_t timestamp, int32_t payload_length,
|
||||
int perfer_cid, uint32_t timestamp, int32_t payload_length,
|
||||
int8_t message_type, int32_t stream_id,
|
||||
char* cache, int nb_cache
|
||||
);
|
||||
|
@ -192,7 +192,7 @@ extern int srs_chunk_header_c0(
|
|||
* @return the size of header. 0 if cache not enough.
|
||||
*/
|
||||
extern int srs_chunk_header_c3(
|
||||
int perfer_cid, u_int32_t timestamp,
|
||||
int perfer_cid, uint32_t timestamp,
|
||||
char* cache, int nb_cache
|
||||
);
|
||||
|
||||
|
|
|
@ -1000,7 +1000,7 @@ int srs_rtmp_on_aggregate(Context* context, SrsCommonMessage* msg)
|
|||
}
|
||||
|
||||
int srs_rtmp_go_packet(Context* context, SrsCommonMessage* msg,
|
||||
char* type, u_int32_t* timestamp, char** data, int* size,
|
||||
char* type, uint32_t* timestamp, char** data, int* size,
|
||||
bool* got_msg
|
||||
) {
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
@ -1010,14 +1010,14 @@ int srs_rtmp_go_packet(Context* context, SrsCommonMessage* msg,
|
|||
|
||||
if (msg->header.is_audio()) {
|
||||
*type = SRS_RTMP_TYPE_AUDIO;
|
||||
*timestamp = (u_int32_t)msg->header.timestamp;
|
||||
*timestamp = (uint32_t)msg->header.timestamp;
|
||||
*data = (char*)msg->payload;
|
||||
*size = (int)msg->size;
|
||||
// detach bytes from packet.
|
||||
msg->payload = NULL;
|
||||
} else if (msg->header.is_video()) {
|
||||
*type = SRS_RTMP_TYPE_VIDEO;
|
||||
*timestamp = (u_int32_t)msg->header.timestamp;
|
||||
*timestamp = (uint32_t)msg->header.timestamp;
|
||||
*data = (char*)msg->payload;
|
||||
*size = (int)msg->size;
|
||||
// detach bytes from packet.
|
||||
|
@ -1044,7 +1044,7 @@ int srs_rtmp_go_packet(Context* context, SrsCommonMessage* msg,
|
|||
return ret;
|
||||
}
|
||||
|
||||
int srs_rtmp_read_packet(srs_rtmp_t rtmp, char* type, u_int32_t* timestamp, char** data, int* size)
|
||||
int srs_rtmp_read_packet(srs_rtmp_t rtmp, char* type, uint32_t* timestamp, char** data, int* size)
|
||||
{
|
||||
*type = 0;
|
||||
*timestamp = 0;
|
||||
|
@ -1093,7 +1093,7 @@ int srs_rtmp_read_packet(srs_rtmp_t rtmp, char* type, u_int32_t* timestamp, char
|
|||
return ret;
|
||||
}
|
||||
|
||||
int srs_rtmp_write_packet(srs_rtmp_t rtmp, char type, u_int32_t timestamp, char* data, int size)
|
||||
int srs_rtmp_write_packet(srs_rtmp_t rtmp, char type, uint32_t timestamp, char* data, int size)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -1154,7 +1154,7 @@ srs_bool srs_rtmp_is_onMetaData(char type, char* data, int size)
|
|||
* directly write a audio frame.
|
||||
*/
|
||||
int srs_write_audio_raw_frame(Context* context,
|
||||
char* frame, int frame_size, SrsRawAacStreamCodec* codec, u_int32_t timestamp
|
||||
char* frame, int frame_size, SrsRawAacStreamCodec* codec, uint32_t timestamp
|
||||
) {
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -1171,7 +1171,7 @@ int srs_write_audio_raw_frame(Context* context,
|
|||
* write aac frame in adts.
|
||||
*/
|
||||
int srs_write_aac_adts_frame(Context* context,
|
||||
SrsRawAacStreamCodec* codec, char* frame, int frame_size, u_int32_t timestamp
|
||||
SrsRawAacStreamCodec* codec, char* frame, int frame_size, uint32_t timestamp
|
||||
) {
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -1199,7 +1199,7 @@ int srs_write_aac_adts_frame(Context* context,
|
|||
*/
|
||||
int srs_write_aac_adts_frames(Context* context,
|
||||
char sound_format, char sound_rate, char sound_size, char sound_type,
|
||||
char* frames, int frames_size, u_int32_t timestamp
|
||||
char* frames, int frames_size, uint32_t timestamp
|
||||
) {
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -1235,7 +1235,7 @@ int srs_write_aac_adts_frames(Context* context,
|
|||
*/
|
||||
int srs_audio_write_raw_frame(srs_rtmp_t rtmp,
|
||||
char sound_format, char sound_rate, char sound_size, char sound_type,
|
||||
char* frame, int frame_size, u_int32_t timestamp
|
||||
char* frame, int frame_size, uint32_t timestamp
|
||||
) {
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -1315,7 +1315,7 @@ int srs_aac_adts_frame_size(char* aac_raw_data, int ac_raw_size)
|
|||
* write h264 IPB-frame.
|
||||
*/
|
||||
int srs_write_h264_ipb_frame(Context* context,
|
||||
char* frame, int frame_size, u_int32_t dts, u_int32_t pts
|
||||
char* frame, int frame_size, uint32_t dts, uint32_t pts
|
||||
) {
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -1357,14 +1357,14 @@ int srs_write_h264_ipb_frame(Context* context,
|
|||
}
|
||||
|
||||
// the timestamp in rtmp message header is dts.
|
||||
u_int32_t timestamp = dts;
|
||||
uint32_t timestamp = dts;
|
||||
return srs_rtmp_write_packet(context, SRS_RTMP_TYPE_VIDEO, timestamp, flv, nb_flv);
|
||||
}
|
||||
|
||||
/**
|
||||
* write the h264 sps/pps in context over RTMP.
|
||||
*/
|
||||
int srs_write_h264_sps_pps(Context* context, u_int32_t dts, u_int32_t pts)
|
||||
int srs_write_h264_sps_pps(Context* context, uint32_t dts, uint32_t pts)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -1394,7 +1394,7 @@ int srs_write_h264_sps_pps(Context* context, u_int32_t dts, u_int32_t pts)
|
|||
context->h264_sps_pps_sent = true;
|
||||
|
||||
// the timestamp in rtmp message header is dts.
|
||||
u_int32_t timestamp = dts;
|
||||
uint32_t timestamp = dts;
|
||||
return srs_rtmp_write_packet(context, SRS_RTMP_TYPE_VIDEO, timestamp, flv, nb_flv);
|
||||
}
|
||||
|
||||
|
@ -1402,7 +1402,7 @@ int srs_write_h264_sps_pps(Context* context, u_int32_t dts, u_int32_t pts)
|
|||
* write h264 raw frame, maybe sps/pps/IPB-frame.
|
||||
*/
|
||||
int srs_write_h264_raw_frame(Context* context,
|
||||
char* frame, int frame_size, u_int32_t dts, u_int32_t pts
|
||||
char* frame, int frame_size, uint32_t dts, uint32_t pts
|
||||
) {
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -1468,7 +1468,7 @@ int srs_write_h264_raw_frame(Context* context,
|
|||
* write h264 multiple frames, in annexb format.
|
||||
*/
|
||||
int srs_h264_write_raw_frames(srs_rtmp_t rtmp,
|
||||
char* frames, int frames_size, u_int32_t dts, u_int32_t pts
|
||||
char* frames, int frames_size, uint32_t dts, uint32_t pts
|
||||
) {
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -1644,7 +1644,7 @@ int srs_flv_read_header(srs_flv_t flv, char header[9])
|
|||
return ret;
|
||||
}
|
||||
|
||||
int srs_flv_read_tag_header(srs_flv_t flv, char* ptype, int32_t* pdata_size, u_int32_t* ptime)
|
||||
int srs_flv_read_tag_header(srs_flv_t flv, char* ptype, int32_t* pdata_size, uint32_t* ptime)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -2075,8 +2075,8 @@ int64_t srs_utils_recv_bytes(srs_rtmp_t rtmp)
|
|||
}
|
||||
|
||||
int srs_utils_parse_timestamp(
|
||||
u_int32_t time, char type, char* data, int size,
|
||||
u_int32_t* ppts
|
||||
uint32_t time, char type, char* data, int size,
|
||||
uint32_t* ppts
|
||||
) {
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -2103,7 +2103,7 @@ int srs_utils_parse_timestamp(
|
|||
return ERROR_FLV_INVALID_VIDEO_TAG;
|
||||
}
|
||||
|
||||
u_int32_t cts = 0;
|
||||
uint32_t cts = 0;
|
||||
char* p = data + 2;
|
||||
char* pp = (char*)&cts;
|
||||
pp[2] = *p++;
|
||||
|
@ -2157,7 +2157,7 @@ char srs_utils_flv_video_avc_packet_type(char* data, int size)
|
|||
return -1;
|
||||
}
|
||||
|
||||
u_int8_t avc_packet_type = data[1];
|
||||
uint8_t avc_packet_type = data[1];
|
||||
|
||||
if (avc_packet_type > 2) {
|
||||
return -1;
|
||||
|
@ -2176,7 +2176,7 @@ char srs_utils_flv_video_frame_type(char* data, int size)
|
|||
return -1;
|
||||
}
|
||||
|
||||
u_int8_t frame_type = data[0];
|
||||
uint8_t frame_type = data[0];
|
||||
frame_type = (frame_type >> 4) & 0x0f;
|
||||
if (frame_type < 1 || frame_type > 5) {
|
||||
return -1;
|
||||
|
@ -2191,7 +2191,7 @@ char srs_utils_flv_audio_sound_format(char* data, int size)
|
|||
return -1;
|
||||
}
|
||||
|
||||
u_int8_t sound_format = data[0];
|
||||
uint8_t sound_format = data[0];
|
||||
sound_format = (sound_format >> 4) & 0x0f;
|
||||
if (sound_format > 15 || sound_format == 12 || sound_format == 13) {
|
||||
return -1;
|
||||
|
@ -2206,7 +2206,7 @@ char srs_utils_flv_audio_sound_rate(char* data, int size)
|
|||
return -1;
|
||||
}
|
||||
|
||||
u_int8_t sound_rate = data[0];
|
||||
uint8_t sound_rate = data[0];
|
||||
sound_rate = (sound_rate >> 2) & 0x03;
|
||||
if (sound_rate > 3) {
|
||||
return -1;
|
||||
|
@ -2221,7 +2221,7 @@ char srs_utils_flv_audio_sound_size(char* data, int size)
|
|||
return -1;
|
||||
}
|
||||
|
||||
u_int8_t sound_size = data[0];
|
||||
uint8_t sound_size = data[0];
|
||||
sound_size = (sound_size >> 1) & 0x01;
|
||||
if (sound_size > 1) {
|
||||
return -1;
|
||||
|
@ -2236,7 +2236,7 @@ char srs_utils_flv_audio_sound_type(char* data, int size)
|
|||
return -1;
|
||||
}
|
||||
|
||||
u_int8_t sound_type = data[0];
|
||||
uint8_t sound_type = data[0];
|
||||
sound_type = sound_type & 0x01;
|
||||
if (sound_type > 1) {
|
||||
return -1;
|
||||
|
@ -2255,7 +2255,7 @@ char srs_utils_flv_audio_aac_packet_type(char* data, int size)
|
|||
return -1;
|
||||
}
|
||||
|
||||
u_int8_t aac_packet_type = data[1];
|
||||
uint8_t aac_packet_type = data[1];
|
||||
if (aac_packet_type > 1) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -2455,22 +2455,22 @@ const char* srs_human_flv_audio_aac_packet_type2string(char aac_packet_type)
|
|||
return unknown;
|
||||
}
|
||||
|
||||
int srs_human_print_rtmp_packet(char type, u_int32_t timestamp, char* data, int size)
|
||||
int srs_human_print_rtmp_packet(char type, uint32_t timestamp, char* data, int size)
|
||||
{
|
||||
return srs_human_print_rtmp_packet2(type, timestamp, data, size, 0);
|
||||
}
|
||||
|
||||
int srs_human_print_rtmp_packet2(char type, u_int32_t timestamp, char* data, int size, u_int32_t pre_timestamp)
|
||||
int srs_human_print_rtmp_packet2(char type, uint32_t timestamp, char* data, int size, uint32_t pre_timestamp)
|
||||
{
|
||||
return srs_human_print_rtmp_packet3(type, timestamp, data, size, pre_timestamp, 0);
|
||||
}
|
||||
|
||||
int srs_human_print_rtmp_packet3(char type, u_int32_t timestamp, char* data, int size, u_int32_t pre_timestamp, int64_t pre_now)
|
||||
int srs_human_print_rtmp_packet3(char type, uint32_t timestamp, char* data, int size, uint32_t pre_timestamp, int64_t pre_now)
|
||||
{
|
||||
return srs_human_print_rtmp_packet4(type, timestamp, data, size, pre_timestamp, pre_now, 0, 0);
|
||||
}
|
||||
|
||||
int srs_human_print_rtmp_packet4(char type, u_int32_t timestamp, char* data, int size, u_int32_t pre_timestamp, int64_t pre_now, int64_t starttime, int64_t nb_packets)
|
||||
int srs_human_print_rtmp_packet4(char type, uint32_t timestamp, char* data, int size, uint32_t pre_timestamp, int64_t pre_now, int64_t starttime, int64_t nb_packets)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -2496,7 +2496,7 @@ int srs_human_print_rtmp_packet4(char type, u_int32_t timestamp, char* data, int
|
|||
ndiff = (int)(srs_utils_time_ms() - pre_now);
|
||||
}
|
||||
|
||||
u_int32_t pts;
|
||||
uint32_t pts;
|
||||
if (srs_utils_parse_timestamp(timestamp, type, data, size, &pts) != 0) {
|
||||
srs_human_trace("Rtmp packet id=%"PRId64"/%.1f/%.1f, type=%s, dts=%d, ndiff=%d, diff=%d, size=%d, DecodeError",
|
||||
nb_packets, pi, gfps, srs_human_flv_tag_type2string(type), timestamp, ndiff, diff, size
|
||||
|
|
|
@ -47,13 +47,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include <windows.h>
|
||||
// the type used by this header for windows.
|
||||
typedef unsigned long long u_int64_t;
|
||||
typedef u_int64_t uint64_t;
|
||||
typedef long long int64_t;
|
||||
typedef unsigned int u_int32_t;
|
||||
typedef u_int32_t uint32_t;
|
||||
typedef int int32_t;
|
||||
typedef unsigned char u_int8_t;
|
||||
typedef u_int8_t uint8_t;
|
||||
typedef char int8_t;
|
||||
typedef unsigned short u_int16_t;
|
||||
typedef u_int16_t uint16_t;
|
||||
typedef short int16_t;
|
||||
typedef int64_t ssize_t;
|
||||
struct iovec {
|
||||
|
@ -297,10 +300,10 @@ extern int srs_rtmp_bandwidth_check(srs_rtmp_t rtmp,
|
|||
* @return 0, success; otherswise, failed.
|
||||
*/
|
||||
extern int srs_rtmp_read_packet(srs_rtmp_t rtmp,
|
||||
char* type, u_int32_t* timestamp, char** data, int* size
|
||||
char* type, uint32_t* timestamp, char** data, int* size
|
||||
);
|
||||
extern int srs_rtmp_write_packet(srs_rtmp_t rtmp,
|
||||
char type, u_int32_t timestamp, char* data, int size
|
||||
char type, uint32_t timestamp, char* data, int size
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -371,7 +374,7 @@ extern srs_bool srs_rtmp_is_onMetaData(char type, char* data, int size);
|
|||
*/
|
||||
extern int srs_audio_write_raw_frame(srs_rtmp_t rtmp,
|
||||
char sound_format, char sound_rate, char sound_size, char sound_type,
|
||||
char* frame, int frame_size, u_int32_t timestamp
|
||||
char* frame, int frame_size, uint32_t timestamp
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -457,7 +460,7 @@ User also can send one by one:
|
|||
srs_h264_write_raw_frames('0000000141E02041F8CDDC562BBDEFAD2F......', size, dts, pts)
|
||||
*/
|
||||
extern int srs_h264_write_raw_frames(srs_rtmp_t rtmp,
|
||||
char* frames, int frames_size, u_int32_t dts, u_int32_t pts
|
||||
char* frames, int frames_size, uint32_t dts, uint32_t pts
|
||||
);
|
||||
/**
|
||||
* whether error_code is dvbsp(drop video before sps/pps/sequence-header) error.
|
||||
|
@ -553,7 +556,7 @@ extern int srs_flv_read_header(srs_flv_t flv, char header[9]);
|
|||
* @remark, user must ensure the next is a tag, srs never check it.
|
||||
*/
|
||||
extern int srs_flv_read_tag_header(srs_flv_t flv,
|
||||
char* ptype, int32_t* pdata_size, u_int32_t* ptime
|
||||
char* ptype, int32_t* pdata_size, uint32_t* ptime
|
||||
);
|
||||
/**
|
||||
* read the tag data. drop the 4bytes previous tag size
|
||||
|
@ -707,8 +710,8 @@ extern int64_t srs_utils_recv_bytes(srs_rtmp_t rtmp);
|
|||
* @remark, video only support h.264.
|
||||
*/
|
||||
extern int srs_utils_parse_timestamp(
|
||||
u_int32_t time, char type, char* data, int size,
|
||||
u_int32_t* ppts
|
||||
uint32_t time, char type, char* data, int size,
|
||||
uint32_t* ppts
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -957,20 +960,20 @@ extern const char* srs_human_flv_audio_aac_packet_type2string(char aac_packet_ty
|
|||
* and use srs_human_raw for script data body.
|
||||
* @return an error code for parse the timetstamp to dts and pts.
|
||||
*/
|
||||
extern int srs_human_print_rtmp_packet(char type, u_int32_t timestamp, char* data, int size);
|
||||
extern int srs_human_print_rtmp_packet(char type, uint32_t timestamp, char* data, int size);
|
||||
/**
|
||||
* @param pre_timestamp the previous timestamp in ms to calc the diff.
|
||||
*/
|
||||
extern int srs_human_print_rtmp_packet2(char type, u_int32_t timestamp, char* data, int size, u_int32_t pre_timestamp);
|
||||
extern int srs_human_print_rtmp_packet2(char type, uint32_t timestamp, char* data, int size, uint32_t pre_timestamp);
|
||||
/**
|
||||
* @param pre_now the previous system time in ms to calc the ndiff.
|
||||
*/
|
||||
extern int srs_human_print_rtmp_packet3(char type, u_int32_t timestamp, char* data, int size, u_int32_t pre_timestamp, int64_t pre_now);
|
||||
extern int srs_human_print_rtmp_packet3(char type, uint32_t timestamp, char* data, int size, uint32_t pre_timestamp, int64_t pre_now);
|
||||
/**
|
||||
* @param starttime the rtmpdump starttime in ms.
|
||||
* @param nb_packets the number of packets received, to calc the packets interval in ms.
|
||||
*/
|
||||
extern int srs_human_print_rtmp_packet4(char type, u_int32_t timestamp, char* data, int size, u_int32_t pre_timestamp, int64_t pre_now, int64_t starttime, int64_t nb_packets);
|
||||
extern int srs_human_print_rtmp_packet4(char type, uint32_t timestamp, char* data, int size, uint32_t pre_timestamp, int64_t pre_now, int64_t starttime, int64_t nb_packets);
|
||||
|
||||
// log to console, for use srs-librtmp application.
|
||||
extern const char* srs_human_format_time();
|
||||
|
|
|
@ -322,9 +322,9 @@ int SrsIngestSrsInput::parseAac(ISrsAacHandler* handler, char* body, int nb_body
|
|||
return ret;
|
||||
}
|
||||
|
||||
u_int8_t id0 = (u_int8_t)body[0];
|
||||
u_int8_t id1 = (u_int8_t)body[1];
|
||||
u_int8_t id2 = (u_int8_t)body[2];
|
||||
uint8_t id0 = (uint8_t)body[0];
|
||||
uint8_t id1 = (uint8_t)body[1];
|
||||
uint8_t id2 = (uint8_t)body[2];
|
||||
|
||||
// skip ID3.
|
||||
if (id0 == 0x49 && id1 == 0x44 && id2 == 0x33) {
|
||||
|
@ -348,7 +348,7 @@ int SrsIngestSrsInput::parseAac(ISrsAacHandler* handler, char* body, int nb_body
|
|||
// ignore ID3 + version + flag.
|
||||
stream->skip(6);
|
||||
// read the size of ID3.
|
||||
u_int32_t nb_id3 = stream->read_4bytes();
|
||||
uint32_t nb_id3 = stream->read_4bytes();
|
||||
|
||||
// read body of ID3
|
||||
if (!stream->require(nb_id3)) {
|
||||
|
@ -652,12 +652,12 @@ private:
|
|||
virtual int do_on_aac_frame(SrsBuffer* avs, double duration);
|
||||
virtual int parse_message_queue();
|
||||
virtual int on_ts_video(SrsTsMessage* msg, SrsBuffer* avs);
|
||||
virtual int write_h264_sps_pps(u_int32_t dts, u_int32_t pts);
|
||||
virtual int write_h264_ipb_frame(std::string ibps, SrsCodecVideoAVCFrame frame_type, u_int32_t dts, u_int32_t pts);
|
||||
virtual int write_h264_sps_pps(uint32_t dts, uint32_t pts);
|
||||
virtual int write_h264_ipb_frame(std::string ibps, SrsCodecVideoAVCFrame frame_type, uint32_t dts, uint32_t pts);
|
||||
virtual int on_ts_audio(SrsTsMessage* msg, SrsBuffer* avs);
|
||||
virtual int write_audio_raw_frame(char* frame, int frame_size, SrsRawAacStreamCodec* codec, u_int32_t dts);
|
||||
virtual int write_audio_raw_frame(char* frame, int frame_size, SrsRawAacStreamCodec* codec, uint32_t dts);
|
||||
private:
|
||||
virtual int rtmp_write_packet(char type, u_int32_t timestamp, char* data, int size);
|
||||
virtual int rtmp_write_packet(char type, uint32_t timestamp, char* data, int size);
|
||||
public:
|
||||
/**
|
||||
* connect to output rtmp server.
|
||||
|
@ -797,14 +797,14 @@ int SrsIngestSrsOutput::do_on_aac_frame(SrsBuffer* avs, double duration)
|
|||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
u_int32_t duration_ms = (u_int32_t)(duration * 1000);
|
||||
uint32_t duration_ms = (uint32_t)(duration * 1000);
|
||||
|
||||
// ts tbn to flv tbn.
|
||||
u_int32_t dts = (u_int32_t)raw_aac_dts;
|
||||
uint32_t dts = (uint32_t)raw_aac_dts;
|
||||
raw_aac_dts += duration_ms;
|
||||
|
||||
// got the next msg to calc the delta duration for each audio.
|
||||
u_int32_t max_dts = dts + duration_ms;
|
||||
uint32_t max_dts = dts + duration_ms;
|
||||
|
||||
// send each frame.
|
||||
while (!avs->empty()) {
|
||||
|
@ -844,8 +844,8 @@ int SrsIngestSrsOutput::do_on_aac_frame(SrsBuffer* avs, double duration)
|
|||
}
|
||||
|
||||
// calc the delta of dts, when previous frame output.
|
||||
u_int32_t delta = duration_ms / (avs->size() / frame_size);
|
||||
dts = (u_int32_t)(srs_min(max_dts, dts + delta));
|
||||
uint32_t delta = duration_ms / (avs->size() / frame_size);
|
||||
dts = (uint32_t)(srs_min(max_dts, dts + delta));
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -955,8 +955,8 @@ int SrsIngestSrsOutput::on_ts_video(SrsTsMessage* msg, SrsBuffer* avs)
|
|||
int ret = ERROR_SUCCESS;
|
||||
|
||||
// ts tbn to flv tbn.
|
||||
u_int32_t dts = (u_int32_t)(msg->dts / 90);
|
||||
u_int32_t pts = (u_int32_t)(msg->dts / 90);
|
||||
uint32_t dts = (uint32_t)(msg->dts / 90);
|
||||
uint32_t pts = (uint32_t)(msg->dts / 90);
|
||||
|
||||
std::string ibps;
|
||||
SrsCodecVideoAVCFrame frame_type = SrsCodecVideoAVCFrameInterFrame;
|
||||
|
@ -1037,7 +1037,7 @@ int SrsIngestSrsOutput::on_ts_video(SrsTsMessage* msg, SrsBuffer* avs)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsIngestSrsOutput::write_h264_sps_pps(u_int32_t dts, u_int32_t pts)
|
||||
int SrsIngestSrsOutput::write_h264_sps_pps(uint32_t dts, uint32_t pts)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -1069,7 +1069,7 @@ int SrsIngestSrsOutput::write_h264_sps_pps(u_int32_t dts, u_int32_t pts)
|
|||
}
|
||||
|
||||
// the timestamp in rtmp message header is dts.
|
||||
u_int32_t timestamp = dts;
|
||||
uint32_t timestamp = dts;
|
||||
if ((ret = rtmp_write_packet(SrsCodecFlvTagVideo, timestamp, flv, nb_flv)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
@ -1083,7 +1083,7 @@ int SrsIngestSrsOutput::write_h264_sps_pps(u_int32_t dts, u_int32_t pts)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsIngestSrsOutput::write_h264_ipb_frame(string ibps, SrsCodecVideoAVCFrame frame_type, u_int32_t dts, u_int32_t pts)
|
||||
int SrsIngestSrsOutput::write_h264_ipb_frame(string ibps, SrsCodecVideoAVCFrame frame_type, uint32_t dts, uint32_t pts)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -1101,7 +1101,7 @@ int SrsIngestSrsOutput::write_h264_ipb_frame(string ibps, SrsCodecVideoAVCFrame
|
|||
}
|
||||
|
||||
// the timestamp in rtmp message header is dts.
|
||||
u_int32_t timestamp = dts;
|
||||
uint32_t timestamp = dts;
|
||||
return rtmp_write_packet(SrsCodecFlvTagVideo, timestamp, flv, nb_flv);
|
||||
}
|
||||
|
||||
|
@ -1110,15 +1110,15 @@ int SrsIngestSrsOutput::on_ts_audio(SrsTsMessage* msg, SrsBuffer* avs)
|
|||
int ret = ERROR_SUCCESS;
|
||||
|
||||
// ts tbn to flv tbn.
|
||||
u_int32_t dts = (u_int32_t)(msg->dts / 90);
|
||||
uint32_t dts = (uint32_t)(msg->dts / 90);
|
||||
|
||||
// got the next msg to calc the delta duration for each audio.
|
||||
u_int32_t duration = 0;
|
||||
uint32_t duration = 0;
|
||||
if (!queue.empty()) {
|
||||
SrsTsMessage* nm = queue.begin()->second;
|
||||
duration = (u_int32_t)(srs_max(0, nm->dts - msg->dts) / 90);
|
||||
duration = (uint32_t)(srs_max(0, nm->dts - msg->dts) / 90);
|
||||
}
|
||||
u_int32_t max_dts = dts + duration;
|
||||
uint32_t max_dts = dts + duration;
|
||||
|
||||
// send each frame.
|
||||
while (!avs->empty()) {
|
||||
|
@ -1158,14 +1158,14 @@ int SrsIngestSrsOutput::on_ts_audio(SrsTsMessage* msg, SrsBuffer* avs)
|
|||
}
|
||||
|
||||
// calc the delta of dts, when previous frame output.
|
||||
u_int32_t delta = duration / (msg->payload->length() / frame_size);
|
||||
dts = (u_int32_t)(srs_min(max_dts, dts + delta));
|
||||
uint32_t delta = duration / (msg->payload->length() / frame_size);
|
||||
dts = (uint32_t)(srs_min(max_dts, dts + delta));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int SrsIngestSrsOutput::write_audio_raw_frame(char* frame, int frame_size, SrsRawAacStreamCodec* codec, u_int32_t dts)
|
||||
int SrsIngestSrsOutput::write_audio_raw_frame(char* frame, int frame_size, SrsRawAacStreamCodec* codec, uint32_t dts)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -1178,7 +1178,7 @@ int SrsIngestSrsOutput::write_audio_raw_frame(char* frame, int frame_size, SrsRa
|
|||
return rtmp_write_packet(SrsCodecFlvTagAudio, dts, data, size);
|
||||
}
|
||||
|
||||
int SrsIngestSrsOutput::rtmp_write_packet(char type, u_int32_t timestamp, char* data, int size)
|
||||
int SrsIngestSrsOutput::rtmp_write_packet(char type, uint32_t timestamp, char* data, int size)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
|
|
@ -501,8 +501,8 @@ public:
|
|||
*/
|
||||
virtual char* http_ts_send_buffer();
|
||||
public:
|
||||
virtual u_int8_t method() = 0;
|
||||
virtual u_int16_t status_code() = 0;
|
||||
virtual uint8_t method() = 0;
|
||||
virtual uint16_t status_code() = 0;
|
||||
/**
|
||||
* method helpers.
|
||||
*/
|
||||
|
|
|
@ -212,7 +212,7 @@ void SrsKafkaBytes::set_value(const char* v, int nb_v)
|
|||
memcpy(_data, v, _size);
|
||||
}
|
||||
|
||||
u_int32_t SrsKafkaBytes::crc32(u_int32_t previous)
|
||||
uint32_t SrsKafkaBytes::crc32(uint32_t previous)
|
||||
{
|
||||
char bsize[4];
|
||||
SrsBuffer(bsize, 4).write_4bytes(_size);
|
||||
|
@ -221,7 +221,7 @@ u_int32_t SrsKafkaBytes::crc32(u_int32_t previous)
|
|||
return srs_crc32_ieee(bsize, 4, previous);
|
||||
}
|
||||
|
||||
u_int32_t crc = srs_crc32_ieee(bsize, 4, previous);
|
||||
uint32_t crc = srs_crc32_ieee(bsize, 4, previous);
|
||||
crc = srs_crc32_ieee(_data, _size, crc);
|
||||
|
||||
return crc;
|
||||
|
|
|
@ -108,7 +108,7 @@ public:
|
|||
virtual bool empty();
|
||||
virtual void set_value(std::string v);
|
||||
virtual void set_value(const char* v, int nb_v);
|
||||
virtual u_int32_t crc32(u_int32_t previous);
|
||||
virtual uint32_t crc32(uint32_t previous);
|
||||
// interface ISrsCodec
|
||||
public:
|
||||
virtual int nb_bytes();
|
||||
|
|
|
@ -197,8 +197,8 @@ string srs_generate_vis_tc_url(string ip, string vhost, string app, int port)
|
|||
*/
|
||||
bool srs_bytes_equals(void* pa, void* pb, int size)
|
||||
{
|
||||
u_int8_t* a = (u_int8_t*)pa;
|
||||
u_int8_t* b = (u_int8_t*)pb;
|
||||
uint8_t* a = (uint8_t*)pa;
|
||||
uint8_t* b = (uint8_t*)pb;
|
||||
|
||||
if (!a && !b) {
|
||||
return true;
|
||||
|
@ -218,7 +218,7 @@ bool srs_bytes_equals(void* pa, void* pb, int size)
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
int srs_do_rtmp_create_msg(char type, u_int32_t timestamp, char* data, int size, int stream_id, T** ppmsg)
|
||||
int srs_do_rtmp_create_msg(char type, uint32_t timestamp, char* data, int size, int stream_id, T** ppmsg)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -263,7 +263,7 @@ int srs_do_rtmp_create_msg(char type, u_int32_t timestamp, char* data, int size,
|
|||
return ret;
|
||||
}
|
||||
|
||||
int srs_rtmp_create_msg(char type, u_int32_t timestamp, char* data, int size, int stream_id, SrsSharedPtrMessage** ppmsg)
|
||||
int srs_rtmp_create_msg(char type, uint32_t timestamp, char* data, int size, int stream_id, SrsSharedPtrMessage** ppmsg)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -276,7 +276,7 @@ int srs_rtmp_create_msg(char type, u_int32_t timestamp, char* data, int size, in
|
|||
return ret;
|
||||
}
|
||||
|
||||
int srs_rtmp_create_msg(char type, u_int32_t timestamp, char* data, int size, int stream_id, SrsCommonMessage** ppmsg)
|
||||
int srs_rtmp_create_msg(char type, uint32_t timestamp, char* data, int size, int stream_id, SrsCommonMessage** ppmsg)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
|
|
@ -115,11 +115,11 @@ extern bool srs_bytes_equals(void* pa, void* pb, int size);
|
|||
* @param ppmsg output the shared ptr message. user should free it.
|
||||
*/
|
||||
extern int srs_rtmp_create_msg(
|
||||
char type, u_int32_t timestamp, char* data, int size, int stream_id,
|
||||
char type, uint32_t timestamp, char* data, int size, int stream_id,
|
||||
SrsSharedPtrMessage** ppmsg
|
||||
);
|
||||
extern int srs_rtmp_create_msg(
|
||||
char type, u_int32_t timestamp, char* data, int size, int stream_id,
|
||||
char type, uint32_t timestamp, char* data, int size, int stream_id,
|
||||
SrsCommonMessage** ppmsg
|
||||
);
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ bool SrsRawH264Stream::is_sps(char* frame, int nb_frame)
|
|||
// 5bits, 7.3.1 NAL unit syntax,
|
||||
// ISO_IEC_14496-10-AVC-2003.pdf, page 44.
|
||||
// 7: SPS, 8: PPS, 5: I Frame, 1: P Frame
|
||||
u_int8_t nal_unit_type = (char)frame[0] & 0x1f;
|
||||
uint8_t nal_unit_type = (char)frame[0] & 0x1f;
|
||||
|
||||
return nal_unit_type == 7;
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ bool SrsRawH264Stream::is_pps(char* frame, int nb_frame)
|
|||
// 5bits, 7.3.1 NAL unit syntax,
|
||||
// ISO_IEC_14496-10-AVC-2003.pdf, page 44.
|
||||
// 7: SPS, 8: PPS, 5: I Frame, 1: P Frame
|
||||
u_int8_t nal_unit_type = (char)frame[0] & 0x1f;
|
||||
uint8_t nal_unit_type = (char)frame[0] & 0x1f;
|
||||
|
||||
return nal_unit_type == 8;
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ int SrsRawH264Stream::pps_demux(char* frame, int nb_frame, string& pps)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsRawH264Stream::mux_sequence_header(string sps, string pps, u_int32_t dts, u_int32_t pts, string& sh)
|
||||
int SrsRawH264Stream::mux_sequence_header(string sps, string pps, uint32_t dts, uint32_t pts, string& sh)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -175,9 +175,9 @@ int SrsRawH264Stream::mux_sequence_header(string sps, string pps, u_int32_t dts,
|
|||
// Baseline profile profile_idc is 66(0x42).
|
||||
// Main profile profile_idc is 77(0x4d).
|
||||
// Extended profile profile_idc is 88(0x58).
|
||||
u_int8_t profile_idc = frame[1];
|
||||
//u_int8_t constraint_set = frame[2];
|
||||
u_int8_t level_idc = frame[3];
|
||||
uint8_t profile_idc = frame[1];
|
||||
//uint8_t constraint_set = frame[2];
|
||||
uint8_t level_idc = frame[3];
|
||||
|
||||
// generate the sps/pps header
|
||||
// 5.3.4.2.1 Syntax, ISO_IEC_14496-15-AVC-format-2012.pdf, page 16
|
||||
|
@ -246,7 +246,7 @@ int SrsRawH264Stream::mux_ipb_frame(char* frame, int nb_frame, string& ibp)
|
|||
|
||||
// 5.3.4.2.1 Syntax, ISO_IEC_14496-15-AVC-format-2012.pdf, page 16
|
||||
// lengthSizeMinusOne, or NAL_unit_length, always use 4bytes size
|
||||
u_int32_t NAL_unit_length = nb_frame;
|
||||
uint32_t NAL_unit_length = nb_frame;
|
||||
|
||||
// mux the avc NALU in "ISO Base Media File Format"
|
||||
// from ISO_IEC_14496-15-AVC-format-2012.pdf, page 20
|
||||
|
@ -261,7 +261,7 @@ int SrsRawH264Stream::mux_ipb_frame(char* frame, int nb_frame, string& ibp)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsRawH264Stream::mux_avc2flv(string video, int8_t frame_type, int8_t avc_packet_type, u_int32_t dts, u_int32_t pts, char** flv, int* nb_flv)
|
||||
int SrsRawH264Stream::mux_avc2flv(string video, int8_t frame_type, int8_t avc_packet_type, uint32_t dts, uint32_t pts, char** flv, int* nb_flv)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -287,7 +287,7 @@ int SrsRawH264Stream::mux_avc2flv(string video, int8_t frame_type, int8_t avc_pa
|
|||
// pts = dts + cts, or
|
||||
// cts = pts - dts.
|
||||
// where cts is the header in rtmp video packet payload header.
|
||||
u_int32_t cts = pts - dts;
|
||||
uint32_t cts = pts - dts;
|
||||
char* pp = (char*)&cts;
|
||||
*p++ = pp[2];
|
||||
*p++ = pp[1];
|
||||
|
@ -518,7 +518,7 @@ int SrsRawAacStream::mux_sequence_header(SrsRawAacStreamCodec* codec, string& sh
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsRawAacStream::mux_aac2flv(char* frame, int nb_frame, SrsRawAacStreamCodec* codec, u_int32_t dts, char** flv, int* nb_flv)
|
||||
int SrsRawAacStream::mux_aac2flv(char* frame, int nb_frame, SrsRawAacStreamCodec* codec, uint32_t dts, char** flv, int* nb_flv)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -538,7 +538,7 @@ int SrsRawAacStream::mux_aac2flv(char* frame, int nb_frame, SrsRawAacStreamCodec
|
|||
char* data = new char[size];
|
||||
char* p = data;
|
||||
|
||||
u_int8_t audio_header = sound_type & 0x01;
|
||||
uint8_t audio_header = sound_type & 0x01;
|
||||
audio_header |= (sound_size << 1) & 0x02;
|
||||
audio_header |= (sound_rate << 2) & 0x0c;
|
||||
audio_header |= (sound_format << 4) & 0xf0;
|
||||
|
|
|
@ -69,7 +69,7 @@ public:
|
|||
* mux the sps/pps to flv sequence header packet.
|
||||
* @param sh output the sequence header.
|
||||
*/
|
||||
virtual int mux_sequence_header(std::string sps, std::string pps, u_int32_t dts, u_int32_t pts, std::string& sh);
|
||||
virtual int mux_sequence_header(std::string sps, std::string pps, uint32_t dts, uint32_t pts, std::string& sh);
|
||||
/**
|
||||
* h264 raw data to h264 packet, without flv payload header.
|
||||
* mux the ibp to flv ibp packet.
|
||||
|
@ -85,7 +85,7 @@ public:
|
|||
* @param flv output the muxed flv packet.
|
||||
* @param nb_flv output the muxed flv size.
|
||||
*/
|
||||
virtual int mux_avc2flv(std::string video, int8_t frame_type, int8_t avc_packet_type, u_int32_t dts, u_int32_t pts, char** flv, int* nb_flv);
|
||||
virtual int mux_avc2flv(std::string video, int8_t frame_type, int8_t avc_packet_type, uint32_t dts, uint32_t pts, char** flv, int* nb_flv);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -138,7 +138,7 @@ public:
|
|||
* @param flv output the muxed flv packet.
|
||||
* @param nb_flv output the muxed flv size.
|
||||
*/
|
||||
virtual int mux_aac2flv(char* frame, int nb_frame, SrsRawAacStreamCodec* codec, u_int32_t dts, char** flv, int* nb_flv);
|
||||
virtual int mux_aac2flv(char* frame, int nb_frame, SrsRawAacStreamCodec* codec, uint32_t dts, char** flv, int* nb_flv);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -46,7 +46,7 @@ using namespace _srs_internal;
|
|||
namespace _srs_internal
|
||||
{
|
||||
// 68bytes FMS key which is used to sign the sever packet.
|
||||
u_int8_t SrsGenuineFMSKey[] = {
|
||||
uint8_t SrsGenuineFMSKey[] = {
|
||||
0x47, 0x65, 0x6e, 0x75, 0x69, 0x6e, 0x65, 0x20,
|
||||
0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, 0x6c,
|
||||
0x61, 0x73, 0x68, 0x20, 0x4d, 0x65, 0x64, 0x69,
|
||||
|
@ -59,7 +59,7 @@ namespace _srs_internal
|
|||
}; // 68
|
||||
|
||||
// 62bytes FP key which is used to sign the client packet.
|
||||
u_int8_t SrsGenuineFPKey[] = {
|
||||
uint8_t SrsGenuineFPKey[] = {
|
||||
0x47, 0x65, 0x6E, 0x75, 0x69, 0x6E, 0x65, 0x20,
|
||||
0x41, 0x64, 0x6F, 0x62, 0x65, 0x20, 0x46, 0x6C,
|
||||
0x61, 0x73, 0x68, 0x20, 0x50, 0x6C, 0x61, 0x79,
|
||||
|
@ -371,7 +371,7 @@ namespace _srs_internal
|
|||
int max_offset_size = 764 - 128 - 4;
|
||||
|
||||
int valid_offset = 0;
|
||||
u_int8_t* pp = (u_int8_t*)&offset;
|
||||
uint8_t* pp = (uint8_t*)&offset;
|
||||
valid_offset += *pp++;
|
||||
valid_offset += *pp++;
|
||||
valid_offset += *pp++;
|
||||
|
@ -448,7 +448,7 @@ namespace _srs_internal
|
|||
int max_offset_size = 764 - 32 - 4;
|
||||
|
||||
int valid_offset = 0;
|
||||
u_int8_t* pp = (u_int8_t*)&offset;
|
||||
uint8_t* pp = (uint8_t*)&offset;
|
||||
valid_offset += *pp++;
|
||||
valid_offset += *pp++;
|
||||
valid_offset += *pp++;
|
||||
|
|
|
@ -44,8 +44,8 @@ namespace _srs_internal
|
|||
{
|
||||
// the digest key generate size.
|
||||
#define SRS_OpensslHashSize 512
|
||||
extern u_int8_t SrsGenuineFMSKey[];
|
||||
extern u_int8_t SrsGenuineFPKey[];
|
||||
extern uint8_t SrsGenuineFMSKey[];
|
||||
extern uint8_t SrsGenuineFPKey[];
|
||||
int openssl_HMACsha256(const void* key, int key_size, const void* data, int data_size, void* digest);
|
||||
int openssl_generate_key(char* public_key, int32_t size);
|
||||
|
||||
|
|
|
@ -662,12 +662,12 @@ int SrsProtocol::do_simple_send(SrsMessageHeader* mh, char* payload, int size)
|
|||
int nbh = 0;
|
||||
if (p == payload) {
|
||||
nbh = srs_chunk_header_c0(
|
||||
mh->perfer_cid, (u_int32_t)mh->timestamp, mh->payload_length,
|
||||
mh->perfer_cid, (uint32_t)mh->timestamp, mh->payload_length,
|
||||
mh->message_type, mh->stream_id,
|
||||
c0c3, sizeof(c0c3));
|
||||
} else {
|
||||
nbh = srs_chunk_header_c3(
|
||||
mh->perfer_cid, (u_int32_t)mh->timestamp,
|
||||
mh->perfer_cid, (uint32_t)mh->timestamp,
|
||||
c0c3, sizeof(c0c3));
|
||||
}
|
||||
srs_assert(nbh > 0);;
|
||||
|
@ -1084,7 +1084,7 @@ int SrsProtocol::read_basic_header(char& fmt, int& cid)
|
|||
}
|
||||
|
||||
cid = 64;
|
||||
cid += (u_int8_t)in_buffer->read_1byte();
|
||||
cid += (uint8_t)in_buffer->read_1byte();
|
||||
srs_verbose("2bytes basic header parsed. fmt=%d, cid=%d", fmt, cid);
|
||||
// 64-65599, 3B chunk header
|
||||
} else if (cid == 1) {
|
||||
|
@ -1096,8 +1096,8 @@ int SrsProtocol::read_basic_header(char& fmt, int& cid)
|
|||
}
|
||||
|
||||
cid = 64;
|
||||
cid += (u_int8_t)in_buffer->read_1byte();
|
||||
cid += ((u_int8_t)in_buffer->read_1byte()) * 256;
|
||||
cid += (uint8_t)in_buffer->read_1byte();
|
||||
cid += ((uint8_t)in_buffer->read_1byte()) * 256;
|
||||
srs_verbose("3bytes basic header parsed. fmt=%d, cid=%d", fmt, cid);
|
||||
} else {
|
||||
srs_error("invalid path, impossible basic header.");
|
||||
|
@ -1320,7 +1320,7 @@ int SrsProtocol::read_message_header(SrsChunkStream* chunk, char fmt)
|
|||
// reset the p to get 4bytes slice.
|
||||
char* p = in_buffer->read_slice(4);
|
||||
|
||||
u_int32_t timestamp = 0x00;
|
||||
uint32_t timestamp = 0x00;
|
||||
char* pp = (char*)×tamp;
|
||||
pp[3] = *p++;
|
||||
pp[2] = *p++;
|
||||
|
@ -1348,7 +1348,7 @@ int SrsProtocol::read_message_header(SrsChunkStream* chunk, char fmt)
|
|||
* @remark, srs always send the extended-timestamp, to keep simple,
|
||||
* and compatible with adobe products.
|
||||
*/
|
||||
u_int32_t chunk_timestamp = (u_int32_t)chunk->header.timestamp;
|
||||
uint32_t chunk_timestamp = (uint32_t)chunk->header.timestamp;
|
||||
|
||||
/**
|
||||
* if chunk_timestamp<=0, the chunk previous packet has no extended-timestamp,
|
||||
|
@ -3416,7 +3416,7 @@ int SrsConnectAppResPacket::decode(SrsBuffer* stream)
|
|||
|
||||
// ignore when props is not amf0 object.
|
||||
if (!p->is_object()) {
|
||||
srs_warn("ignore connect response props marker=%#x.", (u_int8_t)p->marker);
|
||||
srs_warn("ignore connect response props marker=%#x.", (uint8_t)p->marker);
|
||||
srs_freep(p);
|
||||
} else {
|
||||
srs_freep(props);
|
||||
|
|
|
@ -227,7 +227,7 @@ int SrsRtpPacket::decode_97(SrsBuffer* stream)
|
|||
|
||||
int8_t hasv = stream->read_1bytes();
|
||||
int8_t lasv = stream->read_1bytes();
|
||||
u_int16_t au_size = ((hasv << 5) & 0xE0) | ((lasv >> 3) & 0x1f);
|
||||
uint16_t au_size = ((hasv << 5) & 0xE0) | ((lasv >> 3) & 0x1f);
|
||||
|
||||
if (!stream->require(au_size)) {
|
||||
ret = ERROR_RTP_TYPE97_CORRUPT;
|
||||
|
@ -248,7 +248,7 @@ int SrsRtpPacket::decode_97(SrsBuffer* stream)
|
|||
hasv = stream->read_1bytes();
|
||||
lasv = stream->read_1bytes();
|
||||
|
||||
u_int16_t sample_size = ((hasv << 5) & 0xE0) | ((lasv >> 3) & 0x1f);
|
||||
uint16_t sample_size = ((hasv << 5) & 0xE0) | ((lasv >> 3) & 0x1f);
|
||||
// TODO: FIXME: finger out how to parse the size of sample.
|
||||
if (sample_size < 0x100 && stream->require(required_size + sample_size + 0x100)) {
|
||||
sample_size = sample_size | 0x100;
|
||||
|
@ -549,7 +549,7 @@ int SrsRtspSdp::parse_fmtp_attribute(string attr)
|
|||
|
||||
char* tmp_sh = new char[item_value.length()];
|
||||
SrsAutoFreeA(char, tmp_sh);
|
||||
int nb_tmp_sh = ff_hex_to_data((u_int8_t*)tmp_sh, item_value.c_str());
|
||||
int nb_tmp_sh = ff_hex_to_data((uint8_t*)tmp_sh, item_value.c_str());
|
||||
srs_assert(nb_tmp_sh > 0);
|
||||
audio_sh.append(tmp_sh, nb_tmp_sh);
|
||||
}
|
||||
|
@ -602,8 +602,8 @@ string SrsRtspSdp::base64_decode(string value)
|
|||
}
|
||||
|
||||
int nb_output = (int)(value.length() * 2);
|
||||
u_int8_t* output = new u_int8_t[nb_output];
|
||||
SrsAutoFreeA(u_int8_t, output);
|
||||
uint8_t* output = new uint8_t[nb_output];
|
||||
SrsAutoFreeA(uint8_t, output);
|
||||
|
||||
int ret = srs_av_base64_decode(output, (char*)value.c_str(), nb_output);
|
||||
if (ret <= 0) {
|
||||
|
|
|
@ -212,7 +212,7 @@ public:
|
|||
* in Section 9.1, because the packets may flow through a translator that does. Techniques for
|
||||
* choosing unpredictable numbers are discussed in [17].
|
||||
*/
|
||||
u_int16_t sequence_number; //16bits
|
||||
uint16_t sequence_number; //16bits
|
||||
/**
|
||||
* timestamp: 32 bits
|
||||
* The timestamp reflects the sampling instant of the rst octet in the RTP data packet. The
|
||||
|
@ -272,7 +272,7 @@ public:
|
|||
* presentation of the audio and video packets by relating their RTP timestamps using the
|
||||
* timestamp pairs in RTCP SR packets.
|
||||
*/
|
||||
u_int32_t timestamp; //32bits
|
||||
uint32_t timestamp; //32bits
|
||||
/**
|
||||
* SSRC: 32 bits
|
||||
* The SSRC eld identies the synchronization source. This identier should be chosen
|
||||
|
@ -285,7 +285,7 @@ public:
|
|||
* a source changes its source transport address, it must also choose a new SSRC identier to
|
||||
* avoid being interpreted as a looped source (see Section 8.2).
|
||||
*/
|
||||
u_int32_t ssrc; //32bits
|
||||
uint32_t ssrc; //32bits
|
||||
|
||||
// the payload.
|
||||
SrsSimpleStream* payload;
|
||||
|
|
|
@ -620,7 +620,7 @@ VOID TEST(KernelFlvTest, FlvDecoderMetadata)
|
|||
|
||||
char type = 0;
|
||||
int32_t size = 0;
|
||||
u_int32_t time = 0;
|
||||
uint32_t time = 0;
|
||||
char data[1024];
|
||||
fs.mock_reset_offset();
|
||||
|
||||
|
@ -666,7 +666,7 @@ VOID TEST(KernelFlvTest, FlvDecoderAudio)
|
|||
|
||||
char type = 0;
|
||||
int32_t size = 0;
|
||||
u_int32_t time = 0;
|
||||
uint32_t time = 0;
|
||||
char data[1024];
|
||||
fs.mock_reset_offset();
|
||||
|
||||
|
@ -712,7 +712,7 @@ VOID TEST(KernelFlvTest, FlvDecoderVideo)
|
|||
|
||||
char type = 0;
|
||||
int32_t size = 0;
|
||||
u_int32_t time = 0;
|
||||
uint32_t time = 0;
|
||||
char data[1024];
|
||||
fs.mock_reset_offset();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue