PTLib  Version 2.10.10
videoio.h
Go to the documentation of this file.
1 /*
2  * videoio.h
3  *
4  * Classes to support streaming video input (grabbing) and output.
5  *
6  * Portable Windows Library
7  *
8  * Copyright (c) 1993-2000 Equivalence Pty. Ltd.
9  *
10  * The contents of this file are subject to the Mozilla Public License
11  * Version 1.0 (the "License"); you may not use this file except in
12  * compliance with the License. You may obtain a copy of the License at
13  * http://www.mozilla.org/MPL/
14  *
15  * Software distributed under the License is distributed on an "AS IS"
16  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17  * the License for the specific language governing rights and limitations
18  * under the License.
19  *
20  * The Original Code is Portable Windows Library.
21  *
22  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
23  *
24  * Contributor(s): Mark Cooke (mpc@star.sr.bham.ac.uk)
25  *
26  * $Revision: 25752 $
27  * $Author: rjongbloed $
28  * $Date: 2011-05-11 21:50:32 -0500 (Wed, 11 May 2011) $
29  */
30 
31 
32 #ifndef PTLIB_PVIDEOIO_H
33 #define PTLIB_PVIDEOIO_H
34 
35 #ifdef P_USE_PRAGMA
36 #pragma interface
37 #endif
38 #include <ptbuildopts.h>
39 
40 #if P_VIDEO
41 
42 #include <ptlib/plugin.h>
43 #include <ptlib/pluginmgr.h>
44 #include <list>
45 
46 class PColourConverter;
47 
48 
49 class PVideoFrameInfo : public PObject
50 {
51  PCLASSINFO(PVideoFrameInfo, PObject);
52 
53  public:
55  {
60  };
61  friend ostream & operator<<(ostream & strm, ResizeMode mode);
62 
64  SQCIFWidth = 128, SQCIFHeight = 96,
65  QCIFWidth = 176, QCIFHeight = 144,
66  CIFWidth = 352, CIFHeight = 288,
67  CIF4Width = 704, CIF4Height = 576,
68  CIF16Width = 1408, CIF16Height = 1152,
69  HD480Width = 704, HD480Height = 480,
70  i480Width = 704, i480Height = 480,
71  HD720Width = 1280, HD720Height = 720,
72  p720Width = 1280, p720Height = 720,
73  HD1080Width= 1920, HD1080Height= 1080,
74  i1080Width = 1920, i1080Height = 1080,
75  HDTVWidth = 1920, HDTVHeight = 1080,
76  MaxWidth = 1920, MaxHeight = 1200
77  };
78 
82  unsigned frameWidth,
83  unsigned frameHeight,
84  const PString & colourFormat = "YUV420P",
85  unsigned frameRate = 15,
87  );
88 
95  virtual void PrintOn(
96  ostream & strm // Stream to print the object into.
97  ) const;
98 
104  virtual PBoolean SetFrameSize(
105  unsigned width,
106  unsigned height
107  );
108 
114  virtual PBoolean GetFrameSize(
115  unsigned & width,
116  unsigned & height
117  ) const;
118 
123  virtual unsigned GetFrameWidth() const;
124 
129  virtual unsigned GetFrameHeight() const;
130 
136  virtual PBoolean SetFrameSar(unsigned width, unsigned height);
137 
143  virtual PBoolean GetSarSize(
144  unsigned & width,
145  unsigned & height
146  ) const;
147 
152  virtual unsigned GetSarWidth() const;
153 
158  virtual unsigned GetSarHeight() const;
159 
165  virtual PBoolean SetFrameRate(
166  unsigned rate
167  );
168 
173  virtual unsigned GetFrameRate() const;
174 
180  virtual PBoolean SetColourFormat(
181  const PString & colourFormat // New colour format for device.
182  );
183 
188  virtual const PString & GetColourFormat() const;
189 
193  ResizeMode mode
194  ) { if (resizeMode < eMaxResizeMode) resizeMode = mode; }
195 
198  ResizeMode GetResizeMode() const { return resizeMode; }
199 
203  static PINDEX CalculateFrameBytes(
204  unsigned width,
205  unsigned height,
206  const PString & colourFormat
207  );
208 
222  bool Parse(
223  const PString & str
224  );
225 
230  static bool ParseSize(
231  const PString & str,
232  unsigned & width,
233  unsigned & height
234  );
235 
238  static PString AsString(
239  unsigned width,
240  unsigned height
241  );
242 
247  static PStringArray GetSizeNames();
248 
249  protected:
250  unsigned frameWidth;
251  unsigned frameHeight;
252  unsigned sarWidth;
253  unsigned sarHeight;
254  unsigned frameRate;
257 };
258 
259 
261 {
262  PCLASSINFO(PVideoControlInfo, PObject);
263 
264  public:
265 
266  typedef enum {
271 
272  static PString AsString(const InputControlType & type);
273 
275  long min;
276  long max;
277  long step;
278  long def;
279  long flags;
280  long current;
281 };
282 
283 
288 {
290 
291 public:
293 
294  virtual PBoolean Pan(long value, bool absolute = false );
295  virtual PBoolean Tilt(long value, bool absolute = false);
296  virtual PBoolean Zoom(long value, bool absolute = false);
297 
298  long GetPan();
299  long GetTilt();
300  long GetZoom();
301 
302  void Reset();
303  void SetCurrentPosition(const InputControlType ctype, long current);
304 
305  typedef std::list<PVideoControlInfo> InputDeviceControls;
306 
307 protected:
309  PBoolean GetDefaultPosition(const InputControlType ctype, long & def);
310  PBoolean GetCurrentPosition(const InputControlType ctype, long & current);
311 
312  std::list<PVideoControlInfo> m_info;
314 
315 };
316 
320 {
321  PCLASSINFO(PVideoInteractionInfo, PObject);
322 
323  public:
324 
325  typedef enum {
332 
333  static PString AsString(const InputInteractType & type);
334 
336 };
337 
338 
368 {
369  PCLASSINFO(PVideoDevice, PVideoFrameInfo);
370 
371  protected:
374  PVideoDevice();
375 
376 
377  public:
380  virtual ~PVideoDevice();
381 
382  enum VideoFormat {
388  };
389 
392  const PString & GetDeviceName() const
393  { return deviceName; }
394 
397  virtual PStringArray GetDeviceNames() const = 0;
398 
399  struct OpenArgs {
400  OpenArgs();
401 
409  unsigned rate;
410  unsigned width;
411  unsigned height;
414  bool flip;
417  int contrast;
418  int colour;
419  int hue;
420  };
421 
424  virtual PBoolean OpenFull(
425  const OpenArgs & args,
426  PBoolean startImmediate = true
427  );
428 
431  virtual PBoolean Open(
432  const PString & deviceName,
433  PBoolean startImmediate = true
434  ) = 0;
435 
438  virtual PBoolean IsOpen() = 0;
439 
442  virtual PBoolean Close() = 0;
443 
446  virtual PBoolean Start() = 0;
447 
450  virtual PBoolean Stop() = 0;
451 
452 
453 #if PTRACING
454  friend ostream & operator<<(ostream &, VideoFormat);
455 #endif
456 
462  virtual PBoolean SetVideoFormat(
464  );
465 
470  virtual VideoFormat GetVideoFormat() const;
471 
476  virtual int GetNumChannels();
477 
485  virtual PBoolean SetChannel(
486  int channelNumber
487  );
488 
493  virtual int GetChannel() const;
494 
502  const PString & colourFormat // New colour format for device.
503  );
504 
508  virtual PBoolean GetVFlipState();
509 
513  virtual PBoolean SetVFlipState(
514  PBoolean newVFlipState
515  );
516 
523  unsigned & minWidth,
524  unsigned & minHeight,
525  unsigned & maxWidth,
526  unsigned & maxHeight
527  ) ;
528 
529 
536  unsigned width,
537  unsigned height,
539  );
540 
547  unsigned width,
548  unsigned height,
549  PBoolean /*bScaleNotCrop*/
550  ) { return SetFrameSizeConverter(width,height,eScale); }
551 
552 
561  unsigned width,
562  unsigned height
563  );
564 
573  virtual PBoolean SetFrameSize(
574  unsigned width,
575  unsigned height
576  );
577 
583  virtual PBoolean GetFrameSize(
584  unsigned & width,
585  unsigned & height
586  ) const;
587 
593  virtual PINDEX GetMaxFrameBytes() = 0;
594 
595 
598  int GetLastError() const { return lastError; }
599 
600 
603  virtual PBoolean CanCaptureVideo() const = 0;
604 
607  virtual int GetBrightness();
608 
611  virtual PBoolean SetBrightness(unsigned newBrightness);
612 
613 
616  virtual int GetWhiteness();
617 
620  virtual PBoolean SetWhiteness(unsigned newWhiteness);
621 
622 
625  virtual int GetColour();
626 
629  virtual PBoolean SetColour(unsigned newColour);
630 
631 
634  virtual int GetContrast();
635 
638  virtual PBoolean SetContrast(unsigned newContrast);
639 
640 
643  virtual int GetHue();
644 
647  virtual PBoolean SetHue(unsigned newHue);
648 
649 
652  virtual PBoolean GetParameters(
653  int *whiteness,
654  int *brightness,
655  int *colour,
656  int *contrast,
657  int *hue
658  );
659 
660 
664  int channelNumber,
666  );
667 
668 
672  void SetPreferredColourFormat(const PString & colourFmt) { preferredColourFormat = colourFmt; }
673 
678 
679  protected:
680  PINDEX GetMaxFrameBytesConverted(PINDEX rawFrameBytes) const;
681 
686  // Preferred native colour format from video input device, empty == no preference
689 
692 
693  int frameBrightness; // 16 bit entity, -1 is no value
697  int frameHue;
698 };
699 
700 
704 {
705  PCLASSINFO(PVideoOutputDevice, PVideoDevice);
706 
707  public:
711 
714  virtual ~PVideoOutputDevice() { Close(); };
715 
719  PPluginManager * pluginMgr = NULL
720  );
721 
729  const PString & driverName,
730  PPluginManager * pluginMgr = NULL
731  );
732 
736  const PString & driverName,
737  PPluginManager * pluginMgr = NULL
738  );
739 
740  /* Create the matching video output device that corresponds to the device name.
741 
742  This is typically used with the return values from GetDriversDeviceNames().
743  */
745  const PString & deviceName,
746  const PString & driverName = PString::Empty(),
747  PPluginManager * pluginMgr = NULL
748  );
749 
756  const PString & driverName,
757  const PString & deviceName,
758  PBoolean startImmediate = true,
759  PPluginManager * pluginMgr = NULL
760  );
761 
765  const OpenArgs & args,
766  PBoolean startImmediate = true
767  );
768 
771  virtual PBoolean Close() { return true; }
772 
775  virtual PBoolean Start() { return true; }
776 
779  virtual PBoolean Stop() { return true; }
780 
783  virtual PBoolean CanCaptureVideo() const;
784 
787  virtual PBoolean SetFrameData(
788  unsigned x,
789  unsigned y,
790  unsigned width,
791  unsigned height,
792  const BYTE * data,
793  PBoolean endFrame = true
794  ) = 0;
795  virtual PBoolean SetFrameData(
796  unsigned x,
797  unsigned y,
798  unsigned width,
799  unsigned height,
800  const BYTE * data,
801  PBoolean endFrame,
802  unsigned flags
803  );
804  virtual PBoolean SetFrameData(
805  unsigned x,
806  unsigned y,
807  unsigned width,
808  unsigned height,
809  unsigned sarwidth,
810  unsigned sarheight,
811  const BYTE * data,
812  PBoolean endFrame,
813  unsigned flags,
814  const void * mark
815  );
816 
823  virtual PBoolean DisableDecode();
824 
831  virtual PBoolean GetPosition(
832  int & x, // X position of device surface
833  int & y // Y position of device surface
834  ) const;
835 
842  virtual bool SetPosition(
843  int x, // X position of device surface
844  int y // Y position of device surface
845  );
846 };
847 
848 
852 {
854 
855  public:
859 
870  virtual PBoolean SetColourFormat(
871  const PString & colourFormat // New colour format for device.
872  );
873 
882  virtual PBoolean SetFrameSize(
883  unsigned width,
884  unsigned height
885  );
886 
892  virtual PINDEX GetMaxFrameBytes();
893 
896  virtual PBoolean SetFrameData(
897  unsigned x,
898  unsigned y,
899  unsigned width,
900  unsigned height,
901  const BYTE * data,
902  PBoolean endFrame = true
903  );
904 
907  virtual PBoolean FrameComplete() = 0;
908 
909  protected:
914 };
915 
916 
917 #ifdef SHOULD_BE_MOVED_TO_PLUGIN
918 
921 class PVideoOutputDevicePPM : public PVideoOutputDeviceRGB
922 {
923  PCLASSINFO(PVideoOutputDevicePPM, PVideoOutputDeviceRGB);
924 
925  public:
928  PVideoOutputDevicePPM();
929 
932  virtual PBoolean Open(
933  const PString & deviceName,
934  PBoolean startImmediate = true
935  );
936 
939  virtual PBoolean IsOpen();
940 
943  virtual PBoolean Close();
944 
947  virtual PStringArray GetDeviceNames() const;
948 
951  virtual PBoolean EndFrame();
952 
953  protected:
954  unsigned frameNumber;
955 };
956 
957 #endif // SHOULD_BE_MOVED_TO_PLUGIN
958 
959 
963 {
964  PCLASSINFO(PVideoInputDevice, PVideoDevice);
965 
966  public:
969  //PVideoInputDevice();
970 
974 
978  PPluginManager * pluginMgr = NULL
979  );
980 
988  const PString & driverName,
989  PPluginManager * pluginMgr = NULL
990  );
991 
995  const PString & driverName,
996  PPluginManager * pluginMgr = NULL
997  );
998 
999  /* Create the matching video input device that corresponds to the device name.
1000  So, for "fake" return a device that will generate fake video.
1001  For "Phillips 680 webcam" (eg) will return appropriate grabber.
1002  Note that Phillips will return the appropriate grabber also.
1003 
1004  This is typically used with the return values from GetDriversDeviceNames().
1005  */
1007  const PString & deviceName,
1008  const PString & driverName = PString::Empty(),
1009  PPluginManager * pluginMgr = NULL
1010  );
1011 
1018  const PString & driverName,
1019  const PString & deviceName,
1020  PBoolean startImmediate = true,
1021  PPluginManager * pluginMgr = NULL
1022  );
1023 
1027  const OpenArgs & args,
1028  PBoolean startImmediate = true
1029  );
1030 
1031  typedef struct {
1032  std::list<PVideoFrameInfo> framesizes;
1033  std::list<PVideoControlInfo> controls;
1034  std::list<PVideoInteractionInfo> interactions;
1035  } Capabilities;
1036 
1040  Capabilities * capabilities
1041  ) const { return GetDeviceCapabilities(GetDeviceName(), capabilities); }
1042 
1046  const PString & deviceName,
1047  Capabilities * capabilities,
1048  PPluginManager * pluginMgr = NULL
1049  );
1050 
1054  const PString & deviceName,
1055  const PString & driverName,
1056  Capabilities * caps,
1057  PPluginManager * pluginMgr = NULL
1058  );
1059 
1064 
1067  virtual PBoolean Open(
1068  const PString & deviceName,
1069  PBoolean startImmediate = true
1070  ) = 0;
1071 
1072  virtual PBoolean Close(
1073  ) { return true; }
1074 
1077  virtual PBoolean CanCaptureVideo() const;
1078 
1081  virtual PBoolean IsCapturing() = 0;
1082 
1090  virtual PBoolean SetNearestFrameSize(
1091  unsigned width,
1092  unsigned height
1093  );
1094 
1097  virtual PBoolean GetFrame(
1098  PBYTEArray & frame
1099  );
1100 
1103  virtual PBoolean GetFrameData(
1104  BYTE * buffer,
1105  PINDEX * bytesReturned,
1106  unsigned int & flags
1107  );
1108  virtual PBoolean GetFrameData(
1109  BYTE * buffer,
1110  PINDEX * bytesReturned = NULL
1111  ) = 0;
1112 
1115  virtual PBoolean GetFrameDataNoDelay(
1116  BYTE * buffer,
1117  PINDEX * bytesReturned,
1118  unsigned int & flags
1119  );
1120  virtual PBoolean GetFrameDataNoDelay(
1121  BYTE * buffer,
1122  PINDEX * bytesReturned = NULL
1123  ) = 0;
1124 
1127  virtual bool FlowControl(const void * flowData);
1128 
1141  virtual bool SetCaptureMode(unsigned mode);
1142 
1146  virtual int GetCaptureMode() const;
1147 };
1148 
1149 
1151 //
1152 // declare macros and structures needed for video input plugins
1153 //
1154 
1156 {
1157  public:
1158  virtual PObject * CreateInstance(int /*userData*/) const { return new className; }
1159  virtual PStringArray GetDeviceNames(int /*userData*/) const { return className::GetInputDeviceNames(); }
1160  virtual bool GetDeviceCapabilities(const PString & deviceName, void * caps) const
1161  { return className::GetDeviceCapabilities(deviceName, (PVideoInputDevice::Capabilities *)caps); }
1162 };
1163 
1164 #define PCREATE_VIDINPUT_PLUGIN(name) \
1165  static PVideoInputPluginServiceDescriptor<PVideoInputDevice_##name> PVideoInputDevice_##name##_descriptor; \
1166  PCREATE_PLUGIN(name, PVideoInputDevice, &PVideoInputDevice_##name##_descriptor)
1167 
1169 
1170 #ifdef P_APPSHARE
1171  PPLUGIN_STATIC_LOAD(Application, PVideoInputDevice);
1172 #endif
1173 
1174 #if P_FFVDEV
1176 #endif
1177 
1178 #if P_VIDFILE
1180 #endif
1181 
1182 #ifdef P_DIRECTSHOW
1184 #endif
1185 
1186 
1188 //
1189 // declare macros and structures needed for video output plugins
1190 //
1191 
1193 {
1194  public:
1195  virtual PObject * CreateInstance(int /*userData*/) const { return new className; }
1196  virtual PStringArray GetDeviceNames(int /*userData*/) const { return className::GetOutputDeviceNames(); }
1197 };
1198 
1199 #define PCREATE_VIDOUTPUT_PLUGIN(name) \
1200  static PVideoOutputPluginServiceDescriptor<PVideoOutputDevice_##name> PVideoOutputDevice_##name##_descriptor; \
1201  PCREATE_PLUGIN(name, PVideoOutputDevice, &PVideoOutputDevice_##name##_descriptor)
1202 
1203 #if _WIN32
1205 #endif
1206 
1207 #if P_SDL
1209 #endif
1210 
1211 
1213 //
1214 // declare classes needed for access to simple video font
1215 //
1216 
1217 class PVideoFont : public PObject
1218 {
1219  PCLASSINFO(PVideoFont, PObject);
1220  public:
1221  enum {
1223  };
1224  struct LetterData {
1225  char ascii;
1226  const char *line[MAX_L_HEIGHT];
1227  };
1228 
1229  static const LetterData * GetLetterData(char ascii);
1230 };
1231 
1232 #endif // P_VIDEO
1233 
1234 #endif // PTLIB_PVIDEOIO_H
1235 
1236 // End Of File ///////////////////////////////////////////////////////////////
1237 
static PVideoOutputDevice * CreateDevice(const PString &driverName, PPluginManager *pluginMgr=NULL)
Create the video output device that corresponds to the specified driver name.
virtual int GetColour()
Get the colour of the image.
Definition: videoio.h:64
VideoFormat videoFormat
Definition: videoio.h:405
virtual PBoolean SetColour(unsigned newColour)
Set colour of the image.
ResizeMode resizeMode
Definition: videoio.h:256
long current
Definition: videoio.h:280
PVideoOutputDeviceRGB()
Create a new video output device.
static PStringArray GetDriversDeviceNames(const PString &driverName, PPluginManager *pluginMgr=NULL)
Get video input devices that correspond to the specified driver name.
int channelNumber
Definition: videoio.h:406
Definition: videoio.h:399
int channelNumber
Definition: videoio.h:685
virtual PBoolean GetFrameData(BYTE *buffer, PINDEX *bytesReturned, unsigned int &flags)
Grab a frame, after a delay as specified by the frame rate.
Definition: videoio.h:268
virtual PStringArray GetDeviceNames(int) const
Definition: videoio.h:1159
virtual PBoolean SetContrast(unsigned newContrast)
Set contrast of the image.
Definition: videoio.h:70
PINDEX GetMaxFrameBytesConverted(PINDEX rawFrameBytes) const
ResizeMode
Definition: videoio.h:54
PBoolean GetVideoControlInfo(const InputControlType ctype, PVideoControlInfo &control)
static PStringArray GetDriversDeviceNames(const PString &driverName, PPluginManager *pluginMgr=NULL)
Get video output devices that correspond to the specified driver name.
Definition: videoio.h:69
int frameContrast
Definition: videoio.h:695
virtual PBoolean GetFrameSize(unsigned &width, unsigned &height) const
Get the frame size being used.
unsigned frameWidth
Definition: videoio.h:250
Definition: videoio.h:65
Definition: videoio.h:69
virtual PBoolean GetFrameDataNoDelay(BYTE *buffer, PINDEX *bytesReturned, unsigned int &flags)
Grab a frame.
#define PCLASSINFO(cls, par)
Declare all the standard PTLib class information.
Definition: object.h:1049
int frameHue
Definition: videoio.h:697
unsigned width
Definition: videoio.h:410
PString driverName
Definition: videoio.h:403
bool convertSize
Definition: videoio.h:412
Definition: videoio.h:72
virtual PBoolean Pan(long value, bool absolute=false)
Definition: videoio.h:76
long def
Definition: videoio.h:278
Definition: videoio.h:68
Definition: plugin.h:109
static PStringArray GetDriverNames(PPluginManager *pluginMgr=NULL)
Get the list of available video input drivers (plug-ins)
virtual PBoolean FrameComplete()=0
Indicate frame may be displayed.
Definition: videoio.h:1217
Definition: videoio.h:74
std::list< PVideoControlInfo > m_info
Definition: videoio.h:312
Definition: videoio.h:260
Definition: pluginmgr.h:57
Definition: videoio.h:75
PINDEX bytesPerPixel
Definition: videoio.h:911
std::list< PVideoInteractionInfo > interactions
Definition: videoio.h:1034
void SetCurrentPosition(const InputControlType ctype, long current)
virtual PBoolean SetVFlipState(PBoolean newVFlipState)
Set the video conversion vertical flip state.
Definition: videoio.h:76
long max
Definition: videoio.h:276
PString preferredColourFormat
Definition: videoio.h:687
virtual PBoolean Open(const PString &deviceName, PBoolean startImmediate=true)=0
Open the device given the device name.
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.
PString colourFormat
Definition: videoio.h:255
virtual PBoolean GetVFlipState()
Get the video conversion vertical flip state.
virtual PBoolean SetVideoChannelFormat(int channelNumber, VideoFormat videoFormat)
Set VideoFormat and VideoChannel in one ioctl.
InputControlType type
Definition: videoio.h:274
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.
virtual int GetHue()
Get the hue of the image.
Definition: videoio.h:66
Register remote KeyPresses.
Definition: videoio.h:327
virtual PBoolean SetFrameSize(unsigned width, unsigned height)
Set the frame size to be used.
int frameWhiteness
Definition: videoio.h:694
static const LetterData * GetLetterData(char ascii)
virtual PObject * CreateInstance(int) const
Definition: videoio.h:1195
unsigned height
Definition: videoio.h:411
char ascii
Definition: videoio.h:1225
virtual VideoFormat GetVideoFormat() const
Get the video format being used.
virtual PBoolean Zoom(long value, bool absolute=false)
virtual PBoolean SetColourFormat(const PString &colourFormat)
Set the colour format to be used.
virtual const PString & GetColourFormat() const
Get the colour format to be used.
virtual PBoolean SetFrameSar(unsigned width, unsigned height)
Set the sar size to be used.
Definition: videoio.h:269
Definition: videoio.h:70
virtual PINDEX GetMaxFrameBytes()=0
Get the maximum frame size in bytes.
This is an array collection class of PString objects.
Definition: pstring.h:2024
Definition: videoio.h:59
void SetResizeMode(ResizeMode mode)
Set the resize mode to be used.
Definition: videoio.h:192
Definition: videoio.h:75
Definition: videoio.h:267
int frameBrightness
Definition: videoio.h:693
Definition: videoio.h:1224
std::list< PVideoFrameInfo > framesizes
Definition: videoio.h:1032
InputInteractType
Definition: videoio.h:325
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:775
Definition: videoio.h:67
const char * line[MAX_L_HEIGHT]
Definition: videoio.h:1226
virtual PBoolean Stop()=0
Stop the video device I/O capture.
int hue
Definition: videoio.h:419
InputControlType
Definition: videoio.h:266
Definition: videoio.h:1222
VideoFormat
Definition: videoio.h:382
Register remote Navigation commands.
Definition: videoio.h:329
BOOL PBoolean
Definition: object.h:102
static PVideoOutputDevice * CreateDeviceByName(const PString &deviceName, const PString &driverName=PString::Empty(), PPluginManager *pluginMgr=NULL)
PVideoFrameInfo()
Construct video frame information.
virtual PBoolean GetFrameSize(unsigned &width, unsigned &height) const
Get the frame size being used.
virtual bool GetDeviceCapabilities(Capabilities *capabilities) const
Retrieve a list of Device Capabilities.
Definition: videoio.h:1039
virtual PBoolean SetWhiteness(unsigned newWhiteness)
Set whiteness of the image.
virtual int GetCaptureMode() const
Returns the current capture mode.
Definition: videoio.h:49
Array of unsigned characters.
Definition: array.h:670
This class defines a video Input device Interactions (Remote Inputs/Controls)
Definition: videoio.h:319
Definition: videoio.h:71
virtual PBoolean Close()
Close the device.
Definition: videoio.h:1072
Definition: videoio.h:1031
Definition: videoio.h:385
Register remote RTSP (Real Time Streaming Protocol) Inputs.
Definition: videoio.h:330
static PString AsString(unsigned width, unsigned height)
Get a width/height as a standard size string name.
virtual PBoolean CanCaptureVideo() const
Is the device a camera, and obtain video.
Definition: videoio.h:68
Definition: videoio.h:64
static PVideoInputDevice * CreateDeviceByName(const PString &deviceName, const PString &driverName=PString::Empty(), PPluginManager *pluginMgr=NULL)
virtual PBoolean Stop()
Stop the video device I/O display.
Definition: videoio.h:779
virtual PBoolean IsOpen()=0
Determine if the device is currently open.
PMutex ccmutex
Definition: videoio.h:313
virtual PBoolean GetFrame(PBYTEArray &frame)
Grab a frame.
virtual PBoolean SetBrightness(unsigned newBrightness)
Set brightness of the image.
static PVideoInputDevice * CreateDevice(const PString &driverName, PPluginManager *pluginMgr=NULL)
Create the video input device that corresponds to the specified driver name.
friend ostream & operator<<(ostream &strm, ResizeMode mode)
virtual int GetNumChannels()
Get the number of video channels available on the device.
ResizeMode resizeMode
Definition: videoio.h:413
PBoolean GetCurrentPosition(const InputControlType ctype, long &current)
virtual PBoolean SetNearestFrameSize(unsigned width, unsigned height)
Set the nearest available frame size to be used.
PPLUGIN_STATIC_LOAD(FakeVideo, PVideoInputDevice)
Definition: videoio.h:1192
int contrast
Definition: videoio.h:417
unsigned frameRate
Definition: videoio.h:254
virtual PBoolean Start()=0
Start the video device I/O capture.
static PString AsString(const InputInteractType &type)
PString deviceName
Definition: videoio.h:404
Definition: videoio.h:71
This class defines a video device.
Definition: videoio.h:367
virtual int GetChannel() const
Get the video channel to be used on the device.
long flags
Definition: videoio.h:279
virtual PBoolean CanCaptureVideo() const =0
Is the device a camera, and obtain video.
virtual bool GetDeviceCapabilities(const PString &deviceName, void *caps) const
Definition: videoio.h:1160
virtual PBoolean SetNearestFrameSize(unsigned width, unsigned height)
Set the nearest available frame size to be used.
PString deviceName
Definition: videoio.h:682
virtual PBoolean DisableDecode()
Allow the outputdevice decide whether the decoder should ignore decode hence not render any output...
bool Parse(const PString &str)
Parse a descriptor string for the video format.
StandardSizes
Definition: videoio.h:63
virtual PBoolean OpenFull(const OpenArgs &args, PBoolean startImmediate=true)
Open the device given the device name.
virtual PBoolean SetHue(unsigned newHue)
Set hue of the image.
virtual PBoolean GetPosition(int &x, int &y) const
Get the position of the output device, where relevant.
Definition: videoio.h:67
PINDEX scanLineWidth
Definition: videoio.h:912
The character string class.
Definition: pstring.h:108
virtual PBoolean SetFrameSize(unsigned width, unsigned height)
Set the frame size to be used.
std::list< PVideoControlInfo > controls
Definition: videoio.h:1033
PPluginManager * pluginMgr
Definition: videoio.h:402
virtual PStringArray GetDeviceNames() const =0
Get a list of all of the drivers available.
Definition: videoio.h:65
virtual PBoolean SetFrameData(unsigned x, unsigned y, unsigned width, unsigned height, const BYTE *data, PBoolean endFrame=true)
Set a section of the output frame buffer.
static PStringArray GetSizeNames()
Get all "known" image size names.
static PString Empty()
Return an empty string.
Definition: videoio.h:384
virtual int GetContrast()
Get the contrast of the image.
virtual PBoolean IsCapturing()=0
Determine if the video device I/O capture is in progress.
int GetLastError() const
Get the last error code.
Definition: videoio.h:598
virtual PBoolean GetSarSize(unsigned &width, unsigned &height) const
Get the sar size being used.
virtual ~PVideoDevice()
Delete structures created by PVideoDevice();.
const PString & GetPreferredColourFormat()
Get preferred native colour format from video capture device.
Definition: videoio.h:677
Definition: videoio.h:72
PBoolean nativeVerticalFlip
Definition: videoio.h:688
PColourConverter * converter
Definition: videoio.h:690
VideoFormat videoFormat
Definition: videoio.h:684
bool convertFormat
Definition: videoio.h:408
PBoolean GetDefaultPosition(const InputControlType ctype, long &def)
This class defines a video input device.
Definition: videoio.h:962
bool flip
Definition: videoio.h:414
Definition: videoio.h:57
~PVideoInputDevice()
Create a new video input device.
Definition: videoio.h:973
virtual PBoolean SetFrameSize(unsigned width, unsigned height)
Set the frame size to be used.
int lastError
Definition: videoio.h:683
virtual PVideoInputControl * GetVideoInputControls()
Get the devices video Input controls By Default return NULL;.
Definition: videoio.h:74
void SetPreferredColourFormat(const PString &colourFmt)
Set preferred native colour format from video capture device.
Definition: videoio.h:672
This class defines a video output device for RGB in a frame store.
Definition: videoio.h:851
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:80
static PVideoInputDevice * CreateOpenedDevice(const PString &driverName, const PString &deviceName, PBoolean startImmediate=true, PPluginManager *pluginMgr=NULL)
Create an opened video input device that corresponds to the specified names.
virtual PBoolean SetFrameSizeConverter(unsigned width, unsigned height, PBoolean)
Set the frame size to be used, trying converters if available.
Definition: videoio.h:546
virtual PBoolean SetColourFormat(const PString &colourFormat)
Set the colour format to be used.
int colour
Definition: videoio.h:418
virtual ~PVideoOutputDevice()
Close the video output device on destruction.
Definition: videoio.h:714
virtual int GetWhiteness()
Get the whiteness of the image.
Definition: videoio.h:1155
virtual bool SetPosition(int x, int y)
Set the position of the output device, where relevant.
InputInteractType type
Definition: videoio.h:335
virtual unsigned GetFrameWidth() const
Get the width of the frame being used.
virtual PBoolean Close()
Close the device.
Definition: videoio.h:771
Definition: videoio.h:56
long step
Definition: videoio.h:277
This class defines a video output device.
Definition: videoio.h:703
virtual PBoolean SetChannel(int channelNumber)
Set the video channel to be used on the device.
unsigned rate
Definition: videoio.h:409
virtual PBoolean SetFrameData(unsigned x, unsigned y, unsigned width, unsigned height, const BYTE *data, PBoolean endFrame=true)=0
Set a section of the output frame buffer.
Synonym for PTimedMutex.
PINDEX CalculateFrameBytes() const
Get the number of bytes of an image, given a particular width, height and colour format.
Definition: videoio.h:202
PVideoOutputDevice()
Create a new video output device.
static PString AsString(const InputControlType &type)
Definition: videoio.h:58
virtual PBoolean SetColourFormatConverter(const PString &colourFormat)
Set the colour format to be used, trying converters if available.
Definition: videoio.h:387
Definition: videoio.h:73
const PString & GetDeviceName() const
Get the device name of the open device.
Definition: videoio.h:392
unsigned sarHeight
Definition: videoio.h:253
ResizeMode GetResizeMode() const
Get the resize mode to be used.
Definition: videoio.h:198
Definition: videoio.h:66
PBYTEArray frameStore
Definition: videoio.h:691
Definition: videoio.h:386
virtual PBoolean SetFrameSizeConverter(unsigned width, unsigned height, ResizeMode resizeMode=eMaxResizeMode)
Set the frame size to be used, trying converters if available.
int whiteness
Definition: videoio.h:416
int frameColour
Definition: videoio.h:696
static PVideoOutputDevice * CreateOpenedDevice(const PString &driverName, const PString &deviceName, PBoolean startImmediate=true, PPluginManager *pluginMgr=NULL)
Create an opened video output device that corresponds to the specified names.
virtual PBoolean GetFrameSizeLimits(unsigned &minWidth, unsigned &minHeight, unsigned &maxWidth, unsigned &maxHeight)
Get the minimum & maximum size of a frame on the device.
int brightness
Definition: videoio.h:415
virtual PINDEX GetMaxFrameBytes()
Get the maximum frame size in bytes.
Register remote Mouse Movement Clicks.
Definition: videoio.h:328
virtual bool FlowControl(const void *flowData)
Pass data to the inputdevice for flowControl determination.
virtual unsigned GetSarWidth() const
Get the width of the sar being used.
Definition: videoio.h:383
virtual PStringArray GetDeviceNames(int) const
Definition: videoio.h:1196
virtual unsigned GetSarHeight() const
Get the height of the sar being used.
virtual PObject * CreateInstance(int) const
Definition: videoio.h:1158
virtual int GetBrightness()
Get the brightness of the image.
virtual PBoolean SetVideoFormat(VideoFormat videoFormat)
Set the video format to be used.
PVideoDevice()
Create a new video device (input or output).
bool swappedRedAndBlue
Definition: videoio.h:913
Ultimate parent class for all objects in the class library.
Definition: object.h:1118
std::list< PVideoControlInfo > InputDeviceControls
Definition: videoio.h:305
virtual PBoolean CanCaptureVideo() const
Is the device a camera, and obtain video.
virtual PBoolean GetParameters(int *whiteness, int *brightness, int *colour, int *contrast, int *hue)
Return whiteness, brightness, colour, contrast and hue in one call.
PString colourFormat
Definition: videoio.h:407
PMutex mutex
Definition: videoio.h:910
static PStringArray GetDriverNames(PPluginManager *pluginMgr=NULL)
Get the list of available video output drivers (plug-ins)
This class defines a video Input device control (Camera controls PTZ)
Definition: videoio.h:287
Definition: videoio.h:326
unsigned frameHeight
Definition: videoio.h:251
long min
Definition: videoio.h:275
virtual PBoolean Tilt(long value, bool absolute=false)
unsigned sarWidth
Definition: videoio.h:252
virtual bool SetCaptureMode(unsigned mode)
Set the capture modes for implementations that support them.
Definition: videoio.h:73
virtual PBoolean Open(const PString &deviceName, PBoolean startImmediate=true)=0
Open the device given the device name.