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
				
			
		|  | @ -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; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue