android: camera_device: Make CameraStream configuration nicer
Loop over the CameraStream instances and use their interface to perform CameraStream configuration. Modify CameraStream::configure() to configure the android stream buffer count and to retrieve the StreamConfiguration by index instead of receiving it as a parameter. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
parent
fc1fcb5bc9
commit
6c8837da5e
3 changed files with 14 additions and 14 deletions
|
@ -1287,17 +1287,12 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)
|
|||
* StreamConfiguration and set the number of required buffers in
|
||||
* the Android camera3_stream_t.
|
||||
*/
|
||||
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);
|
||||
const StreamConfiguration &cfg = cameraStream->configuration();
|
||||
|
||||
int ret = cameraStream->configure(cfg);
|
||||
if (ret)
|
||||
for (CameraStream &cameraStream : streams_) {
|
||||
int ret = cameraStream.configure();
|
||||
if (ret) {
|
||||
LOG(HAL, Error) << "Failed to configure camera stream";
|
||||
return ret;
|
||||
|
||||
/* Use the bufferCount confirmed by the validation process. */
|
||||
stream->max_buffers = cfg.bufferCount;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -38,10 +38,15 @@ Stream *CameraStream::stream() const
|
|||
return configuration().stream();
|
||||
}
|
||||
|
||||
int CameraStream::configure(const libcamera::StreamConfiguration &cfg)
|
||||
int CameraStream::configure()
|
||||
{
|
||||
if (encoder_)
|
||||
return encoder_->configure(cfg);
|
||||
if (encoder_) {
|
||||
int ret = encoder_->configure(configuration());
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
camera3Stream_->max_buffers = configuration().bufferCount;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ public:
|
|||
const libcamera::StreamConfiguration &configuration() const;
|
||||
libcamera::Stream *stream() const;
|
||||
|
||||
int configure(const libcamera::StreamConfiguration &cfg);
|
||||
int configure();
|
||||
int process(const libcamera::FrameBuffer &source,
|
||||
MappedCamera3Buffer *dest, CameraMetadata *metadata);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue