123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- #pragma once
- // 下列 ifdef 块是创建使从 DLL 导出更简单的
- // 宏的标准方法。此 DLL 中的所有文件都是用命令行上定义的 LIBRECORD_EXPORTS
- // 符号编译的。在使用此 DLL 的
- // 任何其他项目上不应定义此符号。这样,源文件中包含此文件的任何其他项目都会将
- // LIBRECORD_API 函数视为是从 DLL 导入的,而此 DLL 则将用此宏定义的
- // 符号视为是被导出的。
- #ifdef _MSC_VER
- #ifdef LIBVIDEORECORD_EXPORTS
- #define LIBVIDEORECORD_API __declspec(dllexport)
- #else
- #define LIBVIDEORECORD_API __declspec(dllimport)
- #endif
- # elif ( defined(__GNUC__) && __GNUC__ >= 4 )
- #define LIBVIDEORECORD_API __attribute__((visibility("default")))
- #else
- #define LIBVIDEORECORD_API
- #endif
- #include <stdarg.h>
- #include <stdio.h>
- #ifndef REC_MAX_FILE
- #define REC_MAX_FILE 600000 //录像文件最大容量10分钟,超出大小后另辟文件保存
- #endif
- #ifndef MAX_PATH
- #define MAX_PATH 260
- #endif // !MAX_PATH
- #ifndef RECORD_MP4_SUFFIX
- #define RECORD_MP4_SUFFIX "mp4"
- #endif
- enum eVideoFormat {
- eWMV,
- eMP4
- };
- enum eStereoArrayType{
- eLocalLeft,
- eRemoteLeft
- };
- enum record_loglevel {
- RECORD_LOG_DEBUG,
- RECORD_LOG_INFO,
- RECORD_LOG_WARN,
- RECORD_LOG_ERROR,
- RECORD_LOG_FATAL
- };
- enum eAudioOutPutType{
- eUnKnown,
- eLowDefinition,
- eStandardDefinition,
- eHighDefinition,
- eUltraHD
- };
- static const char* audio_quality_type_table[] = {
- "eUnKnown",
- "eLowDefinition",
- "eStandardDefinition",
- "eHighDefinition",
- "eUltraHD"
- };
- //录制双向的视频类型,0:单向录制,1:坐席<->大机双录
- enum eRvcRecordType{
- eSingleSide,
- eStand2Agent
- };
- static const char* record_type_table[] = {
- "SingleSide",
- "Stand2Agent"
- };
- typedef struct Rvc_RecordAudioParam_s{
- eRvcRecordType eRecordType;
- eAudioOutPutType eOutPutType;
- bool bIsNsOn;
- int iNsPolicy;
- bool bIsTransOn;
- int iAudioChannels;
- bool bMuteAudioMode;
- }Rvc_RecordAudioParam_t;
- typedef struct
- {
- bool bSubtitle;
- bool bSubtitleSection;
- char topSubtitleData[MAX_PATH];
- #ifdef _WIN32
- char bottomSubtitleData1[MAX_PATH];
- char bottomSubtitleData2[MAX_PATH];
- char strRightAgentInfo[MAX_PATH];
- #else
- wchar_t bottomSubtitleData1[MAX_PATH];
- wchar_t bottomSubtitleData2[MAX_PATH];
- wchar_t strRightAgentInfo[MAX_PATH];
- #endif
- } SubtitleParam;
- enum eRvcRecordFailedCase{
- eInitialFailed,
- eFontNULL,
- eBeginFailed,
- eVideoGetFailed,
- eRemoteAudioGetFailed,
- eLocalAudioGetFailed,
- eSampNotSupport,
- eAudioStreamWriteFailed,
- eRemoteVideoGetFailed,
- eDefault
- };
- class CHostApi
- {
- public:
- virtual void Debug(record_loglevel elevel, const char *fmt, ...) = 0;
- virtual void vDebug(record_loglevel elevel, const char* str, va_list list) = 0;
- virtual int GetRecordCamera() = 0;
- virtual void OnRecordFailed(eRvcRecordFailedCase eCase, const char *pszMessage, bool bRecordDevFault=false) = 0;
- virtual void OnRecordEntityExcption() = 0;
- virtual void OnASectionFinished(const char* pszMessage, int iSerialNum, bool bfinished) = 0;
- virtual void OnRecordFinished() = 0;
- virtual int GetCameraState() = 0;
- };
- class libvideorecord_impl; //桥接
- // 此类是从 libwmvrecord.dll 导出的
- class LIBVIDEORECORD_API Clibvideorecord
- {
- public:
- Clibvideorecord(bool*pResult, CHostApi *pHostAPI,const char* audioqueuename, const char* videoqueuename, const char* videoqueue2name, const char* salesaudioqueuename=NULL, const char* remotevideoqueuename=NULL, const char* remoteaudioqueuename=NULL);
- ~Clibvideorecord(void);
- // //开始记录,文件名videofilename为空则以当前系统时间做参数
- bool StartVideoRecord(
- int fps,
- int videoquality,
- eVideoFormat eFormat,
- Rvc_RecordAudioParam_t* pAudioParam,
- SubtitleParam *subtitleParam = NULL,
- bool bWholeSection = false,
- bool bSessionManage = false,
- const char *pathname = NULL,
- int pathlength = 0,
- const char *videofilename = NULL,
- int filenamelength = 0
- );
- bool StopVideoRecord(); //退出
- void CloseVideoFile(); //结束当前录像
- bool ReNameVideoFile(const char*newfilename); //session变化,修改当前录像文件名
- #ifdef _WIN32
- bool SetRightVideoWaterMark(const char* strWaterMark); //设置拼接后右侧视频的水印
- #else
- bool SetRightVideoWaterMark(const wchar_t* strWaterMark); //设置拼接后右侧视频的水印
- #endif
- bool PauseRecord(); //暂停录像
- bool ContinueRecord(); //继续录像
- private:
- libvideorecord_impl* m_pImpl;
- };
|