封转好的 rtsp服务器库 ,注意:仅仅支持h264和aac推流
使用方法:
#if 0
void Example()
{
IRtspServer*pRtspServer = CreateRTSPServer(10554); //创建rtspserver
int nStreamHandle1 = pRtspServer->CreateStreamUrl("chn1"); //创建第一路流
pRtspServer->PushVideoData(nStreamHandle1, "...");
pRtspServer->PushAudioData(nStreamHandle1, "...");
int nStreamHandle2 = pRtspServer->CreateStreamUrl("chn2");//创建第 2路流
pRtspServer->PushVideoData(nStreamHandle2, "...");
pRtspServer->PushAudioData(nStreamHandle2, "...");
//client use
stream1: rtsp://ip:10554/chn1
stream2: rtsp://ip:10554/chn2
}
#endif
#pragma once
class IRtspServer
{
public:
virtual ~IRtspServer() {};
virtual int CreateStreamUrl(char const* streamName,bool bTransferAudio=true/*是否传输音频*/) = 0; //创建流地址,返回索引值(>=0)
virtual bool PushVideoData(int nIndex, char *pBuf, int nlen, unsigned long long dTime, bool bKey) = 0; //根据索引值传入视频数据(I帧带SPS,PPS,内部自动识别视频参数配置)
virtual bool PushAudioData(int nIndex, char *pBuf, int nlen, unsigned long long dTime) = 0; //根据索引值传入音频数据(带ADTS头音频,内部自动识别音频参数配置)
};
IRtspServer* CreateRTSPServer(short sPort);
下载地址 :
https://download.csdn.net/download/sunxiaopengsun/10782351