PTLib  Version 2.14.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PVideoInput1394DcDevice Class Reference

This class defines a video input device that generates fictitous image data. More...

#include <videoio1394dc.h>

Inheritance diagram for PVideoInput1394DcDevice:
Collaboration diagram for PVideoInput1394DcDevice:

Public Member Functions

 PVideoInput1394DcDevice ()
 Create a new video input device. More...
 
 ~PVideoInput1394DcDevice ()
 Close the video input device on destruction. More...
 
PBoolean Open (const PString &deviceName, PBoolean startImmediate=true)
 Open the device given the device name. More...
 
PBoolean IsOpen ()
 Determine of the device is currently open. More...
 
PBoolean Close ()
 Close the device. More...
 
PBoolean Start ()
 Start the video device I/O. More...
 
PBoolean Stop ()
 Stop the video device I/O capture. More...
 
PBoolean IsCapturing ()
 Determine if the video device I/O capture is in progress. More...
 
PINDEX GetMaxFrameBytes ()
 Get the maximum frame size in bytes. More...
 
PBoolean GetFrameData (BYTE *buffer, PINDEX *bytesReturned=NULL)
 Grab a frame, after a delay as specified by the frame rate. More...
 
PBoolean GetFrameDataNoDelay (BYTE *buffer, PINDEX *bytesReturned=NULL)
 Grab a frame. More...
 
int GetBrightness ()
 Get the brightness of the image. More...
 
PBoolean SetBrightness (unsigned newBrightness)
 Set brightness of the image. More...
 
int GetWhiteness ()
 Get the whiteness of the image. More...
 
PBoolean SetWhiteness (unsigned newWhiteness)
 Set whiteness of the image. More...
 
int GetColour ()
 Get the colour of the image. More...
 
PBoolean SetColour (unsigned newColour)
 Set colour of the image. More...
 
int GetContrast ()
 Get the contrast of the image. More...
 
PBoolean SetContrast (unsigned newContrast)
 Set contrast of the image. More...
 
int GetHue ()
 Get the hue of the image. More...
 
PBoolean SetHue (unsigned newHue)
 Set hue of the image. More...
 
PBoolean GetParameters (int *whiteness, int *brightness, int *colour, int *contrast, int *hue)
 Return whiteness, brightness, colour, contrast and hue in one call. More...
 
PBoolean GetFrameSizeLimits (unsigned &minWidth, unsigned &minHeight, unsigned &maxWidth, unsigned &maxHeight)
 Get the minimum & maximum size of a frame on the device. More...
 
void ClearMapping ()
 
int GetNumChannels ()
 Get the number of video channels available on the device. More...
 
PBoolean SetChannel (int channelNumber)
 Set the video channel to be used on the device. More...
 
PBoolean SetFrameRate (unsigned rate)
 Set the video frame rate to be used on the device. More...
 
PBoolean SetVideoFormat (VideoFormat videoFormat)
 Set the video format to be used. More...
 
PBoolean SetFrameSize (unsigned width, unsigned height)
 Set the frame size to be used. More...
 
PBoolean SetColourFormat (const PString &colourFormat)
 Set the colour format to be used. More...
 
PBoolean TestAllFormats ()
 Try all known video formats & see which ones are accepted by the video driver. More...
 
PBoolean SetFrameSizeConverter (unsigned width, unsigned height, PBoolean bScaleNotCrop)
 Set the frame size to be used, trying converters if available. More...
 
PBoolean SetColourFormatConverter (const PString &colourFormat)
 Set the colour format to be used, trying converters if available. More...
 
- Public Member Functions inherited from PVideoInputDevice
 ~PVideoInputDevice ()
 Create a new video input device. More...
 
virtual bool GetDeviceCapabilities (Capabilities *capabilities) const
 Retrieve a list of Device Capabilities. More...
 
virtual PBoolean CanCaptureVideo () const
 Is the device a camera, and obtain video. More...
 
virtual PBoolean SetNearestFrameSize (unsigned width, unsigned height)
 Set the nearest available frame size to be used. More...
 
virtual PBoolean GetFrame (PBYTEArray &frame)
 Grab a frame. More...
 
virtual PBoolean GetFrameData (BYTE *buffer, PINDEX *bytesReturned, bool &keyFrame)
 Grab a frame, after a delay as specified by the frame rate. More...
 
virtual PBoolean GetFrameDataNoDelay (BYTE *buffer, PINDEX *bytesReturned, bool &keyFrame)
 Grab a frame. More...
 
virtual bool FlowControl (const void *flowData)
 Pass data to the inputdevice for flowControl determination. More...
 
virtual bool SetCaptureMode (unsigned mode)
 Set the capture modes for implementations that support them. More...
 
virtual int GetCaptureMode () const
 Returns the current capture mode. More...
 
virtual bool SetControl (PVideoControlInfo::Types type, int value, ControlMode mode)
 
virtual const PVideoControlInfoGetControlInfo (PVideoControlInfo::Types type) const
 
- Public Member Functions inherited from PVideoDevice
virtual ~PVideoDevice ()
 Delete structures created by PVideoDevice();. More...
 
 P_DECLARE_STREAMABLE_ENUM (VideoFormat, PAL, NTSC, SECAM, Auto)
 
const PStringGetDeviceName () const
 Get the device name of the open device. More...
 
virtual PStringArray GetDeviceNames () const =0
 Get a list of all of the drivers available. More...
 
virtual PBoolean OpenFull (const OpenArgs &args, PBoolean startImmediate=true)
 Open the device given the device name. More...
 
virtual VideoFormat GetVideoFormat () const
 Get the video format being used. More...
 
virtual PStringArray GetChannelNames ()
 Get the names of video channels available on the device. More...
 
virtual int GetChannel () const
 Get the video channel to be used on the device. More...
 
virtual bool SetFrameInfoConverter (const PVideoFrameInfo &info)
 Set the frame info to be used, trying converters if available. More...
 
virtual PBoolean GetVFlipState ()
 Get the video conversion vertical flip state. More...
 
virtual PBoolean SetVFlipState (PBoolean newVFlipState)
 Set the video conversion vertical flip state. More...
 
virtual PBoolean SetFrameSizeConverter (unsigned width, unsigned height, ResizeMode resizeMode=eMaxResizeMode)
 Set the frame size to be used, trying converters if available. More...
 
virtual PBoolean GetFrameSize (unsigned &width, unsigned &height) const
 Get the frame size being used. More...
 
virtual const PStringGetColourFormat () const
 Get the colour format being used. More...
 
int GetLastError () const
 Get the last error code. More...
 
virtual bool GetAttributes (Attributes &attributes)
 Get video attributes. More...
 
virtual bool SetAttributes (const Attributes &attributes)
 Set video attributes. More...
 
virtual PBoolean SetVideoChannelFormat (int channelNumber, VideoFormat videoFormat)
 Set VideoFormat and VideoChannel in one ioctl. More...
 
void SetPreferredColourFormat (const PString &colourFmt)
 Set preferred native colour format from video capture device. More...
 
const PStringGetPreferredColourFormat ()
 Get preferred native colour format from video capture device. More...
 
- Public Member Functions inherited from PVideoFrameInfo
 P_DECLARE_ENUM_EX (ResizeMode, eMaxResizeMode, eScale, 0, eCropCentre, eCropTopLeft)
 
 PVideoFrameInfo ()
 Construct video frame information. More...
 
 PVideoFrameInfo (unsigned frameWidth, unsigned frameHeight, const PString &colourFormat="YUV420P", unsigned frameRate=15, ResizeMode resizeMode=eScale)
 
virtual Comparison Compare (const PObject &obj) const
 Compare the two PVideoFrameInfo and return their relative rank. More...
 
virtual void PrintOn (ostream &strm) const
 Output the contents of the object to the stream. 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 PBoolean SetFrameSar (unsigned width, unsigned height)
 Set the Storage Aspect Ratio size to be used. More...
 
virtual PBoolean GetSarSize (unsigned &width, unsigned &height) const
 Get the Storage Aspect Ratio size being used. More...
 
virtual unsigned GetSarWidth () const
 Get the width of the Storage Aspect Ratio being used. More...
 
virtual unsigned GetSarHeight () const
 Get the height of the Storage Aspect Ratio being used. More...
 
virtual unsigned GetFrameRate () const
 Get the video frame rate used on the device. More...
 
void SetResizeMode (ResizeMode mode)
 Set the resize mode to be used. More...
 
ResizeMode GetResizeMode () const
 Get the resize mode to be used. More...
 
PINDEX CalculateFrameBytes () const
 Get the number of bytes of an image, given a particular width, height and colour format. More...
 
bool Parse (const PString &str)
 Parse a descriptor string for the video format. More...
 
- Public Member Functions inherited from PObject
unsigned GetTraceContextIdentifier () const
 Get PTRACE context identifier. More...
 
void SetTraceContextIdentifier (unsigned id)
 
void GetTraceContextIdentifier (PObject &obj)
 
void GetTraceContextIdentifier (PObject *obj)
 
void SetTraceContextIdentifier (const PObject &obj)
 
void SetTraceContextIdentifier (const PObject *obj)
 
virtual ~PObject ()
 
virtual PObjectClone () const
 Create a copy of the class on the heap. More...
 
template<class CLS >
CLS * CloneAs () const
 As for Clone() but converts to specified type. More...
 
virtual PINDEX HashFunction () const
 This function yields a hash value required by the PDictionary class. More...
 
virtual const char * GetClass (unsigned ancestor=0) const
 Get the current dynamic type of the object instance. More...
 
PBoolean IsClass (const char *cls) const
 
virtual PBoolean InternalIsDescendant (const char *clsName) const
 Determine if the dynamic type of the current instance is a descendent of the specified class. More...
 
__inline const PObjectPTraceObjectInstance () const
 
virtual Comparison CompareObjectMemoryDirect (const PObject &obj) const
 Determine the byte wise comparison of two objects. More...
 
bool operator== (const PObject &obj) const
 Compare the two objects. More...
 
bool operator!= (const PObject &obj) const
 Compare the two objects. More...
 
bool operator< (const PObject &obj) const
 Compare the two objects. More...
 
bool operator> (const PObject &obj) const
 Compare the two objects. More...
 
bool operator<= (const PObject &obj) const
 Compare the two objects. More...
 
bool operator>= (const PObject &obj) const
 Compare the two objects. More...
 
virtual void PrintOn (ostream &strm) const
 Output the contents of the object to the stream. More...
 
virtual void ReadFrom (istream &strm)
 Input the contents of the object from the stream. More...
 

Static Public Member Functions

static PStringList GetInputDeviceNames ()
 Get a list of all of the drivers available. More...
 
- Static Public Member Functions inherited from PVideoInputDevice
static PStringArray GetDriverNames (PPluginManager *pluginMgr=NULL)
 Get the list of available video input drivers (plug-ins) More...
 
static PStringArray GetDriversDeviceNames (const PString &driverName, PPluginManager *pluginMgr=NULL)
 Get video input devices that correspond to the specified driver name. More...
 
static PVideoInputDeviceCreateDevice (const PString &driverName, PPluginManager *pluginMgr=NULL)
 Create the video input device that corresponds to the specified driver name. More...
 
static PVideoInputDeviceCreateDeviceByName (const PString &deviceName, const PString &driverName=PString::Empty(), PPluginManager *pluginMgr=NULL)
 
static PVideoInputDeviceCreateOpenedDevice (const PString &driverName, const PString &deviceName, PBoolean startImmediate=true, PPluginManager *pluginMgr=NULL)
 Create an opened video input device that corresponds to the specified names. More...
 
static PVideoInputDeviceCreateOpenedDevice (const OpenArgs &args, PBoolean startImmediate=true)
 Create an opened video output device that corresponds to the specified arguments. More...
 
static bool GetDeviceCapabilities (const PString &deviceName, Capabilities *capabilities, PPluginManager *pluginMgr=NULL)
 Retrieve a list of Device Capabilities for particular device. More...
 
static bool GetDeviceCapabilities (const PString &deviceName, const PString &driverName, Capabilities *caps, PPluginManager *pluginMgr=NULL)
 Retrieve a list of Device Capabilities for a particular driver. More...
 

Protected Attributes

raw1394handle_t handle
 
PBoolean is_capturing
 
PBoolean UseDMA
 
nodeid_t * camera_nodes
 
int numCameras
 
dc1394_cameracapture camera
 
int capturing_duration
 
PString desiredColourFormat
 
unsigned desiredFrameWidth
 
unsigned desiredFrameHeight
 
- Protected Attributes inherited from PVideoInputDevice
PVideoControlInfo m_controlInfo [PVideoControlInfo::NumTypes]
 
- Protected Attributes inherited from PVideoDevice
PCaselessString deviceName
 
int lastError
 
VideoFormat videoFormat
 
int channelNumber
 
PString preferredColourFormat
 
PBoolean nativeVerticalFlip
 
PColourConverterconverter
 
PBYTEArray frameStore
 
- Protected Attributes inherited from PVideoFrameInfo
unsigned frameWidth
 
unsigned frameHeight
 
unsigned sarWidth
 
unsigned sarHeight
 
unsigned frameRate
 
PString colourFormat
 
ResizeMode resizeMode
 
- Protected Attributes inherited from PObject
unsigned m_traceContextIdentifier
 

Additional Inherited Members

- Public Types inherited from PVideoInputDevice
enum  ControlMode { AutomaticControl, AbsoluteControl, RelativeControl, ResetControl }
 
- Protected Member Functions inherited from PVideoDevice
 PVideoDevice ()
 Create a new video device (input or output). More...
 
PINDEX GetMaxFrameBytesConverted (PINDEX rawFrameBytes) const
 
PString GetDeviceNameFromOpenArgs (const OpenArgs &args) const
 
- Friends inherited from PObject

Detailed Description

This class defines a video input device that generates fictitous image data.

Constructor & Destructor Documentation

PVideoInput1394DcDevice::PVideoInput1394DcDevice ( )

Create a new video input device.

PVideoInput1394DcDevice::~PVideoInput1394DcDevice ( )

Close the video input device on destruction.

Member Function Documentation

void PVideoInput1394DcDevice::ClearMapping ( )
PBoolean PVideoInput1394DcDevice::Close ( )
virtual

Close the device.

Reimplemented from PVideoInputDevice.

int PVideoInput1394DcDevice::GetBrightness ( )

Get the brightness of the image.

0xffff-Very bright.

int PVideoInput1394DcDevice::GetColour ( )

Get the colour of the image.

0xffff-lots of colour.

int PVideoInput1394DcDevice::GetContrast ( )

Get the contrast of the image.

0xffff-High contrast.

PBoolean PVideoInput1394DcDevice::GetFrameData ( BYTE *  buffer,
PINDEX *  bytesReturned = NULL 
)
virtual

Grab a frame, after a delay as specified by the frame rate.

Parameters
bytesReturnedBuffer to receive frame OPtional bytes returned.

Implements PVideoInputDevice.

PBoolean PVideoInput1394DcDevice::GetFrameDataNoDelay ( BYTE *  buffer,
PINDEX *  bytesReturned = NULL 
)
virtual

Grab a frame.

Do not delay according to the current frame rate parameter.

Parameters
bytesReturnedBuffer to receive frame OPtional bytes returned.

Implements PVideoInputDevice.

PBoolean PVideoInput1394DcDevice::GetFrameSizeLimits ( unsigned &  minWidth,
unsigned &  minHeight,
unsigned &  maxWidth,
unsigned &  maxHeight 
)
virtual

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

Parameters
minHeightVariable to receive minimum width
maxWidthVariable to receive minimum height
maxHeightVariable to receive maximum width Variable to receive maximum height

Reimplemented from PVideoDevice.

int PVideoInput1394DcDevice::GetHue ( )

Get the hue of the image.

0xffff-High hue.

static PStringList PVideoInput1394DcDevice::GetInputDeviceNames ( )
static

Get a list of all of the drivers available.

PINDEX PVideoInput1394DcDevice::GetMaxFrameBytes ( )
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.

Implements PVideoDevice.

int PVideoInput1394DcDevice::GetNumChannels ( )
virtual

Get the number of video channels available on the device.

Default behaviour returns 1.

Reimplemented from PVideoDevice.

PBoolean PVideoInput1394DcDevice::GetParameters ( int *  whiteness,
int *  brightness,
int *  colour,
int *  contrast,
int *  hue 
)

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

int PVideoInput1394DcDevice::GetWhiteness ( )

Get the whiteness of the image.

0xffff-Very white.

PBoolean PVideoInput1394DcDevice::IsCapturing ( )
virtual

Determine if the video device I/O capture is in progress.

Implements PVideoInputDevice.

PBoolean PVideoInput1394DcDevice::IsOpen ( )
virtual

Determine of the device is currently open.

Implements PVideoDevice.

PBoolean PVideoInput1394DcDevice::Open ( const PString deviceName,
PBoolean  startImmediate = true 
)
virtual

Open the device given the device name.

Parameters
startImmediateDevice name to open Immediately start device

Implements PVideoInputDevice.

PBoolean PVideoInput1394DcDevice::SetBrightness ( unsigned  newBrightness)

Set brightness of the image.

0xffff-Very bright.

PBoolean PVideoInput1394DcDevice::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
channelNumberNew channel number for device.

Reimplemented from PVideoDevice.

PBoolean PVideoInput1394DcDevice::SetColour ( unsigned  newColour)

Set colour of the image.

0xffff-lots of colour.

PBoolean PVideoInput1394DcDevice::SetColourFormat ( const PString colourFormat)
virtual

Set the colour format to be used.

Default behaviour sets the value of the colourFormat variable and then returns true if not an empty string.

Reimplemented from PVideoFrameInfo.

PBoolean PVideoInput1394DcDevice::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 from PVideoDevice.

PBoolean PVideoInput1394DcDevice::SetContrast ( unsigned  newContrast)

Set contrast of the image.

0xffff-High contrast.

PBoolean PVideoInput1394DcDevice::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
rateFrames per second

Reimplemented from PVideoFrameInfo.

PBoolean PVideoInput1394DcDevice::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 then sets the converter sizes.

Parameters
heightNew width of frame New height of frame

Reimplemented from PVideoDevice.

PBoolean PVideoInput1394DcDevice::SetFrameSizeConverter ( unsigned  width,
unsigned  height,
PBoolean  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
heightNew width of frame
bScaleNotCropNew height of frame Scale or crop/pad preference

Reimplemented from PVideoDevice.

PBoolean PVideoInput1394DcDevice::SetHue ( unsigned  newHue)

Set hue of the image.

0xffff-High hue.

PBoolean PVideoInput1394DcDevice::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
videoFormatNew video format

Reimplemented from PVideoDevice.

PBoolean PVideoInput1394DcDevice::SetWhiteness ( unsigned  newWhiteness)

Set whiteness of the image.

0xffff-Very white.

PBoolean PVideoInput1394DcDevice::Start ( )
virtual

Start the video device I/O.

Implements PVideoDevice.

PBoolean PVideoInput1394DcDevice::Stop ( )
virtual

Stop the video device I/O capture.

Implements PVideoDevice.

PBoolean PVideoInput1394DcDevice::TestAllFormats ( )

Try all known video formats & see which ones are accepted by the video driver.

Member Data Documentation

dc1394_cameracapture PVideoInput1394DcDevice::camera
protected
nodeid_t* PVideoInput1394DcDevice::camera_nodes
protected
int PVideoInput1394DcDevice::capturing_duration
protected
PString PVideoInput1394DcDevice::desiredColourFormat
protected
unsigned PVideoInput1394DcDevice::desiredFrameHeight
protected
unsigned PVideoInput1394DcDevice::desiredFrameWidth
protected
raw1394handle_t PVideoInput1394DcDevice::handle
protected
PBoolean PVideoInput1394DcDevice::is_capturing
protected
int PVideoInput1394DcDevice::numCameras
protected
PBoolean PVideoInput1394DcDevice::UseDMA
protected

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