Kaynağa Gözat

Z991239-1233 #comment other: 解决interactivecontrol实体存在实体间依赖,启动失败问题

陈礼鹏80274480 4 yıl önce
ebeveyn
işleme
7399d056f0

+ 2 - 2
Module/mod_localmediaplay/CMakeLists.txt

@@ -31,9 +31,9 @@ target_link_directories(${MODULE_NAME} PRIVATE
 
 # 添加实体需要依赖的其他共享库(包括系统库)
 if(WIN32)
-set(${MODULE_PREFIX}_LIBS  ${MODULE_BASE_LIBS} ${RVCCOMM_LIB} ShLwApi Shell32 libimgplayer libwmpplayer)
+set(${MODULE_PREFIX}_LIBS  ${MODULE_BASE_LIBS} ${RVCCOMM_LIB} ShLwApi Shell32 imgplayer wmpplayer)
 else(WIN32)
-set(${MODULE_PREFIX}_LIBS  ${MODULE_BASE_LIBS} ${RVCCOMM_LIB} libmediaplayer libpictureplayer)
+set(${MODULE_PREFIX}_LIBS  ${MODULE_BASE_LIBS} ${RVCCOMM_LIB} mediaplayer pictureplayer)
 endif(WIN32)
 
 target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})

+ 3 - 0
Module/mod_localmediaplay/mod_localmediaplay.cpp

@@ -479,10 +479,13 @@ ErrorCodeEnum CLocalMediaPlayEntity::__OnStart(ErrorCodeEnum preOperationError)
 		m_pVideoPlayer[i] = new Clibwmpplayer(this);
 		m_pImagePlayer[i] = new Clibimgplayer(this);
 #else
+		Dbg("begin create mediaplayer and pictureplayer");
 		m_pMediaPlayer[i] = new Clibmediaplayer(this);
 		m_pPicturePlayer[i] = new Clibpictureplayer(this);
+		Dbg("create mediaplayer and pictureplayer success.");
 #endif 
 	}
+	
 
 #ifdef RVC_OS_WIN
 	m_pAudioPlayer = new Clibwmpplayer(this);

+ 1 - 1
Other/libimgplayer/CMakeLists.txt

@@ -1,4 +1,4 @@
-set(MODULE_NAME "libimgplayer")
+set(MODULE_NAME "imgplayer")
 set(MODULE_PREFIX "LIB_IMGPLAYER_FUNC")
 
 set(${MODULE_PREFIX}_SRCS

+ 1 - 1
Other/libmediaplayer/CMakeLists.txt

@@ -1,4 +1,4 @@
-set(MODULE_NAME "libmediaplayer")
+set(MODULE_NAME "mediaplayer")
 set(MODULE_PREFIX "LIB_MEDIAPLAYER_FUNC")
 
 if(RVC_DEBUG_MODE)

+ 9 - 0
Other/libmediaplayer/libmediaplayer.cpp

@@ -20,7 +20,14 @@ public:
 
 	libmediaplayer_impl(CMediaHostApi* pHostApi) {
 		m_pHostApi = pHostApi;
+		pHostApi->Debug("begin new MediaPlayer.");
 		m_Player = new CMediaPlayer();
+		if (NULL != m_Player) {
+			pHostApi->Debug(" new MediaPlayer success!");
+		}
+		else{
+			pHostApi->Debug(" new MediaPlayer failed!");
+		}
 	}
 
 	~libmediaplayer_impl()
@@ -143,7 +150,9 @@ public:
 
 Clibmediaplayer::Clibmediaplayer(CMediaHostApi* pHostApi)
 {
+	pHostApi->Debug("begin new libmediaplayer_impl.");
 	m_pImpl = new libmediaplayer_impl(pHostApi);
+	pHostApi->Debug("after new libmediaplayer_impl.");
 	return;
 }
 

+ 17 - 5
Other/libmediaplayer/player.cpp

@@ -244,7 +244,7 @@ static void toggle_pause(player_stat_t *is)
 
 CMediaPlayer::CMediaPlayer()
 {
-	m_player_stat = (player_stat_t*)av_mallocz(sizeof(player_stat_t));
+	m_player_stat = NULL;
 	m_uvolume = SDL_MIX_MAXVOLUME;
 	m_bplaying = false;
 
@@ -260,10 +260,23 @@ CMediaPlayer::~CMediaPlayer()
 int CMediaPlayer::Init(rvc_media_player_param_t* pMedia_Player)
 {
 	int iRet = -1;
-	if (NULL == pMedia_Player || NULL == m_player_stat)
-	{
+	if (NULL == pMedia_Player){
+		return iRet;
+	}
+
+	if (NULL != m_player_stat){
+		player_deinit(m_player_stat);
+		m_player_stat = NULL;
+	}
+
+	m_player_stat = (player_stat_t*)av_mallocz(sizeof(player_stat_t));
+	if (NULL == m_player_stat){
+		pMedia_Player->playlog("player_stat_t struct malloc failed!");
 		return iRet;
 	}
+	else {
+		pMedia_Player->playlog("player_stat_t struct malloc success!");
+	}
 
 	m_player_stat->filename = av_strdup(pMedia_Player->p_input_file);
 	m_player_stat->rvc_log = pMedia_Player->playlog;
@@ -271,8 +284,7 @@ int CMediaPlayer::Init(rvc_media_player_param_t* pMedia_Player)
 	m_player_stat->piconpath = av_strdup(pMedia_Player->picon_path);
 	m_player_stat->eMType = pMedia_Player->eType;
 	m_player_stat->uVolume = m_uvolume;
-	if (m_player_stat->filename == NULL || NULL == m_player_stat->rvc_log || NULL == m_player_stat->prvc_cb || NULL == m_player_stat->piconpath)
-	{
+	if (m_player_stat->filename == NULL || NULL == m_player_stat->rvc_log || NULL == m_player_stat->prvc_cb || NULL == m_player_stat->piconpath){
 		player_deinit(m_player_stat);
 		m_player_stat = NULL;
 		return iRet;

+ 1 - 1
Other/libpictureplayer/CMakeLists.txt

@@ -1,4 +1,4 @@
-set(MODULE_NAME "libpictureplayer")
+set(MODULE_NAME "pictureplayer")
 set(MODULE_PREFIX "LIB_PICTUREPLAYER_FUNC")
 
 if(RVC_DEBUG_MODE)

+ 6 - 0
Other/libpictureplayer/libpictureplayer.cpp

@@ -23,6 +23,12 @@ public:
 		m_pHostApi = pHostApi;
 		memset(&m_stPlayConfig, 0, sizeof(m_stPlayConfig));
 		m_Player = new CPicturePlayer();
+		if (NULL != m_Player) {
+			pHostApi->PicDebug(" new PicturePlayer success!");
+		}
+		else {
+			pHostApi->PicDebug(" new PicturePlayer failed!");
+		}
 	}
 
 	~libpictureplayer_impl()

+ 1 - 1
Other/libwmpplayer/CMakeLists.txt

@@ -1,4 +1,4 @@
-set(MODULE_NAME "libwmpplayer")
+set(MODULE_NAME "wmpplayer")
 set(MODULE_PREFIX "LIB_WMPPLAYER_FUNC")
 
 set(${MODULE_PREFIX}_SRCS