Zhijun He | 8486e41 | 2016-09-12 15:30:51 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package android.hardware.camera.device@1.0; |
| 18 | |
| 19 | import android.hardware.camera.common@1.0::types; |
Yin-Chia Yeh | c25c54f | 2017-04-04 13:00:35 -0700 | [diff] [blame] | 20 | import android.hardware.graphics.allocator@2.0::types; |
Zhijun He | 8486e41 | 2016-09-12 15:30:51 -0700 | [diff] [blame] | 21 | import android.hardware.graphics.common@1.0::types; |
| 22 | |
| 23 | /** |
| 24 | * Camera device HAL@1.0 preview stream operation interface. |
| 25 | */ |
| 26 | interface 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 Yeh | 248ed70 | 2017-01-23 17:27:26 -0800 | [diff] [blame] | 33 | * @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 He | 8486e41 | 2016-09-12 15:30:51 -0700 | [diff] [blame] | 37 | * @return stride The stride between two rows of pixels in this buffer. |
| 38 | */ |
Yin-Chia Yeh | 248ed70 | 2017-01-23 17:27:26 -0800 | [diff] [blame] | 39 | dequeueBuffer() generates (Status status, uint64_t bufferId, handle buffer, uint32_t stride); |
Zhijun He | 8486e41 | 2016-09-12 15:30:51 -0700 | [diff] [blame] | 40 | |
| 41 | /** |
| 42 | * Send a filled preview buffer to its consumer. |
| 43 | * |
Yin-Chia Yeh | 248ed70 | 2017-01-23 17:27:26 -0800 | [diff] [blame] | 44 | * @param bufferId The bufferId of the preview buffer |
Zhijun He | 8486e41 | 2016-09-12 15:30:51 -0700 | [diff] [blame] | 45 | * @return status The status code for this operation. |
| 46 | */ |
Yin-Chia Yeh | 248ed70 | 2017-01-23 17:27:26 -0800 | [diff] [blame] | 47 | enqueueBuffer(uint64_t bufferId) generates (Status status); |
Zhijun He | 8486e41 | 2016-09-12 15:30:51 -0700 | [diff] [blame] | 48 | |
| 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 Yeh | 248ed70 | 2017-01-23 17:27:26 -0800 | [diff] [blame] | 54 | * @param bufferId The bufferId of the preview buffer |
Zhijun He | 8486e41 | 2016-09-12 15:30:51 -0700 | [diff] [blame] | 55 | * @return status The status code for this operation. |
| 56 | */ |
Yin-Chia Yeh | 248ed70 | 2017-01-23 17:27:26 -0800 | [diff] [blame] | 57 | cancelBuffer(uint64_t bufferId) generates (Status status); |
Zhijun He | 8486e41 | 2016-09-12 15:30:51 -0700 | [diff] [blame] | 58 | |
| 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 Yeh | c25c54f | 2017-04-04 13:00:35 -0700 | [diff] [blame] | 92 | setUsage(ProducerUsage usage) generates (Status status); |
Zhijun He | 8486e41 | 2016-09-12 15:30:51 -0700 | [diff] [blame] | 93 | |
| 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 | }; |