Hi, ----- Original Message ----- > From: "Vivien Didelot" <[email protected]> > To: [email protected] > Cc: "Vivien Didelot" <[email protected]>, "Tristan Matthews" > <[email protected]> > Sent: Thursday, February 13, 2014 11:25:45 AM > Subject: [PATCH] * #40804: daemon: rename VideoCamera to VideoInput > > This patch renames the VideoCamera class to VideoInput. > Note that the rename only affect the code currently, not the dbus > API. > This means that in the dbus API, we still have some VideoCamera > methods. > --- > daemon/src/client/dbus/video_controls.cpp | 24 > +++++++++---------- > daemon/src/client/video_controls.h | 4 ++-- > daemon/src/conference.cpp | 2 +- > daemon/src/video/Makefile.am | 2 +- > daemon/src/video/test/Makefile.am | 8 +++---- > daemon/src/video/test/test_video_camera.cpp | 12 +++++----- > daemon/src/video/test/test_video_camera.h | 10 ++++---- > .../video/{video_camera.cpp => video_input.cpp} | 27 > +++++++++++----------- > daemon/src/video/{video_camera.h => video_input.h} | 17 > +++++++------- > daemon/src/video/video_mixer.cpp | 8 +++---- > daemon/src/video/video_rtp_session.cpp | 8 +++---- > daemon/src/video/video_v4l2.cpp | 2 +- > 12 files changed, 63 insertions(+), 61 deletions(-) > rename daemon/src/video/{video_camera.cpp => video_input.cpp} (88%) > rename daemon/src/video/{video_camera.h => video_input.h} (86%) > > diff --git a/daemon/src/client/dbus/video_controls.cpp > b/daemon/src/client/dbus/video_controls.cpp > index b93e6c8..e2b61a1 100644 > --- a/daemon/src/client/dbus/video_controls.cpp > +++ b/daemon/src/client/dbus/video_controls.cpp > @@ -32,7 +32,7 @@ > > #include "video_controls.h" > #include "video/libav_utils.h" > -#include "video/video_camera.h" > +#include "video/video_input.h" > #include "account.h" > #include "logger.h" > #include "manager.h" > @@ -43,9 +43,9 @@ const char * const SERVER_PATH = > "/org/sflphone/SFLphone/VideoControls"; > > VideoControls::VideoControls(DBus::Connection& connection) : > DBus::ObjectAdaptor(connection, SERVER_PATH) > - , videoCamera_() > + , videoInput_() > , videoPreference_() > - , cameraClients_(0) > + , inputClients_(0) > { > // initialize libav libraries > libav_utils::sfl_avcodec_init(); > @@ -160,8 +160,8 @@ VideoControls::getSettings() { > void > VideoControls::startCamera() > { > - cameraClients_++; > - if (videoCamera_) { > + inputClients_++; > + if (videoInput_) { > WARN("Video preview was already started!"); > return; > } > @@ -170,17 +170,17 @@ VideoControls::startCamera() > using std::string; > > map<string, string> args(videoPreference_.getSettings()); > - videoCamera_.reset(new sfl_video::VideoCamera(args)); > + videoInput_.reset(new sfl_video::VideoInput(args)); > } > > void > VideoControls::stopCamera() > { > - if (videoCamera_) { > + if (videoInput_) { > DEBUG("Stopping video preview"); > - cameraClients_--; > - if (cameraClients_ <= 0) > - videoCamera_.reset(); > + inputClients_--; > + if (inputClients_ <= 0) > + videoInput_.reset(); > } else { > WARN("Video preview was already stopped"); > } > @@ -189,14 +189,14 @@ VideoControls::stopCamera() > std::weak_ptr<sfl_video::VideoFrameActiveWriter> > VideoControls::getVideoCamera() > { > - return videoCamera_; > + return videoInput_; > } > > bool > VideoControls::hasCameraStarted() > { > // see http://stackoverflow.com/a/7580064/21185 > - return static_cast<bool>(videoCamera_); > + return static_cast<bool>(videoInput_); > } > > std::string > diff --git a/daemon/src/client/video_controls.h > b/daemon/src/client/video_controls.h > index 8d98dd5..0a5fc88 100644 > --- a/daemon/src/client/video_controls.h > +++ b/daemon/src/client/video_controls.h > @@ -63,10 +63,10 @@ class VideoControls : public > org::sflphone::SFLphone::VideoControls_adaptor, > public DBus::IntrospectableAdaptor, > public DBus::ObjectAdaptor { > private: > - std::shared_ptr<sfl_video::VideoFrameActiveWriter> > videoCamera_; > + std::shared_ptr<sfl_video::VideoFrameActiveWriter> > videoInput_; > VideoPreference videoPreference_; > // Only modified from main thread > - int cameraClients_; > + int inputClients_; > > public: > > diff --git a/daemon/src/conference.cpp b/daemon/src/conference.cpp > index 70c38e3..90940de 100644 > --- a/daemon/src/conference.cpp > +++ b/daemon/src/conference.cpp > @@ -40,7 +40,7 @@ > #include "sip/sipvoiplink.h" > #include "sip/sipcall.h" > #include "client/video_controls.h" > -#include "video/video_camera.h" > +#include "video/video_input.h" > #endif > > #include "logger.h" > diff --git a/daemon/src/video/Makefile.am > b/daemon/src/video/Makefile.am > index 2187c8e..225be03 100644 > --- a/daemon/src/video/Makefile.am > +++ b/daemon/src/video/Makefile.am > @@ -14,7 +14,7 @@ libvideo_la_SOURCES = \ > video_mixer.cpp video_mixer.h \ > socket_pair.cpp socket_pair.h \ > shm_sink.cpp shm_sink.h \ > - video_camera.cpp video_camera.h \ > + video_input.cpp video_input.h \ > video_receive_thread.cpp video_receive_thread.h \ > video_sender.cpp video_sender.h \ > video_rtp_session.cpp video_rtp_session.h \ > diff --git a/daemon/src/video/test/Makefile.am > b/daemon/src/video/test/Makefile.am > index c0a731a..79a0847 100644 > --- a/daemon/src/video/test/Makefile.am > +++ b/daemon/src/video/test/Makefile.am > @@ -1,7 +1,7 @@ > include ../../../globals.mak > > -TESTS=test_video_endpoint test_v4l2 test_shm test_video_camera > test_video_rtp > -check_PROGRAMS=test_video_endpoint test_video_rtp test_video_camera > test_v4l2 test_shm > +TESTS=test_video_endpoint test_v4l2 test_shm test_video_input > test_video_rtp > +check_PROGRAMS=test_video_endpoint test_video_rtp test_video_input > test_v4l2 test_shm > > test_video_endpoint_SOURCES=test_video_endpoint.cpp > test_video_endpoint.h > test_video_endpoint_LDADD=$(top_builddir)/src/libsflphone.la > $(top_builddir)/src/video/libvideo.la $(YAML_LIBS) > @@ -9,8 +9,8 @@ > test_video_endpoint_LDADD=$(top_builddir)/src/libsflphone.la > $(top_builddir)/src > test_video_rtp_SOURCES=test_video_rtp.cpp > test_video_rtp_LDADD=$(top_builddir)/src/libsflphone.la > $(top_builddir)/src/video/libvideo.la $(YAML_LIBS) > > -test_video_camera_SOURCES=test_video_camera.cpp test_video_camera.h > -test_video_camera_LDADD=$(top_builddir)/src/libsflphone.la > $(top_builddir)/src/video/libvideo.la $(YAML_LIBS) > +test_video_input_SOURCES=test_video_input.cpp test_video_input.h > +test_video_input_LDADD=$(top_builddir)/src/libsflphone.la > $(top_builddir)/src/video/libvideo.la $(YAML_LIBS) > > test_v4l2_SOURCES=test_v4l2.cpp $(top_srcdir)/src/logger.cpp > test_v4l2_LDADD=$(top_builddir)/src/libsflphone.la > $(top_builddir)/src/video/libvideo.la $(YAML_LIBS) > diff --git a/daemon/src/video/test/test_video_camera.cpp > b/daemon/src/video/test/test_video_camera.cpp > index 51f656c..35922ec 100644 > --- a/daemon/src/video/test/test_video_camera.cpp > +++ b/daemon/src/video/test/test_video_camera.cpp > @@ -29,29 +29,29 @@ > */ > > #include <unistd.h> // for sleep > -#include "test_video_camera.h" > -#include "video_camera.h" > +#include "test_video_input.h" > +#include "video_input.h" > #include <map> > #include <string> > > using namespace std; > > -void VideoCameraTest::testCamera() > +void VideoInputTest::testInput() > { > std::map<std::string, std::string> args; > args["input"] = "/dev/video0"; > args["width"] = "640"; > args["height"] = "480"; > > - sfl_video::VideoCamera camera(args); > + sfl_video::VideoInput camera(args); > sleep(1); > } > > int main () > { > for (int i = 0; i < 20; ++i) { > - VideoCameraTest test; > - test.testCamera(); > + VideoInputTest test; > + test.testInput(); > } > return 0; > } > diff --git a/daemon/src/video/test/test_video_camera.h > b/daemon/src/video/test/test_video_camera.h > index 5db1e9c..d80768e 100644 > --- a/daemon/src/video/test/test_video_camera.h > +++ b/daemon/src/video/test/test_video_camera.h > @@ -28,12 +28,12 @@ > * as that of the covered work. > */ > > -#ifndef _VIDEO_CAMERA_TEST_ > -#define _VIDEO_CAMERA_TEST_ > +#ifndef _VIDEO_INPUT_TEST_ > +#define _VIDEO_INPUT_TEST_ > > -class VideoCameraTest { > +class VideoInputTest { > public: > - void testCamera(); > + void testInput(); > }; > > -#endif // _VIDEO_CAMERA_TEST_ > +#endif // _VIDEO_INPUT_TEST_ > diff --git a/daemon/src/video/video_camera.cpp > b/daemon/src/video/video_input.cpp > similarity index 88% > rename from daemon/src/video/video_camera.cpp > rename to daemon/src/video/video_input.cpp > index c4a45c5..1de4ba1 100644 > --- a/daemon/src/video/video_camera.cpp > +++ b/daemon/src/video/video_input.cpp > @@ -1,6 +1,7 @@ > /* > - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. > + * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. > * Author: Tristan Matthews <[email protected]> > + * Author: Vivien Didelot <[email protected]> > * > * This program is free software; you can redistribute it and/or > modify > * it under the terms of the GNU General Public License as > published by > @@ -28,7 +29,7 @@ > * as that of the covered work. > */ > > -#include "video_camera.h" > +#include "video_input.h" > #include "video_decoder.h" > #include "check.h" > > @@ -44,7 +45,7 @@ namespace sfl_video { > > using std::string; > > -VideoCamera::VideoCamera(const std::map<std::string, std::string> > &args) : > +VideoInput::VideoInput(const std::map<std::string, std::string> > &args) : > VideoGenerator::VideoGenerator() > , id_(SINK_ID) > , args_(args) > @@ -54,13 +55,13 @@ VideoCamera::VideoCamera(const > std::map<std::string, std::string> &args) : > , sinkHeight_(0) > { start(); } > > -VideoCamera::~VideoCamera() > +VideoInput::~VideoInput() > { > stop(); > join(); > } > > -bool VideoCamera::setup() > +bool VideoInput::setup() > { > // it's a v4l device if starting with /dev/video > static const char * const V4L_PATH = "/dev/video"; > @@ -111,10 +112,10 @@ bool VideoCamera::setup() > return true; > } > > -void VideoCamera::process() > +void VideoInput::process() > { captureFrame(); } > > -void VideoCamera::cleanup() > +void VideoInput::cleanup() > { > if (detach(&sink_)) { > Manager::instance().getVideoControls()->stoppedDecoding(id_, > sink_.openedName()); > @@ -124,13 +125,13 @@ void VideoCamera::cleanup() > delete decoder_; > } > > -int VideoCamera::interruptCb(void *data) > +int VideoInput::interruptCb(void *data) > { > - VideoCamera *context = static_cast<VideoCamera*>(data); > + VideoInput *context = static_cast<VideoInput*>(data); > return not context->isRunning(); > } > > -bool VideoCamera::captureFrame() > +bool VideoInput::captureFrame() > { > VideoFrame& frame = getNewFrame(); > int ret = decoder_->decode(frame); > @@ -146,13 +147,13 @@ bool VideoCamera::captureFrame() > return true; > } > > -int VideoCamera::getWidth() const > +int VideoInput::getWidth() const > { return decoder_->getWidth(); } > > -int VideoCamera::getHeight() const > +int VideoInput::getHeight() const > { return decoder_->getHeight(); } > > -int VideoCamera::getPixelFormat() const > +int VideoInput::getPixelFormat() const > { return decoder_->getPixelFormat(); } > > > diff --git a/daemon/src/video/video_camera.h > b/daemon/src/video/video_input.h > similarity index 86% > rename from daemon/src/video/video_camera.h > rename to daemon/src/video/video_input.h > index 9a1e52a..655abfe 100644 > --- a/daemon/src/video/video_camera.h > +++ b/daemon/src/video/video_input.h > @@ -1,8 +1,9 @@ > /* > - * Copyright (C) 2011-2013 Savoir-Faire Linux Inc. > + * Copyright (C) 2011-2014 Savoir-Faire Linux Inc. > * > * Author: Tristan Matthews <[email protected]> > * Author: Guillaume Roguez <[email protected]> > + * Author: Vivien Didelot <[email protected]> > * > * This program is free software; you can redistribute it and/or > modify > * it under the terms of the GNU General Public License as > published by > @@ -30,8 +31,8 @@ > * as that of the covered work. > */ > > -#ifndef __VIDEO_CAMERA_H__ > -#define __VIDEO_CAMERA_H__ > +#ifndef __VIDEO_INPUT_H__ > +#define __VIDEO_INPUT_H__ > > #include "noncopyable.h" > #include "shm_sink.h" > @@ -45,13 +46,13 @@ > namespace sfl_video { > using std::string; > > -class VideoCamera : > +class VideoInput : > public VideoGenerator, > public SFLThread > { > public: > - VideoCamera(const std::map<string, string> &args); > - ~VideoCamera(); > + VideoInput(const std::map<string, string> &args); > + ~VideoInput(); > > // as VideoGenerator > int getWidth() const; > @@ -59,7 +60,7 @@ public: > int getPixelFormat() const; > > private: > - NON_COPYABLE(VideoCamera); > + NON_COPYABLE(VideoInput); > > std::string id_; > std::map<string, string> args_; > @@ -79,4 +80,4 @@ private: > > } > > -#endif // __VIDEO_CAMERA_H__ > +#endif // __VIDEO_INPUT_H__ > diff --git a/daemon/src/video/video_mixer.cpp > b/daemon/src/video/video_mixer.cpp > index 16879b3..6e8bf2c 100644 > --- a/daemon/src/video/video_mixer.cpp > +++ b/daemon/src/video/video_mixer.cpp > @@ -52,20 +52,20 @@ VideoMixer::VideoMixer(const std::string &id) : > , sink_(id + VIDEO_MIXER_SUFFIX) > { > auto videoCtrl = Manager::instance().getVideoControls(); > - if (!videoCtrl->hasCameraStarted()) { > - videoCtrl->startCamera(); > + if (!videoCtrl->hasInputStarted()) { > + videoCtrl->startInput(); > MYSLEEP(1); > } > > // Local video camera is always attached > - if (auto shared = videoCtrl->getVideoCamera().lock()) > + if (auto shared = videoCtrl->getVideoInput().lock()) > shared->attach(this); > } > > VideoMixer::~VideoMixer() > { > auto videoCtrl = Manager::instance().getVideoControls(); > - if (auto shared = videoCtrl->getVideoCamera().lock()) > + if (auto shared = videoCtrl->getVideoInput().lock()) > shared->detach(this); > stop_sink(); > } > diff --git a/daemon/src/video/video_rtp_session.cpp > b/daemon/src/video/video_rtp_session.cpp > index c7986d8..6e7d865 100644 > --- a/daemon/src/video/video_rtp_session.cpp > +++ b/daemon/src/video/video_rtp_session.cpp > @@ -142,12 +142,12 @@ void VideoRtpSession::start(int localPort) > if (sending_) { > // Local video startup if needed > auto videoCtrl = Manager::instance().getVideoControls(); > - const bool firstStart = not videoCtrl->hasCameraStarted(); > - videoCtrl->startCamera(); > + const bool firstStart = not videoCtrl->hasInputStarted(); > + videoCtrl->startInput(); > if (firstStart) > MYSLEEP(1); > > - videoLocal_ = videoCtrl->getVideoCamera(); > + videoLocal_ = videoCtrl->getVideoInput(); > if (sender_) > WARN("Restarting video sender"); > > @@ -210,7 +210,7 @@ void VideoRtpSession::stop() > sender_.reset(); > socketPair_.reset(); > auto videoCtrl = Manager::instance().getVideoControls(); > - videoCtrl->stopCamera(); > + videoCtrl->stopInput(); > } > > void VideoRtpSession::forceKeyFrame() > diff --git a/daemon/src/video/video_v4l2.cpp > b/daemon/src/video/video_v4l2.cpp > index 62c04eb..bea2500 100644 > --- a/daemon/src/video/video_v4l2.cpp > +++ b/daemon/src/video/video_v4l2.cpp > @@ -339,7 +339,7 @@ VideoV4l2Device::VideoV4l2Device(int fd, const > string &device) : > if (idx != input.index) > break; > > - if (input.type & V4L2_INPUT_TYPE_CAMERA) { > + if (input.type & V4L2_CAMERA_TYPE_INPUT) {
Doesn't compile, that's a #define that comes from linux/videodev2.h Best, Tristan -- Tristan Matthews Développeur de logiciels libres [email protected] Ligne directe: 514-276-5468 poste 190 Fax : 514-276-5465 7275 Saint Urbain Bureau 200 Montréal, QC, H2R 2Y5 _______________________________________________ SFLphone mailing list [email protected] http://lists.savoirfairelinux.net/mailman/listinfo/sflphone
