PTLib
Version 2.14.3
|
#include <videoio.h>
Public Types | |
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 } |
![]() | |
enum | Comparison { LessThan = -1, EqualTo = 0, GreaterThan = 1 } |
Result of the comparison operation performed by the Compare() function. More... | |
Public Member Functions | |
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 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 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 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... | |
![]() | |
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 PObject * | Clone () 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 PObject * | PTraceObjectInstance () 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 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 const char * | Class () |
Get the name of the class as a C string. More... | |
static __inline const PObject * | PTraceObjectInstance (const char *) |
static __inline const PObject * | PTraceObjectInstance (const PObject *obj) |
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 |
![]() | |
unsigned | m_traceContextIdentifier |
Friends | |
ostream & | operator<< (ostream &strm, ResizeMode mode) |
Additional Inherited Members | |
![]() | |
PObject () | |
Constructor for PObject, made protected so cannot ever create one on its own. More... | |
PVideoFrameInfo::PVideoFrameInfo | ( | ) |
Construct video frame information.
PVideoFrameInfo::PVideoFrameInfo | ( | unsigned | frameWidth, |
unsigned | frameHeight, | ||
const PString & | colourFormat = "YUV420P" , |
||
unsigned | frameRate = 15 , |
||
ResizeMode | resizeMode = eScale |
||
) |
|
static |
Get a width/height as a standard size string name.
width | Width to convert |
height | Height to convert |
|
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 |
width | WIdth of frame |
height | Height of frame |
colourFormat | Colour format of frame |
|
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.
LessThan
, EqualTo
or GreaterThan
according to the relative rank of the objects. Reimplemented from PObject.
|
virtual |
Get the colour format to be used.
Default behaviour returns the value of the colourFormat variable.
Reimplemented in PVideoDevice.
|
virtual |
Get the height of the frame being used.
Default behaviour returns the value of the frameHeight variable
|
virtual |
Get the video frame rate used on the device.
Default behaviour returns the value of the frameRate variable.
|
virtual |
Get the frame size being used.
Default behaviour returns the value of the frameWidth and frameHeight variable and returns true.
width | Current width of frame |
height | Current height of frame |
Reimplemented in PVideoDevice.
|
virtual |
Get the width of the frame being used.
Default behaviour returns the value of the frameWidth variable
|
inline |
Get the resize mode to be used.
References resizeMode.
|
virtual |
Get the height of the Storage Aspect Ratio being used.
Default behaviour returns the value of the sarHeight variable
|
virtual |
Get the Storage Aspect Ratio size being used.
Default behaviour returns the value of the sarWidth and sarHeight variable and returns true.
width | Current SAR width of frame |
height | Current SAR height of frame |
|
virtual |
Get the width of the Storage Aspect Ratio being used.
Default behaviour returns the value of the sarWidth variable
|
static |
Get all "known" image size names.
Returns all standard names for sizes, e.g. "qcif", "cif", "vga", "hd1080" etc.
PVideoFrameInfo::P_DECLARE_ENUM_EX | ( | ResizeMode | , |
eMaxResizeMode | , | ||
eScale | , | ||
0 | , | ||
eCropCentre | , | ||
eCropTopLeft | |||
) |
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.
str | String to parse |
|
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".
str | String to parse |
width | Resultant width |
height | Resulatant height |
|
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.
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 |
Set the video frame rate to be used on the device.
Default behaviour sets the value of the frameRate variable and then returns true.
rate | Frames per second |
Reimplemented in PVideoInput1394DcDevice.
|
virtual |
Set the Storage Aspect Ratio size to be used.
Default behaviour sets the sarWidth and sarHeight variables and returns true.
width | New SAR width of frame |
height | New SAR height of frame |
|
virtual |
Set the frame size to be used.
Default behaviour sets the frameWidth and frameHeight variables and returns true.
width | New width of frame |
height | New height of frame |
Reimplemented in PVideoOutputDeviceRGB, PVideoDevice, and PVideoInput1394DcDevice.
|
inline |
Set the resize mode to be used.
References resizeMode.
|
friend |
|
protected |
Referenced by CalculateFrameBytes().
|
protected |
Referenced by CalculateFrameBytes().
|
protected |
|
protected |
Referenced by CalculateFrameBytes().
|
protected |
Referenced by GetResizeMode(), and SetResizeMode().
|
protected |
|
protected |