播放视频的问题, 很急

linlu0606 2007-11-20 02:43:49
请帮我看看我的代码,怎么不能播放,很急,谢谢啦!
void Play_Media(multimediaplayer* pMe)
{
IMediaUtil *pMediaUtil;
AEEMediaData sMediaData;
//AEERect rc;
int result;
int a;
char szFilename[20] = "123.mp3";

ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_MEDIAUTIL, (void **)&pMediaUtil);
DBGPRINTF("0");

if(!pMediaUtil)
{
//Error....
DBGPRINTF("error");
}

sMediaData.clsData = MMD_FILE_NAME;
sMediaData.pData = (void *)& szFilename;
sMediaData.dwSize = 0;

result = IMEDIAUTIL_CreateMedia(pMediaUtil, &sMediaData, &pMe->pIMediaObject);
if(!pMe->pIMediaObject)
{
//Error....
if (result == MM_ENOMEDIAMEMORY)
DBGPRINTF("Error: %d", result);

}

DBGPRINTF("1");
IMEDIAUTIL_Release(pMediaUtil);

a=IMEDIA_RegisterNotify(pMe->pIMediaObject, (PFNMEDIANOTIFY)IMediaEventHandler, (void *) pMe);

DBGPRINTF("a=%d",a);

IMEDIA_GetTotalTime(pMe->pIMediaObject);
IMEDIA_Play(pMe->pIMediaObject);
IMEDIA_Release(pMe->pIMediaObject);



DBGPRINTF("3");

DBGPRINTF("pMedia = %d",pMe->pIMediaObject);




/*if(pMe->pIMediaObject)
{
rc.x = 0;
rc.y = 0;
rc.dx = pMe->DeviceInfo.cxScreen;//The width of the rectangle
rc.dy = pMe->DeviceInfo.cyScreen;//The height of the rectangle

//a=IMEDIA_SetRect(pMe->pIMediaObject,&rc,NULL);
//DBGPRINTF("a=%d",a);

DBGPRINTF("pMedia = %d",pMe->pIMediaObject);
IMEDIA_Play(pMe->pIMediaObject);
DBGPRINTF("pMedia= %d",pMe->pIMediaObject);
}


DBGPRINTF("3");*/

//if(pIMediaObject)
//IMEDIAUTIL_Release(pMediaUtil);

//DBGPRINTF("4");

IDISPLAY_Update(pMe->a.m_pIDisplay);
DBGPRINTF("4");
}


void IMediaEventHandler(void *pUser, AEEMediaCmdNotify *pCmdNotify)
{
multimediaplayer *pMe = (multimediaplayer*)pUser;
// AEERect sRect;
IBitmap *pFrame;

if( pCmdNotify->nStatus == MM_MOVIE_LOADED )
{
IMEDIA_EnableFrameCallback(pCmdNotify->pIMedia, TRUE);
IMEDIA_Play(pCmdNotify->pIMedia);
DBGPRINTF("4");
return;
}



switch(pCmdNotify->nCmd)
{
case MM_CMD_GETTOTALTIME:
if(pCmdNotify->nStatus == MM_STATUS_DONE)
{
pMe->dwTotalMediaTime = (int)pCmdNotify->pCmdData;

if( SUCCESS != IMEDIA_Play(pCmdNotify->pIMedia) )
{
//Set a timer to attempt the play later
}
}
break;

case MM_CMD_PLAY:
switch(pCmdNotify->nStatus)
{
case MM_STATUS_START:
//Change UI to reflect play status
DBGPRINTF("5");
break;

case MM_STATUS_DONE:
//Change UI to reflect stop status
//IMEDIA_Play(pIMediaObject);
DBGPRINTF("Call back MM_STATUS_DONE");

break;

case MM_STATUS_TICK_UPDATE:
//Advance your time counter here
DBGPRINTF("6");
break;
case MM_PARM_FRAME:
/*IMEDIA_GetFrame(pCmdNotify->pIMedia, &pFrame);
if(!pFrame)
{
//Error
return;
}

//.....Draw the IBitmap to the screen
IBITMAP_Release(pFrame);*/
{
// IBitmap* pFrame;
AEEBitmapInfo bi;

IMEDIA_GetFrame(pMe->pIMediaObject, &pFrame);
IBITMAP_GetInfo(pFrame,&bi,sizeof(bi));
IDISPLAY_BitBlt(pMe->a.m_pIDisplay,0,0,bi.cx,bi.cy,
pFrame,0,0,AEE_RO_COPY);
IDISPLAY_Update(pMe->a.m_pIDisplay);
IBITMAP_Release(pFrame);
DBGPRINTF("7");

break;
}
}
break;
}
}

...全文
618 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
knowledge_Is_Life 2008-05-01
  • 打赏
  • 举报
回复
我也想知道,正在找這方面的資料~~~~~
UltraBejing 2008-04-30
  • 打赏
  • 举报
回复
我也想知道,正在找這方面的資料~~~~~
linlu0606 2007-12-10
  • 打赏
  • 举报
回复
谢谢勒,我改看看。还有,就是我播放视频的时候怎么没有声音呢?
2025hawk 2007-12-09
  • 打赏
  • 举报
回复
IMEDIA_GetTotalTime(pMe-> pIMediaObject);
IMEDIA_Play(pMe-> pIMediaObject);
IMEDIA_Release(pMe-> pIMediaObject);

你play之后马上释放,肯定不能播放。

这样写也不好

int result = 0;


result = IMEDIA_GetTotalTime(pMe-> pIMediaObject);

if(result != SUCCESS)
{
IMEDIA_Play(pMe-> pIMediaObject);
//Set flag of playing;
}


switch(pCmdNotify-> nCmd)
{
case MM_CMD_GETTOTALTIME:
//Get totaltime
//if playing flag is false, use IMEDIA_Play(pMe-> pIMediaObject);

}
sharetop 2007-12-04
  • 打赏
  • 举报
回复
char szFilename[20] = "123.mp3 ";

...

sMediaData.clsData = MMD_FILE_NAME;
sMediaData.pData = (void *)& szFilename;
sMediaData.dwSize = 0;

请将szFilename放入结构中,否则出了这个函数它就不存在了,那样,Media的回调根本找不到东西吧。

868

社区成员

发帖
与我相关
我的任务
社区描述
为开发者提供高通丰富的解决方案及全面技术下载内容。本版以AI人工智能、WoS移动笔记本、XR、IoT 物联网、Auto 汽车、生成式AI等核心板块组成,为开发者提供一个便捷及高效的学习交流平台。
人工智能物联网机器学习 企业社区 北京·东城区
社区管理员
  • Qualcomm开发
  • csdnsqst0050
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧