Skip to content
Snippets Groups Projects
Commit 406a0b52 authored by Eloi Bail's avatar Eloi Bail Committed by Gerrit Code Review
Browse files

daemon: add of dbus API setCodecDetails

Refs #68805

Change-Id: Ic997485ff22c8cf9465b7ff661dc1c9bcbca2f9c
parent 04f1433d
Branches
Tags
No related merge requests found
...@@ -382,6 +382,15 @@ ...@@ -382,6 +382,15 @@
</arg> </arg>
</method> </method>
<method name="setCodecDetails" tp:name-for-bindings="setCodecDetails">
<arg type="b" name="result" direction="out"></arg>
<arg type="s" name="accountID" direction="in"></arg>
<arg type="u" name="codecId" direction="in"></arg>
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="MapStringString"/>
<arg type="a{ss}" name="details" direction="in" tp:type="String_String_Map">
</arg>
</method>
<method name="getActiveCodecList" tp:name-for-bindings="getActiveCodecList"> <method name="getActiveCodecList" tp:name-for-bindings="getActiveCodecList">
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="VectorUInt"/> <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="VectorUInt"/>
<arg type="s" name="accountID" direction="in"> <arg type="s" name="accountID" direction="in">
......
...@@ -121,6 +121,13 @@ DBusConfigurationManager::getCodecDetails(const std::string& accountID, const un ...@@ -121,6 +121,13 @@ DBusConfigurationManager::getCodecDetails(const std::string& accountID, const un
return DRing::getCodecDetails(accountID, codecId); return DRing::getCodecDetails(accountID, codecId);
} }
auto
DBusConfigurationManager::setCodecDetails(const std::string& accountID, const unsigned& codecId, const std::map<std::string, std::string>& details)
-> decltype(DRing::setCodecDetails(accountID, codecId, details))
{
return DRing::setCodecDetails(accountID, codecId, details);
}
auto auto
DBusConfigurationManager::getActiveCodecList(const std::string& accountID) -> decltype(DRing::getActiveCodecList(accountID)) DBusConfigurationManager::getActiveCodecList(const std::string& accountID) -> decltype(DRing::getActiveCodecList(accountID))
{ {
......
...@@ -79,6 +79,7 @@ class DBusConfigurationManager : ...@@ -79,6 +79,7 @@ class DBusConfigurationManager :
std::vector<unsigned> getCodecList(); std::vector<unsigned> getCodecList();
std::vector<std::string> getSupportedTlsMethod(); std::vector<std::string> getSupportedTlsMethod();
std::map<std::string, std::string> getCodecDetails(const std::string& accountID, const unsigned& codecId); std::map<std::string, std::string> getCodecDetails(const std::string& accountID, const unsigned& codecId);
bool setCodecDetails(const std::string& accountID, const unsigned& codecId, const std::map<std::string, std::string>& details);
std::vector<unsigned> getActiveCodecList(const std::string& accountID); std::vector<unsigned> getActiveCodecList(const std::string& accountID);
void setActiveCodecList(const std::string& accountID, const std::vector<unsigned>& list); void setActiveCodecList(const std::string& accountID, const std::vector<unsigned>& list);
std::vector<std::string> getAudioPluginList(); std::vector<std::string> getAudioPluginList();
......
...@@ -289,6 +289,40 @@ getSupportedCiphers(const std::string& accountID) ...@@ -289,6 +289,40 @@ getSupportedCiphers(const std::string& accountID)
} }
bool
setCodecDetails(const std::string& accountID,
const unsigned& codecId,
const std::map<std::string, std::string>& details)
{
auto acc = ring::Manager::instance().getAccount(accountID);
if (!acc) {
RING_ERR("Could not find account %s. can not set codec details"
, accountID.c_str());
return false;
}
auto codec = acc->searchCodecById(codecId, ring::MEDIA_ALL);
if (!codec) {
RING_ERR("can not find codec %d", codecId);
return false;
}
if (codec->systemCodecInfo.mediaType & ring::MEDIA_AUDIO) {
if (auto foundCodec = std::static_pointer_cast<ring::AccountAudioCodecInfo>(codec)) {
foundCodec->setCodecSpecifications(details);
return true;
}
}
if (codec->systemCodecInfo.mediaType & ring::MEDIA_VIDEO) {
if (auto foundCodec = std::static_pointer_cast<ring::AccountVideoCodecInfo>(codec)) {
foundCodec->setCodecSpecifications(details);
return true;
}
}
return false;
}
std::map<std::string, std::string> std::map<std::string, std::string>
getCodecDetails(const std::string& accountID, const unsigned& codecId) getCodecDetails(const std::string& accountID, const unsigned& codecId)
{ {
......
...@@ -63,6 +63,7 @@ std::vector<unsigned> getCodecList(); ...@@ -63,6 +63,7 @@ std::vector<unsigned> getCodecList();
std::vector<std::string> getSupportedTlsMethod(); std::vector<std::string> getSupportedTlsMethod();
std::vector<std::string> getSupportedCiphers(const std::string& accountID); std::vector<std::string> getSupportedCiphers(const std::string& accountID);
std::map<std::string, std::string> getCodecDetails(const std::string& accountID, const unsigned& codecId); std::map<std::string, std::string> getCodecDetails(const std::string& accountID, const unsigned& codecId);
bool setCodecDetails(const std::string& accountID, const unsigned& codecId, const std::map<std::string, std::string>& details);
std::vector<unsigned> getActiveCodecList(const std::string& accountID); std::vector<unsigned> getActiveCodecList(const std::string& accountID);
void setActiveCodecList(const std::string& accountID, const std::vector<unsigned>& list); void setActiveCodecList(const std::string& accountID, const std::vector<unsigned>& list);
......
...@@ -165,6 +165,22 @@ AccountAudioCodecInfo::getCodecSpecifications() ...@@ -165,6 +165,22 @@ AccountAudioCodecInfo::getCodecSpecifications()
}; };
} }
void
AccountAudioCodecInfo::setCodecSpecifications(const std::map<std::string, std::string>& details)
{
auto it = details.find(DRing::Account::ConfProperties::CodecInfo::BITRATE);
if (it != details.end())
bitrate = std::stoi(it->second);
it = details.find(DRing::Account::ConfProperties::CodecInfo::SAMPLE_RATE);
if (it != details.end())
audioformat.sample_rate = std::stoi(it->second);
it = details.find(DRing::Account::ConfProperties::CodecInfo::CHANNEL_NUMBER);
if (it != details.end())
audioformat.nb_channels = std::stoi(it->second);
}
bool bool
AccountAudioCodecInfo::isPCMG722() const AccountAudioCodecInfo::isPCMG722() const
{ {
...@@ -192,6 +208,18 @@ AccountVideoCodecInfo::getCodecSpecifications() ...@@ -192,6 +208,18 @@ AccountVideoCodecInfo::getCodecSpecifications()
}; };
} }
void
AccountVideoCodecInfo::setCodecSpecifications(const std::map<std::string, std::string>& details)
{
auto it = details.find(DRing::Account::ConfProperties::CodecInfo::BITRATE);
if (it != details.end())
bitrate = stoi(it->second);
it = details.find(DRing::Account::ConfProperties::CodecInfo::FRAME_RATE);
if (it != details.end())
frameRate = stoi(it->second);
}
AccountVideoCodecInfo::~AccountVideoCodecInfo() AccountVideoCodecInfo::~AccountVideoCodecInfo()
{} {}
......
...@@ -152,6 +152,7 @@ struct AccountAudioCodecInfo : AccountCodecInfo ...@@ -152,6 +152,7 @@ struct AccountAudioCodecInfo : AccountCodecInfo
~AccountAudioCodecInfo(); ~AccountAudioCodecInfo();
std::map<std::string, std::string> getCodecSpecifications(); std::map<std::string, std::string> getCodecSpecifications();
void setCodecSpecifications(const std::map<std::string, std::string>& details);
/* account custom values */ /* account custom values */
AudioFormat audioformat {AudioFormat::NONE()}; AudioFormat audioformat {AudioFormat::NONE()};
...@@ -163,6 +164,7 @@ struct AccountVideoCodecInfo : AccountCodecInfo ...@@ -163,6 +164,7 @@ struct AccountVideoCodecInfo : AccountCodecInfo
AccountVideoCodecInfo(const SystemVideoCodecInfo& sysCodecInfo); AccountVideoCodecInfo(const SystemVideoCodecInfo& sysCodecInfo);
~AccountVideoCodecInfo(); ~AccountVideoCodecInfo();
void setCodecSpecifications(const std::map<std::string, std::string>& details);
std::map<std::string, std::string> getCodecSpecifications(); std::map<std::string, std::string> getCodecSpecifications();
/* account custom values */ /* account custom values */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment