blob: cddb82c31f90da2d19d71a119c46444419531369 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Doxygen-Generated Content</title>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.navigation {
display: none;
}
-->
</style>
</head>
<body>
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
<li><a href="functions.html"><span>Data&nbsp;Fields</span></a></li>
</ul>
</div>
<div class="navpath"><a class="el" href="namespaceandroid.html">android</a>::<a class="el" href="classandroid_1_1_camera_hardware_interface.html">CameraHardwareInterface</a>
</div>
</div>
<div class="contents">
<h1>android::CameraHardwareInterface Class Reference</h1><!-- doxytag: class="android::CameraHardwareInterface" --><a class="el" href="_camera_hardware_interface_8h.html">CameraHardwareInterface.h</a> defines the interface to the camera hardware abstraction layer, used for setting and getting parameters, live previewing, and taking pictures.
<a href="#_details">More...</a>
<p>
<code>#include &lt;<a class="el" href="_camera_hardware_interface_8h-source.html">CameraHardwareInterface.h</a>&gt;</code>
<p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classandroid_1_1_camera_hardware_interface.html#99f4ab74b58cd4b23e0fb00a46a60cb1">~CameraHardwareInterface</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual sp&lt; IMemoryHeap &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classandroid_1_1_camera_hardware_interface.html#9d4071fb234a0c2e7bf6ea78e723f2f4">getPreviewHeap</a> () const =0</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return the IMemoryHeap for the preview image heap. <a href="#9d4071fb234a0c2e7bf6ea78e723f2f4"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual status_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classandroid_1_1_camera_hardware_interface.html#62def8031dee8bdab7933770708a6312">startPreview</a> (<a class="el" href="namespaceandroid.html#d32b08663d42356404e2eb971e271636">preview_callback</a> cb, void *user)=0</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Start preview mode. <a href="#62def8031dee8bdab7933770708a6312"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classandroid_1_1_camera_hardware_interface.html#34faa77065f415b93cb1acf84fc788bf">stopPreview</a> ()=0</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Stop a previously started preview. <a href="#34faa77065f415b93cb1acf84fc788bf"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual status_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classandroid_1_1_camera_hardware_interface.html#0dda73938e9b18326dd48bd721dbd515">autoFocus</a> (<a class="el" href="namespaceandroid.html#4dca8d8b824ca9a684358133da0ec8f2">autofocus_callback</a>, void *user)=0</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Start auto focus, the callback routine is called once when focusing is complete. <a href="#0dda73938e9b18326dd48bd721dbd515"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual status_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classandroid_1_1_camera_hardware_interface.html#2aedf65cad695ce439029f37a7cb66c4">takePicture</a> (<a class="el" href="namespaceandroid.html#04c83209c2627e2d303320712ca9ee65">shutter_callback</a>, <a class="el" href="namespaceandroid.html#a97926709e452d66360cb9b24736969e">raw_callback</a>, <a class="el" href="namespaceandroid.html#c21980d4be1e0cc458399ecf5374d473">jpeg_callback</a>, void *user)=0</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Take a picture. <a href="#2aedf65cad695ce439029f37a7cb66c4"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual status_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classandroid_1_1_camera_hardware_interface.html#da8faf376215a605357d26afa1b79386">cancelPicture</a> (bool cancel_shutter, bool cancel_raw, bool cancel_jpeg)=0</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Cancel a picture that was started with takePicture. <a href="#da8faf376215a605357d26afa1b79386"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual status_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classandroid_1_1_camera_hardware_interface.html#82e54ede14bd263274bbc8777bafc384">setParameters</a> (const CameraParameters &amp;params)=0</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the camera parameters. <a href="#82e54ede14bd263274bbc8777bafc384"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual CameraParameters&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classandroid_1_1_camera_hardware_interface.html#4c748a3c0aa3c5f2333e0abcdbeb15cb">getParameters</a> () const =0</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return the camera parameters. <a href="#4c748a3c0aa3c5f2333e0abcdbeb15cb"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classandroid_1_1_camera_hardware_interface.html#df65310b8aa176e0ce5f08b87d6b7eb8">release</a> ()=0</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Release the hardware resources owned by this object. <a href="#df65310b8aa176e0ce5f08b87d6b7eb8"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual status_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classandroid_1_1_camera_hardware_interface.html#06df1bf91b8af07964dca314a6031b32">dump</a> (int fd, const Vector&lt; String16 &gt; &amp;args) const =0</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Dump state of the camera hardware. <a href="#06df1bf91b8af07964dca314a6031b32"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
<a class="el" href="_camera_hardware_interface_8h.html">CameraHardwareInterface.h</a> defines the interface to the camera hardware abstraction layer, used for setting and getting parameters, live previewing, and taking pictures.
<p>
It is a referenced counted interface with RefBase as its base class. CameraService calls <a class="el" href="namespaceandroid.html#24c243f7f9ba0d1d881be17ae06254a2" title="factory function to instantiate a camera hardware object">openCameraHardware()</a> to retrieve a strong pointer to the instance of this interface and may be called multiple times. The following steps describe a typical sequence:<p>
<ol type=1>
<li>After CameraService calls <a class="el" href="namespaceandroid.html#24c243f7f9ba0d1d881be17ae06254a2" title="factory function to instantiate a camera hardware object">openCameraHardware()</a>, <a class="el" href="classandroid_1_1_camera_hardware_interface.html#4c748a3c0aa3c5f2333e0abcdbeb15cb" title="Return the camera parameters.">getParameters()</a> and <a class="el" href="classandroid_1_1_camera_hardware_interface.html#82e54ede14bd263274bbc8777bafc384" title="Set the camera parameters.">setParameters()</a> are used to initialize the camera instance. CameraService calls <a class="el" href="classandroid_1_1_camera_hardware_interface.html#9d4071fb234a0c2e7bf6ea78e723f2f4" title="Return the IMemoryHeap for the preview image heap.">getPreviewHeap()</a> to establish access to the preview heap so it can be registered with SurfaceFlinger for efficient display updating while in preview mode.</li><li><a class="el" href="classandroid_1_1_camera_hardware_interface.html#62def8031dee8bdab7933770708a6312" title="Start preview mode.">startPreview()</a> is called, which is passed a <a class="el" href="namespaceandroid.html#d32b08663d42356404e2eb971e271636" title="Callback for startPreview().">preview_callback()</a> function and a user parameter. The camera instance then periodically calls <a class="el" href="namespaceandroid.html#d32b08663d42356404e2eb971e271636" title="Callback for startPreview().">preview_callback()</a> each time a new preview frame is available. The callback routine has two parameters: the first is a pointer to the IMemory containing the frame and the second a user parameter. If the preview_callback code needs to use this memory after returning, it must copy the data.</li></ol>
<p>
Prior to taking a picture, CameraService calls autofocus() with <a class="el" href="namespaceandroid.html#4dca8d8b824ca9a684358133da0ec8f2" title="Callback for autoFocus().">autofocus_callback()</a> and a user parameter. When auto focusing has completed, the camera instance calls <a class="el" href="namespaceandroid.html#4dca8d8b824ca9a684358133da0ec8f2" title="Callback for autoFocus().">autofocus_callback()</a>, which informs the application whether focusing was successful. The camera instance only calls <a class="el" href="namespaceandroid.html#4dca8d8b824ca9a684358133da0ec8f2" title="Callback for autoFocus().">autofocus_callback()</a> once and it is up to the application to call <a class="el" href="classandroid_1_1_camera_hardware_interface.html#0dda73938e9b18326dd48bd721dbd515" title="Start auto focus, the callback routine is called once when focusing is complete.">autoFocus()</a> again if refocusing is desired.<p>
CameraService calls <a class="el" href="classandroid_1_1_camera_hardware_interface.html#2aedf65cad695ce439029f37a7cb66c4" title="Take a picture.">takePicture()</a> to request the camera instance take a picture. This method has two callbacks: <a class="el" href="namespaceandroid.html#a97926709e452d66360cb9b24736969e" title="Callback for takePicture().">raw_callback()</a> and <a class="el" href="namespaceandroid.html#c21980d4be1e0cc458399ecf5374d473" title="Callback for takePicture().">jpeg_callback()</a>. When the raw image is available, <a class="el" href="namespaceandroid.html#a97926709e452d66360cb9b24736969e" title="Callback for takePicture().">raw_callback()</a> is called with a pointer to the IMemory containing the raw image. When the jpeg image is available, <a class="el" href="namespaceandroid.html#c21980d4be1e0cc458399ecf5374d473" title="Callback for takePicture().">jpeg_callback()</a> is called with a pointer to the IMemory containing the jpeg image. As with <a class="el" href="namespaceandroid.html#d32b08663d42356404e2eb971e271636" title="Callback for startPreview().">preview_callback()</a>, the memory must be copied if it's needed after returning.
<p>Definition at line <a class="el" href="_camera_hardware_interface_8h-source.html#l00079">79</a> of file <a class="el" href="_camera_hardware_interface_8h-source.html">CameraHardwareInterface.h</a>.</p>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="99f4ab74b58cd4b23e0fb00a46a60cb1"></a><!-- doxytag: member="android::CameraHardwareInterface::~CameraHardwareInterface" ref="99f4ab74b58cd4b23e0fb00a46a60cb1" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual android::CameraHardwareInterface::~CameraHardwareInterface </td>
<td>(</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
<td><code> [inline, virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
<p>Definition at line <a class="el" href="_camera_hardware_interface_8h-source.html#l00081">81</a> of file <a class="el" href="_camera_hardware_interface_8h-source.html">CameraHardwareInterface.h</a>.</p>
</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="9d4071fb234a0c2e7bf6ea78e723f2f4"></a><!-- doxytag: member="android::CameraHardwareInterface::getPreviewHeap" ref="9d4071fb234a0c2e7bf6ea78e723f2f4" args="() const =0" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual sp&lt;IMemoryHeap&gt; android::CameraHardwareInterface::getPreviewHeap </td>
<td>(</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
<td> const<code> [pure virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Return the IMemoryHeap for the preview image heap.
<p>
</div>
</div><p>
<a class="anchor" name="62def8031dee8bdab7933770708a6312"></a><!-- doxytag: member="android::CameraHardwareInterface::startPreview" ref="62def8031dee8bdab7933770708a6312" args="(preview_callback cb, void *user)=0" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual status_t android::CameraHardwareInterface::startPreview </td>
<td>(</td>
<td class="paramtype"><a class="el" href="namespaceandroid.html#d32b08663d42356404e2eb971e271636">preview_callback</a>&nbsp;</td>
<td class="paramname"> <em>cb</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void *&nbsp;</td>
<td class="paramname"> <em>user</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td><code> [pure virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Start preview mode.
<p>
When a preview image is available preview_callback is called with the user parameter. The call back parameter may be null.
</div>
</div><p>
<a class="anchor" name="34faa77065f415b93cb1acf84fc788bf"></a><!-- doxytag: member="android::CameraHardwareInterface::stopPreview" ref="34faa77065f415b93cb1acf84fc788bf" args="()=0" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual void android::CameraHardwareInterface::stopPreview </td>
<td>(</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
<td><code> [pure virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Stop a previously started preview.
<p>
</div>
</div><p>
<a class="anchor" name="0dda73938e9b18326dd48bd721dbd515"></a><!-- doxytag: member="android::CameraHardwareInterface::autoFocus" ref="0dda73938e9b18326dd48bd721dbd515" args="(autofocus_callback, void *user)=0" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual status_t android::CameraHardwareInterface::autoFocus </td>
<td>(</td>
<td class="paramtype"><a class="el" href="namespaceandroid.html#4dca8d8b824ca9a684358133da0ec8f2">autofocus_callback</a>&nbsp;</td>
<td class="paramname">, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void *&nbsp;</td>
<td class="paramname"> <em>user</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td><code> [pure virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Start auto focus, the callback routine is called once when focusing is complete.
<p>
<a class="el" href="classandroid_1_1_camera_hardware_interface.html#0dda73938e9b18326dd48bd721dbd515" title="Start auto focus, the callback routine is called once when focusing is complete.">autoFocus()</a> will be called again if another auto focus is needed.
</div>
</div><p>
<a class="anchor" name="2aedf65cad695ce439029f37a7cb66c4"></a><!-- doxytag: member="android::CameraHardwareInterface::takePicture" ref="2aedf65cad695ce439029f37a7cb66c4" args="(shutter_callback, raw_callback, jpeg_callback, void *user)=0" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual status_t android::CameraHardwareInterface::takePicture </td>
<td>(</td>
<td class="paramtype"><a class="el" href="namespaceandroid.html#04c83209c2627e2d303320712ca9ee65">shutter_callback</a>&nbsp;</td>
<td class="paramname">, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="namespaceandroid.html#a97926709e452d66360cb9b24736969e">raw_callback</a>&nbsp;</td>
<td class="paramname">, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="namespaceandroid.html#c21980d4be1e0cc458399ecf5374d473">jpeg_callback</a>&nbsp;</td>
<td class="paramname">, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void *&nbsp;</td>
<td class="paramname"> <em>user</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td><code> [pure virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Take a picture.
<p>
The raw_callback is called when the uncompressed image is available. The jpeg_callback is called when the compressed image is available. These call backs may be null. The user parameter is passed to each of the call back routines.
</div>
</div><p>
<a class="anchor" name="da8faf376215a605357d26afa1b79386"></a><!-- doxytag: member="android::CameraHardwareInterface::cancelPicture" ref="da8faf376215a605357d26afa1b79386" args="(bool cancel_shutter, bool cancel_raw, bool cancel_jpeg)=0" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual status_t android::CameraHardwareInterface::cancelPicture </td>
<td>(</td>
<td class="paramtype">bool&nbsp;</td>
<td class="paramname"> <em>cancel_shutter</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool&nbsp;</td>
<td class="paramname"> <em>cancel_raw</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool&nbsp;</td>
<td class="paramname"> <em>cancel_jpeg</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td><code> [pure virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Cancel a picture that was started with takePicture.
<p>
You may cancel any of the shutter, raw, or jpeg callbacks. Calling this method when no picture is being taken is a no-op.
</div>
</div><p>
<a class="anchor" name="82e54ede14bd263274bbc8777bafc384"></a><!-- doxytag: member="android::CameraHardwareInterface::setParameters" ref="82e54ede14bd263274bbc8777bafc384" args="(const CameraParameters &amp;params)=0" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual status_t android::CameraHardwareInterface::setParameters </td>
<td>(</td>
<td class="paramtype">const CameraParameters &amp;&nbsp;</td>
<td class="paramname"> <em>params</em> </td>
<td>&nbsp;)&nbsp;</td>
<td><code> [pure virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Set the camera parameters.
<p>
</div>
</div><p>
<a class="anchor" name="4c748a3c0aa3c5f2333e0abcdbeb15cb"></a><!-- doxytag: member="android::CameraHardwareInterface::getParameters" ref="4c748a3c0aa3c5f2333e0abcdbeb15cb" args="() const =0" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual CameraParameters android::CameraHardwareInterface::getParameters </td>
<td>(</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
<td> const<code> [pure virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Return the camera parameters.
<p>
</div>
</div><p>
<a class="anchor" name="df65310b8aa176e0ce5f08b87d6b7eb8"></a><!-- doxytag: member="android::CameraHardwareInterface::release" ref="df65310b8aa176e0ce5f08b87d6b7eb8" args="()=0" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual void android::CameraHardwareInterface::release </td>
<td>(</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
<td><code> [pure virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Release the hardware resources owned by this object.
<p>
Note that this is *not* done in the destructor.
</div>
</div><p>
<a class="anchor" name="06df1bf91b8af07964dca314a6031b32"></a><!-- doxytag: member="android::CameraHardwareInterface::dump" ref="06df1bf91b8af07964dca314a6031b32" args="(int fd, const Vector&lt; String16 &gt; &amp;args) const =0" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual status_t android::CameraHardwareInterface::dump </td>
<td>(</td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"> <em>fd</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const Vector&lt; String16 &gt; &amp;&nbsp;</td>
<td class="paramname"> <em>args</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td> const<code> [pure virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Dump state of the camera hardware.
<p>
</div>
</div><p>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="_camera_hardware_interface_8h-source.html">CameraHardwareInterface.h</a></ul>
</div>
</body>
</html>