Logo Search packages:      
Sourcecode: camstream version File versions  Download package

CVideoDevice Class Reference

List of all members.

Detailed Description

A device wrapper for Video4Linux devices.

This class wraps itself around a Video4Linux device; at the moment it is primarely oriented at webcams, but grabber cards are supported as 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. Use the Framerate functions to set the framerate or timer.

Definition at line 22 of file VideoDevice.h.


void ChangedTunerNorm (int tuner, int norm)
void ChangedVideoInput (int input)
void Closed ()
void Error (int err_num)
void FramerateChanged (int)
void Notify ()
void Resized (const QSize &new_size)

Public Member Functions

void Close ()
 Closes the device provisionally.
 CVideoDevice (const QString &node_name)
void EnableRGB (bool isOn)
 Enable/disable retrieval of RGB image(s).
void EnableYUV (bool isOn)
 Enable/disable retrieval of YUV image(s).
CVideoAudioInput * GetAudioInput (int number=-1) const
 Returns an audio input channel (source) object.
int GetAudioInputs () const
 Return number of audio channels on the device.
int GetBrightness () const
 Return brightness setting of device.
int GetBuffers () const
 Return available buffers.
int GetColour () const
 Return colour saturation setting of device.
int GetContrast () const
 Return contrast setting of device.
int GetCurrentVideoInput () const
 Return current input.
int GetDescriptor () const
int GetFramerate () const
 Returns the current framerate.
int GetHue () const
 Return hue (color shift) setting of device.
QString GetIntfName () const
 Returns internal name of device.
QSize GetMaxSize () const
 Return the maximum image size this device supports.
int GetMBuffers () const
 Return number of mmaped() buffers.
QSize GetMinSize () const
 Return the minimum image size this device supports.
QString GetNodeName () const
 Returns device inode name.
QImage * GetRGB (int offset=0) const
 Get an RGB image.
QSize GetSize ()
 Return current size from the driver.
QImage * GetU (int offset=0) const
 Get U (chrominance) component of image.
QImage * GetV (int offset=0) const
 Get V (chrominance) component of image.
CVideoDeviceInputGetVideoInput (int number=-1) const
 Returns an video input channel (source) object.
int GetVideoInputs () const
 Return number of input channels (sources).
int GetWhiteness () const
 Return gamma setting of device.
QImage * GetY (int offset=0) const
 Get Y (luminance) component of image.
bool IsValid ()
int Open (int buffers=1)
 Open the device, even multiple times.
int ReadImage ()
 Read image into Buffers.
bool SelectAudioInput (int number)
bool SelectVideoInput (int number)
 Select a new input channel.
bool SetBrightness (int val)
 Set brightness in device.
bool SetColour (int val)
 Set colour saturation in device.
bool SetContrast (int val)
 Set contrast in device.
bool SetFramerate (int fps)
 Try to set a framerate.
bool SetHue (int val)
 Set hue in device.
bool SetSize (const QSize &new_size)
bool SetSize (int width, int height)
 Set a new image size.
bool SetWhiteness (int val)
 Set gamma value in device.
 ~CVideoDevice ()

Private Slots

void LoadImage ()
 stub for automated loading

Private Member Functions

void CalcVidIoSize ()
void CleanUp ()
 Cleans up mmap()ed stuff and buffers.
void CreateImagesRGB ()
void CreateImagesYUV ()
void Init ()
 Gather data from video device, like name, size, etc. Also initializes buffers.
int MCapture (int buf)
 Do ioctl(MCAPTURE), start grabbing frame in buffer.
int MSync ()
 Do ioctl(SYNC), releasing buffer.
void ResetImagesRGB ()
void ResetImagesYUV ()
void SetPalette ()
void StartCapture ()
void StopCapture ()
bool TryPalette (int pal, int depth)
 Tries to set a VIDEO_PALETTE_* palette.

Private Attributes

QVector< CVideoAudioInput > AudioInputs
int Buffers
int CamFD
int Capturing
int CurBuffer
int CurrentAudioInput
int CurrentVideoInput
int FrameRate
QRgb GrayScale [256]
bool HasFramerate
int image_h
int image_w
QString IntfName
int max_h
int max_w
int min_h
int min_w
QString NodeName
int Opened
int Palette
int PalRGB
int PalYUV
QSocketNotifier * pImageSocket
QTimer * pImageTimer
QImage * pNullImage
QVector< QImage > RGB
uchar * rgb_vid_buffer
QArray< int > rgb_vid_offsets
QVector< QImage > U
bool UseSelect
QVector< QImage > V
bool validated
uchar * vid_io_buffer
int vid_io_buffer_size
int vid_io_image_size
QArray< int > vid_io_offsets
QVector< CVideoDeviceInputVideoInputs
struct video_mbuf VMBuf
struct video_picture VPic
QVector< QImage > Y
uchar * yuv_vid_buffer
QArray< int > yuv_vid_offsets


class CVideoAudioInput
class CVideoDeviceInput
class CVideoDeviceTuner

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index