Added ignore file
[pwlib.git] / plugins / vidinput_avc / vidinput_avc.h
blobd90637da6bbcb85959f222e1ded15fe907171dd5
1 /*
2 * videoio1394avc.h
4 * This file is a based on videoio1394dc.h
6 * Portable Windows Library
8 * Copyright (c) 2003 Equivalence Pty. Ltd.
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/
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.
20 * The Original Code is Portable Windows Library.
22 * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
24 * Contributor(s): Georgi Georgiev <chutz@gg3.net>
26 * $Log$
27 * Revision 1.5 2003/12/14 13:30:10 csoutheren
28 * Added new function required for recent video changes
30 * Revision 1.4 2003/11/25 10:49:31 dsandras
31 * Removed double declaration.
33 * Revision 1.3 2003/11/24 08:25:27 csoutheren
34 * Patches from Snark to fix compile problems
36 * Revision 1.2 2003/11/23 22:11:04 dsandras
37 * Added missing variable in the .h.
39 * Revision 1.1 2003/11/14 06:16:13 csoutheren
40 * Initial version thanks to Damien and Snark
42 * Revision 1.1 2003/01/11 05:30:13 robertj
43 * Added support for IEEE 1394 AV/C cameras, thanks Georgi Georgiev
48 #ifndef _PVIDEOIO1394AVC
50 #define _PVIDEOIO1394AVC
52 #ifdef __GNUC__
53 #pragma interface
54 #endif
56 #include <sys/utsname.h>
57 #include <libraw1394/raw1394.h>
58 #include <libavc1394/avc1394.h>
59 #include <libavc1394/rom1394.h>
60 #include <libraw1394/csr.h>
61 #include <libdv/dv.h>
63 #include <ptlib.h>
64 #include <ptlib/videoio.h>
65 #include <ptlib/vconvert.h>
66 #include <ptlib/file.h>
67 #if !P_USE_INLINES
68 #include <ptlib/contain.inl>
69 #endif
72 /** This class defines a video input device that
73 generates fictitous image data.
76 class PVideoInput1394AvcDevice : public PVideoInputDevice
78 PCLASSINFO(PVideoInput1394AvcDevice, PVideoInputDevice);
79 public:
80 /** Create a new video input device.
82 PVideoInput1394AvcDevice();
84 /**Close the video input device on destruction.
86 ~PVideoInput1394AvcDevice();
88 /**Open the device given the device name.
90 BOOL Open(
91 const PString & deviceName, /// Device name to open
92 BOOL startImmediate = TRUE /// Immediately start device
95 /**Determine of the device is currently open.
97 BOOL IsOpen();
99 /**Close the device.
101 BOOL Close();
103 /**Start the video device I/O.
105 BOOL Start();
107 /**Stop the video device I/O capture.
109 BOOL Stop();
111 /**Determine if the video device I/O capture is in progress.
113 BOOL IsCapturing();
115 /**Get a list of all of the drivers available.
117 static PStringList GetInputDeviceNames();
119 PStringList GetDeviceNames() const
120 { return GetInputDeviceNames(); }
122 /**Get the maximum frame size in bytes.
124 Note a particular device may be able to provide variable length
125 frames (eg motion JPEG) so will be the maximum size of all frames.
127 PINDEX GetMaxFrameBytes();
129 BOOL GetFrame(
130 PBYTEArray & frame
133 /**Grab a frame, after a delay as specified by the frame rate.
135 BOOL GetFrameData(
136 BYTE * buffer, /// Buffer to receive frame
137 PINDEX * bytesReturned = NULL /// OPtional bytes returned.
140 /**Grab a frame. Do not delay according to the current frame rate parameter.
142 BOOL GetFrameDataNoDelay(
143 BYTE * buffer, /// Buffer to receive frame
144 PINDEX * bytesReturned = NULL /// OPtional bytes returned.
148 /**Get the brightness of the image. 0xffff-Very bright.
150 int GetBrightness();
152 /**Set brightness of the image. 0xffff-Very bright.
154 BOOL SetBrightness(unsigned newBrightness);
157 /**Get the whiteness of the image. 0xffff-Very white.
159 int GetWhiteness();
161 /**Set whiteness of the image. 0xffff-Very white.
163 BOOL SetWhiteness(unsigned newWhiteness);
166 /**Get the colour of the image. 0xffff-lots of colour.
168 int GetColour();
170 /**Set colour of the image. 0xffff-lots of colour.
172 BOOL SetColour(unsigned newColour);
175 /**Get the contrast of the image. 0xffff-High contrast.
177 int GetContrast();
179 /**Set contrast of the image. 0xffff-High contrast.
181 BOOL SetContrast(unsigned newContrast);
184 /**Get the hue of the image. 0xffff-High hue.
186 int GetHue();
188 /**Set hue of the image. 0xffff-High hue.
190 BOOL SetHue(unsigned newHue);
193 /**Return whiteness, brightness, colour, contrast and hue in one call.
195 BOOL GetParameters (int *whiteness, int *brightness,
196 int *colour, int *contrast, int *hue);
198 /**Get the minimum & maximum size of a frame on the device.
200 BOOL GetFrameSizeLimits(
201 unsigned & minWidth, /// Variable to receive minimum width
202 unsigned & minHeight, /// Variable to receive minimum height
203 unsigned & maxWidth, /// Variable to receive maximum width
204 unsigned & maxHeight /// Variable to receive maximum height
207 void ClearMapping();
209 int GetNumChannels();
210 BOOL SetChannel(
211 int channelNumber /// New channel number for device.
213 BOOL SetFrameRate(
214 unsigned rate /// Frames per second
216 BOOL SetVideoFormat(
217 VideoFormat videoFormat /// New video format
219 BOOL SetFrameSize(
220 unsigned width, /// New width of frame
221 unsigned height /// New height of frame
223 BOOL SetColourFormat(
224 const PString & colourFormat // New colour format for device.
228 /**Try all known video formats & see which ones are accepted by the video driver
230 BOOL TestAllFormats();
232 /**Set the frame size to be used, trying converters if available.
234 If the device does not support the size, a set of alternate resolutions
235 are attempted. A converter is setup if possible.
237 BOOL SetFrameSizeConverter(
238 unsigned width, /// New width of frame
239 unsigned height, /// New height of frame
240 BOOL bScaleNotCrop /// Scale or crop/pad preference
243 /**Set the colour format to be used, trying converters if available.
245 This function will set the colour format on the device to one that
246 is compatible with a registered converter, and install that converter
247 so that the correct format is used.
249 BOOL SetColourFormatConverter(
250 const PString & colourFormat // New colour format for device.
254 protected:
256 raw1394handle_t handle;
257 BOOL is_capturing;
258 BOOL UseDMA;
259 dv_decoder_t * dv_decoder;
260 PString desiredColourFormat;
261 PINDEX frameBytes;
262 unsigned desiredFrameWidth;
263 unsigned desiredFrameHeight;
264 int port;
266 BOOL SetupHandle();
269 int RawISOHandler (raw1394handle_t handle, int channel, size_t length, u_int32_t * data);
271 #endif
274 // End Of File ///////////////////////////////////////////////////////////////