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
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>
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
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>
64 #include <ptlib/videoio.h>
65 #include <ptlib/vconvert.h>
66 #include <ptlib/file.h>
68 #include <ptlib/contain.inl>
72 /** This class defines a video input device that
73 generates fictitous image data.
76 class PVideoInput1394AvcDevice
: public PVideoInputDevice
78 PCLASSINFO(PVideoInput1394AvcDevice
, PVideoInputDevice
);
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.
91 const PString
& deviceName
, /// Device name to open
92 BOOL startImmediate
= TRUE
/// Immediately start device
95 /**Determine of the device is currently open.
103 /**Start the video device I/O.
107 /**Stop the video device I/O capture.
111 /**Determine if the video device I/O capture is in progress.
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();
133 /**Grab a frame, after a delay as specified by the frame rate.
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.
152 /**Set brightness of the image. 0xffff-Very bright.
154 BOOL
SetBrightness(unsigned newBrightness
);
157 /**Get the whiteness of the image. 0xffff-Very white.
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.
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.
179 /**Set contrast of the image. 0xffff-High contrast.
181 BOOL
SetContrast(unsigned newContrast
);
184 /**Get the hue of the image. 0xffff-High hue.
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
209 int GetNumChannels();
211 int channelNumber
/// New channel number for device.
214 unsigned rate
/// Frames per second
217 VideoFormat videoFormat
/// New video format
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.
256 raw1394handle_t handle
;
259 dv_decoder_t
* dv_decoder
;
260 PString desiredColourFormat
;
262 unsigned desiredFrameWidth
;
263 unsigned desiredFrameHeight
;
269 int RawISOHandler (raw1394handle_t handle
, int channel
, size_t length
, u_int32_t
* data
);
274 // End Of File ///////////////////////////////////////////////////////////////