summaryrefslogtreecommitdiff
path: root/kms++
diff options
context:
space:
mode:
Diffstat (limited to 'kms++')
-rw-r--r--kms++/inc/kms++/card.h1
-rw-r--r--kms++/inc/kms++/drmpropobject.h3
-rw-r--r--kms++/src/atomicreq.cpp2
-rw-r--r--kms++/src/card.cpp10
-rw-r--r--kms++/src/drmpropobject.cpp14
5 files changed, 17 insertions, 13 deletions
diff --git a/kms++/inc/kms++/card.h b/kms++/inc/kms++/card.h
index 5ecaecf..09c9bba 100644
--- a/kms++/inc/kms++/card.h
+++ b/kms++/inc/kms++/card.h
@@ -32,7 +32,6 @@ public:
Encoder* get_encoder(uint32_t id) const;
Plane* get_plane(uint32_t id) const;
Property* get_prop(uint32_t id) const;
- Property* get_prop(const std::string& name) const;
bool master() const { return m_master; }
bool has_atomic() const { return m_has_atomic; }
diff --git a/kms++/inc/kms++/drmpropobject.h b/kms++/inc/kms++/drmpropobject.h
index ec28d45..38de584 100644
--- a/kms++/inc/kms++/drmpropobject.h
+++ b/kms++/inc/kms++/drmpropobject.h
@@ -14,6 +14,9 @@ class DrmPropObject : public DrmObject
friend class Card;
public:
void refresh_props();
+
+ Property* get_prop(const std::string& name) const;
+
uint64_t get_prop_value(uint32_t id) const;
uint64_t get_prop_value(const std::string& name) const;
std::unique_ptr<Blob> get_prop_value_as_blob(const std::string& name) const;
diff --git a/kms++/src/atomicreq.cpp b/kms++/src/atomicreq.cpp
index c8dd862..f2809af 100644
--- a/kms++/src/atomicreq.cpp
+++ b/kms++/src/atomicreq.cpp
@@ -51,7 +51,7 @@ void AtomicReq::add(DrmPropObject* ob, Property *prop, uint64_t value)
void AtomicReq::add(kms::DrmPropObject* ob, const string& prop, uint64_t value)
{
- add(ob, m_card.get_prop(prop), value);
+ add(ob, ob->get_prop(prop), value);
}
void AtomicReq::add(kms::DrmPropObject* ob, const map<string, uint64_t>& values)
diff --git a/kms++/src/card.cpp b/kms++/src/card.cpp
index 0a34d14..12bdef6 100644
--- a/kms++/src/card.cpp
+++ b/kms++/src/card.cpp
@@ -143,16 +143,6 @@ void Card::restore_modes()
conn->restore_mode();
}
-Property* Card::get_prop(const string& name) const
-{
- for (auto prop : m_properties) {
- if (name == prop->name())
- return prop;
- }
-
- throw invalid_argument(string("Card property ") + name + " not found");
-}
-
Connector* Card::get_first_connected_connector() const
{
for(auto c : m_connectors) {
diff --git a/kms++/src/drmpropobject.cpp b/kms++/src/drmpropobject.cpp
index f2edf8b..f5a3c97 100644
--- a/kms++/src/drmpropobject.cpp
+++ b/kms++/src/drmpropobject.cpp
@@ -45,6 +45,18 @@ void DrmPropObject::refresh_props()
drmModeFreeObjectProperties(props);
}
+Property* DrmPropObject::get_prop(const string& name) const
+{
+ for (auto pair : m_prop_values) {
+ auto prop = card().get_prop(pair.first);
+
+ if (name == prop->name())
+ return prop;
+ }
+
+ throw invalid_argument(string("property ") + name + " not found");
+}
+
uint64_t DrmPropObject::get_prop_value(uint32_t id) const
{
return m_prop_values.at(id);
@@ -75,7 +87,7 @@ int DrmPropObject::set_prop_value(uint32_t id, uint64_t value)
int DrmPropObject::set_prop_value(const string &name, uint64_t value)
{
- Property* prop = card().get_prop(name);
+ Property* prop = get_prop(name);
if (prop == nullptr)
throw invalid_argument("property not found: " + name);