×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jul 2013
    Posts
    73

    Nokia E50 single s60v3 (symbian 9.1) StartViewFinderBitmapsL problem

    So i initialized my cam (well i think it was initialized) then i call StartViewFinderBitmapsL();

    and wait for a bitmap in ViewFinderFrameReady( CFbsBitmap& aFrame );
    But somehow i am unable to draw it on the gc screen

    here is my code:

    Code:
     void Initialize_Camera()
    	 {
    	 FrameFlush = true;
    
    	eCamWidth 	= -1;
    	eCamHeight	= -1;
    
    	 act_img = new (ELeave)CFbsBitmap();
    
     MobEyeCam = CCameraController::NewL();
     MobEyeCam->InitializeCameraL(); this actually Creates CCamera class and reserves it (Reserve() call)
    setsizevar = TSize(640,480);
    act_img = new (ELeave)CFbsBitmap;
    act_img->Create(TSize(800,600),EColor16M); this is a buff where i copy frame from viewfinder to draw it on gc
    }
    
     void CCameraEngine::ReserveComplete(TInt aError)
         {
         iState = ECameraReserved;
         iCamera->PowerOn();
         }
       void CCameraEngine::PowerOnComplete(TInt aError)
         {
    	 iCamera->StartViewFinderBitmapsL(setsizevar);<- 640 x 480
         iState = EEngineIdle;
         }
    
    
     void CCameraEngine::ViewFinderFrameReady(CFbsBitmap& aFrame)
         {
    	 CFbsBitmap * p;
    	 p = (&aFrame);
    	 FrameFlush = true;
    	 TSize sajz;
    	 sajz = aFrame.SizeInPixels();
    	 
    	 eCamWidth 	= sajz.iWidth;
    	 eCamHeight = sajz.iHeight;
    	 TRect tempRect(0,0,eCamWidth,eCamHeight );
    	 int blen = eCamWidth * eCamHeight * 3; 
    	 
    	 Mem::Copy(act_img->DataAddress(),p->DataAddress(),blen);
    	 FrameFlush = false;
    }
    
    
    then i call in container Draw method
    
    gc.DrawBitmap(TPoint(0,0),act_img);

    Maybe my phone does not support StartViewFinderBitmapsL but i don't know how to obtain info that it supports it. (i do not get any errors while running app)

    i found this:
    Getting camera information
    The TCameraInfo class specifies camera information, such as supported
    image format, flash support, zoom support and many others. You can get
    camera information by calling CCamera::CameraInfo().
    In the recipe, we use TCameraInfo::iOptionsSupported,which
    has the type of TOptions. It is a bit flag that stores the camera’s supported
    options. Here is the list of possible values of the bit flag:
    but when i write

    TOptions ble;
    ble = iCamera->iOptionsSupported
    how should i find if EViewFinderBitmapsSupported is supported, and why its not working :P
    Last edited by melepeta; 2013-10-24 at 16:51.

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,752

    Re: Nokia E50 single s60v3 (symbian 9.1) StartViewFinderBitmapsL problem

    CCoeControl does not draw unless it has to. Call DrawNow/Deferred after this copy attempt to really do drawing.
    For calculating bitmap size, you may want to check CFbsBitmap, it has some ScanLineLength or similar method, that may be safer than this *3 (also, there can be padding at the end of each line).
    For the copy, you should use LockHeap (or similar method) of CFbsBitmap, and unlock at the end. As the FBS is a separate process, it may reorganize its memory any time, and it can be source of a nasty bug, and also a hard to track one (as it happens rarely).
    In fact directly copying memory assumes that the bitmaps have the same size and the same display mode. Since you are statically creating a 800x600 truecolor bitmap, this assumption probably has some problems.

  3. #3
    Registered User
    Join Date
    Jul 2013
    Posts
    73

    Re: Nokia E50 single s60v3 (symbian 9.1) StartViewFinderBitmapsL problem

    New info.
    Its solved. I just changed the drawing routine
    i changed:
    gc.DrawBitmap(TPoint(0,0),act_img);

    to

    gc.DrawBitmap(TRect(0,0,100,100),act_img2);

    now i can see it.


    oh and in vewfinderready i managed to make code look sweeter and it should be better processed by phone.
    int blen = eCamWidth * eCamHeight * 4;
    p->LockHeap(false);
    act_img->LockHeap(false);
    Mem::Copy(act_img->DataAddress(),p->DataAddress(),blen);
    p->UnlockHeap(false);

    if (didonce == false)
    {
    act_img2->LockHeap(false);
    Mem::Copy(act_img2->DataAddress(),act_img->DataAddress(),blen);
    act_img2->UnlockHeap(false);
    didonce = true;
    }
    act_img->UnlockHeap(false);
    finally....



    ================================================================================================================
    THIS IS THE OLDER POST SECTION




    Firsty i wish to tell you that i dont use E50 i have E52 (i though it was E50 untill i saw E52 on phones front ;x) well i use bad SDK for it (9.1 instead of 9.3) ;x so i changed SDK to for S60v3 FP2 -strange thing that now thread does not run, i have problems with drawing text etc. even camera isn't showing the bitmap size etc. so i changed it back to 9.1 (maybe its carbide 2.7 problem and i should download 3.2?)


    CCoeControl does not draw unless it has to. Call DrawNow/Deferred after this copy attempt to really do drawing.
    - dont worry i have timer that redraws whole screen with DrawNow method.

    For calculating bitmap size, you may want to check CFbsBitmap, it has some ScanLineLength or similar method, that may be safer than this *3 (also, there can be padding at the end of each line).
    and
    In fact directly copying memory assumes that the bitmaps have the same size and the same display mode. Since you are statically creating a 800x600 truecolor bitmap, this assumption probably has some problems.
    yes the bitmap from viewfinder has EColor16MU format. so its a 32 bit format per pixel so i need to use * 4 not * 3 / anyway when i copy memory it shouldn't care if i copy less pixel data than needed. (but i changed newly created bitmaps to 640x480)


    For the copy, you should use LockHeap (or similar method) of CFbsBitmap, and unlock at the end. As the FBS is a separate process, it may reorganize its memory any time, and it can be source of a nasty bug, and also a hard to track one (as it happens rarely).
    Do you mean that program could want to access bitmap that is now used by another thread? if yes i did something like this
    Code:
     void CCameraEngine::ViewFinderFrameReady(CFbsBitmap& aFrame)
         {
     	 CFbsBitmap * p;	
    	 p = (&aFrame);
    
    	 TSize sajz;
    	 sajz = aFrame.SizeInPixels();
    // act_img and act_img2 have 640x480
    	 eCamWidth 	= sajz.iWidth; //640
    	 eCamHeight = sajz.iHeight; //480
    	// TRect tempRect(0,0,eCamWidth,eCamHeight );
    	 FrameFlush = true;
    
    	 int blen = eCamWidth * eCamHeight * 4; 
    	 
    	 act_img->LockHeap(false);
    	 p->LockHeap(false);
    	 Mem::Copy(act_img->DataAddress(),p->DataAddress(),blen);
    	 
    	if (didonce == false)  // the didonce var informs drawing function that we can draw act_img2 
    		{
    		act_img2->LockHeap(false);
    		 Mem::Copy(act_img2->DataAddress(),p->DataAddress(),blen);	
    		 act_img2->UnlockHeap(false);
    		}
    	 act_img->UnlockHeap(false);
    	 p->UnlockHeap(false);
    	 
    	 didonce = true;
    	 FrameFlush = false;
    }

    Its still not working
    maybe conversion from & to *
    CFbsBitmap * p;
    p = (&aFrame);
    because i need a pointer to use Mem::Copy


    cheers.
    Last edited by melepeta; 2013-10-26 at 01:56.

Similar Threads

  1. Replies: 3
    Last Post: 2011-06-19, 10:25
  2. Senior Symbian S60v3 developer needed for CRM
    By minifeed in forum News and Announcements
    Replies: 1
    Last Post: 2010-11-06, 22:17
  3. Need help using SDL with Symbian S60v3
    By DWMI in forum Symbian
    Replies: 4
    Last Post: 2010-03-26, 21:42
  4. Replies: 7
    Last Post: 2009-01-24, 03:04

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×