为何IMedia播放不了视频格式.
IMedia接口播放视频文件,和播放声音文件有什么特别地方要注意吗,
为何我的这段程序,只能播放声音文件,换做视频文件时,IMEDIAUTIL_CreateMedia(pMe->pIMediaUtil,&music,&pMe->pMedia),总是创建不了对象,
代码如下:
// lab 2
static void PlayMusic(mymedia* pMe)
{
AEEMediaData music;
AEERect rect;
music.clsData = MMD_FILE_NAME;
music.pData = "1.mp4";//这里改成视频格式的文件就播不了,MP3的没问题.
music.dwSize = 0;
if(SUCCESS != ISHELL_CreateInstance(pMe->pIShell,AEECLSID_MEDIAUTIL,(void **)&pMe->pIMediaUtil))
return;
if(SUCCESS != IMEDIAUTIL_CreateMedia(pMe->pIMediaUtil,&music,&pMe->pMedia))
return ;
//if(ISHELL_CreateInstance(pMe->pIShell,AEECLSID_MEDIAMIDI,(void**)&pMe->pMedia) != SUCCESS)
// return;
SETAEERECT(&rect,0,0,50,50);
IMEDIA_SetRect(pMe->pMedia,&rect,&rect);
IMEDIA_SetMediaData(pMe->pMedia,&music);
IMEDIA_EnableFrameCallback(pMe->pMedia, TRUE);
IMEDIA_RegisterNotify(pMe->pMedia,(PFNMEDIANOTIFY)CApp_MediaEventNotify,pMe);
IMEDIA_Play(pMe->pMedia);
}
static void CApp_MediaEventNotify(mymedia *pme, AEEMediaCmdNotify *pcn)
{
switch (pcn->nStatus)
{
case MM_STATUS_FRAME:
{
IBitmap * pFrame;
AEEBitmapInfo bi;
IMEDIA_GetFrame(pme->pMedia, &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);
break;
}
}
}