summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/formats.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp
index a51e9681..ebaae9be 100644
--- a/src/libcamera/formats.cpp
+++ b/src/libcamera/formats.cpp
@@ -821,4 +821,22 @@ PixelFormatInfo::frameSize(const Size &size,
return sum;
}
+/**
+ * \brief Retrieve the number of planes represented by the format
+ * \return The number of planes used by the format
+ */
+unsigned int PixelFormatInfo::numPlanes() const
+{
+ unsigned int count = 0;
+
+ for (const PixelFormatPlaneInfo &p : planes) {
+ if (p.bytesPerGroup == 0)
+ break;
+
+ count++;
+ }
+
+ return count;
+}
+
} /* namespace libcamera */