uvc_compat.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002 # Linux-UVC streaming input-plugin for MJPG-streamer                           #
00003 #                                                                              #
00004 # This package work with the Logitech UVC based webcams with the mjpeg feature #
00005 #                                                                              #
00006 # Copyright (C) 2005 2006 Laurent Pinchart &&  Michel Xhaard                   #
00007 #                    2007 Lucas van Staden                                     #
00008 #                    2007 Tom Stöveken                                         #
00009 #                                                                              #
00010 # This program is free software; you can redistribute it and/or modify         #
00011 # it under the terms of the GNU General Public License as published by         #
00012 # the Free Software Foundation; either version 2 of the License, or            #
00013 # (at your option) any later version.                                          #
00014 #                                                                              #
00015 # This program is distributed in the hope that it will be useful,              #
00016 # but WITHOUT ANY WARRANTY; without even the implied warranty of               #
00017 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                #
00018 # GNU General Public License for more details.                                 #
00019 #                                                                              #
00020 # You should have received a copy of the GNU General Public License            #
00021 # along with this program; if not, write to the Free Software                  #
00022 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA    #
00023 #                                                                              #
00024 *******************************************************************************/
00025 
00026 #ifndef _UVC_COMPAT_H
00027 #define _UVC_COMPAT_H
00028 
00029 #include <linux/version.h>
00030 #ifndef __KERNEL__
00031 #ifndef __user
00032 #define __user
00033 #endif
00034 #endif
00035 
00036 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
00037 /*
00038  * Extended control API
00039  */
00040 struct v4l2_ext_control
00041 {
00042         __u32 id;
00043         __u32 reserved2[2];
00044         union {
00045                 __s32 value;
00046                 __s64 value64;
00047                 void *reserved;
00048         };
00049 } __attribute__ ((packed));
00050 
00051 struct v4l2_ext_controls
00052 {
00053         __u32 ctrl_class;
00054         __u32 count;
00055         __u32 error_idx;
00056         __u32 reserved[2];
00057         struct v4l2_ext_control *controls;
00058 };
00059 
00060 /* Values for ctrl_class field */
00061 #define V4L2_CTRL_CLASS_USER            0x00980000      /* Old-style 'user' controls */
00062 #define V4L2_CTRL_CLASS_MPEG            0x00990000      /* MPEG-compression controls */
00063 
00064 #define V4L2_CTRL_ID_MASK               (0x0fffffff)
00065 #define V4L2_CTRL_ID2CLASS(id)          ((id) & 0x0fff0000UL)
00066 #define V4L2_CTRL_DRIVER_PRIV(id)       (((id) & 0xffff) >= 0x1000)
00067 /* Control flags */
00068 #define V4L2_CTRL_FLAG_READ_ONLY        0x0004
00069 #define V4L2_CTRL_FLAG_UPDATE           0x0008
00070 #define V4L2_CTRL_FLAG_INACTIVE         0x0010
00071 #define V4L2_CTRL_FLAG_SLIDER           0x0020
00072 
00073 /* Query flags, to be ORed with the control ID */
00074 #define V4L2_CTRL_FLAG_NEXT_CTRL        0x80000000
00075 
00076 /* User-class control IDs defined by V4L2 */
00077 #undef  V4L2_CID_BASE
00078 #define V4L2_CID_BASE                   (V4L2_CTRL_CLASS_USER | 0x900)
00079 #define V4L2_CID_USER_BASE              V4L2_CID_BASE
00080 #define V4L2_CID_USER_CLASS             (V4L2_CTRL_CLASS_USER | 1)
00081         
00082 #define VIDIOC_G_EXT_CTRLS              _IOWR ('V', 71, struct v4l2_ext_controls)
00083 #define VIDIOC_S_EXT_CTRLS              _IOWR ('V', 72, struct v4l2_ext_controls)
00084 #define VIDIOC_TRY_EXT_CTRLS            _IOWR ('V', 73, struct v4l2_ext_controls)
00085 
00086 #endif
00087 
00088 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
00089 /*
00090  * Frame size and frame rate enumeration
00091  *
00092  * Included in Linux 2.6.19
00093  */
00094 enum v4l2_frmsizetypes
00095 {
00096         V4L2_FRMSIZE_TYPE_DISCRETE      = 1,
00097         V4L2_FRMSIZE_TYPE_CONTINUOUS    = 2,
00098         V4L2_FRMSIZE_TYPE_STEPWISE      = 3
00099 };
00100 
00101 struct v4l2_frmsize_discrete
00102 {
00103         __u32                   width;          /* Frame width [pixel] */
00104         __u32                   height;         /* Frame height [pixel] */
00105 };
00106 
00107 struct v4l2_frmsize_stepwise
00108 {
00109         __u32                   min_width;      /* Minimum frame width [pixel] */
00110         __u32                   max_width;      /* Maximum frame width [pixel] */
00111         __u32                   step_width;     /* Frame width step size [pixel] */
00112         __u32                   min_height;     /* Minimum frame height [pixel] */
00113         __u32                   max_height;     /* Maximum frame height [pixel] */
00114         __u32                   step_height;    /* Frame height step size [pixel] */
00115 };
00116 
00117 struct v4l2_frmsizeenum
00118 {
00119         __u32                   index;          /* Frame size number */
00120         __u32                   pixel_format;   /* Pixel format */
00121         __u32                   type;           /* Frame size type the device supports. */
00122 
00123         union {                                 /* Frame size */
00124                 struct v4l2_frmsize_discrete    discrete;
00125                 struct v4l2_frmsize_stepwise    stepwise;
00126         };
00127 
00128         __u32   reserved[2];                    /* Reserved space for future use */
00129 };
00130 
00131 enum v4l2_frmivaltypes
00132 {
00133         V4L2_FRMIVAL_TYPE_DISCRETE      = 1,
00134         V4L2_FRMIVAL_TYPE_CONTINUOUS    = 2,
00135         V4L2_FRMIVAL_TYPE_STEPWISE      = 3
00136 };
00137 
00138 struct v4l2_frmival_stepwise
00139 {
00140         struct v4l2_fract       min;            /* Minimum frame interval [s] */
00141         struct v4l2_fract       max;            /* Maximum frame interval [s] */
00142         struct v4l2_fract       step;           /* Frame interval step size [s] */
00143 };
00144 
00145 struct v4l2_frmivalenum
00146 {
00147         __u32                   index;          /* Frame format index */
00148         __u32                   pixel_format;   /* Pixel format */
00149         __u32                   width;          /* Frame width */
00150         __u32                   height;         /* Frame height */
00151         __u32                   type;           /* Frame interval type the device supports. */
00152 
00153         union {                                 /* Frame interval */
00154                 struct v4l2_fract               discrete;
00155                 struct v4l2_frmival_stepwise    stepwise;
00156         };
00157 
00158         __u32   reserved[2];                    /* Reserved space for future use */
00159 };
00160 
00161 #define VIDIOC_ENUM_FRAMESIZES          _IOWR ('V', 74, struct v4l2_frmsizeenum)
00162 #define VIDIOC_ENUM_FRAMEINTERVALS      _IOWR ('V', 75, struct v4l2_frmivalenum)
00163 #endif
00164 
00165 
00166 #endif /* _UVC_COMPAT_H */
00167 


corobot_pantilt
Author(s):
autogenerated on Wed Aug 26 2015 11:10:04