Commit 9e3f2160 authored by Philippe Gorley's avatar Philippe Gorley Committed by Philippe Gorley

api: add way to get renderer info

Adds ability to retrieve the shm renderer info from a call id, in case
the client is launched mid call (else it can't show the call).

SinkClient now keeps track of its width and height.

Change-Id: Ie43c196c60de5e22825fc71ff404e99bbfbe9402
Gitlab: #59Reviewed-by: Sébastien Blin's avatarSebastien Blin <sebastien.blin@savoirfairelinux.com>
parent 8fa83541
......@@ -110,6 +110,17 @@
</arg>
</method>
<method name="getRenderer" tp:name-for-bindings="getRenderer">
<tp:docstring>Returns a map of information about a call's renderer.</tp:docstring>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="MapStringString"/>
<arg type="s" name="callId" direction="in">
<tp:docstring>Call ID to get info about.</tp:docstring>
</arg>
<arg type="a{ss}" name="map" direction="out">
<tp:docstring>Map containing renderer info, with empty strings and "0" if not found.</tp:docstring>
</arg>
</method>
<signal name="deviceEvent" tp:name-for-bindings="deviceEvent">
<tp:docstring>Signal triggered by changes in the detected v4l2 devices, e.g. a camera being unplugged.</tp:docstring>
</signal>
......
......@@ -97,6 +97,12 @@ DBusVideoManager::setDecodingAccelerated(const bool& state)
DRing::setDecodingAccelerated(state);
}
std::map<std::string, std::string>
DBusVideoManager::getRenderer(const std::string& callId)
{
return DRing::getRenderer(callId);
}
std::string
DBusVideoManager::startLocalRecorder(const bool& audioOnly, const std::string& filepath)
{
......
......@@ -63,6 +63,7 @@ class DRING_PUBLIC DBusVideoManager :
bool hasCameraStarted();
bool getDecodingAccelerated();
void setDecodingAccelerated(const bool& state);
std::map<std::string, std::string> getRenderer(const std::string& callId);
std::string startLocalRecorder(const bool& audioOnly, const std::string& filepath);
void stopLocalRecorder(const std::string& filepath);
};
......
......@@ -2,7 +2,7 @@ dnl Ring - configure.ac for automake 1.9 and autoconf 2.59
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.65])
AC_INIT([Ring Daemon],[7.0.0],[ring@gnu.org],[ring])
AC_INIT([Ring Daemon],[7.1.0],[ring@gnu.org],[ring])
AC_COPYRIGHT([[Copyright (c) Savoir-faire Linux 2004-2018]])
AC_REVISION([$Revision$])
......
......@@ -31,7 +31,7 @@ PROJECT_NAME = "Ring Daemon"
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = 7.0.0
PROJECT_NUMBER = 7.1.0
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer
......
......@@ -34,6 +34,7 @@
#include "video/sinkclient.h"
#include "client/ring_signal.h"
#include "audio/ringbufferpool.h"
#include "dring/media_const.h"
#include <functional>
#include <memory>
......@@ -349,6 +350,25 @@ registerSinkTarget(const std::string& sinkId, const SinkTarget& target)
RING_WARN("No sink found for id '%s'", sinkId.c_str());
}
std::map<std::string, std::string>
getRenderer(const std::string& callId)
{
if (auto sink = ring::Manager::instance().getSinkClient(callId))
return {
{DRing::Media::Details::CALL_ID, callId},
{DRing::Media::Details::SHM_PATH, sink->openedName()},
{DRing::Media::Details::WIDTH, ring::to_string(sink->getWidth())},
{DRing::Media::Details::HEIGHT, ring::to_string(sink->getHeight())},
};
else
return {
{DRing::Media::Details::CALL_ID, callId},
{DRing::Media::Details::SHM_PATH, ""},
{DRing::Media::Details::WIDTH, "0"},
{DRing::Media::Details::HEIGHT, "0"},
};
}
bool
getDecodingAccelerated()
{
......
......@@ -40,6 +40,13 @@ namespace Details {
constexpr static char MEDIA_TYPE_AUDIO[] = "MEDIA_TYPE_AUDIO";
constexpr static char MEDIA_TYPE_VIDEO[] = "MEDIA_TYPE_VIDEO";
// Renderer and Shm info
constexpr static char CALL_ID [] = "CALL_ID";
constexpr static char SHM_PATH[] = "SHM_PATH";
constexpr static char WIDTH [] = "WIDTH";
constexpr static char HEIGHT [] = "HEIGHT";
}
} //namespace DRing::Media
......
......@@ -150,6 +150,7 @@ DRING_PUBLIC bool hasCameraStarted();
DRING_PUBLIC bool switchInput(const std::string& resource);
DRING_PUBLIC bool switchToCamera();
DRING_PUBLIC void registerSinkTarget(const std::string& sinkId, const SinkTarget& target);
DRING_PUBLIC std::map<std::string, std::string> getRenderer(const std::string& callId);
DRING_PUBLIC std::string startLocalRecorder(const bool& audioOnly, const std::string& filepath);
DRING_PUBLIC void stopLocalRecorder(const std::string& filepath);
......
......@@ -365,6 +365,8 @@ SinkClient::update(Observable<std::shared_ptr<VideoFrame>>* /*obs*/,
void
SinkClient::setFrameSize(int width, int height)
{
width_ = width;
height_ = height;
if (width > 0 and height > 0) {
RING_WARN("Start sink <%s / %s>, size=%dx%d, mixer=%u",
getId().c_str(), openedName().c_str(), width, height, mixer_);
......
......@@ -54,6 +54,14 @@ class SinkClient : public VideoFramePassiveReader
std::string openedName() const noexcept;
int getWidth() const noexcept {
return width_;
}
int getHeight() const noexcept {
return height_;
}
// as VideoFramePassiveReader
void update(Observable<std::shared_ptr<ring::VideoFrame>>*,
const std::shared_ptr<ring::VideoFrame>&) override;
......@@ -70,6 +78,8 @@ class SinkClient : public VideoFramePassiveReader
private:
const std::string id_;
const bool mixer_;
int width_ {0};
int height_ {0};
bool started_ {false}; // used to arbitrate client's stop signal.
DRing::SinkTarget target_;
std::unique_ptr<VideoScaler> scaler_;
......
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