blob: ebc74604b6ac8cf68b2408aecd2f08805b0d4780 [file] [log] [blame]
Zhijun He8486e412016-09-12 15:30:51 -07001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.hardware.camera.device@1.0;
18
19import android.hardware.camera.common@1.0::types;
20import android.hardware.graphics.allocator@2.0::types;
21import android.hardware.graphics.common@1.0::types;
22
23/**
24 * Camera device HAL@1.0 preview stream operation interface.
25 */
26interface ICameraDevicePreviewCallback {
27
28 /**
29 * Acquire a buffer to write a preview buffer into.
30 *
31 * @return status The status code for this operation. If not OK, then
32 * buffer and stride must not be used.
33 * @return buffer A handle to the buffer to write into.
34 * @return stride The stride between two rows of pixels in this buffer.
35 */
36 dequeueBuffer() generates (Status status, handle buffer, uint32_t stride);
37
38 /**
39 * Send a filled preview buffer to its consumer.
40 *
41 * @param buffer The handle to the preview buffer that's been filled.
42 * @return status The status code for this operation.
43 */
44 enqueueBuffer(handle buffer) generates (Status status);
45
46 /**
47 * Return a preview buffer unfilled. This buffer must not be sent on to the
48 * preview consumer as a valid buffer, but may be reused as if it were
49 * empty.
50 *
51 * @param buffer The handle to the preview buffer to return.
52 * @return status The status code for this operation.
53 */
54 cancelBuffer(handle buffer) generates (Status status);
55
56 /**
57 * Set the number of preview buffers needed by the HAL.
58 *
59 * @param count The maximum number of preview buffers to allocate.
60 * @return status The status code for this operation.
61 */
62 setBufferCount(uint32_t count) generates (Status status);
63
64 /**
65 * Set the dimensions and format of future preview buffers.
66 *
67 * The next buffer that is dequeued must match the requested size and
68 * format.
69 *
70 * @return Status The status code for this operation.
71 */
72 setBuffersGeometry(uint32_t w, uint32_t h,
73 android.hardware.graphics.common@1.0::PixelFormat format)
74 generates (Status status);
75
76 /**
77 * Set the valid region of image data for the next buffer(s) to be enqueued.
78 *
79 * @return Status The status code for this operation.
80 */
81 setCrop(int32_t left, int32_t top, int32_t right, int32_t bottom)
82 generates (Status status);
83
84 /**
85 * Set the producer usage flags for the next buffer(s) to be enqueued.
86 *
87 * @return Status The status code for this operation.
88 */
89 setUsage(ProducerUsage usage) generates (Status status);
90
91 /**
92 * Set the expected buffering mode for the preview output.
93 */
94 setSwapInterval(int32_t interval) generates (Status status);
95
96 /**
97 * Get the minimum number of buffers the preview consumer endpoint needs
98 * to hold for correct operation.
99 *
100 * @return Status The status code for this operation.
101 * @return count The number of buffers the consumer has requested.
102 */
103 getMinUndequeuedBufferCount() generates (Status status, uint32_t count);
104
105 /**
106 * Set the timestamp for the next buffer to enqueue
107 *
108 * Timestamps are measured in nanoseconds, and must be comparable
109 * and monotonically increasing between two frames in the same
110 * preview stream. They do not need to be comparable between
111 * consecutive or parallel preview streams, cameras, or app runs.
112 *
113 * @param timestamp The timestamp to set for future buffers.
114 * @return Status The status code for this operation.
115 */
116 setTimestamp(int64_t timestamp) generates (Status status);
117
118};