CVideoDeviceLinux Class Reference
A device wrapper for Video4Linux devices.
More...
#include <VideoDeviceLinux.h>
Inheritance diagram for CVideoDeviceLinux:
List of all members.Public Member Functions
Protected Member Functions
Detailed Description
A device wrapper for Video4Linux devices.
This class wraps itself around a Video4Linux device; it supports webcams and grabber cards equally well. This device can be 'opened' multiple times, so more than one class can use this device (of course they all get the same picture).
The class can return video images in RGB, YUV or both formats; it also has an optional buffer scheme for the images; this can prevent the otherwise deep copy that is needed when, for example, image diffs need to be calculated.
The class will use mmap() when it is supported by the device driver. Also some device support select(); if not, a QTimer is used.
Constructor & Destructor Documentation
CVideoDeviceLinux::CVideoDeviceLinux |
( |
const QString & |
node_name |
) |
|
|
|
- Parameters:
-
| node_name | The /dev/video* device name of the video device |
The constructor will do some basic checks to see if this is a valid device. If yes, IsValid() will return TRUE, otherwise FALSE. |
Member Function Documentation
void CVideoDeviceLinux::Exit |
( |
|
) |
[protected, virtual] |
|
int CVideoDeviceLinux::GetBrightness |
( |
|
) |
const |
|
|
Return brightness setting of device.
- Returns:
- unsigned integer in the range 0-65535. 65535 may indicate setting is not available.
Reimplemented from CVideoDevice. |
int CVideoDeviceLinux::GetColour |
( |
|
) |
const |
|
|
Return colour saturation setting of device.
- Returns:
- unsigned integer in the range 0-65535. 65535 may indicate setting is not available.
A colour saturation of 0 means no colour at all, so the returned images are grayscale.
Reimplemented from CVideoDevice. |
void CVideoDeviceLinux::GetConfiguration |
( |
QDomNode & |
node |
) |
const [virtual] |
|
|
Return information in XML subtree.
This function returns the common part of the video device as an XML node. Specifically, it contains the TV channel/tuner part.
You should overload this function in your OS-specific subclass, and merge this node with the private settings from your device.
Reimplemented from CVideoDevice. |
int CVideoDeviceLinux::GetContrast |
( |
|
) |
const |
|
|
Return contrast setting of device.
- Returns:
- unsigned integer in the range 0-65535. 65535 may indicate setting is not available.
Reimplemented from CVideoDevice. |
long CVideoDeviceLinux::GetDescriptor |
( |
|
) |
const [virtual] |
|
|
System dependant descriptor to device.
File descriptor under Unix, WHND under Windows; should be casted to apropriate type.
Only valid when the device is open!
Implements CVideoDevice. |
int CVideoDeviceLinux::GetFramerate |
( |
|
) |
const |
|
|
Returns the current framerate.
- Returns:
- The framerate in frames per second.
This applies to some webcams that allow setting of a framerate. In case of a device that does not support select() we use the framerate to set the timer. By default the framerate is set to 10.
Returns -1 in case of error.
Reimplemented from CVideoDevice. |
int CVideoDeviceLinux::GetHue |
( |
|
) |
const |
|
|
Return hue (color shift) setting of device.
- Returns:
- unsigned integer in the range 0-65535. 65535 may indicate setting is not available.
Hue is a way to correct for colour deviations. It is something different than GetColour.
Reimplemented from CVideoDevice. |
int CVideoDeviceLinux::GetInput |
( |
|
) |
const [virtual] |
|
|
Get currently selected input.
- Returns:
- A positive integer, or -1 in case input is unknown
Returns the number of the currently selected input (if known). Otherwise returns -1.
Usually this variable will be initialized during SetConfiguration().
Implements CVideoDevice. |
QSize CVideoDeviceLinux::GetMaxSize |
( |
|
) |
const |
|
|
Return the maximum image size this device supports.
- Returns:
- an Object of type QSize
With this function the maximum image size in pixels is retrieved. See also GetMinSize and SetSize
Not all sizes between the minimum and maximum size may be allowed by the device; however, there is currently no way to retrieve a list of possible sizes. It's safest to stick to CIF (352x288) and SIF (320x240) formats and subsizes hereof, and VGA. Also it's wise to use to multiples of 8 in both directions. SetSize will return FALSE when the size was rejected by the driver.
Reimplemented from CVideoDevice. |
QSize CVideoDeviceLinux::GetMinSize |
( |
|
) |
const |
|
|
Return the minimum image size this device supports.
- Returns:
- an Object of type QSize
With this function the minium image size in pixels is retrieved.
Reimplemented from CVideoDevice. |
int CVideoDeviceLinux::GetNumberOfInputs |
( |
|
) |
const [virtual] |
|
|
Get number of inputs.
This functions returns the number of video inputs on the video device. TV cards usually have more than one input; webcams only one.
The numbering starts at 0.
Implements CVideoDevice. |
int CVideoDeviceLinux::GetNumberOfTuners |
( |
|
) |
const [virtual] |
|
|
Get number of tuners.
This function returns ALL tuners belonging to this video device.
- Note:
- It is unlikely a TV card has more than one tuner.
Implements CVideoDevice. |
int CVideoDeviceLinux::GetTuner |
( |
|
) |
const [virtual] |
|
|
Returns an video input channel (source) object.
- Parameters:
-
| number | The desired input channel; -1 for the current one |
- Returns:
- An object of type CVideoDeviceInput, or NULL if number is out of range
This returns a pointer to a CVideoDeviceInput object; when number is -1 (the default value), it returns the current input.
Reimplemented from CVideoDevice. |
int CVideoDeviceLinux::GetWhiteness |
( |
|
) |
const |
|
|
Return gamma setting of device.
- Returns:
- unsigned integer in the range 0-65535. 65535 may indicate setting is not available.
Sometimes used as a brightness contrast, but more generally this returns the gamma correction the device applies to the image.
Reimplemented from CVideoDevice. |
bool CVideoDeviceLinux::HasFramerate |
( |
|
) |
const |
|
bool CVideoDeviceLinux::Init |
( |
|
) |
[protected, virtual] |
|
|
Open device, set defaults, prepare for capture.
Implements CVideoDevice. |
void CVideoDeviceLinux::Mute |
( |
bool |
on |
) |
const [virtual] |
|
void CVideoDeviceLinux::run |
( |
|
) |
[protected, virtual] |
|
bool CVideoDeviceLinux::SetBrightness |
( |
int |
val |
) |
|
|
|
Set brightness in device.
- Parameters:
-
| val | An integer in the range 0-65535. |
- Returns:
- FALSE if the device is closed or the call failed.
The value returned by GetBrightness may be slightly different from what is set with SetBrightness.
Reimplemented from CVideoDevice. |
bool CVideoDeviceLinux::SetColour |
( |
int |
val |
) |
|
|
|
Set colour saturation in device.
- Parameters:
-
| val | An integer in the range 0-65535. |
- Returns:
- FALSE if the device is closed or the call failed.
Colour saturation sets how bright colours should appear. A saturation of 0 yields grayscale images.
The value returned by GetColour may be slightly different from what is set with SetColour.
Reimplemented from CVideoDevice. |
void CVideoDeviceLinux::SetConfiguration |
( |
const QDomNode & |
node |
) |
[virtual] |
|
|
Sets the XML node which contains the settings for this device.
The configuration of a device is stored in an XML subtree. This function sets the root node of this subtree. The format of the subtree is only defined for the TV channels/tuner part, and the slection of input and/or tuner. All other settings should be set by the specific video class.
Note: the given node should be the parent of our real node (i.e. the one where you add the node from GetConfigration to). Example:
- Attention:
- Call this before Open().
Reimplemented from CVideoDevice. |
bool CVideoDeviceLinux::SetContrast |
( |
int |
val |
) |
|
|
|
Set contrast in device.
- Parameters:
-
| val | An integer in the range 0-65535. |
- Returns:
- FALSE if the device is closed or the call failed.
The value returned by GetContrast may be slightly different from what is set with SetContrast.
Reimplemented from CVideoDevice. |
void CVideoDeviceLinux::SetFramerate |
( |
int |
fps |
) |
|
|
|
Try to set a framerate.
- Parameters:
-
| fps | The framerate, in frames per second. |
- Returns:
- TRUE if the framerate was accepted, FALSE otherwise
Some webcams allow their framerate to be set; this functions tries to do just that; in general, the camera will use the framerate closest to what it supports. In case a device does not support framerates or only a fixed framerate (grabber cards!) we use the framerate to set the timer.
Reimplemented from CVideoDevice. |
bool CVideoDeviceLinux::SetHue |
( |
int |
val |
) |
|
|
|
Set hue in device.
- Parameters:
-
| val | An integer in the range 0-65535. |
- Returns:
- FALSE if the device is closed or the call failed.
Hue is a way to correct for colour deviations. The value returned by GetHue may be slightly different from what is set with SetHue.
Reimplemented from CVideoDevice. |
void CVideoDeviceLinux::SetInput |
( |
int |
|
) |
[virtual] |
|
|
Select an input.
- Parameters:
-
| input | The input to use. Between 0 and GetNumberOfInputs() |
This will select an input on your TV card. Most cards have more than one input, for example S-VHS, composite and tuner. Even if you have only one input, you may want to select it so it gets initialized properly. - Note:
- GetConfiguration() and SetConfiguration() will remember the selected input.
Implements CVideoDevice. |
void CVideoDeviceLinux::SetSize |
( |
const QSize & |
new_size |
) |
|
|
void CVideoDeviceLinux::SetTuner |
( |
int |
|
) |
[virtual] |
|
|
Select a tuner.
- Parameters:
-
| tuner | The tuner to use. between 0 and GetNumberOfTuners() |
This will select a tuner. Even if you have only one tuner, you may want to select it so it gets initialized properly.
- Note:
- GetConfiguration() and SetConfiguration() will remember the selected tuner.
Implements CVideoDevice. |
bool CVideoDeviceLinux::SetWhiteness |
( |
int |
val |
) |
|
|
|
Set gamma value in device.
- Parameters:
-
| val | An integer in the range 0-65535. |
- Returns:
- FALSE if the device is closed or the call failed.
Whiteness is sometimes used as brightness, but usually this sets the gamma correction the device will apply to the image.
The value returned by GetWhiteness may be slightly different from what is set with SetWhiteness.
Reimplemented from CVideoDevice. |
void CVideoDeviceLinux::ShowDisplayDialog |
( |
|
) |
[virtual] |
|
void CVideoDeviceLinux::ShowFormatDialog |
( |
|
) |
[virtual] |
|
void CVideoDeviceLinux::ShowSourceDialog |
( |
|
) |
[virtual] |
|
bool CVideoDeviceLinux::StartCapture |
( |
|
) |
[protected, virtual] |
|
void CVideoDeviceLinux::StopCapture |
( |
|
) |
[protected, virtual] |
|
The documentation for this class was generated from the following files:
Generated on Wed Dec 13 23:38:47 2006 for CamStream by
1.3.7