Eino-Ville Talvala | 7fa43f3 | 2013-02-06 17:20:07 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013 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 | #ifndef ANDROID_SERVERS_CAMERA_CAMERADEVICEBASE_H |
| 18 | #define ANDROID_SERVERS_CAMERA_CAMERADEVICEBASE_H |
| 19 | |
| 20 | #include <utils/RefBase.h> |
| 21 | #include <utils/String8.h> |
| 22 | #include <utils/String16.h> |
| 23 | #include <utils/Vector.h> |
| 24 | #include <utils/Timers.h> |
Jianing Wei | 90e59c9 | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 25 | #include <utils/List.h> |
Eino-Ville Talvala | 7fa43f3 | 2013-02-06 17:20:07 -0800 | [diff] [blame] | 26 | |
| 27 | #include "hardware/camera2.h" |
Zhijun He | 0ea8fa4 | 2014-07-07 17:05:38 -0700 | [diff] [blame] | 28 | #include "hardware/camera3.h" |
Eino-Ville Talvala | 7fa43f3 | 2013-02-06 17:20:07 -0800 | [diff] [blame] | 29 | #include "camera/CameraMetadata.h" |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 30 | #include "camera/CaptureResult.h" |
Yin-Chia Yeh | e074a93 | 2015-01-30 10:29:02 -0800 | [diff] [blame] | 31 | #include "common/CameraModule.h" |
Chien-Yu Chen | 618ff8a | 2015-03-13 11:27:17 -0700 | [diff] [blame] | 32 | #include "gui/IGraphicBufferProducer.h" |
Zhijun He | 125684a | 2015-12-26 15:07:30 -0800 | [diff] [blame] | 33 | #include "device3/Camera3StreamInterface.h" |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 34 | #include "binder/Status.h" |
Eino-Ville Talvala | 7fa43f3 | 2013-02-06 17:20:07 -0800 | [diff] [blame] | 35 | |
| 36 | namespace android { |
| 37 | |
Eino-Ville Talvala | 2f09bac | 2016-12-13 11:29:54 -0800 | [diff] [blame] | 38 | class CameraProviderManager; |
| 39 | |
Eino-Ville Talvala | 7fa43f3 | 2013-02-06 17:20:07 -0800 | [diff] [blame] | 40 | /** |
| 41 | * Base interface for version >= 2 camera device classes, which interface to |
| 42 | * camera HAL device versions >= 2. |
| 43 | */ |
| 44 | class CameraDeviceBase : public virtual RefBase { |
| 45 | public: |
| 46 | virtual ~CameraDeviceBase(); |
| 47 | |
Igor Murashkin | 7138105 | 2013-03-04 14:53:08 -0800 | [diff] [blame] | 48 | /** |
| 49 | * The device's camera ID |
| 50 | */ |
Eino-Ville Talvala | 0b1cb14 | 2016-12-19 16:29:17 -0800 | [diff] [blame] | 51 | virtual const String8& getId() const = 0; |
Igor Murashkin | 7138105 | 2013-03-04 14:53:08 -0800 | [diff] [blame] | 52 | |
Yin-Chia Yeh | e074a93 | 2015-01-30 10:29:02 -0800 | [diff] [blame] | 53 | virtual status_t initialize(CameraModule *module) = 0; |
Eino-Ville Talvala | 2f09bac | 2016-12-13 11:29:54 -0800 | [diff] [blame] | 54 | virtual status_t initialize(sp<CameraProviderManager> manager) = 0; |
Eino-Ville Talvala | 7fa43f3 | 2013-02-06 17:20:07 -0800 | [diff] [blame] | 55 | virtual status_t disconnect() = 0; |
| 56 | |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 57 | virtual status_t dump(int fd, const Vector<String16> &args) = 0; |
Eino-Ville Talvala | 7fa43f3 | 2013-02-06 17:20:07 -0800 | [diff] [blame] | 58 | |
| 59 | /** |
| 60 | * The device's static characteristics metadata buffer |
| 61 | */ |
| 62 | virtual const CameraMetadata& info() const = 0; |
| 63 | |
| 64 | /** |
| 65 | * Submit request for capture. The CameraDevice takes ownership of the |
| 66 | * passed-in buffer. |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 67 | * Output lastFrameNumber is the expected frame number of this request. |
Eino-Ville Talvala | 7fa43f3 | 2013-02-06 17:20:07 -0800 | [diff] [blame] | 68 | */ |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 69 | virtual status_t capture(CameraMetadata &request, int64_t *lastFrameNumber = NULL) = 0; |
Eino-Ville Talvala | 7fa43f3 | 2013-02-06 17:20:07 -0800 | [diff] [blame] | 70 | |
| 71 | /** |
Jianing Wei | 90e59c9 | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 72 | * Submit a list of requests. |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 73 | * Output lastFrameNumber is the expected last frame number of the list of requests. |
Jianing Wei | 90e59c9 | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 74 | */ |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 75 | virtual status_t captureList(const List<const CameraMetadata> &requests, |
| 76 | int64_t *lastFrameNumber = NULL) = 0; |
Jianing Wei | 90e59c9 | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 77 | |
| 78 | /** |
Eino-Ville Talvala | 7fa43f3 | 2013-02-06 17:20:07 -0800 | [diff] [blame] | 79 | * Submit request for streaming. The CameraDevice makes a copy of the |
| 80 | * passed-in buffer and the caller retains ownership. |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 81 | * Output lastFrameNumber is the last frame number of the previous streaming request. |
Eino-Ville Talvala | 7fa43f3 | 2013-02-06 17:20:07 -0800 | [diff] [blame] | 82 | */ |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 83 | virtual status_t setStreamingRequest(const CameraMetadata &request, |
| 84 | int64_t *lastFrameNumber = NULL) = 0; |
Eino-Ville Talvala | 7fa43f3 | 2013-02-06 17:20:07 -0800 | [diff] [blame] | 85 | |
| 86 | /** |
Jianing Wei | 90e59c9 | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 87 | * Submit a list of requests for streaming. |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 88 | * Output lastFrameNumber is the last frame number of the previous streaming request. |
Jianing Wei | 90e59c9 | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 89 | */ |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 90 | virtual status_t setStreamingRequestList(const List<const CameraMetadata> &requests, |
| 91 | int64_t *lastFrameNumber = NULL) = 0; |
Jianing Wei | 90e59c9 | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 92 | |
| 93 | /** |
Eino-Ville Talvala | 7fa43f3 | 2013-02-06 17:20:07 -0800 | [diff] [blame] | 94 | * Clear the streaming request slot. |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 95 | * Output lastFrameNumber is the last frame number of the previous streaming request. |
Eino-Ville Talvala | 7fa43f3 | 2013-02-06 17:20:07 -0800 | [diff] [blame] | 96 | */ |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 97 | virtual status_t clearStreamingRequest(int64_t *lastFrameNumber = NULL) = 0; |
Eino-Ville Talvala | 7fa43f3 | 2013-02-06 17:20:07 -0800 | [diff] [blame] | 98 | |
| 99 | /** |
| 100 | * Wait until a request with the given ID has been dequeued by the |
| 101 | * HAL. Returns TIMED_OUT if the timeout duration is reached. Returns |
| 102 | * immediately if the latest request received by the HAL has this id. |
| 103 | */ |
| 104 | virtual status_t waitUntilRequestReceived(int32_t requestId, |
| 105 | nsecs_t timeout) = 0; |
| 106 | |
| 107 | /** |
Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 108 | * Create an output stream of the requested size, format, rotation and dataspace |
Eino-Ville Talvala | 7fa43f3 | 2013-02-06 17:20:07 -0800 | [diff] [blame] | 109 | * |
Eino-Ville Talvala | 3d82c0d | 2015-02-23 15:19:19 -0800 | [diff] [blame] | 110 | * For HAL_PIXEL_FORMAT_BLOB formats, the width and height should be the |
| 111 | * logical dimensions of the buffer, not the number of bytes. |
Eino-Ville Talvala | 7fa43f3 | 2013-02-06 17:20:07 -0800 | [diff] [blame] | 112 | */ |
Eino-Ville Talvala | 727d172 | 2015-06-09 13:44:19 -0700 | [diff] [blame] | 113 | virtual status_t createStream(sp<Surface> consumer, |
Eino-Ville Talvala | 3d82c0d | 2015-02-23 15:19:19 -0800 | [diff] [blame] | 114 | uint32_t width, uint32_t height, int format, |
Zhijun He | 125684a | 2015-12-26 15:07:30 -0800 | [diff] [blame] | 115 | android_dataspace dataSpace, camera3_stream_rotation_t rotation, int *id, |
Zhijun He | 5d677d1 | 2016-05-29 16:52:39 -0700 | [diff] [blame] | 116 | int streamSetId = camera3::CAMERA3_STREAM_SET_ID_INVALID, |
| 117 | uint32_t consumerUsage = 0) = 0; |
Eino-Ville Talvala | 7fa43f3 | 2013-02-06 17:20:07 -0800 | [diff] [blame] | 118 | |
| 119 | /** |
Chien-Yu Chen | 618ff8a | 2015-03-13 11:27:17 -0700 | [diff] [blame] | 120 | * Create an input stream of width, height, and format. |
| 121 | * |
| 122 | * Return value is the stream ID if non-negative and an error if negative. |
| 123 | */ |
| 124 | virtual status_t createInputStream(uint32_t width, uint32_t height, |
| 125 | int32_t format, /*out*/ int32_t *id) = 0; |
| 126 | |
| 127 | /** |
Eino-Ville Talvala | 7fa43f3 | 2013-02-06 17:20:07 -0800 | [diff] [blame] | 128 | * Create an input reprocess stream that uses buffers from an existing |
| 129 | * output stream. |
| 130 | */ |
| 131 | virtual status_t createReprocessStreamFromStream(int outputId, int *id) = 0; |
| 132 | |
| 133 | /** |
| 134 | * Get information about a given stream. |
| 135 | */ |
| 136 | virtual status_t getStreamInfo(int id, |
Eino-Ville Talvala | d46a6b9 | 2015-05-14 17:26:24 -0700 | [diff] [blame] | 137 | uint32_t *width, uint32_t *height, |
| 138 | uint32_t *format, android_dataspace *dataSpace) = 0; |
Eino-Ville Talvala | 7fa43f3 | 2013-02-06 17:20:07 -0800 | [diff] [blame] | 139 | |
| 140 | /** |
| 141 | * Set stream gralloc buffer transform |
| 142 | */ |
| 143 | virtual status_t setStreamTransform(int id, int transform) = 0; |
| 144 | |
| 145 | /** |
| 146 | * Delete stream. Must not be called if there are requests in flight which |
| 147 | * reference that stream. |
| 148 | */ |
| 149 | virtual status_t deleteStream(int id) = 0; |
| 150 | |
| 151 | /** |
| 152 | * Delete reprocess stream. Must not be called if there are requests in |
| 153 | * flight which reference that stream. |
| 154 | */ |
| 155 | virtual status_t deleteReprocessStream(int id) = 0; |
| 156 | |
| 157 | /** |
Igor Murashkin | e2d167e | 2014-08-19 16:19:59 -0700 | [diff] [blame] | 158 | * Take the currently-defined set of streams and configure the HAL to use |
| 159 | * them. This is a long-running operation (may be several hundered ms). |
| 160 | * |
| 161 | * The device must be idle (see waitUntilDrained) before calling this. |
| 162 | * |
| 163 | * Returns OK on success; otherwise on error: |
| 164 | * - BAD_VALUE if the set of streams was invalid (e.g. fmts or sizes) |
| 165 | * - INVALID_OPERATION if the device was in the wrong state |
| 166 | */ |
Zhijun He | 1fa8999 | 2015-06-01 15:44:31 -0700 | [diff] [blame] | 167 | virtual status_t configureStreams(bool isConstrainedHighSpeed = false) = 0; |
Igor Murashkin | e2d167e | 2014-08-19 16:19:59 -0700 | [diff] [blame] | 168 | |
Chien-Yu Chen | 618ff8a | 2015-03-13 11:27:17 -0700 | [diff] [blame] | 169 | // get the buffer producer of the input stream |
| 170 | virtual status_t getInputBufferProducer( |
| 171 | sp<IGraphicBufferProducer> *producer) = 0; |
| 172 | |
Igor Murashkin | e2d167e | 2014-08-19 16:19:59 -0700 | [diff] [blame] | 173 | /** |
Eino-Ville Talvala | 7fa43f3 | 2013-02-06 17:20:07 -0800 | [diff] [blame] | 174 | * Create a metadata buffer with fields that the HAL device believes are |
| 175 | * best for the given use case |
| 176 | */ |
| 177 | virtual status_t createDefaultRequest(int templateId, |
| 178 | CameraMetadata *request) = 0; |
| 179 | |
| 180 | /** |
| 181 | * Wait until all requests have been processed. Returns INVALID_OPERATION if |
| 182 | * the streaming slot is not empty, or TIMED_OUT if the requests haven't |
| 183 | * finished processing in 10 seconds. |
| 184 | */ |
| 185 | virtual status_t waitUntilDrained() = 0; |
| 186 | |
| 187 | /** |
Zhijun He | 28c9b6f | 2014-08-08 12:00:47 -0700 | [diff] [blame] | 188 | * Get Jpeg buffer size for a given jpeg resolution. |
| 189 | * Negative values are error codes. |
| 190 | */ |
| 191 | virtual ssize_t getJpegBufferSize(uint32_t width, uint32_t height) const = 0; |
| 192 | |
| 193 | /** |
Eino-Ville Talvala | 7fa43f3 | 2013-02-06 17:20:07 -0800 | [diff] [blame] | 194 | * Abstract class for HAL notification listeners |
| 195 | */ |
Yin-Chia Yeh | e1c8063 | 2016-08-08 14:48:05 -0700 | [diff] [blame] | 196 | class NotificationListener : public virtual RefBase { |
Eino-Ville Talvala | 7fa43f3 | 2013-02-06 17:20:07 -0800 | [diff] [blame] | 197 | public: |
Eino-Ville Talvala | f1e98d8 | 2013-09-06 09:32:43 -0700 | [diff] [blame] | 198 | // The set of notifications is a merge of the notifications required for |
| 199 | // API1 and API2. |
| 200 | |
| 201 | // Required for API 1 and 2 |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 202 | virtual void notifyError(int32_t errorCode, |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 203 | const CaptureResultExtras &resultExtras) = 0; |
Eino-Ville Talvala | f1e98d8 | 2013-09-06 09:32:43 -0700 | [diff] [blame] | 204 | |
| 205 | // Required only for API2 |
| 206 | virtual void notifyIdle() = 0; |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 207 | virtual void notifyShutter(const CaptureResultExtras &resultExtras, |
Eino-Ville Talvala | f1e98d8 | 2013-09-06 09:32:43 -0700 | [diff] [blame] | 208 | nsecs_t timestamp) = 0; |
Eino-Ville Talvala | 4d44cad | 2015-04-11 13:15:45 -0700 | [diff] [blame] | 209 | virtual void notifyPrepared(int streamId) = 0; |
Shuzhen Wang | 9d06601 | 2016-09-30 11:30:20 -0700 | [diff] [blame] | 210 | virtual void notifyRequestQueueEmpty() = 0; |
Eino-Ville Talvala | f1e98d8 | 2013-09-06 09:32:43 -0700 | [diff] [blame] | 211 | |
| 212 | // Required only for API1 |
Eino-Ville Talvala | 7fa43f3 | 2013-02-06 17:20:07 -0800 | [diff] [blame] | 213 | virtual void notifyAutoFocus(uint8_t newState, int triggerId) = 0; |
| 214 | virtual void notifyAutoExposure(uint8_t newState, int triggerId) = 0; |
| 215 | virtual void notifyAutoWhitebalance(uint8_t newState, |
| 216 | int triggerId) = 0; |
Chien-Yu Chen | e8c535e | 2016-04-14 12:18:26 -0700 | [diff] [blame] | 217 | virtual void notifyRepeatingRequestError(long lastFrameNumber) = 0; |
Eino-Ville Talvala | 7fa43f3 | 2013-02-06 17:20:07 -0800 | [diff] [blame] | 218 | protected: |
| 219 | virtual ~NotificationListener(); |
| 220 | }; |
| 221 | |
| 222 | /** |
| 223 | * Connect HAL notifications to a listener. Overwrites previous |
| 224 | * listener. Set to NULL to stop receiving notifications. |
| 225 | */ |
Yin-Chia Yeh | e1c8063 | 2016-08-08 14:48:05 -0700 | [diff] [blame] | 226 | virtual status_t setNotifyCallback(wp<NotificationListener> listener) = 0; |
Eino-Ville Talvala | 7fa43f3 | 2013-02-06 17:20:07 -0800 | [diff] [blame] | 227 | |
| 228 | /** |
Eino-Ville Talvala | 46910bd | 2013-07-18 19:15:17 -0700 | [diff] [blame] | 229 | * Whether the device supports calling notifyAutofocus, notifyAutoExposure, |
| 230 | * and notifyAutoWhitebalance; if this returns false, the client must |
| 231 | * synthesize these notifications from received frame metadata. |
| 232 | */ |
| 233 | virtual bool willNotify3A() = 0; |
| 234 | |
| 235 | /** |
Eino-Ville Talvala | 7fa43f3 | 2013-02-06 17:20:07 -0800 | [diff] [blame] | 236 | * Wait for a new frame to be produced, with timeout in nanoseconds. |
| 237 | * Returns TIMED_OUT when no frame produced within the specified duration |
Eino-Ville Talvala | f1e98d8 | 2013-09-06 09:32:43 -0700 | [diff] [blame] | 238 | * May be called concurrently to most methods, except for getNextFrame |
Eino-Ville Talvala | 7fa43f3 | 2013-02-06 17:20:07 -0800 | [diff] [blame] | 239 | */ |
| 240 | virtual status_t waitForNextFrame(nsecs_t timeout) = 0; |
| 241 | |
| 242 | /** |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 243 | * Get next capture result frame from the result queue. Returns NOT_ENOUGH_DATA |
| 244 | * if the queue is empty; caller takes ownership of the metadata buffer inside |
| 245 | * the capture result object's metadata field. |
| 246 | * May be called concurrently to most methods, except for waitForNextFrame. |
Eino-Ville Talvala | 7fa43f3 | 2013-02-06 17:20:07 -0800 | [diff] [blame] | 247 | */ |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 248 | virtual status_t getNextResult(CaptureResult *frame) = 0; |
Eino-Ville Talvala | 7fa43f3 | 2013-02-06 17:20:07 -0800 | [diff] [blame] | 249 | |
| 250 | /** |
| 251 | * Trigger auto-focus. The latest ID used in a trigger autofocus or cancel |
| 252 | * autofocus call will be returned by the HAL in all subsequent AF |
| 253 | * notifications. |
| 254 | */ |
| 255 | virtual status_t triggerAutofocus(uint32_t id) = 0; |
| 256 | |
| 257 | /** |
| 258 | * Cancel auto-focus. The latest ID used in a trigger autofocus/cancel |
| 259 | * autofocus call will be returned by the HAL in all subsequent AF |
| 260 | * notifications. |
| 261 | */ |
| 262 | virtual status_t triggerCancelAutofocus(uint32_t id) = 0; |
| 263 | |
| 264 | /** |
| 265 | * Trigger pre-capture metering. The latest ID used in a trigger pre-capture |
| 266 | * call will be returned by the HAL in all subsequent AE and AWB |
| 267 | * notifications. |
| 268 | */ |
| 269 | virtual status_t triggerPrecaptureMetering(uint32_t id) = 0; |
| 270 | |
| 271 | /** |
| 272 | * Abstract interface for clients that want to listen to reprocess buffer |
| 273 | * release events |
| 274 | */ |
| 275 | struct BufferReleasedListener : public virtual RefBase { |
| 276 | virtual void onBufferReleased(buffer_handle_t *handle) = 0; |
| 277 | }; |
| 278 | |
| 279 | /** |
| 280 | * Push a buffer to be reprocessed into a reprocessing stream, and |
| 281 | * provide a listener to call once the buffer is returned by the HAL |
| 282 | */ |
| 283 | virtual status_t pushReprocessBuffer(int reprocessStreamId, |
| 284 | buffer_handle_t *buffer, wp<BufferReleasedListener> listener) = 0; |
Eino-Ville Talvala | abaa51d | 2013-08-14 11:37:00 -0700 | [diff] [blame] | 285 | |
| 286 | /** |
| 287 | * Flush all pending and in-flight requests. Blocks until flush is |
| 288 | * complete. |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 289 | * Output lastFrameNumber is the last frame number of the previous streaming request. |
Eino-Ville Talvala | abaa51d | 2013-08-14 11:37:00 -0700 | [diff] [blame] | 290 | */ |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 291 | virtual status_t flush(int64_t *lastFrameNumber = NULL) = 0; |
Eino-Ville Talvala | abaa51d | 2013-08-14 11:37:00 -0700 | [diff] [blame] | 292 | |
Zhijun He | 204e329 | 2014-07-14 17:09:23 -0700 | [diff] [blame] | 293 | /** |
Eino-Ville Talvala | 4d44cad | 2015-04-11 13:15:45 -0700 | [diff] [blame] | 294 | * Prepare stream by preallocating buffers for it asynchronously. |
| 295 | * Calls notifyPrepared() once allocation is complete. |
| 296 | */ |
| 297 | virtual status_t prepare(int streamId) = 0; |
| 298 | |
| 299 | /** |
Eino-Ville Talvala | b25e3c8 | 2015-07-15 16:04:27 -0700 | [diff] [blame] | 300 | * Free stream resources by dumping its unused gralloc buffers. |
| 301 | */ |
| 302 | virtual status_t tearDown(int streamId) = 0; |
| 303 | |
| 304 | /** |
Shuzhen Wang | b0fdc1e | 2016-03-20 23:21:39 -0700 | [diff] [blame] | 305 | * Add buffer listener for a particular stream in the device. |
| 306 | */ |
| 307 | virtual status_t addBufferListenerForStream(int streamId, |
| 308 | wp<camera3::Camera3StreamBufferListener> listener) = 0; |
| 309 | |
| 310 | /** |
Ruben Brunk | c78ac26 | 2015-08-13 17:58:46 -0700 | [diff] [blame] | 311 | * Prepare stream by preallocating up to maxCount buffers for it asynchronously. |
| 312 | * Calls notifyPrepared() once allocation is complete. |
| 313 | */ |
| 314 | virtual status_t prepare(int maxCount, int streamId) = 0; |
| 315 | |
| 316 | /** |
Zhijun He | 204e329 | 2014-07-14 17:09:23 -0700 | [diff] [blame] | 317 | * Get the HAL device version. |
| 318 | */ |
| 319 | virtual uint32_t getDeviceVersion() = 0; |
Zhijun He | 5d677d1 | 2016-05-29 16:52:39 -0700 | [diff] [blame] | 320 | |
| 321 | /** |
| 322 | * Set the deferred consumer surface and finish the rest of the stream configuration. |
| 323 | */ |
| 324 | virtual status_t setConsumerSurface(int streamId, sp<Surface> consumer) = 0; |
| 325 | |
Eino-Ville Talvala | 7fa43f3 | 2013-02-06 17:20:07 -0800 | [diff] [blame] | 326 | }; |
| 327 | |
| 328 | }; // namespace android |
| 329 | |
| 330 | #endif |