40
#ifndef _VIDEO_GRABBER_H_
41
#define _VIDEO_GRABBER_H_
40
#ifndef _EKIGA_VIDEO_INPUT_H_
41
#define _EKIGA_VIDEO_INPUT_H_
43
#include "videoinput-core.h"
43
44
#include "common.h"
45
#include "videooutput.h"
50
class GMVideoGrabber : public PThread
46
class PVideoInputDevice_EKIGA : public PVideoInputDevice
52
PCLASSINFO(GMVideoGrabber, PThread);
48
PCLASSINFO(PVideoInputDevice_EKIGA, PVideoInputDevice);
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.
65
GMVideoGrabber (BOOL start_grabbing,
70
/* DESCRIPTION : The destructor.
74
~GMVideoGrabber (void);
78
* BEHAVIOR : Start to grab, i.e. read from the specified device
79
* and display images in the main interface.
82
void StartGrabbing (void);
86
* BEHAVIOR : Stop to grab, i.e. read from the specified device
87
* and display images in the main interface.
90
void StopGrabbing (void);
94
* BEHAVIOR : Returns TRUE if we are grabbing.
97
BOOL IsGrabbing (void);
101
* BEHAVIOR : Returns the PVideoInputDevice used to capture
105
PVideoInputDevice *GetInputDevice (void);
109
* BEHAVIOR : Returns the PVideoOutputDevice used to display
113
PVideoOutputDevice *GetOutputDevice (void);
117
* BEHAVIOR : Sets the colour for the specified device.
118
* PRE : 0 <= int <= 65535
120
BOOL SetColour (int colour);
124
* BEHAVIOR : Sets the brightness for the specified device.
125
* PRE : 0 <= int <= 65535
127
BOOL SetBrightness (int brightness);
131
* BEHAVIOR : Sets the whiteness for the specified device.
132
* PRE : 0 <= int <= 65535
134
BOOL SetWhiteness (int whiteness);
138
* BEHAVIOR : Sets the contrast for the specified device.
139
* PRE : 0 <= int <= 65535
141
BOOL SetContrast (int contrast);
145
* BEHAVIOR : Returns respectively the whiteness, brightness,
146
* colour, contrast for the specified device.
147
* PRE : Allocated pointers to int. Grabber must be opened.
149
void GetParameters (int *whiteness,
156
* BEHAVIOR : Lock the device, preventing it to be Closed and deleted.
163
* BEHAVIOR : Unlock the device.
181
char video_buffer [3 * GM_CIF_WIDTH * GM_CIF_HEIGHT];
183
PVideoInputDevice *grabber;
184
PVideoOutputDevice *display;
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
196
PSyncPoint thread_sync_point;
202
class GMVideoTester : public PThread
204
PCLASSINFO(GMVideoTester, PThread);
209
/* DESCRIPTION : The constructor.
213
GMVideoTester (gchar *manager,
217
/* DESCRIPTION : The destructor.
52
/* DESCRIPTION : The constructor.
53
* BEHAVIOR : Creates the Fake Input Device.
56
PVideoInputDevice_EKIGA (Ekiga::ServiceCore & core);
59
/* DESCRIPTION : The destructor
63
~PVideoInputDevice_EKIGA ();
66
virtual bool Open (const PString &name,
67
bool start_immediate = TRUE);
70
/**Determine of the device is currently open.
72
virtual bool IsOpen() ;
80
/**Start the video device I/O.
85
/**Stop the video device I/O capture.
90
/**Determine if the video device I/O capture is in progress.
92
virtual bool IsCapturing();
95
virtual bool SetFrameSize (unsigned int width,
99
/* DESCRIPTION : The destructor
103
virtual bool GetFrameData (BYTE *frame, PINDEX *i = NULL);
106
/* DESCRIPTION : The destructor
110
virtual bool GetFrameDataNoDelay (BYTE *frame, PINDEX *i = NULL);
113
virtual bool TestAllFormats ();
116
/**Get the maximum frame size in bytes.
118
virtual PINDEX GetMaxFrameBytes();
121
/** Given a preset interval of n milliseconds, this function
122
returns n msecs after the previous frame capture was initiated.
124
// virtual void WaitFinishPreviousFrame();
127
/**Set the video format to be used.
129
Default behaviour sets the value of the videoFormat variable and then
130
returns the IsOpen() status.
132
virtual bool SetVideoFormat (VideoFormat newFormat);
134
/**Get the number of video channels available on the device.
136
Default behaviour returns 1.
138
virtual int GetNumChannels() ;
141
/**Set the video channel to be used on the device.
143
Default behaviour sets the value of the channelNumber variable and then
144
returns the IsOpen() status.
146
virtual bool SetChannel (int newChannel);
149
/**Set the colour format to be used.
151
Default behaviour sets the value of the colourFormat variable and then
152
returns the IsOpen() status.
154
virtual bool SetColourFormat (const PString &newFormat);
157
/**Set the video frame rate to be used on the device.
159
Default behaviour sets the value of the frameRate variable and then
160
return the IsOpen() status.
162
virtual bool SetFrameRate (unsigned rate);
165
virtual bool GetFrameSizeLimits (unsigned &minWidth,
168
unsigned &maxHeight);
170
virtual bool GetParameters (int *whiteness,
177
virtual PStringArray GetDeviceNames() const;
179
static int devices_nbr;
229
PString video_manager;
230
PString video_recorder;
232
GtkWidget *test_label;
233
GtkWidget *test_dialog;
236
PSyncPoint thread_sync_point;
183
Ekiga::ServiceCore & core;
184
Ekiga::VideoInputCore & videoinput_core;