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

fix #133, support push rtsp to srs. 2.0.120.

This commit is contained in:
winlin 2015-02-18 22:28:39 +08:00
parent a954040d29
commit 9d233db27e
11 changed files with 670 additions and 80 deletions

View file

@ -621,3 +621,41 @@ char* srs_av_base64_encode(char* out, int out_size, const u_int8_t* in, int in_s
return ret;
}
#define SPACE_CHARS " \t\r\n"
int av_toupper(int c)
{
if (c >= 'a' && c <= 'z') {
c ^= 0x20;
}
return c;
}
int ff_hex_to_data(u_int8_t* data, const char* p)
{
int c, len, v;
len = 0;
v = 1;
for (;;) {
p += strspn(p, SPACE_CHARS);
if (*p == '\0')
break;
c = av_toupper((unsigned char) *p++);
if (c >= '0' && c <= '9')
c = c - '0';
else if (c >= 'A' && c <= 'F')
c = c - 'A' + 10;
else
break;
v = (v << 4) | c;
if (v & 0x100) {
if (data)
data[len] = v;
len++;
v = 1;
}
}
return len;
}