Commit 36e0124a authored by Vivien Didelot's avatar Vivien Didelot Committed by Tristan Matthews

daemon: rename VideoControls to VideoManager

This patch renames the VideoControls class to VideoManager, for
consistency with the other client's *Manager classes.

Refs #46643

Change-Id: If98730f666a5375f73d2d86c6e3be9f4970c81bd
parent 3e054dea
......@@ -13,8 +13,8 @@ noinst_HEADERS += presencemanager.h
endif
if SFL_VIDEO
VIDEO_STUB = videocontrols_stub.cpp
noinst_HEADERS += video_controls.h
VIDEO_STUB = videomanager_stub.cpp
noinst_HEADERS += videomanager.h
endif
if USE_DBUS
......
......@@ -49,7 +49,7 @@ Client::Client() : callManager_(new CallManager)
, dispatcher_(0)
#endif
#ifdef SFL_VIDEO
, videoControls_(0)
, videoManager_(0)
#endif
#ifdef USE_NETWORKMANAGER
, networkManager_(0)
......@@ -62,7 +62,7 @@ Client::~Client()
delete networkManager_;
#endif
#ifdef SFL_VIDEO
delete videoControls_;
delete videoManager_;
#endif
#if HAVE_DBUS
delete dispatcher_;
......@@ -103,8 +103,8 @@ PresenceManager * Client::getPresenceManager()
#endif
#ifdef SFL_VIDEO
VideoControls * Client::getVideoControls()
VideoManager * Client::getVideoManager()
{
return videoControls_;
return videoManager_;
}
#endif
......@@ -46,7 +46,7 @@ class PresenceManager;
#endif
#ifdef SFL_VIDEO
class VideoControls;
class VideoManager;
#endif
#if HAVE_DBUS
......@@ -69,7 +69,7 @@ class Client {
#endif
#ifdef SFL_VIDEO
VideoControls* getVideoControls();
VideoManager* getVideoManager();
#endif
int event_loop();
......@@ -87,7 +87,7 @@ class Client {
DBus::BusDispatcher* dispatcher_;
#endif
#ifdef SFL_VIDEO
VideoControls *videoControls_;
VideoManager *videoManager_;
#endif
#if USE_NETWORKMANAGER
NetworkManager* networkManager_;
......
......@@ -14,8 +14,8 @@ presencemanager-glue.h: presencemanager-introspec.xml Makefile.am
endif
if SFL_VIDEO
BUILT_SOURCES+=video_controls-glue.h
video_controls-glue.h: video_controls-introspec.xml Makefile.am
BUILT_SOURCES+=videomanager-glue.h
videomanager-glue.h: videomanager-introspec.xml Makefile.am
dbusxx-xml2cpp $< --adaptor=$@
endif
......@@ -42,7 +42,7 @@ libclient_dbus_la_SOURCES += presencemanager_dbus.cpp
endif
if SFL_VIDEO
libclient_dbus_la_SOURCES += video_controls.cpp
libclient_dbus_la_SOURCES += videomanager_dbus.cpp
endif
if USE_NETWORKMANAGER
......@@ -83,7 +83,7 @@ EXTRA_DIST += presencemanager-introspec.xml
endif
if SFL_VIDEO
EXTRA_DIST += video_controls-introspec.xml
EXTRA_DIST += videomanager-introspec.xml
endif
CLEANFILES= \
......
......@@ -50,7 +50,7 @@
#endif
#ifdef SFL_VIDEO
#include "video_controls.h"
#include "videomanager.h"
#endif
struct DummyCallback : DBus::Callback_Base<void, DBus::DefaultTimeout&>
......@@ -66,7 +66,7 @@ Client::Client() : callManager_(0)
, instanceManager_(0)
, dispatcher_(new DBus::BusDispatcher)
#ifdef SFL_VIDEO
, videoControls_(0)
, videoManager_(0)
#endif
#ifdef USE_NETWORKMANAGER
, networkManager_(0)
......@@ -103,7 +103,7 @@ Client::Client() : callManager_(0)
instanceManager_ = new Instance(sessionConnection);
#ifdef SFL_VIDEO
videoControls_ = new VideoControls(sessionConnection);
videoManager_ = new VideoManager(sessionConnection);
#endif
#ifdef USE_NETWORKMANAGER
......@@ -128,7 +128,7 @@ Client::~Client()
delete networkManager_;
#endif
#ifdef SFL_VIDEO
delete videoControls_;
delete videoManager_;
#endif
delete instanceManager_;
#ifdef SFL_PRESENCE
......@@ -189,9 +189,9 @@ Client::getPresenceManager()
#endif
#ifdef SFL_VIDEO
VideoControls*
Client::getVideoControls()
VideoManager*
Client::getVideoManager()
{
return videoControls_;
return videoManager_;
}
#endif
<?xml version="1.0" ?>
<node name="/video_controls-introspec" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
<interface name="org.sflphone.SFLphone.VideoControls">
<node name="/videomanager-introspec" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
<interface name="org.sflphone.SFLphone.VideoManager">
<!-- Video device methods -->
<method name="getDeviceList" tp:name-for-bindings="getDeviceList">
......
......@@ -30,7 +30,7 @@
* as that of the covered work.
*/
#include "video_controls.h"
#include "videomanager.h"
#include "video/libav_utils.h"
#include "video/video_input_selector.h"
#include "account.h"
......@@ -38,10 +38,10 @@
#include "manager.h"
namespace {
const char * const SERVER_PATH = "/org/sflphone/SFLphone/VideoControls";
const char * const SERVER_PATH = "/org/sflphone/SFLphone/VideoManager";
}
VideoControls::VideoControls(DBus::Connection& connection) :
VideoManager::VideoManager(DBus::Connection& connection) :
DBus::ObjectAdaptor(connection, SERVER_PATH)
, videoInputSelector_()
, videoPreference_()
......@@ -52,13 +52,13 @@ VideoControls::VideoControls(DBus::Connection& connection) :
}
VideoPreference &
VideoControls::getVideoPreferences()
VideoManager::getVideoPreferences()
{
return videoPreference_;
}
std::vector<std::map<std::string, std::string> >
VideoControls::getCodecs(const std::string &accountID)
VideoManager::getCodecs(const std::string &accountID)
{
Account *acc = Manager::instance().getAccount(accountID);
......@@ -69,7 +69,7 @@ VideoControls::getCodecs(const std::string &accountID)
}
void
VideoControls::setCodecs(const std::string& accountID,
VideoManager::setCodecs(const std::string& accountID,
const std::vector<std::map<std::string, std::string> > &details)
{
Account *acc = Manager::instance().getAccount(accountID);
......@@ -80,90 +80,90 @@ VideoControls::setCodecs(const std::string& accountID,
}
std::vector<std::string>
VideoControls::getDeviceList()
VideoManager::getDeviceList()
{
return videoPreference_.getDeviceList();
}
std::vector<std::string>
VideoControls::getDeviceChannelList(const std::string &dev)
VideoManager::getDeviceChannelList(const std::string &dev)
{
return videoPreference_.getChannelList(dev);
}
std::vector<std::string>
VideoControls::getDeviceSizeList(const std::string &dev, const std::string &channel)
VideoManager::getDeviceSizeList(const std::string &dev, const std::string &channel)
{
return videoPreference_.getSizeList(dev, channel);
}
std::vector<std::string>
VideoControls::getDeviceRateList(const std::string &dev, const std::string &channel, const std::string &size)
VideoManager::getDeviceRateList(const std::string &dev, const std::string &channel, const std::string &size)
{
return videoPreference_.getRateList(dev, channel, size);
}
std::string
VideoControls::getActiveDevice()
VideoManager::getActiveDevice()
{
return videoPreference_.getDevice();
}
std::string
VideoControls::getActiveDeviceChannel()
VideoManager::getActiveDeviceChannel()
{
return videoPreference_.getChannel();
}
std::string
VideoControls::getActiveDeviceSize()
VideoManager::getActiveDeviceSize()
{
return videoPreference_.getSize();
}
std::string
VideoControls::getActiveDeviceRate()
VideoManager::getActiveDeviceRate()
{
return videoPreference_.getRate();
}
void
VideoControls::setActiveDevice(const std::string &device)
VideoManager::setActiveDevice(const std::string &device)
{
DEBUG("Setting device to %s", device.c_str());
videoPreference_.setDevice(device);
}
void
VideoControls::setActiveDeviceChannel(const std::string &channel)
VideoManager::setActiveDeviceChannel(const std::string &channel)
{
videoPreference_.setChannel(channel);
}
void
VideoControls::setActiveDeviceSize(const std::string &size)
VideoManager::setActiveDeviceSize(const std::string &size)
{
videoPreference_.setSize(size);
}
void
VideoControls::setActiveDeviceRate(const std::string &rate)
VideoManager::setActiveDeviceRate(const std::string &rate)
{
videoPreference_.setRate(rate);
}
std::map<std::string, std::string>
VideoControls::getSettingsFor(const std::string& device) {
VideoManager::getSettingsFor(const std::string& device) {
return videoPreference_.getSettingsFor(device);
}
std::map<std::string, std::string>
VideoControls::getSettings() {
VideoManager::getSettings() {
return videoPreference_.getSettings();
}
void
VideoControls::startCamera()
VideoManager::startCamera()
{
inputClients_++;
if (hasCameraStarted()) {
......@@ -176,7 +176,7 @@ VideoControls::startCamera()
}
void
VideoControls::stopCamera()
VideoManager::stopCamera()
{
if (hasCameraStarted()) {
DEBUG("Stopping video preview");
......@@ -189,7 +189,7 @@ VideoControls::stopCamera()
}
bool
VideoControls::switchInput(const std::string &resource)
VideoManager::switchInput(const std::string &resource)
{
if (not hasCameraStarted()) {
ERROR("Input selector not initialized");
......@@ -200,20 +200,20 @@ VideoControls::switchInput(const std::string &resource)
}
std::weak_ptr<sfl_video::VideoFrameActiveWriter>
VideoControls::getVideoCamera()
VideoManager::getVideoCamera()
{
return videoInputSelector_;
}
bool
VideoControls::hasCameraStarted()
VideoManager::hasCameraStarted()
{
// see http://stackoverflow.com/a/7580064/21185
return static_cast<bool>(videoInputSelector_);
}
std::string
VideoControls::getCurrentCodecName(const std::string & /*callID*/)
VideoManager::getCurrentCodecName(const std::string & /*callID*/)
{
return "";
}
......@@ -27,8 +27,8 @@
* as that of the covered work.
*/
#ifndef VIDEO_CONTROLS_H_
#define VIDEO_CONTROLS_H_
#ifndef VIDEOMANAGER_H_
#define VIDEOMANAGER_H_
#ifdef HAVE_CONFIG_H
#include "config.h"
......@@ -44,7 +44,7 @@
#pragma GCC diagnostic ignored "-Wignored-qualifiers"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#include "dbus/video_controls-glue.h"
#include "dbus/videomanager-glue.h"
#pragma GCC diagnostic warning "-Wignored-qualifiers"
#pragma GCC diagnostic warning "-Wunused-parameter"
......@@ -60,9 +60,9 @@
#include "video/video_base.h"
#include "video/video_input_selector.h"
class VideoControls
class VideoManager
#if HAVE_DBUS
: public org::sflphone::SFLphone::VideoControls_adaptor,
: public org::sflphone::SFLphone::VideoManager_adaptor,
public DBus::IntrospectableAdaptor,
public DBus::ObjectAdaptor
#endif
......@@ -75,9 +75,9 @@ class VideoControls
public:
#if HAVE_DBUS
VideoControls(DBus::Connection& connection);
VideoManager(DBus::Connection& connection);
#else
VideoControls();
VideoManager();
#endif
VideoPreference &getVideoPreferences();
......@@ -148,4 +148,4 @@ class VideoControls
#endif // !HAVE_DBUS
};
#endif // VIDEO_CONTROLS_H_
#endif // VIDEOMANAGER_H_
......@@ -30,47 +30,47 @@
#warning Using a stub file will produce a non working application
#include "client/video_controls.h"
#include "client/videomanager.h"
VideoControls::VideoControls()
VideoManager::VideoManager()
{}
VideoPreference& VideoControls::getVideoPreferences()
VideoPreference& VideoManager::getVideoPreferences()
{
}
void VideoControls::deviceEvent()
void VideoManager::deviceEvent()
{
}
void VideoControls::startedDecoding(const std::string &id, const std::string,
void VideoManager::startedDecoding(const std::string &id, const std::string,
int w, int h)
{
}
void VideoControls::stoppedDecoding(const std::string &id, const std::string)
void VideoManager::stoppedDecoding(const std::string &id, const std::string)
{
}
std::map<std::string, std::string> VideoControls::getSettings()
std::map<std::string, std::string> VideoManager::getSettings()
{
return std::map<std::string, std::string>();
}
bool VideoControls::hasCameraStarted()
bool VideoManager::hasCameraStarted()
{
return false;
}
void VideoControls::startCamera()
void VideoManager::startCamera()
{
}
void VideoControls::stopCamera()
void VideoManager::stopCamera()
{
}
std::weak_ptr<sfl_video::VideoFrameActiveWriter> VideoControls::getVideoCamera()
std::weak_ptr<sfl_video::VideoFrameActiveWriter> VideoManager::getVideoCamera()
{
return std::weak_ptr<sfl_video::VideoFrameActiveWriter>();
}
......@@ -39,7 +39,7 @@
#ifdef SFL_VIDEO
#include "sip/sipvoiplink.h"
#include "sip/sipcall.h"
#include "client/video_controls.h"
#include "client/videomanager.h"
#include "video/video_input.h"
#endif
......
......@@ -74,7 +74,7 @@
#include "client/callmanager.h"
#ifdef SFL_VIDEO
#include "client/video_controls.h"
#include "client/videomanager.h"
#endif
#include "conference.h"
......@@ -1370,7 +1370,7 @@ void ManagerImpl::saveConfig()
hookPreference.serialize(emitter);
audioPreference.serialize(emitter);
#ifdef SFL_VIDEO
getVideoControls()->getVideoPreferences().serialize(emitter);
getVideoManager()->getVideoPreferences().serialize(emitter);
#endif
shortcutPreferences.serialize(emitter);
......@@ -2615,7 +2615,7 @@ int ManagerImpl::loadAccountMap(Conf::YamlParser &parser)
int errorCount = 0;
#ifdef SFL_VIDEO
VideoControls *controls(getVideoControls());
VideoManager *controls(getVideoManager());
try {
MappingNode *videoNode = parser.getVideoNode();
if (videoNode)
......@@ -2955,9 +2955,9 @@ ManagerImpl::getClient()
}
#ifdef SFL_VIDEO
VideoControls *
ManagerImpl::getVideoControls()
VideoManager *
ManagerImpl::getVideoManager()
{
return client_.getVideoControls();
return client_.getVideoManager();
}
#endif
......@@ -945,7 +945,7 @@ class ManagerImpl {
*/
Client* getClient();
#ifdef SFL_VIDEO
VideoControls * getVideoControls();
VideoManager * getVideoManager();
#endif
/**
......
......@@ -37,7 +37,7 @@
#include "sdp.h"
#include "manager.h"
#ifdef SFL_VIDEO
#include "client/video_controls.h"
#include "client/videomanager.h"
#endif
namespace {
......@@ -52,7 +52,7 @@ SIPCall::SIPCall(const std::string& id, Call::CallType type,
, audiortp_(this)
#ifdef SFL_VIDEO
// The ID is used to associate video streams to calls
, videortp_(id, Manager::instance().getClient()->getVideoControls()->getSettings())
, videortp_(id, Manager::instance().getClient()->getVideoManager()->getSettings())
#endif
, pool_(pj_pool_create(&caching_pool->factory, id.c_str(), INITIAL_SIZE, INCREMENT_SIZE, NULL))
, local_sdp_(new Sdp(pool_))
......
......@@ -59,7 +59,7 @@
#ifdef SFL_VIDEO
#include "video/video_rtp_session.h"
#include "client/video_controls.h"
#include "client/videomanager.h"
#endif
#include "client/client.h"
......
......@@ -34,7 +34,7 @@
#include "check.h"
#include "manager.h"
#include "client/video_controls.h"
#include "client/videomanager.h"
#include <map>
#include <string>
......@@ -117,7 +117,7 @@ bool VideoInput::setup()
/* Sink setup */
EXIT_IF_FAIL(sink_.start(), "Cannot start shared memory sink");
if (attach(&sink_)) {
Manager::instance().getVideoControls()->startedDecoding(id_, sink_.openedName(),
Manager::instance().getVideoManager()->startedDecoding(id_, sink_.openedName(),
decoder_->getWidth(), decoder_->getHeight());
DEBUG("LOCAL: shm sink <%s> started: size = %dx%d",
sink_.openedName().c_str(), decoder_->getWidth(), decoder_->getHeight());
......@@ -132,7 +132,7 @@ void VideoInput::process()
void VideoInput::cleanup()
{
if (detach(&sink_)) {
Manager::instance().getVideoControls()->stoppedDecoding(id_, sink_.openedName());
Manager::instance().getVideoManager()->stoppedDecoding(id_, sink_.openedName());
sink_.stop();
}
......
......@@ -33,7 +33,7 @@
#include "check.h"
#include "manager.h"
#include "client/video_controls.h"
#include "client/videomanager.h"
#include <unistd.h>
......@@ -83,7 +83,7 @@ static std::map<std::string, std::string>
initCamera(const std::string& device)
{
std::map<std::string, std::string> map =
Manager::instance().getVideoControls()->getSettingsFor(device);
Manager::instance().getVideoManager()->getSettingsFor(device);
map["format"] = "video4linux2";
map["mirror"] = "true"; // only the key matters
......
......@@ -32,7 +32,7 @@
#include "libav_deps.h"
#include "video_mixer.h"
#include "check.h"
#include "client/video_controls.h"
#include "client/videomanager.h"
#include "manager.h"
#include "logger.h"
......@@ -51,7 +51,7 @@ VideoMixer::VideoMixer(const std::string &id) :
, mutex_()
, sink_(id + VIDEO_MIXER_SUFFIX)
{
auto videoCtrl = Manager::instance().getVideoControls();
auto videoCtrl = Manager::instance().getVideoManager();
if (!videoCtrl->hasCameraStarted()) {
videoCtrl->startCamera();
MYSLEEP(1);
......@@ -64,7 +64,7 @@ VideoMixer::VideoMixer(const std::string &id) :
VideoMixer::~VideoMixer()
{
auto videoCtrl = Manager::instance().getVideoControls();
auto videoCtrl = Manager::instance().getVideoManager();
if (auto shared = videoCtrl->getVideoCamera().lock())
shared->detach(this);
stop_sink();
......@@ -144,7 +144,7 @@ void VideoMixer::start_sink()
{
if (sink_.start()) {
if (this->attach(&sink_)) {
Manager::instance().getVideoControls()->startedDecoding(id_, sink_.openedName(), width_, height_);
Manager::instance().getVideoManager()->startedDecoding(id_, sink_.openedName(), width_, height_);
DEBUG("MX: shm sink <%s> started: size = %dx%d",
sink_.openedName().c_str(), width_, height_);
}
......@@ -155,7 +155,7 @@ void VideoMixer::start_sink()
void VideoMixer::stop_sink()
{
if (this->detach(&sink_)) {
Manager::instance().getVideoControls()->stoppedDecoding(id_, sink_.openedName());
Manager::instance().getVideoManager()->stoppedDecoding(id_, sink_.openedName());
sink_.stop();
}
}
......
......@@ -35,7 +35,7 @@
#include "video_receive_thread.h"
#include "socket_pair.h"
#include "manager.h"
#include "client/video_controls.h"
#include "client/videomanager.h"
#include "check.h"
#include <unistd.h>
......@@ -154,7 +154,7 @@ void VideoReceiveThread::process()
void VideoReceiveThread::cleanup()
{
if (detach(&sink_))
Manager::instance().getVideoControls()->stoppedDecoding(id_, sink_.openedName());
Manager::instance().getVideoManager()->stoppedDecoding(id_, sink_.openedName());
sink_.stop();
if (videoDecoder_)
......@@ -214,7 +214,7 @@ void VideoReceiveThread::enterConference()
return;
if (detach(&sink_)) {
Manager::instance().getVideoControls()->stoppedDecoding(id_, sink_.openedName());
Manager::instance().getVideoManager()->stoppedDecoding(id_, sink_.openedName());
DEBUG("RX: shm sink <%s> detached", sink_.openedName().c_str());
}
}
......@@ -226,7 +226,7 @@ void VideoReceiveThread::exitConference()
if (dstWidth_ > 0 && dstHeight_ > 0) {
if (attach(&sink_)) {
Manager::instance().getVideoControls()->startedDecoding(id_, sink_.openedName(), dstWidth_, dstHeight_);
Manager::instance().getVideoManager()->startedDecoding(id_, sink_.openedName(), dstWidth_, dstHeight_);
DEBUG("RX: shm sink <%s> started: size = %dx%d",
sink_.openedName().c_str(), dstWidth_, dstHeight_);
}
......
......@@ -29,7 +29,7 @@
* as that of the covered work.
*/
#include "client/video_controls.h"
#include "client/videomanager.h"
#include "video_rtp_session.h"
#include "video_sender.h"
#include "video_receive_thread.h"
......@@ -145,7 +145,7 @@ void VideoRtpSession::start(int localPort)
if (sending_) {
// Local video startup if needed
auto videoCtrl = Manager::instance().getVideoControls();
auto videoCtrl = Manager::instance().getVideoManager();
const bool firstStart = not videoCtrl->hasCameraStarted();
videoCtrl->startCamera();
if (firstStart)
......@@ -214,7 +214,7 @@ void VideoRtpSession::stop()
receiveThread_.reset();
sender_.reset();
socketPair_.reset();
auto videoCtrl = Manager::instance().getVideoControls();
auto videoCtrl = Manager::instance().getVideoManager();
videoCtrl->stopCamera();
}
......
......@@ -32,7 +32,7 @@
#include "video_sender.h"
#include "video_mixer.h"
#include "socket_pair.h"
#include "client/video_controls.h"
#include "client/videomanager.h"
#include "check.h"
#include "manager.h"
......
......@@ -51,7 +51,7 @@ extern "C" {
#include "video_v4l2_list.h"
#include "manager.h"
#include "client/video_controls.h"
#include "client/videomanager.h"
namespace sfl_video {
......@@ -243,7 +243,7 @@ void VideoV4l2ListThread::run()
DEBUG("udev: adding %s", node);
try {
if (addDevice(node)) {
Manager::instance().getVideoControls()->deviceEvent();
Manager::instance().getVideoManager()->deviceEvent();
}
} catch (const std::runtime_error &e) {
ERROR("%s", e.what());
......@@ -280,7 +280,7 @@ void VideoV4l2ListThread::delDevice(const string &node)
if (itr != devices_.end()) {
devices_.erase(itr);
Manager::instance().getVideoControls()->deviceEvent();
Manager::instance().getVideoManager()->deviceEvent();
}
}
......
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