1 Star 0 Fork 2

anonymous / rtsp

forked from 飞猪饭饭 / rtsp 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
r_util.cpp 1.50 KB
一键复制 编辑 原始数据 按行查看 历史
greenjim301 提交于 2017-10-02 12:07 . first commit
#include "r_util.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <windef.h>
#include <winuser.h>
#include <stdarg.h>
#include <stringapiset.h>
#include <string>
void SkipSpace(char*& p)
{
while(*p == ' ')
++p;
}
int SkipLine(char*& p)
{
char* pp = strstr(p, "\r\n");
if(pp)
{
p = pp + strlen("\r\n");
return 0;
}
return -1;
}
int get_rtsp_addr(r_string& url, r_string& host, int& port)
{
port = 554;
if(0 != memcmp(url.c_str(), "rtsp://", strlen("rtsp://")))
{
r_log("%s illegal\n", url.c_str());
return -1;
}
char* start = url.Data() + strlen("rtsp://");
char* p = strchr(start, ':');
if(p)
{
host.assign(start, p - start);
++p;
port = atoi(p);
}
else
{
p = strchr(start, '/');
if(p)
{
host.assign(start, p - start);
}
else
{
host.assign(start, url.Size() - (start - url.c_str()));
}
}
r_log("host:%s, port:%d\n", host.c_str(), port);
return 0;
}
void r_log(const char* pszFormat, ...)
{
va_list pArgs;
char szMessageBuffer[64]={0};
va_start( pArgs, pszFormat );
_vsnprintf( szMessageBuffer, 64, pszFormat, pArgs );
va_end( pArgs );
TCHAR buf[64] = {0};
#ifdef UNICODE
MultiByteToWideChar(CP_ACP, 0, szMessageBuffer, -1, buf, 64);
#else
strcpy(buf, strszMessageBufferUsr);
#endif
OutputDebugString(buf);
}
1
https://gitee.com/jibamao/rtsp.git
git@gitee.com:jibamao/rtsp.git
jibamao
rtsp
rtsp
master

搜索帮助