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