Directly to the matter, here is my code (almost exactly the same of
CameraSample.c):
-the capture function:
void CapturaImagem( )
{
Err erro = errNone;
CamLibBitmapInfoType info;
CamLibCaptureType capture;
CamLibSettingType captureFormat;
PhotoCaptureInfo captureInfo;
captureFormat.type = kCamLibCaptureDataFormatRGB565;
erro = CamLibControl(camLibRefNum, kCamLibCtrlCaptureFormatSet,
&captureFormat);
captureFormat.type = kCamLibImageSizeQVGA;
erro = CamLibControl(camLibRefNum, kCamLibCtrlCaptureSizeSet,
&captureFormat);
erro = CamLibControl(camLibRefNum, kCamLibCtrlCaptureGetBitmapInfo,
&info);
captureInfo.winH = WinCreateOffscreenWindow(info.width / 2, info.height /
2, nativeFormat, &erro);
captureInfo.bufferP = BmpGetBits(WinGetBitmap(captureInfo.winH));
capture.userDataP = &captureInfo;
capture.callbackP = PhotoCaptureCallback;
CamLibControl(camLibRefNum, kCamLibCtrlCapture, &capture);
WinDrawBitmap(WinGetBitmap(captureInfo.winH), 0, 0);
WinDeleteWindow(captureInfo.winH, true);
}
- the callback: (that�s the same as CameraSample)
Err PhotoCaptureCallback(void *bufferP, UInt32 size, void *userDataP)
{
PhotoCaptureInfo *captureInfoP = (PhotoCaptureInfo *) userDataP;
if (captureInfoP)
{
MemMove(captureInfoP->bufferP, bufferP, size);
captureInfoP->bufferP += size;
}
return errNone;
}
Still, the app is crashing when I call CapturaImagem( ). Apparently the
callback is being called 'n' times and it only stops when userDataP comes
with a null pointer.
Can I have some help on why is this happening?
Thanks for your attention,
Christiano.
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/