PTLib  Version 2.10.11
PVideoFrameInfo Class Reference

#include <videoio.h>

Inheritance diagram for PVideoFrameInfo:
PObject PVideoDevice PVideoInputDevice PVideoOutputDevice PVideoInput1394DcDevice PVideoOutputDeviceRGB

Public Types

enum  ResizeMode { eScale, eCropCentre, eCropTopLeft, eMaxResizeMode }
 
enum  StandardSizes {
  SQCIFWidth = 128, SQCIFHeight = 96, QCIFWidth = 176, QCIFHeight = 144,
  CIFWidth = 352, CIFHeight = 288, CIF4Width = 704, CIF4Height = 576,
  CIF16Width = 1408, CIF16Height = 1152, HD480Width = 704, HD480Height = 480,
  i480Width = 704, i480Height = 480, HD720Width = 1280, HD720Height = 720,
  p720Width = 1280, p720Height = 720, HD1080Width = 1920, HD1080Height = 1080,
  i1080Width = 1920, i1080Height = 1080, HDTVWidth = 1920, HDTVHeight = 1080,
  MaxWidth = 1920, MaxHeight = 1200
}
 
- Public Types inherited from PObject
enum  Comparison { LessThan = -1, EqualTo = 0, GreaterThan = 1 }
 Result of the comparison operation performed by the Compare() function. More...
 

Public Member Functions

 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 PBoolean SetFrameSize (unsigned width, unsigned height)
 Set the frame size to be used. More...
 
virtual PBoolean GetFrameSize (unsigned &width, unsigned &height) const
 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 PBoolean SetFrameSar (unsigned width, unsigned height)
 Set the sar size to be used. More...
 
virtual PBoolean GetSarSize (unsigned &width, unsigned &height) const
 Get the sar size being used. More...
 
virtual unsigned GetSarWidth () const
 Get the width of the sar being used. More...
 
virtual unsigned GetSarHeight () const
 Get the height of the sar being used. More...
 
virtual PBoolean 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 PBoolean SetColourFormat (const PString &colourFormat)
 Set the colour format to be used. More...
 
virtual const PStringGetColourFormat () const
 Get the colour format to be used. 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
virtual ~PObject ()
 
virtual PObjectClone () const
 Create a copy of the class on the heap. 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...
 
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 ReadFrom (istream &strm)
 Input the contents of the object from the stream. More...
 

Static Public Member Functions

static PINDEX CalculateFrameBytes (unsigned width, unsigned height, const PString &colourFormat)
 
static bool ParseSize (const PString &str, unsigned &width, unsigned &height)
 Parse the standard size string names. More...
 
static PString AsString (unsigned width, unsigned height)
 Get a width/height as a standard size string name. More...
 
static PStringArray GetSizeNames ()
 Get all "known" image size names. More...
 
- Static Public Member Functions inherited from PObject
static const char * Class ()
 Get the name of the class as a C string. More...
 
static Comparison InternalCompareObjectMemoryDirect (const PObject *obj1, const PObject *obj2, PINDEX size)
 Internal function caled from CompareObjectMemoryDirect() More...
 

Protected Attributes

unsigned frameWidth
 
unsigned frameHeight
 
unsigned sarWidth
 
unsigned sarHeight
 
unsigned frameRate
 
PString colourFormat
 
ResizeMode resizeMode
 

Friends

ostream & operator<< (ostream &strm, ResizeMode mode)
 

Additional Inherited Members

- Protected Member Functions inherited from PObject
 PObject ()
 Constructor for PObject, made protected so cannot ever create one on its own. More...
 

Member Enumeration Documentation

§ ResizeMode

Enumerator
eScale 
eCropCentre 
eCropTopLeft 
eMaxResizeMode 

§ StandardSizes

Enumerator
SQCIFWidth 
SQCIFHeight 
QCIFWidth 
QCIFHeight 
CIFWidth 
CIFHeight 
CIF4Width 
CIF4Height 
CIF16Width 
CIF16Height 
HD480Width 
HD480Height 
i480Width 
i480Height 
HD720Width 
HD720Height 
p720Width 
p720Height 
HD1080Width 
HD1080Height 
i1080Width 
i1080Height 
HDTVWidth 
HDTVHeight 
MaxWidth 
MaxHeight 

Constructor & Destructor Documentation

§ PVideoFrameInfo() [1/2]

PVideoFrameInfo::PVideoFrameInfo ( )

Construct video frame information.

§ PVideoFrameInfo() [2/2]

PVideoFrameInfo::PVideoFrameInfo ( unsigned  frameWidth,
unsigned  frameHeight,
const PString colourFormat = "YUV420P",
unsigned  frameRate = 15,
ResizeMode  resizeMode = eScale 
)

Member Function Documentation

§ AsString()

static PString PVideoFrameInfo::AsString ( unsigned  width,
unsigned  height 
)
static

Get a width/height as a standard size string name.

Parameters
widthWidth to convert
heightHeight to convert

Referenced by CalculateFrameBytes().

§ CalculateFrameBytes() [1/2]

PINDEX PVideoFrameInfo::CalculateFrameBytes ( ) const
inline

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

References AsString(), CalculateFrameBytes(), colourFormat, frameHeight, frameWidth, GetSizeNames(), Parse(), and ParseSize().

Referenced by CalculateFrameBytes().

§ CalculateFrameBytes() [2/2]

static PINDEX PVideoFrameInfo::CalculateFrameBytes ( unsigned  width,
unsigned  height,
const PString colourFormat 
)
static
Parameters
widthWIdth of frame
heightHeight of frame
colourFormatColour format of frame

§ Compare()

virtual Comparison PVideoFrameInfo::Compare ( const PObject obj) const
virtual

Compare the two PVideoFrameInfo and return their relative rank.

This ranking is by the relative area of the frame resolution, and frame rate if resolution equal. The final check for equality is on the colourFormat. The SAR and resize mode take no part.

Returns
LessThan, EqualTo or GreaterThan according to the relative rank of the objects.

Reimplemented from PObject.

§ GetColourFormat()

virtual const PString& PVideoFrameInfo::GetColourFormat ( ) const
virtual

Get the colour format to be used.

Default behaviour returns the value of the colourFormat variable.

§ GetFrameHeight()

virtual unsigned PVideoFrameInfo::GetFrameHeight ( ) const
virtual

Get the height of the frame being used.

Default behaviour returns the value of the frameHeight variable

§ GetFrameRate()

virtual unsigned PVideoFrameInfo::GetFrameRate ( ) const
virtual

Get the video frame rate used on the device.

Default behaviour returns the value of the frameRate variable.

§ GetFrameSize()

virtual PBoolean PVideoFrameInfo::GetFrameSize ( unsigned &  width,
unsigned &  height 
) const
virtual

Get the frame size being used.

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

Reimplemented in PVideoDevice.

Referenced by PVideoDevice::SetFrameSizeConverter().

§ GetFrameWidth()

virtual unsigned PVideoFrameInfo::GetFrameWidth ( ) const
virtual

Get the width of the frame being used.

Default behaviour returns the value of the frameWidth variable

§ GetResizeMode()

ResizeMode PVideoFrameInfo::GetResizeMode ( ) const
inline

Get the resize mode to be used.

References resizeMode.

§ GetSarHeight()

virtual unsigned PVideoFrameInfo::GetSarHeight ( ) const
virtual

Get the height of the sar being used.

Default behaviour returns the value of the sarHeight variable

§ GetSarSize()

virtual PBoolean PVideoFrameInfo::GetSarSize ( unsigned &  width,
unsigned &  height 
) const
virtual

Get the sar size being used.

Default behaviour returns the value of the sarWidth and sarHeight variable and returns PTrue.

§ GetSarWidth()

virtual unsigned PVideoFrameInfo::GetSarWidth ( ) const
virtual

Get the width of the sar being used.

Default behaviour returns the value of the sarWidth variable

§ GetSizeNames()

static PStringArray PVideoFrameInfo::GetSizeNames ( )
static

Get all "known" image size names.

Returns all standard names for sizes, e.g. "qcif", "cif", "vga", "hd1080" etc.

Referenced by CalculateFrameBytes().

§ Parse()

bool PVideoFrameInfo::Parse ( const PString str)

Parse a descriptor string for the video format.

This is of the form [fmt ':' ] size [ '@' rate][ '/' crop ]. The size component is as for the ParseSize() function.

The fmt string is the colour format such as "RGB32", "YUV420P" etc.

The rate field is a simple integer from 1 to 100.

The crop field is one of "scale", "resize" (synonym for "scale"), "centre", "center", "topleft" or "crop" (synonym for "topleft").

Note no spaces are allowed in the descriptor.

Parameters
strString to parse

Referenced by CalculateFrameBytes().

§ ParseSize()

static bool PVideoFrameInfo::ParseSize ( const PString str,
unsigned &  width,
unsigned &  height 
)
static

Parse the standard size string names.

This will parse a size desciption using either standard names: "qcif", "cif", "vga", "hd1080" etc or WxY form e.g. "640x480".

Parameters
strString to parse
widthResultant width
heightResulatant height

Referenced by CalculateFrameBytes().

§ PrintOn()

virtual void PVideoFrameInfo::PrintOn ( ostream &  strm) const
virtual

Output the contents of the object to the stream.

The exact output is dependent on the exact semantics of the descendent class. This is primarily used by the standard operator<< function.

The default behaviour is to print the class name.

Reimplemented from PObject.

§ SetColourFormat()

virtual PBoolean PVideoFrameInfo::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 in PVideoOutputDeviceRGB, and PVideoInput1394DcDevice.

§ SetFrameRate()

virtual PBoolean PVideoFrameInfo::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 in PVideoInput1394DcDevice.

§ SetFrameSar()

virtual PBoolean PVideoFrameInfo::SetFrameSar ( unsigned  width,
unsigned  height 
)
virtual

Set the sar size to be used.

Default behaviour sets the sarWidth and sarHeight variables and returns PTrue.

§ SetFrameSize()

virtual PBoolean PVideoFrameInfo::SetFrameSize ( unsigned  width,
unsigned  height 
)
virtual

Set the frame size to be used.

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

Parameters
widthNew width of frame
heightNew height of frame

Reimplemented in PVideoOutputDeviceRGB, PVideoDevice, and PVideoInput1394DcDevice.

Referenced by PVideoDevice::SetFrameSizeConverter().

§ SetResizeMode()

void PVideoFrameInfo::SetResizeMode ( ResizeMode  mode)
inline

Set the resize mode to be used.

References eMaxResizeMode, and resizeMode.

Friends And Related Function Documentation

§ operator<<

ostream& operator<< ( ostream &  strm,
ResizeMode  mode 
)
friend

Member Data Documentation

§ colourFormat

PString PVideoFrameInfo::colourFormat
protected

Referenced by CalculateFrameBytes().

§ frameHeight

unsigned PVideoFrameInfo::frameHeight
protected

Referenced by CalculateFrameBytes().

§ frameRate

unsigned PVideoFrameInfo::frameRate
protected

§ frameWidth

unsigned PVideoFrameInfo::frameWidth
protected

Referenced by CalculateFrameBytes().

§ resizeMode

ResizeMode PVideoFrameInfo::resizeMode
protected

Referenced by GetResizeMode(), and SetResizeMode().

§ sarHeight

unsigned PVideoFrameInfo::sarHeight
protected

§ sarWidth

unsigned PVideoFrameInfo::sarWidth
protected

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