| page.title=Camera |
| pdk.version=1.0 |
| doc.type=porting |
| @jd:body |
| |
| <div id="qv-wrapper"> |
| <div id="qv"> |
| <h2>In this document</h2> |
| <a name="toc"/> |
| <ul> |
| <li><a href="#androidCameraBuildingDriver">Building a Camera Library</a></li> |
| <li><a href="#androidCameraSequenceDiagrams">Sequence Diagrams</a></li> |
| <li><a href="#androidCameraInterfaceIntro">Interface</a></li> |
| </ul> |
| </div> |
| </div> |
| |
| <p>Android's camera subsystem connects the camera application to the application framework and user space libraries, which in turn communicate with the camera hardware layer that operates the physical camera.</p> |
| <p>The diagram below illustrates the structure of the camera subsystem.</p> |
| <p><img src="images/camera_video2.gif"></p> |
| |
| |
| <a name="androidCameraBuildingDriver"></a><h3>Building a Camera Library</h3> |
| |
| <p>To implement a camera driver, create a shared library that implements the interface defined in <code>CameraHardwareInterface.h</code>. You must name your shared library <code>libcamera.so</code> so that it will get loaded from <code>/system/lib</code> at runtime. Place libcamera sources and <code>Android.mk</code> in <code>vendor/acme/chipset_or_board/libcamera/</code>.</p> |
| <p>The following stub <code>Android.mk</code> file ensures that <code>libcamera</code> compiles and links to the appropriate libraries:</p> |
| <pre class="prettify"> |
| 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) |
| </pre> |
| |
| |
| <a name="androidCameraSequenceDiagrams"></a><h3>Sequence Diagrams</h3> |
| |
| |
| |
| <a name="androidCameraSequenceDiagramsPreview"></a><h4>Preview</h4> |
| |
| <p>The following diagram illustrates the sequence of function calls and actions necessary for your camera to preview.</p> |
| <img src="images/cameraPreview.jpg"> |
| |
| |
| <a name="androidCameraSequenceDiagramsTakePic"></a><h4>Taking a Picture</h4> |
| |
| <p>The following diagram illustrates the sequence of function calls and actions necessary for your camera to take a picture.</p> |
| <img src="images/cameraTakePicture.jpg"> |
| |
| |
| <a name="androidCameraInterfaceIntro"></a><h3>Interface</h3> |
| |
| |
| |
| <p class="note"><strong>Note</strong>: This document relies on some Doxygen-generated content that appears in an iFrame below. To return to the Doxygen default content for this page, <a href="camera.html">click here</a>.</p> |
| |
| |
| <iframe onLoad="resizeDoxFrameHeight();" src="CameraHardwareInterface_8h.html" scrolling="no" scroll="no" id="doxygen" marginwidth="0" marginheight="0" frameborder="0" style="width:100%;"></iframe> |