class PVideoDevice

This class defines a video device.

Inheritance:


Public Methods

[more]virtual ~PVideoDevice ()
Delete structures created by PVideoDevice();
[more]virtual BOOL OpenFull ( const OpenArgs & args, BOOL startImmediate = TRUE )
Open the device given the device name.
[more]virtual BOOL Open ( const PString & deviceName, BOOL startImmediate = TRUE )
Open the device given the device name.
[more]virtual BOOL IsOpen ()
Determine if the device is currently open
[more]virtual BOOL Close ()
Close the device
[more]virtual BOOL Start ()
Start the video device I/O capture
[more]virtual BOOL Stop ()
Stop the video device I/O capture
[more]const PString& GetDeviceName () const
Get the device name of the open device
[more]virtual PStringList GetDeviceNames () const
Get a list of all of the drivers available
[more]virtual BOOL SetVideoFormat ( VideoFormat videoFormat )
Set the video format to be used.
[more]virtual VideoFormat GetVideoFormat () const
Get the video format being used.
[more]virtual int GetNumChannels ()
Get the number of video channels available on the device.
[more]virtual BOOL SetChannel ( int channelNumber )
Set the video channel to be used on the device.
[more]virtual int GetChannel () const
Get the video channel to be used on the device.
[more]virtual BOOL SetColourFormatConverter ( const PString & colourFormat )
Set the colour format to be used, trying converters if available.
[more]virtual BOOL SetColourFormat ( const PString & colourFormat )
Set the colour format to be used.
[more]const PString& GetColourFormat () const
Get the colour format to be used.
[more]virtual BOOL SetFrameRate ( unsigned rate )
Set the video frame rate to be used on the device.
[more]virtual unsigned GetFrameRate () const
Get the video frame rate used on the device.
[more]virtual BOOL GetFrameSizeLimits ( unsigned & minWidth, unsigned & minHeight, unsigned & maxWidth, unsigned & maxHeight )
Get the minimum & maximum size of a frame on the device.
[more]virtual BOOL SetFrameSizeConverter ( unsigned width, unsigned height, BOOL bScaleNotCrop )
Set the frame size to be used, trying converters if available.
[more]virtual BOOL SetFrameSize ( unsigned width, unsigned height )
Set the frame size to be used.
[more]virtual BOOL GetFrameSize ( unsigned & width, unsigned & height )
Get the frame size being used.
[more]virtual unsigned GetFrameWidth () const
Get the width of the frame being used.
[more]virtual unsigned GetFrameHeight () const
Get the height of the frame being used.
[more]virtual PINDEX GetMaxFrameBytes ()
Get the maximum frame size in bytes.
[more]static unsigned CalculateFrameBytes ( unsigned width, unsigned height, const PString & colourFormat )
Get the number of bytes of an image, given a particular width, height and colour format
[more]int GetLastError () const
Get the last error code.
[more]virtual BOOL CanCaptureVideo () const
Is the device a camera, and obtain video
[more]virtual int GetBrightness ()
Get the brightness of the image.
[more]virtual BOOL SetBrightness (unsigned newBrightness)
Set brightness of the image.
[more]virtual int GetWhiteness ()
Get the whiteness of the image.
[more]virtual BOOL SetWhiteness (unsigned newWhiteness)
Set whiteness of the image.
[more]virtual int GetColour ()
Get the colour of the image.
[more]virtual BOOL SetColour (unsigned newColour)
Set colour of the image.
[more]virtual int GetContrast ()
Get the contrast of the image.
[more]virtual BOOL SetContrast (unsigned newContrast)
Set contrast of the image.
[more]virtual int GetHue ()
Get the hue of the image.
[more]virtual BOOL SetHue (unsigned newHue)
Set hue of the image.
[more]virtual BOOL GetParameters ( int* whiteness, int* brightness, int* colour, int* contrast, int* hue )
Return whiteness, brightness, colour, contrast and hue in one call
[more]virtual BOOL SetVideoChannelFormat ( int channelNumber, VideoFormat videoFormat )
Set VideoFormat and VideoChannel in one ioctl
[more]virtual BOOL GetVFlipState ()
Get the video conversion vertical flip state.
[more]virtual BOOL SetVFlipState ( BOOL newVFlipState )
Set the video conversion vertical flip state.
[more]void SetPreferredColourFormat (const PString & colourFmt)
Set preferred native colour format from video capture device.
[more]const PString& GetPreferredColourFormat ()
Get preferred native colour format from video capture device.

Protected Methods

[more] PVideoDevice ()
Create a new video device (input or output)


Inherited from PObject:

Public Methods

Run Time Type functions

I/O functions

Miscellaneous functions

Public Members

Comparison functions


Documentation

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

o PVideoDevice()
Create a new video device (input or output)

ovirtual ~PVideoDevice()
Delete structures created by PVideoDevice();

ovirtual BOOL OpenFull( const OpenArgs & args, BOOL startImmediate = TRUE )
Open the device given the device name.
Parameters:
- args Parameters to set on opened device
startImmediate - Immediately start device

ovirtual BOOL Open( const PString & deviceName, BOOL startImmediate = TRUE ) = 0
Open the device given the device name.
Parameters:
deviceName - Device name to open
startImmediate - Immediately start device

ovirtual BOOL IsOpen() = 0
Determine if the device is currently open

ovirtual BOOL Close()
Close the device

ovirtual BOOL Start()
Start the video device I/O capture

ovirtual BOOL Stop()
Stop the video device I/O capture

oconst PString& GetDeviceName() const
Get the device name of the open device

ovirtual PStringList GetDeviceNames() const = 0
Get a list of all of the drivers available

ovirtual BOOL SetVideoFormat( VideoFormat videoFormat )
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

ovirtual VideoFormat GetVideoFormat() const
Get the video format being used.

Default behaviour returns the value of the videoFormat variable.

ovirtual int GetNumChannels()
Get the number of video channels available on the device.

Default behaviour returns 1.

ovirtual BOOL SetChannel( int channelNumber )
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.

ovirtual int GetChannel() const
Get the video channel to be used on the device.

Default behaviour returns the value of the channelNumber variable.

ovirtual BOOL SetColourFormatConverter( const PString & colourFormat )
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.

ovirtual BOOL SetColourFormat( const PString & colourFormat )
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.

oconst PString& GetColourFormat() const
Get the colour format to be used.

Default behaviour returns the value of the colourFormat variable.

ovirtual BOOL SetFrameRate( unsigned rate )
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

ovirtual unsigned GetFrameRate() const
Get the video frame rate used on the device.

Default behaviour returns the value of the frameRate variable.

ovirtual BOOL GetFrameSizeLimits( unsigned & minWidth, unsigned & minHeight, unsigned & maxWidth, unsigned & maxHeight )
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

ovirtual BOOL SetFrameSizeConverter( unsigned width, unsigned height, BOOL bScaleNotCrop )
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

ovirtual BOOL SetFrameSize( unsigned width, unsigned height )
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

ovirtual BOOL GetFrameSize( unsigned & width, unsigned & height )
Get the frame size being used.

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

ovirtual unsigned GetFrameWidth() const
Get the width of the frame being used.

Default behaviour returns the value of the frameWidth variable

ovirtual unsigned GetFrameHeight() const
Get the height of the frame being used.

Default behaviour returns the value of the frameHeight variable

ovirtual PINDEX GetMaxFrameBytes() = 0
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.

ostatic unsigned CalculateFrameBytes( unsigned width, unsigned height, const PString & colourFormat )
Get the number of bytes of an image, given a particular width, height and colour format

oint GetLastError() const
Get the last error code. This is a platform dependent number.

ovirtual BOOL CanCaptureVideo() const = 0
Is the device a camera, and obtain video

ovirtual int GetBrightness()
Get the brightness of the image. 0xffff-Very bright. -1 is unknown.

ovirtual BOOL SetBrightness(unsigned newBrightness)
Set brightness of the image. 0xffff-Very bright.

ovirtual int GetWhiteness()
Get the whiteness of the image. 0xffff-Very white. -1 is unknown.

ovirtual BOOL SetWhiteness(unsigned newWhiteness)
Set whiteness of the image. 0xffff-Very white.

ovirtual int GetColour()
Get the colour of the image. 0xffff-lots of colour. -1 is unknown.

ovirtual BOOL SetColour(unsigned newColour)
Set colour of the image. 0xffff-lots of colour.

ovirtual int GetContrast()
Get the contrast of the image. 0xffff-High contrast. -1 is unknown.

ovirtual BOOL SetContrast(unsigned newContrast)
Set contrast of the image. 0xffff-High contrast.

ovirtual int GetHue()
Get the hue of the image. 0xffff-High hue. -1 is unknown.

ovirtual BOOL SetHue(unsigned newHue)
Set hue of the image. 0xffff-High hue.

ovirtual BOOL GetParameters( int* whiteness, int* brightness, int* colour, int* contrast, int* hue )
Return whiteness, brightness, colour, contrast and hue in one call

ovirtual BOOL SetVideoChannelFormat( int channelNumber, VideoFormat videoFormat )
Set VideoFormat and VideoChannel in one ioctl

ovirtual BOOL GetVFlipState()
Get the video conversion vertical flip state. Default action is to return FALSE.

ovirtual BOOL SetVFlipState( BOOL newVFlipState )
Set the video conversion vertical flip state. Default action is to return FALSE.
Parameters:
newVFlipState - New vertical flip state

ovoid SetPreferredColourFormat(const PString & colourFmt)
Set preferred native colour format from video capture device. Note empty == no preference.

oconst PString& GetPreferredColourFormat()
Get preferred native colour format from video capture device. Returns empty == no preference


Direct child classes:
PVideoOutputDevice
PVideoInputDevice
Friends:
ostream & operator<<(ostream &, VideoFormat)

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.