summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c65ffb7)
raw | patch | inline | side by side (parent: c65ffb7)
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | |
Sat, 11 Jun 2016 20:42:06 +0000 (23:42 +0300) | ||
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | |
Thu, 16 Jun 2016 18:47:51 +0000 (21:47 +0300) |
py/CMakeLists.txt | patch | blob | history | |
py/pykms.cpp | patch | blob | history | |
py/pyvid.cpp | [new file with mode: 0644] | patch | blob |
diff --git a/py/CMakeLists.txt b/py/CMakeLists.txt
index 562a3cff4572225a298d996d54a44b5ddc86c312..1349ea57200341c107183385f0e48cc0d27692c6 100644 (file)
--- a/py/CMakeLists.txt
+++ b/py/CMakeLists.txt
include_directories(${PROJECT_SOURCE_DIR}/ext/pybind11/include)
-add_library(pykms SHARED pykms.cpp pykmsbase.cpp pykmsutil.cpp)
+add_library(pykms SHARED pykms.cpp pykmsbase.cpp pykmsutil.cpp pyvid.cpp)
target_link_libraries(pykms kms++ kms++util ${LIBDRM_LIBRARIES})
# Don't add a 'lib' prefix to the shared library
diff --git a/py/pykms.cpp b/py/pykms.cpp
index 57ca363c5fc274c213790b63ace94ded2edd2114..c759d236cc966f5281436705fc886519700a095b 100644 (file)
--- a/py/pykms.cpp
+++ b/py/pykms.cpp
void init_pykmstest(py::module &m);
void init_pykmsbase(py::module &m);
+void init_pyvid(py::module &m);
class PyPageFlipHandlerBase : PageFlipHandlerBase
{
init_pykmstest(m);
+ init_pyvid(m);
+
return m.ptr();
}
diff --git a/py/pyvid.cpp b/py/pyvid.cpp
--- /dev/null
+++ b/py/pyvid.cpp
@@ -0,0 +1,38 @@
+#include <pybind11/pybind11.h>
+#include <pybind11/stl.h>
+#include <kms++/kms++.h>
+#include <kms++util/kms++util.h>
+#include <kms++util/videodevice.h>
+
+namespace py = pybind11;
+
+using namespace kms;
+using namespace std;
+
+void init_pyvid(py::module &m)
+{
+ py::class_<VideoDevice, VideoDevice*>(m, "VideoDevice")
+ .def(py::init<const string&>())
+ .def_property_readonly("fd", &VideoDevice::fd)
+ .def_property_readonly("has_capture", &VideoDevice::has_capture)
+ .def_property_readonly("has_output", &VideoDevice::has_output)
+ .def_property_readonly("has_m2m", &VideoDevice::has_m2m)
+ .def_property_readonly("capture_streamer", &VideoDevice::get_capture_streamer)
+ .def_property_readonly("output_streamer", &VideoDevice::get_output_streamer)
+ .def_property_readonly("discrete_frame_sizes", &VideoDevice::get_discrete_frame_sizes)
+ .def_property_readonly("frame_sizes", &VideoDevice::get_frame_sizes)
+ .def("get_capture_devices", &VideoDevice::get_capture_devices)
+ ;
+
+ py::class_<VideoStreamer, VideoStreamer*>(m, "VideoStreamer")
+ .def_property_readonly("fd", &VideoStreamer::fd)
+ .def_property_readonly("ports", &VideoStreamer::get_ports)
+ .def("set_port", &VideoStreamer::set_port)
+ .def_property_readonly("formats", &VideoStreamer::get_formats)
+ .def("set_format", &VideoStreamer::set_format)
+ .def("set_queue_size", &VideoStreamer::set_queue_size)
+ .def("queue", &VideoStreamer::queue)
+ .def("dequeue", &VideoStreamer::dequeue)
+ .def("stream_on", &VideoStreamer::stream_on)
+ ;
+}