The Android Open Source Project | e943f2f | 2008-12-17 18:04:04 -0800 | [diff] [blame^] | 1 | |
| 2 | <html> |
| 3 | <head> |
| 4 | <meta http-equiv="content-type" content="text/html; charset=utf-8"/> |
| 5 | <title>Android - Porting Guide</title> |
| 6 | <script src="http://www.google.com/uds/api?file=uds.js&v=1.0&key=internal-codesite" type="text/javascript"></script> |
| 7 | <script src="http://code.google.com/js/jquery.js" type="text/javascript"></script> |
| 8 | <script type="text/javascript">var _tocPath_ = 'http://code.google.com/android/_toc.ezt';</script> |
| 9 | <script src="http://code.google.com/js/codesite.pack.01312008.js" type="text/javascript"></script> |
| 10 | <script language="JavaScript"> |
| 11 | function resizeHeight() { |
| 12 | if(document.getElementById && !(document.all)) { |
| 13 | height= document.getElementById('doxygen').contentDocument.body.scrollHeight + 20; |
| 14 | document.getElementById('doxygen').style.height = height; |
| 15 | } |
| 16 | else if(document.all) { |
| 17 | height= document.frames('doxygen').document.body.scrollHeight + 20; |
| 18 | document.all.doxygen.style.height = height; |
| 19 | } |
| 20 | } |
| 21 | </script> |
| 22 | <link href="http://code.google.com/css/codesite.pack.01312008.css" type="text/css" rel="stylesheet"> |
| 23 | </link> |
| 24 | |
| 25 | <!--[if IE]><link rel="stylesheet" type="text/css" href="/css/iehacks.css" /><![endif]--> |
| 26 | <script src="http://code.google.com/android/assets/search_autocomplete.js"></script> |
| 27 | <link rel="stylesheet" type="text/css" href="http://code.google.com/css/semantic_headers.css" /> |
| 28 | <link rel="stylesheet" type="text/css" href="http://code.google.com/android/assets/style.css" /> |
| 29 | <script> |
| 30 | jQuery(document).ready(function() { |
| 31 | jQuery("pre").addClass("prettyprint"); |
| 32 | }); |
| 33 | </script> |
| 34 | <style type="text/css"> |
| 35 | <!-- |
| 36 | h1,h2,h3 { |
| 37 | color: #000000; |
| 38 | } |
| 39 | --> |
| 40 | </style> |
| 41 | </head> |
| 42 | <body class="gc-documentation"> |
| 43 | <div id="gc-container"> |
| 44 | <a name="top"></a> |
| 45 | <div id="skipto"> </div> |
| 46 | <div id="langpref"> |
| 47 | <!--<a class="dropdown" href="/">English</a> <span>|</span> <a href="/more/">Site Directory</a> --> |
| 48 | |
| 49 | </div> |
| 50 | <div id="gc-header"> |
| 51 | <div id="logo"><a href="http://code.google.com/android/index.html"><img src="http://code.google.com/android/images/logo_android.gif" alt="Android"/></a></div> |
| 52 | <div id="search" style="inline"> |
| 53 | <div id="searchForm" class="searchForm" style="height: 44px;"> |
| 54 | <!--previously form was here--> |
| 55 | </div> |
| 56 | <!-- end searchForm --> |
| 57 | <noscript> |
| 58 | <style type="text/css"> |
| 59 | .searchForm { |
| 60 | display : none !important; |
| 61 | } |
| 62 | .searchForm2 { |
| 63 | display : inline !important; |
| 64 | } |
| 65 | </style> |
| 66 | </noscript> |
| 67 | |
| 68 | <div id="searchForm2" class="searchForm2" style="display:none"> |
| 69 | <form id="searchbox_001456098540849067467:6whlsytkdqg" action="http://www.google.com/cse"> |
| 70 | <input type="hidden" name="cx" value="001456098540849067467:6whlsytkdqg" /> |
| 71 | <input type="hidden" name="cof" value="FORID:0" /> |
| 72 | <input type="text" name="q" maxlength="2048" size="41" autocomplete="off" title="Google Code Search"/> |
| 73 | <input type="submit" name="sa" value="Search" title="Search"/> |
| 74 | <br/> |
| 75 | <div class="greytext">e.g. "ajax apis" or "open source"</div> |
| 76 | |
| 77 | </form> |
| 78 | </div> |
| 79 | <!-- end searchForm2 --> |
| 80 | </div> |
| 81 | <!-- end search --> |
| 82 | </div> |
| 83 | <!-- end gc-header --> |
| 84 | <div id="searchControl" class="search-control"></div> |
| 85 | <!--[if IE]><iframe id="backiFrame" name="backiFrame" src='/dummy.html' style="display:none"></iframe><![endif]--> |
| 86 | <div id="codesiteContent"> |
| 87 | <a name="gc-topnav-anchor"></a> |
| 88 | <div id="gc-topnav"> |
| 89 | |
| 90 | <h1>Android Platform Development Kit</h1> |
| 91 | <ul class="gc-topnav-tabs"> |
| 92 | <li id="sdk_link"> <a href="http://code.google.com/android/index.html" title="Android Software Development Kit">SDK</a> </li> |
| 93 | <li id="docs_link"> <a href="index.html" title="Official Android documentation">Docs</a> </li> |
| 94 | <li id="faq_link"> <a href="http://code.google.com/android/kb/index.html" title="Answers to frequently asked questions about Android">FAQ</a> </li> |
| 95 | |
| 96 | <li> <a href="http://android-developers.blogspot.com/" title="Official Android blog">Blog</a> </li> |
| 97 | <li> <a href="http://code.google.com/android/groups.html" title="Android developer forum">Group</a> </li> |
| 98 | <li> <a href="http://code.google.com/android/terms.html" title="Android terms of service">Terms</a> </li> |
| 99 | <li> <a href="mailto:android-pdk-feedback@google.com?subject=PDK%20Feedback&body=(filed%20from:%20camera.html%20v0.6%20-%2025%20November%202008)%0D%0A%0D%0ASUMMARY:%0D%0A%0D%0A%0D%0A%0D%0ASTEPS%20TO%20REPRODUCE:%0D%0A%0D%0A%0D%0A%0D%0AADDITIONAL%20NOTES:">Report a Problem</a> </li> |
| 100 | |
| 101 | </ul> |
| 102 | </div> |
| 103 | <!-- end gc-topnav --> |
| 104 | <div class="g-section g-tpl-180"> |
| 105 | <a name="gc-toc"></a> |
| 106 | <div class="g-unit g-first" id="gc-toc"> |
| 107 | <ul> |
| 108 | <li> |
| 109 | <h1><a href="index.html">Documentation</a></h1> |
| 110 | <ul> |
| 111 | <li> <strong>Introduction</strong> |
| 112 | |
| 113 | <ul> |
| 114 | <li><a href="system_requirements.html">Device Requirements</a></li> |
| 115 | </ul> |
| 116 | </li> |
| 117 | <li> <strong>Dev Environment Setup</strong> |
| 118 | <ul> |
| 119 | <li><a href="build_system.html">Build System</a></li> |
| 120 | </ul> |
| 121 | </li> |
| 122 | <li> <strong>Basic Bring up</strong> |
| 123 | |
| 124 | <ul> |
| 125 | <li><a href="build_new_device.html">Building New Device</a></li> |
| 126 | <li><a href="bring_up.html">Bring up</a></li> |
| 127 | <li><a href="keymaps_keyboard_input.html">Keymaps and Keyboard</a></li> |
| 128 | <li><a href="display_drivers.html">Display Drivers</a></li> |
| 129 | </ul> |
| 130 | </li> |
| 131 | |
| 132 | <li> <strong>Multimedia</strong> |
| 133 | <ul> |
| 134 | <li><a href="audio_sub_system.html">Audio</a></li> |
| 135 | <li><a href="camera.html">Camera</a></li> |
| 136 | </ul> |
| 137 | </li> |
| 138 | <li> <strong>Power Management</strong> |
| 139 | |
| 140 | <ul> |
| 141 | <li><a href="power_management.html">Power Management</a></li> |
| 142 | </ul> |
| 143 | </li> |
| 144 | |
| 145 | <li> <strong>Networking</strong> |
| 146 | <ul> |
| 147 | <li><a href="wifi.html">Wi-Fi</a></li> |
| 148 | <li><a href="gps.html">GPS</a></li> |
| 149 | <li><a href="bluetooth.html">Bluetooth</a></li> |
| 150 | </ul> |
| 151 | </li> |
| 152 | |
| 153 | <li> <strong>Telephony</strong> |
| 154 | <ul> |
| 155 | <li><a href="telephony.html">Radio Interface Layer</a></li> |
| 156 | |
| 157 | </ul> |
| 158 | </li> |
| 159 | <li> <strong>Testing</strong> |
| 160 | <ul> |
| 161 | <li><a href="instrumentation_testing.html">Instrumentation Testing</a></li> |
| 162 | </ul> |
| 163 | |
| 164 | </li> |
| 165 | </ul> |
| 166 | </li> |
| 167 | </ul> |
| 168 | </div> |
| 169 | <a name="gc-pagecontent"></a> |
| 170 | <div class="g-unit" id="gc-pagecontent"> |
| 171 | <div id="jd-content"> |
| 172 | <div class="jd-descr"> |
| 173 | |
| 174 | |
| 175 | <a name="androidCameraTitle"></a><h1>Camera Subsystem</h1> |
| 176 | |
| 177 | |
| 178 | |
| 179 | <a name="toc"/> |
| 180 | <div style="padding:10px"> |
| 181 | <a href="#androidCameraIntroduction">Introduction</a><br/> |
| 182 | <a href="#androidCameraBuildingDriver">Building a Camera Library</a><br/> |
| 183 | <a href="#androidCameraSequenceDiagrams">Sequence Diagrams</a><br/><div style="padding-left:40px"> |
| 184 | |
| 185 | <a href="#androidCameraSequenceDiagramsPreview">Preview</a><br/> |
| 186 | <a href="#androidCameraSequenceDiagramsTakePic">Taking a Picture</a><br/></div> |
| 187 | <a href="#androidCameraInterfaceIntro">Interface</a><br/></div></font></div> |
| 188 | |
| 189 | <a name="androidCameraIntroduction"></a><h2>Introduction</h2> |
| 190 | |
| 191 | <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> |
| 192 | <p>The diagram below illustrates the structure of the camera subsystem.</p> |
| 193 | <p><img src="androidCameraArchitecture.gif"></p> |
| 194 | |
| 195 | |
| 196 | <a name="androidCameraBuildingDriver"></a><h2>Building a Camera Library</h2> |
| 197 | |
| 198 | <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> |
| 199 | <p>The following stub <code>Android.mk</code> file ensures that <code>libcamera</code> compiles and links to the appropriate libraries:</p> |
| 200 | <pre class="prettify"> |
| 201 | LOCAL_PATH := $(call my-dir) |
| 202 | include $(CLEAR_VARS) |
| 203 | |
| 204 | LOCAL_MODULE := libcamera |
| 205 | |
| 206 | LOCAL_SHARED_LIBRARIES := \ |
| 207 | libutils \ |
| 208 | librpc \ |
| 209 | liblog |
| 210 | |
| 211 | LOCAL_SRC_FILES += MyCameraHardware.cpp |
| 212 | |
| 213 | LOCAL_CFLAGS += |
| 214 | |
| 215 | LOCAL_C_INCLUDES += |
| 216 | |
| 217 | LOCAL_STATIC_LIBRARIES += \ |
| 218 | libcamera-common \ |
| 219 | libclock-rpc \ |
| 220 | libcommondefs-rpc |
| 221 | |
| 222 | include $(BUILD_SHARED_LIBRARY) |
| 223 | </pre> |
| 224 | |
| 225 | |
| 226 | <a name="androidCameraSequenceDiagrams"></a><h2>Sequence Diagrams</h2> |
| 227 | |
| 228 | |
| 229 | |
| 230 | <a name="androidCameraSequenceDiagramsPreview"></a><h3>Preview</h3> |
| 231 | |
| 232 | <p>The following diagram illustrates the sequence of function calls and actions necessary for your camera to preview.</p> |
| 233 | <img src="cameraPreview.jpg"> |
| 234 | |
| 235 | |
| 236 | <a name="androidCameraSequenceDiagramsTakePic"></a><h3>Taking a Picture</h3> |
| 237 | |
| 238 | <p>The following diagram illustrates the sequence of function calls and actions necessary for your camera to take a picture.</p> |
| 239 | <img src="cameraTakePicture.jpg"> |
| 240 | |
| 241 | |
| 242 | <a name="androidCameraInterfaceIntro"></a><h2>Interface</h2> |
| 243 | |
| 244 | |
| 245 | |
| 246 | <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> |
| 247 | |
| 248 | |
| 249 | <iframe onLoad="resizeHeight();" src="_camera_hardware_interface_8h.html" scrolling="no" scroll="no" id="doxygen" marginwidth="0" marginheight="0" frameborder="0" style="width:100%;"></iframe> |
| 250 | |
| 251 | |
| 252 | <p><span class="lh2"><a name="androidFooter"></a></span> |
| 253 | |
| 254 | </div> |
| 255 | </div> |
| 256 | <!-- end gc-pagecontent --> |
| 257 | </div> |
| 258 | <!-- end gooey wrapper --> |
| 259 | </div> |
| 260 | <!-- end codesearchresults --> |
| 261 | <div id="gc-footer" dir="ltr"> |
| 262 | <div class="text"> ©2008 Google<!-- - <a href="/">Code Home</a> - <a href="http://www.google.com/accounts/TOS">Site Terms of Service</a> - <a href="http://www.google.com/privacy.html">Privacy Policy</a> - <a href="/more">Site Directory</a> --></div> |
| 263 | </div> |
| 264 | <!-- end gc-footer --> |
| 265 | </div> |
| 266 | <!-- end gc-containter --> |
| 267 | <script src="http://www.google-analytics.com/ga.js" type="text/javascript"> |
| 268 | </script> |
| 269 | <script type="text/javascript"> |
| 270 | try { |
| 271 | var pageTracker = _gat._getTracker("UA-18071-1"); |
| 272 | pageTracker._setAllowAnchor(true); |
| 273 | pageTracker._initData(); |
| 274 | pageTracker._trackPageview(); |
| 275 | } catch(e) {} |
| 276 | </script> |
| 277 | <div id="jd-build-id"> v0.6 - 25 November 2008</div> |
| 278 | </div></div></div></body> |
| 279 | </html> |
| 280 | |