py: Expose MappedFramebuffer width and height properties
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Mon, 2 Jan 2017 14:42:07 +0000 (16:42 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Tue, 3 Jan 2017 08:46:42 +0000 (10:46 +0200)
The property getters are defined as pure virtual functions in the
MappedFramebuffer class. Expose the Python properties as part of the
bindings for that class to make them available for all classes
inheriting from MappedFramebuffer.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
py/pykmsbase.cpp

index 9f20fdb66caa3ec9817d5661032f82fa4ba03237..5247158d7bd4d794733b28136024dca6aa665610 100644 (file)
@@ -91,6 +91,8 @@ void init_pykmsbase(py::module &m)
                        ;
 
        py::class_<MappedFramebuffer>(m, "MappedFramebuffer", py::base<Framebuffer>())
+                       .def_property_readonly("width", &MappedFramebuffer::width)
+                       .def_property_readonly("height", &MappedFramebuffer::height)
                        ;
 
        py::class_<DumbFramebuffer>(m, "DumbFramebuffer", py::base<MappedFramebuffer>())
@@ -98,8 +100,6 @@ void init_pykmsbase(py::module &m)
                             py::keep_alive<1, 2>())    // Keep Card alive until this is destructed
                        .def(py::init<Card&, uint32_t, uint32_t, PixelFormat>(),
                             py::keep_alive<1, 2>())    // Keep Card alive until this is destructed
-                       .def_property_readonly("width", &DumbFramebuffer::width)
-                       .def_property_readonly("height", &DumbFramebuffer::height)
                        ;
 
        py::enum_<PixelFormat>(m, "PixelFormat")