Skip to content
Snippets Groups Projects
Commit 7c0af2d2 authored by Alexandre Lision's avatar Alexandre Lision
Browse files

fix video signals

ENABLE_VIDEO was not set in qtwrapper lib
parent 00f68d7c
No related branches found
No related tags found
No related merge requests found
......@@ -17,7 +17,9 @@ FIND_PACKAGE(Qt5Core REQUIRED)
FIND_PACKAGE(Ring REQUIRED)
set(libqtwrapper_LIB_SRCS
instancemanager.cpp)
instancemanager.cpp
videomanager_wrap.cpp
)
INCLUDE_DIRECTORIES(SYSTEM ${Qt5Core_INCLUDE_DIRS} )
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
......@@ -31,4 +33,3 @@ TARGET_LINK_LIBRARIES( qtwrapper
${QT_QTCORE_LIBRARY}
${ring_BIN}
)
#include "videomanager_wrap.h"
VideoManagerInterface::VideoManagerInterface()
{
#ifdef ENABLE_VIDEO
proxy = new VideoManagerSignalProxy(this);
sender = new VideoManagerProxySender();
QObject::connect(sender,&VideoManagerProxySender::deviceEvent,proxy,&VideoManagerSignalProxy::slotDeviceEvent);
QObject::connect(sender,&VideoManagerProxySender::startedDecoding,proxy,&VideoManagerSignalProxy::slotStartedDecoding);
QObject::connect(sender,&VideoManagerProxySender::stoppedDecoding,proxy,&VideoManagerSignalProxy::slotStoppedDecoding);
using DRing::exportable_callback;
using DRing::VideoSignal;
videoHandlers = {
exportable_callback<VideoSignal::DeviceEvent>(
[this] () {
emit sender->deviceEvent();
}),
exportable_callback<VideoSignal::DecodingStarted>(
[this] (const std::string &id, const std::string &shmPath, int width, int height, bool isMixer) {
emit sender->startedDecoding(QString(id.c_str()), QString(shmPath.c_str()), width, height, isMixer);
}),
exportable_callback<VideoSignal::DecodingStopped>(
[this] (const std::string &id, const std::string &shmPath, bool isMixer) {
emit sender->stoppedDecoding(QString(id.c_str()), QString(shmPath.c_str()), isMixer);
})
};
#endif
}
VideoManagerInterface::~VideoManagerInterface()
{
}
VideoManagerSignalProxy::VideoManagerSignalProxy(VideoManagerInterface* parent) : QObject(parent), m_pParent(parent)
{}
void VideoManagerSignalProxy::slotDeviceEvent()
{
QTimer::singleShot(0, [=] {
emit m_pParent->deviceEvent();
});
}
void VideoManagerSignalProxy::slotStartedDecoding(const QString &id, const QString &shmPath, int width, int height, bool isMixer)
{
QTimer::singleShot(0, [=] {
emit m_pParent->startedDecoding(id,shmPath,width,height,isMixer);
});
}
void VideoManagerSignalProxy::slotStoppedDecoding(const QString &id, const QString &shmPath, bool isMixer)
{
QTimer::singleShot(0, [=] {
emit m_pParent->stoppedDecoding(id,shmPath,isMixer);
});
}
......@@ -20,7 +20,9 @@
#define VIDEO_DBUS_INTERFACE_H
#include <QtCore/QObject>
#include <QtCore/QCoreApplication>
#include <QtCore/QByteArray>
#include <QtCore/QThread>
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtCore/QString>
......@@ -33,6 +35,37 @@
#include "typedefs.h"
#include "conversions_wrap.hpp"
class VideoManagerInterface;
class VideoManagerSignalProxy : public QObject
{
Q_OBJECT
public:
VideoManagerSignalProxy(VideoManagerInterface* parent);
public Q_SLOTS:
void slotDeviceEvent();
void slotStartedDecoding(const QString &id, const QString &shmPath, int width, int height, bool isMixer);
void slotStoppedDecoding(const QString &id, const QString &shmPath, bool isMixer);
private:
VideoManagerInterface* m_pParent;
};
class VideoManagerProxySender : public QObject
{
Q_OBJECT
friend class VideoManagerInterface;
public:
Q_SIGNALS:
void deviceEvent();
void startedDecoding(const QString &id, const QString &shmPath, int width, int height, bool isMixer);
void stoppedDecoding(const QString &id, const QString &shmPath, bool isMixer);
};
/*
* Proxy class for interface org.ring.Ring.VideoManager
*/
......@@ -40,36 +73,20 @@ class VideoManagerInterface: public QObject
{
Q_OBJECT
friend class VideoManagerSignalProxy;
public:
VideoManagerInterface()
{
VideoManagerInterface();
~VideoManagerInterface();
#ifdef ENABLE_VIDEO
using DRing::exportable_callback;
using DRing::VideoSignal;
videoHandlers = {
exportable_callback<VideoSignal::DeviceEvent>(
[this] () {
QTimer::singleShot(0, [this] {
emit this->deviceEvent();
});
}),
exportable_callback<VideoSignal::DecodingStarted>(
[this] (const std::string &id, const std::string &shmPath, int width, int height, bool isMixer) {
QTimer::singleShot(0, [this,id, shmPath, width, height, isMixer] {
emit this->startedDecoding(QString(id.c_str()), QString(shmPath.c_str()), width, height, isMixer);
});
}),
exportable_callback<VideoSignal::DecodingStopped>(
[this] (const std::string &id, const std::string &shmPath, bool isMixer) {
QTimer::singleShot(0, [this,id, shmPath, isMixer] {
emit this->stoppedDecoding(QString(id.c_str()), QString(shmPath.c_str()), isMixer);
});
})
};
std::map<std::string, std::shared_ptr<DRing::CallbackWrapperBase>> videoHandlers;
#endif
}
~VideoManagerInterface() {}
private:
VideoManagerSignalProxy* proxy;
VideoManagerProxySender* sender;
#ifdef ENABLE_VIDEO
std::map<std::string, std::shared_ptr<DRing::CallbackWrapperBase>> videoHandlers;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment