winlin

refine librtmp, remove the ssl functoins, refine the type2string memory alloc to static

@@ -239,14 +239,19 @@ int srs_publish_stream(srs_rtmp_t rtmp) @@ -239,14 +239,19 @@ int srs_publish_stream(srs_rtmp_t rtmp)
239 239
240 const char* srs_type2string(int type) 240 const char* srs_type2string(int type)
241 { 241 {
  242 + static const char* audio = "Audio";
  243 + static const char* video = "Video";
  244 + static const char* data = "Data";
  245 + static const char* unknown = "Unknown";
  246 +
242 switch (type) { 247 switch (type) {
243 - case SRS_RTMP_TYPE_AUDIO: return "Audio";  
244 - case SRS_RTMP_TYPE_VIDEO: return "Video";  
245 - case SRS_RTMP_TYPE_SCRIPT: return "Data";  
246 - default: return "Unknown"; 248 + case SRS_RTMP_TYPE_AUDIO: return audio;
  249 + case SRS_RTMP_TYPE_VIDEO: return video;
  250 + case SRS_RTMP_TYPE_SCRIPT: return data;
  251 + default: return unknown;
247 } 252 }
248 253
249 - return "Unknown"; 254 + return unknown;
250 } 255 }
251 256
252 int srs_read_packet(srs_rtmp_t rtmp, int* type, u_int32_t* timestamp, char** data, int* size) 257 int srs_read_packet(srs_rtmp_t rtmp, int* type, u_int32_t* timestamp, char** data, int* size)
@@ -355,14 +360,6 @@ int srs_write_packet(srs_rtmp_t rtmp, int type, u_int32_t timestamp, char* data, @@ -355,14 +360,6 @@ int srs_write_packet(srs_rtmp_t rtmp, int type, u_int32_t timestamp, char* data,
355 return ret; 360 return ret;
356 } 361 }
357 362
358 -int srs_ssl_enabled()  
359 -{  
360 -#ifndef SRS_AUTO_SSL  
361 - return false;  
362 -#endif  
363 - return true;  
364 -}  
365 -  
366 int srs_version_major() 363 int srs_version_major()
367 { 364 {
368 return ::atoi(VERSION_MAJOR); 365 return ::atoi(VERSION_MAJOR);
@@ -109,6 +109,8 @@ int srs_publish_stream(srs_rtmp_t rtmp); @@ -109,6 +109,8 @@ int srs_publish_stream(srs_rtmp_t rtmp);
109 * SRS_RTMP_TYPE_VIDEO to "Video" 109 * SRS_RTMP_TYPE_VIDEO to "Video"
110 * SRS_RTMP_TYPE_SCRIPT to "Data" 110 * SRS_RTMP_TYPE_SCRIPT to "Data"
111 * otherwise, "Unknown" 111 * otherwise, "Unknown"
  112 +* @remark user never free the return char*,
  113 +* it's static shared const string.
112 */ 114 */
113 const char* srs_type2string(int type); 115 const char* srs_type2string(int type);
114 /** 116 /**
@@ -132,14 +134,6 @@ int srs_read_packet(srs_rtmp_t rtmp, int* type, u_int32_t* timestamp, char** dat @@ -132,14 +134,6 @@ int srs_read_packet(srs_rtmp_t rtmp, int* type, u_int32_t* timestamp, char** dat
132 int srs_write_packet(srs_rtmp_t rtmp, int type, u_int32_t timestamp, char* data, int size); 134 int srs_write_packet(srs_rtmp_t rtmp, int type, u_int32_t timestamp, char* data, int size);
133 135
134 /** 136 /**
135 -* whether srs is compiled with ssl,  
136 -* that is, compile srs with ssl: ./configure --with-ssl,.  
137 -* if no ssl, complex handshake always error.  
138 -* @return 0 for false, otherwise, true.  
139 -*/  
140 -int srs_ssl_enabled();  
141 -  
142 -/**  
143 * get protocol stack version 137 * get protocol stack version
144 */ 138 */
145 int srs_version_major(); 139 int srs_version_major();