summaryrefslogtreecommitdiff
path: root/src/android/camera_device.cpp
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2020-10-03 11:36:41 +0200
committerJacopo Mondi <jacopo@jmondi.org>2020-10-07 16:07:44 +0200
commit216030aa9d0953cff552d5892d32e5cd73864202 (patch)
tree6374d754012666ecfab24cc8fe84f894d29aaebc /src/android/camera_device.cpp
parent9e95d5e4531039f8e21c65ea88be9ad6aaa1ced0 (diff)
android: camera_stream: Retrieve Stream and Configuration
It's a common pattern to access the libcamera::Stream and libcamera::StreamConfiguration using the CameraStream instance's index. Add two methods to the CameraStream to shorten access to the two fields. This allows removing the index() method from the class interface. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/android/camera_device.cpp')
-rw-r--r--src/android/camera_device.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 914e66b8..47c42319 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -1292,7 +1292,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)
for (unsigned int i = 0; i < stream_list->num_streams; ++i) {
camera3_stream_t *stream = stream_list->streams[i];
CameraStream *cameraStream = static_cast<CameraStream *>(stream->priv);
- StreamConfiguration &cfg = config_->at(cameraStream->index());
+ const StreamConfiguration &cfg = cameraStream->configuration();
int ret = cameraStream->configure(cfg);
if (ret)
@@ -1413,10 +1413,7 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques
}
descriptor->frameBuffers.emplace_back(buffer);
- StreamConfiguration *streamConfiguration = &config_->at(cameraStream->index());
- Stream *stream = streamConfiguration->stream();
-
- request->addBuffer(stream, buffer);
+ request->addBuffer(cameraStream->stream(), buffer);
}
int ret = camera_->queueRequest(request);
@@ -1462,9 +1459,7 @@ void CameraDevice::requestComplete(Request *request)
if (cameraStream->camera3Stream().format != HAL_PIXEL_FORMAT_BLOB)
continue;
- StreamConfiguration *streamConfiguration = &config_->at(cameraStream->index());
- Stream *stream = streamConfiguration->stream();
- FrameBuffer *buffer = request->findBuffer(stream);
+ FrameBuffer *buffer = request->findBuffer(cameraStream->stream());
if (!buffer) {
LOG(HAL, Error) << "Failed to find a source stream buffer";
continue;