Removed warnings under Windows
[pwlib.git] / plugins / vidinput_dc / videoio1394dc.h
blobabd2b9a87a77b36a1d29696742093e1389e9488f
1 /*
2 * videoio1394dc.h
4 * Copyright:
5 * Copyright (c) 2002 Ryutaroh Matsumoto <ryutaroh@rmatsumoto.org>
7 * The contents of this file are subject to the Mozilla Public License
8 * Version 1.0 (the "License"); you may not use this file except in
9 * compliance with the License. You may obtain a copy of the License at
10 * http://www.mozilla.org/MPL/
12 * Software distributed under the License is distributed on an "AS IS"
13 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 * the License for the specific language governing rights and limitations
15 * under the License.
18 * Classes to support streaming video input from IEEE 1394 cameras.
19 * Detailed explanation can be found at src/ptlib/unix/video4dc1394.cxx
21 * $Log$
22 * Revision 1.1 2003/12/17 15:40:56 dominance
23 * Added DC Plugin as provided by Julien Puydt <julien.puydt@laposte.net>. Needs manual patching of plugins/configure for now though. (i.e. disabled by default, run autoconf in plugins/)
25 * Revision 1.2 2002/05/30 22:49:35 dereks
26 * correct implementation of GetInputDeviceNames().
28 * Revision 1.1 2002/02/20 02:37:26 dereks
29 * Initial release of Firewire camera support for linux.
30 * Many thanks to Ryutaroh Matsumoto <ryutaroh@rmatsumoto.org>.
36 #ifndef _PVIDEOIO1394DC
38 #define _PVIDEOIO1394DC
40 #ifdef __GNUC__
41 #pragma interface
42 #endif
44 #include <libraw1394/raw1394.h>
45 #include <libdc1394/dc1394_control.h>
47 /** This class defines a video input device that
48 generates fictitous image data.
50 class PVideoInput1394DcDevice : public PVideoInputDevice
52 PCLASSINFO(PVideoInput1394DcDevice, PVideoInputDevice);
53 public:
54 /** Create a new video input device.
56 PVideoInput1394DcDevice();
58 /**Close the video input device on destruction.
60 ~PVideoInput1394DcDevice();
62 /**Open the device given the device name.
64 BOOL Open(
65 const PString & deviceName, /// Device name to open
66 BOOL startImmediate = TRUE /// Immediately start device
69 /**Determine of the device is currently open.
71 BOOL IsOpen();
73 /**Close the device.
75 BOOL Close();
77 /**Start the video device I/O.
79 BOOL Start();
81 /**Stop the video device I/O capture.
83 BOOL Stop();
85 /**Determine if the video device I/O capture is in progress.
87 BOOL IsCapturing();
89 /**Get a list of all of the drivers available.
91 static PStringList GetInputDeviceNames();
93 PStringList GetDeviceNames() const
94 { return GetInputDeviceNames(); }
96 /**Get the maximum frame size in bytes.
98 Note a particular device may be able to provide variable length
99 frames (eg motion JPEG) so will be the maximum size of all frames.
101 PINDEX GetMaxFrameBytes();
103 BOOL GetFrame(
104 PBYTEArray & frame
107 /**Grab a frame, after a delay as specified by the frame rate.
109 BOOL GetFrameData(
110 BYTE * buffer, /// Buffer to receive frame
111 PINDEX * bytesReturned = NULL /// OPtional bytes returned.
114 /**Grab a frame. Do not delay according to the current frame rate parameter.
116 BOOL GetFrameDataNoDelay(
117 BYTE * buffer, /// Buffer to receive frame
118 PINDEX * bytesReturned = NULL /// OPtional bytes returned.
122 /**Get the brightness of the image. 0xffff-Very bright.
124 int GetBrightness();
126 /**Set brightness of the image. 0xffff-Very bright.
128 BOOL SetBrightness(unsigned newBrightness);
131 /**Get the whiteness of the image. 0xffff-Very white.
133 int GetWhiteness();
135 /**Set whiteness of the image. 0xffff-Very white.
137 BOOL SetWhiteness(unsigned newWhiteness);
140 /**Get the colour of the image. 0xffff-lots of colour.
142 int GetColour();
144 /**Set colour of the image. 0xffff-lots of colour.
146 BOOL SetColour(unsigned newColour);
149 /**Get the contrast of the image. 0xffff-High contrast.
151 int GetContrast();
153 /**Set contrast of the image. 0xffff-High contrast.
155 BOOL SetContrast(unsigned newContrast);
158 /**Get the hue of the image. 0xffff-High hue.
160 int GetHue();
162 /**Set hue of the image. 0xffff-High hue.
164 BOOL SetHue(unsigned newHue);
167 /**Return whiteness, brightness, colour, contrast and hue in one call.
169 BOOL GetParameters (int *whiteness, int *brightness,
170 int *colour, int *contrast, int *hue);
172 /**Get the minimum & maximum size of a frame on the device.
174 BOOL GetFrameSizeLimits(
175 unsigned & minWidth, /// Variable to receive minimum width
176 unsigned & minHeight, /// Variable to receive minimum height
177 unsigned & maxWidth, /// Variable to receive maximum width
178 unsigned & maxHeight /// Variable to receive maximum height
181 void ClearMapping();
183 int GetNumChannels();
184 BOOL SetChannel(
185 int channelNumber /// New channel number for device.
187 BOOL SetFrameRate(
188 unsigned rate /// Frames per second
190 BOOL SetVideoFormat(
191 VideoFormat videoFormat /// New video format
193 BOOL SetFrameSize(
194 unsigned width, /// New width of frame
195 unsigned height /// New height of frame
197 BOOL SetColourFormat(
198 const PString & colourFormat // New colour format for device.
202 /**Try all known video formats & see which ones are accepted by the video driver
204 BOOL TestAllFormats();
206 /**Set the frame size to be used, trying converters if available.
208 If the device does not support the size, a set of alternate resolutions
209 are attempted. A converter is setup if possible.
211 BOOL SetFrameSizeConverter(
212 unsigned width, /// New width of frame
213 unsigned height, /// New height of frame
214 BOOL bScaleNotCrop /// Scale or crop/pad preference
217 /**Set the colour format to be used, trying converters if available.
219 This function will set the colour format on the device to one that
220 is compatible with a registered converter, and install that converter
221 so that the correct format is used.
223 BOOL SetColourFormatConverter(
224 const PString & colourFormat // New colour format for device.
228 protected:
229 PINDEX frameBytes;
230 raw1394handle_t handle;
231 BOOL is_capturing;
232 BOOL UseDMA;
233 nodeid_t * camera_nodes;
234 int numCameras;
235 dc1394_cameracapture camera;
236 int capturing_duration;
237 PString desiredColourFormat;
238 unsigned desiredFrameWidth;
239 unsigned desiredFrameHeight;
242 #endif
245 // End Of File ///////////////////////////////////////////////////////////////