summaryrefslogtreecommitdiff
path: root/src/py/libcamera/py_main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/py/libcamera/py_main.cpp')
-rw-r--r--src/py/libcamera/py_main.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/py/libcamera/py_main.cpp b/src/py/libcamera/py_main.cpp
index 9e827845..52f70811 100644
--- a/src/py/libcamera/py_main.cpp
+++ b/src/py/libcamera/py_main.cpp
@@ -163,6 +163,7 @@ PYBIND11_MODULE(_libcamera, m)
auto pyRequestReuse = py::enum_<Request::ReuseFlag>(pyRequest, "Reuse");
auto pyFrameMetadata = py::class_<FrameMetadata>(m, "FrameMetadata");
auto pyFrameMetadataStatus = py::enum_<FrameMetadata::Status>(pyFrameMetadata, "Status");
+ auto pyFrameMetadataPlane = py::class_<FrameMetadata::Plane>(pyFrameMetadata, "Plane");
auto pyTransform = py::class_<Transform>(m, "Transform");
auto pyColorSpace = py::class_<ColorSpace>(m, "ColorSpace");
auto pyColorSpacePrimaries = py::enum_<ColorSpace::Primaries>(pyColorSpace, "Primaries");
@@ -512,11 +513,10 @@ PYBIND11_MODULE(_libcamera, m)
.def_readonly("status", &FrameMetadata::status)
.def_readonly("sequence", &FrameMetadata::sequence)
.def_readonly("timestamp", &FrameMetadata::timestamp)
- /* \todo Implement FrameMetadata::Plane properly */
- .def_property_readonly("bytesused", [](FrameMetadata &self) {
- std::vector<unsigned int> v;
- v.resize(self.planes().size());
- transform(self.planes().begin(), self.planes().end(), v.begin(), [](const auto &p) { return p.bytesused; });
+ .def_property_readonly("planes", [](const FrameMetadata &self) {
+ /* Convert from Span<> to std::vector<> */
+ /* Note: this creates a copy */
+ std::vector<FrameMetadata::Plane> v(self.planes().begin(), self.planes().end());
return v;
});
@@ -525,6 +525,9 @@ PYBIND11_MODULE(_libcamera, m)
.value("Error", FrameMetadata::FrameError)
.value("Cancelled", FrameMetadata::FrameCancelled);
+ pyFrameMetadataPlane
+ .def_readwrite("bytes_used", &FrameMetadata::Plane::bytesused);
+
pyTransform
.def(py::init([](int rotation, bool hflip, bool vflip, bool transpose) {
bool ok;