1 #include <pybind11/pybind11.h> 2 #include <pybind11/stl.h> 3 #include <kms++/kms++.h> 4 #include <kms++util/kms++util.h> 5 #include <kms++util/videodevice.h> 6 7 namespace py = pybind11; 8 9 using namespace kms; 10 using namespace std; 11 12 void init_pyvid(py::module &m) 13 { 14 py::class_<VideoDevice>(m, "VideoDevice") 15 .def(py::init<const string&>()) 16 .def_property_readonly("fd", &VideoDevice::fd) 17 .def_property_readonly("has_capture", &VideoDevice::has_capture) 18 .def_property_readonly("has_output", &VideoDevice::has_output) 19 .def_property_readonly("has_m2m", &VideoDevice::has_m2m) 20 .def_property_readonly("capture_streamer", &VideoDevice::get_capture_streamer) 21 .def_property_readonly("output_streamer", &VideoDevice::get_output_streamer) 22 .def_property_readonly("discrete_frame_sizes", &VideoDevice::get_discrete_frame_sizes) 23 .def_property_readonly("frame_sizes", &VideoDevice::get_frame_sizes) 24 .def("get_capture_devices", &VideoDevice::get_capture_devices) 25 ; 26 27 py::class_<VideoStreamer>(m, "VideoStreamer") 28 .def_property_readonly("fd", &VideoStreamer::fd) 29 .def_property_readonly("ports", &VideoStreamer::get_ports) 30 .def("set_port", &VideoStreamer::set_port) 31 .def_property_readonly("formats", &VideoStreamer::get_formats) 32 .def("set_format", &VideoStreamer::set_format) 33 .def("set_queue_size", &VideoStreamer::set_queue_size) 34 .def("queue", &VideoStreamer::queue) 35 .def("dequeue", &VideoStreamer::dequeue) 36 .def("stream_on", &VideoStreamer::stream_on) 37 .def("stream_off", &VideoStreamer::stream_off) 38 ; 39 } 40