调过摄像头的指点一下,显示白屏
用Coolpad268开发,直接借用了ICAMERA API中的例子,调试很长时间,怎么显示的还是白屏,哪位做过指点一下.
谢谢
原码如下:
static int CApp_StartCameraInPreviewMode(CApp * pme)
{
int nErr;
int nRet;
//boolean bTrue;
//IBitmap *pFrame;
//AEEBitmapInfo bi;
nErr = ISHELL_CreateInstance(pme->a.m_pIShell,AEECLSID_CAMERA,(void**)&pme->m_pICamera);
if(nErr)
{
return nErr;
}
nRet =ICAMERA_RegisterNotify(pme->m_pICamera,CApp_CameraNotify,pme);
if(nErr)
{
return nErr;
}
nErr = ICAMERA_SetDisplaySize(pme->m_pICamera,&pme->m_sizePreview);
if(nErr)
{
return nErr;
}
pme->m_sizeFrame.cx = 176;
pme->m_sizeFrame.cy = 198;
ICAMERA_SetSize(pme->m_pICamera,&pme->m_sizeFrame);
nErr = ICAMERA_Preview(pme->m_pICamera);
if(nErr != SUCCESS)
{
return nErr;
}
return SUCCESS;
}
static void CApp_CameraNotify(void *pUser,AEECameraNotify *pn)
{
CApp *pme = (CApp*)pUser;
DBGPRINTF("\n Inside Notify\n");
if(!pme || !pn){
return;
}
switch(pn->nStatus)
{
case CAM_STATUS_START:
DBGPRINTF("\n Inside start\n");
break;
case CAM_STATUS_FRAME:
{
IBitmap *pFrame;
AEEBitmapInfo bi;
DBGPRINTF("\n Inside Display\n");
if(SUCCESS != ICAMERA_GetFrame(pme->m_pICamera,&pFrame)){
return;
}
IBITMAP_GetInfo(pFrame,&bi,sizeof(bi));
IDISPLAY_BitBlt(pme->a.m_pIDisplay,0,0,bi.cx,bi.cy,pFrame,0,0,AEE_RO_COPY);
IBITMAP_Release(pFrame);
IDISPLAY_Update(pme->a.m_pIDisplay);
break;
}
case CAM_STATUS_DONE:
DBGPRINTF("CAM_STATUS_DONE");
break;
case CAM_STATUS_ABORT:
DBGPRINTF("CAM_STATUS_ABORT\n");
break;
}
}