All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PVideoFrameInfo Class Reference

`#include <videoio.h>`

Inheritance diagram for PVideoFrameInfo:

## 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 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 PString & | GetColourFormat () 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 PObject * | Clone () 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 | Compare (const PObject &obj) const
| Compare the two objects and return their relative rank. 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

enum PVideoFrameInfo::ResizeMode

Enumerator
eScale |
eCropCentre |
eCropTopLeft |
eMaxResizeMode |

enum PVideoFrameInfo::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::PVideoFrameInfo | ( |  | ) |

Construct video frame information.

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

## Member Function Documentation

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

static

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

Parameters

  width | Width to convert
  height | Height to convert

PINDEX PVideoFrameInfo::CalculateFrameBytes | ( |  | ) | const

inline

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

References CalculateFrameBytes(), colourFormat, frameHeight, and frameWidth.

Referenced by CalculateFrameBytes().

static PINDEX PVideoFrameInfo::CalculateFrameBytes | ( | unsigned | width,
|  | unsigned | height,
|  | const PString & | colourFormat
| ) |  |

static

Parameters

  width | WIdth of frame
  height | Height of frame
  colourFormat | Colour format of frame

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

virtual

Get the colour format to be used.

Default behaviour returns the value of the colourFormat variable.

virtual unsigned PVideoFrameInfo::GetFrameHeight | ( |  | ) | const

virtual

Get the height of the frame being used.

Default behaviour returns the value of the frameHeight variable

virtual unsigned PVideoFrameInfo::GetFrameRate | ( |  | ) | const

virtual

Get the video frame rate used on the device.

Default behaviour returns the value of the frameRate variable.

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.

virtual unsigned PVideoFrameInfo::GetFrameWidth | ( |  | ) | const

virtual

Get the width of the frame being used.

Default behaviour returns the value of the frameWidth variable

ResizeMode PVideoFrameInfo::GetResizeMode | ( |  | ) | const

inline

Get the resize mode to be used.

References resizeMode.

virtual unsigned PVideoFrameInfo::GetSarHeight | ( |  | ) | const

virtual

Get the height of the sar being used.

Default behaviour returns the value of the sarHeight variable

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.

virtual unsigned PVideoFrameInfo::GetSarWidth | ( |  | ) | const

virtual

Get the width of the sar being used.

Default behaviour returns the value of the sarWidth variable

static PStringArray PVideoFrameInfo::GetSizeNames | ( |  | ) |

static

Get all "known" image size names.

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

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

  str | String to parse

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

  str | String to parse
  width | Resultant width
  height | Resulatant height

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.

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.

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

  rate | Frames per second

Reimplemented in PVideoInput1394DcDevice.

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.

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

  width | New width of frame
  height | New height of frame

Reimplemented in PVideoOutputDeviceRGB, PVideoDevice, and PVideoInput1394DcDevice.

void PVideoFrameInfo::SetResizeMode | ( | ResizeMode | mode | ) |

inline

Set the resize mode to be used.

References eMaxResizeMode, and resizeMode.

## Friends And Related Function Documentation

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

friend

## Member Data Documentation

PString PVideoFrameInfo::colourFormat

protected

Referenced by CalculateFrameBytes().

unsigned PVideoFrameInfo::frameHeight

protected

Referenced by CalculateFrameBytes().

unsigned PVideoFrameInfo::frameRate

protected

unsigned PVideoFrameInfo::frameWidth

protected

Referenced by CalculateFrameBytes().

ResizeMode PVideoFrameInfo::resizeMode

protected

Referenced by GetResizeMode(), and SetResizeMode().

unsigned PVideoFrameInfo::sarHeight

protected

unsigned PVideoFrameInfo::sarWidth

protected

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

- videoio.h