"Fossies" - the Fresh Open Source Software Archive

Member "motion-Release-4.3.0/src/pwc-ioctl.h" (14 Jan 2020, 11471 Bytes) of package /linux/misc/motion-Release-4.3.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "pwc-ioctl.h" see the Fossies "Dox" file reference documentation.

    1 #ifndef PWC_IOCTL_H
    2 #define PWC_IOCTL_H
    3 
    4 /* (C) 2001-2004 Nemosoft Unv.
    5    (C) 2004-2006 Luc Saillard (luc@saillard.org)
    6 
    7    NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx
    8    driver and thus may have bugs that are not present in the original version.
    9    Please send bug reports and support requests to <luc@saillard.org>.
   10    The decompression routines have been implemented by reverse-engineering the
   11    Nemosoft binary pwcx module. Caveat emptor.
   12 
   13    This program is free software; you can redistribute it and/or modify
   14    it under the terms of the GNU General Public License as published by
   15    the Free Software Foundation; either version 2 of the License, or
   16    (at your option) any later version.
   17 
   18    This program is distributed in the hope that it will be useful,
   19    but WITHOUT ANY WARRANTY; without even the implied warranty of
   20    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   21    GNU General Public License for more details.
   22 
   23    You should have received a copy of the GNU General Public License
   24    along with this program; if not, write to the Free Software
   25    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   26 */
   27 
   28 /* This is pwc-ioctl.h belonging to PWC 10.0.10
   29    It contains structures and defines to communicate from user space
   30    directly to the driver.
   31  */
   32 
   33 /*
   34    Changes
   35    2001/08/03  Alvarado   Added ioctl constants to access methods for
   36                           changing white balance and red/blue gains
   37    2002/12/15  G. H. Fernandez-Toribio   VIDIOCGREALSIZE
   38    2003/12/13  Nemosft Unv. Some modifications to make interfacing to
   39                PWCX easier
   40    2006/01/01  Luc Saillard Add raw format definition
   41  */
   42 
   43 /* These are private ioctl() commands, specific for the Philips webcams.
   44    They contain functions not found in other webcams, and settings not
   45    specified in the Video4Linux API.
   46 
   47    The #define names are built up like follows:
   48    VIDIOC        VIDeo IOCtl prefix
   49          PWC        Philps WebCam
   50             G           optional: Get
   51             S           optional: Set
   52              ...     the function
   53  */
   54 
   55 #if defined(__linux__)
   56 #include <linux/types.h>
   57 #include <linux/version.h>
   58 #endif
   59 
   60  /* Enumeration of image sizes */
   61 #define PSZ_SQCIF   0x00
   62 #define PSZ_QSIF    0x01
   63 #define PSZ_QCIF    0x02
   64 #define PSZ_SIF     0x03
   65 #define PSZ_CIF     0x04
   66 #define PSZ_VGA     0x05
   67 #define PSZ_MAX     6
   68 
   69 
   70 /* The frame rate is encoded in the video_window.flags parameter using
   71    the upper 16 bits, since some flags are defined nowadays. The following
   72    defines provide a mask and shift to filter out this value.
   73    This value can also be passing using the private flag when using v4l2 and
   74    VIDIOC_S_FMT ioctl.
   75 
   76    In 'Snapshot' mode the camera freezes its automatic exposure and colour
   77    balance controls.
   78  */
   79 #define PWC_FPS_SHIFT       16
   80 #define PWC_FPS_MASK        0x00FF0000
   81 #define PWC_FPS_FRMASK      0x003F0000
   82 #define PWC_FPS_SNAPSHOT    0x00400000
   83 #define PWC_QLT_MASK        0x03000000
   84 #define PWC_QLT_SHIFT       24
   85 
   86 
   87 /* structure for transferring x & y coordinates */
   88 struct pwc_coord
   89 {
   90     int x, y;        /* guess what */
   91     int size;        /* size, or offset */
   92 };
   93 
   94 
   95 /* Used with VIDIOCPWCPROBE */
   96 struct pwc_probe
   97 {
   98     char name[32];
   99     int type;
  100 };
  101 
  102 struct pwc_serial
  103 {
  104     char serial[30];    /* String with serial number. Contains terminating 0 */
  105 };
  106 
  107 /* pwc_whitebalance.mode values */
  108 #define PWC_WB_INDOOR        0
  109 #define PWC_WB_OUTDOOR       1
  110 #define PWC_WB_FL            2
  111 #define PWC_WB_MANUAL        3
  112 #define PWC_WB_AUTO          4
  113 
  114 /* Used with VIDIOCPWC[SG]AWB (Auto White Balance).
  115    Set mode to one of the PWC_WB_* values above.
  116    *red and *blue are the respective gains of these colour components inside
  117    the camera; range 0..65535
  118    When 'mode' == PWC_WB_MANUAL, 'manual_red' and 'manual_blue' are set or read;
  119    otherwise undefined.
  120    'read_red' and 'read_blue' are read-only.
  121 */
  122 struct pwc_whitebalance
  123 {
  124     int mode;
  125     int manual_red, manual_blue;  /* R/W */
  126     int read_red, read_blue;      /* R/O */
  127 };
  128 
  129 /*
  130    'control_speed' and 'control_delay' are used in automatic whitebalance mode,
  131    and tell the camera how fast it should react to changes in lighting, and
  132    with how much delay. Valid values are 0..65535.
  133 */
  134 struct pwc_wb_speed
  135 {
  136     int control_speed;
  137     int control_delay;
  138 
  139 };
  140 
  141 /* Used with VIDIOCPWC[SG]LED */
  142 struct pwc_leds
  143 {
  144     int led_on;             /* Led on-time; range = 0..25000 */
  145     int led_off;            /* Led off-time; range = 0..25000  */
  146 };
  147 
  148 /* Image size (used with GREALSIZE) */
  149 struct pwc_imagesize
  150 {
  151     int width;
  152     int height;
  153 };
  154 
  155 /* Defines and structures for Motorized Pan & Tilt */
  156 #define PWC_MPT_PAN        0x01
  157 #define PWC_MPT_TILT       0x02
  158 #define PWC_MPT_TIMEOUT    0x04 /* for status */
  159 
  160 /* Set angles; when absolute != 0, the angle is absolute and the
  161    driver calculates the relative offset for you. This can only
  162    be used with VIDIOCPWCSANGLE; VIDIOCPWCGANGLE always returns
  163    absolute angles.
  164  */
  165 struct pwc_mpt_angles
  166 {
  167     int absolute;   /* write-only */
  168     int pan;        /* degrees * 100 */
  169     int tilt;       /* degress * 100 */
  170 };
  171 
  172 /* Range of angles of the camera, both horizontally and vertically.
  173  */
  174 struct pwc_mpt_range
  175 {
  176     int pan_min, pan_max;        /* degrees * 100 */
  177     int tilt_min, tilt_max;
  178 };
  179 
  180 struct pwc_mpt_status
  181 {
  182     int status;
  183     int time_pan;
  184     int time_tilt;
  185 };
  186 
  187 
  188 /* This is used for out-of-kernel decompression. With it, you can get
  189    all the necessary information to initialize and use the decompressor
  190    routines in standalone applications.
  191  */
  192 struct pwc_video_command
  193 {
  194     int type;                       /* camera type (645, 675, 730, etc.) */
  195     int release;                    /* release number */
  196 
  197     int size;                       /* one of PSZ_* */
  198     int alternate;
  199     int command_len;                /* length of USB video command */
  200     unsigned char command_buf[13];  /* Actual USB video command */
  201     int bandlength;                 /* >0 = compressed */
  202     int frame_size;                 /* Size of one (un)compressed frame */
  203 };
  204 
  205 /* Flags for PWCX subroutines. Not all modules honour all flags. */
  206 #define PWCX_FLAG_PLANAR    0x0001
  207 #define PWCX_FLAG_BAYER     0x0008
  208 
  209 
  210 /* IOCTL definitions */
  211 
  212  /* Restore user settings */
  213 #define VIDIOCPWCRUSER        _IO('v', 192)
  214  /* Save user settings */
  215 #define VIDIOCPWCSUSER        _IO('v', 193)
  216  /* Restore factory settings */
  217 #define VIDIOCPWCFACTORY      _IO('v', 194)
  218 
  219  /* You can manipulate the compression factor. A compression preference of 0
  220     means use uncompressed modes when available; 1 is low compression, 2 is
  221     medium and 3 is high compression preferred. Of course, the higher the
  222     compression, the lower the bandwidth used but more chance of artefacts
  223     in the image. The driver automatically chooses a higher compression when
  224     the preferred mode is not available.
  225   */
  226  /* Set preferred compression quality (0 = uncompressed, 3 = highest compression) */
  227 #define VIDIOCPWCSCQUAL       _IOW('v', 195, int)
  228  /* Get preferred compression quality */
  229 #define VIDIOCPWCGCQUAL       _IOR('v', 195, int)
  230 
  231 
  232 /* Retrieve serial number of camera */
  233 #define VIDIOCPWCGSERIAL      _IOR('v', 198, struct pwc_serial)
  234 
  235  /* This is a probe function; since so many devices are supported, it
  236     becomes difficult to include all the names in programs that want to
  237     check for the enhanced Philips stuff. So in stead, try this PROBE;
  238     it returns a structure with the original name, and the corresponding
  239     Philips type.
  240     To use, fill the structure with zeroes, call PROBE and if that succeeds,
  241     compare the name with that returned from VIDIOCGCAP; they should be the
  242     same. If so, you can be assured it is a Philips (OEM) cam and the type
  243     is valid.
  244  */
  245 #define VIDIOCPWCPROBE        _IOR('v', 199, struct pwc_probe)
  246 
  247  /* Set AGC (Automatic Gain Control); int < 0 = auto, 0..65535 = fixed */
  248 #define VIDIOCPWCSAGC         _IOW('v', 200, int)
  249  /* Get AGC; int < 0 = auto; >= 0 = fixed, range 0..65535 */
  250 #define VIDIOCPWCGAGC         _IOR('v', 200, int)
  251  /* Set shutter speed; int < 0 = auto; >= 0 = fixed, range 0..65535 */
  252 #define VIDIOCPWCSSHUTTER     _IOW('v', 201, int)
  253 
  254  /* Color compensation (Auto White Balance) */
  255 #define VIDIOCPWCSAWB         _IOW('v', 202, struct pwc_whitebalance)
  256 #define VIDIOCPWCGAWB         _IOR('v', 202, struct pwc_whitebalance)
  257 
  258  /* Auto WB speed */
  259 #define VIDIOCPWCSAWBSPEED    _IOW('v', 203, struct pwc_wb_speed)
  260 #define VIDIOCPWCGAWBSPEED    _IOR('v', 203, struct pwc_wb_speed)
  261 
  262  /* LEDs on/off/blink; int range 0..65535 */
  263 #define VIDIOCPWCSLED         _IOW('v', 205, struct pwc_leds)
  264 #define VIDIOCPWCGLED         _IOR('v', 205, struct pwc_leds)
  265 
  266   /* Contour (sharpness); int < 0 = auto, 0..65536 = fixed */
  267 #define VIDIOCPWCSCONTOUR     _IOW('v', 206, int)
  268 #define VIDIOCPWCGCONTOUR     _IOR('v', 206, int)
  269 
  270   /* Backlight compensation; 0 = off, otherwise on */
  271 #define VIDIOCPWCSBACKLIGHT   _IOW('v', 207, int)
  272 #define VIDIOCPWCGBACKLIGHT   _IOR('v', 207, int)
  273 
  274   /* Flickerless mode; = 0 off, otherwise on */
  275 #define VIDIOCPWCSFLICKER     _IOW('v', 208, int)
  276 #define VIDIOCPWCGFLICKER     _IOR('v', 208, int)
  277 
  278   /* Dynamic noise reduction; 0 off, 3 = high noise reduction */
  279 #define VIDIOCPWCSDYNNOISE    _IOW('v', 209, int)
  280 #define VIDIOCPWCGDYNNOISE    _IOR('v', 209, int)
  281 
  282  /* Real image size as used by the camera; tells you whether or not there's a gray border around the image */
  283 #define VIDIOCPWCGREALSIZE    _IOR('v', 210, struct pwc_imagesize)
  284 
  285  /* Motorized pan & tilt functions */
  286 #define VIDIOCPWCMPTRESET     _IOW('v', 211, int)
  287 #define VIDIOCPWCMPTGRANGE    _IOR('v', 211, struct pwc_mpt_range)
  288 #define VIDIOCPWCMPTSANGLE    _IOW('v', 212, struct pwc_mpt_angles)
  289 #define VIDIOCPWCMPTGANGLE    _IOR('v', 212, struct pwc_mpt_angles)
  290 #define VIDIOCPWCMPTSTATUS    _IOR('v', 213, struct pwc_mpt_status)
  291 
  292  /* Get the USB set-video command; needed for initializing libpwcx */
  293 #define VIDIOCPWCGVIDCMD      _IOR('v', 215, struct pwc_video_command)
  294 struct pwc_table_init_buffer {
  295    int len;
  296    char *buffer;
  297 };
  298 #define VIDIOCPWCGVIDTABLE    _IOR('v', 216, struct pwc_table_init_buffer)
  299 
  300 /*
  301  * This is private command used when communicating with v4l2.
  302  * In the future all private ioctl will be remove/replace to
  303  * use interface offer by v4l2.
  304  */
  305 
  306 #if (defined(HAVE_V4L2)) && defined(__linux__)
  307 
  308 #define V4L2_CID_PRIVATE_SAVE_USER       (V4L2_CID_PRIVATE_BASE + 0)
  309 #define V4L2_CID_PRIVATE_RESTORE_USER    (V4L2_CID_PRIVATE_BASE + 1)
  310 #define V4L2_CID_PRIVATE_RESTORE_FACTORY (V4L2_CID_PRIVATE_BASE + 2)
  311 #define V4L2_CID_PRIVATE_COLOUR_MODE     (V4L2_CID_PRIVATE_BASE + 3)
  312 #define V4L2_CID_PRIVATE_AUTOCONTOUR     (V4L2_CID_PRIVATE_BASE + 4)
  313 #define V4L2_CID_PRIVATE_CONTOUR         (V4L2_CID_PRIVATE_BASE + 5)
  314 #define V4L2_CID_PRIVATE_BACKLIGHT       (V4L2_CID_PRIVATE_BASE + 6)
  315 #define V4L2_CID_PRIVATE_FLICKERLESS     (V4L2_CID_PRIVATE_BASE + 7)
  316 #define V4L2_CID_PRIVATE_NOISE_REDUCTION (V4L2_CID_PRIVATE_BASE + 8)
  317 
  318 struct pwc_raw_frame {
  319    __le16 type;           /* type of the webcam */
  320    __le16 vbandlength;    /* Size of 4lines compressed (used by the decompressor) */
  321    __u8   cmd[4];         /* the four byte of the command (in case of nala,
  322                              only the first 3 bytes is filled) */
  323    __u8   rawframe[0];    /* frame_size = H/4*vbandlength */
  324 } __attribute__ ((packed));
  325 
  326 #endif /*  HAVE_V4L2 && __linux__ */
  327 
  328 #endif