diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2019-11-06 17:28:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-06 17:28:56 +0200 |
commit | d6dc724f16672cbb3eed382815514f4c9a0246d4 (patch) | |
tree | 2dc92e3848cb6de85cf29646418b6deac3dbb250 /py/pykms | |
parent | 9d142cb7ec175a8394f47aee61ca8a1951dd6170 (diff) | |
parent | 3009db77d599c6a397c24ba1a4e84c53299162c0 (diff) |
Merge pull request #40 from tomba/work
Misc improvements
Diffstat (limited to 'py/pykms')
-rw-r--r-- | py/pykms/pykmsbase.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/py/pykms/pykmsbase.cpp b/py/pykms/pykmsbase.cpp index b4dc090..c039833 100644 --- a/py/pykms/pykmsbase.cpp +++ b/py/pykms/pykmsbase.cpp @@ -122,14 +122,14 @@ void init_pykmsbase(py::module &m) ; py::class_<Blob>(m, "Blob") - .def("__init__", [](Blob& instance, Card& card, py::buffer buf) { - py::buffer_info info = buf.request(); - if (info.ndim != 1) - throw std::runtime_error("Incompatible buffer dimension!"); + .def(py::init([](Card& card, py::buffer buf) { + py::buffer_info info = buf.request(); + if (info.ndim != 1) + throw std::runtime_error("Incompatible buffer dimension!"); - new (&instance) Blob(card, info.ptr, info.size * info.itemsize); - }, - py::keep_alive<1, 3>()) // Keep Card alive until this is destructed + return new Blob(card, info.ptr, info.size * info.itemsize); + }), + py::keep_alive<1, 2>()) // Keep Card alive until this is destructed .def_property_readonly("data", &Blob::data) @@ -167,7 +167,7 @@ void init_pykmsbase(py::module &m) .def("offset", &DumbFramebuffer::offset) ; - py::class_<ExtFramebuffer, Framebuffer>(m, "ExtFramebuffer") + py::class_<DmabufFramebuffer, Framebuffer>(m, "DmabufFramebuffer") .def(py::init<Card&, uint32_t, uint32_t, PixelFormat, vector<int>, vector<uint32_t>, vector<uint32_t>>(), py::keep_alive<1, 2>()) // Keep Card alive until this is destructed ; |