28 #ifndef PTLIB_PVIDEOIO_H
29 #define PTLIB_PVIDEOIO_H
46 #define PTLIB_VIDEO_YUV420P "YUV420P"
59 friend ostream &
operator<<(ostream & strm, ResizeMode mode);
85 unsigned frameRate = 15,
86 ResizeMode resizeMode = eScale
289 Types type = EndTypes,
302 virtual void PrintOn(ostream & strm)
const;
337 virtual void PrintOn(ostream & strm)
const;
442 template<
class PV
ideoXxxDevice>
459 const OpenArgs & args,
493 VideoFormat videoFormat
567 unsigned & minHeight,
581 ResizeMode resizeMode = eMaxResizeMode
649 Attributes & attributes
655 const Attributes & attributes
663 VideoFormat videoFormat
695 P_REMOVE_VIRTUAL(
int, GetBrightness(), 0);
696 P_REMOVE_VIRTUAL(
PBoolean, SetBrightness(
unsigned),
false);
697 P_REMOVE_VIRTUAL(
int, GetWhiteness(), 0);
698 P_REMOVE_VIRTUAL(
PBoolean, SetWhiteness(
unsigned),
false);
699 P_REMOVE_VIRTUAL(
int, GetColour(), 0);
700 P_REMOVE_VIRTUAL(
PBoolean, SetColour(
unsigned),
false);
701 P_REMOVE_VIRTUAL(
int, GetContrast(), 0);
702 P_REMOVE_VIRTUAL(
PBoolean, SetContrast(
unsigned),
false);
703 P_REMOVE_VIRTUAL(
int, GetHue(), 0);
704 P_REMOVE_VIRTUAL(
PBoolean, SetHue(
unsigned),
false);
705 P_REMOVE_VIRTUAL(
PBoolean, GetParameters(
int *,
int *,
int *,
int *,
int *),
false);
728 PPluginManager * pluginMgr = NULL
739 PPluginManager * pluginMgr = NULL
746 PPluginManager * pluginMgr = NULL
756 PPluginManager * pluginMgr = NULL
767 bool startImmediate =
true,
768 PPluginManager * pluginMgr = NULL
772 bool startImmediate =
true,
773 PPluginManager * pluginMgr = NULL
779 const OpenArgs & args,
780 bool startImmediate =
true
819 const FrameData & frameData
838 bool & keyFrameNeeded
872 virtual bool ApplicationMain() {
return false; }
956 PPluginManager * pluginMgr = NULL
967 PPluginManager * pluginMgr = NULL
974 PPluginManager * pluginMgr = NULL
987 PPluginManager * pluginMgr = NULL
998 bool startImmediate =
true,
999 PPluginManager * pluginMgr = NULL
1003 bool startImmediate =
true,
1004 PPluginManager * pluginMgr = NULL
1010 const OpenArgs & args,
1011 bool startImmediate =
true
1018 virtual void PrintOn(ostream & strm)
const;
1043 PPluginManager * pluginMgr = NULL
1052 PPluginManager * pluginMgr = NULL
1094 PINDEX & bytesReturned,
1111 PINDEX * bytesReturned,
1118 PINDEX * bytesReturned = NULL
1124 PINDEX * bytesReturned,
1132 PINDEX * bytesReturned = NULL
1171 PINDEX & bytesReturned,
1200 virtual void PrintOn(ostream & strm)
const;
1239 virtual bool InternalGetFrameData(BYTE * buffer, PINDEX & bytesReturned,
bool & keyFrame,
bool wait);
1303 unsigned & minWidth,
1304 unsigned & minHeight,
1305 unsigned & maxWidth,
1306 unsigned & maxHeight
1329 virtual bool InternalGetFrameData(BYTE * buffer, PINDEX & bytesReturned,
bool & keyFrame,
bool wait);
1345 #define PCREATE_VIDINPUT_PLUGIN_EX(name, extra) \
1346 PCREATE_PLUGIN(name, PVideoInputDevice, PVideoInputDevice_##name, PPlugin_PVideoInputDevice, \
1347 virtual PStringArray GetDeviceNames(P_INT_PTR ) const { return PVideoInputDevice_##name::GetInputDeviceNames(); } \
1348 virtual bool GetDeviceCapabilities(const PString & deviceName, void * caps) const { return PVideoInputDevice_##name::GetInputDeviceCapabilities(deviceName, (PVideoInputDevice::Capabilities *)caps); } \
1351 #define PCREATE_VIDINPUT_PLUGIN(name) PCREATE_VIDINPUT_PLUGIN_EX(name, )
1354 #define P_FAKE_VIDEO_DRIVER "FakeVideo"
1355 #define P_FAKE_VIDEO_PREFIX "Fake/"
1356 #define P_FAKE_VIDEO_MOVING_BLOCKS P_FAKE_VIDEO_PREFIX"MovingBlocks"
1357 #define P_FAKE_VIDEO_MOVING_LINE P_FAKE_VIDEO_PREFIX"MovingLine"
1358 #define P_FAKE_VIDEO_BOUNCING_BOXES P_FAKE_VIDEO_PREFIX"BouncingBoxes"
1359 #define P_FAKE_VIDEO_SOLID_COLOUR P_FAKE_VIDEO_PREFIX"SolidColour"
1360 #define P_FAKE_VIDEO_TEXT P_FAKE_VIDEO_PREFIX"Text"
1361 #define P_FAKE_VIDEO_NTSC P_FAKE_VIDEO_PREFIX"NTSCTest"
1362 #define P_FAKE_VIDEO_BLACK P_FAKE_VIDEO_PREFIX"Black"
1367 #define P_APPLICATION_VIDEO_DRIVER "Application"
1372 #define P_MEDIA_FILE_DRIVER "MediaFile"
1377 #define P_VIDEO_FILE_DRIVER "VideoFile"
1382 #define P_VIDEO_FOR_WINDOWS_DRIVER "VideoForWindows"
1387 #define P_DIRECT_SHOW_DRIVER "DirectShow"
1391 #if defined(P_MACOSX)
1392 #define P_MAC_VIDEO_DRIVER "Mac"
1404 #define PCREATE_VIDOUTPUT_PLUGIN_EX(name, extra) \
1405 PCREATE_PLUGIN(name, PVideoOutputDevice, PVideoOutputDevice_##name, PPlugin_PVideoOutputDevice, \
1406 virtual PStringArray GetDeviceNames(P_INT_PTR ) const { return PVideoOutputDevice_##name::GetOutputDeviceNames(); } \
1409 #define PCREATE_VIDOUTPUT_PLUGIN(name) PCREATE_VIDOUTPUT_PLUGIN_EX(name,)
1411 #define P_NULL_VIDEO_DRIVER "NULLOutput"
1412 #define P_NULL_VIDEO_DEVICE "Null Video Out"
1418 #define P_MSWIN_VIDEO_DRIVER "Window"
1419 #define P_MSWIN_VIDEO_PREFIX "MSWIN"
1420 #define P_MSWIN_VIDEO_DEVICE(x,y,width,height) P_MSWIN_VIDEO_PREFIX " X=" x " Y=" y " WIDTH=" width " HEIGHT=" height
1426 #if defined(P_MACOSX) || defined(P_IOS)
1427 #include <SDL_main.h>
1429 #define P_SDL_VIDEO_DRIVER "SDL"
1430 #define P_SDL_VIDEO_PREFIX "SDL"
1431 #define P_SDL_VIDEO_DEVICE(x,y,width,height) P_SDL_VIDEO_PREFIX " X=" x " Y=" y " WIDTH=" width " HEIGHT=" height
1458 #endif // PTLIB_PVIDEOIO_H
static PVideoOutputDevice * CreateDevice(const PString &driverName, PPluginManager *pluginMgr=NULL)
Create the video output device that corresponds to the specified driver name.
unsigned m_frameWidth
Definition: videoio.h:266
VideoFormat videoFormat
Definition: videoio.h:430
int m_reset
Definition: videoio.h:317
int m_exposure
Definition: videoio.h:421
PVideoOutputDeviceRGB()
Create a new video output device.
bool partialFrame
Indicate partial video frame.
Definition: videoio.h:809
int channelNumber
Definition: videoio.h:431
Definition: videoio.h:424
virtual Comparison Compare(const PObject &obj) const
Compare the two PVideoFrameInfo and return their relative rank.
unsigned width
Width of area in frame where data is put.
Definition: videoio.h:803
PINDEX m_bytesPerPixel
Definition: videoio.h:932
PINDEX GetMaxFrameBytesConverted(PINDEX rawFrameBytes) const
static PStringArray GetDriversDeviceNames(const PString &driverName, PPluginManager *pluginMgr=NULL)
Get video output devices that correspond to the specified driver name.
virtual PBoolean GetFrameSize(unsigned &width, unsigned &height) const
Get the frame size being used.
This class defines an arbitrary time interval to millisecond accuracy.
Definition: timeint.h:51
ResizeMode m_resizeMode
Definition: videoio.h:272
int m_contrast
Definition: videoio.h:417
unsigned width
Definition: videoio.h:435
PString driverName
Definition: videoio.h:428
bool convertSize
Definition: videoio.h:437
P_DECLARE_STREAMABLE_ENUM(Types, Pan, Tilt, Zoom, Focus)
virtual PBoolean FrameComplete()=0
Indicate frame may be displayed.
virtual void PrintOn(ostream &strm) const
Output the contents of the object to the stream.
Definition: videoio.h:1441
Definition: videoio.h:1446
Definition: videoio.h:276
virtual PBoolean SetFrameData(const FrameData &frameData)
Set a section of the output frame buffer.
virtual bool Parse(const PString &str)
Parse a descriptor string for the video format.
int m_channelNumber
Definition: videoio.h:687
virtual PBoolean SetVFlipState(PBoolean newVFlipState)
Set the video conversion vertical flip state.
int ParseDeviceNameTokenInt(const char *token, int defaultValue)
virtual PBoolean Open(const PString &deviceName, PBoolean startImmediate=true)=0
Open the device given the device name.
virtual int GetLastError() const
Get the last error code.
Definition: videoio.h:639
virtual unsigned GetFrameRate() const
Get the video frame rate used on the device.
virtual unsigned GetFrameHeight() const
Get the height of the frame being used.
virtual PBoolean GetVFlipState()
Get the video conversion vertical flip state.
virtual PBoolean SetVideoChannelFormat(int channelNumber, VideoFormat videoFormat)
Set VideoFormat and VideoChannel in one ioctl.
static bool ParseSize(const PString &str, unsigned &width, unsigned &height)
Parse the standard size string names.
virtual PBoolean SetFrameRate(unsigned rate)
Set the video frame rate to be used on the device.
unsigned sarHeight
Aspect ratio height of area in frame where data is put.
Definition: videoio.h:806
int m_minimum
Definition: videoio.h:314
Comparison
Result of the comparison operation performed by the Compare() function.
Definition: object.h:2251
#define PPLUGIN_STATIC_LOAD(serviceName, serviceType)
Definition: plugin.h:123
virtual void SetResizeMode(ResizeMode mode)
Set the resize mode to be used.
Definition: videoio.h:208
uint64_t ParseDeviceNameTokenUnsigned(const char *token, uint64_t defaultValue)
unsigned y
Vertical position in frame where data is put.
Definition: videoio.h:802
This class is a variation of a string that ignores case.
Definition: pstring.h:2012
virtual PBoolean SetFrameSize(unsigned width, unsigned height)
Set the frame size to be used.
Types m_type
Definition: videoio.h:313
int SetCurrent(int current)
static const LetterData * GetLetterData(char ascii)
virtual PString GetColourFormat() const
Get the colour format to be used.
unsigned height
Definition: videoio.h:436
char ascii
Definition: videoio.h:1449
virtual VideoFormat GetVideoFormat() const
Get the video format being used.
int m_brightness
Definition: videoio.h:416
PString ParseDeviceNameTokenString(const char *token, const char *defaultValue)
virtual PBoolean SetColourFormat(const PString &colourFormat)
Set the colour format to be used.
virtual PBoolean SetFrameSar(unsigned width, unsigned height)
Set the Storage Aspect Ratio size to be used.
int m_gamma
Definition: videoio.h:420
This is an array collection class of PString objects.
Definition: pstring.h:2365
PString GetDeviceNameFromOpenArgs(const OpenArgs &args) const
static const PString & YUV420P()
Definition: videoio.h:413
PCaselessString m_deviceName
Definition: videoio.h:684
bool m_swappedRedAndBlue
Definition: videoio.h:934
Definition: videoio.h:799
Definition: videoio.h:1448
virtual void PrintOn(ostream &strm) const
Output the contents of the object to the stream.
virtual PBoolean Start()
Start the video device I/O display.
Definition: videoio.h:789
const char * line[MAX_L_HEIGHT]
Definition: videoio.h:1450
virtual PBoolean Stop()=0
Stop the video device I/O capture.
static PVideoOutputDevice * CreateDeviceByName(const PString &deviceName, const PString &driverName=PString::Empty(), PPluginManager *pluginMgr=NULL)
#define PCREATE_PLUGIN_DEVICE(serviceType)
Definition: plugin.h:92
PVideoFrameInfo()
Construct video frame information.
virtual PBoolean GetFrameSize(unsigned &width, unsigned &height) const
Get the frame size being used.
Array of unsigned characters.
Definition: array.h:605
This class defines a video Input device Interactions (Remote Inputs/Controls)
Definition: videoio.h:324
static PString AsString(unsigned width, unsigned height)
Get a width/height as a standard size string name.
unsigned m_frameHeight
Definition: videoio.h:267
unsigned height
Height of area in frame where data is put.
Definition: videoio.h:804
static PString AsString(const Type &type)
virtual PBoolean Stop()
Stop the video device I/O display.
Definition: videoio.h:793
virtual PString GetPreferredColourFormat()
Get preferred native colour format from video capture device.
Definition: videoio.h:675
int m_current
Definition: videoio.h:318
virtual PBoolean IsOpen()=0
Determine if the device is currently open.
P_DECLARE_STREAMABLE_ENUM(VideoFormat, PAL, NTSC, SECAM, Auto)
friend ostream & operator<<(ostream &strm, ResizeMode mode)
PColourConverter * m_converter
Definition: videoio.h:691
virtual int GetNumChannels()
Get the number of video channels available on the device.
ResizeMode resizeMode
Definition: videoio.h:438
virtual ResizeMode GetResizeMode() const
Get the resize mode to be used.
Definition: videoio.h:214
int m_hue
Definition: videoio.h:419
virtual PBoolean Start()=0
Start the video device I/O capture.
PTimeInterval sampleTime
Sampling time for the frame.
Definition: videoio.h:807
int m_lastError
Definition: videoio.h:685
virtual void PrintOn(ostream &strm) const
Output the contents of the object to the stream.
const BYTE * pixels
Data to put into the video frame store.
Definition: videoio.h:808
static PVideoOutputDevice * CreateOpenedDevice(const PString &driverName, const PString &deviceName, bool startImmediate=true, PPluginManager *pluginMgr=NULL)
Create an opened video output device that corresponds to the specified names.
PString deviceName
Definition: videoio.h:429
This class defines a video device.
Definition: videoio.h:372
virtual int GetChannel() const
Get the video channel to be used on the device.
Types GetType() const
Definition: videoio.h:306
bool PBoolean
Definition: object.h:174
virtual bool GetAttributes(Attributes &attributes)
Get video attributes.
virtual PBoolean CanCaptureVideo() const =0
Is the device a camera, and obtain video.
virtual PBoolean SetNearestFrameSize(unsigned width, unsigned height)
Set the nearest available frame size to be used.
virtual PString GetDeviceName() const
Get the device name of the open device.
Definition: videoio.h:406
virtual PBoolean DisableDecode()
Allow the outputdevice decide whether the decoder should ignore decode hence not render any output...
unsigned m_frameRate
Definition: videoio.h:270
StandardSizes
Definition: videoio.h:61
virtual PBoolean OpenFull(const OpenArgs &args, PBoolean startImmediate=true)
Open the device given the device name.
virtual PBoolean GetPosition(int &x, int &y) const
Get the position of the output device, where relevant.
The character string class.
Definition: pstring.h:108
virtual PBoolean SetFrameSize(unsigned width, unsigned height)
Set the frame size to be used.
PPluginManager * pluginMgr
Definition: videoio.h:427
int m_maximum
Definition: videoio.h:315
virtual PStringArray GetDeviceNames() const =0
Get a list of all of the drivers available.
unsigned m_sarWidth
Definition: videoio.h:268
Class for implementing an "adaptive" delay.
Definition: delaychan.h:48
static PStringArray GetSizeNames()
Get all "known" image size names.
FrameData()
Definition: videoio.h:813
virtual PBoolean SetFrameData(const FrameData &frameData)=0
Set a section of the output frame buffer.
virtual PBoolean GetSarSize(unsigned &width, unsigned &height) const
Get the Storage Aspect Ratio size being used.
int GetStep() const
Definition: videoio.h:307
virtual ~PVideoDevice()
Delete structures created by PVideoDevice();.
virtual PString GetColourFormat() const
Get the colour format being used.
int GetCurrent() const
Definition: videoio.h:309
bool IsValid() const
Definition: videoio.h:304
bool convertFormat
Definition: videoio.h:433
static PVideoOutputDevice * CreateOpenedDevice(const PString &deviceName, bool startImmediate=true, PPluginManager *pluginMgr=NULL)
Definition: videoio.h:770
virtual void PrintOn(ostream &strm) const
Output the contents of the object to the stream.
P_DECLARE_ENUM_EX(ResizeMode, eMaxResizeMode, eScale, 0, eCropCentre, eCropTopLeft, eScaleKeepAspect)
PString m_preferredColourFormat
Definition: videoio.h:688
bool flip
Definition: videoio.h:439
static const PString & Empty()
Return an empty string.
virtual PINDEX CalculateFrameBytes() const
Get the number of bytes of an image, given a particular width, height and colour format.
Definition: videoio.h:218
virtual PStringArray GetChannelNames()
Get the names of video channels available on the device.
Type m_type
Definition: videoio.h:340
virtual PBoolean SetFrameSize(unsigned width, unsigned height)
Set the frame size to be used.
int m_step
Definition: videoio.h:316
This class defines a video output device for RGB in a frame store.
Definition: videoio.h:879
virtual PBoolean Close()=0
Close the device.
This class defines a means to convert an image from one colour format to another. ...
Definition: vconvert.h:74
virtual PBoolean SetColourFormat(const PString &colourFormat)
Set the colour format to be used.
virtual ~PVideoOutputDevice()
Close the video output device on destruction.
Definition: videoio.h:723
virtual bool SetPosition(int x, int y)
Set the position of the output device, where relevant.
unsigned m_sarHeight
Definition: videoio.h:269
bool m_nativeVerticalFlip
Definition: videoio.h:689
Attributes m_attributes
Definition: videoio.h:440
PBYTEArray m_frameStore
Definition: videoio.h:692
virtual unsigned GetFrameWidth() const
Get the width of the frame being used.
virtual PBoolean Close()
Close the device.
Definition: videoio.h:785
int m_saturation
Definition: videoio.h:418
This class defines a video output device.
Definition: videoio.h:712
virtual PBoolean SetChannel(int channelNumber)
Set the video channel to be used on the device.
unsigned rate
Definition: videoio.h:434
PVideoOutputDevice()
Create a new video output device.
virtual PINDEX GetMaxFrameBytes()
Get the maximum frame size in bytes.
virtual PBoolean SetColourFormatConverter(const PString &colourFormat)
Set the colour format to be used, trying converters if available.
unsigned x
Horizontal position in frame where data is put.
Definition: videoio.h:801
virtual bool SetAttributes(const Attributes &attributes)
Set video attributes.
PString m_colourFormat
Definition: videoio.h:271
virtual PBoolean SetFrameSizeConverter(unsigned width, unsigned height, ResizeMode resizeMode=eMaxResizeMode)
Set the frame size to be used, trying converters if available.
bool * keyFrameNeeded
Indicates bad video and a new key frame is required.
Definition: videoio.h:810
virtual PBoolean GetFrameSizeLimits(unsigned &minWidth, unsigned &minHeight, unsigned &maxWidth, unsigned &maxHeight)
Get the minimum & maximum size of a frame on the device.
virtual bool SetFrameInfoConverter(const PVideoFrameInfo &info)
Set the frame info to be used, trying converters if available.
virtual PINDEX GetMaxFrameBytes()
Get the maximum frame size in bytes.
virtual unsigned GetSarWidth() const
Get the width of the Storage Aspect Ratio being used.
virtual unsigned GetSarHeight() const
Get the height of the Storage Aspect Ratio being used.
void * mark
Definition: videoio.h:811
virtual PBoolean SetVideoFormat(VideoFormat videoFormat)
Set the video format to be used.
PINDEX m_scanLineWidth
Definition: videoio.h:933
PVideoDevice()
Create a new video device (input or output).
P_DECLARE_ENUM(Type, InteractKey, InteractMouse, InteractNavigate, InteractRTSP, InteractOther)
Ultimate parent class for all objects in the class library.
Definition: object.h:2204
int Reset()
Definition: videoio.h:308
virtual PBoolean CanCaptureVideo() const
Is the device a camera, and obtain video.
PString colourFormat
Definition: videoio.h:432
static PStringArray GetDriverNames(PPluginManager *pluginMgr=NULL)
Get the list of available video output drivers (plug-ins)
virtual void SetPreferredColourFormat(const PString &colourFmt)
Set preferred native colour format from video capture device.
Definition: videoio.h:670
VideoFormat m_videoFormat
Definition: videoio.h:686
bool Validate(PVideoDevice::OpenArgs &validated) const
Definition: videoio.h:443
PVideoControlInfo(Types type=EndTypes, int minimum=0, int maximum=100, int step=1, int reset=0)
Definition: videoio.h:288
unsigned sarWidth
Aspect ratio width of area in frame where data is put.
Definition: videoio.h:805