winlin

refine the spaces, no TABS

@@ -61,16 +61,16 @@ using namespace std; @@ -61,16 +61,16 @@ using namespace std;
61 61
62 SrsFFMPEG::SrsFFMPEG(std::string ffmpeg_bin) 62 SrsFFMPEG::SrsFFMPEG(std::string ffmpeg_bin)
63 { 63 {
64 - ffmpeg = ffmpeg_bin; 64 + ffmpeg = ffmpeg_bin;
65 65
66 - vbitrate = 0;  
67 - vfps = 0;  
68 - vwidth = 0;  
69 - vheight = 0;  
70 - vthreads = 0;  
71 - abitrate = 0;  
72 - asample_rate = 0;  
73 - achannels = 0; 66 + vbitrate = 0;
  67 + vfps = 0;
  68 + vwidth = 0;
  69 + vheight = 0;
  70 + vthreads = 0;
  71 + abitrate = 0;
  72 + asample_rate = 0;
  73 + achannels = 0;
74 74
75 process = new SrsProcess(); 75 process = new SrsProcess();
76 } 76 }
@@ -112,24 +112,24 @@ int SrsFFMPEG::initialize_transcode(SrsConfDirective* engine) @@ -112,24 +112,24 @@ int SrsFFMPEG::initialize_transcode(SrsConfDirective* engine)
112 { 112 {
113 int ret = ERROR_SUCCESS; 113 int ret = ERROR_SUCCESS;
114 114
115 - perfile = _srs_config->get_engine_perfile(engine);  
116 - iformat = _srs_config->get_engine_iformat(engine);  
117 - vfilter = _srs_config->get_engine_vfilter(engine);  
118 - vcodec = _srs_config->get_engine_vcodec(engine);  
119 - vbitrate = _srs_config->get_engine_vbitrate(engine);  
120 - vfps = _srs_config->get_engine_vfps(engine);  
121 - vwidth = _srs_config->get_engine_vwidth(engine);  
122 - vheight = _srs_config->get_engine_vheight(engine);  
123 - vthreads = _srs_config->get_engine_vthreads(engine);  
124 - vprofile = _srs_config->get_engine_vprofile(engine);  
125 - vpreset = _srs_config->get_engine_vpreset(engine);  
126 - vparams = _srs_config->get_engine_vparams(engine);  
127 - acodec = _srs_config->get_engine_acodec(engine);  
128 - abitrate = _srs_config->get_engine_abitrate(engine);  
129 - asample_rate = _srs_config->get_engine_asample_rate(engine);  
130 - achannels = _srs_config->get_engine_achannels(engine);  
131 - aparams = _srs_config->get_engine_aparams(engine);  
132 - oformat = _srs_config->get_engine_oformat(engine); 115 + perfile = _srs_config->get_engine_perfile(engine);
  116 + iformat = _srs_config->get_engine_iformat(engine);
  117 + vfilter = _srs_config->get_engine_vfilter(engine);
  118 + vcodec = _srs_config->get_engine_vcodec(engine);
  119 + vbitrate = _srs_config->get_engine_vbitrate(engine);
  120 + vfps = _srs_config->get_engine_vfps(engine);
  121 + vwidth = _srs_config->get_engine_vwidth(engine);
  122 + vheight = _srs_config->get_engine_vheight(engine);
  123 + vthreads = _srs_config->get_engine_vthreads(engine);
  124 + vprofile = _srs_config->get_engine_vprofile(engine);
  125 + vpreset = _srs_config->get_engine_vpreset(engine);
  126 + vparams = _srs_config->get_engine_vparams(engine);
  127 + acodec = _srs_config->get_engine_acodec(engine);
  128 + abitrate = _srs_config->get_engine_abitrate(engine);
  129 + asample_rate = _srs_config->get_engine_asample_rate(engine);
  130 + achannels = _srs_config->get_engine_achannels(engine);
  131 + aparams = _srs_config->get_engine_aparams(engine);
  132 + oformat = _srs_config->get_engine_oformat(engine);
133 133
134 // ensure the size is even. 134 // ensure the size is even.
135 vwidth -= vwidth % 2; 135 vwidth -= vwidth % 2;
@@ -226,7 +226,7 @@ int SrsMpegtsOverUdp::on_udp_bytes(string host, int port, char* buf, int nb_buf) @@ -226,7 +226,7 @@ int SrsMpegtsOverUdp::on_udp_bytes(string host, int port, char* buf, int nb_buf)
226 } 226 }
227 227
228 // use stream to parse ts packet. 228 // use stream to parse ts packet.
229 - int nb_packet = buffer->length() / SRS_TS_PACKET_SIZE; 229 + int nb_packet = buffer->length() / SRS_TS_PACKET_SIZE;
230 for (int i = 0; i < nb_packet; i++) { 230 for (int i = 0; i < nb_packet; i++) {
231 char* p = buffer->bytes() + (i * SRS_TS_PACKET_SIZE); 231 char* p = buffer->bytes() + (i * SRS_TS_PACKET_SIZE);
232 if ((ret = stream->initialize(p, SRS_TS_PACKET_SIZE)) != ERROR_SUCCESS) { 232 if ((ret = stream->initialize(p, SRS_TS_PACKET_SIZE)) != ERROR_SUCCESS) {
@@ -64,17 +64,17 @@ class SrsKafkaProducer; @@ -64,17 +64,17 @@ class SrsKafkaProducer;
64 enum SrsListenerType 64 enum SrsListenerType
65 { 65 {
66 // RTMP client, 66 // RTMP client,
67 - SrsListenerRtmpStream = 0, 67 + SrsListenerRtmpStream = 0,
68 // HTTP api, 68 // HTTP api,
69 - SrsListenerHttpApi = 1, 69 + SrsListenerHttpApi = 1,
70 // HTTP stream, HDS/HLS/DASH 70 // HTTP stream, HDS/HLS/DASH
71 - SrsListenerHttpStream = 2, 71 + SrsListenerHttpStream = 2,
72 // UDP stream, MPEG-TS over udp. 72 // UDP stream, MPEG-TS over udp.
73 - SrsListenerMpegTsOverUdp = 3, 73 + SrsListenerMpegTsOverUdp = 3,
74 // TCP stream, RTSP stream. 74 // TCP stream, RTSP stream.
75 - SrsListenerRtsp = 4, 75 + SrsListenerRtsp = 4,
76 // TCP stream, FLV stream over HTTP. 76 // TCP stream, FLV stream over HTTP.
77 - SrsListenerFlv = 5, 77 + SrsListenerFlv = 5,
78 }; 78 };
79 79
80 /** 80 /**
@@ -1063,7 +1063,7 @@ SrsNetworkRtmpServer* srs_get_network_rtmp_server() @@ -1063,7 +1063,7 @@ SrsNetworkRtmpServer* srs_get_network_rtmp_server()
1063 1063
1064 // @see: http://stackoverflow.com/questions/5992211/list-of-possible-internal-socket-statuses-from-proc 1064 // @see: http://stackoverflow.com/questions/5992211/list-of-possible-internal-socket-statuses-from-proc
1065 enum { 1065 enum {
1066 - SYS_TCP_ESTABLISHED = 0x01, 1066 + SYS_TCP_ESTABLISHED = 0x01,
1067 SYS_TCP_SYN_SENT, // 0x02 1067 SYS_TCP_SYN_SENT, // 0x02
1068 SYS_TCP_SYN_RECV, // 0x03 1068 SYS_TCP_SYN_RECV, // 0x03
1069 SYS_TCP_FIN_WAIT1, // 0x04 1069 SYS_TCP_FIN_WAIT1, // 0x04
@@ -388,34 +388,34 @@ int SrsCodecSample::add_sample_unit(char* bytes, int size) @@ -388,34 +388,34 @@ int SrsCodecSample::add_sample_unit(char* bytes, int size)
388 388
389 SrsAvcAacCodec::SrsAvcAacCodec() 389 SrsAvcAacCodec::SrsAvcAacCodec()
390 { 390 {
391 - avc_parse_sps = true;  
392 -  
393 - width = 0;  
394 - height = 0;  
395 - duration = 0;  
396 - NAL_unit_length = 0;  
397 - frame_rate = 0;  
398 -  
399 - video_data_rate = 0;  
400 - video_codec_id = 0;  
401 -  
402 - audio_data_rate = 0;  
403 - audio_codec_id = 0;  
404 -  
405 - avc_profile = SrsAvcProfileReserved;  
406 - avc_level = SrsAvcLevelReserved;  
407 - aac_object = SrsAacObjectTypeReserved;  
408 - aac_sample_rate = SRS_AAC_SAMPLE_RATE_UNSET; // sample rate ignored  
409 - aac_channels = 0;  
410 - avc_extra_size = 0;  
411 - avc_extra_data = NULL;  
412 - aac_extra_size = 0;  
413 - aac_extra_data = NULL;  
414 -  
415 - sequenceParameterSetLength = 0; 391 + avc_parse_sps = true;
  392 +
  393 + width = 0;
  394 + height = 0;
  395 + duration = 0;
  396 + NAL_unit_length = 0;
  397 + frame_rate = 0;
  398 +
  399 + video_data_rate = 0;
  400 + video_codec_id = 0;
  401 +
  402 + audio_data_rate = 0;
  403 + audio_codec_id = 0;
  404 +
  405 + avc_profile = SrsAvcProfileReserved;
  406 + avc_level = SrsAvcLevelReserved;
  407 + aac_object = SrsAacObjectTypeReserved;
  408 + aac_sample_rate = SRS_AAC_SAMPLE_RATE_UNSET; // sample rate ignored
  409 + aac_channels = 0;
  410 + avc_extra_size = 0;
  411 + avc_extra_data = NULL;
  412 + aac_extra_size = 0;
  413 + aac_extra_data = NULL;
  414 +
  415 + sequenceParameterSetLength = 0;
416 sequenceParameterSetNALUnit = NULL; 416 sequenceParameterSetNALUnit = NULL;
417 - pictureParameterSetLength = 0;  
418 - pictureParameterSetNALUnit = NULL; 417 + pictureParameterSetLength = 0;
  418 + pictureParameterSetNALUnit = NULL;
419 419
420 payload_format = SrsAvcPayloadFormatGuess; 420 payload_format = SrsAvcPayloadFormatGuess;
421 stream = new SrsBuffer(); 421 stream = new SrsBuffer();
@@ -41,10 +41,10 @@ class SrsBuffer; @@ -41,10 +41,10 @@ class SrsBuffer;
41 enum SrsCodecAudioType 41 enum SrsCodecAudioType
42 { 42 {
43 // set to the max value to reserved, for array map. 43 // set to the max value to reserved, for array map.
44 - SrsCodecAudioTypeReserved = 2, 44 + SrsCodecAudioTypeReserved = 2,
45 45
46 - SrsCodecAudioTypeSequenceHeader = 0,  
47 - SrsCodecAudioTypeRawData = 1, 46 + SrsCodecAudioTypeSequenceHeader = 0,
  47 + SrsCodecAudioTypeRawData = 1,
48 }; 48 };
49 49
50 // E.4.3.1 VIDEODATA 50 // E.4.3.1 VIDEODATA
@@ -58,14 +58,14 @@ enum SrsCodecAudioType @@ -58,14 +58,14 @@ enum SrsCodecAudioType
58 enum SrsCodecVideoAVCFrame 58 enum SrsCodecVideoAVCFrame
59 { 59 {
60 // set to the zero to reserved, for array map. 60 // set to the zero to reserved, for array map.
61 - SrsCodecVideoAVCFrameReserved = 0,  
62 - SrsCodecVideoAVCFrameReserved1 = 6, 61 + SrsCodecVideoAVCFrameReserved = 0,
  62 + SrsCodecVideoAVCFrameReserved1 = 6,
63 63
64 - SrsCodecVideoAVCFrameKeyFrame = 1,  
65 - SrsCodecVideoAVCFrameInterFrame = 2,  
66 - SrsCodecVideoAVCFrameDisposableInterFrame = 3,  
67 - SrsCodecVideoAVCFrameGeneratedKeyFrame = 4,  
68 - SrsCodecVideoAVCFrameVideoInfoFrame = 5, 64 + SrsCodecVideoAVCFrameKeyFrame = 1,
  65 + SrsCodecVideoAVCFrameInterFrame = 2,
  66 + SrsCodecVideoAVCFrameDisposableInterFrame = 3,
  67 + SrsCodecVideoAVCFrameGeneratedKeyFrame = 4,
  68 + SrsCodecVideoAVCFrameVideoInfoFrame = 5,
69 }; 69 };
70 70
71 // AVCPacketType IF CodecID == 7 UI8 71 // AVCPacketType IF CodecID == 7 UI8
@@ -77,11 +77,11 @@ enum SrsCodecVideoAVCFrame @@ -77,11 +77,11 @@ enum SrsCodecVideoAVCFrame
77 enum SrsCodecVideoAVCType 77 enum SrsCodecVideoAVCType
78 { 78 {
79 // set to the max value to reserved, for array map. 79 // set to the max value to reserved, for array map.
80 - SrsCodecVideoAVCTypeReserved = 3, 80 + SrsCodecVideoAVCTypeReserved = 3,
81 81
82 - SrsCodecVideoAVCTypeSequenceHeader = 0,  
83 - SrsCodecVideoAVCTypeNALU = 1,  
84 - SrsCodecVideoAVCTypeSequenceHeaderEOF = 2, 82 + SrsCodecVideoAVCTypeSequenceHeader = 0,
  83 + SrsCodecVideoAVCTypeNALU = 1,
  84 + SrsCodecVideoAVCTypeSequenceHeaderEOF = 2,
85 }; 85 };
86 86
87 // E.4.3.1 VIDEODATA 87 // E.4.3.1 VIDEODATA
@@ -96,19 +96,19 @@ enum SrsCodecVideoAVCType @@ -96,19 +96,19 @@ enum SrsCodecVideoAVCType
96 enum SrsCodecVideo 96 enum SrsCodecVideo
97 { 97 {
98 // set to the zero to reserved, for array map. 98 // set to the zero to reserved, for array map.
99 - SrsCodecVideoReserved = 0,  
100 - SrsCodecVideoReserved1 = 1,  
101 - SrsCodecVideoReserved2 = 9, 99 + SrsCodecVideoReserved = 0,
  100 + SrsCodecVideoReserved1 = 1,
  101 + SrsCodecVideoReserved2 = 9,
102 102
103 // for user to disable video, for example, use pure audio hls. 103 // for user to disable video, for example, use pure audio hls.
104 - SrsCodecVideoDisabled = 8, 104 + SrsCodecVideoDisabled = 8,
105 105
106 - SrsCodecVideoSorensonH263 = 2,  
107 - SrsCodecVideoScreenVideo = 3,  
108 - SrsCodecVideoOn2VP6 = 4, 106 + SrsCodecVideoSorensonH263 = 2,
  107 + SrsCodecVideoScreenVideo = 3,
  108 + SrsCodecVideoOn2VP6 = 4,
109 SrsCodecVideoOn2VP6WithAlphaChannel = 5, 109 SrsCodecVideoOn2VP6WithAlphaChannel = 5,
110 - SrsCodecVideoScreenVideoVersion2 = 6,  
111 - SrsCodecVideoAVC = 7, 110 + SrsCodecVideoScreenVideoVersion2 = 6,
  111 + SrsCodecVideoAVC = 7,
112 }; 112 };
113 std::string srs_codec_video2str(SrsCodecVideo codec); 113 std::string srs_codec_video2str(SrsCodecVideo codec);
114 114
@@ -134,25 +134,25 @@ std::string srs_codec_video2str(SrsCodecVideo codec); @@ -134,25 +134,25 @@ std::string srs_codec_video2str(SrsCodecVideo codec);
134 enum SrsCodecAudio 134 enum SrsCodecAudio
135 { 135 {
136 // set to the max value to reserved, for array map. 136 // set to the max value to reserved, for array map.
137 - SrsCodecAudioReserved1 = 16, 137 + SrsCodecAudioReserved1 = 16,
138 138
139 // for user to disable audio, for example, use pure video hls. 139 // for user to disable audio, for example, use pure video hls.
140 - SrsCodecAudioDisabled = 17, 140 + SrsCodecAudioDisabled = 17,
141 141
142 - SrsCodecAudioLinearPCMPlatformEndian = 0,  
143 - SrsCodecAudioADPCM = 1,  
144 - SrsCodecAudioMP3 = 2,  
145 - SrsCodecAudioLinearPCMLittleEndian = 3,  
146 - SrsCodecAudioNellymoser16kHzMono = 4,  
147 - SrsCodecAudioNellymoser8kHzMono = 5,  
148 - SrsCodecAudioNellymoser = 6,  
149 - SrsCodecAudioReservedG711AlawLogarithmicPCM = 7,  
150 - SrsCodecAudioReservedG711MuLawLogarithmicPCM = 8,  
151 - SrsCodecAudioReserved = 9,  
152 - SrsCodecAudioAAC = 10,  
153 - SrsCodecAudioSpeex = 11,  
154 - SrsCodecAudioReservedMP3_8kHz = 14,  
155 - SrsCodecAudioReservedDeviceSpecificSound = 15, 142 + SrsCodecAudioLinearPCMPlatformEndian = 0,
  143 + SrsCodecAudioADPCM = 1,
  144 + SrsCodecAudioMP3 = 2,
  145 + SrsCodecAudioLinearPCMLittleEndian = 3,
  146 + SrsCodecAudioNellymoser16kHzMono = 4,
  147 + SrsCodecAudioNellymoser8kHzMono = 5,
  148 + SrsCodecAudioNellymoser = 6,
  149 + SrsCodecAudioReservedG711AlawLogarithmicPCM = 7,
  150 + SrsCodecAudioReservedG711MuLawLogarithmicPCM = 8,
  151 + SrsCodecAudioReserved = 9,
  152 + SrsCodecAudioAAC = 10,
  153 + SrsCodecAudioSpeex = 11,
  154 + SrsCodecAudioReservedMP3_8kHz = 14,
  155 + SrsCodecAudioReservedDeviceSpecificSound = 15,
156 }; 156 };
157 std::string srs_codec_audio2str(SrsCodecAudio codec); 157 std::string srs_codec_audio2str(SrsCodecAudio codec);
158 158
@@ -167,12 +167,12 @@ std::string srs_codec_audio2str(SrsCodecAudio codec); @@ -167,12 +167,12 @@ std::string srs_codec_audio2str(SrsCodecAudio codec);
167 enum SrsCodecAudioSampleRate 167 enum SrsCodecAudioSampleRate
168 { 168 {
169 // set to the max value to reserved, for array map. 169 // set to the max value to reserved, for array map.
170 - SrsCodecAudioSampleRateReserved = 4, 170 + SrsCodecAudioSampleRateReserved = 4,
171 171
172 - SrsCodecAudioSampleRate5512 = 0,  
173 - SrsCodecAudioSampleRate11025 = 1,  
174 - SrsCodecAudioSampleRate22050 = 2,  
175 - SrsCodecAudioSampleRate44100 = 3, 172 + SrsCodecAudioSampleRate5512 = 0,
  173 + SrsCodecAudioSampleRate11025 = 1,
  174 + SrsCodecAudioSampleRate22050 = 2,
  175 + SrsCodecAudioSampleRate44100 = 3,
176 }; 176 };
177 177
178 /** 178 /**
@@ -257,10 +257,10 @@ extern int aac_sample_rates[]; @@ -257,10 +257,10 @@ extern int aac_sample_rates[];
257 enum SrsCodecAudioSampleSize 257 enum SrsCodecAudioSampleSize
258 { 258 {
259 // set to the max value to reserved, for array map. 259 // set to the max value to reserved, for array map.
260 - SrsCodecAudioSampleSizeReserved = 2, 260 + SrsCodecAudioSampleSizeReserved = 2,
261 261
262 - SrsCodecAudioSampleSize8bit = 0,  
263 - SrsCodecAudioSampleSize16bit = 1, 262 + SrsCodecAudioSampleSize8bit = 0,
  263 + SrsCodecAudioSampleSize16bit = 1,
264 }; 264 };
265 265
266 /** 266 /**
@@ -272,10 +272,10 @@ enum SrsCodecAudioSampleSize @@ -272,10 +272,10 @@ enum SrsCodecAudioSampleSize
272 enum SrsCodecAudioSoundType 272 enum SrsCodecAudioSoundType
273 { 273 {
274 // set to the max value to reserved, for array map. 274 // set to the max value to reserved, for array map.
275 - SrsCodecAudioSoundTypeReserved = 2, 275 + SrsCodecAudioSoundTypeReserved = 2,
276 276
277 - SrsCodecAudioSoundTypeMono = 0,  
278 - SrsCodecAudioSoundTypeStereo = 1, 277 + SrsCodecAudioSoundTypeMono = 0,
  278 + SrsCodecAudioSoundTypeStereo = 1,
279 }; 279 };
280 280
281 /** 281 /**
@@ -974,14 +974,14 @@ int SrsTsAdaptationField::decode(SrsBuffer* stream) @@ -974,14 +974,14 @@ int SrsTsAdaptationField::decode(SrsBuffer* stream)
974 int pos_af = stream->pos(); 974 int pos_af = stream->pos();
975 int8_t tmpv = stream->read_1bytes(); 975 int8_t tmpv = stream->read_1bytes();
976 976
977 - discontinuity_indicator = (tmpv >> 7) & 0x01;  
978 - random_access_indicator = (tmpv >> 6) & 0x01;  
979 - elementary_stream_priority_indicator = (tmpv >> 5) & 0x01;  
980 - PCR_flag = (tmpv >> 4) & 0x01;  
981 - OPCR_flag = (tmpv >> 3) & 0x01;  
982 - splicing_point_flag = (tmpv >> 2) & 0x01;  
983 - transport_private_data_flag = (tmpv >> 1) & 0x01;  
984 - adaptation_field_extension_flag = tmpv & 0x01; 977 + discontinuity_indicator = (tmpv >> 7) & 0x01;
  978 + random_access_indicator = (tmpv >> 6) & 0x01;
  979 + elementary_stream_priority_indicator = (tmpv >> 5) & 0x01;
  980 + PCR_flag = (tmpv >> 4) & 0x01;
  981 + OPCR_flag = (tmpv >> 3) & 0x01;
  982 + splicing_point_flag = (tmpv >> 2) & 0x01;
  983 + transport_private_data_flag = (tmpv >> 1) & 0x01;
  984 + adaptation_field_extension_flag = tmpv & 0x01;
985 985
986 if (PCR_flag) { 986 if (PCR_flag) {
987 if (!stream->require(6)) { 987 if (!stream->require(6)) {
@@ -65,19 +65,19 @@ class SrsTsContext; @@ -65,19 +65,19 @@ class SrsTsContext;
65 enum SrsTsPid 65 enum SrsTsPid
66 { 66 {
67 // Program Association Table(see Table 2-25). 67 // Program Association Table(see Table 2-25).
68 - SrsTsPidPAT = 0x00, 68 + SrsTsPidPAT = 0x00,
69 // Conditional Access Table (see Table 2-27). 69 // Conditional Access Table (see Table 2-27).
70 - SrsTsPidCAT = 0x01, 70 + SrsTsPidCAT = 0x01,
71 // Transport Stream Description Table 71 // Transport Stream Description Table
72 - SrsTsPidTSDT = 0x02, 72 + SrsTsPidTSDT = 0x02,
73 // Reserved 73 // Reserved
74 - SrsTsPidReservedStart = 0x03,  
75 - SrsTsPidReservedEnd = 0x0f, 74 + SrsTsPidReservedStart = 0x03,
  75 + SrsTsPidReservedEnd = 0x0f,
76 // May be assigned as network_PID, Program_map_PID, elementary_PID, or for other purposes 76 // May be assigned as network_PID, Program_map_PID, elementary_PID, or for other purposes
77 - SrsTsPidAppStart = 0x10,  
78 - SrsTsPidAppEnd = 0x1ffe, 77 + SrsTsPidAppStart = 0x10,
  78 + SrsTsPidAppEnd = 0x1ffe,
79 // null packets (see Table 2-3) 79 // null packets (see Table 2-3)
80 - SrsTsPidNULL = 0x01FFF, 80 + SrsTsPidNULL = 0x01FFF,
81 }; 81 };
82 82
83 /** 83 /**
@@ -87,13 +87,13 @@ enum SrsTsPid @@ -87,13 +87,13 @@ enum SrsTsPid
87 enum SrsTsScrambled 87 enum SrsTsScrambled
88 { 88 {
89 // Not scrambled 89 // Not scrambled
90 - SrsTsScrambledDisabled = 0x00, 90 + SrsTsScrambledDisabled = 0x00,
91 // User-defined 91 // User-defined
92 - SrsTsScrambledUserDefined1 = 0x01, 92 + SrsTsScrambledUserDefined1 = 0x01,
93 // User-defined 93 // User-defined
94 - SrsTsScrambledUserDefined2 = 0x02, 94 + SrsTsScrambledUserDefined2 = 0x02,
95 // User-defined 95 // User-defined
96 - SrsTsScrambledUserDefined3 = 0x03, 96 + SrsTsScrambledUserDefined3 = 0x03,
97 }; 97 };
98 98
99 /** 99 /**
@@ -103,13 +103,13 @@ enum SrsTsScrambled @@ -103,13 +103,13 @@ enum SrsTsScrambled
103 enum SrsTsAdaptationFieldType 103 enum SrsTsAdaptationFieldType
104 { 104 {
105 // Reserved for future use by ISO/IEC 105 // Reserved for future use by ISO/IEC
106 - SrsTsAdaptationFieldTypeReserved = 0x00, 106 + SrsTsAdaptationFieldTypeReserved = 0x00,
107 // No adaptation_field, payload only 107 // No adaptation_field, payload only
108 - SrsTsAdaptationFieldTypePayloadOnly = 0x01, 108 + SrsTsAdaptationFieldTypePayloadOnly = 0x01,
109 // Adaptation_field only, no payload 109 // Adaptation_field only, no payload
110 - SrsTsAdaptationFieldTypeAdaptionOnly = 0x02, 110 + SrsTsAdaptationFieldTypeAdaptionOnly = 0x02,
111 // Adaptation_field followed by payload 111 // Adaptation_field followed by payload
112 - SrsTsAdaptationFieldTypeBoth = 0x03, 112 + SrsTsAdaptationFieldTypeBoth = 0x03,
113 }; 113 };
114 114
115 /** 115 /**
@@ -133,12 +133,12 @@ enum SrsTsPidApply @@ -133,12 +133,12 @@ enum SrsTsPidApply
133 enum SrsTsStream 133 enum SrsTsStream
134 { 134 {
135 // ITU-T | ISO/IEC Reserved 135 // ITU-T | ISO/IEC Reserved
136 - SrsTsStreamReserved = 0x00, 136 + SrsTsStreamReserved = 0x00,
137 // ISO/IEC 11172 Video 137 // ISO/IEC 11172 Video
138 // ITU-T Rec. H.262 | ISO/IEC 13818-2 Video or ISO/IEC 11172-2 constrained parameter video stream 138 // ITU-T Rec. H.262 | ISO/IEC 13818-2 Video or ISO/IEC 11172-2 constrained parameter video stream
139 // ISO/IEC 11172 Audio 139 // ISO/IEC 11172 Audio
140 // ISO/IEC 13818-3 Audio 140 // ISO/IEC 13818-3 Audio
141 - SrsTsStreamAudioMp3 = 0x04, 141 + SrsTsStreamAudioMp3 = 0x04,
142 // ITU-T Rec. H.222.0 | ISO/IEC 13818-1 private_sections 142 // ITU-T Rec. H.222.0 | ISO/IEC 13818-1 private_sections
143 // ITU-T Rec. H.222.0 | ISO/IEC 13818-1 PES packets containing private data 143 // ITU-T Rec. H.222.0 | ISO/IEC 13818-1 PES packets containing private data
144 // ISO/IEC 13522 MHEG 144 // ISO/IEC 13522 MHEG
@@ -150,21 +150,21 @@ enum SrsTsStream @@ -150,21 +150,21 @@ enum SrsTsStream
150 // ISO/IEC 13818-6 type D 150 // ISO/IEC 13818-6 type D
151 // ITU-T Rec. H.222.0 | ISO/IEC 13818-1 auxiliary 151 // ITU-T Rec. H.222.0 | ISO/IEC 13818-1 auxiliary
152 // ISO/IEC 13818-7 Audio with ADTS transport syntax 152 // ISO/IEC 13818-7 Audio with ADTS transport syntax
153 - SrsTsStreamAudioAAC = 0x0f, 153 + SrsTsStreamAudioAAC = 0x0f,
154 // ISO/IEC 14496-2 Visual 154 // ISO/IEC 14496-2 Visual
155 - SrsTsStreamVideoMpeg4 = 0x10, 155 + SrsTsStreamVideoMpeg4 = 0x10,
156 // ISO/IEC 14496-3 Audio with the LATM transport syntax as defined in ISO/IEC 14496-3 / AMD 1 156 // ISO/IEC 14496-3 Audio with the LATM transport syntax as defined in ISO/IEC 14496-3 / AMD 1
157 - SrsTsStreamAudioMpeg4 = 0x11, 157 + SrsTsStreamAudioMpeg4 = 0x11,
158 // ISO/IEC 14496-1 SL-packetized stream or FlexMux stream carried in PES packets 158 // ISO/IEC 14496-1 SL-packetized stream or FlexMux stream carried in PES packets
159 // ISO/IEC 14496-1 SL-packetized stream or FlexMux stream carried in ISO/IEC14496_sections. 159 // ISO/IEC 14496-1 SL-packetized stream or FlexMux stream carried in ISO/IEC14496_sections.
160 // ISO/IEC 13818-6 Synchronized Download Protocol 160 // ISO/IEC 13818-6 Synchronized Download Protocol
161 // ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Reserved 161 // ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Reserved
162 // 0x15-0x7F 162 // 0x15-0x7F
163 - SrsTsStreamVideoH264 = 0x1b, 163 + SrsTsStreamVideoH264 = 0x1b,
164 // User Private 164 // User Private
165 // 0x80-0xFF 165 // 0x80-0xFF
166 - SrsTsStreamAudioAC3 = 0x81,  
167 - SrsTsStreamAudioDTS = 0x8a, 166 + SrsTsStreamAudioAC3 = 0x81,
  167 + SrsTsStreamAudioDTS = 0x8a,
168 }; 168 };
169 std::string srs_ts_stream2string(SrsTsStream stream); 169 std::string srs_ts_stream2string(SrsTsStream stream);
170 170
@@ -192,58 +192,58 @@ struct SrsTsChannel @@ -192,58 +192,58 @@ struct SrsTsChannel
192 enum SrsTsPESStreamId 192 enum SrsTsPESStreamId
193 { 193 {
194 // program_stream_map 194 // program_stream_map
195 - SrsTsPESStreamIdProgramStreamMap = 0xbc, // 0b10111100 195 + SrsTsPESStreamIdProgramStreamMap = 0xbc, // 0b10111100
196 // private_stream_1 196 // private_stream_1
197 - SrsTsPESStreamIdPrivateStream1 = 0xbd, // 0b10111101 197 + SrsTsPESStreamIdPrivateStream1 = 0xbd, // 0b10111101
198 // padding_stream 198 // padding_stream
199 - SrsTsPESStreamIdPaddingStream = 0xbe, // 0b10111110 199 + SrsTsPESStreamIdPaddingStream = 0xbe, // 0b10111110
200 // private_stream_2 200 // private_stream_2
201 - SrsTsPESStreamIdPrivateStream2 = 0xbf, // 0b10111111 201 + SrsTsPESStreamIdPrivateStream2 = 0xbf, // 0b10111111
202 202
203 // 110x xxxx 203 // 110x xxxx
204 // ISO/IEC 13818-3 or ISO/IEC 11172-3 or ISO/IEC 13818-7 or ISO/IEC 204 // ISO/IEC 13818-3 or ISO/IEC 11172-3 or ISO/IEC 13818-7 or ISO/IEC
205 // 14496-3 audio stream number x xxxx 205 // 14496-3 audio stream number x xxxx
206 // ((sid >> 5) & 0x07) == SrsTsPESStreamIdAudio 206 // ((sid >> 5) & 0x07) == SrsTsPESStreamIdAudio
207 // @remark, use SrsTsPESStreamIdAudioCommon as actually audio, SrsTsPESStreamIdAudio to check whether audio. 207 // @remark, use SrsTsPESStreamIdAudioCommon as actually audio, SrsTsPESStreamIdAudio to check whether audio.
208 - SrsTsPESStreamIdAudioChecker = 0x06, // 0b110  
209 - SrsTsPESStreamIdAudioCommon = 0xc0, 208 + SrsTsPESStreamIdAudioChecker = 0x06, // 0b110
  209 + SrsTsPESStreamIdAudioCommon = 0xc0,
210 210
211 // 1110 xxxx 211 // 1110 xxxx
212 // ITU-T Rec. H.262 | ISO/IEC 13818-2 or ISO/IEC 11172-2 or ISO/IEC 212 // ITU-T Rec. H.262 | ISO/IEC 13818-2 or ISO/IEC 11172-2 or ISO/IEC
213 // 14496-2 video stream number xxxx 213 // 14496-2 video stream number xxxx
214 // ((stream_id >> 4) & 0x0f) == SrsTsPESStreamIdVideo 214 // ((stream_id >> 4) & 0x0f) == SrsTsPESStreamIdVideo
215 // @remark, use SrsTsPESStreamIdVideoCommon as actually video, SrsTsPESStreamIdVideo to check whether video. 215 // @remark, use SrsTsPESStreamIdVideoCommon as actually video, SrsTsPESStreamIdVideo to check whether video.
216 - SrsTsPESStreamIdVideoChecker = 0x0e, // 0b1110  
217 - SrsTsPESStreamIdVideoCommon = 0xe0, 216 + SrsTsPESStreamIdVideoChecker = 0x0e, // 0b1110
  217 + SrsTsPESStreamIdVideoCommon = 0xe0,
218 218
219 // ECM_stream 219 // ECM_stream
220 - SrsTsPESStreamIdEcmStream = 0xf0, // 0b11110000 220 + SrsTsPESStreamIdEcmStream = 0xf0, // 0b11110000
221 // EMM_stream 221 // EMM_stream
222 - SrsTsPESStreamIdEmmStream = 0xf1, // 0b11110001 222 + SrsTsPESStreamIdEmmStream = 0xf1, // 0b11110001
223 // DSMCC_stream 223 // DSMCC_stream
224 - SrsTsPESStreamIdDsmccStream = 0xf2, // 0b11110010 224 + SrsTsPESStreamIdDsmccStream = 0xf2, // 0b11110010
225 // 13522_stream 225 // 13522_stream
226 - SrsTsPESStreamId13522Stream = 0xf3, // 0b11110011 226 + SrsTsPESStreamId13522Stream = 0xf3, // 0b11110011
227 // H_222_1_type_A 227 // H_222_1_type_A
228 - SrsTsPESStreamIdH2221TypeA = 0xf4, // 0b11110100 228 + SrsTsPESStreamIdH2221TypeA = 0xf4, // 0b11110100
229 // H_222_1_type_B 229 // H_222_1_type_B
230 - SrsTsPESStreamIdH2221TypeB = 0xf5, // 0b11110101 230 + SrsTsPESStreamIdH2221TypeB = 0xf5, // 0b11110101
231 // H_222_1_type_C 231 // H_222_1_type_C
232 - SrsTsPESStreamIdH2221TypeC = 0xf6, // 0b11110110 232 + SrsTsPESStreamIdH2221TypeC = 0xf6, // 0b11110110
233 // H_222_1_type_D 233 // H_222_1_type_D
234 - SrsTsPESStreamIdH2221TypeD = 0xf7, // 0b11110111 234 + SrsTsPESStreamIdH2221TypeD = 0xf7, // 0b11110111
235 // H_222_1_type_E 235 // H_222_1_type_E
236 - SrsTsPESStreamIdH2221TypeE = 0xf8, // 0b11111000 236 + SrsTsPESStreamIdH2221TypeE = 0xf8, // 0b11111000
237 // ancillary_stream 237 // ancillary_stream
238 - SrsTsPESStreamIdAncillaryStream = 0xf9, // 0b11111001 238 + SrsTsPESStreamIdAncillaryStream = 0xf9, // 0b11111001
239 // SL_packetized_stream 239 // SL_packetized_stream
240 - SrsTsPESStreamIdSlPacketizedStream = 0xfa, // 0b11111010 240 + SrsTsPESStreamIdSlPacketizedStream = 0xfa, // 0b11111010
241 // FlexMux_stream 241 // FlexMux_stream
242 - SrsTsPESStreamIdFlexMuxStream = 0xfb, // 0b11111011 242 + SrsTsPESStreamIdFlexMuxStream = 0xfb, // 0b11111011
243 // reserved data stream 243 // reserved data stream
244 // 1111 1100 ... 1111 1110 244 // 1111 1100 ... 1111 1110
245 // program_stream_directory 245 // program_stream_directory
246 - SrsTsPESStreamIdProgramStreamDirectory = 0xff, // 0b11111111 246 + SrsTsPESStreamIdProgramStreamDirectory = 0xff, // 0b11111111
247 }; 247 };
248 248
249 /** 249 /**
@@ -857,28 +857,28 @@ public: @@ -857,28 +857,28 @@ public:
857 enum SrsTsPsiId 857 enum SrsTsPsiId
858 { 858 {
859 // program_association_section 859 // program_association_section
860 - SrsTsPsiIdPas = 0x00, 860 + SrsTsPsiIdPas = 0x00,
861 // conditional_access_section (CA_section) 861 // conditional_access_section (CA_section)
862 - SrsTsPsiIdCas = 0x01, 862 + SrsTsPsiIdCas = 0x01,
863 // TS_program_map_section 863 // TS_program_map_section
864 - SrsTsPsiIdPms = 0x02, 864 + SrsTsPsiIdPms = 0x02,
865 // TS_description_section 865 // TS_description_section
866 - SrsTsPsiIdDs = 0x03, 866 + SrsTsPsiIdDs = 0x03,
867 // ISO_IEC_14496_scene_description_section 867 // ISO_IEC_14496_scene_description_section
868 - SrsTsPsiIdSds = 0x04, 868 + SrsTsPsiIdSds = 0x04,
869 // ISO_IEC_14496_object_descriptor_section 869 // ISO_IEC_14496_object_descriptor_section
870 - SrsTsPsiIdOds = 0x05, 870 + SrsTsPsiIdOds = 0x05,
871 // ITU-T Rec. H.222.0 | ISO/IEC 13818-1 reserved 871 // ITU-T Rec. H.222.0 | ISO/IEC 13818-1 reserved
872 - SrsTsPsiIdIso138181Start = 0x06,  
873 - SrsTsPsiIdIso138181End = 0x37, 872 + SrsTsPsiIdIso138181Start = 0x06,
  873 + SrsTsPsiIdIso138181End = 0x37,
874 // Defined in ISO/IEC 13818-6 874 // Defined in ISO/IEC 13818-6
875 - SrsTsPsiIdIso138186Start = 0x38,  
876 - SrsTsPsiIdIso138186End = 0x3F, 875 + SrsTsPsiIdIso138186Start = 0x38,
  876 + SrsTsPsiIdIso138186End = 0x3F,
877 // User private 877 // User private
878 - SrsTsPsiIdUserStart = 0x40,  
879 - SrsTsPsiIdUserEnd = 0xFE, 878 + SrsTsPsiIdUserStart = 0x40,
  879 + SrsTsPsiIdUserEnd = 0xFE,
880 // forbidden 880 // forbidden
881 - SrsTsPsiIdForbidden = 0xFF, 881 + SrsTsPsiIdForbidden = 0xFF,
882 }; 882 };
883 883
884 /** 884 /**
@@ -294,7 +294,7 @@ int SrsIngestSrsInput::parseTs(ISrsTsHandler* handler, char* body, int nb_body) @@ -294,7 +294,7 @@ int SrsIngestSrsInput::parseTs(ISrsTsHandler* handler, char* body, int nb_body)
294 int ret = ERROR_SUCCESS; 294 int ret = ERROR_SUCCESS;
295 295
296 // use stream to parse ts packet. 296 // use stream to parse ts packet.
297 - int nb_packet = (int)nb_body / SRS_TS_PACKET_SIZE; 297 + int nb_packet = (int)nb_body / SRS_TS_PACKET_SIZE;
298 for (int i = 0; i < nb_packet; i++) { 298 for (int i = 0; i < nb_packet; i++) {
299 char* p = (char*)body + (i * SRS_TS_PACKET_SIZE); 299 char* p = (char*)body + (i * SRS_TS_PACKET_SIZE);
300 if ((ret = stream->initialize(p, SRS_TS_PACKET_SIZE)) != ERROR_SUCCESS) { 300 if ((ret = stream->initialize(p, SRS_TS_PACKET_SIZE)) != ERROR_SUCCESS) {
@@ -1960,7 +1960,7 @@ enum SrcPCUCEventType @@ -1960,7 +1960,7 @@ enum SrcPCUCEventType
1960 * the stream ID of the stream that became 1960 * the stream ID of the stream that became
1961 * functional. 1961 * functional.
1962 */ 1962 */
1963 - SrcPCUCStreamBegin = 0x00, 1963 + SrcPCUCStreamBegin = 0x00,
1964 1964
1965 /** 1965 /**
1966 * The server sends this event to notify the client 1966 * The server sends this event to notify the client
@@ -1971,7 +1971,7 @@ enum SrcPCUCEventType @@ -1971,7 +1971,7 @@ enum SrcPCUCEventType
1971 * 4 bytes of event data represent the ID of the 1971 * 4 bytes of event data represent the ID of the
1972 * stream on which playback has ended. 1972 * stream on which playback has ended.
1973 */ 1973 */
1974 - SrcPCUCStreamEOF = 0x01, 1974 + SrcPCUCStreamEOF = 0x01,
1975 1975
1976 /** 1976 /**
1977 * The server sends this event to notify the client 1977 * The server sends this event to notify the client
@@ -1981,7 +1981,7 @@ enum SrcPCUCEventType @@ -1981,7 +1981,7 @@ enum SrcPCUCEventType
1981 * that the stream is dry. The 4 bytes of event 1981 * that the stream is dry. The 4 bytes of event
1982 * data represent the stream ID of the dry stream. 1982 * data represent the stream ID of the dry stream.
1983 */ 1983 */
1984 - SrcPCUCStreamDry = 0x02, 1984 + SrcPCUCStreamDry = 0x02,
1985 1985
1986 /** 1986 /**
1987 * The client sends this event to inform the server 1987 * The client sends this event to inform the server
@@ -1993,7 +1993,7 @@ enum SrcPCUCEventType @@ -1993,7 +1993,7 @@ enum SrcPCUCEventType
1993 * 4 bytes represent the buffer length, in 1993 * 4 bytes represent the buffer length, in
1994 * milliseconds. 1994 * milliseconds.
1995 */ 1995 */
1996 - SrcPCUCSetBufferLength = 0x03, // 8bytes event-data 1996 + SrcPCUCSetBufferLength = 0x03, // 8bytes event-data
1997 1997
1998 /** 1998 /**
1999 * The server sends this event to notify the client 1999 * The server sends this event to notify the client
@@ -2001,7 +2001,7 @@ enum SrcPCUCEventType @@ -2001,7 +2001,7 @@ enum SrcPCUCEventType
2001 * 4 bytes event data represent the stream ID of 2001 * 4 bytes event data represent the stream ID of
2002 * the recorded stream. 2002 * the recorded stream.
2003 */ 2003 */
2004 - SrcPCUCStreamIsRecorded = 0x04, 2004 + SrcPCUCStreamIsRecorded = 0x04,
2005 2005
2006 /** 2006 /**
2007 * The server sends this event to test whether the 2007 * The server sends this event to test whether the
@@ -2011,7 +2011,7 @@ enum SrcPCUCEventType @@ -2011,7 +2011,7 @@ enum SrcPCUCEventType
2011 * client responds with kMsgPingResponse on 2011 * client responds with kMsgPingResponse on
2012 * receiving kMsgPingRequest. 2012 * receiving kMsgPingRequest.
2013 */ 2013 */
2014 - SrcPCUCPingRequest = 0x06, 2014 + SrcPCUCPingRequest = 0x06,
2015 2015
2016 /** 2016 /**
2017 * The client sends this event to the server in 2017 * The client sends this event to the server in
@@ -2019,14 +2019,14 @@ enum SrcPCUCEventType @@ -2019,14 +2019,14 @@ enum SrcPCUCEventType
2019 * a 4-byte timestamp, which was received with the 2019 * a 4-byte timestamp, which was received with the
2020 * kMsgPingRequest request. 2020 * kMsgPingRequest request.
2021 */ 2021 */
2022 - SrcPCUCPingResponse = 0x07, 2022 + SrcPCUCPingResponse = 0x07,
2023 2023
2024 /** 2024 /**
2025 * for PCUC size=3, the payload is "00 1A 01", 2025 * for PCUC size=3, the payload is "00 1A 01",
2026 * where we think the event is 0x001a, fms defined msg, 2026 * where we think the event is 0x001a, fms defined msg,
2027 * which has only 1bytes event data. 2027 * which has only 1bytes event data.
2028 */ 2028 */
2029 - SrsPCUCFmsEvent0 = 0x1a, 2029 + SrsPCUCFmsEvent0 = 0x1a,
2030 }; 2030 };
2031 2031
2032 /** 2032 /**
@@ -45,11 +45,11 @@ class SrsCodecSample; @@ -45,11 +45,11 @@ class SrsCodecSample;
45 class ISrsProtocolReaderWriter; 45 class ISrsProtocolReaderWriter;
46 46
47 // rtsp specification 47 // rtsp specification
48 -// CR = <US-ASCII CR, carriage return (13)> 48 +// CR = <US-ASCII CR, carriage return (13)>
49 #define SRS_RTSP_CR SRS_CONSTS_CR // 0x0D 49 #define SRS_RTSP_CR SRS_CONSTS_CR // 0x0D
50 -// LF = <US-ASCII LF, linefeed (10)> 50 +// LF = <US-ASCII LF, linefeed (10)>
51 #define SRS_RTSP_LF SRS_CONSTS_LF // 0x0A 51 #define SRS_RTSP_LF SRS_CONSTS_LF // 0x0A
52 -// SP = <US-ASCII SP, space (32)> 52 +// SP = <US-ASCII SP, space (32)>
53 #define SRS_RTSP_SP ' ' // 0x20 53 #define SRS_RTSP_SP ' ' // 0x20
54 54
55 // 4 RTSP Message, @see rtsp-rfc2326-1998.pdf, page 37 55 // 4 RTSP Message, @see rtsp-rfc2326-1998.pdf, page 37
@@ -118,17 +118,17 @@ enum SrsRtspSdpState @@ -118,17 +118,17 @@ enum SrsRtspSdpState
118 */ 118 */
119 enum SrsRtspMethod 119 enum SrsRtspMethod
120 { 120 {
121 - SrsRtspMethodDescribe = 0x0001,  
122 - SrsRtspMethodAnnounce = 0x0002,  
123 - SrsRtspMethodGetParameter = 0x0004,  
124 - SrsRtspMethodOptions = 0x0008,  
125 - SrsRtspMethodPause = 0x0010,  
126 - SrsRtspMethodPlay = 0x0020,  
127 - SrsRtspMethodRecord = 0x0040,  
128 - SrsRtspMethodRedirect = 0x0080,  
129 - SrsRtspMethodSetup = 0x0100,  
130 - SrsRtspMethodSetParameter = 0x0200,  
131 - SrsRtspMethodTeardown = 0x0400, 121 + SrsRtspMethodDescribe = 0x0001,
  122 + SrsRtspMethodAnnounce = 0x0002,
  123 + SrsRtspMethodGetParameter = 0x0004,
  124 + SrsRtspMethodOptions = 0x0008,
  125 + SrsRtspMethodPause = 0x0010,
  126 + SrsRtspMethodPlay = 0x0020,
  127 + SrsRtspMethodRecord = 0x0040,
  128 + SrsRtspMethodRedirect = 0x0080,
  129 + SrsRtspMethodSetup = 0x0100,
  130 + SrsRtspMethodSetParameter = 0x0200,
  131 + SrsRtspMethodTeardown = 0x0400,
132 }; 132 };
133 133
134 /** 134 /**
@@ -69,7 +69,7 @@ int MockReloadHandler::count_total() @@ -69,7 +69,7 @@ int MockReloadHandler::count_total()
69 69
70 int MockReloadHandler::count_true() 70 int MockReloadHandler::count_true()
71 { 71 {
72 - int count_true = 0; 72 + int count_true = 0;
73 73
74 if (listen_reloaded) count_true++; 74 if (listen_reloaded) count_true++;
75 if (pid_reloaded) count_true++; 75 if (pid_reloaded) count_true++;
@@ -99,7 +99,7 @@ int MockReloadHandler::count_true() @@ -99,7 +99,7 @@ int MockReloadHandler::count_true()
99 99
100 int MockReloadHandler::count_false() 100 int MockReloadHandler::count_false()
101 { 101 {
102 - int count_false = 0; 102 + int count_false = 0;
103 103
104 if (!listen_reloaded) count_false++; 104 if (!listen_reloaded) count_false++;
105 if (!pid_reloaded) count_false++; 105 if (!pid_reloaded) count_false++;