標籤:android camera 原始碼
本文基於Android 4.2.2+Linux3.6.9+SAMA5D3 SoC從原始碼的角度審視Android Camera子系統。
應用程式層
Androd原生Camera應用
/system/app/LegacyCamera.apk
http://androidxref.com/4.2.2_r1/xref/packages/apps/LegacyCamera/
Camera應用調用Android應用程式框架提供的Camera API
import android.hardware.Camera;
import android.hardware.Camera.Area;
import android.hardware.Camera.CameraInfo;
import android.hardware.Camera.Face;
import android.hardware.Camera.FaceDetectionListener;
import android.hardware.Camera.Parameters;
import android.hardware.Camera.PictureCallback;
import android.hardware.Camera.Size;
應用程式框架層
/system/framework/framework.jar
http://androidxref.com/4.2.2_r1/xref/frameworks/base/core/java/android/hardware/Camera.java
JNI
/system/lib/libandroid_runtime.so
http://androidxref.com/4.2.2_r1/xref/frameworks/base/core/jni/android_hardware_Camera.cpp
Camera ServiceBinder Proxy
Camera ServiceBinder Proxy是Camera Client和Camera Service之間通訊的統一通道。Camera Client和Camera Service都會調用Camera Service Binder Proxy。
/system/lib/libcamera_client.so
標頭檔目錄
http://androidxref.com/4.2.2_r1/xref/frameworks/av/include/camera/
源檔案目錄
http://androidxref.com/4.2.2_r1/xref/frameworks/av/camera/
Camera Service
Camera Service與Camera HAL互動,通過Binder Service的方式為Camera Client提供服務。
/system/lib/libcameraservice.so
http://androidxref.com/4.2.2_r1/xref/frameworks/av/services/camera/libcameraservice/
HAL
Camera硬體抽象層定義並實現供Camera Service調用的標準介面,保證Camera硬體的功能能夠正常發揮。
/system/lib/hw/camera.sama5d3-ek.so
標頭檔
http://androidxref.com/4.2.2_r1/xref/hardware/libhardware/include/hardware/camera.h
源檔案目錄
https://github.com/Android4SAM/platform_hardware_atmel/tree/master/sama5d3/camera
KernelDriver
Camera驅動程式與Camera硬體和HAL互動。Camera硬體和驅動程式必須支援YV12和NV21映像格式以支援預覽和錄影。
The V4L2driver for Atmel Linux
https://github.com/Android4SAM/linux-at91/blob/android4sam_v4.0/drivers/media/video/atmel-isi.c
SoC Cameradriver for Omni Vision 2640 sensor
https://github.com/Android4SAM/linux-at91/blob/android4sam_v4.0/drivers/media/video/ov2640.c
Android Camera子系統之原始碼View