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
18 * Classes to support streaming video input from IEEE 1394 cameras.
19 * Detailed explanation can be found at src/ptlib/unix/video4dc1394.cxx
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
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
);
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.
65 const PString
& deviceName
, /// Device name to open
66 BOOL startImmediate
= TRUE
/// Immediately start device
69 /**Determine of the device is currently open.
77 /**Start the video device I/O.
81 /**Stop the video device I/O capture.
85 /**Determine if the video device I/O capture is in progress.
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();
107 /**Grab a frame, after a delay as specified by the frame rate.
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.
126 /**Set brightness of the image. 0xffff-Very bright.
128 BOOL
SetBrightness(unsigned newBrightness
);
131 /**Get the whiteness of the image. 0xffff-Very white.
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.
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.
153 /**Set contrast of the image. 0xffff-High contrast.
155 BOOL
SetContrast(unsigned newContrast
);
158 /**Get the hue of the image. 0xffff-High hue.
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
183 int GetNumChannels();
185 int channelNumber
/// New channel number for device.
188 unsigned rate
/// Frames per second
191 VideoFormat videoFormat
/// New video format
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.
230 raw1394handle_t handle
;
233 nodeid_t
* camera_nodes
;
235 dc1394_cameracapture camera
;
236 int capturing_duration
;
237 PString desiredColourFormat
;
238 unsigned desiredFrameWidth
;
239 unsigned desiredFrameHeight
;
245 // End Of File ///////////////////////////////////////////////////////////////