* #8357: daemon now builds with video enabled

This commit is contained in:
Tristan Matthews
2012-01-26 18:58:53 -05:00
parent 8cc2cb0fce
commit 80d4ae8d68
44 changed files with 246 additions and 206 deletions

View File

@ -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]))

View File

@ -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@ \

View File

@ -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));
}

View File

@ -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;

View File

@ -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 \

View File

@ -29,7 +29,7 @@
* as that of the covered work.
*/
#include "config.h"
#include "sfl_config.h"
#include "../global.h"
#include <fstream>
#include <cstdlib>

View File

@ -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_

View File

@ -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>

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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)

View File

@ -56,11 +56,9 @@ class ConfigurationManager
: public org::sflphone::SFLphone::ConfigurationManager_adaptor,
public DBus::IntrospectableAdaptor,
public DBus::ObjectAdaptor {
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);

View File

@ -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)

View File

@ -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();

View File

@ -62,5 +62,4 @@ class Instance
};
#endif//INSTANCE_H
#endif // INSTANCE_H

View File

@ -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">

View File

@ -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");

View File

@ -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_

View File

@ -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

View File

@ -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"

View File

@ -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;

View File

@ -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
*/

View File

@ -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_))

View File

@ -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"

View File

@ -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);

View File

@ -35,6 +35,10 @@
#ifndef SIPVOIPLINK_H_
#define SIPVOIPLINK_H_
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <map>
//////////////////////////////

View File

@ -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

View File

@ -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()

View File

@ -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;

View File

@ -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();

View File

@ -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();
}

View File

@ -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__

View File

@ -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");

View File

@ -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_;

View File

@ -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

View File

@ -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";
}

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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"

View File

@ -31,7 +31,7 @@
#include <iostream>
#include "echocanceltest.h"
#include "config/config.h"
#include "config/sfl_config.h"
using namespace std;

View File

@ -31,7 +31,7 @@
#include <iostream>
#include "gaincontroltest.h"
#include "config/config.h"
#include "config/sfl_config.h"
using namespace std;

View File

@ -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();