I don't know all the answers to your question. Here's what I know. 1. If your application only needs to show the preview and does not need to process the preview frame, the app doesn't need to allocate any buffer or register preview callback. The framework/driver will draw the preview for your app. 2. For G1 and Magic, preview buffers are allocated by the driver. During start preview, camera service gets the preview heap from the driver and calls registerBuffers on the surface. See registerPreviewBuffers() in frameworks/base/camera/libcamera/ CameraService.cpp in 2.0 for reference. Whenever the camera service gets a preview frame from the driver, it calls mSurface->postBuffer() to draw on the surface. Droid uses overlay and the driver directly draws on the screen.
On Nov 21, 1:56 pm, android-newbie <[email protected]> wrote: > I have some questions regarding the code below forcamerapreview > applicaiton. I am hoping someone can help me out. Thanks in advance. > > 1. How does surfaceCreated() and CreateSurface() relate? Is this > surface created via createSurface() from SurfaceFlinger client to > SurfaceFlinger server? If so, there must be > 2 buffers (frame buffers from display driver if there is hw > acceleration or if it is the emulator, it will be from ashmem) > associated with this surface: surface BB (for composition) > and surface FB (for display). Am I correct? Can you please confirm? > > 2. How does the rendering buffer (frame buffer BB and frame buffer > FB) get allocated in thecamerapreview application? Are they > allocated by the application? > > 3. How does this surface relate to the preview buffers? Are the > preview buffers allocated by theCameraService during startPreview? > > private class CameraSurfaceView extends SurfaceView implements > SurfaceHolder.Callback { > private SurfaceHolder mHolder; > privateCameracamera= null; > public CameraSurfaceView(Context context) { > super(context); > mHolder = getHolder(); > mHolder.addCallback(this); > mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); > } > public void surfaceCreated(SurfaceHolder holder) { > camera=Camera.open(); > try { > camera.setPreviewDisplay(mHolder); > } catch (Exception e) { > Log.e("Camera", "Failed to setcamerapreview > display", e); > } > } > > } > > Thank you very much for your help. > an -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

