Commit aace00fc authored by Guillaume Roguez's avatar Guillaume Roguez
Browse files

#29579: moved Camera source adding in Conference class

parent 44fde29b
......@@ -42,7 +42,9 @@ const char * const SERVER_PATH = "/org/sflphone/SFLphone/VideoControls";
}
VideoControls::VideoControls(DBus::Connection& connection) :
DBus::ObjectAdaptor(connection, SERVER_PATH), preview_(), videoPreference_()
DBus::ObjectAdaptor(connection, SERVER_PATH)
, videoPreview_()
, videoPreference_()
{
// initialize libav libraries
libav_utils::sfl_avcodec_init();
......@@ -157,7 +159,7 @@ VideoControls::getSettings() {
void
VideoControls::startPreview()
{
if (preview_.get()) {
if (videoPreview_.get()) {
ERROR("Video preview was already started!");
return;
}
......@@ -166,15 +168,15 @@ VideoControls::startPreview()
using std::string;
map<string, string> args(videoPreference_.getSettings());
preview_.reset(new sfl_video::VideoCamera(args));
videoPreview_.reset(new sfl_video::VideoCamera(args));
}
void
VideoControls::stopPreview()
{
if (preview_.get()) {
if (videoPreview_.get()) {
DEBUG("Stopping video preview");
preview_.reset();
videoPreview_.reset();
} else {
WARN("Video preview was already stopped");
}
......@@ -182,13 +184,13 @@ VideoControls::stopPreview()
sfl_video::VideoSource* VideoControls::getVideoPreview()
{
return preview_.get();
return videoPreview_.get();
}
bool
VideoControls::hasPreviewStarted()
{
return preview_.get() != 0;
return videoPreview_.get() != 0;
}
std::string
......
......@@ -66,7 +66,7 @@ class VideoControls : public org::sflphone::SFLphone::VideoControls_adaptor,
public DBus::IntrospectableAdaptor,
public DBus::ObjectAdaptor {
private:
std::shared_ptr<sfl_video::VideoSource> preview_;
std::shared_ptr<sfl_video::VideoSource> videoPreview_;
VideoPreference videoPreference_;
public:
......@@ -126,7 +126,7 @@ class VideoControls : public org::sflphone::SFLphone::VideoControls_adaptor,
void startPreview();
void stopPreview();
bool hasPreviewStarted();
sfl_video::VideoSource *getVideoPreview();
sfl_video::VideoSource* getVideoPreview();
};
#endif // VIDEO_CONTROLS_H_
......@@ -36,6 +36,12 @@
#include "audio/audiolayer.h"
#include "audio/mainbuffer.h"
#ifdef SFL_VIDEO
#include "client/video_controls.h"
#include "video/video_camera.h"
#endif
Conference::Conference()
: id_(Manager::instance().getNewCallID())
, confState_(ACTIVE_ATTACHED)
......@@ -45,6 +51,15 @@ Conference::Conference()
#endif
{
Recordable::initRecFilename(id_);
#ifdef SFL_VIDEO
sfl_video::VideoCamera *camera = static_cast<sfl_video::VideoCamera*>(Manager::instance().getVideoControls()->getVideoPreview());
if (camera) {
videoMixer_.addSource(camera);
camera->setMixer(&videoMixer_);
}
#endif
}
Conference::ConferenceState Conference::getState() const
......
......@@ -50,14 +50,9 @@ VideoMixer::VideoMixer() :
, width_(0)
, height_(0)
{
VideoCamera* camera;
pthread_mutex_init(&updateMutex_, NULL);
pthread_cond_init(&updateCondition_, NULL);
start();
camera = dynamic_cast<VideoCamera*>(Manager::instance().getVideoControls()->getVideoPreview());
sourceList_.push_front(camera);
camera->setMixer(this);
}
VideoMixer::~VideoMixer()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment