|
|
@@ -25,7 +25,18 @@ extern "C"
|
|
|
|
|
|
static void logCallbacks(void* ptr, int level, const char* fmt, va_list list)
|
|
|
{
|
|
|
- vDbg(fmt, list);
|
|
|
+ int n = _vscprintf(fmt, list);
|
|
|
+ if (n >= MAX_PATH) {
|
|
|
+ char* buf = (char*)malloc((size_t)(n + 1));
|
|
|
+ vsnprintf(buf, n + 1, fmt, list);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", buf);
|
|
|
+ free(buf);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ char strlog[MAX_PATH] = { 0 };
|
|
|
+ vsnprintf(strlog, MAX_PATH, fmt, list);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", strlog);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
class CRecorderEntity : public CEntityBase, public CWmvHostApi, public ILogListener,public ISysVarListener
|
|
|
@@ -63,7 +74,7 @@ public:
|
|
|
m_pRecorder = new Clibwmvrecord(&bRet, this, REC_COMMON_AUDIO_SHM_QUEUE,
|
|
|
REC_COMMON_VIDEO_ENV_SHM_RTP_QUEUE, REC_COMMON_VIDEO_OPT_SHM_RTP_QUEUE);
|
|
|
}
|
|
|
- Dbg("init libwmvrecord success!");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("init libwmvrecord success!");
|
|
|
|
|
|
return bRet;
|
|
|
}
|
|
|
@@ -89,28 +100,28 @@ public:
|
|
|
{
|
|
|
if (stricmp(stStaticinfo.strSite,"CMB.FLB")==0)
|
|
|
{
|
|
|
- LOG_TRACE("the type is mobile pad");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("the type is mobile pad");
|
|
|
m_eDeviceType = eMobilePadType;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- LOG_TRACE("the type is pad");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("the type is pad");
|
|
|
m_eDeviceType = ePadtype;
|
|
|
}
|
|
|
}
|
|
|
else if (stricmp(stStaticinfo.strMachineType,"RPM.Stand1S")==0)
|
|
|
{
|
|
|
- LOG_TRACE("the type is rpm.stand1s");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("the type is rpm.stand1s");
|
|
|
m_eDeviceType = eRpm1sType;
|
|
|
}
|
|
|
else if (stricmp(stStaticinfo.strMachineType,"RVC.Desk2S")==0)
|
|
|
{
|
|
|
- LOG_TRACE("the type is Desk2S");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("the type is Desk2S");
|
|
|
m_eDeviceType = eDesk2SType;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- LOG_TRACE("the type is standard");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("the type is standard");
|
|
|
m_eDeviceType = eStand2sType;
|
|
|
}
|
|
|
|
|
|
@@ -161,20 +172,20 @@ public:
|
|
|
Error = GetFunction()->RegistSysVarEvent("SessionID", this);
|
|
|
if (Error != Error_Succeed)
|
|
|
{
|
|
|
- LOG_TRACE("register sysvar %s failed!", "SessionID");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("register sysvar %s failed!", "SessionID");
|
|
|
}
|
|
|
|
|
|
// add by ly 2018/02/13
|
|
|
Error = GetFunction()->GetPath("Temp", m_TempDir);
|
|
|
if (Error != Error_Succeed) {
|
|
|
- LOG_TRACE("get global record temp path failed!");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("get global record temp path failed!");
|
|
|
}
|
|
|
if (m_TempDir.GetLength() > 0 && m_TempDir[m_TempDir.GetLength()-1] != SPLIT_SLASH) {
|
|
|
m_TempDir += SPLIT_SLASH_STR;
|
|
|
}
|
|
|
Error = GetFunction()->GetPath("UploadVideo", m_RecordSaveDir);
|
|
|
if (Error != Error_Succeed) {
|
|
|
- LOG_TRACE("get global record save path failed!");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("get global record save path failed!");
|
|
|
}
|
|
|
if (m_RecordSaveDir.GetLength() > 0 && m_RecordSaveDir[m_RecordSaveDir.GetLength()-1] != SPLIT_SLASH) {
|
|
|
m_RecordSaveDir += SPLIT_SLASH_STR;
|
|
|
@@ -210,7 +221,18 @@ public:
|
|
|
if (RECORD_LOG_INFO <= elevel) {
|
|
|
va_list arg;
|
|
|
va_start(arg, fmt);
|
|
|
- vDbg(fmt, arg);
|
|
|
+ int n = _vscprintf(fmt, arg);
|
|
|
+ if (n >= MAX_PATH) {
|
|
|
+ char* buf = (char*)malloc((size_t)(n + 1));
|
|
|
+ vsnprintf(buf, n + 1, fmt, arg);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", buf);
|
|
|
+ free(buf);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ char strlog[MAX_PATH] = { 0 };
|
|
|
+ vsnprintf(strlog, MAX_PATH, fmt, arg);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", strlog);
|
|
|
+ }
|
|
|
va_end(arg);
|
|
|
}
|
|
|
}
|
|
|
@@ -218,7 +240,18 @@ public:
|
|
|
virtual void vDebug(record_loglevel elevel, const char* str, va_list list)
|
|
|
{
|
|
|
if (RECORD_LOG_INFO <= elevel) {
|
|
|
- vDbg(str, list);
|
|
|
+ int n = _vscprintf(str, list);
|
|
|
+ if (n >= MAX_PATH) {
|
|
|
+ char* buf = (char*)malloc((size_t)(n + 1));
|
|
|
+ vsnprintf(buf, n + 1, str, list);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", buf);
|
|
|
+ free(buf);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ char strlog[MAX_PATH] = { 0 };
|
|
|
+ vsnprintf(strlog, MAX_PATH, str, list);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", strlog);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -227,7 +260,18 @@ public:
|
|
|
{
|
|
|
va_list arg;
|
|
|
va_start(arg, fmt);
|
|
|
- vDbg(fmt, arg);
|
|
|
+ int n = _vscprintf(fmt, arg);
|
|
|
+ if (n >= MAX_PATH) {
|
|
|
+ char* buf = (char*)malloc((size_t)(n + 1));
|
|
|
+ vsnprintf(buf, n + 1, fmt, arg);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", buf);
|
|
|
+ free(buf);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ char strlog[MAX_PATH] = { 0 };
|
|
|
+ vsnprintf(strlog, MAX_PATH, fmt, arg);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", strlog);
|
|
|
+ }
|
|
|
va_end(arg);
|
|
|
}
|
|
|
|
|
|
@@ -244,7 +288,7 @@ public:
|
|
|
|
|
|
virtual void OnRecordFailed(eRvcRecordFailedCase eCase, const char* pszMessage, bool bRecordDevFault)
|
|
|
{
|
|
|
- Dbg("OnRecordFailed!");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("OnRecordFailed!");
|
|
|
if (!bRecordDevFault)
|
|
|
{
|
|
|
LogEvent(Severity_Middle,LOG_EVT_RECORDFAILED,"0");
|
|
|
@@ -257,12 +301,12 @@ public:
|
|
|
|
|
|
virtual void OnRecordEntityExcption()
|
|
|
{
|
|
|
- Dbg("OnRecordEntityExcption!");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("OnRecordEntityExcption!");
|
|
|
}
|
|
|
|
|
|
virtual void OnRecordFinished()
|
|
|
{
|
|
|
- Dbg("OnRecordFinished!");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("OnRecordFinished!");
|
|
|
}
|
|
|
|
|
|
virtual void OnLog(const CAutoArray<CUUID> &SubIDs, const CUUID nLogID,const LogTypeEnum eLogType, const SeverityLevelEnum eLevel,
|
|
|
@@ -271,13 +315,13 @@ public:
|
|
|
{
|
|
|
if (/*(dwUserCode == EVENT_MOD_CUSTOMERAWARE_BEGIN)||*/(dwUserCode == EVENT_MOD_BEGIN_RECORD))
|
|
|
{
|
|
|
- Dbg("start record!");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("start record!");
|
|
|
StartRecord(pszMessage);
|
|
|
|
|
|
}
|
|
|
else if (/*(dwUserCode == EVENT_MOD_CUSTOMERAWARE_END)||*/(dwUserCode == EVENT_MOD_END_RECORD))
|
|
|
{
|
|
|
- Dbg("stop record!");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("stop record!");
|
|
|
StopRecord();
|
|
|
//ReleaseRecorder();
|
|
|
}
|
|
|
@@ -286,7 +330,7 @@ public:
|
|
|
//本地录像,退回到首页关闭当前文件,重新开始录制
|
|
|
if (m_bStarted&&m_pRecorder)
|
|
|
{
|
|
|
- Dbg("return menu,close video file!");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("return menu,close video file!");
|
|
|
m_pRecorder->CloseVideoFile();
|
|
|
}
|
|
|
}
|
|
|
@@ -298,7 +342,7 @@ private:
|
|
|
{
|
|
|
if (_stricmp(pszKey, SYSVAR_CAMERASTATE) == 0)
|
|
|
{
|
|
|
- Dbg("camera state from : %c to %c", pszOldValue[0], pszValue[0]);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("camera state from : %c to %c", pszOldValue[0], pszValue[0]);
|
|
|
m_iCameraState = pszValue[0];
|
|
|
if (pszValue[0] == 'E')
|
|
|
{
|
|
|
@@ -340,7 +384,7 @@ private:
|
|
|
{
|
|
|
if (m_bStarted)
|
|
|
{
|
|
|
- Dbg("Sessionid change to %s,close record and start new video file",strSessionID.GetData());
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Sessionid change to %s,close record and start new video file",strSessionID.GetData());
|
|
|
m_pRecorder->ReNameVideoFile(strSessionID);
|
|
|
}
|
|
|
|
|
|
@@ -359,7 +403,7 @@ private:
|
|
|
// edit by ly@2018/06/07
|
|
|
void StartRecord(const char *wmvfilename)
|
|
|
{
|
|
|
- Dbg("wmvfilename = %s", wmvfilename);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("wmvfilename = %s", wmvfilename);
|
|
|
//Dbg("strPath = %s", (LPCSTR)m_RecordSaveDir);
|
|
|
int fps = 5;
|
|
|
Rvc_RecordAudioParam_t tAudioParams;
|