Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

Video4LinuxSource Class Reference

A class which implements the ImageSource interface as a source of Images supplied from a Video4Linux compatible device such as webcams and tv cards. More...

#include <Video4LinuxSource.h>

Inheritance diagram for Video4LinuxSource::

ImageSource List of all members.

Public Methods

 Video4LinuxSource (char *device, bool sup_memory_map)
 Initialise a Video4Linux source. More...

virtual ~Video4LinuxSource ()
 Close the device and unmap any mapped memory or free up memory if necessary.

virtual ImageSourceoperator>> (ImageRGB &)
 Extract a colour image into the images data buffer.

virtual ImageSourceoperator>> (ImageGrey &)
 Extract a greyscale image into the images brightness buffer.

virtual ImageSourceoperator>> (Image &)
 Extract an image dependant on the default type.

void set_size (unsigned int, unsigned int)
 Set the size of source Images. More...

void set_framerate (unsigned int)
 Set the rate of Image acquistion. More...

void set_palette (int)
 Set the palette of the acquired Images. More...

void set_channel (int)
 Set the channel to use for image acquisition. More...

virtual void get_size (unsigned int &, unsigned int &)
 Get the size of the source Images.

void get_framerate (unsigned int &)
 Get the rate of Image acquisition.

void get_palette (int &)
 Get the palette used by acquired Images.


Protected Methods

int set_capability (video_capability &)
int set_frameBuffer (video_buffer &)
 ioctl wrapper for VIDIOCSFBUF.

int set_captureWindows (video_window &)
 ioctl wrapper for VIDIOCSWIN.

int set_videoSource (int)
 ioctl wrapper for VIDIOCSCHAN.

int set_imageProperties (video_picture &)
 ioctl wrapper for VIDIOCSPICT.

int set_tuning (video_tuner &)
 ioctl wrapper for VIDIOCSTUNER.

int set_memoryBuffer (video_mbuf &)
int get_capability (video_capability &)
 ioctl wrapper for VIDIOCGCAP.

int get_frameBuffer (video_buffer &)
 ioctl wrapper for VIDIOCGFBUF.

int get_captureWindows (video_window &)
 ioctl wrapper for VIDIOCGWIN.

int get_videoSource (video_channel &)
 ioctl wrapper for VIDIOCGCHAN.

int get_imageProperties (video_picture &)
 ioctl wrapper for VIDIOCGPICT.

int get_tuning (video_tuner &)
 ioctl wrapper for VIDIOCGTUNER.

int get_memoryBuffer (video_mbuf &)
 ioctl wrapper for VIDIOCGMBUF.

void print_capability (video_capability &)
void print_frameBuffer (video_buffer &)
void print_captureWindows (video_window &)
void print_videoSource (video_channel &)
void print_imageProperties (video_picture &)
void print_tuning (video_tuner &)
void print_memoryBuffer (video_mbuf &)

Protected Attributes

int fd
 device file handle.

unsigned char* buff
 temporary buffer.

unsigned int buffsize
 size of temporary buffer.

int currentBuffer
 number of current buffer.

int numBuffers
 total number of buffers.

unsigned int width
 width of source image.

unsigned int height
 height of source image.

unsigned int size
 total size of source image.

video_mbuf mbuf
 memory buffer structure.

video_mmap vmmap
 memory map structure.

int palette
 palette to use for the device.

bool capture
 true if capture to memory is possible for this device. More...

void (* convert_rgb )(int width, int height, void *, void *)
 conversion method for colour Images.

void (* convert_grey )(int width, int height, void *, void *)
 conversion method for greyscale Images.


Detailed Description

A class which implements the ImageSource interface as a source of Images supplied from a Video4Linux compatible device such as webcams and tv cards.

Bug:
Memory mapping is not yet functional.

Todo:
Needs to be expanded to add more of the Video4Linux API so that more devices can be supported 'out of the box'.

Definition at line 31 of file Video4LinuxSource.h.


Constructor & Destructor Documentation

Video4LinuxSource::Video4LinuxSource ( char * device,
bool sup_memory_map )
 

Initialise a Video4Linux source.

Parameters:
device   The Video4Linux compatible device.

Definition at line 38 of file Video4LinuxSource.cpp.


Member Function Documentation

void Video4LinuxSource::set_channel ( int channel )
 

Set the channel to use for image acquisition.

Parameters:
channel   The channel to use.

Definition at line 250 of file Video4LinuxSource.cpp.

void Video4LinuxSource::set_framerate ( unsigned int fps )
 

Set the rate of Image acquistion.

Note:
Although the device is issued with the instruction to change framerate it may not be changed in the device itself. Sometimes this is necessary so that incorect values cannot be set.
Parameters:
fps   The framerate to use.

Definition at line 183 of file Video4LinuxSource.cpp.

void Video4LinuxSource::set_palette ( int pal )
 

Set the palette of the acquired Images.

Note:
Although the device is issued with the instruction to change palette it may not be changed in the device itself. Normally this will be because the selected palette is not supported.
Parameters:
pal   The palette to use.

Definition at line 208 of file Video4LinuxSource.cpp.

void Video4LinuxSource::set_size ( unsigned int w,
unsigned int h )
 

Set the size of source Images.

Note:
Although the device is issued with the instruction to change size it may not be changed in the device itself. Sometimes this is necessary so that incorect values cannot be set.
Parameters:
w   The width of the Image.
h   The height of the Image.

Definition at line 127 of file Video4LinuxSource.cpp.


Member Data Documentation

bool Video4LinuxSource::capture [protected]
 

true if capture to memory is possible for this device.

This is always false though see constructor in Video4Linux.cpp

Definition at line 65 of file Video4LinuxSource.h.


The documentation for this class was generated from the following files:
Generated at Fri Aug 13 17:29:22 2004 for libRTImage by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001