|
@@ -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);
|
|
|
}
|
|
|
|
|
|
}
|