py: Add Card crtcs and encoders properties back to the Python bindings
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Thu, 7 Dec 2017 18:20:54 +0000 (20:20 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 8 Dec 2017 06:48:03 +0000 (08:48 +0200)
Commit 706a44abb3aa ("Update to latest pybind11") removed the crtcs and
encoders properties from the Card class. Add them back by wrapping the
associated C++ methods manually due to a limitation of pybind11.

Fixes: 706a44abb3aa ("Update to latest pybind11")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
py/pykms/pykmsbase.cpp

index 79c502ccc8aebfcb381ff8742237c16d1f33df3a..dd09fae6c6243eef25cca9084aefd0c8f603a8d0 100644 (file)
@@ -24,6 +24,20 @@ void init_pykmsbase(py::module &m)
                                return v;
                        })
 
+                       .def_property_readonly("crtcs", [](Card* self) {
+                               vector<unique_ptr<Crtc, py::nodelete>> v;
+                               for (Crtc* p : self->get_crtcs())
+                                       v.push_back(unique_ptr<Crtc, py::nodelete>(p));
+                               return v;
+                       })
+
+                       .def_property_readonly("encoders", [](Card* self) {
+                               vector<unique_ptr<Encoder, py::nodelete>> v;
+                               for (Encoder* p : self->get_encoders())
+                                       v.push_back(unique_ptr<Encoder, py::nodelete>(p));
+                               return v;
+                       })
+
                        .def_property_readonly("planes", [](Card* self) {
                                vector<unique_ptr<Plane, py::nodelete>> v;
                                for (Plane* p : self->get_planes())