diff options
-rw-r--r-- | src/libcamera/pipeline/vivid/vivid.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/libcamera/pipeline/vivid/vivid.cpp b/src/libcamera/pipeline/vivid/vivid.cpp index 3f697789..56ca9b08 100644 --- a/src/libcamera/pipeline/vivid/vivid.cpp +++ b/src/libcamera/pipeline/vivid/vivid.cpp @@ -164,7 +164,26 @@ PipelineHandlerVivid::generateConfiguration(Camera *camera, Span<const StreamRol int PipelineHandlerVivid::configure(Camera *camera, CameraConfiguration *config) { - return -1; + VividCameraData *data = cameraData(camera); + StreamConfiguration &cfg = config->at(0); + int ret; + + V4L2DeviceFormat format = {}; + format.fourcc = data->video_->toV4L2PixelFormat(cfg.pixelFormat); + format.size = cfg.size; + + ret = data->video_->setFormat(&format); + if (ret) + return ret; + + if (format.size != cfg.size || + format.fourcc != data->video_->toV4L2PixelFormat(cfg.pixelFormat)) + return -EINVAL; + + cfg.setStream(&data->stream_); + cfg.stride = format.planes[0].bpl; + + return 0; } int PipelineHandlerVivid::exportFrameBuffers(Camera *camera, Stream *stream, |