diff --git a/src/Account.cpp b/src/Account.cpp index 301810123d088f86f701d4adc6d9d9ea2345e633..7359247a3175580681e42bd5edf90675ae80c1ee 100644 --- a/src/Account.cpp +++ b/src/Account.cpp @@ -27,9 +27,11 @@ //SFLPhone #include "sflphone_const.h" +#include "VideoCodec.h" //SFLPhone lib #include "configurationmanager_interface_singleton.h" +#include "video_interface_singleton.h" ///Match state name to user readable string const QString& account_state_name(const QString& s) @@ -249,4 +251,29 @@ bool Account::operator==(const Account& a)const return *m_pAccountId == *a.m_pAccountId; } +/***************************************************************************** + * * + * Video * + * * + ****************************************************************************/ +#ifdef ENABLE_VIDEO +void Account::setActiveVideoCodecList(QList<VideoCodec*> codecs) +{ + QStringList codecs; + VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + foreach(VideoCodec* codec,codecs) { + codecs << codecs->getName(); + } + interface.setActiveCodecList(codecs,m_pAccountId); +} + +QList<VideoCodec*> Account::getActiveVideoCodecList() +{ + QList<VideoCodec*> codecs; + VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + foreach (QString codec, interface.getActiveCodecList(m_pAccountId)) { + codecs << VideoCodec::getCodec(codec); + } +} +#endif \ No newline at end of file diff --git a/src/Account.h b/src/Account.h index 0ed07591e3f8753ec00124d9302593e835af9ccb..a228c0087f079637b57d43050fc9e8ad5554bcc5 100644 --- a/src/Account.h +++ b/src/Account.h @@ -21,9 +21,14 @@ #ifndef ACCOUNT_H #define ACCOUNT_H +#include <QtCore/QList> + //Qt class QString; +//SFLPhone +#include "VideoCodec.h" + #include "typedefs.h" const QString& account_state_name(const QString& s); @@ -52,6 +57,10 @@ class LIB_EXPORT Account : public QObject { void setAccountId (const QString& id ); void setAccountDetails (const MapStringString& m ); void setAccountDetail (const QString& param, const QString& val ); + #ifdef ENABLE_VIDEO + void setActiveVideoCodecList(QList<VideoCodec*> codecs); + QList<VideoCodec*> getActiveVideoCodecList(); + #endif //Updates virtual void updateState(); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3db06e46222025221271cb49ff41cf8d14a01202..fdc6c4419062f917bf9afbf312504fa497de660b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -33,9 +33,14 @@ set( qtsflphone_LIB_SRCS Contact.cpp ContactBackend.cpp Item.cpp + VideoCodec.cpp + VideoModel.cpp + VideoDevice.cpp configurationmanager_interface_singleton.cpp callmanager_interface_singleton.cpp instance_interface_singleton.cpp + video_interface_singleton.cpp + video_interface_singleton.cpp sflphone_const.h ) @@ -70,6 +75,20 @@ QT4_ADD_DBUS_INTERFACE( ${callmanager_xml} callmanager_dbus_interface) +# video manager interface +SET ( video_xml ${dbus_xml_introspecs_path}/video_controls-introspec.xml ) + +SET_SOURCE_FILES_PROPERTIES( + ${video_xml} + PROPERTIES + CLASSNAME VideoInterface + INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/dbus/metatypes.h") + +QT4_ADD_DBUS_INTERFACE( + qtsflphone_LIB_SRCS + ${video_xml} + video_dbus_interface) + # instance interface SET ( instance_xml ${dbus_xml_introspecs_path}/instance-introspec.xml ) diff --git a/src/Call.cpp b/src/Call.cpp index c04a8d5bc22eebd39b0c1bd72b02e9752373f71c..7d11ef8cb43e58334acd56b9e95b04822beecc4f 100644 --- a/src/Call.cpp +++ b/src/Call.cpp @@ -613,9 +613,6 @@ call_state Call::stateChanged(const QString& newStateName) call_state Call::actionPerformed(call_action action) { call_state previousState = m_CurrentState; - Q_ASSERT_X((previousState>10) || (previousState<0),"perform action","Invalid previous state ("+QString::number(previousState)+")"); - Q_ASSERT_X((state>4) || (state < 0),"perform action","Invalid action ("+QString::number(action)+")"); - Q_ASSERT_X((action>5) || (action < 0),"perform action","Invalid action ("+QString::number(action)+")"); //update the state if (previousState < 13 && action < 5) { changeCurrentState(actionPerformedStateMap[previousState][action]); diff --git a/src/VideoCodec.cpp b/src/VideoCodec.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d3e1c7befd8895ead483896ff06dfffd9b85617d --- /dev/null +++ b/src/VideoCodec.cpp @@ -0,0 +1,64 @@ +/************************************************************************************ + * Copyright (C) 2012 by Savoir-Faire Linux * + * Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***********************************************************************************/ +#include "VideoCodec.h" +#include "Call.h" +#include "video_interface_singleton.h" + +QHash<QString,VideoCodec*> VideoCodec::m_slCodecs; + +///Private constructor +VideoCodec::VideoCodec(QString codecName) +{ + VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + QStringList details = interface.getCodecDetails(codecName); + m_Name = details[0];//TODO do not use stringlist + m_Id = details[1];//TODO do not use stringlist +} + +///Get a codec from a name +VideoCodec* VideoCodec::getCodec(QString name) +{ + return m_slCodecs[name]; +} + +///Get the current call codec +//TODO move to call.h? +VideoCodec* VideoCodec::getCurrentCodec(Call* call) +{ + VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + return getCodec(interface.getCurrentCodecName(call->getCallId())); +} + +///Get the complete video codec list +QList<VideoCodec*> VideoCodec::getCodecList() +{ + return m_slCodecs.values(); +} + +///Get the current codec name +QString VideoCodec::getCodecName() +{ + return m_Name; +} + +///Get the current codec id +QString VideoCodec::getCodecId() +{ + return m_Id; +} \ No newline at end of file diff --git a/src/VideoCodec.h b/src/VideoCodec.h new file mode 100644 index 0000000000000000000000000000000000000000..f3283a2cc0efb3667f124b07e8065e047c6a6b25 --- /dev/null +++ b/src/VideoCodec.h @@ -0,0 +1,44 @@ +/************************************************************************************ + * Copyright (C) 2012 by Savoir-Faire Linux * + * Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***********************************************************************************/ +#ifndef VIDEO_CODEC_H +#define VIDEO_CODEC_H + +#include "typedefs.h" + +//Qt +class QString; + +//SFLPhone +class Call; + +///@class VideoCodec Codecs used for video calls +class LIB_EXPORT VideoCodec { + public: + static VideoCodec* getCodec(QString name); + static VideoCodec* getCurrentCodec(Call* call); + static QList<VideoCodec*> getCodecList(); + QString getCodecName(); + QString getCodecId(); //Is the second field the ID? + private: + static QHash<QString,VideoCodec*> m_slCodecs; + VideoCodec(QString codecName); + QString m_Name; + QString m_Id; +}; +#endif \ No newline at end of file diff --git a/src/VideoDevice.cpp b/src/VideoDevice.cpp new file mode 100644 index 0000000000000000000000000000000000000000..94d09bbb3430637a2a7c271bbef6c23940346cf1 --- /dev/null +++ b/src/VideoDevice.cpp @@ -0,0 +1,96 @@ +/************************************************************************************ + * Copyright (C) 2012 by Savoir-Faire Linux * + * Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***********************************************************************************/ +#include "VideoDevice.h" +#include "video_interface_singleton.h" + +QList<VideoDevice*> VideoDevice::getDeviceList() +{ + QList<VideoDevice*> list; + VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + QStringList deviceList = interface.getInputDeviceList(); + foreach(QString device,deviceList) { + VideoDevice* dev = new VideoDevice(device); + list << dev; + } + return list; +} + +VideoDevice::VideoDevice(QString id) : m_DeviceId(id) +{ + +} + +QStringList VideoDevice::getRateList(VideoChannel channel, Resolution resolution) +{ + VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + return interface.getInputDeviceRateList(m_DeviceId,channel,resolution.toString()); +} + +QList<VideoChannel> VideoDevice::getChannelList() +{ + VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + return interface.getInputDeviceChannelList(m_DeviceId); +} + +void VideoDevice::setRate(VideoRate rate) +{ + VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + interface.setInputDeviceRate(rate); +} + +void VideoDevice::setResolution(Resolution resolution) //??? No device +{ + VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + interface.setInputDeviceSize(resolution.toString()); +} + +void VideoDevice::setChannel(VideoChannel channel) //??? No device +{ + VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + interface.setInputDeviceChannel(channel); +} + +Resolution VideoDevice::getResolution() +{ + VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + return Resolution(interface.getInputDeviceSize()); +} + +VideoChannel VideoDevice::getChannel() //??? No device +{ + VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + return interface.getInputDeviceChannel(); +} + +VideoRate VideoDevice::getRate() +{ + VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + return interface.getInputDeviceRate(); +} + +QList<Resolution> VideoDevice::getResolutionList(VideoChannel channel) +{ + QList<Resolution> toReturn; + VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + QStringList list = interface.getInputDeviceSizeList(m_DeviceId,channel); + foreach(QString res,list) { + toReturn << Resolution(res); + } + return toReturn; +} diff --git a/src/VideoDevice.h b/src/VideoDevice.h new file mode 100644 index 0000000000000000000000000000000000000000..5077c508468919eb6656bf793d0756c88d3702ba --- /dev/null +++ b/src/VideoDevice.h @@ -0,0 +1,67 @@ +/************************************************************************************ + * Copyright (C) 2012 by Savoir-Faire Linux * + * Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***********************************************************************************/ +#ifndef VIDEO_DEVICE_H +#define VIDEO_DEVICE_H + +#include "typedefs.h" +#include <QStringList> + +///@typedef VideoChannel A channel available in a Device +typedef QString VideoChannel; + +///@typedef VideoRate The rate for a device +typedef QString VideoRate; + +///@struct Resolution Equivalent of "640x480" +struct LIB_EXPORT Resolution { + explicit Resolution(uint _width, uint _height):width(_width),height(_height){} + Resolution(QString size) { + width=size.split("x")[0].toInt(); + height=size.split("x")[1].toInt(); + } + uint width; + uint height; + QString toString() { return QString::number(width)+"x"+QString::number(height);} +}; + +///@class VideoDevice V4L devices used to record video for video call +class LIB_EXPORT VideoDevice { + public: + //Constructor + VideoDevice(QString id); + + //Static getter + static QList<VideoDevice*> getDeviceList(); + + //Getter + QStringList getRateList(VideoChannel channel, Resolution resolution); + QList<Resolution> getResolutionList(VideoChannel channel); + QList<VideoChannel> getChannelList (); + Resolution getResolution (); + VideoChannel getChannel (); + VideoRate getRate (); + + //Setter + void setRate ( VideoRate rate ); + void setResolution ( Resolution resolution ); + void setChannel ( VideoChannel channel ); + private: + QString m_DeviceId; +}; +#endif \ No newline at end of file diff --git a/src/VideoModel.cpp b/src/VideoModel.cpp new file mode 100644 index 0000000000000000000000000000000000000000..60dfda8666eb37b65f7d8124d6be04c8fbc87d28 --- /dev/null +++ b/src/VideoModel.cpp @@ -0,0 +1,72 @@ +/************************************************************************************ + * Copyright (C) 2012 by Savoir-Faire Linux * + * Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***********************************************************************************/ +#include "VideoModel.h" +#include "video_interface_singleton.h" + +///Constructor +VideoModel::VideoModel():m_BufferSize(0),m_ShmKey(0),m_SemKey(0),m_Res(0,0) +{ + VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + connect(&interface,SIGNAL(receivingEvent(int,int,int,int,int)),this,SLOT(receivingEvent(int,int,int,int,int))); + connect(&interface,SIGNAL(deviceEvent()),this,SLOT(deviceEvent())); + connect(&interface,SIGNAL(stoppedReceivingEvent(int,int)),this,SLOT(stoppedReceivingEvent(int,int))); +} + +///Stop video preview +void VideoModel::stopPreview() +{ + VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + interface.stopPreview(); +} + +///Start video preview +void VideoModel::startPreview() +{ + VideoInterface& interface = VideoInterfaceSingleton::getInstance(); + interface.startPreview(); +} + +///@todo Set the video buffer size +void VideoModel::setBufferSize(uint size) +{ + m_BufferSize = size; +} + +///Event callback +void VideoModel::receivingEvent(int shmKey, int semKey, int videoBufferSize, int destWidth, int destHeight) +{ + m_ShmKey = (uint)shmKey; + m_ShmKey = (uint)semKey; + m_BufferSize = videoBufferSize; + m_Res.width = destWidth; + m_Res.height = destHeight; +} + +///Callback when video is stopped +void VideoModel::stoppedReceivingEvent(int shmKey, int semKey) +{ + m_ShmKey = (uint)shmKey; + m_ShmKey = (uint)semKey; +} + +///Event callback +void VideoModel::deviceEvent() +{ + +} \ No newline at end of file diff --git a/src/VideoModel.h b/src/VideoModel.h new file mode 100644 index 0000000000000000000000000000000000000000..239d44c397eed3383cc66d4a9aa183d3da16058d --- /dev/null +++ b/src/VideoModel.h @@ -0,0 +1,44 @@ +/************************************************************************************ + * Copyright (C) 2012 by Savoir-Faire Linux * + * Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***********************************************************************************/ +#include "typedefs.h" +#include <QtCore/QObject> + +//SFLPhone +#include "VideoDevice.h" + +///@class VideoModel Video event dispatcher +class LIB_EXPORT VideoModel : public QObject { +public: + VideoModel(); + void stopPreview(); + void startPreview(); + void setBufferSize(uint size); + +private: + //Attributes + uint m_BufferSize; + uint m_ShmKey; + uint m_SemKey; + Resolution m_Res; + +private slots: + void receivingEvent(int shmKey, int semKey, int videoBufferSize, int destWidth, int destHeight); + void stoppedReceivingEvent(int shmKey, int semKey); + void deviceEvent(); +}; \ No newline at end of file diff --git a/src/dbus/video_controls-introspec.xml b/src/dbus/video_controls-introspec.xml new file mode 100755 index 0000000000000000000000000000000000000000..34c93064fe26de0bbfe3a612ce4ae26a66217538 --- /dev/null +++ b/src/dbus/video_controls-introspec.xml @@ -0,0 +1,158 @@ +<?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"> + <!-- Video device methods --> + + <method name="getInputDeviceList" tp:name-for-bindings="getInputDeviceList"> + <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="VectorString"/> + <arg type="as" name="list" direction="out"> + </arg> + </method> + + <method name="getInputDeviceChannelList" tp:name-for-bindings="getInputDeviceChannelList"> + <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="VectorString"/> + <arg type="s" name="device" direction="in"> + </arg> + <arg type="as" name="list" direction="out"> + </arg> + </method> + + <method name="getInputDeviceSizeList" tp:name-for-bindings="getInputDeviceSizeList"> + <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="VectorString"/> + <arg type="s" name="device" direction="in"> + </arg> + <arg type="s" name="channel" direction="in"> + </arg> + <arg type="as" name="list" direction="out"> + </arg> + </method> + + <method name="getInputDeviceRateList" tp:name-for-bindings="getInputDeviceRateList"> + <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="VectorString"/> + <arg type="s" name="device" direction="in"> + </arg> + <arg type="s" name="channel" direction="in"> + </arg> + <arg type="s" name="size" direction="in"> + </arg> + <arg type="as" name="list" direction="out"> + </arg> + </method> + + <method name="getInputDevice" tp:name-for-bindings="getInputDevice"> + <arg type="s" name="device" direction="out"> + </arg> + </method> + + <method name="getInputDeviceChannel" tp:name-for-bindings="getInputDeviceChannel"> + <arg type="s" name="channel" direction="out"> + </arg> + </method> + + <method name="getInputDeviceSize" tp:name-for-bindings="getInputDeviceSize"> + <arg type="s" name="size" direction="out"> + </arg> + </method> + + <method name="getInputDeviceRate" tp:name-for-bindings="getInputDeviceRate"> + <arg type="s" name="rate" direction="out"> + </arg> + </method> + + <method name="setInputDevice" tp:name-for-bindings="setInputDevice"> + <arg type="s" name="device" direction="in"> + </arg> + </method> + + <method name="setInputDeviceChannel" tp:name-for-bindings="setInputDeviceChannel"> + <arg type="s" name="channel" direction="in"> + </arg> + </method> + + <method name="setInputDeviceSize" tp:name-for-bindings="setInputDeviceSize"> + <arg type="s" name="size" direction="in"> + </arg> + </method> + + <method name="setInputDeviceRate" tp:name-for-bindings="setInputDeviceRate"> + <arg type="s" name="rate" direction="in"> + </arg> + </method> + + <!-- Video Codec related methods --> + + <method name="getCodecList" tp:name-for-bindings="getCodecList"> + <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="VectorString"/> + <arg type="as" name="list" direction="out"> + </arg> + </method> + + <method name="getCodecDetails" tp:name-for-bindings="getCodecDetails"> + <arg type="s" name="codec" direction="in"> + </arg> + <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="VectorString"/> + <arg type="as" name="details" direction="out"> + </arg> + </method> + + <method name="getActiveCodecList" tp:name-for-bindings="getActiveCodecList"> + <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="VectorString"/> + <arg type="s" name="accountID" direction="in"> + </arg> + <arg type="as" name="list" direction="out"> + </arg> + </method> + + <method name="setActiveCodecList" tp:name-for-bindings="setActiveCodecList"> + <annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="VectorString"/> + <arg type="as" name="list" direction="in"> + </arg> + <arg type="s" name="accountID" direction="in"> + </arg> + </method> + + <method name="startPreview" tp:name-for-bindings="startPreview"> + <arg type="i" name="width" direction="out"> + </arg> + <arg type="i" name="height" direction="out"> + </arg> + <arg type="i" name="shmKey" direction="out"> + </arg> + <arg type="i" name="semKey" direction="out"> + </arg> + <arg type="i" name="videoBufferSize" direction="out"> + </arg> + </method> + + <method name="stopPreview" tp:name-for-bindings="stopPreview"> + </method> + + <signal name="deviceEvent" tp:name-for-bindings="deviceEvent"> + </signal> + + <signal name="receivingEvent" tp:name-for-bindings="receivingEvent"> + <arg type="i" name="shmKey"> + </arg> + <arg type="i" name="semKey"> + </arg> + <arg type="i" name="videoBufferSize"> + </arg> + <arg type="i" name="destWidth"> + </arg> + <arg type="i" name="destHeight"> + </arg> + </signal> + + <signal name="stoppedReceivingEvent" tp:name-for-bindings="stoppedReceivingEvent"> + <arg type="i" name="shmKey"> + </arg> + <arg type="i" name="semKey"> + </arg> + </signal> + + <method name="getCurrentCodecName" tp:name-for-bindings="getCurrentCodecName"> + <arg type="s" name="callID" direction="in"/> + <arg type="s" name="codecName" direction="out"/> + </method> + </interface> +</node> diff --git a/src/video_interface_singleton.cpp b/src/video_interface_singleton.cpp new file mode 100644 index 0000000000000000000000000000000000000000..94723949321bc9c57ba564eed70ce7b784521b09 --- /dev/null +++ b/src/video_interface_singleton.cpp @@ -0,0 +1,31 @@ +/************************************************************************************ + * Copyright (C) 2012 by Savoir-Faire Linux * + * Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***********************************************************************************/ + +#include "video_interface_singleton.h" + +VideoInterface* VideoInterfaceSingleton::interface + = new VideoInterface("org.sflphone.SFLphone", "/org/sflphone/SFLphone/Instance", QDBusConnection::sessionBus()); + +VideoInterface& VideoInterfaceSingleton::getInstance() +{ + if(!interface->connection().isConnected()) { + throw "Error : sflphoned not connected. Service " + interface->service() + " not connected. From instance interface."; + } + return *interface; +} diff --git a/src/video_interface_singleton.h b/src/video_interface_singleton.h new file mode 100644 index 0000000000000000000000000000000000000000..e594b967642a72aafff4e6548152ab74cbd1f1af --- /dev/null +++ b/src/video_interface_singleton.h @@ -0,0 +1,40 @@ +/************************************************************************************ + * Copyright (C) 2012 by Savoir-Faire Linux * + * Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***********************************************************************************/ + +#ifndef INSTANCE_INTERFACE_SINGLETON_H +#define INSTANCE_INTERFACE_SINGLETON_H + +#include "src/lib/video_dbus_interface.h" +#include "typedefs.h" + +/** + * @author Jérémy Quentin <jeremy.quentin@savoirfairelinux.com> + */ +class LIB_EXPORT VideoInterfaceSingleton +{ + +private: + static VideoInterface* interface; + +public: + static VideoInterface& getInstance(); + +}; + +#endif