浏览代码

Z991239-1258 #comment other: 解决localmediaplayer存在启动失败问题

陈礼鹏80274480 4 年之前
父节点
当前提交
6f1633911a

+ 1 - 1
Other/libmediaplayer/libmediaplayer.cpp

@@ -13,7 +13,7 @@ public:
 	libmediaplayer_impl(CMediaHostApi* pHostApi) {
 		m_pHostApi = pHostApi;
 		pHostApi->Debug("begin new MediaPlayer.");
-		m_Player = new CMediaPlayer(pHostApi, "D:/run/version/0.0.2.0/bin/rvc_media_player_64px.bmp");
+		m_Player = new CMediaPlayer(pHostApi, "./rvc_media_player_64px.bmp");
 		if (NULL != m_Player) {
 			pHostApi->Debug(" new MediaPlayer success!");
 		}

+ 30 - 2
Other/libmediaplayer/player.cpp

@@ -22,6 +22,34 @@
 
 static int player_deinit(player_stat_t *is);
 
+static char* rvc_strdup(const char* strdata)
+{
+	char* strbuffer = NULL;
+	if (NULL == strdata)
+	{
+		return strbuffer;
+	}
+
+	uint8_t ulen = strlen(strdata);
+	if (strbuffer = (char*)malloc(ulen + 1))
+	{
+		memset(strbuffer, 0, ulen + 1);
+		memcpy(strbuffer, strdata, ulen);
+	}
+
+	return strbuffer;
+}
+
+
+static void rvc_strfree(char* strdata)
+{
+	if (NULL != strdata)
+	{
+		free(strdata);
+		strdata = NULL;
+	}
+}
+
 
 // 返回值:返回上一帧的pts更新值(上一帧pts+流逝的时间)
 double get_clock(play_clock_t *c)
@@ -181,7 +209,7 @@ CMediaPlayer::CMediaPlayer(CMediaHostApi* pHostApi, const char* picon_path)
 	m_player_stat = NULL;
 	m_uvolume = SDL_MIX_MAXVOLUME;
 	m_bplaying = false;
-	m_piconpath = av_strdup(picon_path);
+	m_piconpath = rvc_strdup(picon_path);
 	if (NULL != m_hostapi){
 		m_hostapi->Debug("new CMediaPlayer success!");
 	}
@@ -196,7 +224,7 @@ CMediaPlayer::~CMediaPlayer()
 		free(m_hostapi);
 	}
 	if(NULL != m_piconpath){
-		av_free(m_piconpath);
+		rvc_strfree(m_piconpath);
 	}
 	
 }

+ 1 - 1
Other/libpictureplayer/libpictureplayer.cpp

@@ -14,7 +14,7 @@ public:
 		m_bIsPlay = false;
 		m_pHostApi = pHostApi;
 		memset(&m_stPlayConfig, 0, sizeof(m_stPlayConfig));
-		m_Player = new CPicturePlayer(pHostApi, "D:/run/version/0.0.2.0/bin/rvc_media_player_64px.bmp");
+		m_Player = new CPicturePlayer(pHostApi, "./rvc_media_player_64px.bmp");
 		if (NULL != m_Player) {
 			pHostApi->PicDebug(" new PicturePlayer success!");
 		}