From 5267ca8e0209c08ba2b022543f291985c4cfeaf5 Mon Sep 17 00:00:00 2001 From: Jacopo Mondi <jacopo@jmondi.org> Date: Sun, 28 Jun 2020 16:36:45 +0200 Subject: libcamera: ipu3: Accept an empty roles list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The IPU3 pipeline handler that does not support receiving an empty list of roles at generateConfiguration() time. This contradicts the camera API which allows application to generate empty CameraConfiguration to be later manually filled. Fix this by returning an empty CameraConfiguration if the list of requested roles is empty. While at it, align the style with the other pipeline handlers. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> --- src/libcamera/pipeline/ipu3/ipu3.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index ef57196c..cbf19793 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -292,14 +292,15 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera, const StreamRoles &roles) { IPU3CameraData *data = cameraData(camera); - IPU3CameraConfiguration *config; + IPU3CameraConfiguration *config = new IPU3CameraConfiguration(camera, data); std::set<Stream *> streams = { &data->outStream_, &data->vfStream_, &data->rawStream_, }; - config = new IPU3CameraConfiguration(camera, data); + if (roles.empty()) + return config; for (const StreamRole role : roles) { StreamConfiguration cfg = {}; -- cgit v1.2.1