Hi, I have a question about using the camera service. Here are something I observed from different discussions as well as my own tests on a real development board with Froyo.
1. The default pixel format for camera preview is YUV420SP. 2. To show a camera preview, the camera view surface at the app level is normally set to PUSHED type and the surface holder is sent to camera service so the preview is actually managed automatically by the framework. 3. As an alternative to #2, application can accept camera data from a camera preview callback and build its own UI display from the data with further processing. I found some discussions for bar code scanner type of applications. YUV420SP is good in that only luminance information is important for image analyzing and the data is upfront in the returned byte stream. My question is, how the preview in the standard Android Camera app worked with color. If the Camera HAL layer only returns with YUV420SP format, the OpenGL processing in surface layer can only display Y plane and there will be no color preview. Running the standard Camera app with the fake camera source in the Android code tree shows a gray- scale picture in the preview window although from the source code it does have color content. The camera API does provide a method to set preview format, so I guess if the app side selects RGB565, a color preview can be seen. But I don't find any place in the Camera app request this. There is a third path to show the preview, which is through the overlay layer and I heard about some devices use that for preview then it leads to my next question about the media recording. I believe the video encoders accepts YUV420SP format only. This can be found from Stagefright recorder's code. The CameraSource::getFormat set the kKeyColorFormat to OMX_COLOR_FormatYUV420SemiPlanar directly. I'm not clear about the PVMediaRecorder case but I guess it's the same. YUV is more accepted for video content. In order to get encoder work, the data from camera must be in YUV420SP, then how to get the camera preview work at same time? We should only see a gray-scaled display for preview, correct? The camera should not provide two data streams with YUV420SP(for encoding) and RGB565 (for preview surface) at same time. I'm wondering how the devices on the market worked this out. Another similar discussion can be found here: http://groups.google.com/group/zxing/browse_thread/thread/6bfbc218f68ecc7c And that ends with no answer also. Anybody can give me a hint? Thanks, -Tim -- 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

