Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Hi All,
In my app when i am calling IMEDIA_Play, my app is crashing, even the IMedia obejct is valid and i am able to call IMEDIA_RegisterNotify and IMEDIA_SetVolume using that IMedia object.
On calling IMEDIA_SetVolume i am getting following values in MediaNotify function.
pCmdNotify->nCmd = MM_CMD_SETMEDIAPARM,
pCmdNotify->nSubCmd = MM_PARM_VOLUME
pCmdNotify->nStatus = MM_STATUS_DONE.

After setting volume when i am calling IMEDIA_Play, at this point my app is crashing.
My code is given below.. can anybody tell me what is wrong with this..
This all i am doing in Simulator using SDK Ver 3.1.4. I have already installed CMX player at SDK location.

void MP3Player_Play(MP3Play *pMe)
{
AEEMediaData md;
AECHAR *currFileName;
char szFullPath[MP3PLAYER_MAX_PATH];
char fileName[MP3PLAYER_MAX_PATH];
AECHAR wFileName[MP3PLAYER_MAX_PATH];
int nRet = 0;
AEECLSID clsID;

IVECTORMODEL_GetAt(pMe->mp3list, pMe->currIndex, (void**)&currFileName);
WSTRTOSTR(currFileName, szFullPath, MP3PLAYER_MAX_PATH);

//GETFILENAME(fileName, szFullPath);
STRCPY(fileName, szFullPath);
STRTOWSTR(fileName, wFileName, MP3PLAYER_MAX_PATH);

WSTRCPY(pMe->titleStr, wFileName);

if (pMe->pIMedia)
{
IMEDIA_Stop(pMe->pIMedia);
IMEDIA_Release(pMe->pIMedia);
pMe->pIMedia = NULL;
}
md.clsData = MMD_FILE_NAME;
md.pData = (void *)szFullPath;
md.dwSize = 0;
nRet =IMEDIAUTIL_CreateMedia(pMe->mp3MediaUtil, &md, &pMe->pIMedia);

if (nRet == SUCCESS)
{
pMe->nProgressTime = 0;
pMe->nPlayTime = 0;
nRet = IMEDIA_RegisterNotify(pMe->pIMedia, MP3Player_PlayMediaNotify, pMe);
IMEDIA_GetTotalTime(pMe->pIMedia);
}

nRet = IMEDIA_GetClassID(pMe->pIMedia, &clsID);
if(nRet || clsID != AEECLSID_MEDIAMP3)
{
DBGPRINTF("!!! MEDIA Creation FAILED !!!");
}

IMEDIA_SetVolume(pMe->pIMedia, pMe->ISoundVolume);
nResult = IMEDIA_Play(pMe->pIMedia);

plz make sure that IMedia instance must not be be created more than once at a time in application. In such case the unexpected behavior is seen; if you need IMedia instances at different places then use the same instance across all the places in the app.

plz make sure that IMedia instance must not be be created more than once at a time in application. In such case the unexpected behavior is seen; if you need IMedia instances at different places then use the same instance across all the places in the app.