summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kms++/inc/kms++/drmpropobject.h2
-rw-r--r--kms++/src/drmpropobject.cpp2
-rw-r--r--py/pykms/pykmsbase.cpp2
3 files changed, 5 insertions, 1 deletions
diff --git a/kms++/inc/kms++/drmpropobject.h b/kms++/inc/kms++/drmpropobject.h
index 809caf5..48e0265 100644
--- a/kms++/inc/kms++/drmpropobject.h
+++ b/kms++/inc/kms++/drmpropobject.h
@@ -15,6 +15,8 @@ class DrmPropObject : public DrmObject
public:
void refresh_props();
+ bool has_prop(const std::string& name) const { return !!get_prop(name); }
+
Property* get_prop(const std::string& name) const;
uint64_t get_prop_value(uint32_t id) const;
diff --git a/kms++/src/drmpropobject.cpp b/kms++/src/drmpropobject.cpp
index 74f8848..c78f70a 100644
--- a/kms++/src/drmpropobject.cpp
+++ b/kms++/src/drmpropobject.cpp
@@ -54,7 +54,7 @@ Property* DrmPropObject::get_prop(const string& name) const
return prop;
}
- throw invalid_argument(string("property ") + name + " not found");
+ return nullptr;
}
uint64_t DrmPropObject::get_prop_value(uint32_t id) const
diff --git a/py/pykms/pykmsbase.cpp b/py/pykms/pykmsbase.cpp
index 0448e02..bee277c 100644
--- a/py/pykms/pykmsbase.cpp
+++ b/py/pykms/pykmsbase.cpp
@@ -65,6 +65,7 @@ void init_pykmsbase(py::module &m)
.def("set_prop_value",(int (DrmPropObject::*)(const string&, uint64_t)) &DrmPropObject::set_prop_value)
.def("get_prop_value_as_blob", &DrmPropObject::get_prop_value_as_blob)
.def("get_prop", &DrmPropObject::get_prop)
+ .def("has_prop", &DrmPropObject::has_prop)
;
py::class_<Connector, DrmPropObject, unique_ptr<Connector, py::nodelete>>(m, "Connector")
@@ -274,6 +275,7 @@ void init_pykmsbase(py::module &m)
.def(py::init<Card&>(),
py::keep_alive<1, 2>()) // Keep Card alive until this is destructed
.def("add", (void (AtomicReq::*)(DrmPropObject*, const string&, uint64_t)) &AtomicReq::add)
+ .def("add", (void (AtomicReq::*)(DrmPropObject*, Property*, uint64_t)) &AtomicReq::add)
.def("add", (void (AtomicReq::*)(DrmPropObject*, const map<string, uint64_t>&)) &AtomicReq::add)
.def("test", &AtomicReq::test, py::arg("allow_modeset") = false)
.def("commit",