1
0
Fork 0
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:
winlin 2017-01-30 17:32:18 +08:00
parent 011ac4f6a9
commit b16ab038ce
49 changed files with 278 additions and 275 deletions

View file

@ -35,7 +35,7 @@ SrsLbRoundRobin::~SrsLbRoundRobin()
{
}
u_int32_t SrsLbRoundRobin::current()
uint32_t SrsLbRoundRobin::current()
{
return index;
}

View file

@ -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);
};

View file

@ -216,7 +216,7 @@ class SrsBitBuffer
{
private:
int8_t cb;
u_int8_t cb_left;
uint8_t cb_left;
SrsBuffer* stream;
public:
SrsBitBuffer();

View file

@ -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);

View file

@ -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,

View file

@ -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;

View file

@ -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.

View file

@ -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);
}

View file

@ -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.

View file

@ -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.

View file

@ -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
);