summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/android/camera_device.cpp11
-rw-r--r--src/android/camera_stream.cpp10
-rw-r--r--src/android/camera_stream.h4
3 files changed, 16 insertions, 9 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;
diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp
index e86a7ba6..9c7819ef 100644
--- a/src/android/camera_stream.cpp
+++ b/src/android/camera_stream.cpp
@@ -33,6 +33,16 @@ CameraStream::CameraStream(CameraDevice *cameraDevice,
encoder_ = std::make_unique<EncoderLibJpeg>();
}
+const StreamConfiguration &CameraStream::configuration() const
+{
+ return config_->at(index_);
+}
+
+Stream *CameraStream::stream() const
+{
+ return configuration().stream();
+}
+
int CameraStream::configure(const libcamera::StreamConfiguration &cfg)
{
if (encoder_)
diff --git a/src/android/camera_stream.h b/src/android/camera_stream.h
index d95c2a38..d8d9d8c4 100644
--- a/src/android/camera_stream.h
+++ b/src/android/camera_stream.h
@@ -115,7 +115,9 @@ public:
const libcamera::PixelFormat &format() const { return format_; }
const libcamera::Size &size() const { return size_; }
Type type() const { return type_; }
- unsigned int index() const { return index_; }
+
+ const libcamera::StreamConfiguration &configuration() const;
+ libcamera::Stream *stream() const;
int configure(const libcamera::StreamConfiguration &cfg);
int process(const libcamera::FrameBuffer &source,