Hi,
my app requirement was to take snapshots from front camera, recognize useless (too dark or monochrome) images and save them into jpeg format.
I've succesfully accomplished it on all tested device except N96... so i'm searching a reason for it... i always have a totally black image of around 9 KB....
CCamera::ImageReady() is called with aError==KErrNone; inside this method i perform a duplication:
and err == 0Code:iBitmapSave->Reset(); TInt err = iBitmapSave->Duplicate( aBitmap->Handle() );
then i call my jpeg encoding method:
but i don't think the problem is in the jpeg conversion, because i used the same function to convert screenshots and it was (it is in fact) working fine in N96 too... but maybe screenshots and snapshot are taken into different memory areas?Code:/* * Returns a buffer with encoded jpeg image */ HBufC8* CFrontCameraApp::GetImageBufferL(CFbsBitmap* aBitmap) { if (aBitmap == NULL) return HBufC8::NewL(0); // set jpeg properties CFrameImageData* frameImageData = CFrameImageData::NewL(); CleanupStack::PushL(frameImageData); TJpegImageData* imageData = new (ELeave) TJpegImageData(); imageData->iSampleScheme = TJpegImageData::EColor444; imageData->iQualityFactor = 75; // set 90 for normal or 100 for high frameImageData->AppendImageData(imageData); // convert to jpeg synchronously HBufC8* imageBuf = NULL; CImageEncoder* encoder = CImageEncoder::DataNewL(imageBuf,_L8("image/jpeg"),CImageEncoder::EOptionAlwaysThread); CleanupStack::PushL(encoder); TRequestStatus aStatus = KErrNone; encoder->Convert( &aStatus, *aBitmap, frameImageData ); User::WaitForRequest( aStatus ); CleanupStack::PopAndDestroy(encoder); CleanupStack::PopAndDestroy(frameImageData); return imageBuf; }
and native camera app on N96 is taking nice snapshots in jpeg format with front camera
thank you for any hint,
regards,
pg





