I have a strange problem with camera ViewFinder.
I use MCameraObserver2 interface. This interface has a method - ViewFinderReady(MCameraBuffer& aCameraBuffer, TInt aError), which has to be called periodicaly.
But in my program it called only once.
There is my algorithm with camera:
1) iCamera = CCamera::New2L(*this, 0, 0);
2) iCamera->Reserve();
3) in HandleEvent(const TECAMEvent& aEvent) I call iCamera->PowerOn();
4) in HandleEvent(const TECAMEvent& aEvent) I call StartViewFinder();
A code of the HandleEvent and StartViewFinder:
StartViewFinder TRAP return KErrNone (err == KErrNone)PHP Code:
void HandleEvent(const TECAMEvent& aEvent)
{
if (aEvent.iEventType == KUidECamEventReserveComplete)
{
if (aEvent.iErrorCode == KErrNone)
{
iCamera->PowerOn();
}
else
{
}
}
else
if (aEvent.iEventType == KUidECamEventPowerOnComplete)
{
if (aEvent.iErrorCode == KErrNone)
{
StartViewFinder();
}
else
{
}
}
}
void StartViewFinder()
{
if (iCamera->ViewFinderActive())
{
return;
}
TRAPD(err, iCamera->StartViewFinderBitmapsL(iSize));
}
After that MCameraObserver2's method ViewFinderReady() called and I draw the image on a screen.
BUT: after that ViewFinderReady() does NOT called and my screen aren't updating
But camera are working at the moment, so I can capture image (before capturing image I call StopViewFinder). After capturing image I call StartViewFinder and again ViewFinderReady() called only once.
What a problem could be?
ViewFinderReady implamentation
I've been testing this on a Nokia N78 (FP2)PHP Code:void ViewFinderReady(MCameraBuffer& aCameraBuffer, TInt aError)
{
iNotifier.DrawImage(aCameraBuffer.BitmapL(0));
}

Reply With Quote


