summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/pipeline/raspberrypi/raspberrypi.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index dcd737a1..b3cb9323 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -526,6 +526,8 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera,
if (roles.empty())
return config;
+ unsigned int rawCount = 0;
+ unsigned int outCount = 0;
for (const StreamRole role : roles) {
switch (role) {
case StreamRole::StillCaptureRaw:
@@ -535,6 +537,7 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera,
pixelFormat = sensorFormat.fourcc.toPixelFormat();
ASSERT(pixelFormat.isValid());
bufferCount = 1;
+ rawCount++;
break;
case StreamRole::StillCapture:
@@ -543,6 +546,7 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera,
/* Return the largest sensor resolution. */
size = data->sensor_->resolution();
bufferCount = 1;
+ outCount++;
break;
case StreamRole::VideoRecording:
@@ -550,6 +554,7 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera,
pixelFormat = formats::NV12;
size = { 1920, 1080 };
bufferCount = 4;
+ outCount++;
break;
case StreamRole::Viewfinder:
@@ -557,6 +562,7 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera,
pixelFormat = formats::ARGB8888;
size = { 800, 600 };
bufferCount = 4;
+ outCount++;
break;
default:
@@ -565,6 +571,12 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera,
break;
}
+ if (rawCount > 1 || outCount > 2) {
+ LOG(RPI, Error) << "Invalid stream roles requested";
+ delete config;
+ return nullptr;
+ }
+
/* Translate the V4L2PixelFormat to PixelFormat. */
std::map<PixelFormat, std::vector<SizeRange>> deviceFormats;
std::transform(fmts.begin(), fmts.end(), std::inserter(deviceFormats, deviceFormats.end()),