Browse Source

Z991239-1387 #comment other: Linux下优化获取广告策略功能

陈礼鹏80274480 4 years ago
parent
commit
b3d4d006cb

+ 129 - 15
Module/mod_localmediaplay/AdvertManage/MediaManage.cpp

@@ -56,24 +56,134 @@ void mediaManage::GetPlayList(vector<ResourceParse> &resourceList)
 	}
 }
 
-void mediaManage::GetPlayListByLocal(vector<ResourceParse>& resourceList)
+size_t mediaManage::GetPlayListByLocal(vector<ResourceParse>& resourceList)
 {
+	size_t uNum = 0;
 	resourceList.clear();
 
 #ifdef RVC_OS_WIN
 	for each (auto i in m_localList)
 	{
-		if (checkInVaildTime(i.vaildTime, true) && checkInPlayTime(i.playTime, true))
+		if (checkInVaildTime(i.vaildTime, true) && checkInPlayTime(i.playTime, true)) {
 			resourceList.push_back(i);
+			uNum++;
+		}
 	}
 #else
-	for (vector<ResourceParse>::iterator it = m_localList.begin(); it < m_localList.end(); it++)
+	for (vector<ResourceParse>::iterator it = m_localList.begin(); it != m_localList.end(); it++)
 	{
-		resourceList.push_back(*it);
+		Dbg("play extend %c:%s, %s, %s, %s", it->type, it->resourcePath.c_str(), it->videoNames.c_str(), it->vaildTime.c_str(), it->playTime.c_str());
+		if (checkInVaildTime(it->vaildTime, true) && checkInPlayTime(it->playTime, true)) {
+			resourceList.push_back(*it);
+			uNum++;
+		}
+	}
+	Dbg("uNum is %d, m_localList size is %d, resourceList size is %d", uNum, m_localList.size(), resourceList.size());
+
+	for (vector<ResourceParse>::iterator i = resourceList.begin(); i != resourceList.end(); i++)
+	{
+		Dbg("begin play extend %c:%s, %s", i->type, i->resourcePath.c_str(), i->videoNames.c_str());
 	}
 #endif // _WIN32
+
+	return uNum;
+}
+
+
+size_t mediaManage::GetPlayListByLocal(CResourceParse** ResourceArr, size_t uSize)
+{
+	size_t uNum = 0;
+
+	Dbg("%s:%d", __FUNCTION__, __LINE__);
+
+	for (vector<ResourceParse>::iterator it = m_localList.begin(); it != m_localList.end() && uNum < uSize; it++)
+	{
+		Dbg("new deep copy play extend %c:%s, %s, %s, %s", it->type, it->resourcePath.c_str(), it->videoNames.c_str(), it->vaildTime.c_str(), it->playTime.c_str());
+		if (checkInVaildTime(it->vaildTime, true) && checkInPlayTime(it->playTime, true)) {
+			CResourceParse* pNode = new CResourceParse();
+			pNode->type = it->type;
+			pNode->fullScreen = it->fullScreen;
+			pNode->primMonitor = it->primMonitor;
+			pNode->simpleMode = it->simpleMode;
+			pNode->playInterval = it->playInterval;
+			pNode->priority = it->priority;
+
+			if (it->videoNames.length() > 0) {
+				pNode->pvideoNames = new char[it->videoNames.length() + 1];
+				memset(pNode->pvideoNames, 0, it->videoNames.length() + 1);
+				memcpy(pNode->pvideoNames, it->videoNames.c_str(), it->videoNames.length());
+			}
+
+			if (it->vaildTime.length() > 0) {
+				pNode->pvaildTime = new char[it->vaildTime.length() + 1];
+				memset(pNode->pvaildTime, 0, it->vaildTime.length() + 1);
+				memcpy(pNode->pvaildTime, it->vaildTime.c_str(), it->vaildTime.length());
+			}
+
+			if (it->resourcePath.length() > 0) {
+				pNode->presourcePath = new char[it->resourcePath.length() + 1];
+				memset(pNode->presourcePath, 0, it->resourcePath.length() + 1);
+				memcpy(pNode->presourcePath, it->resourcePath.c_str(), it->resourcePath.length());
+			}
+
+			if (it->playTime.length() > 0) {
+				pNode->playTime = new char[it->playTime.length() + 1];
+				memset(pNode->playTime, 0, it->playTime.length() + 1);
+				memcpy(pNode->playTime, it->playTime.c_str(), it->playTime.length());
+			}
+			ResourceArr[uNum++] = pNode;
+			Dbg("aftercopy play extend pNode->type=0x%0x:pNode->presourcePath=0x%0x, pNode->pvideoNames=0x%0x, pNode->pvaildTime=0x%0x, pNode->playTime=0x%0x", pNode->type, pNode->presourcePath, pNode->pvideoNames, pNode->pvaildTime, pNode->playTime);
+			Dbg("aftercopy play extend %c:%s, %s, %s, %s", pNode->type, pNode->presourcePath, pNode->pvideoNames, pNode->pvaildTime, pNode->playTime);
+			Dbg("%s:%d    ResourceList[%d] address is 0x%0x, pNode address is 0x%0x.", __FUNCTION__, __LINE__, uNum-1, ResourceArr[uNum-1], pNode);
+			
+		}
+	}
+
+	return uNum;
+}
+
+
+size_t mediaManage::GetPlayListByLocal(rvcResourceParse_t* ResourceArr, size_t uSize)
+{
+	size_t uNum = 0;
+
+	Dbg("%s:%d", __FUNCTION__, __LINE__);
+
+	for (vector<ResourceParse>::iterator it = m_localList.begin(); it != m_localList.end() && uNum < uSize; it++)
+	{
+		Dbg("new deep copy play extend %c:%s, %s, %s, %s", it->type, it->resourcePath.c_str(), it->videoNames.c_str(), it->vaildTime.c_str(), it->playTime.c_str());
+		if (checkInVaildTime(it->vaildTime, true) && checkInPlayTime(it->playTime, true)) {
+			rvcResourceParse_t* pNode = ResourceArr+uNum;
+			pNode->type = it->type;
+			pNode->fullScreen = it->fullScreen;
+			pNode->primMonitor = it->primMonitor;
+			pNode->simpleMode = it->simpleMode;
+			pNode->playInterval = it->playInterval;
+			pNode->priority = it->priority;
+
+			if (it->videoNames.length() > 0) {
+				memcpy(pNode->strvideoNames, it->videoNames.c_str(), it->videoNames.length());
+			}
+
+			if (it->vaildTime.length() > 0) {
+				memcpy(pNode->strvaildTime, it->vaildTime.c_str(), it->vaildTime.length());
+			}
+
+			if (it->resourcePath.length() > 0) {
+				memcpy(pNode->strResourcePath, it->resourcePath.c_str(), it->resourcePath.length());
+			}
+
+			if (it->playTime.length() > 0) {
+				memcpy(pNode->strplayTime, it->playTime.c_str(), it->playTime.length());
+			}
+			uNum++;
+		}
+	}
+
+	return uNum;
 }
 
+
 bool mediaManage::InitResourseList(vector<string> resourceList)
 {
 	/*
@@ -216,22 +326,27 @@ void mediaManage::InitResourceListByLocal()
 	for each (auto i in networkList)
 		m_localList.push_back(i);
 #else
-	for (vector<ResourceParse>::iterator it = headList.begin(); it < headList.end(); ++it)
-	{
+	size_t uheadList = 0;
+	size_t ubranchList = 0;
+	size_t unetworkList = 0;
+	for (vector<ResourceParse>::iterator it = headList.begin(); it < headList.end(); ++it){
 		m_localList.push_back(*it);
+		uheadList++;
 	}
 
-	for (vector<ResourceParse>::iterator it = branchList.begin(); it < branchList.end(); ++it)
-	{
+	for (vector<ResourceParse>::iterator it = branchList.begin(); it < branchList.end(); ++it){
 		m_localList.push_back(*it);
+		ubranchList++;
 	}
 
-	for (vector<ResourceParse>::iterator it = networkList.begin(); it < networkList.end(); ++it)
-	{
+	for (vector<ResourceParse>::iterator it = networkList.begin(); it < networkList.end(); ++it){
 		m_localList.push_back(*it);
+		unetworkList++;
 	}
-#endif // RVC_OS_WIN
+	Dbg("headList size is %d, branchList size is %d, networkList size is %d, and m_localList size is %u.", uheadList, ubranchList, unetworkList, m_localList.size());
 
+#endif // RVC_OS_WIN
+	
 	std::stable_sort(m_localList.begin(), m_localList.end(), [](const ResourceParse& a, const ResourceParse& b) {
 		return a.priority > b.priority;
 		});//��priority����
@@ -240,15 +355,14 @@ void mediaManage::InitResourceListByLocal()
 	for (auto i = m_localList.begin(); i != m_localList.end(); i++)
 	{
 		auto pos = i->videoNames.find(SPLIT_SLASH_STR);
-		if (pos > 0)
-		{
+		if (pos > 0){
 			i->resourcePath = m_addvertPath + SPLIT_SLASH_STR + i->videoNames.substr(0, pos + 1);
 			i->videoNames = i->videoNames.substr(pos + 1, i->videoNames.length() - pos - 1);
 		}
-		else
+		else {
 			i->resourcePath = m_addvertPath + SPLIT_SLASH_STR;
+		}
 	}
-
 }
 
 void mediaManage::DeleteResourceList(vector<string> resourceList)

+ 7 - 1
Module/mod_localmediaplay/AdvertManage/mediaManage.h

@@ -21,10 +21,15 @@ public:
 	void setDefaultDownloadPath(string downloadPath);
 	bool InitResourseList(vector<string> resourceList);	//初始化资源列表,或者根据资源列表添加删除当前的资源列表
 	void GetPlayList(vector<ResourceParse> &resourceList);
-	void GetPlayListByLocal(vector<ResourceParse>& resourceList);
+	size_t GetPlayListByLocal(vector<ResourceParse>& resourceList);
+	size_t GetPlayListByLocal(CResourceParse** ResourceArr, size_t uSize);
+	size_t GetPlayListByLocal(rvcResourceParse_t* ResourceArr, size_t uSize);
+	
 	void clearOutdataResource();	//定期清理过期资源
 	void InitResourceListByLocal();	//通过本地配置生成资源列表播放
 
+	
+
 private:
 	bool AddResourceList(vector<string> resourceList);
 	void DeleteResourceList(vector<string> resourceList);
@@ -32,4 +37,5 @@ private:
 	string m_addvertPath, m_downloadPath;
 	vector<ParseInfo> m_curParse;
 	vector<ResourceParse> m_localList;
+
 };

+ 29 - 13
Module/mod_localmediaplay/AdvertManage/resourceIniParse.cpp

@@ -233,29 +233,45 @@ bool parseResourceIni(LPCTSTR filePath, vector<ResourceParse> &ret)
 		snprintf(sectionMedia, 30, "%s%d", SECTION_MEDIA, i);
 #endif // RVC_OS_WIN
 
-		ResourceParse curResource;
+		//ResourceParse curResource;
+		ResourceParse* item = new ResourceParse();
 		//获取type属性及校验
 		string type = ReadString(sectionMedia, MEDIA_TYPE, filePath, STR_NULL);
 		if (string("Pic") == type)
-			curResource.type = 'P';
+			item->type = 'P';
 		else if (string("Video") == type)
-			curResource.type = 'V';
+			item->type = 'V';
 		else//无法识别
 			continue;
 
-		curResource.fullScreen = ReadBoolean(sectionMedia, MEDIA_FULLSCREEN, filePath, false);
-		curResource.primMonitor = ReadBoolean(sectionMedia, MEDIA_PRIMMONITOR, filePath, false);
-		curResource.simpleMode = ReadBoolean(sectionMedia, MEDIA_SIMPLEMODE, filePath, false);
-		curResource.playInterval = ReadInterger(sectionMedia, MEDIA_PLAYINTERVAL, filePath, false);
-		curResource.videoNames = ReadString(sectionMedia, MEDIA_VIDIONAMES, filePath, STR_NULL);
-		curResource.vaildTime = ReadString(sectionMedia, MEDIA_VAILDTIME, filePath, STR_NULL);
-		curResource.playTime = ReadString(sectionMedia, MEDIA_PLAYTIME, filePath, STR_NULL);
-		curResource.priority = ReadInterger(sectionMedia, MEDIA_PRIORITY, filePath, 0);
+		item->fullScreen = ReadBoolean(sectionMedia, MEDIA_FULLSCREEN, filePath, false);
+		item->primMonitor = ReadBoolean(sectionMedia, MEDIA_PRIMMONITOR, filePath, false);
+		item->simpleMode = ReadBoolean(sectionMedia, MEDIA_SIMPLEMODE, filePath, false);
+		item->playInterval = ReadInterger(sectionMedia, MEDIA_PLAYINTERVAL, filePath, false);
+		item->videoNames = ReadString(sectionMedia, MEDIA_VIDIONAMES, filePath, STR_NULL);
+		item->vaildTime = ReadString(sectionMedia, MEDIA_VAILDTIME, filePath, STR_NULL);
+		item->playTime = ReadString(sectionMedia, MEDIA_PLAYTIME, filePath, STR_NULL);
+		item->priority = ReadInterger(sectionMedia, MEDIA_PRIORITY, filePath, 0);
 
-		if (checkInVaildTime(curResource.vaildTime) && checkInPlayTime(curResource.playTime))
-			ret.push_back(curResource);
+		if (checkInVaildTime(item->vaildTime) && checkInPlayTime(item->playTime))
+			ret.push_back(*item);
 	}
 	if (0 == ret.size())
 		return false;
 	return true;
 }
+
+
+int ReleaseCResourceArrs(CResourceParse** resourceArr, size_t uSize)
+{
+	int iRet = 0;
+	for (int i = 0; i < uSize; i++) {
+		if (resourceArr && resourceArr[i]){
+			CResourceParse* pData = resourceArr[i];
+			delete pData;
+			resourceArr[i] = NULL;
+		}
+	}
+
+	return iRet;
+}

+ 87 - 1
Module/mod_localmediaplay/AdvertManage/resourceIniParse.h

@@ -7,6 +7,11 @@
 #endif // RVC_OS_WIN
 
 
+#ifndef MAX_PATH
+#define MAX_PATH 260
+#endif // !MAX_PATH
+
+
 
 using namespace std;
 
@@ -45,6 +50,87 @@ typedef struct _resourceParse
 }ResourceParse;
 
 
+class CResourceParse {
+public:
+	CResourceParse()
+	{
+		pvideoNames = NULL;
+		pvaildTime = NULL;
+		playTime = NULL;
+		presourcePath = NULL;
+	};
+
+	CResourceParse(const CResourceParse& item)
+	{
+		this->type = item.type;
+		this->fullScreen = item.fullScreen;
+		this->primMonitor = item.primMonitor;
+		this->simpleMode = item.simpleMode;
+		this->playInterval = item.playInterval;
+		this->priority = item.priority;
+
+		if (item.pvideoNames) {
+			this->pvideoNames = new char[strlen(item.pvideoNames) + 1];
+			memset(this->pvideoNames, 0, strlen(item.pvideoNames) + 1);
+			memcpy(this->pvideoNames, item.pvideoNames, strlen(item.pvideoNames));
+		}
+
+		if (item.pvaildTime) {
+			this->pvaildTime = new char[strlen(item.pvaildTime) + 1];
+			memset(this->pvaildTime, 0, strlen(item.pvaildTime) + 1);
+			memcpy(this->pvaildTime, item.pvaildTime, strlen(item.pvaildTime));
+		}
+
+		if (item.playTime) {
+			this->playTime = new char[strlen(item.playTime) + 1];
+			memset(this->playTime, 0, strlen(item.playTime) + 1);
+			memcpy(this->playTime, item.playTime, strlen(item.playTime));
+		}
+
+		if (item.presourcePath) {
+			this->presourcePath = new char[strlen(item.presourcePath) + 1];
+			memset(this->presourcePath, 0, strlen(item.presourcePath) + 1);
+			memcpy(this->presourcePath, item.presourcePath, strlen(item.presourcePath));
+		}
+	};
+
+	~CResourceParse()
+	{
+		if (pvideoNames) delete[]pvideoNames;
+		if (pvaildTime) delete[]pvaildTime;
+		if (playTime) delete[]playTime;
+		if (presourcePath) delete[]presourcePath;
+	};
+
+	char type;	//Pic:P, Video:V, Mp3:M
+	bool fullScreen;
+	bool primMonitor;
+	bool simpleMode;
+	int playInterval;
+	int priority;
+	char* pvideoNames;
+	char* pvaildTime;
+	char* playTime;
+	char* presourcePath;
+};
+
+
+typedef struct rvcResourceParse_s {
+	char type;	//Pic:P, Video:V, Mp3:M
+	bool fullScreen;
+	bool primMonitor;
+	bool simpleMode;
+	int playInterval;
+	int priority;
+	char strvideoNames[MAX_PATH];
+	char strvaildTime[64];
+	char strplayTime[64];
+	char strResourcePath[MAX_PATH];
+}rvcResourceParse_t;
+
+
+
 bool checkInPlayTime(string playTime, bool checkCurTime = false);
 bool parseResourceIni(LPCTSTR filePath, vector<ResourceParse> &ret);
-bool checkInVaildTime(string vaildTime, bool checkCurData = false);
+bool checkInVaildTime(string vaildTime, bool checkCurData = false);
+int ReleaseCResourceArrs(CResourceParse** resourceArr, size_t uSize);

+ 45 - 33
Module/mod_localmediaplay/mod_localmediaplay.cpp

@@ -9,6 +9,11 @@ bool IS_DEBUG = false;
 int scanTime = 600;
 int removeOldTime = 1800;
 
+#ifndef MAX_LOCAL_MEDIAS
+#define MAX_LOCAL_MEDIAS 128
+#endif // !MAX_LOCAL_MEDIAS
+
+
 //DWORD WINAPI clearOutdata(LPVOID lpv)
 //{
 //	CLocalMediaPlayEntity* curEntity = (CLocalMediaPlayEntity*)lpv;
@@ -37,12 +42,12 @@ DWORD WINAPI qryMedia(LPVOID lpv)
 void* queryMedia(void* param)
 {
 	CLocalMediaPlayEntity* curEntity = (CLocalMediaPlayEntity*)param;
-	Sleep(3000);
+	sleep(3);
 
 	while (true)
 	{
 		curEntity->m_mediaManage.InitResourceListByLocal();
-		Sleep(3600 * 1000);
+		sleep(3600);
 	}
 
 	return 0;
@@ -232,8 +237,7 @@ void CLocalMediaPlayEntity::loadDefaultMedia()
 				CWmpPlayConfig curVideo;
 				ZeroMemory(&curVideo, sizeof(CWmpPlayConfig));
 #else
-				CMediaPlayConfig curVideo;
-				ZeroMemory(&curVideo, sizeof(CMediaPlayConfig));
+				CMediaPlayConfig curVideo = {0};
 #endif // RVC_OS_WIN
 
 				CSimpleStringA videoPath = strRootPath + SPLIT_SLASH_STR +"Video" + SPLIT_SLASH_STR;
@@ -300,8 +304,7 @@ void CLocalMediaPlayEntity::loadDefaultMedia()
 				CWmpPlayConfig curAudio;
 				ZeroMemory(&curAudio, sizeof(CWmpPlayConfig));
 #else
-				CMediaPlayConfig curAudio;
-				ZeroMemory(&curAudio, sizeof(CMediaPlayConfig));
+			CMediaPlayConfig curAudio = { 0 };
 #endif // RVC_OS_WIN
 
 				CSimpleStringA audioPath = strRootPath + SPLIT_SLASH_STR +"Audio" + SPLIT_SLASH_STR;
@@ -791,14 +794,24 @@ void* StartMediaPlayFunc(void* param)
 	CLocalMediaPlayEntity* entity = (CLocalMediaPlayEntity*)param;
 	while (TRUE)
 	{
-		vector<ResourceParse> curParse;
-		entity->m_mediaManage.GetPlayListByLocal(curParse);
-		Dbg("curParse.size() = %d.", curParse.size());
-		if (0 == curParse.size())
+		rvcResourceParse_t ResourceList[MAX_LOCAL_MEDIAS] = { 0 };
+		size_t uCount = entity->m_mediaManage.GetPlayListByLocal(ResourceList, MAX_LOCAL_MEDIAS);
+		Dbg("uCount == %d", uCount);
+		//for (int i = 0; i < uCount; i++)
+		//{
+		//	rvcResourceParse_t item = ResourceList[i];
+		//	Dbg("%s:%d    ResourceList[%d] address is 0x%0x.", __FUNCTION__, __LINE__, i, ResourceList[i]);
+		//	Dbg("item->type address is 0x%0x.", item.type);
+		//	Dbg("item->presourcePath address is 0x%0x.", item.strResourcePath);
+		//	Dbg("item->pvideoNames address is 0x%0x.", item.strvideoNames);
+
+		//	Dbg("play extend %c:%s, %s", item.type, item.strResourcePath, item.strvideoNames);
+		//}
+
+		if (0 == uCount)
 		{
 			int64_t playThreadId  = 0;
-			CMediaPlayConfig config;
-			ZeroMemory(&config, sizeof(CMediaPlayConfig));
+			CMediaPlayConfig config = {0};
 			memcpy(&config, &(entity->m_Videos[entity->m_mediaParam.nCfgInx]), sizeof(CMediaPlayConfig));
 			config.nPlayCnt = 1;	//can be change 
 			config.eMode = LOCALVIDEO;
@@ -843,21 +856,22 @@ void* StartMediaPlayFunc(void* param)
 			}
 		}
 
-		for (vector<ResourceParse>::iterator i = curParse.begin(); i != curParse.end(); i++)
+		for (int i = 0; i < uCount && i < MAX_LOCAL_MEDIAS; i++)
 		{
+			Dbg("ResourceList[%d] address is 0x%0x", i, ResourceList[i]);
 			int64_t playThreadId = 0;
-			Dbg("begin play extend %c:%s, %s", i->type, i->resourcePath.c_str(), i->videoNames.c_str());
-			if ('V' == i->type)
+			rvcResourceParse_t item = ResourceList[i];
+			Dbg("begin play extend %c:%s, %s", item.type, item.strResourcePath, item.strvideoNames);
+			if ('V' == item.type)
 			{//video
-				CMediaPlayConfig config;
-				ZeroMemory(&config, sizeof(CMediaPlayConfig));
-				config.bFullScreen = IS_DEBUG ? false : i->fullScreen;
-				config.bPrimMonitor = IS_DEBUG ? true : i->primMonitor;
-				config.bSimpleMode = i->simpleMode;
+				CMediaPlayConfig config = {0};
+				config.bFullScreen = IS_DEBUG ? false : item.fullScreen;
+				config.bPrimMonitor = IS_DEBUG ? true : item.primMonitor;
+				config.bSimpleMode = item.simpleMode;
 				config.eMode = LOCALVIDEO;
 				config.nFileCnt = 1;
 				config.nPlayCnt = 1;
-				config.nPlayInterval = i->playInterval;
+				config.nPlayInterval = item.playInterval;
 				// add by ly@2018/07/30
 				//config.nVolume = IS_DEBUG ? 0 : entity->m_defaultVolum;
 				if (!entity->GetLocalVideoVolume(0, config.nVolume))
@@ -869,8 +883,8 @@ void* StartMediaPlayFunc(void* param)
 				config.nWndY = entity->m_mediaParam.nWndY;
 				config.nWndWidth = entity->m_mediaParam.nWndWidth;
 				config.nWndHeight = entity->m_mediaParam.nWndHeight;
-				strncpy(config.strRootPath, i->resourcePath.c_str(), sizeof(config.strRootPath));
-				strncpy(config.strFileNames[0], i->videoNames.c_str(), 256);
+				strncpy(config.strRootPath, item.strResourcePath, strlen(item.strResourcePath));
+				strncpy(config.strFileNames[0], item.strvideoNames, strlen(item.strvideoNames));
 				strncpy(config.strVideoRunTime_S, "09:00:00", sizeof(config.strVideoRunTime_S));
 				strncpy(config.strVideoRunTime_E, "17:30:00", sizeof(config.strVideoRunTime_E));
 
@@ -889,21 +903,20 @@ void* StartMediaPlayFunc(void* param)
 					return (void*)& iRet;
 				}
 			}
-			else if ('P' == i->type)
+			else if ('P' == item.type)
 			{//play Image
-				CPicPlayConfig config;
-				ZeroMemory(&config, sizeof(CPicPlayConfig));
-				config.bFullScreen = IS_DEBUG ? false : i->fullScreen;
-				config.bPrimMonitor = IS_DEBUG ? true : i->primMonitor;
+				CPicPlayConfig config = {0};
+				config.bFullScreen = IS_DEBUG ? false : item.fullScreen;
+				config.bPrimMonitor = IS_DEBUG ? true : item.primMonitor;
 				config.nFileCnt = 1;
 				config.nPlayCnt = 1;
-				config.nPlayInterval = i->playInterval;
+				config.nPlayInterval = item.playInterval;
 				config.nWndX = entity->m_mediaParam.nWndX;
 				config.nWndY = entity->m_mediaParam.nWndY;
 				config.nWndWidth = entity->m_mediaParam.nWndWidth;
 				config.nWndHeight = entity->m_mediaParam.nWndHeight;
-				strncpy(config.strRootPath, i->resourcePath.c_str(), sizeof(config.strRootPath));
-				strncpy(config.strFileNames[0], i->videoNames.c_str(), 256);
+				strncpy(config.strRootPath, item.strResourcePath, strlen(item.strResourcePath));
+				strncpy(config.strFileNames[0], item.strvideoNames, strlen(item.strvideoNames));
 				entity->m_pPicturePlayer[entity->m_mediaParam.nCfgInx]->PlayMedia(config);
 				if (!entity->m_pPicturePlayer[entity->m_mediaParam.nCfgInx]->checkIsPlay(&playThreadId))
 				{
@@ -921,7 +934,7 @@ void* StartMediaPlayFunc(void* param)
 						return (void*)& iRet;
 					}
 				}
-				ts.tv_nsec += (i->playInterval * 1000000);
+				ts.tv_nsec += (item.playInterval * 1000000);
 				pthread_timedjoin_np(playThreadId, NULL, &ts);
 
 				if (entity->m_pPicturePlayer[entity->m_mediaParam.nCfgInx]->checkIsStop())
@@ -937,7 +950,6 @@ void* StartMediaPlayFunc(void* param)
 			}
 		}
 	}
-
 	return (void*)&iRet;
 }
 

+ 1 - 0
Module/mod_localmediaplay/mod_localmediaplay.h

@@ -8,6 +8,7 @@
 #else
 #include <pthread.h>
 #include <signal.h>
+#include <unistd.h>
 #include "../../Other/libmediaplayer/libmediaplayer.h"
 #include "../../Other/libpictureplayer/libpictureplayer.h"
 #endif // RVC_OS_WIN