From dc4be4e5ce8556ba0d8bdc82681c673ed89c7dd5 Mon Sep 17 00:00:00 2001 From: William Vinnicombe Date: Tue, 12 Dec 2023 13:37:28 +0000 Subject: [PATCH] picamera2: Allow setting of stride Allow setting of the stride in stream configuration, and default to 0 if not set to allow libcamera to set the correct stride. Signed-off-by: William Vinnicombe --- picamera2/picamera2.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/picamera2/picamera2.py b/picamera2/picamera2.py index 95d3deec..ce11bc90 100644 --- a/picamera2/picamera2.py +++ b/picamera2/picamera2.py @@ -641,7 +641,7 @@ def _make_initial_stream_config(stream_config: dict, updates: dict, ignore_list= """ if updates is None: return None - valid = ("format", "size") + valid = ("format", "size", "stride") for key, value in updates.items(): if isinstance(value, SensorFormat): value = str(value) @@ -839,6 +839,7 @@ def _update_libcamera_stream_config(libcamera_stream_config, stream_config, buff libcamera_stream_config.size = libcamera.Size(stream_config["size"][0], stream_config["size"][1]) libcamera_stream_config.pixel_format = libcamera.PixelFormat(stream_config["format"]) libcamera_stream_config.buffer_count = buffer_count + libcamera_stream_config.stride = stream_config.get("stride", 0) def _make_libcamera_config(self, camera_config): # Make a libcamera configuration object from our Python configuration.