blob: 578bdf5cd5dda3e74795137cba8c5589a6b72f8f [file] [log] [blame]
Eino-Ville Talvalab2675542012-12-12 13:29:45 -08001<!-- Copyright (C) 2013 The Android Open Source Project
2
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6
7 http://www.apache.org/licenses/LICENSE-2.0
8
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14-->
15<HTML>
16<BODY>
17<p>The android.hardware.photography package provides an interface to
18individual camera devices connected to an Android device. It replaces
19the deprecated {@link android.hardware.Camera} class.</p>
20
21<p>This package models a camera device as a pipeline, which takes in
22input requests for capturing a single frame, captures the single image
23per the request, and then outputs one capture result metadata packet,
24plus a set of output image buffers for the request. The requests are
25processed in-order, and multiple requests can be in flight at
26once. Since the camera device is a pipeline with multiple stages,
27having multiple requests in flight is required to maintain full
28framerate on most Android devices.</p>
29
30<p>To enumerate, query, and open available camera devices, obtain a
31{@link android.hardware.photography.CameraManager} instance.</p>
32
33<p>Individual {@link android.hardware.photography.CameraDevice
34CameraDevices} provide a set of static property information that
35describes the hardware device and the available settings and output
36parameters for the device. This information is provided through the
37{@link android.hardware.photography.CameraProperties} object.</p>
38
39<p>To capture or stream images from a camera device, the application
40must first configure a set of output Surfaces for use with the camera
41device, with {@link
42android.hardware.photography.CameraDevice#configureOutputs}. Each
43Surface has to be pre-configured with an appropriate size and format
44(if applicable) to match the sizes and formats available from the
45camera device. A target Surface can be obtained from a variety of
46classes, including {@link android.view.SurfaceView}, {@link
47android.graphics.SurfaceTexture} via {@link
48android.view.Surface#Surface(SurfaceTexture), {@link
49android.media.MediaCodec}, and {@link android.media.ImageReader}.
50</p>
51
52<p>The application then needs to construct a {@link
53android.hardware.photography.CaptureRequest}, which defines all the
54capture parameters needed by a camera device to capture a single
55image. The request also lists which of the configured output Surfaces
56should be used as targets for this capture. The CameraDevice has a
57{@link android.hardware.photography.CameraDevice#createCaptureRequest
58convenience factory method} for creating a request for a given use
59case which is optimized for the Android device the application is
60running on.</p>
61
62<p>Once the request has been set up, it can be handed to the
63CameraDevice either for a one-shot {@link
64android.hardware.photography.CameraDevice#capture} or for an endlessly
65{@link android.hardware.photography.CameraDevice#setRepeatingRequest
66repeating} use. Both methods also accept a list of requests to use as
67a burst capture / repeating burst. Repeating requests have a lower
68priority than captures, so a request submitted
69through <code>capture()</code> while there's a repeating request
70configured will be captured as soon as the current repeat (burst)
71capture completes.</p>
72
73<p>After processing a request, the camera device will produce a {@link
74android.hardware.photography.CaptureResult} object, which contains
75information about the state of the camera device at time of capture,
76and the final settings used. These may vary somewhat from the request,
77if rounding or resolving contradictory parameters was necessary. The
78camera device will also send a frame of image data into each of the
79output streams included in the request. These are produced
80asynchronously relative to the output CaptureResult, sometimes
81substantially later.</p>
82
83</BODY>
84</HTML>