CVD 0.8
Classes | Modules | Functions
Video devices and video files

Classes and functions to manage video streams and present them as images. More...

Classes

class  CVD::V4LControl
 exposes the V4L2 API to set parameters on a capture device. More...

Modules

 Video buffers
 Video frames

Functions

template<class T >
VideoBuffer< T > * CVD::open_video_source (std::istream &in)
template<class T >
VideoBuffer< T > * CVD::open_video_source (const std::string &src)

Detailed Description

Classes and functions to manage video streams and present them as images.


Function Documentation

template<class T >
VideoBuffer<T>* CVD::open_video_source ( std::istream &  in)

opens a video device described by a video source url given from an input stream.

See open_video_source(const std::string &) for details on the url syntax.

Definition at line 417 of file videosource.h.

template<class T >
VideoBuffer< T > * CVD::open_video_source ( const std::string &  src)

opens a video device described by a video source url.

This allows to decide at runtime what kind of video input your program is using. Basic use is to call open_video_source<T>(url) to get a VideoBuffer<T>*.

In many cases, the VideoBuffer returned by open_video_source() is a wrapper around the video buffer dealing with the hardware and so does not provide access to the controls. The underlying buffer can be accessed with VideoBuffer::root_buffer().

Threre are also several pseudo buffers (such as deinterlacing and colorspace conversion) which are chained to other buffers by taking a URL as an argument.

The url syntax is the following:

url		 := protocol ':' [ '[' options ']' ] // identifier
protocol := "files" | "file" | "v4l2" | "v4l1" | "jpegstream" | "dc1394" | "qt" | "colourspace" | "deinterlace"
options  := option [ ',' options ]
option	 := name [ '=' value ]

identifier and values can be quoted literals with escapes, all other text is unquoted. Some Examples:

Open a DiskBuffer2 for *.pgm in /local/capture/:

files:///local/capture/ *.pgm

Open a DiskBuffer2 that loops and uses a ReadAheadVideoBuffer wrapper with 40 frame buffer, with 30 fps:

files:[read_ahead=40, fps=30, on_end=loop]///local/capture/ *.pgm

Open a V4L2 device at /dev/video0:

v4l2:///dev/video0

Open a V4L2 device with fields on input 2:

v4l2:[input=2,fields]///dev/video0

Open firewire camera 1 with the default fps:

dc1394://1

Open firewire camera 1, capturing in YUV411, at 30fps: colourspace:[from=yuv411]//dc1394:[fps=30]//1

Open an avi file relative to the current directory:

file://../../stuff/movie.avi

Open the first QuickTime camera and show the settings dialog

qt:[showsettings=1]//0

Open an HTTP camera. First create a named pipe from the shell, and start grabbing video:

mkfifo /tmp/video
wget http//my.camera/file_representing_video -O /tmp/video

then open a source with:

jpegstream:///tmp/video

If the argument is provided from a shell such as BASH, then then redirection can be used:

jpegstream://<(wget http//my.camera/file_representing_video -O - )

Fields are: bool = true | yes | 1 ! false | no | 0 offset = <width>x<height> size = <offset> | qvga | vga | pal | ntsc | xga

Options supported by the various protocols are:

'files' protocol (DiskBuffer2):  identifier is glob pattern
		fps = <number>
		read_ahead [= <number>] (default is 50 if specified without value)
		on_end = repeat_last | unset_pending | loop (default is repeat_last)

'file' protocol (VideoFileBuffer): identifier is path to file
	   read_ahead  [= <number>] (default is 50 if specified without value)
	   on_end = repeat_last | unset_pending | loop (default is repeat_last)

'v4l1' protocol (V4L1Buffer): identifier is device name
	   size = <size>  (default is 0x0)

'v4l2' protocol (V4LBuffer): identifier is device name
	   size = <size> (default vga)
	   input = <number>
	   interlaced | fields [= <bool> ]
		   verbose [ = <bool> ]

'dc1394' protocol (DVBuffer): identifier is camera number
	   fps = <number> (default is camera default)
	   size = <size>
	   offset = <offset>
	   verbose [ = <bool> ]
	   reset [ = <bool> ]
	   mode | format7 | format7_mode = <number>

'qt' protocol (QTBuffer): identifier is camera number
	  size = vga | qvga | <width>x<height>	(default vga)
	  showsettings [ = <bool> ] (default 0)
	  verbose [ = <bool> ] (default 0)

'jpegstream' protocol (ServerPushJpegBuffer): identifier is path to file
	  read_ahead  [= <number>] (default is 50 if specified without value)

'deinterlace' protcol (DeinterlaceBuffer): identifier is a video URL
      oddonly  [ = <bool> ]
      evenonly [ = <bool> ]
      oddeven  [ = <bool> ]   (default)
      evenodd  [ = <bool> ]
	  double   [ = <bool> ]  (perform line doubling by averaging)

'colourspace' protcol (ColourspaceBuffer): identifier is a video URL
      from = byte | mono | gray | grey | yuv411 | yuv422 | rgb<byte> 
	         | rgb | bayer_bggr | bayer_gbrg | bayer_grbg | bayer_rggb  (default mono)

Definition at line 561 of file videosource.h.