blob: 204c0702b92f82ddb5cfc604195266df243a797d [file] [log] [blame]
page.title=Camera
pdk.version=1.0
@jd:body
<a name="toc"/>
<div style="padding:10px">
<a href="#androidCameraIntroduction">Introduction</a><br/>
<a href="#androidCameraBuildingDriver">Building a Camera Library</a><br/>
<a href="#androidCameraSequenceDiagrams">Sequence Diagrams</a><br/><div style="padding-left:40px">
<a href="#androidCameraSequenceDiagramsPreview">Preview</a><br/>
<a href="#androidCameraSequenceDiagramsTakePic">Taking a Picture</a><br/></div>
<a href="#androidCameraInterfaceIntro">Interface</a><br/></div></font></div>
<a name="androidCameraIntroduction"></a><h2>Introduction</h2>
<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/androidCameraArchitecture.gif"></p>
<a name="androidCameraBuildingDriver"></a><h2>Building a Camera Library</h2>
<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>partner/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><h2>Sequence Diagrams</h2>
<a name="androidCameraSequenceDiagramsPreview"></a><h3>Preview</h3>
<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><h3>Taking a Picture</h3>
<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><h2>Interface</h2>
<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>