2
/* Ekiga -- A VoIP and Video-Conferencing application
3
* Copyright (C) 2000-2006 Damien Sandras
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20
* Ekiga is licensed under the GPL license and as a special exception,
21
* you have permission to link or otherwise combine this program with the
22
* programs OPAL, OpenH323 and PWLIB, and distribute the combination,
23
* without applying the requirements of the GNU GPL to the OPAL, OpenH323
24
* and PWLIB programs, as long as you do follow the requirements of the
25
* GNU GPL for all the rest of the software thus combined.
30
* videograbber.cpp - description
31
* --------------------------------
32
* begin : Mon Feb 12 2001
33
* copyright : (C) 2000-2006 by Damien Sandras
34
* description : Video4Linux compliant functions to manipulate the
39
#define P_FORCE_STATIC_PLUGIN
41
#include "videoinput.h"
44
/* Plugin definition */
45
class PVideoInputDevice_EKIGA_PluginServiceDescriptor
46
: public PDevicePluginServiceDescriptor
49
virtual PObject *CreateInstance (int) const
51
return new PVideoInputDevice_EKIGA (*(GnomeMeeting::Process ()->GetServiceCore ()));
55
virtual PStringArray GetDeviceNames(int) const
57
return PStringList("EKIGA");
60
virtual bool ValidateDeviceName (const PString & deviceName,
63
return deviceName.Find("EKIGA") == 0;
65
} PVideoInputDevice_EKIGA_descriptor;
67
PCREATE_PLUGIN(EKIGA, PVideoInputDevice, &PVideoInputDevice_EKIGA_descriptor);
69
int PVideoInputDevice_EKIGA::devices_nbr = 0;
71
PVideoInputDevice_EKIGA::PVideoInputDevice_EKIGA (Ekiga::ServiceCore & _core)
72
: core (_core), videoinput_core (*(dynamic_cast<Ekiga::VideoInputCore *> (_core.get ("videoinput-core"))))
79
PVideoInputDevice_EKIGA::~PVideoInputDevice_EKIGA ()
85
PVideoInputDevice_EKIGA::Open (const PString &/*name*/,
88
if (start_immediate) {
90
if (devices_nbr == 0) {
91
videoinput_core.set_stream_config(frameWidth, frameHeight, frameRate);
92
videoinput_core.start_stream();
105
PVideoInputDevice_EKIGA::IsOpen ()
112
PVideoInputDevice_EKIGA::Close ()
117
videoinput_core.stop_stream();
127
PVideoInputDevice_EKIGA::Start ()
130
if (devices_nbr == 0) {
131
videoinput_core.set_stream_config(frameWidth, frameHeight, frameRate);
132
videoinput_core.start_stream();
143
PVideoInputDevice_EKIGA::Stop ()
150
PVideoInputDevice_EKIGA::IsCapturing ()
152
return IsCapturing ();
157
PVideoInputDevice_EKIGA::GetDeviceNames() const
159
PStringArray devlist;
160
devlist.AppendString(GetDeviceName());
167
PVideoInputDevice_EKIGA::SetFrameSize (unsigned int width,
170
if (!PVideoDevice::SetFrameSize (width, height))
178
PVideoInputDevice_EKIGA::GetFrameData (BYTE *frame,
183
videoinput_core.get_frame_data((char*)frame, width, height);
185
*i = width * height * 3 / 2;
191
bool PVideoInputDevice_EKIGA::GetFrameDataNoDelay (BYTE *frame,
196
videoinput_core.get_frame_data((char*)frame, width, height);
198
*i = width * height * 3 / 2;
204
PVideoInputDevice_EKIGA::TestAllFormats ()
211
PVideoInputDevice_EKIGA::GetMaxFrameBytes ()
213
return CalculateFrameBytes (frameWidth, frameHeight, colourFormat);
218
PVideoInputDevice_EKIGA::SetVideoFormat (VideoFormat newFormat)
220
return PVideoDevice::SetVideoFormat (newFormat);
225
PVideoInputDevice_EKIGA::GetNumChannels()
232
PVideoInputDevice_EKIGA::SetChannel (int /*newChannel*/)
239
PVideoInputDevice_EKIGA::SetColourFormat (const PString &newFormat)
241
if (newFormat == "YUV420P")
242
return PVideoDevice::SetColourFormat (newFormat);
249
PVideoInputDevice_EKIGA::SetFrameRate (unsigned rate)
251
PVideoDevice::SetFrameRate (rate);
258
PVideoInputDevice_EKIGA::GetFrameSizeLimits (unsigned & minWidth,
259
unsigned & minHeight,
261
unsigned & maxHeight)
272
bool PVideoInputDevice_EKIGA::GetParameters (int *whiteness,