PTLib  Version 2.10.11
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: 29328 $
27  * $Author: rjongbloed $
28  * $Date: 2013-03-26 18:23:37 -0500 (Tue, 26 Mar 2013) $
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 
98  virtual Comparison Compare(
99  const PObject & obj // Object to compare against.
100  ) const;
101 
108  virtual void PrintOn(
109  ostream & strm // Stream to print the object into.
110  ) const;
111 
117  virtual PBoolean SetFrameSize(
118  unsigned width,
119  unsigned height
120  );
121 
127  virtual PBoolean GetFrameSize(
128  unsigned & width,
129  unsigned & height
130  ) const;
131 
136  virtual unsigned GetFrameWidth() const;
137 
142  virtual unsigned GetFrameHeight() const;
143 
149  virtual PBoolean SetFrameSar(unsigned width, unsigned height);
150 
156  virtual PBoolean GetSarSize(
157  unsigned & width,
158  unsigned & height
159  ) const;
160 
165  virtual unsigned GetSarWidth() const;
166 
171  virtual unsigned GetSarHeight() const;
172 
178  virtual PBoolean SetFrameRate(
179  unsigned rate
180  );
181 
186  virtual unsigned GetFrameRate() const;
187 
193  virtual PBoolean SetColourFormat(
194  const PString & colourFormat // New colour format for device.
195  );
196 
201  virtual const PString & GetColourFormat() const;
202 
206  ResizeMode mode
207  ) { if (resizeMode < eMaxResizeMode) resizeMode = mode; }
208 
211  ResizeMode GetResizeMode() const { return resizeMode; }
212 
216  static PINDEX CalculateFrameBytes(
217  unsigned width,
218  unsigned height,
219  const PString & colourFormat
220  );
221 
235  bool Parse(
236  const PString & str
237  );
238 
243  static bool ParseSize(
244  const PString & str,
245  unsigned & width,
246  unsigned & height
247  );
248 
251  static PString AsString(
252  unsigned width,
253  unsigned height
254  );
255 
260  static PStringArray GetSizeNames();
261 
262  protected:
263  unsigned frameWidth;
264  unsigned frameHeight;
265  unsigned sarWidth;
266  unsigned sarHeight;
267  unsigned frameRate;
270 };
271 
272 
274 {
275  PCLASSINFO(PVideoControlInfo, PObject);
276 
277  public:
278 
279  typedef enum {
284 
285  static PString AsString(const InputControlType & type);
286 
288  long min;
289  long max;
290  long step;
291  long def;
292  long flags;
293  long current;
294 };
295 
296 
301 {
303 
304 public:
306 
307  virtual PBoolean Pan(long value, bool absolute = false );
308  virtual PBoolean Tilt(long value, bool absolute = false);
309  virtual PBoolean Zoom(long value, bool absolute = false);
310 
311  long GetPan();
312  long GetTilt();
313  long GetZoom();
314 
315  void Reset();
316  void SetCurrentPosition(const InputControlType ctype, long current);
317 
318  typedef std::list<PVideoControlInfo> InputDeviceControls;
319 
320 protected:
322  PBoolean GetDefaultPosition(const InputControlType ctype, long & def);
323  PBoolean GetCurrentPosition(const InputControlType ctype, long & current);
324 
325  std::list<PVideoControlInfo> m_info;
327 
328 };
329 
333 {
334  PCLASSINFO(PVideoInteractionInfo, PObject);
335 
336  public:
337 
338  typedef enum {
345 
346  static PString AsString(const InputInteractType & type);
347 
349 };
350 
351 
381 {
382  PCLASSINFO(PVideoDevice, PVideoFrameInfo);
383 
384  protected:
387  PVideoDevice();
388 
389 
390  public:
393  virtual ~PVideoDevice();
394 
395  enum VideoFormat {
401  };
402 
405  const PString & GetDeviceName() const
406  { return deviceName; }
407 
410  virtual PStringArray GetDeviceNames() const = 0;
411 
412  struct OpenArgs {
413  OpenArgs();
414 
422  unsigned rate;
423  unsigned width;
424  unsigned height;
427  bool flip;
430  int contrast;
431  int colour;
432  int hue;
433  };
434 
437  virtual PBoolean OpenFull(
438  const OpenArgs & args,
439  PBoolean startImmediate = true
440  );
441 
444  virtual PBoolean Open(
445  const PString & deviceName,
446  PBoolean startImmediate = true
447  ) = 0;
448 
451  virtual PBoolean IsOpen() = 0;
452 
455  virtual PBoolean Close() = 0;
456 
459  virtual PBoolean Start() = 0;
460 
463  virtual PBoolean Stop() = 0;
464 
465 
466 #if PTRACING
467  friend ostream & operator<<(ostream &, VideoFormat);
468 #endif
469 
475  virtual PBoolean SetVideoFormat(
477  );
478 
483  virtual VideoFormat GetVideoFormat() const;
484 
489  virtual int GetNumChannels();
490 
498  virtual PBoolean SetChannel(
499  int channelNumber
500  );
501 
506  virtual int GetChannel() const;
507 
515  const PString & colourFormat // New colour format for device.
516  );
517 
521  virtual PBoolean GetVFlipState();
522 
526  virtual PBoolean SetVFlipState(
527  PBoolean newVFlipState
528  );
529 
536  unsigned & minWidth,
537  unsigned & minHeight,
538  unsigned & maxWidth,
539  unsigned & maxHeight
540  ) ;
541 
542 
549  unsigned width,
550  unsigned height,
552  );
553 
560  unsigned width,
561  unsigned height,
562  PBoolean /*bScaleNotCrop*/
563  ) { return SetFrameSizeConverter(width,height,eScale); }
564 
565 
574  unsigned width,
575  unsigned height
576  );
577 
586  virtual PBoolean SetFrameSize(
587  unsigned width,
588  unsigned height
589  );
590 
596  virtual PBoolean GetFrameSize(
597  unsigned & width,
598  unsigned & height
599  ) const;
600 
606  virtual PINDEX GetMaxFrameBytes() = 0;
607 
608 
611  int GetLastError() const { return lastError; }
612 
613 
616  virtual PBoolean CanCaptureVideo() const = 0;
617 
620  virtual int GetBrightness();
621 
624  virtual PBoolean SetBrightness(unsigned newBrightness);
625 
626 
629  virtual int GetWhiteness();
630 
633  virtual PBoolean SetWhiteness(unsigned newWhiteness);
634 
635 
638  virtual int GetColour();
639 
642  virtual PBoolean SetColour(unsigned newColour);
643 
644 
647  virtual int GetContrast();
648 
651  virtual PBoolean SetContrast(unsigned newContrast);
652 
653 
656  virtual int GetHue();
657 
660  virtual PBoolean SetHue(unsigned newHue);
661 
662 
665  virtual PBoolean GetParameters(
666  int *whiteness,
667  int *brightness,
668  int *colour,
669  int *contrast,
670  int *hue
671  );
672 
673 
677  int channelNumber,
679  );
680 
681 
685  void SetPreferredColourFormat(const PString & colourFmt) { preferredColourFormat = colourFmt; }
686 
691 
692  protected:
693  PINDEX GetMaxFrameBytesConverted(PINDEX rawFrameBytes) const;
694 
699  // Preferred native colour format from video input device, empty == no preference
702 
705 
706  int frameBrightness; // 16 bit entity, -1 is no value
710  int frameHue;
711 };
712 
713 
717 {
718  PCLASSINFO(PVideoOutputDevice, PVideoDevice);
719 
720  public:
724 
727  virtual ~PVideoOutputDevice() { Close(); };
728 
732  PPluginManager * pluginMgr = NULL
733  );
734 
742  const PString & driverName,
743  PPluginManager * pluginMgr = NULL
744  );
745 
749  const PString & driverName,
750  PPluginManager * pluginMgr = NULL
751  );
752 
753  /* Create the matching video output device that corresponds to the device name.
754 
755  This is typically used with the return values from GetDriversDeviceNames().
756  */
758  const PString & deviceName,
759  const PString & driverName = PString::Empty(),
760  PPluginManager * pluginMgr = NULL
761  );
762 
769  const PString & driverName,
770  const PString & deviceName,
771  PBoolean startImmediate = true,
772  PPluginManager * pluginMgr = NULL
773  );
774 
778  const OpenArgs & args,
779  PBoolean startImmediate = true
780  );
781 
784  virtual PBoolean Close() { return true; }
785 
788  virtual PBoolean Start() { return true; }
789 
792  virtual PBoolean Stop() { return true; }
793 
796  virtual PBoolean CanCaptureVideo() const;
797 
800  virtual PBoolean SetFrameData(
801  unsigned x,
802  unsigned y,
803  unsigned width,
804  unsigned height,
805  const BYTE * data,
806  PBoolean endFrame = true
807  ) = 0;
808  virtual PBoolean SetFrameData(
809  unsigned x,
810  unsigned y,
811  unsigned width,
812  unsigned height,
813  const BYTE * data,
814  PBoolean endFrame,
815  unsigned flags
816  );
817  virtual PBoolean SetFrameData(
818  unsigned x,
819  unsigned y,
820  unsigned width,
821  unsigned height,
822  unsigned sarwidth,
823  unsigned sarheight,
824  const BYTE * data,
825  PBoolean endFrame,
826  unsigned flags,
827  const void * mark
828  );
829 
836  virtual PBoolean DisableDecode();
837 
844  virtual PBoolean GetPosition(
845  int & x, // X position of device surface
846  int & y // Y position of device surface
847  ) const;
848 
855  virtual bool SetPosition(
856  int x, // X position of device surface
857  int y // Y position of device surface
858  );
859 };
860 
861 
865 {
867 
868  public:
872 
883  virtual PBoolean SetColourFormat(
884  const PString & colourFormat // New colour format for device.
885  );
886 
895  virtual PBoolean SetFrameSize(
896  unsigned width,
897  unsigned height
898  );
899 
905  virtual PINDEX GetMaxFrameBytes();
906 
909  virtual PBoolean SetFrameData(
910  unsigned x,
911  unsigned y,
912  unsigned width,
913  unsigned height,
914  const BYTE * data,
915  PBoolean endFrame = true
916  );
917 
920  virtual PBoolean FrameComplete() = 0;
921 
922  protected:
927 };
928 
929 
930 #ifdef SHOULD_BE_MOVED_TO_PLUGIN
931 
934 class PVideoOutputDevicePPM : public PVideoOutputDeviceRGB
935 {
936  PCLASSINFO(PVideoOutputDevicePPM, PVideoOutputDeviceRGB);
937 
938  public:
941  PVideoOutputDevicePPM();
942 
945  virtual PBoolean Open(
946  const PString & deviceName,
947  PBoolean startImmediate = true
948  );
949 
952  virtual PBoolean IsOpen();
953 
956  virtual PBoolean Close();
957 
960  virtual PStringArray GetDeviceNames() const;
961 
964  virtual PBoolean EndFrame();
965 
966  protected:
967  unsigned frameNumber;
968 };
969 
970 #endif // SHOULD_BE_MOVED_TO_PLUGIN
971 
972 
976 {
977  PCLASSINFO(PVideoInputDevice, PVideoDevice);
978 
979  public:
982  //PVideoInputDevice();
983 
987 
991  PPluginManager * pluginMgr = NULL
992  );
993 
1001  const PString & driverName,
1002  PPluginManager * pluginMgr = NULL
1003  );
1004 
1008  const PString & driverName,
1009  PPluginManager * pluginMgr = NULL
1010  );
1011 
1012  /* Create the matching video input device that corresponds to the device name.
1013  So, for "fake" return a device that will generate fake video.
1014  For "Phillips 680 webcam" (eg) will return appropriate grabber.
1015  Note that Phillips will return the appropriate grabber also.
1016 
1017  This is typically used with the return values from GetDriversDeviceNames().
1018  */
1020  const PString & deviceName,
1021  const PString & driverName = PString::Empty(),
1022  PPluginManager * pluginMgr = NULL
1023  );
1024 
1031  const PString & driverName,
1032  const PString & deviceName,
1033  PBoolean startImmediate = true,
1034  PPluginManager * pluginMgr = NULL
1035  );
1036 
1040  const OpenArgs & args,
1041  PBoolean startImmediate = true
1042  );
1043 
1044  typedef struct {
1045  std::list<PVideoFrameInfo> framesizes;
1046  std::list<PVideoControlInfo> controls;
1047  std::list<PVideoInteractionInfo> interactions;
1048  } Capabilities;
1049 
1053  Capabilities * capabilities
1054  ) const { return GetDeviceCapabilities(GetDeviceName(), capabilities); }
1055 
1059  const PString & deviceName,
1060  Capabilities * capabilities,
1061  PPluginManager * pluginMgr = NULL
1062  );
1063 
1067  const PString & deviceName,
1068  const PString & driverName,
1069  Capabilities * caps,
1070  PPluginManager * pluginMgr = NULL
1071  );
1072 
1077 
1080  virtual PBoolean Open(
1081  const PString & deviceName,
1082  PBoolean startImmediate = true
1083  ) = 0;
1084 
1085  virtual PBoolean Close(
1086  ) { return true; }
1087 
1090  virtual PBoolean CanCaptureVideo() const;
1091 
1094  virtual PBoolean IsCapturing() = 0;
1095 
1103  virtual PBoolean SetNearestFrameSize(
1104  unsigned width,
1105  unsigned height
1106  );
1107 
1110  virtual PBoolean GetFrame(
1111  PBYTEArray & frame
1112  );
1113 
1116  virtual PBoolean GetFrameData(
1117  BYTE * buffer,
1118  PINDEX * bytesReturned,
1119  unsigned int & flags
1120  );
1121  virtual PBoolean GetFrameData(
1122  BYTE * buffer,
1123  PINDEX * bytesReturned = NULL
1124  ) = 0;
1125 
1128  virtual PBoolean GetFrameDataNoDelay(
1129  BYTE * buffer,
1130  PINDEX * bytesReturned,
1131  unsigned int & flags
1132  );
1133  virtual PBoolean GetFrameDataNoDelay(
1134  BYTE * buffer,
1135  PINDEX * bytesReturned = NULL
1136  ) = 0;
1137 
1140  virtual bool FlowControl(const void * flowData);
1141 
1154  virtual bool SetCaptureMode(unsigned mode);
1155 
1159  virtual int GetCaptureMode() const;
1160 };
1161 
1162 
1164 //
1165 // declare macros and structures needed for video input plugins
1166 //
1167 
1169 {
1170  public:
1171  virtual PObject * CreateInstance(int /*userData*/) const { return new className; }
1172  virtual PStringArray GetDeviceNames(int /*userData*/) const { return className::GetInputDeviceNames(); }
1173  virtual bool GetDeviceCapabilities(const PString & deviceName, void * caps) const
1174  { return className::GetDeviceCapabilities(deviceName, (PVideoInputDevice::Capabilities *)caps); }
1175 };
1176 
1177 #define PCREATE_VIDINPUT_PLUGIN(name) \
1178  static PVideoInputPluginServiceDescriptor<PVideoInputDevice_##name> PVideoInputDevice_##name##_descriptor; \
1179  PCREATE_PLUGIN(name, PVideoInputDevice, &PVideoInputDevice_##name##_descriptor)
1180 
1182 
1183 #ifdef P_APPSHARE
1184  PPLUGIN_STATIC_LOAD(Application, PVideoInputDevice);
1185 #endif
1186 
1187 #if P_FFVDEV
1189 #endif
1190 
1191 #if P_VIDFILE
1193 #endif
1194 
1195 #ifdef P_DIRECTSHOW
1197 #endif
1198 
1199 
1201 //
1202 // declare macros and structures needed for video output plugins
1203 //
1204 
1206 {
1207  public:
1208  virtual PObject * CreateInstance(int /*userData*/) const { return new className; }
1209  virtual PStringArray GetDeviceNames(int /*userData*/) const { return className::GetOutputDeviceNames(); }
1210 };
1211 
1212 #define PCREATE_VIDOUTPUT_PLUGIN(name) \
1213  static PVideoOutputPluginServiceDescriptor<PVideoOutputDevice_##name> PVideoOutputDevice_##name##_descriptor; \
1214  PCREATE_PLUGIN(name, PVideoOutputDevice, &PVideoOutputDevice_##name##_descriptor)
1215 
1216 #if _WIN32
1218 #endif
1219 
1220 #if P_SDL
1222 #endif
1223 
1224 
1226 //
1227 // declare classes needed for access to simple video font
1228 //
1229 
1230 class PVideoFont : public PObject
1231 {
1232  PCLASSINFO(PVideoFont, PObject);
1233  public:
1234  enum {
1236  };
1237  struct LetterData {
1238  char ascii;
1239  const char *line[MAX_L_HEIGHT];
1240  };
1241 
1242  static const LetterData * GetLetterData(char ascii);
1243 };
1244 
1245 #endif // P_VIDEO
1246 
1247 #endif // PTLIB_PVIDEOIO_H
1248 
1249 // End Of File ///////////////////////////////////////////////////////////////
1250 
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:418
virtual PBoolean SetColour(unsigned newColour)
Set colour of the image.
ResizeMode resizeMode
Definition: videoio.h:269
long current
Definition: videoio.h:293
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:419
Definition: videoio.h:412
virtual Comparison Compare(const PObject &obj) const
Compare the two PVideoFrameInfo and return their relative rank.
int channelNumber
Definition: videoio.h:698
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:281
virtual PStringArray GetDeviceNames(int) const
Definition: videoio.h:1172
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:708
virtual PBoolean GetFrameSize(unsigned &width, unsigned &height) const
Get the frame size being used.
unsigned frameWidth
Definition: videoio.h:263
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:710
unsigned width
Definition: videoio.h:423
PString driverName
Definition: videoio.h:416
bool convertSize
Definition: videoio.h:425
Definition: videoio.h:72
virtual PBoolean Pan(long value, bool absolute=false)
Definition: videoio.h:76
long def
Definition: videoio.h:291
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:1230
Definition: videoio.h:74
std::list< PVideoControlInfo > m_info
Definition: videoio.h:325
Definition: videoio.h:273
Definition: pluginmgr.h:57
Definition: videoio.h:75
PINDEX bytesPerPixel
Definition: videoio.h:924
std::list< PVideoInteractionInfo > interactions
Definition: videoio.h:1047
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:289
PString preferredColourFormat
Definition: videoio.h:700
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:268
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:287
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
Comparison
Result of the comparison operation performed by the Compare() function.
Definition: object.h:1184
Register remote KeyPresses.
Definition: videoio.h:340
virtual PBoolean SetFrameSize(unsigned width, unsigned height)
Set the frame size to be used.
int frameWhiteness
Definition: videoio.h:707
static const LetterData * GetLetterData(char ascii)
virtual PObject * CreateInstance(int) const
Definition: videoio.h:1208
unsigned height
Definition: videoio.h:424
char ascii
Definition: videoio.h:1238
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:282
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:205
Definition: videoio.h:75
Definition: videoio.h:280
int frameBrightness
Definition: videoio.h:706
Definition: videoio.h:1237
std::list< PVideoFrameInfo > framesizes
Definition: videoio.h:1045
InputInteractType
Definition: videoio.h:338
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:788
Definition: videoio.h:67
const char * line[MAX_L_HEIGHT]
Definition: videoio.h:1239
virtual PBoolean Stop()=0
Stop the video device I/O capture.
int hue
Definition: videoio.h:432
InputControlType
Definition: videoio.h:279
Definition: videoio.h:1235
VideoFormat
Definition: videoio.h:395
Register remote Navigation commands.
Definition: videoio.h:342
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:1052
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:332
Definition: videoio.h:71
virtual PBoolean Close()
Close the device.
Definition: videoio.h:1085
Definition: videoio.h:1044
Definition: videoio.h:398
Register remote RTSP (Real Time Streaming Protocol) Inputs.
Definition: videoio.h:343
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:792
virtual PBoolean IsOpen()=0
Determine if the device is currently open.
PMutex ccmutex
Definition: videoio.h:326
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:426
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:1205
int contrast
Definition: videoio.h:430
unsigned frameRate
Definition: videoio.h:267
virtual PBoolean Start()=0
Start the video device I/O capture.
static PString AsString(const InputInteractType &type)
PString deviceName
Definition: videoio.h:417
Definition: videoio.h:71
This class defines a video device.
Definition: videoio.h:380
virtual int GetChannel() const
Get the video channel to be used on the device.
long flags
Definition: videoio.h:292
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:1173
virtual PBoolean SetNearestFrameSize(unsigned width, unsigned height)
Set the nearest available frame size to be used.
PString deviceName
Definition: videoio.h:695
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:925
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:1046
PPluginManager * pluginMgr
Definition: videoio.h:415
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:397
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:611
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:690
Definition: videoio.h:72
PBoolean nativeVerticalFlip
Definition: videoio.h:701
PColourConverter * converter
Definition: videoio.h:703
VideoFormat videoFormat
Definition: videoio.h:697
bool convertFormat
Definition: videoio.h:421
PBoolean GetDefaultPosition(const InputControlType ctype, long &def)
This class defines a video input device.
Definition: videoio.h:975
bool flip
Definition: videoio.h:427
Definition: videoio.h:57
~PVideoInputDevice()
Create a new video input device.
Definition: videoio.h:986
virtual PBoolean SetFrameSize(unsigned width, unsigned height)
Set the frame size to be used.
int lastError
Definition: videoio.h:696
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:685
This class defines a video output device for RGB in a frame store.
Definition: videoio.h:864
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:559
virtual PBoolean SetColourFormat(const PString &colourFormat)
Set the colour format to be used.
int colour
Definition: videoio.h:431
virtual ~PVideoOutputDevice()
Close the video output device on destruction.
Definition: videoio.h:727
virtual int GetWhiteness()
Get the whiteness of the image.
Definition: videoio.h:1168
virtual bool SetPosition(int x, int y)
Set the position of the output device, where relevant.
InputInteractType type
Definition: videoio.h:348
virtual unsigned GetFrameWidth() const
Get the width of the frame being used.
virtual PBoolean Close()
Close the device.
Definition: videoio.h:784
Definition: videoio.h:56
long step
Definition: videoio.h:290
This class defines a video output device.
Definition: videoio.h:716
virtual PBoolean SetChannel(int channelNumber)
Set the video channel to be used on the device.
unsigned rate
Definition: videoio.h:422
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:215
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:400
Definition: videoio.h:73
const PString & GetDeviceName() const
Get the device name of the open device.
Definition: videoio.h:405
unsigned sarHeight
Definition: videoio.h:266
ResizeMode GetResizeMode() const
Get the resize mode to be used.
Definition: videoio.h:211
Definition: videoio.h:66
PBYTEArray frameStore
Definition: videoio.h:704
Definition: videoio.h:399
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:429
int frameColour
Definition: videoio.h:709
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:428
virtual PINDEX GetMaxFrameBytes()
Get the maximum frame size in bytes.
Register remote Mouse Movement Clicks.
Definition: videoio.h:341
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:396
virtual PStringArray GetDeviceNames(int) const
Definition: videoio.h:1209
virtual unsigned GetSarHeight() const
Get the height of the sar being used.
virtual PObject * CreateInstance(int) const
Definition: videoio.h:1171
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:926
Ultimate parent class for all objects in the class library.
Definition: object.h:1118
std::list< PVideoControlInfo > InputDeviceControls
Definition: videoio.h:318
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:420
PMutex mutex
Definition: videoio.h:923
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:300
Definition: videoio.h:339
unsigned frameHeight
Definition: videoio.h:264
long min
Definition: videoio.h:288
virtual PBoolean Tilt(long value, bool absolute=false)
unsigned sarWidth
Definition: videoio.h:265
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.