]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android/external-libkmsxx.git/blobdiff - libkms++/drmobject.cpp
Split properties from DrmObject into DrmPropObject
[android/external-libkmsxx.git] / libkms++ / drmobject.cpp
index 76a7e8c2b992c6dfb579436fcd7087e8ccb34896..8abecc725bb955d6da237d664b316bd8e474d1cf 100644 (file)
@@ -20,7 +20,6 @@ DrmObject::DrmObject(Card& card, uint32_t object_type)
 DrmObject::DrmObject(Card& card, uint32_t id, uint32_t object_type, uint32_t idx)
        :m_card(card), m_id(id), m_object_type(object_type), m_idx(idx)
 {
-       refresh_props();
 }
 
 DrmObject::~DrmObject()
@@ -28,54 +27,6 @@ DrmObject::~DrmObject()
 
 }
 
-void DrmObject::refresh_props()
-{
-       auto props = drmModeObjectGetProperties(card().fd(), this->id(), this->object_type());
-
-       if (props == nullptr)
-               return;
-
-       for (unsigned i = 0; i < props->count_props; ++i) {
-               uint32_t prop_id = props->props[i];
-               uint64_t prop_value = props->prop_values[i];
-
-               m_prop_values[prop_id] = prop_value;
-       }
-
-       drmModeFreeObjectProperties(props);
-}
-
-uint64_t DrmObject::get_prop_value(uint32_t id) const
-{
-       return m_prop_values.at(id);
-}
-
-uint64_t DrmObject::get_prop_value(const string& name) const
-{
-       for (auto pair : m_prop_values) {
-               auto prop = card().get_prop(pair.first);
-               if (name == prop->name())
-                       return m_prop_values.at(prop->id());
-       }
-
-       throw invalid_argument("property not found: " + name);
-}
-
-int DrmObject::set_prop_value(uint32_t id, uint64_t value)
-{
-       return drmModeObjectSetProperty(card().fd(), this->id(), this->object_type(), id, value);
-}
-
-int DrmObject::set_prop_value(const string &name, uint64_t value)
-{
-       Property* prop = card().get_prop(name);
-
-       if (prop == nullptr)
-               throw invalid_argument("property not found: " + name);
-
-       return set_prop_value(prop->id(), value);
-}
-
 void DrmObject::set_id(uint32_t id)
 {
        m_id = id;