|
@@ -3,18 +3,20 @@
|
|
|
|
|
|
#ifdef RVC_OS_WIN
|
|
|
#include <Shlwapi.h>
|
|
|
+#pragma comment(lib, "ShLwApi.Lib")
|
|
|
+
|
|
|
#include "../../Other/libwmpplayer/libwmpplayer.h"
|
|
|
#include "../../Other/libimgplayer/libimgplayer.h"
|
|
|
#else
|
|
|
#include <pthread.h>
|
|
|
#include <signal.h>
|
|
|
#include <unistd.h>
|
|
|
-#include "../../Other/libmediaplayer/libmediaplayer.h"
|
|
|
-#include "../../Other/libpictureplayer/libpictureplayer.h"
|
|
|
#include <semaphore.h>
|
|
|
-#include "../../Other/libaudioqueue/libaudioqueue.h"
|
|
|
#endif // RVC_OS_WIN
|
|
|
|
|
|
+#include "../../Other/libmediaplayer/libmediaplayer.h"
|
|
|
+#include "../../Other/libpictureplayer/libpictureplayer.h"
|
|
|
+#include "../../Other/libaudioqueue/libaudioqueue.h"
|
|
|
|
|
|
#include "LocalMediaPlay_server_g.h"
|
|
|
#include "AdvertBase/AdvertSync.h"
|
|
@@ -22,7 +24,6 @@
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
|
-//#include "SpTest.h"
|
|
|
#include "modVer.h"
|
|
|
#include "EventCode.h"
|
|
|
|
|
@@ -32,26 +33,29 @@ using namespace LocalMediaPlay;
|
|
|
#define LOG_EVT_SELFCHECK_IEBROWSER_IDLE 0x50500007 //IEBrowser重启
|
|
|
#define MAX_PLAY_CHANNELS 3 //最大播放通道数
|
|
|
|
|
|
-#define LOG_EVT_START_NOTICE_PLAY 0x31300101
|
|
|
-#define LOG_EVT_STOP_NOTICE_PLAY 0x31300102
|
|
|
-#define LOG_EVT_NOTICE_PLAY_FINISHED 0x31300103
|
|
|
-#define LOG_EVT_NOTICE_FILE_NOT_EXIST 0x31300104
|
|
|
+#define LOG_EVT_START_NOTICE_PLAY 0x31300101
|
|
|
+#define LOG_EVT_STOP_NOTICE_PLAY 0x31300102
|
|
|
+#define LOG_EVT_NOTICE_PLAY_FINISHED 0x31300103
|
|
|
+#define LOG_EVT_NOTICE_FILE_NOT_EXIST 0x31300104
|
|
|
+
|
|
|
+#define LOG_EVT_ADV_VIDEO_NOT_EXIST 0x31300105
|
|
|
+#define LOG_EVT_ADV_AUDIO_NOT_EXIST 0x31300106
|
|
|
+#define LOG_EVT_ADV_PIC_NOT_EXIST 0x31300107
|
|
|
|
|
|
-#define LOG_EVT_ADV_VIDEO_NOT_EXIST 0x31300105
|
|
|
-#define LOG_EVT_ADV_AUDIO_NOT_EXIST 0x31300106
|
|
|
-#define LOG_EVT_ADV_PIC_NOT_EXIST 0x31300107
|
|
|
+#define LOG_EVT_VICE_MONITOR_NOT_EXIST 0x31300108
|
|
|
+#define LOG_EVT_VICE_MONITOR_SET_ERROR 0x31300109
|
|
|
+#define LOG_EVT_NOTICE_PLAY_EARLY_TERM 0x3130010A
|
|
|
+#define LOG_EVT_PLAYING_AUDIO_INFOS 0x3130010B
|
|
|
+#define LOG_EVT_NOTICE_FILE_NOT_VALID 0x3130010C
|
|
|
+#define LOG_EVT_MEDIAPLAY_COST_TIME_ERROR 0x3130010D
|
|
|
|
|
|
-#define LOG_EVT_VICE_MONITOR_NOT_EXIST 0x31300108
|
|
|
-#define LOG_EVT_VICE_MONITOR_SET_ERROR 0x31300109
|
|
|
-#define LOG_EVT_NOTICE_PLAY_EARLY_TERM 0x3130010A
|
|
|
-#define LOG_EVT_PLAYING_AUDIO_INFOS 0x3130010B
|
|
|
|
|
|
#ifndef RVC_AUDIO_LEN
|
|
|
#define RVC_AUDIO_LEN 320
|
|
|
#endif // !RVC_AUDIO_LEN
|
|
|
|
|
|
#ifndef RVC_AUDIO_BUFFER_LEN
|
|
|
-#define RVC_AUDIO_BUFFER_LEN 320*8
|
|
|
+#define RVC_AUDIO_BUFFER_LEN 320*8*2
|
|
|
#endif // !RVC_AUDIO_BUFFER_LEN
|
|
|
|
|
|
typedef struct {
|
|
@@ -62,18 +66,24 @@ typedef struct {
|
|
|
int nWndHeight;
|
|
|
}MediaPlayParam;
|
|
|
|
|
|
-//DWORD WINAPI qryMedia(LPVOID lpv);
|
|
|
-//DWORD WINAPI MediaPlayThread(LPVOID param);
|
|
|
-//DWORD WINAPI clearOutdata(LPVOID lpv);
|
|
|
-//DWORD WINAPI CheckAudioThread(LPVOID param);
|
|
|
+#ifdef RVC_OS_WIN
|
|
|
+ DWORD WINAPI qryMedia(LPVOID lpv);
|
|
|
+ DWORD WINAPI MediaPlayThread(LPVOID param);
|
|
|
+ DWORD WINAPI clearOutdata(LPVOID lpv);
|
|
|
+ DWORD WINAPI CheckAudioThread(LPVOID param);
|
|
|
+ DWORD WINAPI NoticePlayThread(LPVOID param);
|
|
|
+ DWORD WINAPI StartMediaPlayFunc(LPVOID param);
|
|
|
+ DWORD WINAPI StartAudioPlayingThreadFunc(LPVOID param);
|
|
|
+ DWORD WINAPI StartNoticePlayThreadFunc(LPVOID param);
|
|
|
+#endif
|
|
|
+
|
|
|
|
|
|
#ifdef RVC_OS_WIN
|
|
|
-class CLocalMediaPlayEntity : public CWmpHostApi, public CImgHostApi, public CEntityBase, public ILogListener
|
|
|
+class CLocalMediaPlayEntity : public CWmpHostApi, public CImgHostApi, public CMediaHostApi, public CPicHostApi, public CEntityBase, public ILogListener
|
|
|
#else
|
|
|
class CLocalMediaPlayEntity : public CMediaHostApi, public CPicHostApi, public CEntityBase, public ILogListener
|
|
|
#endif // RVC_OS_WIN
|
|
|
{
|
|
|
-
|
|
|
public:
|
|
|
CLocalMediaPlayEntity();
|
|
|
virtual ~CLocalMediaPlayEntity();
|
|
@@ -93,25 +103,40 @@ public:
|
|
|
|
|
|
#ifdef RVC_OS_WIN
|
|
|
virtual BOOL LoadPlayConfig(CWmpPlayConfig& config, int CfgInx);
|
|
|
+
|
|
|
virtual BOOL LoadPlayConfig(CImgPlayConfig& config, int CfgInx);
|
|
|
+
|
|
|
virtual void WmpDebug(const char* fmt, ...);
|
|
|
+
|
|
|
+ virtual void WmpLogEvt(int ievent, const char* strmsg);
|
|
|
+
|
|
|
virtual void ImgDebug(const char* fmt, ...);
|
|
|
-#else
|
|
|
+#endif // _WIN32
|
|
|
virtual int LoadPlayConfig(CMediaPlayConfig& config, int CfgInx);
|
|
|
+
|
|
|
virtual int LoadPlayConfig(CPicPlayConfig& config, int CfgInx);
|
|
|
+
|
|
|
virtual void Debug(media_loglevel log_level, const char* fmt, ...);
|
|
|
+
|
|
|
virtual void PicDebug(pic_loglevel log_level, const char* fmt, ...);
|
|
|
+
|
|
|
virtual void MediaPlayFinished(int iMediaType);
|
|
|
+
|
|
|
virtual int GetMediaPlayerIcoPath(char* strPath, size_t uLen);
|
|
|
+
|
|
|
virtual int GetPicPlayerIcoPath(char* strPath, size_t uLen);
|
|
|
+
|
|
|
virtual int GetAudioOutDevName(char* strDev, size_t uLen);
|
|
|
+
|
|
|
virtual int PlayingAudioDataCallback(audio_param_t* param, const void* input, unsigned long uaudiolen);
|
|
|
+
|
|
|
bool GetPlayFlag();
|
|
|
+
|
|
|
bool GetScanExitFlag();
|
|
|
+
|
|
|
ErrorCodeEnum GetPcmRecordFlag();
|
|
|
- ErrorCodeEnum HandleRemoteRecord(const char* pszMessage);
|
|
|
-
|
|
|
-#endif // _WIN32
|
|
|
+
|
|
|
+ ErrorCodeEnum HandleRemoteRecord(const char* pszMessage);
|
|
|
|
|
|
virtual void OnLog(const CAutoArray<CUUID> &SubIDs, const CUUID nLogID, const LogTypeEnum eLogType, const SeverityLevelEnum eLevel,
|
|
|
const DWORD dwSysError, const DWORD dwUserCode, const DWORD dwEntityInstanceID, const WORD wEntityDevelID,
|
|
@@ -142,26 +167,40 @@ public:
|
|
|
void StopAll();
|
|
|
|
|
|
bool GetLocalVideoVolume(int nCfgInx, int &nVolume);
|
|
|
+
|
|
|
bool SetLocalVideoVolume(int nCfgInx, int nVolume);
|
|
|
+
|
|
|
std::pair<bool, int> GetLocalAudioVolume();
|
|
|
+
|
|
|
bool SetLocalAudioVolume(int nVolume);
|
|
|
+
|
|
|
bool IsRunConfigExist();
|
|
|
|
|
|
ErrorCodeEnum StartNotice(int nCfgInx, int nWndX, int nWndY, int nWndWidth, int nWndHeight, const char *pVideoName);
|
|
|
|
|
|
+ ErrorCodeEnum StartMediaPlayerNotice(int nCfgInx, int nWndX, int nWndY, int nWndWidth, int nWndHeight, const char *pVideoName);
|
|
|
+
|
|
|
+ ErrorCodeEnum StartFFPlayerNotice(int nCfgInx, int nWndX, int nWndY, int nWndWidth, int nWndHeight, const char *pVideoName);
|
|
|
+
|
|
|
+ void SetLogFlag(bool bflag);
|
|
|
+
|
|
|
+ bool GetLogFlag();
|
|
|
+
|
|
|
+ void SetLocalLogFlag(bool bflag);
|
|
|
+
|
|
|
+ bool GetLocalLogFlag();
|
|
|
+
|
|
|
+ void SetLocalPicLogFlag(bool bflag);
|
|
|
+
|
|
|
+ bool GetLocalPicLogFlag();
|
|
|
+
|
|
|
+ ErrorCodeEnum LoadEntityConfig();
|
|
|
+
|
|
|
ErrorCodeEnum StopNotice(int nCfgInx);
|
|
|
|
|
|
ErrorCodeEnum StopPlayAllMedias();
|
|
|
|
|
|
DeviceTypeEnum GetDeviceType();
|
|
|
-
|
|
|
-protected:
|
|
|
- // 音频播放对象指针
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
- Clibwmpplayer* m_pAudioPlayer;
|
|
|
-#else
|
|
|
- Clibmediaplayer* m_pMediaAudioPlayer;
|
|
|
-#endif // RVC_OS_WIN
|
|
|
|
|
|
private:
|
|
|
|
|
@@ -170,44 +209,68 @@ private:
|
|
|
// 按分隔符分隔字符串
|
|
|
void CStringSplit(char *str, char **result, const char *del);
|
|
|
|
|
|
- //friend DWORD WINAPI clearOutdata(LPVOID lpv);
|
|
|
-
|
|
|
#ifdef RVC_OS_WIN
|
|
|
- friend DWORD WINAPI MediaPlayThread(LPVOID param);
|
|
|
+ friend DWORD WINAPI clearOutdata(LPVOID lpv);
|
|
|
+
|
|
|
friend DWORD WINAPI qryMedia(LPVOID lpv);
|
|
|
+
|
|
|
+ friend DWORD WINAPI MediaPlayThread(LPVOID param);
|
|
|
+
|
|
|
friend DWORD WINAPI CheckAudioThread(LPVOID param);
|
|
|
+
|
|
|
+ friend DWORD WINAPI NoticePlayThread(LPVOID param);
|
|
|
+
|
|
|
+ friend DWORD WINAPI StartMediaPlayFunc(LPVOID param);
|
|
|
+
|
|
|
+ friend DWORD WINAPI StartAudioPlayingThreadFunc(LPVOID param);
|
|
|
+
|
|
|
+ friend DWORD WINAPI StartNoticePlayThreadFunc(LPVOID param);
|
|
|
#else
|
|
|
friend void* queryMedia(void* param);
|
|
|
+
|
|
|
friend void* StartAudioPlayingThreadFunc(void* param);
|
|
|
+
|
|
|
friend void* StartMediaPlayFunc(void* param);
|
|
|
+
|
|
|
friend void* StartNoticePlayThreadFunc(void* param);
|
|
|
|
|
|
- int GetPlayerIcoPath(char* strPath, size_t uLen);
|
|
|
- int GetAudioOutDev();
|
|
|
#endif // RVC_OS_WIN
|
|
|
|
|
|
void setMediaPath();
|
|
|
+
|
|
|
void SecureClientRelease();
|
|
|
+
|
|
|
bool SecureClientConnect();
|
|
|
|
|
|
- void loadDefaultMedia();
|
|
|
+ void loadDefaultMedia(bool fNewVersion = true);
|
|
|
+
|
|
|
+ int GetPlayerIcoPath(char* strPath, size_t uLen);
|
|
|
+
|
|
|
+ int GetAudioOutDev();
|
|
|
+
|
|
|
private:
|
|
|
int m_id_seq;
|
|
|
+
|
|
|
CUUID m_SubIDIEIdle;
|
|
|
+
|
|
|
CUUID m_SubIDStartRecord;
|
|
|
+
|
|
|
CUUID m_SubIDStopRecord;
|
|
|
|
|
|
#ifdef RVC_OS_WIN
|
|
|
// 视频播放对象指针数组
|
|
|
Clibwmpplayer* m_pVideoPlayer[MAX_PLAY_CHANNELS];
|
|
|
+ // 音频播放对象指针
|
|
|
+ Clibwmpplayer* m_pAudioPlayer;
|
|
|
// 图片播放对象指针数组
|
|
|
Clibimgplayer* m_pImagePlayer[MAX_PLAY_CHANNELS];
|
|
|
-#else
|
|
|
+#endif // RVC_OS_WIN
|
|
|
// 媒体播放对象指针数组
|
|
|
Clibmediaplayer* m_pMediaPlayer[MAX_PLAY_CHANNELS];
|
|
|
- // 图片播放对象指针数组 add by clp 20201103
|
|
|
+ // 图片播放对象指针数组
|
|
|
Clibpictureplayer* m_pPicturePlayer[MAX_PLAY_CHANNELS];
|
|
|
-#endif // RVC_OS_WIN
|
|
|
+
|
|
|
+ Clibmediaplayer* m_pMediaAudioPlayer;
|
|
|
|
|
|
//连接获取最新广告资源
|
|
|
CAdvertSyncConnection *m_connection;
|
|
@@ -217,23 +280,33 @@ private:
|
|
|
std::string m_lastPlayAudio;
|
|
|
std::string m_lastPlayVideo;
|
|
|
DeviceTypeEnum m_eDeviceType;
|
|
|
-
|
|
|
- bool m_bStartRecord;
|
|
|
+ bool m_bLogFlag;
|
|
|
+ bool m_bLocalLogFlag;
|
|
|
+ CSimpleStringA m_AudioPath;
|
|
|
+ bool m_bLocalPicLogFlag;
|
|
|
bool m_bRecordPCM;
|
|
|
+ bool m_bStartRecord;
|
|
|
bool m_bloged;
|
|
|
|
|
|
+
|
|
|
#ifdef RVC_OS_WIN
|
|
|
+ HANDLE m_scanThreadId;
|
|
|
+ HANDLE m_uMediaPlayThreadId;
|
|
|
+ HANDLE m_uNoticePlayThreadId;
|
|
|
HANDLE m_scanThread, m_playThread;
|
|
|
vector<CWmpPlayConfig> m_defaultVideo;
|
|
|
vector<CWmpPlayConfig> m_defaultAudio;
|
|
|
vector<CImgPlayConfig> m_defaultImg;
|
|
|
#else
|
|
|
pthread_t m_scanThreadId;
|
|
|
+ pthread_t m_uMediaPlayThreadId;
|
|
|
+ pthread_t m_uNoticePlayThreadId;
|
|
|
+#endif // RVC_OS_WIN
|
|
|
+
|
|
|
vector<CMediaPlayConfig> m_Videos;
|
|
|
vector<CMediaPlayConfig> m_Audios;
|
|
|
vector<CPicPlayConfig> m_defaultPic;
|
|
|
- pthread_t m_uMediaPlayThreadId;
|
|
|
- pthread_t m_uNoticePlayThreadId;
|
|
|
+
|
|
|
volatile bool m_badplayflag;
|
|
|
bool m_scanexitflag;
|
|
|
CSimpleStringA m_strAudioOutDev;
|
|
@@ -245,7 +318,9 @@ private:
|
|
|
int m_leftlen;
|
|
|
int m_iseriesnumber;
|
|
|
bool m_buserstopaudio;
|
|
|
-#endif // RVC_OS_WIN
|
|
|
+ int m_iPlayType;
|
|
|
+ pic_loglevel m_piclevel;
|
|
|
+ media_loglevel m_medialevel;
|
|
|
};
|
|
|
|
|
|
|