1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

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

This commit is contained in:
winlin 2014-06-07 13:44:46 +08:00
parent 48adeeb1a5
commit 373f92551d
2 changed files with 12 additions and 21 deletions

View file

@ -239,14 +239,19 @@ int srs_publish_stream(srs_rtmp_t rtmp)
const char* srs_type2string(int type) const char* srs_type2string(int type)
{ {
static const char* audio = "Audio";
static const char* video = "Video";
static const char* data = "Data";
static const char* unknown = "Unknown";
switch (type) { switch (type) {
case SRS_RTMP_TYPE_AUDIO: return "Audio"; case SRS_RTMP_TYPE_AUDIO: return audio;
case SRS_RTMP_TYPE_VIDEO: return "Video"; case SRS_RTMP_TYPE_VIDEO: return video;
case SRS_RTMP_TYPE_SCRIPT: return "Data"; case SRS_RTMP_TYPE_SCRIPT: return data;
default: return "Unknown"; default: return unknown;
} }
return "Unknown"; return unknown;
} }
int srs_read_packet(srs_rtmp_t rtmp, int* type, u_int32_t* timestamp, char** data, int* size) 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,
return ret; return ret;
} }
int srs_ssl_enabled()
{
#ifndef SRS_AUTO_SSL
return false;
#endif
return true;
}
int srs_version_major() int srs_version_major()
{ {
return ::atoi(VERSION_MAJOR); return ::atoi(VERSION_MAJOR);

View file

@ -109,6 +109,8 @@ int srs_publish_stream(srs_rtmp_t rtmp);
* SRS_RTMP_TYPE_VIDEO to "Video" * SRS_RTMP_TYPE_VIDEO to "Video"
* SRS_RTMP_TYPE_SCRIPT to "Data" * SRS_RTMP_TYPE_SCRIPT to "Data"
* otherwise, "Unknown" * otherwise, "Unknown"
* @remark user never free the return char*,
* it's static shared const string.
*/ */
const char* srs_type2string(int type); const char* srs_type2string(int type);
/** /**
@ -131,14 +133,6 @@ const char* srs_type2string(int type);
int srs_read_packet(srs_rtmp_t rtmp, int* type, u_int32_t* timestamp, char** data, int* size); int srs_read_packet(srs_rtmp_t rtmp, int* type, u_int32_t* timestamp, char** data, int* size);
int srs_write_packet(srs_rtmp_t rtmp, int type, u_int32_t timestamp, char* data, int size); int srs_write_packet(srs_rtmp_t rtmp, int type, u_int32_t timestamp, char* data, int size);
/**
* whether srs is compiled with ssl,
* that is, compile srs with ssl: ./configure --with-ssl,.
* if no ssl, complex handshake always error.
* @return 0 for false, otherwise, true.
*/
int srs_ssl_enabled();
/** /**
* get protocol stack version * get protocol stack version
*/ */