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 f7fa759e..40d723e9 100644 --- a/src/libcamera/pipeline/vivid/vivid.cpp +++ b/src/libcamera/pipeline/vivid/vivid.cpp @@ -164,7 +164,26 @@ CameraConfiguration *PipelineHandlerVivid::generateConfiguration(Camera *camera, 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, |