|
@@ -238,10 +238,10 @@ void CLocalMediaPlayEntity::loadDefaultMedia()
|
|
|
Dbg("config.strRootPath: %s", curVideo.strRootPath);
|
|
|
|
|
|
CSimpleStringA strRunTime_S, strRunTime_E;
|
|
|
- // ����ͨ������
|
|
|
+
|
|
|
table.AddEntryString("General", "VideoRunTime_Start", strRunTime_S, "");
|
|
|
table.AddEntryString("General", "VideoRunTime_End", strRunTime_E, "");
|
|
|
- // ������Ƶ����
|
|
|
+
|
|
|
table.AddEntryBoolean(sectionList[i].GetData(), "FullScreen", curVideo.bFullScreen, false);
|
|
|
table.AddEntryBoolean(sectionList[i].GetData(), "PrimMonitor", curVideo.bPrimMonitor, false);
|
|
|
table.AddEntryBoolean(sectionList[i].GetData(), "SimpleMode", curVideo.bSimpleMode, true);
|
|
@@ -253,7 +253,6 @@ void CLocalMediaPlayEntity::loadDefaultMedia()
|
|
|
else
|
|
|
Dbg("Fail to LoadWmpConfig!");
|
|
|
|
|
|
- // �������� add by ly at 2017/06/06
|
|
|
curVideo.nVolume = 50;
|
|
|
Error = GetFunction()->OpenConfig(Config_Run, tempConfig);
|
|
|
if (Error == Error_Succeed)
|
|
@@ -309,7 +308,6 @@ void CLocalMediaPlayEntity::loadDefaultMedia()
|
|
|
table.AddEntryInt(sectionList[i], "PlayCount", curAudio.nPlayCnt, 0);
|
|
|
table.AddEntryInt(sectionList[i], "PlayInterval", curAudio.nPlayInterval, 0);
|
|
|
|
|
|
- // ��������
|
|
|
auto audioRet = GetLocalAudioVolume();
|
|
|
if (audioRet.first)
|
|
|
curAudio.nVolume = audioRet.second;
|
|
@@ -450,6 +448,41 @@ void CLocalMediaPlayEntity::AudioPlayFinished()
|
|
|
SpSendBroadcast(GetFunction(), eMsg_AudioPlayRet, eMsgSig_AudioPlayRet, ret);
|
|
|
}
|
|
|
|
|
|
+int CLocalMediaPlayEntity::GetMediaPlayerIcoPath(char* strPath, size_t uLen)
|
|
|
+{
|
|
|
+ return GetPlayerIcoPath(strPath, uLen);
|
|
|
+}
|
|
|
+
|
|
|
+int CLocalMediaPlayEntity::GetPicPlayerIcoPath(char* strPath, size_t uLen)
|
|
|
+{
|
|
|
+ return GetPlayerIcoPath(strPath, uLen);
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+int CLocalMediaPlayEntity::GetPlayerIcoPath(char* strPath, size_t uLen)
|
|
|
+{
|
|
|
+ int iRet = -1;
|
|
|
+ if (NULL == strPath) {
|
|
|
+ return iRet;
|
|
|
+ }
|
|
|
+ CSimpleStringA csBinPath, csBackslash("/");
|
|
|
+ ErrorCodeEnum eErrPath = GetFunction()->GetPath("Bin", csBinPath);
|
|
|
+ if (eErrPath != Error_Succeed) {
|
|
|
+ Dbg("GetBasePath failed (%d).", eErrPath);
|
|
|
+ return iRet;
|
|
|
+ }
|
|
|
+
|
|
|
+ CSimpleStringA szIcoName("rvc_media_player_64px.bmp");
|
|
|
+ szIcoName = csBinPath + csBackslash + szIcoName;
|
|
|
+ Dbg("media player ico full path is %s.", szIcoName.GetData());
|
|
|
+
|
|
|
+ if (uLen > szIcoName.GetLength()) {
|
|
|
+ memcpy(strPath, szIcoName.GetData(), szIcoName.GetLength());
|
|
|
+ iRet = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ return iRet;
|
|
|
+}
|
|
|
#endif // RVC_OS_WIN
|
|
|
|
|
|
|
|
@@ -510,10 +543,8 @@ ErrorCodeEnum CLocalMediaPlayEntity::__OnStart(ErrorCodeEnum preOperationError)
|
|
|
|
|
|
//setMediaPath();
|
|
|
loadDefaultMedia();
|
|
|
-
|
|
|
- // ����IEBrowser�����¼�
|
|
|
+
|
|
|
GetFunction()->SubscribeLog(m_SubIDIEIdle, this, Log_Event, Severity_None, Error_IgnoreAll, LOG_EVT_SELFCHECK_IEBROWSER_IDLE, NULL, false);
|
|
|
- // ʵ�������Ŷ���
|
|
|
|
|
|
#ifdef RVC_OS_WIN
|
|
|
m_scanThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)& qryMedia, this, 0, NULL);
|
|
@@ -558,9 +589,7 @@ ErrorCodeEnum CLocalMediaPlayEntity::__OnClose(ErrorCodeEnum preOperationError)
|
|
|
delete m_pMediaAudioPlayer; m_pMediaAudioPlayer = NULL;
|
|
|
#endif // RVC_OS_WIN
|
|
|
|
|
|
- // �˶�������ҳ�¼�
|
|
|
GetFunction()->UnsubscribeLog(m_SubIDIEIdle);
|
|
|
- // �ͷŲ��Ŷ���
|
|
|
return Error_Succeed;
|
|
|
}
|
|
|
|
|
@@ -591,26 +620,20 @@ DWORD WINAPI CheckAudioThread(LPVOID param)
|
|
|
|
|
|
#else
|
|
|
|
|
|
-void* CheckAudioPlayingThreadFunc(void* param)
|
|
|
+void* StartAudioPlayingThreadFunc(void* param)
|
|
|
{
|
|
|
CLocalMediaPlayEntity* entity = (CLocalMediaPlayEntity*)param;
|
|
|
- Dbg("Begin CheckAudioPlayingThreadFunc");
|
|
|
-
|
|
|
- pthread_t playThreadId = 0;
|
|
|
- if (!entity->m_pMediaAudioPlayer->checkIsPlay(&playThreadId))
|
|
|
- {
|
|
|
- Dbg("Create play audio Media Thread Failed!");
|
|
|
- return 0;
|
|
|
+ Dbg("Enter StartAudioPlayingThreadFunc");
|
|
|
+ const char* pAudioNames = entity->m_lastPlayAudio.c_str();
|
|
|
+ Dbg("Begin StartAudio, and Audio Info is %s.", pAudioNames);
|
|
|
+ if (0 == entity->m_pMediaAudioPlayer->PlayLocalAudio(pAudioNames)) {
|
|
|
+ Dbg("Succeed to StartAudio, and Audio Info is %s.", pAudioNames);
|
|
|
}
|
|
|
- pthread_join(playThreadId, NULL);
|
|
|
-
|
|
|
- AudioPlayRet ret;
|
|
|
- ret.AudioNames = entity->m_lastPlayAudio.c_str();
|
|
|
- ret.ret = true;
|
|
|
- Dbg("stop play audio %s success", ret.AudioNames);
|
|
|
- SpSendBroadcast(entity->GetFunction(), eMsg_AudioPlayRet, eMsgSig_AudioPlayRet, ret);
|
|
|
+ else{
|
|
|
+ Dbg("StartAudio failed, for %s is not exsit.", pAudioNames);
|
|
|
+ }
|
|
|
+ Dbg("Leave StartAudioPlayingThreadFunc");
|
|
|
|
|
|
- return 0;
|
|
|
}
|
|
|
|
|
|
#endif // RVC_OS_WIN
|
|
@@ -756,11 +779,11 @@ DWORD WINAPI MediaPlayThread(LPVOID param)
|
|
|
return 0;
|
|
|
}
|
|
|
#else
|
|
|
-int StartMediaPlay(void* param)
|
|
|
+void* StartMediaPlayFunc(void* param)
|
|
|
{
|
|
|
int iRet = -1;
|
|
|
if (NULL == param){
|
|
|
- return iRet;
|
|
|
+ return (void*)&iRet;
|
|
|
}
|
|
|
|
|
|
CLocalMediaPlayEntity* entity = (CLocalMediaPlayEntity*)param;
|
|
@@ -806,14 +829,14 @@ int StartMediaPlay(void* param)
|
|
|
if (!entity->m_pMediaPlayer[entity->m_mediaParam.nCfgInx]->checkIsPlay(&playThreadId))
|
|
|
{
|
|
|
Dbg("Create play Video Media Thread Failed!");
|
|
|
- return iRet;
|
|
|
+ return (void*)&iRet;
|
|
|
}
|
|
|
iRet = 0;
|
|
|
pthread_join(playThreadId, NULL);
|
|
|
if (entity->m_pMediaPlayer[entity->m_mediaParam.nCfgInx]->checkIsStop())
|
|
|
{//ֹͣ����
|
|
|
Dbg("stop play video");
|
|
|
- return iRet;
|
|
|
+ return (void*)&iRet;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -852,13 +875,15 @@ int StartMediaPlay(void* param)
|
|
|
if (!entity->m_pMediaPlayer[entity->m_mediaParam.nCfgInx]->checkIsPlay(&playThreadId))
|
|
|
{
|
|
|
Dbg("Create play Video Media Thread Failed!");
|
|
|
- return 0;
|
|
|
+ iRet = 0;
|
|
|
+ return (void*)& iRet;
|
|
|
}
|
|
|
pthread_join(playThreadId, NULL);
|
|
|
if (entity->m_pMediaPlayer[entity->m_mediaParam.nCfgInx]->checkIsStop())
|
|
|
{//ֹͣ����
|
|
|
Dbg("stop play video");
|
|
|
- return 0;
|
|
|
+ iRet = 0;
|
|
|
+ return (void*)& iRet;
|
|
|
}
|
|
|
}
|
|
|
else if ('P' == i->type)
|
|
@@ -880,15 +905,18 @@ int StartMediaPlay(void* param)
|
|
|
if (!entity->m_pPicturePlayer[entity->m_mediaParam.nCfgInx]->checkIsPlay(&playThreadId))
|
|
|
{
|
|
|
Dbg("Create play Image Media Thread Failed!");
|
|
|
- return -1;
|
|
|
+ iRet = -1;
|
|
|
+ return (void*)& iRet;
|
|
|
}
|
|
|
|
|
|
//WaitForSingleObject(playThread, i->playInterval);
|
|
|
struct timespec ts;
|
|
|
{
|
|
|
int rc = clock_gettime(CLOCK_REALTIME, &ts);
|
|
|
- if (rc)
|
|
|
- return -1;
|
|
|
+ if (rc) {
|
|
|
+ iRet = -1;
|
|
|
+ return (void*)& iRet;
|
|
|
+ }
|
|
|
}
|
|
|
ts.tv_nsec += (i->playInterval * 1000000);
|
|
|
pthread_timedjoin_np(playThreadId, NULL, &ts);
|
|
@@ -896,7 +924,8 @@ int StartMediaPlay(void* param)
|
|
|
if (entity->m_pPicturePlayer[entity->m_mediaParam.nCfgInx]->checkIsStop())
|
|
|
{//ֹͣ����
|
|
|
Dbg("stop play Image");
|
|
|
- return 0;
|
|
|
+ iRet = 0;
|
|
|
+ return (void*)& iRet;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -906,7 +935,7 @@ int StartMediaPlay(void* param)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return iRet;
|
|
|
+ return (void*)&iRet;
|
|
|
}
|
|
|
|
|
|
#endif // RVC_OS_WIN
|
|
@@ -937,8 +966,14 @@ void CLocalMediaPlayEntity::StartVideo(int nCfgInx, int nWndX, int nWndY, int nW
|
|
|
m_playThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)& MediaPlayThread, this, 0, NULL);
|
|
|
#else
|
|
|
|
|
|
- StartMediaPlay(this);
|
|
|
-
|
|
|
+ pthread_t uMediaPlayThreadId = 0;
|
|
|
+ int err = pthread_create(&uMediaPlayThreadId, NULL, StartMediaPlayFunc, this);
|
|
|
+ if (0 == err) {
|
|
|
+ Dbg("create media play thread[%lu] success.", uMediaPlayThreadId);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ Dbg("create media play thread failed.");
|
|
|
+ }
|
|
|
|
|
|
#endif
|
|
|
}
|
|
@@ -973,23 +1008,21 @@ void CLocalMediaPlayEntity::StartAudio(const char *pAudioNames)
|
|
|
//if (0 == pthread_kill(audioPlayThreadId, 0)) {
|
|
|
|
|
|
//}
|
|
|
+ m_lastPlayAudio = pAudioNames;
|
|
|
|
|
|
- Dbg("Begin StartAudio, and Audio Info is %s.", pAudioNames);
|
|
|
- if (0 == m_pMediaAudioPlayer->PlayLocalAudio(pAudioNames)) {
|
|
|
- Dbg("Succeed to StartAudio, and Audio Info is %s.", pAudioNames);
|
|
|
+ pthread_t uAudioPlayThreadId = 0;
|
|
|
+ int err = pthread_create(&uAudioPlayThreadId, NULL, StartAudioPlayingThreadFunc, this);
|
|
|
+ if (0 == err) {
|
|
|
+ Dbg("create audio play thread[%lu] success.", uAudioPlayThreadId);
|
|
|
}
|
|
|
- else{
|
|
|
- Dbg("StartAudio failed, for %s is not exsit.", pAudioNames);
|
|
|
+ else {
|
|
|
+ Dbg("create audio play thread failed.");
|
|
|
}
|
|
|
-
|
|
|
|
|
|
auto audioRet = GetLocalAudioVolume();
|
|
|
m_pMediaAudioPlayer->SetVolume(audioRet.second);
|
|
|
Dbg("Succeed to set audio volume %d!", audioRet.second);
|
|
|
- m_lastPlayAudio = pAudioNames;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
#endif // RVC_OS_WIN
|
|
|
}
|
|
|
|
|
@@ -1272,7 +1305,7 @@ void CLocalMediaPlaySession::Handle_StartPlayAudio(SpReqAnsContext<PlayService_S
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- return;
|
|
|
+ return m_pEntity->StartAudio("CardOut.mp3|CardIn.mp3");
|
|
|
}
|
|
|
#endif
|
|
|
|