Commit 27625f2a authored by Philippe Gorley's avatar Philippe Gorley Committed by Adrien Béraud

api: add hardware encoding

Also adds hardware decoding to nodejs and jni APIs.

Change-Id: I2a89f2d9e09b597df0ec449e69e8e7b84bea5552
parent 805e8052
......@@ -117,6 +117,20 @@
</arg>
</method>
<method name="getEncodingAccelerated" tp:name-for-bindings="getEncodingAccelerated">
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="Bool"/>
<arg type="b" name="state" direction="out">
<tp:docstring>Returns true if hardware encoding is enabled, false otherwise</tp:docstring>
</arg>
</method>
<method name="setEncodingAccelerated" tp:name-for-bindings="setEncodingAccelerated">
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="Bool"/>
<arg type="b" name="state" direction="in">
<tp:docstring>Toggle hardware encoding</tp:docstring>
</arg>
</method>
<method name="setDeviceOrientation" tp:name-for-bindings="setDeviceOrientation">
<arg type="s" name="name" direction="in">
<tp:docstring>Device name</tp:docstring>
......
......@@ -109,6 +109,18 @@ DBusVideoManager::setDecodingAccelerated(const bool& state)
DRing::setDecodingAccelerated(state);
}
auto
DBusVideoManager::getEncodingAccelerated() -> decltype(DRing::getEncodingAccelerated())
{
return DRing::getEncodingAccelerated();
}
void
DBusVideoManager::setEncodingAccelerated(const bool& state)
{
DRing::setEncodingAccelerated(state);
}
void
DBusVideoManager::setDeviceOrientation(const std::string& name, const int& angle)
{
......
......@@ -65,6 +65,8 @@ class DRING_PUBLIC DBusVideoManager :
bool hasCameraStarted();
bool getDecodingAccelerated();
void setDecodingAccelerated(const bool& state);
bool getEncodingAccelerated();
void setEncodingAccelerated(const bool& state);
void setDeviceOrientation(const std::string& name, const int& angle);
std::map<std::string, std::string> getRenderer(const std::string& callId);
std::string startLocalRecorder(const bool& audioOnly, const std::string& filepath);
......
......@@ -51,6 +51,10 @@ public:
virtual void decodingStopped(const std::string& id, const std::string& shm_path, bool is_mixer) {}
virtual std::string startLocalRecorder(const bool& audioOnly, const std::string& filepath) {}
virtual void stopLocalRecorder(const std::string& filepath) {}
virtual bool getDecodingAccelerated() {}
virtual void setDecodingAccelerated(bool state) {}
virtual bool getEncodingAccelerated() {}
virtual void setEncodingAccelerated(bool state) {}
virtual void setDeviceOrientation(const std::string&, int angle) {}
};
%}
......@@ -407,6 +411,10 @@ void setDeviceOrientation(const std::string& name, int angle);
uint8_t* obtainFrame(int length);
void releaseFrame(uint8_t* frame);
void registerSinkTarget(const std::string& sinkId, const DRing::SinkTarget& target);
bool getDecodingAccelerated();
void setDecodingAccelerated(bool state);
bool getEncodingAccelerated();
void setEncodingAccelerated(bool state);
}
class VideoCallback {
......
......@@ -38,6 +38,10 @@ public:
virtual void decodingStopped(const std::string& id, const std::string& shm_path, bool is_mixer) {}
virtual std::string startLocalRecorder(const bool& audioOnly, const std::string& filepath) {}
virtual void stopLocalRecorder(const std::string& filepath) {}
virtual bool getDecodingAccelerated() {}
virtual void setDecodingAccelerated(bool state) {}
virtual bool getEncodingAccelerated() {}
virtual void setEncodingAccelerated(bool state) {}
virtual void setDeviceOrientation(const std::string& name, int angle) {}
};
%}
......@@ -60,6 +64,10 @@ std::map<std::string, std::string> getSettings(const std::string& name);
void applySettings(const std::string& name, const std::map<std::string, std::string>& settings);
void registerSinkTarget(const std::string& sinkId, const DRing::SinkTarget& target);
bool getDecodingAccelerated();
void setDecodingAccelerated(bool state);
bool getEncodingAccelerated();
void setEncodingAccelerated(bool state);
void setDeviceOrientation(const std::string& name, int angle);
}
......
......@@ -546,6 +546,25 @@ setDecodingAccelerated(bool state)
#endif
}
bool
getEncodingAccelerated()
{
#ifdef RING_ACCEL
return ring::Manager::instance().videoPreferences.getEncodingAccelerated();
#else
return false;
#endif
}
void
setEncodingAccelerated(bool state)
{
#ifdef RING_ACCEL
RING_DBG("%s hardware acceleration", (state ? "Enabling" : "Disabling"));
ring::Manager::instance().videoPreferences.setEncodingAccelerated(state);
#endif
}
#if defined(__ANDROID__) || defined(RING_UWP) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
void
addVideoDevice(const std::string &node, std::vector<std::map<std::string, std::string>> const * devInfo)
......
......@@ -195,6 +195,8 @@ DRING_PUBLIC void publishFrame();
DRING_PUBLIC bool getDecodingAccelerated();
DRING_PUBLIC void setDecodingAccelerated(bool state);
DRING_PUBLIC bool getEncodingAccelerated();
DRING_PUBLIC void setEncodingAccelerated(bool state);
// Video signal type definitions
struct DRING_PUBLIC VideoSignal {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment