JLBrown
June 3, 2003, 16:46:07
Has anyone else experienced a problem under windows XP with a sony camera? I am currently developing using a (SONY-DFW SX900). In the code fragment under windows 2000 when ever snapImages fails (seems quiet rare to happen) the application sucessfully re-tries and continues. However under Windows XP when snapImages fails when it re-tries it is successful in capturing an image, but the image is all broken up.
Has anyone else experienced this? Should I stop the live image and then start it up again before retrying? The frame sink type is set to 'eSNAP'
Thanks in advance,
John
BOOL CaptureFixedShutterFrame(tCameraBoard *pBoard,int nFramePerImage,long timeoutSeconds=10)
{
REFERENCE_TIME curTime,timeNow;
BOOL bResult = FALSE;
Grabber::tMemBufferPtr pMemBuff = NULL;
//if (!pBoard->pGrabber->isLive())
if (!pBoard->pGrabber->setCallback())return ErrorMessageBox(false,"setCallback(): failed");
if (!pBoard->pGrabber->startLive(false))return ErrorMessageBox(false,">startLive(false): failed");
if (!pBoard->pGrabber->getCurReferenceTime(curTime))return ErrorMessageBox(false,"getCurReferenceTime(): failed");
do{
pBoard->pGrabber->getCurReferenceTime(timeNow);
long sec = nano2sec(timeNow - curTime);
if (sec >= timeoutSeconds){
pBoard->pGrabber->stopLive();
return FALSE;//ErrorMessageBox(false,"Timeout!");
}
if (!pBoard->pGrabber->snapImages(1,2500)){
ErrorMessageBox(false,"snapImages failed!");
continue; // grab images
}
if ((pMemBuff = pBoard->pGrabber->getActiveMemBuffer())==NULL){
ErrorMessageBox(false,"getActiveMemBuffer failed!");
continue;
}
tsMediaSampleDesc desc = pMemBuff->getSampleDesc();
if ((curTime/100000) > desc.SampleStart)
continue;// skip as it's an old frame (with possible drag)
bResult = TRUE;
}while (bResult != TRUE);
if ((pMemBuff = pBoard->pGrabber->getActiveMemBuffer())==NULL){pBoard->pGrabber->stopLive();return FALSE;}
memcpy(pBoard->uFrameBuffer,pMemBuff->getPtr(),pBoard->uFrameBufferSz);
pBoard->pGrabber->stopLive();
return bResult;
}
Has anyone else experienced this? Should I stop the live image and then start it up again before retrying? The frame sink type is set to 'eSNAP'
Thanks in advance,
John
BOOL CaptureFixedShutterFrame(tCameraBoard *pBoard,int nFramePerImage,long timeoutSeconds=10)
{
REFERENCE_TIME curTime,timeNow;
BOOL bResult = FALSE;
Grabber::tMemBufferPtr pMemBuff = NULL;
//if (!pBoard->pGrabber->isLive())
if (!pBoard->pGrabber->setCallback())return ErrorMessageBox(false,"setCallback(): failed");
if (!pBoard->pGrabber->startLive(false))return ErrorMessageBox(false,">startLive(false): failed");
if (!pBoard->pGrabber->getCurReferenceTime(curTime))return ErrorMessageBox(false,"getCurReferenceTime(): failed");
do{
pBoard->pGrabber->getCurReferenceTime(timeNow);
long sec = nano2sec(timeNow - curTime);
if (sec >= timeoutSeconds){
pBoard->pGrabber->stopLive();
return FALSE;//ErrorMessageBox(false,"Timeout!");
}
if (!pBoard->pGrabber->snapImages(1,2500)){
ErrorMessageBox(false,"snapImages failed!");
continue; // grab images
}
if ((pMemBuff = pBoard->pGrabber->getActiveMemBuffer())==NULL){
ErrorMessageBox(false,"getActiveMemBuffer failed!");
continue;
}
tsMediaSampleDesc desc = pMemBuff->getSampleDesc();
if ((curTime/100000) > desc.SampleStart)
continue;// skip as it's an old frame (with possible drag)
bResult = TRUE;
}while (bResult != TRUE);
if ((pMemBuff = pBoard->pGrabber->getActiveMemBuffer())==NULL){pBoard->pGrabber->stopLive();return FALSE;}
memcpy(pBoard->uFrameBuffer,pMemBuff->getPtr(),pBoard->uFrameBufferSz);
pBoard->pGrabber->stopLive();
return bResult;
}