ubuntu 在 R40e 上 還有 Debian 在 Sempron 2600 上

2011年6月29日 星期三

提供 camera service 的好像是
/framework/base/service/camera -- libcameraservice
使用這個 share library 的 有
  1. /framework/base/media/mediaserver
  2. /framework/base/cmds/system_server/library -- linked by system_serer
mediaserver 很有趣,就只有: int main(int argc, char** argv) { sp<ProcessState> proc(ProcessState::self()); sp<IServiceManager> sm = defaultServiceManager(); LOGI("ServiceManager: %p", sm.get()); AudioFlinger::instantiate(); MediaPlayerService::instantiate(); CameraService::instantiate(); AudioPolicyService::instantiate(); ProcessState::self()->startThreadPool(); IPCThreadState::self()->joinThreadPool(); }
CameraService 跟 Surface, Overlay 相關的部份,大概是 CameraService::Client::setOverlay() CameraService::Client::registerPreviewBuffers() 這兩個 function 的 format 都是 hard-coded:

setOverlay: mOverlayRef = mSurface->createOverlay(w, h, OVERLAY_FORMAT_YCbCr_420_SP, mOrientation);
registerPreviewBuffers: ISurface::BufferHeap buffers(w, h, w, h, HAL_PIXEL_FORMAT_YCrCb_420_SP, mOrientation, 0, mHardware->getPreviewHeap()); 這個 FORMAT_YCrCb_420_SP 是如何決定的?


FORMAT
hardware/libhardware/include/hardware/hardware.h enum { HAL_PIXEL_FORMAT_RGBA_8888 = 1, HAL_PIXEL_FORMAT_RGBX_8888 = 2, HAL_PIXEL_FORMAT_RGB_888 = 3, HAL_PIXEL_FORMAT_RGB_565 = 4, HAL_PIXEL_FORMAT_BGRA_8888 = 5, HAL_PIXEL_FORMAT_RGBA_5551 = 6, HAL_PIXEL_FORMAT_RGBA_4444 = 7, HAL_PIXEL_FORMAT_YV12 = 0x32315659, // YCrCb 4:2:0 Planar /* Legacy formats (deprecated), used by ImageFormat.java */ HAL_PIXEL_FORMAT_YCbCr_422_SP = 0x10, // NV16 HAL_PIXEL_FORMAT_YCrCb_420_SP = 0x11, // NV21 HAL_PIXEL_FORMAT_YCbCr_420_SP = 0x12, // NV16 HAL_PIXEL_FORMAT_YCbCr_420_I = 0x13, // NV16 HAL_PIXEL_FORMAT_YCbCr_422_I = 0x14, // YUY2 };

hardware/libhardware/include/hardware/overlay.h: enum { OVERLAY_FORMAT_RGBA_8888 = HAL_PIXEL_FORMAT_RGBA_8888, OVERLAY_FORMAT_RGB_565 = HAL_PIXEL_FORMAT_RGB_565, OVERLAY_FORMAT_BGRA_8888 = HAL_PIXEL_FORMAT_BGRA_8888, OVERLAY_FORMAT_YCbCr_420_SP = HAL_PIXEL_FORMAT_YCbCr_420_SP, OVERLAY_FORMAT_YCbYCr_422_I = 0x14, OVERLAY_FORMAT_CbYCrY_422_I = 0x16, OVERLAY_FORMAT_DEFAULT = 99 // The actual color format is determined // by the overlay };

沒有留言:

標籤

網誌存檔