blob: 204c0702b92f82ddb5cfc604195266df243a797d [file] [log] [blame]
David Warren5f6ca4f2009-04-30 17:11:58 -07001page.title=Camera
2pdk.version=1.0
3@jd:body
4
5<a name="toc"/>
6<div style="padding:10px">
7<a href="#androidCameraIntroduction">Introduction</a><br/>
8<a href="#androidCameraBuildingDriver">Building a Camera Library</a><br/>
9<a href="#androidCameraSequenceDiagrams">Sequence Diagrams</a><br/><div style="padding-left:40px">
10
11<a href="#androidCameraSequenceDiagramsPreview">Preview</a><br/>
12<a href="#androidCameraSequenceDiagramsTakePic">Taking a Picture</a><br/></div>
13<a href="#androidCameraInterfaceIntro">Interface</a><br/></div></font></div>
14
15<a name="androidCameraIntroduction"></a><h2>Introduction</h2>
16
17<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>
18<p>The diagram below illustrates the structure of the camera subsystem.</p>
19<p><img src="images/androidCameraArchitecture.gif"></p>
20
21
22<a name="androidCameraBuildingDriver"></a><h2>Building a Camera Library</h2>
23
24<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>
25<p>The following stub <code>Android.mk</code> file ensures that <code>libcamera</code> compiles and links to the appropriate libraries:</p>
26<pre class="prettify">
27LOCAL_PATH := $(call my-dir)
28include $(CLEAR_VARS)
29
30LOCAL_MODULE := libcamera
31
32LOCAL_SHARED_LIBRARIES := \
33 libutils \
34 librpc \
35 liblog
36
37LOCAL_SRC_FILES += MyCameraHardware.cpp
38
39LOCAL_CFLAGS +=
40
41LOCAL_C_INCLUDES +=
42
43LOCAL_STATIC_LIBRARIES += \
44 libcamera-common \
45 libclock-rpc \
46 libcommondefs-rpc
47
48include $(BUILD_SHARED_LIBRARY)
49</pre>
50
51
52<a name="androidCameraSequenceDiagrams"></a><h2>Sequence Diagrams</h2>
53
54
55
56<a name="androidCameraSequenceDiagramsPreview"></a><h3>Preview</h3>
57
58<p>The following diagram illustrates the sequence of function calls and actions necessary for your camera to preview.</p>
59<img src="images/cameraPreview.jpg">
60
61
62<a name="androidCameraSequenceDiagramsTakePic"></a><h3>Taking a Picture</h3>
63
64<p>The following diagram illustrates the sequence of function calls and actions necessary for your camera to take a picture.</p>
65<img src="images/cameraTakePicture.jpg">
66
67
68<a name="androidCameraInterfaceIntro"></a><h2>Interface</h2>
69
70
71
72<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>
73
74
75<iframe onLoad="resizeDoxFrameHeight();" src="CameraHardwareInterface_8h.html" scrolling="no" scroll="no" id="doxygen" marginwidth="0" marginheight="0" frameborder="0" style="width:100%;"></iframe>