This article is from kandroid. It can also be found in the android source code development/PDK/. It is recently implemented in the android camera module. We can see this article. Although it is concise, most of it is quite useful, so remember to share your reference here.
Android camera
Brief:
- Compile libcamera. So Library
- Time Sequence Diagram
- Interface
The android camera subsystem associates the "top-layer camera application" with the application framework layer and various libraries of the user space (the media library camera Library), and connects the camera hardware abstraction layer to operate the physical camera.
Describes the structure of the camera subsystem:
Note: In the multimedia framework, the Android 2.3 system stagefright replaces opencore.
Compile a libcamera. So Library
To implement a camera driver, you need to defineThe camerahardwareinterface. H Interface is compiled into a dynamic link library. The dynamic link library must be named libcamera. So, so that the anroid runtime can be loaded from/system/lib. We recommend that you put the camera source code and Android. mk in this directory.
vendor/acme/chipset_or_board/libcamera/
。
The following Android. mk stub file ensures that libcamera can be linked to the corresponding library during compilation:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libcamera
LOCAL_SHARED_LIBRARIES := \
libutils \
librpc \
liblog
LOCAL_SRC_FILES += MyCameraHardware.cpp
LOCAL_CFLAGS +=
LOCAL_C_INCLUDES +=
LOCAL_STATIC_LIBRARIES += \
libcamera-common \
libclock-rpc \
libcommondefs-rpc
include $(BUILD_SHARED_LIBRARY)
Time Sequence Diagram
A preview timeline and a picture timeline.
Preview
The following diagram illustrates the function call and action sequence necessary for camera preview:
Photography
The following diagram illustrates the function call and action sequence diagrams necessary for camera photography:
Interface
For more information about the Function interfaces for camera operations, see camerahardwareinteface. h. See examples.
Add:
Android source code: There are a lot of device Hal code in the device/directory. For example, camera is implemented in the Samsung/crepo/libcamera/path. This is Nexus S.
Refer to the Hal code of the front and rear cameras and then debug your own code.