</pre><pre name="code" class="html">
基于live555 testRtspClient.cpp 改造, 已经封装成 dll 模块,提供了视频帧回调接口. live555 需要编译成静态库, 请自行编译,网上很多例子,比较简单
源码下载地址: http://download.youkuaiyun.com/detail/mtour/8035591
通过此模块能够获取到海康摄像机音视频帧数据
模块接口定义:
typedef enum VIDEO_TYPE
{
VIDEO_TYPE_SPS=0,
VIDEO_TYPE_PPS,
VIDEO_TYPE_I,
VIDEO_TYPE_P,
VIDEO_TYPE_INVAILED=-1
}VIDEO_TYPE;
typedef enum AUDIO_TYPE
{
AUDIO_TYPE_G711A=0
}AUDIO_TYPE;
#ifdef __cplusplus
extern "C" {
#endif
typedef int (CALLBACK *LPSreamDataCallBack)(int bVideo, int nType, unsigned char* lpBuf, int nBufSize, LONGLONG llTimeStamp,void* pUser);
RTSP_STREAM_API int RTSP_STREAM_Init();
RTSP_STREAM_API int RTSP_STREAM_Fini();
/*
return: open handle >=0 success ; <0 failed
*/
RTSP_STREAM_API int RTSP_STREAM_Open(char* sRtspUrl,LPSreamDataCallBack pStreamCB, void* pUserData);
RTSP_STREAM_API int RTSP_STREAM_Close(int nOpenHandle);
注意:
由于live555 是单线程, rtspClient对象 请不要在自定义线程中进行释放,否则会导致报错。