~ubuntu-branches/ubuntu/maverick/ekiga/maverick

« back to all changes in this revision

Viewing changes to src/devices/videoinput.h

  • Committer: Bazaar Package Importer
  • Author(s): Eugen Dedu, Eugen Dedu, Loic Minier
  • Date: 2008-09-27 10:00:00 UTC
  • mfrom: (1.1.8 upstream)
  • mto: (1.4.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 38.
  • Revision ID: james.westby@ubuntu.com-20080927100000-l5k5werb6czr5b3h
Tags: 3.0.1-1
[ Eugen Dedu ]
* New version.  (Closes: #500089).
* Add our own changelog file in /usr/share/doc.
* Remove gnomemeeting transitional package.
* Discover new interfaces.  (Closes: #488199).
* Compile with dbus support.  (Closes: #467212).
* Numeric keypad inserts digits at correct position.  (Closes: #440159).
* Use libnotify upon call.  (Closes: #412604).
* Symlink identical GNOME help files, to reduce size.  (Closes: #505536).
* Explicitely build-depends on a few dev packages, even if they were
  pulled out anyway by the other dependencies.

[ Loic Minier ]
* Use clean:: instead of clean: in rules.
* Don't disable Uploaders: generation for control.in -> control generation
  in rules.
* Fix some tabs which were size 4 anyway.
* Generate a PO template during build by calling intltool-update -p in
  install; thanks Ubuntu and Martin Pitt; closes: #505535.
* Also let the -dbg depend on ${misc:Depends}.
* Cleanup rules; in particular, use dpkg-parsechangelog and honor
  distclean/clean failures, remove old clean rules, commented out stuff,
  gtk-only stuff.
* Pass -s to dh_* in binary-arch.
* Use debian/*.links and debian/*.manpages instead of symlink manually or
  passing files to dh_installman.
* Use ftp.gnome.org in copyright.
* Switch to quilt and fix target deps in the process; build-dep on quilt
  instead of dpatch; rename news.dpatch to 00_news.patch and refresh;
  replace 00list with series.
* Install autotools-dev config.guess and .sub after patching.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
 */
38
38
 
39
39
 
40
 
#ifndef _VIDEO_GRABBER_H_
41
 
#define _VIDEO_GRABBER_H_
 
40
#ifndef _EKIGA_VIDEO_INPUT_H_
 
41
#define _EKIGA_VIDEO_INPUT_H_
42
42
 
 
43
#include "videoinput-core.h"
43
44
#include "common.h"
44
45
 
45
 
#include "videooutput.h"
46
 
 
47
 
 
48
 
class GMManager;
49
 
 
50
 
class GMVideoGrabber : public PThread
 
46
class PVideoInputDevice_EKIGA : public PVideoInputDevice 
51
47
{
52
 
  PCLASSINFO(GMVideoGrabber, PThread);
53
 
 
 
48
  PCLASSINFO(PVideoInputDevice_EKIGA, PVideoInputDevice);
 
49
  
54
50
 public:
55
 
 
56
 
  /* DESCRIPTION  :  The constructor.
57
 
   * BEHAVIOR     :  Initialises the VideoGrabber, the VideoGrabber is opened
58
 
   *                 asynchronously given the config parameters. If the opening
59
 
   *                 fails, an error popup is displayed.
60
 
   * PRE          :  First parameter is TRUE if the VideoGrabber must grab
61
 
   *                 once opened. The second one is TRUE if the VideoGrabber
62
 
   *                 must be opened synchronously. The last one is a 
63
 
   *                 reference to the GMManager.
64
 
   */
65
 
  GMVideoGrabber (BOOL start_grabbing,
66
 
                  BOOL sync,
67
 
                  GMManager &endpoint);
68
 
 
69
 
 
70
 
  /* DESCRIPTION  :  The destructor.
71
 
   * BEHAVIOR     :  /
72
 
   * PRE          :  /
73
 
   */
74
 
  ~GMVideoGrabber (void);
75
 
 
76
 
 
77
 
  /* DESCRIPTION  :  /
78
 
   * BEHAVIOR     :  Start to grab, i.e. read from the specified device 
79
 
   *                 and display images in the main interface.
80
 
   * PRE          :  /
81
 
   */
82
 
  void StartGrabbing (void);
83
 
 
84
 
  
85
 
  /* DESCRIPTION  :  /
86
 
   * BEHAVIOR     :  Stop to grab, i.e. read from the specified device 
87
 
   *                 and display images in the main interface.
88
 
   * PRE          :  /
89
 
   */
90
 
  void StopGrabbing (void);
91
 
 
92
 
  
93
 
  /* DESCRIPTION  :  /
94
 
   * BEHAVIOR     :  Returns TRUE if we are grabbing.
95
 
   * PRE          :  /
96
 
   */
97
 
  BOOL IsGrabbing (void);
98
 
 
99
 
  
100
 
  /* DESCRIPTION  :  /
101
 
   * BEHAVIOR     :  Returns the PVideoInputDevice used to capture
102
 
   *                 the camera images.
103
 
   * PRE          :  /
104
 
   */
105
 
  PVideoInputDevice *GetInputDevice (void);
106
 
 
107
 
  
108
 
  /* DESCRIPTION  :  /
109
 
   * BEHAVIOR     :  Returns the PVideoOutputDevice used to display
110
 
   *                 the camera images.
111
 
   * PRE          :  /
112
 
   */
113
 
  PVideoOutputDevice *GetOutputDevice (void);
114
 
 
115
 
 
116
 
  /* DESCRIPTION  :  /
117
 
   * BEHAVIOR     :  Sets the colour for the specified device.
118
 
   * PRE          :  0 <= int <= 65535
119
 
   */
120
 
  BOOL SetColour (int colour);
121
 
 
122
 
 
123
 
  /* DESCRIPTION  :  /
124
 
   * BEHAVIOR     :  Sets the brightness for the specified device.
125
 
   * PRE          :  0 <= int <= 65535
126
 
   */
127
 
  BOOL SetBrightness (int brightness);
128
 
 
129
 
 
130
 
  /* DESCRIPTION  :  /
131
 
   * BEHAVIOR     :  Sets the whiteness for the specified device.
132
 
   * PRE          :  0 <= int <= 65535
133
 
   */
134
 
  BOOL SetWhiteness (int whiteness);
135
 
 
136
 
 
137
 
  /* DESCRIPTION  :  /
138
 
   * BEHAVIOR     :  Sets the contrast for the specified device.
139
 
   * PRE          :  0 <= int <= 65535
140
 
   */
141
 
  BOOL SetContrast (int contrast);
142
 
 
143
 
 
144
 
  /* DESCRIPTION  :  /
145
 
   * BEHAVIOR     :  Returns respectively the whiteness, brightness, 
146
 
   *                 colour, contrast for the specified device.
147
 
   * PRE          :  Allocated pointers to int. Grabber must be opened.
148
 
   */
149
 
  void GetParameters (int *whiteness,
150
 
                      int *brightness,
151
 
                      int *colour,
152
 
                      int *contrast);
153
 
 
154
 
 
155
 
  /* DESCRIPTION  :  /
156
 
   * BEHAVIOR     :  Lock the device, preventing it to be Closed and deleted.
157
 
   * PRE          :  /
158
 
   */
159
 
  void Lock ();
160
 
 
161
 
  
162
 
  /* DESCRIPTION  :  /
163
 
   * BEHAVIOR     :  Unlock the device.
164
 
   * PRE          :  /
165
 
   */
166
 
  void Unlock ();
167
 
 
168
 
  
169
 
 protected:
170
 
  void Main (void);
171
 
  void VGOpen (void);
172
 
  void VGClose (void);
173
 
 
174
 
  int height;
175
 
  int width;
176
 
  int whiteness;
177
 
  int brightness;
178
 
  int colour;
179
 
  int contrast;
180
 
 
181
 
  char video_buffer [3 * GM_CIF_WIDTH * GM_CIF_HEIGHT];
182
 
 
183
 
  PVideoInputDevice *grabber;
184
 
  PVideoOutputDevice *display;
185
 
 
186
 
  BOOL stop;
187
 
  BOOL is_grabbing;
188
 
  BOOL synchronous;
189
 
  BOOL is_opened;
190
 
 
191
 
  PMutex var_mutex;      /* To protect variables that are read and written
192
 
                            from various threads */
193
 
  PMutex quit_mutex;     /* To exit */
194
 
  PMutex device_mutex;   /* To Lock and Unlock and not exit until
195
 
                            it is unlocked */
196
 
  PSyncPoint thread_sync_point;
197
 
 
198
 
  GMManager & ep;
199
 
};
200
 
 
201
 
 
202
 
class GMVideoTester : public PThread
203
 
{
204
 
  PCLASSINFO(GMVideoTester, PThread);
205
 
 
206
 
 
207
 
public:
208
 
 
209
 
  /* DESCRIPTION  :  The constructor.
210
 
   * BEHAVIOR     :  
211
 
   * PRE          :  /
212
 
   */
213
 
  GMVideoTester (gchar *manager,
214
 
                 gchar *recorder);
215
 
 
216
 
 
217
 
  /* DESCRIPTION  :  The destructor.
218
 
   * BEHAVIOR     :  /
219
 
   * PRE          :  /
220
 
   */
221
 
  ~GMVideoTester ();
222
 
 
223
 
 
224
 
  void Main ();
225
 
 
226
 
 
 
51
  
 
52
  /* DESCRIPTION  :  The constructor.
 
53
   * BEHAVIOR     :  Creates the Fake Input Device.
 
54
   * PRE          :  /
 
55
   */
 
56
  PVideoInputDevice_EKIGA (Ekiga::ServiceCore & core);
 
57
 
 
58
 
 
59
  /* DESCRIPTION  :  The destructor
 
60
   * BEHAVIOR     :  /
 
61
   * PRE          :  /
 
62
   */
 
63
  ~PVideoInputDevice_EKIGA ();
 
64
 
 
65
  
 
66
  virtual bool Open (const PString &name,
 
67
                     bool start_immediate = TRUE);
 
68
 
 
69
  
 
70
  /**Determine of the device is currently open.
 
71
   */
 
72
  virtual bool IsOpen() ;
 
73
 
 
74
  
 
75
  /**Close the device.
 
76
   */
 
77
  virtual bool Close();
 
78
 
 
79
  
 
80
  /**Start the video device I/O.
 
81
   */
 
82
  virtual bool Start();
 
83
 
 
84
  
 
85
  /**Stop the video device I/O capture.
 
86
   */
 
87
  virtual bool Stop();
 
88
 
 
89
 
 
90
  /**Determine if the video device I/O capture is in progress.
 
91
   */
 
92
  virtual bool IsCapturing();
 
93
 
 
94
  
 
95
  virtual bool SetFrameSize (unsigned int width,
 
96
                             unsigned int height);
 
97
  
 
98
  
 
99
  /* DESCRIPTION  :  The destructor
 
100
   * BEHAVIOR     :  /
 
101
   * PRE          :  /
 
102
   */
 
103
  virtual bool GetFrameData (BYTE *frame, PINDEX *i = NULL);
 
104
 
 
105
 
 
106
  /* DESCRIPTION  :  The destructor
 
107
   * BEHAVIOR     :  /
 
108
   * PRE          :  /
 
109
   */
 
110
  virtual bool GetFrameDataNoDelay (BYTE *frame, PINDEX *i = NULL);
 
111
 
 
112
  
 
113
  virtual bool TestAllFormats ();
 
114
 
 
115
  
 
116
  /**Get the maximum frame size in bytes.
 
117
  */
 
118
  virtual PINDEX GetMaxFrameBytes();
 
119
 
 
120
  
 
121
  /** Given a preset interval of n milliseconds, this function
 
122
      returns n msecs after the previous frame capture was initiated.
 
123
  */
 
124
//  virtual void WaitFinishPreviousFrame();
 
125
 
 
126
  
 
127
  /**Set the video format to be used.
 
128
 
 
129
  Default behaviour sets the value of the videoFormat variable and then
 
130
  returns the IsOpen() status.
 
131
  */
 
132
  virtual bool SetVideoFormat (VideoFormat newFormat);
 
133
  
 
134
  /**Get the number of video channels available on the device.
 
135
 
 
136
  Default behaviour returns 1.
 
137
  */
 
138
  virtual int GetNumChannels() ;
 
139
 
 
140
  
 
141
  /**Set the video channel to be used on the device.
 
142
 
 
143
  Default behaviour sets the value of the channelNumber variable and then
 
144
  returns the IsOpen() status.
 
145
  */
 
146
  virtual bool SetChannel (int newChannel);
 
147
                        
 
148
 
 
149
  /**Set the colour format to be used.
 
150
 
 
151
  Default behaviour sets the value of the colourFormat variable and then
 
152
  returns the IsOpen() status.
 
153
  */
 
154
  virtual bool SetColourFormat (const PString &newFormat);
 
155
 
 
156
  
 
157
  /**Set the video frame rate to be used on the device.
 
158
 
 
159
  Default behaviour sets the value of the frameRate variable and then
 
160
  return the IsOpen() status.
 
161
  */
 
162
  virtual bool SetFrameRate (unsigned rate);
 
163
 
 
164
  
 
165
  virtual bool GetFrameSizeLimits (unsigned &minWidth,
 
166
                                   unsigned &minHeight,
 
167
                                   unsigned &maxWidth,
 
168
                                   unsigned &maxHeight);
 
169
  
 
170
  virtual bool GetParameters (int *whiteness,
 
171
                              int *brightness,
 
172
                              int *colour,
 
173
                              int *contrast,
 
174
                              int *hue);
 
175
  
 
176
 
 
177
  virtual PStringArray GetDeviceNames() const;
 
178
 
 
179
  static int devices_nbr;
 
180
  bool is_active;
 
181
  
227
182
protected:
228
 
 
229
 
  PString video_manager;
230
 
  PString video_recorder;
231
 
 
232
 
  GtkWidget *test_label;
233
 
  GtkWidget *test_dialog;
234
 
 
235
 
  PMutex quit_mutex;
236
 
  PSyncPoint thread_sync_point;
 
183
  Ekiga::ServiceCore & core;
 
184
  Ekiga::VideoInputCore & videoinput_core;
 
185
 
 
186
  bool opened;
237
187
};
 
188
 
238
189
#endif