1 /******************************************************************************* 2 # Linux-UVC streaming input-plugin for MJPG-streamer # 3 # # 4 # This package work with the Logitech UVC based webcams with the mjpeg feature # 5 # # 6 # Copyright (C) 2005 2006 Laurent Pinchart && Michel Xhaard # 7 # 2007 Lucas van Staden # 8 # 2007 Tom Stöveken # 9 # # 10 # This program is free software; you can redistribute it and/or modify # 11 # it under the terms of the GNU General Public License as published by # 12 # the Free Software Foundation; either version 2 of the License, or # 13 # (at your option) any later version. # 14 # # 15 # This program is distributed in the hope that it will be useful, # 16 # but WITHOUT ANY WARRANTY; without even the implied warranty of # 17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 18 # GNU General Public License for more details. # 19 # # 20 # You should have received a copy of the GNU General Public License # 21 # along with this program; if not, write to the Free Software # 22 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # 23 # # 24 *******************************************************************************/ 25 26 #ifndef _UVC_COMPAT_H 27 #define _UVC_COMPAT_H 28 29 #include <linux/version.h> 30 #ifndef __KERNEL__ 31 #ifndef __user 32 #define __user 33 #endif 34 #endif 35 36 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) 37 /* 38 * Extended control API 39 */ 40 struct v4l2_ext_control { 41 __u32 id; 42 __u32 reserved2[2]; 43 union { 44 __s32 value; 45 __s64 value64; 46 void *reserved; 47 }; 48 } __attribute__((packed)); 49 50 struct v4l2_ext_controls { 51 __u32 ctrl_class; 52 __u32 count; 53 __u32 error_idx; 54 __u32 reserved[2]; 55 struct v4l2_ext_control *controls; 56 }; 57 58 /* Values for ctrl_class field */ 59 #define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */ 60 #define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */ 61 62 #define V4L2_CTRL_ID_MASK (0x0fffffff) 63 #define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) 64 #define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000) 65 /* Control flags */ 66 #define V4L2_CTRL_FLAG_READ_ONLY 0x0004 67 #define V4L2_CTRL_FLAG_UPDATE 0x0008 68 #define V4L2_CTRL_FLAG_INACTIVE 0x0010 69 #define V4L2_CTRL_FLAG_SLIDER 0x0020 70 71 /* Query flags, to be ORed with the control ID */ 72 #define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000 73 74 /* User-class control IDs defined by V4L2 */ 75 #undef V4L2_CID_BASE 76 #define V4L2_CID_BASE (V4L2_CTRL_CLASS_USER | 0x900) 77 #define V4L2_CID_USER_BASE V4L2_CID_BASE 78 #define V4L2_CID_USER_CLASS (V4L2_CTRL_CLASS_USER | 1) 79 80 #define VIDIOC_G_EXT_CTRLS _IOWR ('V', 71, struct v4l2_ext_controls) 81 #define VIDIOC_S_EXT_CTRLS _IOWR ('V', 72, struct v4l2_ext_controls) 82 #define VIDIOC_TRY_EXT_CTRLS _IOWR ('V', 73, struct v4l2_ext_controls) 83 84 #endif 85 86 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) 87 /* 88 * Frame size and frame rate enumeration 89 * 90 * Included in Linux 2.6.19 91 */ 92 enum v4l2_frmsizetypes { 93 V4L2_FRMSIZE_TYPE_DISCRETE = 1, 94 V4L2_FRMSIZE_TYPE_CONTINUOUS = 2, 95 V4L2_FRMSIZE_TYPE_STEPWISE = 3 96 }; 97 98 struct v4l2_frmsize_discrete { 99 __u32 width; /* Frame width [pixel] */ 100 __u32 height; /* Frame height [pixel] */ 101 }; 102 103 struct v4l2_frmsize_stepwise { 104 __u32 min_width; /* Minimum frame width [pixel] */ 105 __u32 max_width; /* Maximum frame width [pixel] */ 106 __u32 step_width; /* Frame width step size [pixel] */ 107 __u32 min_height; /* Minimum frame height [pixel] */ 108 __u32 max_height; /* Maximum frame height [pixel] */ 109 __u32 step_height; /* Frame height step size [pixel] */ 110 }; 111 112 struct v4l2_frmsizeenum { 113 __u32 index; /* Frame size number */ 114 __u32 pixel_format; /* Pixel format */ 115 __u32 type; /* Frame size type the device supports. */ 116 117 union { /* Frame size */ 118 struct v4l2_frmsize_discrete discrete; 119 struct v4l2_frmsize_stepwise stepwise; 120 }; 121 122 __u32 reserved[2]; /* Reserved space for future use */ 123 }; 124 125 enum v4l2_frmivaltypes { 126 V4L2_FRMIVAL_TYPE_DISCRETE = 1, 127 V4L2_FRMIVAL_TYPE_CONTINUOUS = 2, 128 V4L2_FRMIVAL_TYPE_STEPWISE = 3 129 }; 130 131 struct v4l2_frmival_stepwise { 132 struct v4l2_fract min; /* Minimum frame interval [s] */ 133 struct v4l2_fract max; /* Maximum frame interval [s] */ 134 struct v4l2_fract step; /* Frame interval step size [s] */ 135 }; 136 137 struct v4l2_frmivalenum { 138 __u32 index; /* Frame format index */ 139 __u32 pixel_format; /* Pixel format */ 140 __u32 width; /* Frame width */ 141 __u32 height; /* Frame height */ 142 __u32 type; /* Frame interval type the device supports. */ 143 144 union { /* Frame interval */ 145 struct v4l2_fract discrete; 146 struct v4l2_frmival_stepwise stepwise; 147 }; 148 149 __u32 reserved[2]; /* Reserved space for future use */ 150 }; 151 152 #define VIDIOC_ENUM_FRAMESIZES _IOWR ('V', 74, struct v4l2_frmsizeenum) 153 #define VIDIOC_ENUM_FRAMEINTERVALS _IOWR ('V', 75, struct v4l2_frmivalenum) 154 #endif 155 156 157 #endif /* _UVC_COMPAT_H */ 158 159