~ubuntu-branches/ubuntu/karmic/ekiga/karmic

« back to all changes in this revision

Viewing changes to src/devices/videoinput.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Ken VanDine
  • Date: 2009-03-17 15:14:12 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20090317151412-no6uq0wl8zz2hsw3
Tags: 3.2.0-0ubuntu1
* New upstream release (LP: #341367)
  - Better NAT support in case of Cone NAT
  - Uniformise detection of libnotify; fix compilation with mingw
  - Fix "URL completion combobox shows identical completions"
  - Fix "Assistant loosing values when going backward"
  - Fix GmConf settings when compiled with another package name
  - Fix unregistration of accounts
  - Fix build with --enable-kde
  - Fixed possible crash when retrieving presence information
  - New translations: crh, or
  - Updated translations: as, bg, bn_IN, da, de, el, eu, gl, gu, hi, hu,
    ja, kn, ko, ku, lt, ml, mr, or, pt, ro, ru, ta, te, tr
  - New help translation: en_GB
  - Updated help translation: fr
  - Better NAT support in case of Cone NAT
  - There is now only one H.263 plugin implementing both H.263 and H.263+
  - Allow several ALSA devices to have the same name
  - Added support for the G.722 audio codec: G.722 is a 16 kHz wideband
    audio codec advertised as HD Voice by the famous Polycom. It is a
    great boost in quality and interoperability
  - Added support for the CELT ultral-low delay audio codec: CELT delivers
    high quality audio at 32 kHz or 48 kHz, allowing to transmit music in
    high quality, with low delay and low bitrate
  - Added support for SIP dialog-info notifications: they allow displaying
    notifications of incoming calls in the roster. With software like
    kamailio or Asterisk, it allows being informed of incoming calls
    reaching your colleagues
  - Largely improved LDAP support: the OpenLDAP guys contributed several
    patches to provide state-of-the-art LDAP support in the Ekiga address
    book. The new code even supports authentication
  - Killed the gconf_test_age test, Ekiga can now finally work with
    badly installed GConf schemas
  - Better handling of multiple network interfaces with dynamic addition
    and removal
  - Added settings migration from Ekiga 2.0.x.
  - Other various fixes, cleanups, removal of deprecated symbols etc.
  - New translations: crh, or
  - New help translation: en_GB, eu
  - Updated many translations and help
  - Experimental features:
    * Significant improvements in IPv6 support
    * Gstreamer audio and video capture support near to be finished...
* debian/patches/migrate_2.0_settings.patch:
  - Removed, migration is now upstream
* debian/patches/00_news.patch
  - Removed
* debian/patches/ubuntu_lpi.patch:
  - Modified to work with 3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
/* Ekiga -- A VoIP and Video-Conferencing application
3
 
 * Copyright (C) 2000-2006 Damien Sandras
4
 
 *
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.
9
 
 *
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.
14
 
 *
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.
18
 
 *
19
 
 *
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.
26
 
 */
27
 
 
28
 
 
29
 
/*
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 
35
 
 *                          webcam device.
36
 
 *
37
 
 */
38
 
 
39
 
#define P_FORCE_STATIC_PLUGIN
40
 
 
41
 
#include "videoinput.h"
42
 
#include "ekiga.h"
43
 
 
44
 
/* Plugin definition */
45
 
class PVideoInputDevice_EKIGA_PluginServiceDescriptor 
46
 
: public PDevicePluginServiceDescriptor
47
 
{
48
 
  public:
49
 
    virtual PObject *CreateInstance (int) const 
50
 
      {
51
 
        return new PVideoInputDevice_EKIGA (*(GnomeMeeting::Process ()->GetServiceCore ())); 
52
 
      }
53
 
    
54
 
    
55
 
    virtual PStringArray GetDeviceNames(int) const 
56
 
      { 
57
 
        return PStringList("EKIGA"); 
58
 
      }
59
 
    
60
 
    virtual bool ValidateDeviceName (const PString & deviceName, 
61
 
                                     int) const 
62
 
      { 
63
 
        return deviceName.Find("EKIGA") == 0; 
64
 
      }
65
 
} PVideoInputDevice_EKIGA_descriptor;
66
 
 
67
 
PCREATE_PLUGIN(EKIGA, PVideoInputDevice, &PVideoInputDevice_EKIGA_descriptor);
68
 
 
69
 
int PVideoInputDevice_EKIGA::devices_nbr = 0;
70
 
 
71
 
PVideoInputDevice_EKIGA::PVideoInputDevice_EKIGA (Ekiga::ServiceCore & _core)
72
 
: core (_core), videoinput_core (*(dynamic_cast<Ekiga::VideoInputCore *> (_core.get ("videoinput-core"))))
73
 
{
74
 
  opened = false;
75
 
  is_active = false;
76
 
}
77
 
 
78
 
 
79
 
PVideoInputDevice_EKIGA::~PVideoInputDevice_EKIGA ()
80
 
{
81
 
  Close ();
82
 
}
83
 
 
84
 
bool
85
 
PVideoInputDevice_EKIGA::Open (const PString &/*name*/,
86
 
                               bool start_immediate)
87
 
{
88
 
  if (start_immediate) {
89
 
    if (!is_active) {
90
 
      if (devices_nbr == 0) {
91
 
        videoinput_core.set_stream_config(frameWidth, frameHeight, frameRate);
92
 
        videoinput_core.start_stream();
93
 
      }
94
 
      is_active = true;
95
 
      devices_nbr++;
96
 
    }
97
 
  }
98
 
  opened = true;
99
 
 
100
 
  return true;
101
 
}
102
 
 
103
 
 
104
 
bool
105
 
PVideoInputDevice_EKIGA::IsOpen ()
106
 
{
107
 
  return opened;
108
 
}
109
 
 
110
 
 
111
 
bool
112
 
PVideoInputDevice_EKIGA::Close ()
113
 
{
114
 
  if (is_active) {
115
 
    devices_nbr--;
116
 
    if (devices_nbr==0)
117
 
      videoinput_core.stop_stream();
118
 
    is_active = false;
119
 
  }
120
 
  opened = false;
121
 
 
122
 
  return true;
123
 
}
124
 
 
125
 
  
126
 
bool
127
 
PVideoInputDevice_EKIGA::Start ()
128
 
{
129
 
  if (!is_active) {
130
 
    if (devices_nbr == 0) {
131
 
      videoinput_core.set_stream_config(frameWidth, frameHeight, frameRate);
132
 
      videoinput_core.start_stream();
133
 
    }
134
 
    is_active = true;
135
 
    devices_nbr++;
136
 
  }
137
 
 
138
 
  return true;
139
 
}
140
 
 
141
 
  
142
 
bool
143
 
PVideoInputDevice_EKIGA::Stop ()
144
 
{
145
 
  return true;
146
 
}
147
 
 
148
 
 
149
 
bool
150
 
PVideoInputDevice_EKIGA::IsCapturing ()
151
 
{
152
 
  return IsCapturing ();
153
 
}
154
 
 
155
 
 
156
 
PStringArray
157
 
PVideoInputDevice_EKIGA::GetDeviceNames() const
158
 
{
159
 
  PStringArray  devlist;
160
 
  devlist.AppendString(GetDeviceName());
161
 
 
162
 
  return devlist;
163
 
}
164
 
 
165
 
 
166
 
bool
167
 
PVideoInputDevice_EKIGA::SetFrameSize (unsigned int width,
168
 
                                       unsigned int height)
169
 
{
170
 
  if (!PVideoDevice::SetFrameSize (width, height))
171
 
    return false;
172
 
 
173
 
  return true;
174
 
}
175
 
 
176
 
 
177
 
bool
178
 
PVideoInputDevice_EKIGA::GetFrameData (BYTE *frame,
179
 
                                       PINDEX *i)
180
 
{
181
 
  unsigned width;
182
 
  unsigned height;
183
 
  videoinput_core.get_frame_data((char*)frame, width, height);
184
 
 
185
 
  *i = width * height * 3 / 2;
186
 
 
187
 
  return true;
188
 
}
189
 
 
190
 
//FIXME
191
 
bool PVideoInputDevice_EKIGA::GetFrameDataNoDelay (BYTE *frame,
192
 
                                                   PINDEX *i)
193
 
{
194
 
  unsigned width;
195
 
  unsigned height;
196
 
  videoinput_core.get_frame_data((char*)frame, width, height);
197
 
 
198
 
  *i = width * height * 3 / 2;
199
 
  return true;
200
 
}
201
 
 
202
 
 
203
 
bool
204
 
PVideoInputDevice_EKIGA::TestAllFormats ()
205
 
{
206
 
  return true;
207
 
}
208
 
 
209
 
 
210
 
PINDEX
211
 
PVideoInputDevice_EKIGA::GetMaxFrameBytes ()
212
 
{
213
 
  return CalculateFrameBytes (frameWidth, frameHeight, colourFormat);
214
 
}
215
 
 
216
 
 
217
 
bool
218
 
PVideoInputDevice_EKIGA::SetVideoFormat (VideoFormat newFormat)
219
 
{
220
 
  return PVideoDevice::SetVideoFormat (newFormat);
221
 
}
222
 
 
223
 
 
224
 
int
225
 
PVideoInputDevice_EKIGA::GetNumChannels()
226
 
{
227
 
  return 1;
228
 
}
229
 
 
230
 
 
231
 
bool
232
 
PVideoInputDevice_EKIGA::SetChannel (int /*newChannel*/)
233
 
{
234
 
  return true;
235
 
}
236
 
 
237
 
 
238
 
bool
239
 
PVideoInputDevice_EKIGA::SetColourFormat (const PString &newFormat)
240
 
{
241
 
  if (newFormat == "YUV420P") 
242
 
    return PVideoDevice::SetColourFormat (newFormat);
243
 
 
244
 
  return false;  
245
 
}
246
 
 
247
 
 
248
 
bool
249
 
PVideoInputDevice_EKIGA::SetFrameRate (unsigned rate)
250
 
{
251
 
  PVideoDevice::SetFrameRate (rate);
252
 
 
253
 
  return true;
254
 
}
255
 
 
256
 
 
257
 
bool
258
 
PVideoInputDevice_EKIGA::GetFrameSizeLimits (unsigned & minWidth,
259
 
                                               unsigned & minHeight,
260
 
                                               unsigned & maxWidth,
261
 
                                               unsigned & maxHeight)
262
 
{
263
 
  minWidth  = 10;
264
 
  minHeight = 10;
265
 
  maxWidth  = 1000;
266
 
  maxHeight =  800;
267
 
 
268
 
  return true;
269
 
}
270
 
 
271
 
 
272
 
bool PVideoInputDevice_EKIGA::GetParameters (int *whiteness,
273
 
                                               int *brightness,
274
 
                                               int *colour,
275
 
                                               int *contrast,
276
 
                                               int *hue)
277
 
{
278
 
  *whiteness = 0;
279
 
  *brightness = 0;
280
 
  *colour = 0;
281
 
  *contrast = 0;
282
 
  *hue = 0;
283
 
 
284
 
  return true;
285
 
}