----- Mail original -----
> De: "Tristan Matthews" <[email protected]>
> À: "Vivien Didelot" <[email protected]>
> Cc: "guillaume roguez" <[email protected]>,
> [email protected]
> Envoyé: Jeudi 20 Février 2014 17:32:13
> Objet: Re: [PATCH 3/3] daemon: (VideoInput) add support for x11grab
>
>
>
> ----- Original Message -----
> > From: "Vivien Didelot" <[email protected]>
> > To: [email protected]
> > Cc: "tristan matthews" <[email protected]>,
> > "guillaume roguez"
> > <[email protected]>, "Vivien Didelot"
> > <[email protected]>
> > Sent: Thursday, February 20, 2014 1:44:53 AM
> > Subject: [PATCH 3/3] daemon: (VideoInput) add support for x11grab
> >
> > This patch adds support for X11 screen sharing in the VideoInput
> > class.
> > The expected string device to instanciate a new video input for X11
> > is
> > the standard display name (usually the content of $DISPLAY),
> > optionally
> > following by a space and a video size. For instance:
> >
> > ":0.0" or ":0.0 1024x768"
> >
> > Refs: #40806
> > ---
> > daemon/src/video/video_input.cpp | 28 +++++++++++++++++++++++++++-
> > daemon/src/video/video_input.h | 1 +
> > 2 files changed, 28 insertions(+), 1 deletion(-)
> >
> > diff --git a/daemon/src/video/video_input.cpp
> > b/daemon/src/video/video_input.cpp
> > index 1089534..b8394a1 100644
> > --- a/daemon/src/video/video_input.cpp
> > +++ b/daemon/src/video/video_input.cpp
> > @@ -56,7 +56,14 @@ VideoInput::VideoInput(const std::string&
> > device)
> > :
> > , framerate_()
> > , video_size_()
> > {
> > - initCamera(device);
> > + /* TODO better check for the X11 display name */
> > + if (device.find(':') != std::string::npos) {
>
> Yikes, I can see how this might be the quick fix for now but looking
> for a semi-colon/parsing the device string to deduce the type in
> general seems
> very fragile. Any idea as to how we can be more explicit about what
> type of input it is?
> I would assume that the caller should already know what type of input
> they're creating.
>
Exactly, the caller formats the string and give it via dbus.
Actually, a camera name is for example "Integrated Camera" or
"Microsoft® LifeCam Cinema(TM)" (got from getActiveDevice() methods.
I wanted to provide a valid display name for X11 (see 'man X'),
but it doesn't support height and width. So actually, the patch allows
an optional space and video_size.
If we want to add our own convention, we could certainly expect a prefix
string such as: "display://:0.0@1024x768". Our call to decide.
> > + DEBUG("Init screen display %s\n", device.c_str());
> > + initX11(device);
> > + } else {
> > + DEBUG("Init camera %s\n", device.c_str());
> > + initCamera(device);
> > + }
> >
> > start();
> > }
> > @@ -80,6 +87,25 @@ void VideoInput::initCamera(std::string device)
> > video_size_ = map["video_size"];
> > }
> >
> > +void VideoInput::initX11(std::string device)
> > +{
> > + size_t space = device.find(' ');
> > +
> > + if (space != std::string::npos) {
> > + video_size_ = device.substr(space + 1);
> > + input_ = device.erase(space);
> > + } else {
> > + input_ = device;
> > + video_size_ = "vga";
> > + }
> > +
> > + format_ = "x11grab";
> > + framerate_ = "25";
> > + mirror_ = false;
> > +
> > + DEBUG("X11 display name %s (%s)", input_.c_str(),
> > video_size_.c_str());
> > +}
> > +
> > bool VideoInput::setup()
> > {
> > decoder_ = new VideoDecoder();
> > diff --git a/daemon/src/video/video_input.h
> > b/daemon/src/video/video_input.h
> > index 3d8b048..cb7bea7 100644
> > --- a/daemon/src/video/video_input.h
> > +++ b/daemon/src/video/video_input.h
> > @@ -74,6 +74,7 @@ private:
> > std::string video_size_;
> >
> > void initCamera(std::string device);
>
> Maybe rename initCamera to initV4l2 (could be in a separate patch).
>
> > + void initX11(std::string device);
> >
> > // as SFLThread
> > bool setup();
> > --
> > 1.8.5.4
> >
> >
>
> Nits aside, it's fine for now since we only have two types of
> VideoInputs. Please merge.
>
> 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