|
@@ -34,14 +34,16 @@
|
|
|
|
|
|
#define MAX_DISK_PERCENT 95 // 磁盘最大占用百分比
|
|
|
|
|
|
+
|
|
|
static const char* record_failed_case_table[] = {
|
|
|
- "启动录像失败,初始化失败",
|
|
|
- "启动录像失败,字体为空,添加水印失败",
|
|
|
- "开始录像失败,请稍后(约30秒)再试",
|
|
|
- "录像失败,摄像头故障,获取不到视频,请联系厂商进行维修",
|
|
|
- "录像失败,获取不到远端音频,请检查风险提示音是否正常播放且音量大小是否正常",
|
|
|
- "录像失败,麦克风故障,获取不到本地音频,请联系厂商进行维修",
|
|
|
- "录像失败,系统不支持当前音频采样率"
|
|
|
+ "[RTA3L01] 启动录像失败,初始化失败",
|
|
|
+ "[RTA3L02] 启动录像失败,字体为空,添加水印失败",
|
|
|
+ "[RTA3L03] 开始录像失败,请稍后(约30秒)再试",
|
|
|
+ "[RTA3L04] 录像失败,摄像头故障,获取不到视频,请联系厂商进行维修",
|
|
|
+ "[RTA3L05] 录像失败,获取不到远端音频,请检查风险提示音是否正常播放且音量大小是否正常",
|
|
|
+ "[RTA3L06] 录像失败,麦克风故障,获取不到本地音频,请联系厂商进行维修",
|
|
|
+ "[RTA3L07] 录像失败,系统不支持当前音频采样率",
|
|
|
+ "[RTA3L08] 录像失败,获取不到远端视频,请稍后(约30秒)再试"
|
|
|
};
|
|
|
|
|
|
static ErrorCodeEnum ParseIPAddress(const char *str, CSimpleStringA &ip, int &port)
|
|
@@ -210,7 +212,7 @@ static BOOL FindMatchedFile(LPCSTR sFindPath, LPCSTR sFindFileName, ULONGLONG& u
|
|
|
|
|
|
//linux不支持*查找,去掉后缀
|
|
|
char strsuffix[MAX_PATH] = { 0 };
|
|
|
- snprintf(strsuffix, MAX_PATH, "*.%s", RVC_RECORD_SUFFIX);
|
|
|
+ snprintf(strsuffix, MAX_PATH, "*.%s", RECORD_MP4_SUFFIX);
|
|
|
if (tmpFindFileName.IsEndWith(strsuffix)) {
|
|
|
tmpFindFileName = tmpFindFileName.SubString(0, tmpFindFileName.GetLength() - 5);
|
|
|
}
|
|
@@ -341,7 +343,6 @@ void CSalesRecorderEntity::OnPreStart( CAutoArray<CSimpleStringA> strArgs,CSmart
|
|
|
|
|
|
ErrorCodeEnum CSalesRecorderEntity::__OnStart( ErrorCodeEnum preOperationError )
|
|
|
{
|
|
|
- LOG_FUNCTION();
|
|
|
//MessageBoxA(0,0,0,0);
|
|
|
m_eDeviceType = eStand2sType;
|
|
|
m_nSysCallType = 0;
|
|
@@ -356,15 +357,13 @@ ErrorCodeEnum CSalesRecorderEntity::__OnStart( ErrorCodeEnum preOperationError )
|
|
|
int iAudioQuality = 3;
|
|
|
int iAudioNsPolicy = 2;
|
|
|
int iIsAudioNsOn = 0;
|
|
|
- m_max_disk_percent = MAX_DISK_PERCENT; // add by ly 2018/02/24
|
|
|
+ m_max_disk_percent = MAX_DISK_PERCENT;
|
|
|
CSmartPointer<IConfigInfo> spConfig;
|
|
|
CSmartPointer<IEntityFunction> spFunction = GetFunction();
|
|
|
if (spFunction->OpenConfig(Config_CenterSetting, spConfig) == Error_Succeed) {
|
|
|
spConfig->ReadConfigValueInt("SalesRecorder","MaxDiskPercent",m_max_disk_percent);
|
|
|
spConfig->ReadConfigValueInt("SalesRecorder","AudioSampleRate",m_audio_samplerate);
|
|
|
spConfig->ReadConfigValueInt("SalesRecorder","AudioBitRate",m_audio_out_bitrate);
|
|
|
- spConfig->ReadConfigValueInt("SalesRecorder","WholeSection",m_bWholeSection);
|
|
|
- spConfig->ReadConfigValueInt("SalesRecorder","ApplyHighQuality",m_bApplyHighQuality);
|
|
|
spConfig->ReadConfigValueInt("SalesRecorder","AudioNsPolicy",iAudioNsPolicy);
|
|
|
spConfig->ReadConfigValueInt("SalesRecorder","IsAudioNsOn",iIsAudioNsOn);
|
|
|
spConfig->ReadConfigValueInt("SalesRecorder","AudioQuality",iAudioQuality);
|
|
@@ -387,7 +386,7 @@ ErrorCodeEnum CSalesRecorderEntity::__OnStart( ErrorCodeEnum preOperationError )
|
|
|
if (m_bApplyHighQuality != 0 && m_bApplyHighQuality != 1){
|
|
|
m_bApplyHighQuality = FALSE;
|
|
|
}
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("[dbg] m_bApplyHighQuality:%d",m_bApplyHighQuality);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("[dbg] m_bApplyHighQuality:%d",m_bApplyHighQuality);
|
|
|
|
|
|
m_bEwsRecord = FALSE;
|
|
|
|
|
@@ -759,22 +758,22 @@ ErrorCodeEnum CSalesRecorderEntity::DecideCameraCount( int &nCount )
|
|
|
}
|
|
|
|
|
|
|
|
|
-BOOL CSalesRecorderEntity::GetStandardQualityOnSiteSalesRecorder()
|
|
|
+bool CSalesRecorderEntity::GetStandardQualityOnSiteSalesRecorder()
|
|
|
{
|
|
|
- BOOL bRet = FALSE;
|
|
|
+ bool bRet = FALSE;
|
|
|
|
|
|
- m_pRecorder = new Clibwmvrecord(&bRet, this, REC_COMMON_AUDIO_SHM_QUEUE, REC_COMMON_VIDEO_ENV_SHM_SNAPSHOT_QUEUE,
|
|
|
+ m_pRecorder = new Clibvideorecord(&bRet, this, REC_COMMON_AUDIO_SHM_QUEUE, REC_COMMON_VIDEO_ENV_SHM_SNAPSHOT_QUEUE,
|
|
|
REC_COMMON_VIDEO_OPT_SHM_SNAPSHOT_QUEUE, REC_COMMON_AUDIO_SALES_SHM_QUEUE, REC_COMMON_VIDEO_REMOTE_SHM_RTP_QUEUE, REC_COMMON_REMOTEAUDIO_SHM_QUEUE);
|
|
|
|
|
|
return bRet;
|
|
|
}
|
|
|
|
|
|
|
|
|
-BOOL CSalesRecorderEntity::GetHighQualityOnSiteSalesRecorder()
|
|
|
+bool CSalesRecorderEntity::GetHighQualityOnSiteSalesRecorder()
|
|
|
{
|
|
|
- BOOL bRet = FALSE;
|
|
|
+ bool bRet = false;
|
|
|
|
|
|
- m_pRecorder = new Clibwmvrecord(&bRet, this, REC_COMMON_AUDIO_SHM_QUEUE, REC_COMMON_VIDEO_ENV_SHM_SNAPSHOT_QUEUE,
|
|
|
+ m_pRecorder = new Clibvideorecord(&bRet, this, REC_COMMON_AUDIO_SHM_QUEUE, REC_COMMON_VIDEO_ENV_SHM_SNAPSHOT_QUEUE,
|
|
|
REC_COMMON_VIDEO_OPT_SHM_SNAPSHOT_QUEUE, REC_COMMON_AUDIO_SALES_SHM_QUEUE, REC_COMMON_VIDEO_REMOTE_SHM_RTP_QUEUE, REC_COMMON_REMOTEAUDIO_SHM_QUEUE);
|
|
|
|
|
|
return bRet;
|
|
@@ -796,10 +795,10 @@ void CSalesRecorderEntity::StartOnSiteSalesRecord(const int fps, const char* wmv
|
|
|
}
|
|
|
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("init lib wmv record success! and record type is %s and output audio quality is %s, audio noise suppression flag is %s. noise suppression policy is %d.", record_type_table[eRecordType], audio_quality_type_table[m_eAudioOutQuality], tAudioParams.bIsNsOn ? "true" : "false", tAudioParams.iNsPolicy);
|
|
|
- if (m_pRecorder->StartWmvRecord(fps, videoquality, &tAudioParams, subtitleParam, bWholeSection, FALSE, (LPCSTR)m_TempDir,
|
|
|
+ if (m_pRecorder->StartVideoRecord(fps, videoquality, eMP4, &tAudioParams, subtitleParam, bWholeSection, FALSE, (LPCSTR)m_TempDir,
|
|
|
m_TempDir.GetLength(), wmvfilename, strlen(wmvfilename)))
|
|
|
{
|
|
|
- m_bStarted = TRUE;
|
|
|
+ m_bStarted = true;
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Start WmvRecord success!");
|
|
|
}
|
|
|
else {
|
|
@@ -819,7 +818,7 @@ ErrorCodeEnum CSalesRecorderEntity::StopRecord()
|
|
|
ErrorCodeEnum eCode = Error_Succeed;
|
|
|
if (m_bStarted)
|
|
|
{
|
|
|
- m_pRecorder->StopWmvRecord();
|
|
|
+ m_pRecorder->StopVideoRecord();
|
|
|
|
|
|
m_bStarted = FALSE;
|
|
|
}
|
|
@@ -833,33 +832,7 @@ ErrorCodeEnum CSalesRecorderEntity::StopRecord()
|
|
|
ErrorCodeEnum CSalesRecorderEntity::ShowVideo( const char *wmvfilename )
|
|
|
{
|
|
|
ErrorCodeEnum ErrorCode = Error_Succeed;
|
|
|
- if(!m_bStarted)
|
|
|
- {
|
|
|
- CSimpleStringA strPath;
|
|
|
- ErrorCodeEnum Error = GetFunction()->GetPath("Temp", strPath);
|
|
|
- if (Error == Error_Succeed) {
|
|
|
- if (strPath.GetLength() > 0 && strPath[strPath.GetLength()-1] != SPLIT_SLASH) {
|
|
|
- strPath += SPLIT_SLASH_STR;
|
|
|
- }
|
|
|
- CSimpleStringA strFindFileName = CSimpleStringA::Format("%s*.%s", wmvfilename, RVC_RECORD_SUFFIX);
|
|
|
- ULONGLONG uVideoCount = 0;
|
|
|
- BOOL bRet = FindMatchedFile((LPCSTR)strPath, (LPCTSTR)strFindFileName, uVideoCount);
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("bRet = %d while find %s", bRet, wmvfilename);
|
|
|
- if(bRet){
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("succeed to get record count while play video!");
|
|
|
- //DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("m_pPlayer = %p while play!", m_pPlayer);
|
|
|
- //m_pPlayer->PlayVideo((LPCSTR)strPath, wmvfilename, uVideoCount);
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("succeed to play video!");
|
|
|
- }
|
|
|
- else{
|
|
|
- ErrorCode = Error_NotExist;
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("play video failed for %s no exist!", wmvfilename);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- else{
|
|
|
- ErrorCode = Error_NotImpl;
|
|
|
- }
|
|
|
+
|
|
|
return ErrorCode;
|
|
|
}
|
|
|
|
|
@@ -867,33 +840,7 @@ ErrorCodeEnum CSalesRecorderEntity::ShowVideo( const char *wmvfilename )
|
|
|
ErrorCodeEnum CSalesRecorderEntity::PlaySalesRecordVideo( const char *wmvfilename, int iWndX, int iWndY, int iWndWidth, int iWndHeight)
|
|
|
{
|
|
|
ErrorCodeEnum ErrorCode = Error_Succeed;
|
|
|
- if(!m_bStarted)
|
|
|
- {
|
|
|
- CSimpleStringA strPath;
|
|
|
- ErrorCodeEnum Error = GetFunction()->GetPath("Temp", strPath);
|
|
|
- if (Error == Error_Succeed) {
|
|
|
- if (strPath.GetLength() > 0 && strPath[strPath.GetLength()-1] != SPLIT_SLASH) {
|
|
|
- strPath += SPLIT_SLASH_STR;
|
|
|
- }
|
|
|
- CSimpleStringA strFindFileName = CSimpleStringA::Format("%s*.%s", wmvfilename, RVC_RECORD_SUFFIX);
|
|
|
- ULONGLONG uVideoCount = 0;
|
|
|
- BOOL bRet = FindMatchedFile((LPCSTR)strPath, (LPCTSTR)strFindFileName, uVideoCount);
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("bRet = %d while find %s", bRet, wmvfilename);
|
|
|
- if(bRet){
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("succeed to get record count while play sales record video!");
|
|
|
- //DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("m_pPlayer = %p while play!", m_pPlayer);
|
|
|
- //m_pPlayer->PlaySalesRecordVideo(iWndX, iWndY, iWndWidth, iWndHeight,(LPCSTR)strPath, wmvfilename, uVideoCount);
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("succeed to play sales record video!");
|
|
|
- }
|
|
|
- else{
|
|
|
- ErrorCode = Error_NotExist;
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("play play sales record video failed for %s no exist!", wmvfilename);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- else{
|
|
|
- ErrorCode = Error_NotImpl;
|
|
|
- }
|
|
|
+
|
|
|
return ErrorCode;
|
|
|
}
|
|
|
|
|
@@ -908,7 +855,7 @@ void CSalesRecorderEntity::DeleteVideo( const char *wmvfilename )
|
|
|
if (strPath.GetLength() > 0 && strPath[strPath.GetLength()-1] != SPLIT_SLASH) {
|
|
|
strPath += SPLIT_SLASH_STR;
|
|
|
}
|
|
|
- CSimpleStringA strFindFileName = CSimpleStringA::Format("%s*.%s", wmvfilename, RVC_RECORD_SUFFIX);
|
|
|
+ CSimpleStringA strFindFileName = CSimpleStringA::Format("%s*.%s", wmvfilename, RECORD_MP4_SUFFIX);
|
|
|
ULONGLONG uVideoCount = 0;
|
|
|
BOOL bRet = FindMatchedFile((LPCSTR)strPath, (LPCTSTR)strFindFileName, uVideoCount);
|
|
|
if(bRet)
|
|
@@ -918,7 +865,7 @@ void CSalesRecorderEntity::DeleteVideo( const char *wmvfilename )
|
|
|
BOOL bDeleteSucc = TRUE;
|
|
|
for(int i = 0; i != uVideoCount; ++i)
|
|
|
{
|
|
|
- fileName = CSimpleStringA::Format("%s%s_%d.%s", (LPCSTR)strPath, wmvfilename, i, RVC_RECORD_SUFFIX);
|
|
|
+ fileName = CSimpleStringA::Format("%s%s_%d.%s", (LPCSTR)strPath, wmvfilename, i, RECORD_MP4_SUFFIX);
|
|
|
|
|
|
if(remove(fileName.GetData())) {
|
|
|
bDeleteSucc = FALSE;
|
|
@@ -968,7 +915,7 @@ ErrorCodeEnum CSalesRecorderEntity::SaveVideo( const char *wmvfilename )
|
|
|
}
|
|
|
ULONGLONG uVideoCount = 0;
|
|
|
// 移动销售录像 edit by ly 2018/03/05
|
|
|
- CSimpleStringA strFindFileName = CSimpleStringA::Format("S_%s*.%s", wmvfilename, RVC_RECORD_SUFFIX);
|
|
|
+ CSimpleStringA strFindFileName = CSimpleStringA::Format("S_%s*.%s", wmvfilename, RECORD_MP4_SUFFIX);
|
|
|
BOOL bRet = FindMatchedFile((LPCSTR)sourPath, (LPCSTR)strFindFileName, uVideoCount);
|
|
|
if(bRet)
|
|
|
{
|
|
@@ -986,8 +933,8 @@ ErrorCodeEnum CSalesRecorderEntity::SaveVideo( const char *wmvfilename )
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("strFindFileName=%s", (LPCSTR)strFindFileName);
|
|
|
for(int i = 0; i != uVideoCount; ++i)
|
|
|
{
|
|
|
- sourFileName = CSimpleStringA::Format("%s%s_%d.%s", (LPCSTR)sourPath, (LPCSTR)strFindFileName, i, RVC_RECORD_SUFFIX);
|
|
|
- destFileName = CSimpleStringA::Format("%s%s_%d.%s", (LPCSTR)destPath, (LPCSTR)strFindFileName, i, RVC_RECORD_SUFFIX);
|
|
|
+ sourFileName = CSimpleStringA::Format("%s%s_%d.%s", (LPCSTR)sourPath, (LPCSTR)strFindFileName, i, RECORD_MP4_SUFFIX);
|
|
|
+ destFileName = CSimpleStringA::Format("%s%s_%d.%s", (LPCSTR)destPath, (LPCSTR)strFindFileName, i, RECORD_MP4_SUFFIX);
|
|
|
unsigned long ufilesize = GetFileSize(sourFileName.GetData());
|
|
|
char strtext[MAX_PATH] = {0};
|
|
|
snprintf(strtext, MAX_PATH, "%s file size is %u byte.", (LPCSTR)sourFileName, ufilesize);
|
|
@@ -1096,15 +1043,8 @@ ErrorCodeEnum CSalesRecorderEntity::HandleStartRecord(const char *pszMessage, co
|
|
|
char *tmp = new char[ulen+1];
|
|
|
m_bEwsRecord = FALSE;
|
|
|
|
|
|
- if ((false == bRemoteRecord) && (ulen >= EWS_CAMERA_FLAG_LEN) && (0 == strnicmp(pszMessage,EWS_CAMERA_FLAG,EWS_CAMERA_FLAG_LEN)))
|
|
|
- {
|
|
|
- m_bEwsRecord = TRUE;
|
|
|
- strncpy(tmp, pszMessage+EWS_CAMERA_FLAG_LEN, ulen-EWS_CAMERA_FLAG_LEN);
|
|
|
- }
|
|
|
- else{
|
|
|
- strncpy(tmp, pszMessage, ulen);
|
|
|
- }
|
|
|
-
|
|
|
+ strncpy(tmp, pszMessage, ulen);
|
|
|
+
|
|
|
char *result[32] = {0};
|
|
|
CStringSplit(tmp, result, "@");
|
|
|
|
|
@@ -1193,7 +1133,7 @@ ErrorCodeEnum CSalesRecorderEntity::HandleStartRecord(const char *pszMessage, co
|
|
|
subtitleParam.bSubtitle = TRUE;
|
|
|
subtitleParam.bSubtitleSection = TRUE;
|
|
|
subtitleParam.topSubtitleData[0] = '\0';
|
|
|
- if (strlen(subTitle.SapID)>0&&strlen(subTitle.CustManagerName)>0) // 有无客户经理的双录字幕 edit by ly @2018/01/10
|
|
|
+ if (strlen(subTitle.SapID)>0&&strlen(subTitle.CustManagerName)>0)
|
|
|
{
|
|
|
swprintf(subtitleParam.bottomSubtitleData1, MAX_PATH, L"%s %s %s", subTitle.CustCardNo, subTitle.CustName, subTitle.ProductCode);
|
|
|
swprintf(subtitleParam.bottomSubtitleData2, MAX_PATH, L"%s %s %s", subTitle.ProductName, subTitle.SapID, subTitle.CustManagerName);
|
|
@@ -1351,9 +1291,9 @@ ErrorCodeEnum CSalesRecorderEntity::HandleSalesRecordEntityException(const char*
|
|
|
return Error_Succeed;
|
|
|
}
|
|
|
|
|
|
-BOOL CSalesRecorderEntity::InitSalesRecorder()
|
|
|
+bool CSalesRecorderEntity::InitSalesRecorder()
|
|
|
{
|
|
|
- BOOL bRet = FALSE;
|
|
|
+ bool bRet = FALSE;
|
|
|
if (m_bApplyHighQuality)
|
|
|
{
|
|
|
bRet = GetHighQualityOnSiteSalesRecorder();
|
|
@@ -1367,13 +1307,13 @@ BOOL CSalesRecorderEntity::InitSalesRecorder()
|
|
|
}
|
|
|
|
|
|
|
|
|
-BOOL CSalesRecorderEntity::ReleaseSalesRecorder()
|
|
|
+bool CSalesRecorderEntity::ReleaseSalesRecorder()
|
|
|
{
|
|
|
if (m_pRecorder) {
|
|
|
delete m_pRecorder;
|
|
|
m_pRecorder = NULL;
|
|
|
}
|
|
|
- return TRUE;
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1563,7 +1503,7 @@ void CSalesRecorderEntity::UploadTempPathVideos() {
|
|
|
char srcFilePath[MAX_PATH] = { 0 };
|
|
|
DIR* pDir = NULL;
|
|
|
struct dirent* pFile = NULL;
|
|
|
- snprintf(srcFilePath, MAX_PATH, "%s*.%s", sourPath, RVC_RECORD_SUFFIX);
|
|
|
+ snprintf(srcFilePath, MAX_PATH, "%s*.%s", sourPath, RECORD_MP4_SUFFIX);
|
|
|
|
|
|
pDir = opendir(sourPath);
|
|
|
if (pDir == NULL) return ;
|