PTLib
Version 2.18.8
|
#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, eScaleKeepAspect) | |
PVideoFrameInfo () | |
Construct video frame information. More... | |
PVideoFrameInfo (unsigned frameWidth, unsigned frameHeight, const PString &colourFormat=PVideoFrameInfo::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 PString | GetColourFormat () const |
Get the colour format to be used. More... | |
virtual void | SetResizeMode (ResizeMode mode) |
Set the resize mode to be used. More... | |
virtual ResizeMode | GetResizeMode () const |
Get the resize mode to be used. More... | |
virtual PINDEX | CalculateFrameBytes () const |
Get the number of bytes of an image, given a particular width, height and colour format. More... | |
virtual bool | Parse (const PString &str) |
Parse a descriptor string for the video format. More... | |
![]() | |
__inline unsigned | GetTraceContextIdentifier () const |
Get PTRACE context identifier. More... | |
__inline void | SetTraceContextIdentifier (unsigned id) |
__inline void | SetTraceContextIdentifier (const PObject &obj) |
__inline void | SetTraceContextIdentifier (const PObject *obj) |
__inline void | CopyTraceContextIdentifier (PObject &obj) const |
__inline void | CopyTraceContextIdentifier (PObject *obj) const |
virtual | ~PObject () |
__inline const char * | GetClass () const |
__inline bool | IsClass (const char *name) const |
__inline const PObject * | PTraceObjectInstance () const |
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 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 const PString & | YUV420P () |
static PINDEX | CalculateFrameBytes (unsigned width, unsigned height, const PString &colourFormat=PVideoFrameInfo::YUV420P()) |
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 __inline void | CopyTraceContextIdentifier (PObject &to, const PObject &from) |
static __inline void | CopyTraceContextIdentifier (PObject &to, const PObject *from) |
static __inline void | CopyTraceContextIdentifier (PObject *to, const PObject &from) |
static __inline void | CopyTraceContextIdentifier (PObject *to, const PObject *from) |
static __inline const char * | Class () |
static __inline const PObject * | PTraceObjectInstance (const char *) |
static __inline const PObject * | PTraceObjectInstance (const PObject *obj) |
template<typename T > | |
static Comparison | Compare2 (T v1, T v2) |
Compare two types, returning Comparison type. More... | |
static Comparison | InternalCompareObjectMemoryDirect (const PObject *obj1, const PObject *obj2, PINDEX size) |
Internal function caled from CompareObjectMemoryDirect() More... | |
Protected Attributes | |
unsigned | m_frameWidth |
unsigned | m_frameHeight |
unsigned | m_sarWidth |
unsigned | m_sarHeight |
unsigned | m_frameRate |
PString | m_colourFormat |
ResizeMode | m_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 = PVideoFrameInfo::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 |
|
inlinevirtual |
Get the number of bytes of an image, given a particular width, height and colour format.
Reimplemented in PVideoInputDeviceIndirect.
References CalculateFrameBytes(), m_colourFormat, m_frameHeight, and m_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.
Reimplemented in PVideoInputDeviceIndirect.
|
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
Referenced by P_WXWINDOWS_DEVICE_CLASS::InternalOpen().
|
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
Referenced by P_WXWINDOWS_DEVICE_CLASS::InternalOpen().
|
inlinevirtual |
Get the resize mode to be used.
References m_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 | , | ||
eScaleKeepAspect | |||
) |
|
virtual |
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 |
Reimplemented in PVideoInputDeviceIndirect.
|
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.
Reimplemented from PObject.
Reimplemented in PVideoInputDeviceIndirect, and PVideoDevice.
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 PVideoInputEmulatedDevice, PVideoInputDeviceIndirect, PVideoOutputDeviceRGB, PVideoInput1394DcDevice, and P_WXWINDOWS_DEVICE_CLASS.
|
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 PVideoInputEmulatedDevice, PVideoInputDeviceIndirect, and 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 |
Reimplemented in PVideoInputDeviceIndirect.
|
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 PVideoInputEmulatedDevice, PVideoInputDeviceIndirect, PVideoOutputDeviceRGB, PVideoDevice, PVideoInput1394DcDevice, and P_WXWINDOWS_DEVICE_CLASS.
|
inlinevirtual |
Set the resize mode to be used.
Reimplemented in PVideoInputDeviceIndirect.
References m_resizeMode.
|
static |
|
friend |
|
protected |
Referenced by CalculateFrameBytes().
|
protected |
|
protected |
|
protected |
Referenced by CalculateFrameBytes(), and P_WXWINDOWS_DEVICE_CLASS::SetFrameSize().
|
protected |
Referenced by GetResizeMode(), and SetResizeMode().
|
protected |
|
protected |