Add Source class
This commit is contained in:
24
src/PySource.cpp
Normal file
24
src/PySource.cpp
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#include "PySource.hpp"
|
||||||
|
|
||||||
|
PySource::PySource(const std::string &ndi_name_,
|
||||||
|
const std::string &url_address_)
|
||||||
|
: _ndi_name(ndi_name_), _url_address(url_address_) {
|
||||||
|
p_ndi_name = _ndi_name.c_str();
|
||||||
|
p_url_address = _url_address.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
PySource::~PySource() {}
|
||||||
|
|
||||||
|
const std::string &PySource::getNdiName() const { return _ndi_name; }
|
||||||
|
|
||||||
|
void PySource::setNdiName(const std::string &name) {
|
||||||
|
_ndi_name = name;
|
||||||
|
p_ndi_name = _ndi_name.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string &PySource::getUrlAddress() const { return _url_address; }
|
||||||
|
|
||||||
|
void PySource::setUrlAddress(const std::string &address) {
|
||||||
|
_url_address = address;
|
||||||
|
p_url_address = _url_address.c_str();
|
||||||
|
}
|
||||||
18
src/PySource.hpp
Normal file
18
src/PySource.hpp
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#include <Processing.NDI.Lib.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
class PySource : public NDIlib_source_t {
|
||||||
|
public:
|
||||||
|
PySource(const std::string &ndi_name_, const std::string &url_address_);
|
||||||
|
virtual ~PySource();
|
||||||
|
|
||||||
|
const std::string &getNdiName() const;
|
||||||
|
void setNdiName(const std::string &name);
|
||||||
|
|
||||||
|
const std::string &getUrlAddress() const;
|
||||||
|
void setUrlAddress(const std::string &address);
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string _ndi_name;
|
||||||
|
std::string _url_address;
|
||||||
|
};
|
||||||
11
src/main.cpp
11
src/main.cpp
@@ -1,6 +1,6 @@
|
|||||||
#include <pybind11/pybind11.h>
|
#include <pybind11/pybind11.h>
|
||||||
|
|
||||||
#include <Processing.NDI.Lib.h>
|
#include "PySource.hpp"
|
||||||
|
|
||||||
namespace py = pybind11;
|
namespace py = pybind11;
|
||||||
|
|
||||||
@@ -93,11 +93,12 @@ PYBIND11_MODULE(NDIlib, m) {
|
|||||||
|
|
||||||
m.attr("RECV_TIMESTAMP_UNDEFINED") = py::int_(INT64_MAX);
|
m.attr("RECV_TIMESTAMP_UNDEFINED") = py::int_(INT64_MAX);
|
||||||
|
|
||||||
py::class_<NDIlib_source_t>(m, "Source")
|
py::class_<PySource>(m, "Source")
|
||||||
.def(py::init<const char *, const char *>(),
|
.def(py::init<const std::string &, const std::string &>(),
|
||||||
py::arg("ndi_name") = nullptr, py::arg("url_address") = nullptr)
|
py::arg("ndi_name") = nullptr, py::arg("url_address") = nullptr)
|
||||||
.def_readwrite("ndi_name", &NDIlib_source_t::p_ndi_name)
|
.def_property("ndi_name", &PySource::getNdiName, &PySource::setNdiName)
|
||||||
.def_readwrite("url_address", &NDIlib_source_t::p_url_address);
|
.def_property("url_address", &PySource::getUrlAddress,
|
||||||
|
&PySource::setUrlAddress);
|
||||||
|
|
||||||
py::class_<NDIlib_video_frame_v2_t>(m, "VideoFrameV2")
|
py::class_<NDIlib_video_frame_v2_t>(m, "VideoFrameV2")
|
||||||
.def(py::init<int, int, NDIlib_FourCC_type_e, int, int, float,
|
.def(py::init<int, int, NDIlib_FourCC_type_e, int, int, float,
|
||||||
|
|||||||
Reference in New Issue
Block a user