blob: 4c9b51726593c8ef7ceb3649b664bfc4c8d9c898 [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;
Yin-Chia Yehc25c54f2017-04-04 13:00:35 -070020import android.hardware.graphics.allocator@2.0::types;
Zhijun He8486e412016-09-12 15:30:51 -070021import 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.
Yin-Chia Yeh248ed702017-01-23 17:27:26 -080033 * @return bufferId A unique ID for the returned buffer.
34 * @return buffer A handle to the buffer to write into. Must be non-null if the bufferId has not
35 * been seen by HAL before. Must be null if the bufferId is seen before. HAL must keep track
36 * of the bufferId to actual buffer handle mapping.
Zhijun He8486e412016-09-12 15:30:51 -070037 * @return stride The stride between two rows of pixels in this buffer.
38 */
Yin-Chia Yeh248ed702017-01-23 17:27:26 -080039 dequeueBuffer() generates (Status status, uint64_t bufferId, handle buffer, uint32_t stride);
Zhijun He8486e412016-09-12 15:30:51 -070040
41 /**
42 * Send a filled preview buffer to its consumer.
43 *
Yin-Chia Yeh248ed702017-01-23 17:27:26 -080044 * @param bufferId The bufferId of the preview buffer
Zhijun He8486e412016-09-12 15:30:51 -070045 * @return status The status code for this operation.
46 */
Yin-Chia Yeh248ed702017-01-23 17:27:26 -080047 enqueueBuffer(uint64_t bufferId) generates (Status status);
Zhijun He8486e412016-09-12 15:30:51 -070048
49 /**
50 * Return a preview buffer unfilled. This buffer must not be sent on to the
51 * preview consumer as a valid buffer, but may be reused as if it were
52 * empty.
53 *
Yin-Chia Yeh248ed702017-01-23 17:27:26 -080054 * @param bufferId The bufferId of the preview buffer
Zhijun He8486e412016-09-12 15:30:51 -070055 * @return status The status code for this operation.
56 */
Yin-Chia Yeh248ed702017-01-23 17:27:26 -080057 cancelBuffer(uint64_t bufferId) generates (Status status);
Zhijun He8486e412016-09-12 15:30:51 -070058
59 /**
60 * Set the number of preview buffers needed by the HAL.
61 *
62 * @param count The maximum number of preview buffers to allocate.
63 * @return status The status code for this operation.
64 */
65 setBufferCount(uint32_t count) generates (Status status);
66
67 /**
68 * Set the dimensions and format of future preview buffers.
69 *
70 * The next buffer that is dequeued must match the requested size and
71 * format.
72 *
73 * @return Status The status code for this operation.
74 */
75 setBuffersGeometry(uint32_t w, uint32_t h,
76 android.hardware.graphics.common@1.0::PixelFormat format)
77 generates (Status status);
78
79 /**
80 * Set the valid region of image data for the next buffer(s) to be enqueued.
81 *
82 * @return Status The status code for this operation.
83 */
84 setCrop(int32_t left, int32_t top, int32_t right, int32_t bottom)
85 generates (Status status);
86
87 /**
88 * Set the producer usage flags for the next buffer(s) to be enqueued.
89 *
90 * @return Status The status code for this operation.
91 */
Yin-Chia Yehc25c54f2017-04-04 13:00:35 -070092 setUsage(ProducerUsage usage) generates (Status status);
Zhijun He8486e412016-09-12 15:30:51 -070093
94 /**
95 * Set the expected buffering mode for the preview output.
96 */
97 setSwapInterval(int32_t interval) generates (Status status);
98
99 /**
100 * Get the minimum number of buffers the preview consumer endpoint needs
101 * to hold for correct operation.
102 *
103 * @return Status The status code for this operation.
104 * @return count The number of buffers the consumer has requested.
105 */
106 getMinUndequeuedBufferCount() generates (Status status, uint32_t count);
107
108 /**
109 * Set the timestamp for the next buffer to enqueue
110 *
111 * Timestamps are measured in nanoseconds, and must be comparable
112 * and monotonically increasing between two frames in the same
113 * preview stream. They do not need to be comparable between
114 * consecutive or parallel preview streams, cameras, or app runs.
115 *
116 * @param timestamp The timestamp to set for future buffers.
117 * @return Status The status code for this operation.
118 */
119 setTimestamp(int64_t timestamp) generates (Status status);
120
121};