资源简介
rtsp_server 为工程主目录
livelib 为live555 库目录
RtspServer.cpp 为主程序
H264LiveVideoServerMediaSubsession.cpp H264LiveVideoSource.cpp
为创建对话和获取帧类 其他为平台获取帧代码和库
代码片段和文件信息
#include “H264LiveVideoServerMediaSubsession.hh“
#include “H264VideoRTPSink.hh“
#include “H264VideoStreamframer.hh“
#include “H265VideoRTPSink.hh“
#include “H265VideoStreamframer.hh“
#include “H264LiveVideoSource.hh“
H264LiveVideoServerMediaSubsession*
H264LiveVideoServerMediaSubsession::createNew(UsageEnvironment& env
char const* chanID
Boolean reuseFirstSource) {
return new H264LiveVideoServerMediaSubsession(env chanID reuseFirstSource);
}
H264LiveVideoServerMediaSubsession::H264LiveVideoServerMediaSubsession(UsageEnvironment& env
char const* chanID Boolean reuseFirstSource)
: OnDemandServerMediaSubsession(envreuseFirstSource)
fAuxSDPLine(NULL) fDoneFlag(0) fDummyRTPSink(NULL) {
fChanID = strDup(chanID);
if(NULL == fChanID)
fChanID = strDup(“720p-stream“);
env << “H264LiveVideoServerMediaSubsession::fChanID:“ << fChanID <<“\n“;
#ifdef GET_VIDEO_frame_FROM_DRIVER
TENDCAM_PARAM_VIDEO video[2];
tend_CamVideo_hal_initDevice(TEND_STREAMID_LIVE &video[TEND_STREAMID_LIVE]);
#endif
// printf(“~~~~~~~%s line :%d \n “__func____LINE__);
}
H264LiveVideoServerMediaSubsession::~H264LiveVideoServerMediaSubsession() {
// printf(“~~~~~~~%s line :%d \n “__func____LINE__);
#ifdef GET_VIDEO_frame_FROM_DRIVER
tend_CamVideo_hal_releaseallDevice();
#endif
delete[] fAuxSDPLine;
delete[] fChanID;
}
static void afterPlayingDummy(void* clientData) {
// printf(“~~~~~~~%s line :%d \n “__func____LINE__);
H264LiveVideoServerMediaSubsession* subsess = (H264LiveVideoServerMediaSubsession*)clientData;
subsess->afterPlayingDummy1();
}
void H264LiveVideoServerMediaSubsession::afterPlayingDummy1() {
// printf(“~~~~~~~%s line :%d \n “__func____LINE__);
// Unschedule any pending ‘checking‘ task:
envir().taskScheduler().unscheduleDelayedTask(nextTask());
// Signal the event loop that we‘re done:
setDoneFlag();
}
static void checkForAuxSDPLine(void* clientData) {
// printf(“~~~~~~~%s line :%d \n “__func____LINE__);
H264LiveVideoServerMediaSubsession* subsess = (H264LiveVideoServerMediaSubsession*)clientData;
subsess->checkForAuxSDPLine1();
}
void H264LiveVideoServerMediaSubsession::checkForAuxSDPLine1() {
// printf(“~~~~~~~%s line :%d \n “__func____LINE__);
char const* dasl;
if (fAuxSDPLine != NULL) {
// Signal the event loop that we‘re done:
setDoneFlag();
} else if (fDummyRTPSink != NULL && (dasl = fDummyRTPSink->auxSDPLine()) != NULL) {
fAuxSDPLine = strDup(dasl);
fDummyRTPSink = NULL;
// Signal the event loop that we‘re done:
setDoneFlag();
} else if (!fDoneFlag) {
// try again after a brief delay:
//int uSecsToDelay = 100000; // 100 ms
int uSecsToDelay = 10; // 100 ms
nextTask() = envir().taskScheduler().scheduleDelayedTask(uSecsToDelay
(TaskFunc*)checkForAuxSDPLine this);
}
}
char const* H264LiveVideoServerMediaSubsession::getAuxSDPLine(RTPSink* rtpSink framedSource* inputSource)
评论
共有 条评论