PVideoDevice Class Reference

#include <videoio.h>

Inheritance diagram for PVideoDevice:

PObject PVideoInputDevice PVideoOutputDevice PVideoInput1394DcDevice PVideoOutputDeviceRGB

List of all members.

Public Types

enum  VideoFormat {
  PAL, NTSC, SECAM, Auto,
  NumVideoFormats
}
enum  StandardSizes {
  CIF16Width = 1408, CIF16Height = 1152, CIF4Width = 704, CIF4Height = 576,
  CIFWidth = 352, CIFHeight = 288, QCIFWidth = 176, QCIFHeight = 144,
  SQCIFWidth = 144, SQCIFHeight = 96
}

Public Member Functions

virtual ~PVideoDevice ()
const PStringGetDeviceName () const
virtual PStringList GetDeviceNames () const =0
virtual BOOL OpenFull (const OpenArgs &args, BOOL startImmediate=TRUE)
virtual BOOL Open (const PString &deviceName, BOOL startImmediate=TRUE)=0
virtual BOOL IsOpen ()=0
virtual BOOL Close ()=0
virtual BOOL Start ()=0
virtual BOOL Stop ()=0
virtual BOOL SetVideoFormat (VideoFormat videoFormat)
virtual VideoFormat GetVideoFormat () const
virtual int GetNumChannels ()
virtual BOOL SetChannel (int channelNumber)
virtual int GetChannel () const
virtual BOOL SetColourFormatConverter (const PString &colourFormat)
virtual BOOL SetColourFormat (const PString &colourFormat)
const PStringGetColourFormat () const
virtual BOOL GetVFlipState ()
virtual BOOL SetVFlipState (BOOL newVFlipState)
virtual BOOL SetFrameRate (unsigned rate)
virtual unsigned GetFrameRate () const
virtual BOOL GetFrameSizeLimits (unsigned &minWidth, unsigned &minHeight, unsigned &maxWidth, unsigned &maxHeight)
virtual BOOL SetFrameSizeConverter (unsigned width, unsigned height, BOOL bScaleNotCrop)
virtual BOOL SetFrameSize (unsigned width, unsigned height)
virtual BOOL GetFrameSize (unsigned &width, unsigned &height)
virtual unsigned GetFrameWidth () const
virtual unsigned GetFrameHeight () const
virtual PINDEX GetMaxFrameBytes ()=0
int GetLastError () const
virtual BOOL CanCaptureVideo () const =0
virtual int GetBrightness ()
virtual BOOL SetBrightness (unsigned newBrightness)
virtual int GetWhiteness ()
virtual BOOL SetWhiteness (unsigned newWhiteness)
virtual int GetColour ()
virtual BOOL SetColour (unsigned newColour)
virtual int GetContrast ()
virtual BOOL SetContrast (unsigned newContrast)
virtual int GetHue ()
virtual BOOL SetHue (unsigned newHue)
virtual BOOL GetParameters (int *whiteness, int *brightness, int *colour, int *contrast, int *hue)
virtual BOOL SetVideoChannelFormat (int channelNumber, VideoFormat videoFormat)
void SetPreferredColourFormat (const PString &colourFmt)
const PStringGetPreferredColourFormat ()

Static Public Member Functions

static unsigned CalculateFrameBytes (unsigned width, unsigned height, const PString &colourFormat)

Protected Member Functions

 PVideoDevice ()
PINDEX GetMaxFrameBytesConverted (PINDEX rawFrameBytes) const

Protected Attributes

PString deviceName
int lastError
VideoFormat videoFormat
int channelNumber
PString colourFormat
PString preferredColourFormat
unsigned frameRate
unsigned frameWidth
unsigned frameHeight
BOOL nativeVerticalFlip
PColourConverterconverter
int frameBrightness
int frameWhiteness
int frameContrast
int frameColour
int frameHue
PTime previousFrameTime
int msBetweenFrames
int frameTimeError

Classes

struct  OpenArgs


Detailed Description

This class defines a video device. This class is used to abstract the few parameters that are common to both\ input and output devices.

Example colour formats are:

"Grey" Simple 8 bit linear grey scale "Gray" Synonym for Grey "RGB32" 32 bit RGB "RGB24" 24 bit RGB "RGB565" 16 bit RGB (6 bit green) "RGB555" 15 bit RGB "YUV422" YUV 4:2:2 packed "YUV422P" YUV 4:2:2 planar "YUV411" YUV 4:1:1 packed "YUV411P" YUV 4:1:1 planar "YUV420" YUV 4:2:0 packed "YUV420P" YUV 4:2:0 planar "YUV410" YUV 4:1:0 packed "YUV410P" YUV 4:1:0 planar "MJPEG" Motion JPEG "UYVY422" YUV 4:2:2 packed as U Y V Y U Y V Y ... "UYV444 YUV 4:4:4 packed as U Y V U Y V ... They are used in IEEE 1394 digital cameras. The specification is found at http://www.1394ta.org/Download/Technology/Specifications/2000/IIDC_Spec_v1_30.pdf


Member Enumeration Documentation

enum PVideoDevice::VideoFormat

Enumerator:
PAL 
NTSC 
SECAM 
Auto 
NumVideoFormats 

enum PVideoDevice::StandardSizes

Enumerator:
CIF16Width 
CIF16Height 
CIF4Width 
CIF4Height 
CIFWidth 
CIFHeight 
QCIFWidth 
QCIFHeight 
SQCIFWidth 
SQCIFHeight 


Constructor & Destructor Documentation

PVideoDevice::PVideoDevice (  )  [protected]

Create a new video device (input or output).

virtual PVideoDevice::~PVideoDevice (  )  [virtual]

Delete structures created by PVideoDevice();


Member Function Documentation

const PString& PVideoDevice::GetDeviceName (  )  const [inline]

Get the device name of the open device.

virtual PStringList PVideoDevice::GetDeviceNames (  )  const [pure virtual]

Get a list of all of the drivers available.

virtual BOOL PVideoDevice::OpenFull ( const OpenArgs args,
BOOL  startImmediate = TRUE 
) [virtual]

Open the device given the device name.

Parameters:
args  Parameters to set on opened device
startImmediate  Immediately start device

virtual BOOL PVideoDevice::Open ( const PString deviceName,
BOOL  startImmediate = TRUE 
) [pure virtual]

Open the device given the device name.

Parameters:
deviceName  Device name to open
startImmediate  Immediately start device

Implemented in PVideoInputDevice, and PVideoInput1394DcDevice.

virtual BOOL PVideoDevice::IsOpen (  )  [pure virtual]

Determine if the device is currently open.

Implemented in PVideoInput1394DcDevice.

virtual BOOL PVideoDevice::Close (  )  [pure virtual]

Close the device.

Implemented in PVideoOutputDevice, PVideoInputDevice, and PVideoInput1394DcDevice.

virtual BOOL PVideoDevice::Start (  )  [pure virtual]

Start the video device I/O capture.

Implemented in PVideoOutputDevice, and PVideoInput1394DcDevice.

virtual BOOL PVideoDevice::Stop (  )  [pure virtual]

Stop the video device I/O capture.

Implemented in PVideoOutputDevice, and PVideoInput1394DcDevice.

virtual BOOL PVideoDevice::SetVideoFormat ( VideoFormat  videoFormat  )  [virtual]

Set the video format to be used.

Default behaviour sets the value of the videoFormat variable and then returns TRUE.

Parameters:
videoFormat  New video format

Reimplemented in PVideoInput1394DcDevice.

virtual VideoFormat PVideoDevice::GetVideoFormat (  )  const [virtual]

Get the video format being used.

Default behaviour returns the value of the videoFormat variable.

virtual int PVideoDevice::GetNumChannels (  )  [virtual]

Get the number of video channels available on the device.

Default behaviour returns 1.

Reimplemented in PVideoInput1394DcDevice.

virtual BOOL PVideoDevice::SetChannel ( int  channelNumber  )  [virtual]

Set the video channel to be used on the device. The channel number is an integer from 0 to GetNumChannels()-1. The special value of -1 will find the first working channel number.

Default behaviour sets the value of the channelNumber variable and then returns TRUE.

Parameters:
channelNumber  New channel number for device.

Reimplemented in PVideoInput1394DcDevice.

virtual int PVideoDevice::GetChannel (  )  const [virtual]

Get the video channel to be used on the device.

Default behaviour returns the value of the channelNumber variable.

virtual BOOL PVideoDevice::SetColourFormatConverter ( const PString colourFormat  )  [virtual]

Set the colour format to be used, trying converters if available.

This function will set the colour format on the device to one that is compatible with a registered converter, and install that converter so that the correct format is used.

Reimplemented in PVideoInput1394DcDevice.

virtual BOOL PVideoDevice::SetColourFormat ( const PString colourFormat  )  [virtual]

Set the colour format to be used. Note that this function does not do any conversion. If it returns TRUE then the video device does the colour format in native mode.

To utilise an internal converter use the SetColourFormatConverter() function.

Default behaviour sets the value of the colourFormat variable and then returns TRUE.

Reimplemented in PVideoOutputDeviceRGB, and PVideoInput1394DcDevice.

const PString& PVideoDevice::GetColourFormat (  )  const

Get the colour format to be used.

Default behaviour returns the value of the colourFormat variable.

virtual BOOL PVideoDevice::GetVFlipState (  )  [virtual]

Get the video conversion vertical flip state. Default action is to return FALSE.

virtual BOOL PVideoDevice::SetVFlipState ( BOOL  newVFlipState  )  [virtual]

Set the video conversion vertical flip state. Default action is to return FALSE.

Parameters:
newVFlipState  New vertical flip state

virtual BOOL PVideoDevice::SetFrameRate ( unsigned  rate  )  [virtual]

Set the video frame rate to be used on the device.

Default behaviour sets the value of the frameRate variable and then returns TRUE.

Parameters:
rate  Frames per second

Reimplemented in PVideoInput1394DcDevice.

virtual unsigned PVideoDevice::GetFrameRate (  )  const [virtual]

Get the video frame rate used on the device.

Default behaviour returns the value of the frameRate variable.

virtual BOOL PVideoDevice::GetFrameSizeLimits ( unsigned &  minWidth,
unsigned &  minHeight,
unsigned &  maxWidth,
unsigned &  maxHeight 
) [virtual]

Get the minimum & maximum size of a frame on the device.

Default behaviour returns the value 1 to UINT_MAX for both and returns FALSE.

Parameters:
minWidth  Variable to receive minimum width
minHeight  Variable to receive minimum height
maxWidth  Variable to receive maximum width
maxHeight  Variable to receive maximum height

Reimplemented in PVideoInput1394DcDevice.

virtual BOOL PVideoDevice::SetFrameSizeConverter ( unsigned  width,
unsigned  height,
BOOL  bScaleNotCrop 
) [virtual]

Set the frame size to be used, trying converters if available.

If the device does not support the size, a set of alternate resolutions are attempted. A converter is setup if possible.

Parameters:
width  New width of frame
height  New height of frame
bScaleNotCrop  Scale or crop/pad preference

Reimplemented in PVideoInput1394DcDevice.

virtual BOOL PVideoDevice::SetFrameSize ( unsigned  width,
unsigned  height 
) [virtual]

Set the frame size to be used.

Note that devices may not be able to produce the requested size, and this function will fail. See SetFrameSizeConverter().

Default behaviour sets the frameWidth and frameHeight variables and returns TRUE.

Parameters:
width  New width of frame
height  New height of frame

Reimplemented in PVideoOutputDeviceRGB, and PVideoInput1394DcDevice.

virtual BOOL PVideoDevice::GetFrameSize ( unsigned &  width,
unsigned &  height 
) [virtual]

Get the frame size being used.

Default behaviour returns the value of the frameWidth and frameHeight variable and returns TRUE.

virtual unsigned PVideoDevice::GetFrameWidth (  )  const [virtual]

Get the width of the frame being used.

Default behaviour returns the value of the frameWidth variable

virtual unsigned PVideoDevice::GetFrameHeight (  )  const [virtual]

Get the height of the frame being used.

Default behaviour returns the value of the frameHeight variable

virtual PINDEX PVideoDevice::GetMaxFrameBytes (  )  [pure virtual]

Get the maximum frame size in bytes.

Note a particular device may be able to provide variable length frames (eg motion JPEG) so will be the maximum size of all frames.

Implemented in PVideoOutputDeviceRGB, and PVideoInput1394DcDevice.

static unsigned PVideoDevice::CalculateFrameBytes ( unsigned  width,
unsigned  height,
const PString colourFormat 
) [static]

Get the number of bytes of an image, given a particular width, height and colour format.

int PVideoDevice::GetLastError (  )  const [inline]

Get the last error code. This is a platform dependent number.

virtual BOOL PVideoDevice::CanCaptureVideo (  )  const [pure virtual]

Is the device a camera, and obtain video

Implemented in PVideoOutputDevice, and PVideoInputDevice.

virtual int PVideoDevice::GetBrightness (  )  [virtual]

Get the brightness of the image. 0xffff-Very bright. -1 is unknown.

Reimplemented in PVideoInput1394DcDevice.

virtual BOOL PVideoDevice::SetBrightness ( unsigned  newBrightness  )  [virtual]

Set brightness of the image. 0xffff-Very bright.

Reimplemented in PVideoInput1394DcDevice.

virtual int PVideoDevice::GetWhiteness (  )  [virtual]

Get the whiteness of the image. 0xffff-Very white. -1 is unknown.

Reimplemented in PVideoInput1394DcDevice.

virtual BOOL PVideoDevice::SetWhiteness ( unsigned  newWhiteness  )  [virtual]

Set whiteness of the image. 0xffff-Very white.

Reimplemented in PVideoInput1394DcDevice.

virtual int PVideoDevice::GetColour (  )  [virtual]

Get the colour of the image. 0xffff-lots of colour. -1 is unknown.

Reimplemented in PVideoInput1394DcDevice.

virtual BOOL PVideoDevice::SetColour ( unsigned  newColour  )  [virtual]

Set colour of the image. 0xffff-lots of colour.

Reimplemented in PVideoInput1394DcDevice.

virtual int PVideoDevice::GetContrast (  )  [virtual]

Get the contrast of the image. 0xffff-High contrast. -1 is unknown.

Reimplemented in PVideoInput1394DcDevice.

virtual BOOL PVideoDevice::SetContrast ( unsigned  newContrast  )  [virtual]

Set contrast of the image. 0xffff-High contrast.

Reimplemented in PVideoInput1394DcDevice.

virtual int PVideoDevice::GetHue (  )  [virtual]

Get the hue of the image. 0xffff-High hue. -1 is unknown.

Reimplemented in PVideoInput1394DcDevice.

virtual BOOL PVideoDevice::SetHue ( unsigned  newHue  )  [virtual]

Set hue of the image. 0xffff-High hue.

Reimplemented in PVideoInput1394DcDevice.

virtual BOOL PVideoDevice::GetParameters ( int *  whiteness,
int *  brightness,
int *  colour,
int *  contrast,
int *  hue 
) [virtual]

Return whiteness, brightness, colour, contrast and hue in one call.

Reimplemented in PVideoInput1394DcDevice.

virtual BOOL PVideoDevice::SetVideoChannelFormat ( int  channelNumber,
VideoFormat  videoFormat 
) [virtual]

Set VideoFormat and VideoChannel in one ioctl

void PVideoDevice::SetPreferredColourFormat ( const PString colourFmt  )  [inline]

Set preferred native colour format from video capture device. Note empty == no preference.

const PString& PVideoDevice::GetPreferredColourFormat (  )  [inline]

Get preferred native colour format from video capture device. Returns empty == no preference

PINDEX PVideoDevice::GetMaxFrameBytesConverted ( PINDEX  rawFrameBytes  )  const [protected]


Member Data Documentation

PString PVideoDevice::deviceName [protected]

int PVideoDevice::lastError [protected]

VideoFormat PVideoDevice::videoFormat [protected]

int PVideoDevice::channelNumber [protected]

PString PVideoDevice::colourFormat [protected]

PString PVideoDevice::preferredColourFormat [protected]

unsigned PVideoDevice::frameRate [protected]

unsigned PVideoDevice::frameWidth [protected]

unsigned PVideoDevice::frameHeight [protected]

BOOL PVideoDevice::nativeVerticalFlip [protected]

PColourConverter* PVideoDevice::converter [protected]

int PVideoDevice::frameBrightness [protected]

int PVideoDevice::frameWhiteness [protected]

int PVideoDevice::frameContrast [protected]

int PVideoDevice::frameColour [protected]

int PVideoDevice::frameHue [protected]

PTime PVideoDevice::previousFrameTime [protected]

int PVideoDevice::msBetweenFrames [protected]

int PVideoDevice::frameTimeError [protected]


The documentation for this class was generated from the following file:
Generated on Fri Sep 21 14:40:16 2007 for PWLib by  doxygen 1.5.3