📄 videoio.h
字号:
/**Determine if the device is currently open.
*/
virtual BOOL IsOpen() = 0;
/**Close the device.
*/
virtual BOOL Close() = 0;
/**Start the video device I/O capture.
*/
virtual BOOL Start() = 0;
/**Stop the video device I/O capture.
*/
virtual BOOL Stop() = 0;
#if PTRACING
friend ostream & operator<<(ostream &, VideoFormat);
#endif
/**Set the video format to be used.
Default behaviour sets the value of the videoFormat variable and then
returns TRUE.
*/
virtual BOOL SetVideoFormat(
VideoFormat videoFormat ///< New video format
);
/**Get the video format being used.
Default behaviour returns the value of the videoFormat variable.
*/
virtual VideoFormat GetVideoFormat() const;
/**Get the number of video channels available on the device.
Default behaviour returns 1.
*/
virtual int GetNumChannels();
/**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.
*/
virtual BOOL SetChannel(
int channelNumber ///< New channel number for device.
);
/**Get the video channel to be used on the device.
Default behaviour returns the value of the channelNumber variable.
*/
virtual int GetChannel() const;
/**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.
*/
virtual BOOL SetColourFormatConverter(
const PString & colourFormat // New colour format for device.
);
/**Set the colour format to be used.
Note that this function does not do any conversion. If it returns TRUE
then the video device does the colour format in native mode.
To utilise an internal converter use the SetColourFormatConverter()
function.
Default behaviour sets the value of the colourFormat variable and then
returns TRUE.
*/
virtual BOOL SetColourFormat(
const PString & colourFormat // New colour format for device.
);
/**Get the colour format to be used.
Default behaviour returns the value of the colourFormat variable.
*/
const PString & GetColourFormat() const;
/**Get the video conversion vertical flip state.
Default action is to return FALSE.
*/
virtual BOOL GetVFlipState();
/**Set the video conversion vertical flip state.
Default action is to return FALSE.
*/
virtual BOOL SetVFlipState(
BOOL newVFlipState ///< New vertical flip state
);
/**Set the video frame rate to be used on the device.
Default behaviour sets the value of the frameRate variable and then
returns TRUE.
*/
virtual BOOL SetFrameRate(
unsigned rate ///< Frames per second
);
/**Get the video frame rate used on the device.
Default behaviour returns the value of the frameRate variable.
*/
virtual unsigned GetFrameRate() const;
/**Get the minimum & maximum size of a frame on the device.
Default behaviour returns the value 1 to UINT_MAX for both and returns
FALSE.
*/
virtual BOOL GetFrameSizeLimits(
unsigned & minWidth, ///< Variable to receive minimum width
unsigned & minHeight, ///< Variable to receive minimum height
unsigned & maxWidth, ///< Variable to receive maximum width
unsigned & maxHeight ///< Variable to receive maximum height
) ;
/**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.
*/
virtual BOOL SetFrameSizeConverter(
unsigned width, ///< New width of frame
unsigned height, ///< New height of frame
BOOL bScaleNotCrop ///< Scale or crop/pad preference
);
/**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
returns TRUE.
*/
virtual BOOL SetFrameSize(
unsigned width, ///< New width of frame
unsigned height ///< New height of frame
);
/**Get the frame size being used.
Default behaviour returns the value of the frameWidth and frameHeight
variable and returns TRUE.
*/
virtual BOOL GetFrameSize(
unsigned & width,
unsigned & height
);
/** Get the width of the frame being used.
Default behaviour returns the value of the frameWidth variable
*/
virtual unsigned GetFrameWidth() const;
/** Get the height of the frame being used.
Default behaviour returns the value of the frameHeight variable
*/
virtual unsigned GetFrameHeight() const;
/**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.
*/
virtual PINDEX GetMaxFrameBytes() = 0;
/** Get the number of bytes of an image, given a particular width, height and colour format.
*/
static unsigned CalculateFrameBytes(
unsigned width,
unsigned height,
const PString & colourFormat
);
/**Get the last error code. This is a platform dependent number.
*/
int GetLastError() const { return lastError; }
/** Is the device a camera, and obtain video
*/
virtual BOOL CanCaptureVideo() const = 0;
/**Get the brightness of the image. 0xffff-Very bright. -1 is unknown.
*/
virtual int GetBrightness();
/**Set brightness of the image. 0xffff-Very bright.
*/
virtual BOOL SetBrightness(unsigned newBrightness);
/**Get the whiteness of the image. 0xffff-Very white. -1 is unknown.
*/
virtual int GetWhiteness();
/**Set whiteness of the image. 0xffff-Very white.
*/
virtual BOOL SetWhiteness(unsigned newWhiteness);
/**Get the colour of the image. 0xffff-lots of colour. -1 is unknown.
*/
virtual int GetColour();
/**Set colour of the image. 0xffff-lots of colour.
*/
virtual BOOL SetColour(unsigned newColour);
/**Get the contrast of the image. 0xffff-High contrast. -1 is unknown.
*/
virtual int GetContrast();
/**Set contrast of the image. 0xffff-High contrast.
*/
virtual BOOL SetContrast(unsigned newContrast);
/**Get the hue of the image. 0xffff-High hue. -1 is unknown.
*/
virtual int GetHue();
/**Set hue of the image. 0xffff-High hue.
*/
virtual BOOL SetHue(unsigned newHue);
/**Return whiteness, brightness, colour, contrast and hue in one call.
*/
virtual BOOL GetParameters(
int *whiteness,
int *brightness,
int *colour,
int *contrast,
int *hue
);
/** Set VideoFormat and VideoChannel in one ioctl
*/
virtual BOOL SetVideoChannelFormat (
int channelNumber,
VideoFormat videoFormat
);
/**Set preferred native colour format from video capture device.
Note empty == no preference.
*/
void SetPreferredColourFormat(const PString & colourFmt) { preferredColourFormat = colourFmt; }
/**Get preferred native colour format from video capture device.
Returns empty == no preference
*/
const PString & GetPreferredColourFormat() { return preferredColourFormat; }
protected:
PINDEX GetMaxFrameBytesConverted(PINDEX rawFrameBytes) const;
PString deviceName;
int lastError;
VideoFormat videoFormat;
int channelNumber;
PString colourFormat;
// Preferred native colour format from video input device, empty == no preference
PString preferredColourFormat;
unsigned frameRate;
unsigned frameWidth;
unsigned frameHeight;
BOOL nativeVerticalFlip;
PColourConverter * converter;
int frameBrightness; // 16 bit entity, -1 is no value
int frameWhiteness;
int frameContrast;
int frameColour;
int frameHue;
PTime previousFrameTime; // Time of the last frame.
int msBetweenFrames; // msBetween subsequent frames.
int frameTimeError; // determines when this frame should happen.
};
/**This class defines a video output device.- typically, a window.
*/
class PVideoOutputDevice : public PVideoDevice
{
PCLASSINFO(PVideoOutputDevice, PVideoDevice);
public:
/** Create a new video output device.
*/
PVideoOutputDevice();
/**Close the video output device on destruction.
*/
virtual ~PVideoOutputDevice() { Close(); };
/**Get the list of available video output drivers (plug-ins)
*/
static PStringList GetDriverNames(
PPluginManager * pluginMgr = NULL ///< Plug in manager, use default if NULL
);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -