diff --git a/daemon/configure.ac b/daemon/configure.ac index 5cad174a72788787589ef1780c31252c5add8690..18363be1cab9c898585b0d03f33ae6aa6e937dc3 100644 --- a/daemon/configure.ac +++ b/daemon/configure.ac @@ -163,7 +163,8 @@ AS_IF([test "x$enable_video" != "xno"], [ dnl Check for libavutil development package - name: libavutil-dev PKG_CHECK_MODULES(LIBAVUTIL, libavutil >= 51.7.0,, AC_MSG_ERROR([Missing libavutil package: libavutil-dev])) ]); -AM_CONDITIONAL(SFL_VIDEO, test x"$enable_video" = xyes) + +AM_CONDITIONAL(SFL_VIDEO, test "x$enable_video" != "xno") LIBCCGNU2_MIN_VERSION=1.3.1 PKG_CHECK_MODULES(CCGNU2, libccgnu2 >= ${LIBCCGNU2_MIN_VERSION},, AC_MSG_ERROR([Missing common cpp development package: libcommoncpp2-dev])) diff --git a/daemon/src/Makefile.am b/daemon/src/Makefile.am index 619618f3fb0cd2dfc7e6cc2b2def1c299da81c4c..026bbf4f9ac85995ee3af732935721ed85a8e3f5 100644 --- a/daemon/src/Makefile.am +++ b/daemon/src/Makefile.am @@ -3,13 +3,12 @@ include ../globals.mak libexecdir=$(libdir)/sflphone libexec_PROGRAMS = sflphoned -# all: indent - -SUBDIRS = dbus audio config hooks history sip iax im if SFL_VIDEO -SUBDIRS += video +SFL_VIDEO_SUBDIR = video endif +SUBDIRS = dbus audio config hooks history sip iax im $(SFL_VIDEO_SUBDIR) + sflphoned_SOURCES = main.cpp # Redefine the USE_IAX variable here, so that it could be used in managerimpl @@ -53,6 +52,10 @@ noinst_HEADERS = \ fileutils.h \ noncopyable.h +if SFL_VIDEO +SFL_VIDEO_LIB=./video/libvideo.la +endif + libsflphone_la_LIBADD = \ $(top_builddir)/libs/utilspp/libutilspp.la \ $(top_builddir)/libs/iax2/libiax2.la \ @@ -63,10 +66,7 @@ libsflphone_la_LIBADD = \ ./dbus/libdbus.la \ ./config/libconfig.la \ ./hooks/libhooks.la \ - ./history/libhistory.la -if SFL_VIDEO -libsflphone_la_LIBADD += ./video/libvideo.la -endif + ./history/libhistory.la $(SFL_VIDEO_LIB) libsflphone_la_LDFLAGS = \ @CCGNU2_LIBS@ \ diff --git a/daemon/src/account.cpp b/daemon/src/account.cpp index e9c6d9d70dc3f3032e8541bd3440829990fae5de..71fbc41c8258b2ad2a03875b6cdce20889c7402b 100644 --- a/daemon/src/account.cpp +++ b/daemon/src/account.cpp @@ -86,15 +86,15 @@ void Account::loadDefaultCodecs() codecList.push_back("112"); setActiveCodecs(codecList); -#if SFL_VIDEO - setActiveVideoCodecs(sfl_video::getVideoCodecList()); +#ifdef SFL_VIDEO + setActiveVideoCodecs(sfl_video::getCodecList()); #endif } -#if SFL_VIDEO +#ifdef SFL_VIDEO void Account::setActiveVideoCodecs (const std::vector <std::string> &list) { - videoCodecList_ = !list.empty() ? list : sfl_video::getVideoCodecList(); + videoCodecList_ = !list.empty() ? list : sfl_video::getCodecList(); } #endif @@ -105,9 +105,8 @@ void Account::setActiveCodecs(const std::vector <std::string> &list) // list contains the ordered payload of active codecs picked by the user for this account // we used the CodecList vector to save the order. - for (std::vector<std::string>::const_iterator iter = list.begin(); iter != list.end(); - ++iter) { - int payload = std::atoi(iter->c_str()); + for (std::vector<std::string>::const_iterator i = list.begin(); i != list.end(); ++i) { + int payload = std::atoi(i->c_str()); codecList_.push_back(static_cast<int>(payload)); } diff --git a/daemon/src/account.h b/daemon/src/account.h index 6e79e79e9acac62cb33a4218ed5906e1b26de77d..3a11fabfa8992a24924829b7015740e88db568c7 100644 --- a/daemon/src/account.h +++ b/daemon/src/account.h @@ -35,9 +35,13 @@ #include <string> #include <vector> +#if HAVE_CONFIG_H +#include "config.h" +#endif + #include "global.h" #include "noncopyable.h" -#include "config/config.h" +#include "config/sfl_config.h" #include "config/serializable.h" class VoIPLink; diff --git a/daemon/src/config/Makefile.am b/daemon/src/config/Makefile.am index f64c876291d13ed2c4f69c956136123553d6df9f..4b9660aabc2e0255694b960f239f5bce3e890aa3 100644 --- a/daemon/src/config/Makefile.am +++ b/daemon/src/config/Makefile.am @@ -1,13 +1,13 @@ noinst_LTLIBRARIES = libconfig.la libconfig_la_SOURCES = \ - config.cpp \ + sfl_config.cpp \ yamlemitter.cpp \ yamlparser.cpp \ yamlnode.cpp noinst_HEADERS = \ - config.h \ + sfl_config.h \ serializable.h \ yamlemitter.h \ yamlparser.h \ diff --git a/daemon/src/config/config.cpp b/daemon/src/config/sfl_config.cpp similarity index 99% rename from daemon/src/config/config.cpp rename to daemon/src/config/sfl_config.cpp index 32d56f9481e0f132afc80c1e805ca8653ab76323..0038a3e00d672611c6d7d37d8eef383ce71e664c 100644 --- a/daemon/src/config/config.cpp +++ b/daemon/src/config/sfl_config.cpp @@ -29,7 +29,7 @@ * as that of the covered work. */ -#include "config.h" +#include "sfl_config.h" #include "../global.h" #include <fstream> #include <cstdlib> diff --git a/daemon/src/config/config.h b/daemon/src/config/sfl_config.h similarity index 100% rename from daemon/src/config/config.h rename to daemon/src/config/sfl_config.h diff --git a/daemon/src/config/yamlemitter.h b/daemon/src/config/yamlemitter.h index 0915e7764f547318fb80058b68487d72e09c96a9..e26e0a2efbfd4bf11e6422e6ba0abee61b844768 100644 --- a/daemon/src/config/yamlemitter.h +++ b/daemon/src/config/yamlemitter.h @@ -28,8 +28,12 @@ * as that of the covered work. */ -#ifndef __YAMLEMITTER_H__ -#define __YAMLEMITTER_H__ +#ifndef YAMLEMITTER_H_ +#define YAMLEMITTER_H_ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include <yaml.h> #include <stdexcept> @@ -129,4 +133,4 @@ class YamlEmitter { }; } -#endif +#endif // YAMLEMITTER_H_ diff --git a/daemon/src/config/yamlparser.h b/daemon/src/config/yamlparser.h index bdd828f2b033368b5ee93013f44167f2c11fa94c..c357e1c7ca73e63dcb25a6c14d76ea5d98e835ad 100644 --- a/daemon/src/config/yamlparser.h +++ b/daemon/src/config/yamlparser.h @@ -31,6 +31,10 @@ #ifndef __YAMLPARSER_H__ #define __YAMLPARSER_H__ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "yamlnode.h" #include <yaml.h> #include <cstdio> diff --git a/daemon/src/dbus/Makefile.am b/daemon/src/dbus/Makefile.am index 5a539257db8f4ada74b44de6ea62e3b1efb83010..08265e0872b1ea7b0d3561984624802041dea200 100644 --- a/daemon/src/dbus/Makefile.am +++ b/daemon/src/dbus/Makefile.am @@ -9,6 +9,8 @@ BUILT_SOURCES= \ if SFL_VIDEO BUILT_SOURCES+=video_controls-glue.h +video_controls-glue.h: video_controls-introspec.xml Makefile.am + dbusxx-xml2cpp $< --adaptor=$@ endif # Rule to generate the binding headers diff --git a/daemon/src/dbus/callmanager.cpp b/daemon/src/dbus/callmanager.cpp index 6015888a66cc1fa35b6d9c688b4b1c9fdfa4261e..5c2c72a8d6376a92d5267b6de4bf4dc95bfe9e14 100644 --- a/daemon/src/dbus/callmanager.cpp +++ b/daemon/src/dbus/callmanager.cpp @@ -40,8 +40,12 @@ #include "manager.h" +namespace { + const char* SERVER_PATH = "/org/sflphone/SFLphone/CallManager"; +} + CallManager::CallManager(DBus::Connection& connection) - : DBus::ObjectAdaptor(connection, "/org/sflphone/SFLphone/CallManager") + : DBus::ObjectAdaptor(connection, SERVER_PATH) {} void CallManager::placeCall(const std::string& accountID, @@ -71,10 +75,10 @@ void CallManager::placeCallFirstAccount(const std::string& callID, if (accountList.empty()) accountList = Manager::instance().getAccountList(); - for (vector<string>::const_iterator iter = accountList.begin(); iter != accountList.end(); ++iter) { - if ((*iter != IP2IP_PROFILE) && Manager::instance().getAccount(*iter)->isEnabled()) { - Manager::instance().outgoingCall(*iter, callID, to); - return; + for (vector<string>::const_iterator i = accountList.begin(); i != accountList.end(); ++i) { + if ((*i != IP2IP_PROFILE) && Manager::instance().getAccount(*i)->isEnabled()) { + Manager::instance().outgoingCall(*i, callID, to); + break; } } } @@ -129,9 +133,9 @@ void CallManager::attendedTransfer(const std::string& transferID, const std::str void CallManager::setVolume(const std::string& device, const double& value) { if (device == "speaker") - Manager::instance().setSpkrVolume((int)(value * 100.0)); + Manager::instance().setSpkrVolume(value * 100.0); else if (device == "mic") - Manager::instance().setMicVolume((int)(value * 100.0)); + Manager::instance().setMicVolume(value * 100.0); volumeChanged(device, value); } @@ -195,19 +199,19 @@ CallManager::unholdConference(const std::string& confID) Manager::instance().unHoldConference(confID); } -std::map< std::string, std::string > +std::map<std::string, std::string> CallManager::getConferenceDetails(const std::string& callID) { return Manager::instance().getConferenceDetails(callID); } -std::vector< std::string > +std::vector<std::string> CallManager::getConferenceList() { return Manager::instance().getConferenceList(); } -std::vector< std::string > +std::vector<std::string> CallManager::getParticipantList(const std::string& confID) { return Manager::instance().getParticipantList(confID); @@ -239,7 +243,7 @@ CallManager::getIsRecording(const std::string& callID) std::string CallManager::getCurrentAudioCodecName(const std::string& callID) { - return Manager::instance().getCurrentCodecName(callID).c_str(); + return Manager::instance().getCurrentCodecName(callID); } std::map<std::string, std::string> @@ -307,27 +311,23 @@ CallManager::setSASVerified(const std::string& callID) sfl::AudioZrtpSession * zSession; zSession = getAudioZrtpSession(callID); zSession->SASVerified(); - } catch (...) { - } + } catch (...) {} } void CallManager::resetSASVerified(const std::string& callID) { try { - sfl::AudioZrtpSession * zSession; - zSession = getAudioZrtpSession(callID); + sfl::AudioZrtpSession * zSession = getAudioZrtpSession(callID); zSession->resetSASVerified(); - } catch (...) { - } + } catch (...) {} } void CallManager::setConfirmGoClear(const std::string& callID) { try { - sfl::AudioZrtpSession * zSession; - zSession = getAudioZrtpSession(callID); + sfl::AudioZrtpSession * zSession = getAudioZrtpSession(callID); zSession->goClearOk(); } catch (...) {} } @@ -335,33 +335,27 @@ CallManager::setConfirmGoClear(const std::string& callID) void CallManager::requestGoClear(const std::string& callID) { try { - sfl::AudioZrtpSession * zSession; - zSession = getAudioZrtpSession(callID); + sfl::AudioZrtpSession * zSession = getAudioZrtpSession(callID); zSession->requestGoClear(); - } catch (...) { - } + } catch (...) {} } void CallManager::acceptEnrollment(const std::string& callID, const bool& accepted) { try { - sfl::AudioZrtpSession * zSession; - zSession = getAudioZrtpSession(callID); + sfl::AudioZrtpSession * zSession = getAudioZrtpSession(callID); zSession->acceptEnrollment(accepted); - } catch (...) { - } + } catch (...) {} } void CallManager::setPBXEnrollment(const std::string& callID, const bool& yesNo) { try { - sfl::AudioZrtpSession * zSession; - zSession = getAudioZrtpSession(callID); + sfl::AudioZrtpSession * zSession = getAudioZrtpSession(callID); zSession->setPBXEnrollment(yesNo); - } catch (...) { - } + } catch (...) {} } void diff --git a/daemon/src/dbus/callmanager.h b/daemon/src/dbus/callmanager.h index e5f11d6512e02aed7015a36443ca6f6359a938e8..a43ab96d39ce334d6ab310517f77ef30562942e6 100644 --- a/daemon/src/dbus/callmanager.h +++ b/daemon/src/dbus/callmanager.h @@ -57,17 +57,16 @@ class CallManagerException: public std::runtime_error { }; namespace sfl { -class AudioZrtpSession; + class AudioZrtpSession; } -class CallManager - : public org::sflphone::SFLphone::CallManager_adaptor, - public DBus::IntrospectableAdaptor, - public DBus::ObjectAdaptor { +class CallManager : public org::sflphone::SFLphone::CallManager_adaptor, + public DBus::IntrospectableAdaptor, + public DBus::ObjectAdaptor { + public: CallManager(DBus::Connection& connection); - static const char* SERVER_PATH; /* methods exported by this interface, * you will have to implement them in your ObjectAdaptor @@ -83,13 +82,13 @@ class CallManager void hold(const std::string& callID); void unhold(const std::string& callID); void transfer(const std::string& callID, const std::string& to); - void attendedTransfer(const std::string& transferID, const std::string& targetID); - std::map< std::string, std::string > getCallDetails(const std::string& callID); - std::vector< std::string > getCallList(); + void attendedTransfer(const std::string& transferID, const std::string &targetID); + std::map<std::string, std::string> getCallDetails(const std::string &callID); + std::vector<std::string> getCallList(); /* Conference related methods */ - void joinParticipant(const std::string& sel_callID, const std::string& drag_callID); - void createConfFromParticipantList(const std::vector< std::string >& participants); + void joinParticipant(const std::string& sel_callID, const std::string &drag_callID); + void createConfFromParticipantList(const std::vector<std::string> &participants); void addParticipant(const std::string& callID, const std::string& confID); void addMainParticipant(const std::string& confID); void detachParticipant(const std::string& callID); @@ -97,9 +96,9 @@ class CallManager void hangUpConference(const std::string& confID); void holdConference(const std::string& confID); void unholdConference(const std::string& confID); - std::vector< std::string > getConferenceList(); - std::vector< std::string > getParticipantList(const std::string& confID); - std::map< std::string, std::string > getConferenceDetails(const std::string& callID); + std::vector<std::string> getConferenceList(); + std::vector<std::string> getParticipantList(const std::string& confID); + std::map<std::string, std::string> getConferenceDetails(const std::string& callID); /* File Playback methods */ bool startRecordedFilePlayback(const std::string& filepath); diff --git a/daemon/src/dbus/configurationmanager.cpp b/daemon/src/dbus/configurationmanager.cpp index a749e01eeab9515b8a1340deebd20e8418faca60..e6e4ac04eebbdcc69868a545e14b029c3ec4d9a4 100644 --- a/daemon/src/dbus/configurationmanager.cpp +++ b/daemon/src/dbus/configurationmanager.cpp @@ -40,8 +40,9 @@ #include "account.h" #include "sip/sipaccount.h" -const char* ConfigurationManager::SERVER_PATH = - "/org/sflphone/SFLphone/ConfigurationManager"; +namespace { + const char* SERVER_PATH = "/org/sflphone/SFLphone/ConfigurationManager"; +} ConfigurationManager::ConfigurationManager(DBus::Connection& connection) : DBus::ObjectAdaptor(connection, SERVER_PATH) diff --git a/daemon/src/dbus/configurationmanager.h b/daemon/src/dbus/configurationmanager.h index 520117150b605c1cb8810b45c8b16e443e793b4c..6c9dbab96bf020f75ad17c7a7490fd68b129083d 100644 --- a/daemon/src/dbus/configurationmanager.h +++ b/daemon/src/dbus/configurationmanager.h @@ -56,11 +56,9 @@ class ConfigurationManager : public org::sflphone::SFLphone::ConfigurationManager_adaptor, public DBus::IntrospectableAdaptor, public DBus::ObjectAdaptor { - public: + public: ConfigurationManager(DBus::Connection& connection); - static const char* SERVER_PATH; - std::map< std::string, std::string > getAccountDetails(const std::string& accountID); void setAccountDetails(const std::string& accountID, const std::map< std::string, std::string >& details); std::string addAccount(const std::map< std::string, std::string >& details); diff --git a/daemon/src/dbus/dbusmanager.cpp b/daemon/src/dbus/dbusmanager.cpp index 35ae0384d9d65a64f1f23670564992c1cc003892..2baed52590a335862ed28a6a4ce9eca24cf9a4e8 100644 --- a/daemon/src/dbus/dbusmanager.cpp +++ b/daemon/src/dbus/dbusmanager.cpp @@ -38,6 +38,10 @@ #include "configurationmanager.h" #include "networkmanager.h" +#ifdef SFL_VIDEO +#include "dbus/video_controls.h" +#endif + DBusManager::DBusManager() : callManager_(0) , configurationManager_(0) , instanceManager_(0) diff --git a/daemon/src/dbus/dbusmanager.h b/daemon/src/dbus/dbusmanager.h index 3351027edc7c5d72ebf02f2fa02c78b209650958..aaef322a0f93deb1c79fab8f303ca6cfabf78ef0 100644 --- a/daemon/src/dbus/dbusmanager.h +++ b/daemon/src/dbus/dbusmanager.h @@ -31,6 +31,9 @@ #ifndef __DBUSMANAGERIMPL_H__ #define __DBUSMANAGERIMPL_H__ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "dbus_cpp.h" #include "noncopyable.h" @@ -38,6 +41,7 @@ class ConfigurationManager; class CallManager; class NetworkManager; class Instance; +class VideoControls; class DBusManager { public: @@ -46,10 +50,15 @@ class DBusManager { CallManager * getCallManager() { return callManager_; - }; + } ConfigurationManager * getConfigurationManager() { return configurationManager_; - }; + } +#ifdef SFL_VIDEO + VideoControls* getVideoControls() { + return videoControls_; + } +#endif void exec(); void exit(); diff --git a/daemon/src/dbus/instance.h b/daemon/src/dbus/instance.h index 31c82d29e96652267ef03eb6680baf43ac22797a..4a2b2c2593af1fb9b63e0bf15c551d42dc9abdf7 100644 --- a/daemon/src/dbus/instance.h +++ b/daemon/src/dbus/instance.h @@ -62,5 +62,4 @@ class Instance }; - -#endif//INSTANCE_H +#endif // INSTANCE_H diff --git a/daemon/src/dbus/video_controls.xml b/daemon/src/dbus/video_controls-introspec.xml similarity index 64% rename from daemon/src/dbus/video_controls.xml rename to daemon/src/dbus/video_controls-introspec.xml index 7fcd2cf60f3fcfb6ac65d00c0aa23e50e5cae6cf..de6ab6c719efa6bd882f21ce5e5aecc5f23dbb3c 100644 --- a/daemon/src/dbus/video_controls.xml +++ b/daemon/src/dbus/video_controls-introspec.xml @@ -3,13 +3,13 @@ <interface name="org.sflphone.SFLphone.VideoControls"> <!-- Video device methods --> - <method name="getVideoInputDeviceList" tp:name-for-bindings="getVideoInputDeviceList"> + <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="getVideoInputDeviceChannelList" tp:name-for-bindings="getVideoInputDeviceChannelList"> + <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> @@ -17,7 +17,7 @@ </arg> </method> - <method name="getVideoInputDeviceSizeList" tp:name-for-bindings="getVideoInputDeviceSizeList"> + <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> @@ -27,7 +27,7 @@ </arg> </method> - <method name="getVideoInputDeviceRateList" tp:name-for-bindings="getVideoInputDeviceRateList"> + <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> @@ -39,55 +39,55 @@ </arg> </method> - <method name="getVideoInputDevice" tp:name-for-bindings="getVideoInputDevice"> + <method name="getInputDevice" tp:name-for-bindings="getInputDevice"> <arg type="s" name="device" direction="out"> </arg> </method> - <method name="getVideoInputDeviceChannel" tp:name-for-bindings="getVideoInputDeviceChannel"> + <method name="getInputDeviceChannel" tp:name-for-bindings="getInputDeviceChannel"> <arg type="s" name="channel" direction="out"> </arg> </method> - <method name="getVideoInputDeviceSize" tp:name-for-bindings="getVideoInputDeviceSize"> + <method name="getInputDeviceSize" tp:name-for-bindings="getInputDeviceSize"> <arg type="s" name="size" direction="out"> </arg> </method> - <method name="getVideoInputDeviceRate" tp:name-for-bindings="getVideoInputDeviceRate"> + <method name="getInputDeviceRate" tp:name-for-bindings="getInputDeviceRate"> <arg type="s" name="rate" direction="out"> </arg> </method> - <method name="setVideoInputDevice" tp:name-for-bindings="setVideoInputDevice"> + <method name="setInputDevice" tp:name-for-bindings="setInputDevice"> <arg type="s" name="device" direction="in"> </arg> </method> - <method name="setVideoInputDeviceChannel" tp:name-for-bindings="setVideoInputDeviceChannel"> + <method name="setInputDeviceChannel" tp:name-for-bindings="setInputDeviceChannel"> <arg type="s" name="channel" direction="in"> </arg> </method> - <method name="setVideoInputDeviceSize" tp:name-for-bindings="setVideoInputDeviceSize"> + <method name="setInputDeviceSize" tp:name-for-bindings="setInputDeviceSize"> <arg type="s" name="size" direction="in"> </arg> </method> - <method name="setVideoInputDeviceRate" tp:name-for-bindings="setVideoInputDeviceRate"> + <method name="setInputDeviceRate" tp:name-for-bindings="setInputDeviceRate"> <arg type="s" name="rate" direction="in"> </arg> </method> <!-- Video Codec related methods --> - <method name="getVideoCodecList" tp:name-for-bindings="getVideoCodecList"> + <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="getVideoCodecDetails" tp:name-for-bindings="getVideoCodecDetails"> + <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"/> @@ -95,7 +95,7 @@ </arg> </method> - <method name="getActiveVideoCodecList" tp:name-for-bindings="getActiveVideoCodecList"> + <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> @@ -103,7 +103,7 @@ </arg> </method> - <method name="setActiveVideoCodecList" tp:name-for-bindings="setActiveVideoCodecList"> + <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> @@ -111,7 +111,7 @@ </arg> </method> - <method name="startVideoPreview" tp:name-for-bindings="startVideoPreview"> + <method name="startPreview" tp:name-for-bindings="startPreview"> <arg type="i" name="width" direction="out"> </arg> <arg type="i" name="height" direction="out"> @@ -124,18 +124,13 @@ </arg> </method> - <method name="stopVideoPreview" tp:name-for-bindings="stopVideoPreview"> + <method name="stopPreview" tp:name-for-bindings="stopPreview"> </method> - <signal name="videoDeviceEvent" tp:name-for-bindings="videoDeviceEvent"> + <signal name="deviceEvent" tp:name-for-bindings="deviceEvent"> </signal> - <method name="getCurrentVideoCodecName" tp:name-for-bindings="getCurrentVideoCodecName"> - <arg type="s" name="callID" direction="in"/> - <arg type="s" name="codecName" direction="out"/> - </method> - - <signal name="receivingVideoEvent" tp:name-for-bindings="receivingVideoEvent"> + <signal name="receivingEvent" tp:name-for-bindings="receivingEvent"> <arg type="i" name="shmKey"> </arg> <arg type="i" name="semKey"> @@ -148,7 +143,7 @@ </arg> </signal> - <signal name="stoppedReceivingVideoEvent" tp:name-for-bindings="stoppedReceivingVideoEvent"> + <signal name="stoppedReceivingEvent" tp:name-for-bindings="stoppedReceivingEvent"> <arg type="i" name="shmKey"> </arg> <arg type="i" name="semKey"> diff --git a/daemon/src/dbus/video_controls.cpp b/daemon/src/dbus/video_controls.cpp index 2fc3385966a5685b141c6ee13e3c2fb1f5a7c4ea..35e2d6ac30edff4676c029f9f6e8cf7de066474b 100644 --- a/daemon/src/dbus/video_controls.cpp +++ b/daemon/src/dbus/video_controls.cpp @@ -34,11 +34,15 @@ #include "video/libav_utils.h" #include "video/video_endpoint.h" #include "video/video_preview.h" +#include "account.h" +#include "manager.h" -const char* VideoControls::SERVER_PATH = "/org/sflphone/SFLphone/VideoControls"; +namespace { +const char * const SERVER_PATH = "/org/sflphone/SFLphone/VideoControls"; +} VideoControls::VideoControls(DBus::Connection& connection) : - DBus::ObjectAdaptor(connection, SERVER_PATH), preview_() + DBus::ObjectAdaptor(connection, SERVER_PATH), preview_(), videoPreference_() { // initialize libav libraries libav_utils::sfl_avcodec_init(); @@ -65,7 +69,7 @@ VideoControls::getActiveCodecList(const std::string& accountID) Account *acc = Manager::instance().getAccount(accountID); if (acc != NULL) - v = acc->getActiveCodecs(); + v = acc->getActiveVideoCodecs(); return v; @@ -123,27 +127,32 @@ std::string VideoControls::getInputDeviceRate() return videoPreference_.getRate(); } -void VideoControls::setVideoInputDevice(const std::string& api) +void VideoControls::setInputDevice(const std::string& api) { videoPreference_.setDevice(api); } -void VideoControls::setVideoInputDeviceChannel(const std::string& api) +void VideoControls::setInputDeviceChannel(const std::string& api) { videoPreference_.setChannel(api); } -void VideoControls::setVideoInputDeviceSize(const std::string& api) +void VideoControls::setInputDeviceSize(const std::string& api) { videoPreference_.setSize(api); } -void VideoControls::setVideoInputDeviceRate(const std::string& api) +void VideoControls::setInputDeviceRate(const std::string& api) { videoPreference_.setRate(api); } -void VideoControls::startVideoPreview(int32_t &width, int32_t &height, int32_t &shmKey, int32_t &semKey, int32_t &videoBufferSize) +std::map<std::string, std::string> +VideoControls::getSettings() const { + return videoPreference_.getSettings(); +} + +void VideoControls::startPreview(int32_t &width, int32_t &height, int32_t &shmKey, int32_t &semKey, int32_t &videoBufferSize) { if (preview_.get()) { ERROR("Video preview was already started!"); @@ -156,7 +165,7 @@ void VideoControls::startVideoPreview(int32_t &width, int32_t &height, int32_t & using std::map; using std::string; - map<string, string> args(Manager::instance().videoPreference.getVideoSettings()); + map<string, string> args(videoPreference_.getSettings()); preview_.reset(new sfl_video::VideoPreview(args)); preview_->start(); @@ -167,7 +176,7 @@ void VideoControls::startVideoPreview(int32_t &width, int32_t &height, int32_t & videoBufferSize = preview_->getVideoBufferSize(); } -void VideoControls::stopVideoPreview() +void VideoControls::stopPreview() { if (preview_.get()) { DEBUG("Stopping video preview"); diff --git a/daemon/src/dbus/video_controls.h b/daemon/src/dbus/video_controls.h index c5bb7793720d66c6172a398cf1a47dd3d04cad53..6f38a4755bad103ea0012411ac34d30c1e96e83c 100644 --- a/daemon/src/dbus/video_controls.h +++ b/daemon/src/dbus/video_controls.h @@ -31,47 +31,47 @@ #define VIDEO_CONTROLS_H_ #include "dbus_cpp.h" +#include "video_controls-glue.h" #include <tr1/memory> // for shared_ptr +#include "video/video_preferences.h" namespace sfl_video { class VideoPreview; } -class VideoControls - : public org::sflphone::SFLphone::ConfigurationManager_adaptor, +class VideoControls : public org::sflphone::SFLphone::VideoControls_adaptor, public DBus::IntrospectableAdaptor, public DBus::ObjectAdaptor { private: std::tr1::shared_ptr<sfl_video::VideoPreview> preview_; - VideoPreference videoPreference; + VideoPreference videoPreference_; public: VideoControls(DBus::Connection& connection); - static const char* SERVER_PATH; - std::vector< std::string > getVideoCodecList(); - std::vector< std::string > getVideoCodecDetails(const std::string& payload); - std::vector<std::string> getActiveVideoCodecList(const std::string& accountID); - void setActiveVideoCodecList(const std::vector<std::string>& list, const std::string& accountID); + std::vector<std::string> getCodecList(); + std::vector<std::string> getCodecDetails(const std::string& payload); + std::vector<std::string> getActiveCodecList(const std::string& accountID); + void setActiveCodecList(const std::vector<std::string>& list, const std::string& accountID); - std::vector<std::string> getVideoInputDeviceList(); - std::vector<std::string> getVideoInputDeviceChannelList(const std::string &dev); - std::vector<std::string> getVideoInputDeviceSizeList(const std::string &dev, const std::string &channel); - std::vector<std::string> getVideoInputDeviceRateList(const std::string &dev, const std::string &channel, const std::string &size); - void setVideoInputDevice(const std::string& api); - void setVideoInputDeviceChannel(const std::string& api); - void setVideoInputDeviceSize(const std::string& api); - void setVideoInputDeviceRate(const std::string& api); - std::string getVideoInputDevice(); - std::string getVideoInputDeviceChannel(); - std::string getVideoInputDeviceSize(); - std::string getVideoInputDeviceRate(); + std::vector<std::string> getInputDeviceList(); + std::vector<std::string> getInputDeviceChannelList(const std::string &dev); + std::vector<std::string> getInputDeviceSizeList(const std::string &dev, const std::string &channel); + std::vector<std::string> getInputDeviceRateList(const std::string &dev, const std::string &channel, const std::string &size); + std::map<std::string, std::string> getSettings() const; + void setInputDevice(const std::string& api); + void setInputDeviceChannel(const std::string& api); + void setInputDeviceSize(const std::string& api); + void setInputDeviceRate(const std::string& api); + std::string getInputDevice(); + std::string getInputDeviceChannel(); + std::string getInputDeviceSize(); + std::string getInputDeviceRate(); - void startVideoPreview(int32_t &width, int32_t &height, int32_t &shmKey, int32_t &semKey, int32_t &videoBufferSize); - void stopVideoPreview(); - std::string getCurrentVideoCodecName(const std::string& callID); + void startPreview(int32_t &width, int32_t &height, int32_t &shmKey, int32_t &semKey, int32_t &bufferSize); + void stopPreview(); }; #endif // VIDEO_CONTROLS_H_ diff --git a/daemon/src/iax/iaxvoiplink.h b/daemon/src/iax/iaxvoiplink.h index 8e906c8acc1ac9082a9eec68807c1af77bfb95c0..ae53da8a9814566c30ea4590ed2090759831972a 100644 --- a/daemon/src/iax/iaxvoiplink.h +++ b/daemon/src/iax/iaxvoiplink.h @@ -32,6 +32,10 @@ #ifndef IAXVOIPLINK_H #define IAXVOIPLINK_H +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "voiplink.h" #include <iax-client.h> #include "audio/codecs/audiocodec.h" // for DEC_BUFFER_SIZE diff --git a/daemon/src/managerimpl.h b/daemon/src/managerimpl.h index 5d93b26765d448c6a361c65203b13f0864a1f2ac..c9684804072b011f14459602ad9fec5de1ec19cf 100644 --- a/daemon/src/managerimpl.h +++ b/daemon/src/managerimpl.h @@ -42,7 +42,7 @@ #include <cc++/thread.h> #include "dbus/dbusmanager.h" -#include "config/config.h" +#include "config/sfl_config.h" #include "call.h" #include "conference.h" diff --git a/daemon/src/sip/sdp.cpp b/daemon/src/sip/sdp.cpp index 2304b029fd4c59f79ff259fa47d06e2edab90e36..8bd3c55d1839fe70406d926bf2a6ba8cc2388f64 100644 --- a/daemon/src/sip/sdp.cpp +++ b/daemon/src/sip/sdp.cpp @@ -37,9 +37,12 @@ #include "sdp.h" #include "global.h" #include "manager.h" -#include "video/video_endpoint.h" #include <cassert> +#ifdef SFL_VIDEO +#include "video/video_endpoint.h" +#endif + Sdp::Sdp(pj_pool_t *pool) : memPool_(pool) , negotiator_(NULL) @@ -112,7 +115,7 @@ void Sdp::setActiveRemoteSdpSession(const pjmedia_sdp_session *sdp) return; } - for (unsigned i = 0; i < sdp->media_count; i++) + for (unsigned i = 0; i < sdp->media_count; i++) { if (pj_stricmp2(&sdp->media[i]->desc.media, "audio") == 0) { pjmedia_sdp_media *r_media = sdp->media[i]; static const pj_str_t STR_TELEPHONE_EVENT = { (char*) "telephone-event", 15}; @@ -126,6 +129,7 @@ void Sdp::setActiveRemoteSdpSession(const pjmedia_sdp_session *sdp) return; } + } ERROR("Sdp: Error: Could not found dtmf event from remote sdp"); } @@ -133,7 +137,7 @@ void Sdp::setActiveRemoteSdpSession(const pjmedia_sdp_session *sdp) #ifdef SFL_VIDEO std::string Sdp::getSessionVideoCodec() const { - if (sessionVideoMedia_.size().empty()) + if (sessionVideoMedia_.empty()) return ""; return sessionVideoMedia_[0]; } @@ -144,14 +148,14 @@ std::string Sdp::getAudioCodecName() const try { sfl::AudioCodec *codec = getSessionAudioMedia(); return codec ? codec->getMimeSubtype() : ""; - } catch(...) { + } catch (...) { return ""; } } sfl::AudioCodec* Sdp::getSessionAudioMedia() const { - if (sessionAudioMedia_.size() < 1) + if (sessionAudioMedia_.empty()) throw SdpException("No codec description for this media"); return dynamic_cast<sfl::AudioCodec *>(sessionAudioMedia_[0]); @@ -202,7 +206,7 @@ pjmedia_sdp_media *Sdp::setMediaDescriptorLine(bool audio) pjmedia_sdp_rtpmap rtpmap; rtpmap.pt = med->desc.fmt[i]; - rtpmap.enc_name = pj_str ((char*)enc_name.c_str()); + rtpmap.enc_name = pj_str((char*) enc_name.c_str()); rtpmap.clock_rate = clock_rate; rtpmap.param.ptr = ((char* const)""); rtpmap.param.slen = 0; @@ -301,7 +305,7 @@ void Sdp::setLocalMediaVideoCapabilities(const std::vector<std::string> &videoCo throw SdpException ("No selected video codec while building local SDP offer"); video_codec_list_.clear(); - const std::vector<std::string> &codecs_list = sfl_video::getVideoCodecList(); + const std::vector<std::string> &codecs_list = sfl_video::getCodecList(); for (unsigned i = 0; i < videoCodecs.size(); ++i) { const std::string &codec = videoCodecs[i]; for (unsigned j = 0; j < codecs_list.size(); ++j) { @@ -544,10 +548,6 @@ namespace } } // end anonymous namespace -Sdp::~Sdp() -{ -} - std::string Sdp::getLineFromLocalSDP(const std::string &keyword) const { assert(activeLocalSession_); @@ -570,7 +570,6 @@ std::vector<std::string> Sdp::getActiveVideoDescription() const ss << "s=sflphone" << std::endl; ss << "c=IN IP4 " << remoteIpAddr_ << std::endl; ss << "t=0 0" << std::endl; - //ss << "b=AS:1000" << std::endl; std::string videoLine(getLineFromLocalSDP("m=video")); ss << videoLine << std::endl; @@ -598,10 +597,10 @@ std::vector<std::string> Sdp::getActiveVideoDescription() const // get direction string static const pj_str_t DIRECTIONS[] = { - {(char*)"sendrecv", 8}, - {(char*)"sendonly", 8}, - {(char*)"recvonly", 8}, - {(char*)"inactive", 8}, + {(char*) "sendrecv", 8}, + {(char*) "sendonly", 8}, + {(char*) "recvonly", 8}, + {(char*) "inactive", 8}, {NULL, 0} }; pjmedia_sdp_attr *direction = NULL; diff --git a/daemon/src/sip/sdp.h b/daemon/src/sip/sdp.h index cd46eacdb046f9a7ec9e5cc4ad0c6505995bc609..c452f8f3efd6513133e79560d78226d91842ee41 100644 --- a/daemon/src/sip/sdp.h +++ b/daemon/src/sip/sdp.h @@ -29,8 +29,12 @@ * as that of the covered work. */ -#ifndef _SDP_H -#define _SDP_H +#ifndef SDP_H_ +#define SDP_H_ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include <pjmedia/sdp.h> #include <pjmedia/sdp_neg.h> @@ -70,8 +74,6 @@ class Sdp { */ Sdp(pj_pool_t *pool); - ~Sdp(); - /** * Accessor for the internal memory pool */ diff --git a/daemon/src/sip/sipcall.cpp b/daemon/src/sip/sipcall.cpp index 1dc5ef01eabef48dc1c26b7b5a4880e1ebe76054..f4c4a6e9d96c2bed37bfddd03c7339638dffe1bf 100644 --- a/daemon/src/sip/sipcall.cpp +++ b/daemon/src/sip/sipcall.cpp @@ -35,6 +35,8 @@ #include "logger.h" // for _debug #include "audio/audiortp/audio_rtp_factory.h" #include "sdp.h" +#include "manager.h" +#include "dbus/video_controls.h" #ifdef SFL_VIDEO #include "video/video_rtp_session.h" @@ -45,11 +47,12 @@ namespace { static const int INCREMENT_SIZE = INITIAL_SIZE; } -SIPCall::SIPCall(const std::string& id, Call::CallType type, pj_caching_pool *caching_pool) : Call(id, type) +SIPCall::SIPCall(const std::string& id, Call::CallType type, + pj_caching_pool *caching_pool) : Call(id, type) , inv(NULL) , audiortp_(this) #ifdef SFL_VIDEO - , videortp_(new sfl_video::VideoRtpSession) + , videortp_(new sfl_video::VideoRtpSession(Manager::instance().getDbusManager()->getVideoControls()->getSettings())) #endif , pool_(pj_pool_create(&caching_pool->factory, id.c_str(), INITIAL_SIZE, INCREMENT_SIZE, NULL)) , local_sdp_(new Sdp(pool_)) diff --git a/daemon/src/sip/sipcall.h b/daemon/src/sip/sipcall.h index 1d529c9f61d4a691e83889b715269c14f4b86503..5c173fdb61518eec559279e271c8161a6fcbc450 100644 --- a/daemon/src/sip/sipcall.h +++ b/daemon/src/sip/sipcall.h @@ -32,6 +32,10 @@ #ifndef __SIPCALL_H__ #define __SIPCALL_H__ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "call.h" #include <tr1/memory> #include "audio/audiortp/audio_rtp_factory.h" diff --git a/daemon/src/sip/sipvoiplink.cpp b/daemon/src/sip/sipvoiplink.cpp index 4f1fd25cc7583673dfbb6c08733997d077f43d2e..0dc4bd84a24c5cde643d893c3798955190ce62d0 100644 --- a/daemon/src/sip/sipvoiplink.cpp +++ b/daemon/src/sip/sipvoiplink.cpp @@ -2174,7 +2174,7 @@ void setCallMediaLocal(SIPCall* call, const std::string &localIP) call->setLocalIp(localIP); call->setLocalAudioPort(callLocalAudioPort); call->getLocalSDP()->setLocalPublishedAudioPort(callLocalExternAudioPort); -#if SFL_VIDEO +#ifdef SFL_VIDEO unsigned int callLocalVideoPort = ((rand() % 27250) + 5250) * 2; assert(callLocalAudioPort != callLocalVideoPort); call->setLocalVideoPort(callLocalVideoPort); diff --git a/daemon/src/sip/sipvoiplink.h b/daemon/src/sip/sipvoiplink.h index a18571fc4444ba7a36b658bd6899f5d88f197310..caa6b296348d10dccbb6b175837dc8d2bd732214 100644 --- a/daemon/src/sip/sipvoiplink.h +++ b/daemon/src/sip/sipvoiplink.h @@ -35,6 +35,10 @@ #ifndef SIPVOIPLINK_H_ #define SIPVOIPLINK_H_ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <map> ////////////////////////////// diff --git a/daemon/src/video/Makefile.am b/daemon/src/video/Makefile.am index 0bd9fd437c887b775a025ce0876662c1bc16f99f..46690a27dce2e34253bb9878775d45af7ce340b2 100644 --- a/daemon/src/video/Makefile.am +++ b/daemon/src/video/Makefile.am @@ -1,4 +1,3 @@ -if SFL_VIDEO include $(top_srcdir)/globals.mak SUBDIRS=test @@ -18,5 +17,3 @@ libvideo_la_LIBADD = @LIBAVCODEC_LIBS@ @LIBAVFORMAT_LIBS@ @LIBAVDEVICE_LIBS@ @LI AM_CXXFLAGS=@LIBAVCODEC_CFLAGS@ @LIBAVFORMAT_CFLAGS@ @LIBAVDEVICE_CFLAGS@ @LIBSWSCALE_CFLAGS@ @CCRTP_CFLAGS@ @UDEV_CFLAGS@ AM_CFLAGS=@LIBAVCODEC_CFLAGS@ @LIBAVFORMAT_CFLAGS@ @LIBAVDEVICE_CFLAGS@ @LIBSWSCALE_CFLAGS@ - -endif diff --git a/daemon/src/video/test/test_thread.cpp b/daemon/src/video/test/test_thread.cpp index 0f81a86929eb37cef465d97b0c96c2fc5eee591d..d1ae172604d5b2f7cded2da69dded10fba657b45 100644 --- a/daemon/src/video/test/test_thread.cpp +++ b/daemon/src/video/test/test_thread.cpp @@ -1,10 +1,11 @@ #include <cc++/thread.h> #include <memory> #include <iostream> +#include "noncopyable.h" class CancellableBusyThread : public ost::Thread { public: - CancellableBusyThread() + CancellableBusyThread() : x_(0) { setCancel(cancelImmediate); } @@ -37,11 +38,12 @@ class CancellableBusyThread : public ost::Thread { private: int *x_; + NON_COPYABLE(CancellableBusyThread); }; class EventThread : public ost::Thread { public: - EventThread() : ost::Thread(), x_(0) + EventThread() : ost::Thread(), x_(0), event_() {} virtual void run() diff --git a/daemon/src/video/test/test_video_endpoint.cpp b/daemon/src/video/test/test_video_endpoint.cpp index c21713cd4777aa3192dfe8fbccf222d16a64ffe9..f19d51ce4f313652d4a43a0e2d76775ac3ac3f00 100644 --- a/daemon/src/video/test/test_video_endpoint.cpp +++ b/daemon/src/video/test/test_video_endpoint.cpp @@ -40,7 +40,7 @@ void VideoEndpointTest::testListInstalledCodecs() { /* This would list codecs */ std::cout << "Installed codecs:" << std::endl; - std::vector<std::string> codecs = sfl_video::getVideoCodecList(); + std::vector<std::string> codecs = sfl_video::getCodecList(); std::vector<std::string>::iterator it; for (it = codecs.begin(); it != codecs.end(); ++it) std::cout << '\t' << *it << std::endl; diff --git a/daemon/src/video/test/test_video_rtp.cpp b/daemon/src/video/test/test_video_rtp.cpp index f13863b7a7773a1818561bc5c86345cafdeeacdb..e113c7750bf36db4d17c28470a11c8b456d6463d 100644 --- a/daemon/src/video/test/test_video_rtp.cpp +++ b/daemon/src/video/test/test_video_rtp.cpp @@ -34,10 +34,12 @@ #include <map> #include <string> #include "video_rtp_session.h" +#include "video_preferences.h" int main () { - sfl_video::VideoRtpSession session; + VideoPreference preference; + sfl_video::VideoRtpSession session(preference.getSettings()); session.start(); sleep(10); session.stop(); diff --git a/daemon/src/video/video_endpoint.cpp b/daemon/src/video/video_endpoint.cpp index 014c91836818f1d3d3c06f0e3ddc32bd41f9cb93..77c75581e42a92946ddda647213e00a783523381 100644 --- a/daemon/src/video/video_endpoint.cpp +++ b/daemon/src/video/video_endpoint.cpp @@ -49,7 +49,7 @@ int getBitRate(const std::string & /*codec*/) } } // end anonymous namespace -std::vector<std::string> getVideoCodecList() +std::vector<std::string> getCodecList() { return libav_utils::getVideoCodecList(); } diff --git a/daemon/src/video/video_endpoint.h b/daemon/src/video/video_endpoint.h index 87601ab0999290c0ea7a8cdfb278bd2c15301d56..9ed5d107a05e7736e36204e4f909e31bd8ce3450 100644 --- a/daemon/src/video/video_endpoint.h +++ b/daemon/src/video/video_endpoint.h @@ -28,8 +28,8 @@ * as that of the covered work. */ -#ifndef __VIDEO_ENDPOINT_H__ -#define __VIDEO_ENDPOINT_H__ +#ifndef VIDEO_ENDPOINT_H__ +#define VIDEO_ENDPOINT_H__ #include <vector> #include <string> @@ -38,9 +38,8 @@ namespace sfl_video { /** * Returns the list of codecs installed at runtime and that we support */ - std::vector<std::string> getVideoCodecList(); - + std::vector<std::string> getCodecList(); std::vector<std::string> getCodecSpecifications(const std::string &codec); } -#endif // __VIDEO_ENDPOINT_H__ +#endif // VIDEO_ENDPOINT_H__ diff --git a/daemon/src/video/video_preferences.cpp b/daemon/src/video/video_preferences.cpp index 1d735260127bf8d60860a0f218663bbfc5d35341..dea0faf2ecdb338927c1aeb6fae6e2e0929bf4c2 100644 --- a/daemon/src/video/video_preferences.cpp +++ b/daemon/src/video/video_preferences.cpp @@ -29,12 +29,15 @@ */ #include "video_preferences.h" +#include "video_v4l2_list.h" +#include "logger.h" #include <sstream> +using namespace sfl_video; + VideoPreference::VideoPreference() : - v4l2_list_(0), device_(), channel_(), size_(), rate_() + v4l2_list_(new VideoV4l2ListThread), device_(), channel_(), size_(), rate_() { - v4l2_list_ = new VideoV4l2ListThread(); v4l2_list_->start(); } @@ -43,23 +46,23 @@ VideoPreference::~VideoPreference() delete v4l2_list_; } -std::map<std::string, std::string> VideoPreference::getVideoSettings() +std::map<std::string, std::string> VideoPreference::getSettings() const { - std::map<std::string, std::string> map; + std::map<std::string, std::string> args; std::stringstream ss; - map["input"] = v4l2_list_->getDeviceNode(device_); + args["input"] = v4l2_list_->getDeviceNode(device_); ss << v4l2_list_->getChannelNum(device_, channel_); - map["channel"] = ss.str(); - map["video_size"] = size_; + args["channel"] = ss.str(); + args["video_size"] = size_; size_t x_pos = size_.find("x"); - map["width"] = size_.substr(0, x_pos); - map["height"] = size_.substr(x_pos + 1); - map["framerate"] = rate_; + args["width"] = size_.substr(0, x_pos); + args["height"] = size_.substr(x_pos + 1); + args["framerate"] = rate_; - return map; + return args; } -void VideoPreference::serialize (Conf::YamlEmitter *emitter) +void VideoPreference::serialize(Conf::YamlEmitter *emitter) { if (emitter == NULL) { ERROR("VideoPreference: Error: emitter is NULL while serializing"); @@ -81,7 +84,7 @@ void VideoPreference::serialize (Conf::YamlEmitter *emitter) emitter->serializeVideoPreference(&preferencemap); } -void VideoPreference::unserialize (Conf::MappingNode *map) +void VideoPreference::unserialize(Conf::MappingNode *map) { if (map == NULL) { ERROR("VideoPreference: Error: Preference map is NULL"); diff --git a/daemon/src/video/video_preferences.h b/daemon/src/video/video_preferences.h index 21f867c7e8c86e431be2537da816cf0288fb9717..73ea2d62cd729dbf3918f5f7adeb9e64850f568c 100644 --- a/daemon/src/video/video_preferences.h +++ b/daemon/src/video/video_preferences.h @@ -31,6 +31,7 @@ #ifndef VIDEO_PREFERENCE_H__ #define VIDEO_PREFERENCE_H__ +#include "config/serializable.h" #include "video/video_v4l2_list.h" #include "video/video_v4l2.h" @@ -54,7 +55,7 @@ class VideoPreference : public Serializable virtual void unserialize(Conf::MappingNode *map); - std::map<std::string, std::string> getVideoSettings(); + std::map<std::string, std::string> getSettings() const; std::string getDevice() const { return device_; diff --git a/daemon/src/video/video_receive_thread.cpp b/daemon/src/video/video_receive_thread.cpp index 7b52eaa8485f36bcf4811b2c574797501b8d472c..1af5803b3844b89e2283db2d08fb78a9acddff7b 100644 --- a/daemon/src/video/video_receive_thread.cpp +++ b/daemon/src/video/video_receive_thread.cpp @@ -52,6 +52,7 @@ extern "C" { #include "manager.h" #include "dbus/callmanager.h" +#include "dbus/video_controls.h" #include "fileutils.h" static const enum PixelFormat video_rgb_format = PIX_FMT_BGRA; @@ -353,7 +354,7 @@ void VideoReceiveThread::setup() videoBufferSize_); // Fri Jul 15 12:15:59 EDT 2011:tmatth:FIXME: access to call manager // from this thread may not be thread-safe - Manager::instance().getDbusManager()->getCallManager()->receivingVideoEvent(shmKey_, + Manager::instance().getDbusManager()->getVideoControls()->receivingEvent(shmKey_, semKey_, videoBufferSize_, dstWidth_, dstHeight_); } } @@ -475,7 +476,7 @@ void VideoReceiveThread::run() VideoReceiveThread::~VideoReceiveThread() { // free resources, exit thread - Manager::instance().getDbusManager()->getCallManager()->stoppedReceivingVideoEvent(shmKey_, semKey_); + Manager::instance().getDbusManager()->getVideoControls()->stoppedReceivingEvent(shmKey_, semKey_); ost::Thread::terminate(); // make sure no one is waiting for the SHM event which will never come if we've error'd out diff --git a/daemon/src/video/video_rtp_session.cpp b/daemon/src/video/video_rtp_session.cpp index 0318f2ee35947f09001bdba6b055605da4dbafe8..7304a2cb823eae0cc5d70d6b790baa452bbb65e1 100644 --- a/daemon/src/video/video_rtp_session.cpp +++ b/daemon/src/video/video_rtp_session.cpp @@ -44,10 +44,9 @@ namespace sfl_video { -VideoRtpSession::VideoRtpSession() : sendThread_(), receiveThread_(), - txArgs_(), rxArgs_(), sending_(true), receiving_(true) +VideoRtpSession::VideoRtpSession(const std::map<std::string, std::string> &txArgs) : sendThread_(), receiveThread_(), + txArgs_(txArgs), rxArgs_(), sending_(true), receiving_(true) { - txArgs_ = Manager::instance().videoPreference.getVideoSettings(); txArgs_["bitrate"] = "500000"; } diff --git a/daemon/src/video/video_rtp_session.h b/daemon/src/video/video_rtp_session.h index ec855ae66b63980427cb3d2f7b535df51a4fe978..47ddfda610e3f4dd74fbcf7bf8740cbeadfd9ffa 100644 --- a/daemon/src/video/video_rtp_session.h +++ b/daemon/src/video/video_rtp_session.h @@ -44,7 +44,7 @@ class VideoReceiveThread; class VideoRtpSession { public: - VideoRtpSession(); + VideoRtpSession(const std::map<std::string, std::string> &txArgs); VideoRtpSession(const std::map<std::string, std::string> &txArgs, const std::map<std::string, std::string> &rxArgs); diff --git a/daemon/src/video/video_v4l2_list.cpp b/daemon/src/video/video_v4l2_list.cpp index 46fd8bc14c065e77a86d723b8d23b4535db0574d..0a578498086249371ff5827f3150795663b2489b 100644 --- a/daemon/src/video/video_v4l2_list.cpp +++ b/daemon/src/video/video_v4l2_list.cpp @@ -30,10 +30,6 @@ * as that of the covered work. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include <cstdio> #include <stdexcept> // for std::runtime_error #include <sstream> @@ -54,8 +50,8 @@ extern "C" { #include <cerrno> #include "video_v4l2_list.h" - #include "manager.h" +#include "dbus/video_controls.h" namespace sfl_video { @@ -223,7 +219,7 @@ void VideoV4l2ListThread::run() DEBUG("udev: adding %s", node); try { addDevice(node); - Manager::instance().notifyVideoDeviceEvent(); + Manager::instance().getDbusManager()->getVideoControls()->deviceEvent(); } catch (const std::runtime_error &e) { ERROR(e.what()); } @@ -256,7 +252,7 @@ void VideoV4l2ListThread::delDevice(const std::string &node) for (size_t i = 0 ; i < n ; i++) { if (devices_[i].device == node) { devices_.erase(devices_.begin() + i); - Manager::instance().notifyVideoDeviceEvent(); + Manager::instance().getDbusManager()->getVideoControls()->deviceEvent(); return; } } diff --git a/daemon/test/audiolayertest.h b/daemon/test/audiolayertest.h index 994cbaa62f96f567d60f8b97bf7232f9ec0c1895..06e857c1fc081db18d07043d5c01eb6ce004e240 100644 --- a/daemon/test/audiolayertest.h +++ b/daemon/test/audiolayertest.h @@ -47,7 +47,7 @@ // Application import #include "manager.h" -#include "config/config.h" +#include "config/sfl_config.h" #include "audio/audiolayer.h" #include "audio/alsa/alsalayer.h" diff --git a/daemon/test/echocanceltest.cpp b/daemon/test/echocanceltest.cpp index 53b03faed8b26b8237e923cb2d6452079c095d83..832b9ed0d996b07ac765de0d29b5098cb3cd3958 100644 --- a/daemon/test/echocanceltest.cpp +++ b/daemon/test/echocanceltest.cpp @@ -31,7 +31,7 @@ #include <iostream> #include "echocanceltest.h" -#include "config/config.h" +#include "config/sfl_config.h" using namespace std; diff --git a/daemon/test/gaincontroltest.cpp b/daemon/test/gaincontroltest.cpp index 916a110d71e0126a3d6d3ac18d96d8a20cc31ec6..fa3968ddcaeca4b06234a78db85c1f4bae03bd73 100644 --- a/daemon/test/gaincontroltest.cpp +++ b/daemon/test/gaincontroltest.cpp @@ -31,7 +31,7 @@ #include <iostream> #include "gaincontroltest.h" -#include "config/config.h" +#include "config/sfl_config.h" using namespace std; diff --git a/daemon/test/sdptest.cpp b/daemon/test/sdptest.cpp index 8feabcf139109cee1dc5d58f13813765d717c896..00a5495120332fa5abbaa66fae1d1346f858f685 100644 --- a/daemon/test/sdptest.cpp +++ b/daemon/test/sdptest.cpp @@ -28,6 +28,9 @@ * as that of the covered work. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "sdptest.h" #include <iostream> #include <cstring> @@ -218,7 +221,6 @@ void SDPTest::testInitialOfferLastCodec() CPPUNIT_ASSERT(session_->getRemoteIP().empty()); std::vector<int> codecSelection; - pjmedia_sdp_session *remoteAnswer; codecSelection.push_back(PAYLOAD_CODEC_ULAW); codecSelection.push_back(PAYLOAD_CODEC_ALAW); @@ -238,8 +240,8 @@ void SDPTest::testInitialOfferLastCodec() session_->createOffer(codecSelection); #endif - // pjmedia_sdp_parse(testPool_, test[0].offer_answer[0].sdp2, strlen(test[0].offer_answer[0].sdp2), &remoteAnswer); - pjmedia_sdp_parse(testPool_, (char*)sdp_answer2, strlen(sdp_answer2), &remoteAnswer); + pjmedia_sdp_session *remoteAnswer; + pjmedia_sdp_parse(testPool_, (char*) sdp_answer2, strlen(sdp_answer2), &remoteAnswer); session_->receivingAnswerAfterInitialOffer(remoteAnswer); session_->startNegotiation();