Added PSharedptr class
[pwlib.git] / plugins / vidinput_v4l2 / vidinput_v4l2.h
blob8a13034352d93477c7e2368118cbe3772237aefa
1 #ifndef _PVIDEOIOV4L2
2 #define _PVIDEOIOV4L2
5 #include <sys/mman.h>
6 #include <sys/time.h>
8 #include <ptlib.h>
9 #include <ptlib/videoio.h>
10 #include <ptlib/vconvert.h>
12 #include <linux/videodev.h>
15 class PVideoInputV4l2Device: public PVideoInputDevice
18 PCLASSINFO(PVideoInputV4l2Device, PVideoInputDevice);
21 public:
22 PVideoInputV4l2Device();
23 ~PVideoInputV4l2Device();
25 void ReadDeviceDirectory (PDirectory, POrdinalToString &);
27 static PStringList GetInputDeviceNames();
29 PStringList GetDeviceNames() const
30 { return GetInputDeviceNames(); }
32 BOOL Open(const PString &deviceName, BOOL startImmediate);
34 BOOL IsOpen();
36 BOOL Close();
38 BOOL Start();
39 BOOL Stop();
41 BOOL IsCapturing();
43 PINDEX GetMaxFrameBytes();
45 BOOL GetFrame(PBYTEArray & frame);
46 BOOL GetFrameData(BYTE*, PINDEX*);
47 BOOL GetFrameDataNoDelay(BYTE*, PINDEX*);
49 BOOL GetFrameSizeLimits(unsigned int&, unsigned int&,
50 unsigned int&, unsigned int&);
52 BOOL TestAllFormats();
54 BOOL SetFrameSize(unsigned int, unsigned int);
55 BOOL SetFrameRate(unsigned int);
56 BOOL VerifyHardwareFrameSize(unsigned int, unsigned int);
58 BOOL GetParameters(int*, int*, int*, int*, int*);
60 BOOL SetColourFormat(const PString&);
62 int GetContrast();
63 BOOL SetContrast(unsigned int);
64 int GetBrightness();
65 BOOL SetBrightness(unsigned int);
66 int GetWhiteness();
67 BOOL SetWhiteness(unsigned int);
68 int GetColour();
69 BOOL SetColour(unsigned int);
70 int GetHue();
71 BOOL SetHue(unsigned int);
73 BOOL SetVideoChannelFormat(int, PVideoDevice::VideoFormat);
74 BOOL SetVideoFormat(PVideoDevice::VideoFormat);
75 int GetNumChannels();
76 BOOL SetChannel(int);
78 BOOL NormalReadProcess(BYTE*, PINDEX*);
80 void ClearMapping();
82 BOOL SetMapping();
84 struct v4l2_capability videoCapability;
85 struct v4l2_streamparm videoStreamParm;
86 BOOL canRead;
87 BOOL canStream;
88 BOOL canSelect;
89 BOOL canSetFrameRate;
90 BOOL isMapped;
91 #define NUM_VIDBUF 4
92 BYTE * videoBuffer[NUM_VIDBUF];
93 uint videoBufferCount;
95 int videoFd;
96 int frameBytes;
97 BOOL started;
100 #endif