1 /* 2 # (C) 2008-2009 Elmar Kleijn <elmar_kleijn@hotmail.com> 3 # (C) 2008-2009 Sjoerd Piepenbrink <need4weed@gmail.com> 4 # (C) 2008-2009 Radjnies Bhansingh <radjnies@gmail.com> 5 # (C) 2008-2009 Hans de Goede <hdegoede@redhat.com> 6 7 # This program is free software; you can redistribute it and/or modify 8 # it under the terms of the GNU Lesser General Public License as published by 9 # the Free Software Foundation; either version 2.1 of the License, or 10 # (at your option) any later version. 11 # 12 # This program is distributed in the hope that it will be useful, 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNU Lesser General Public License for more details. 16 # 17 # You should have received a copy of the GNU Lesser General Public License 18 # along with this program; if not, write to the Free Software 19 # Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA 20 */ 21 22 #ifndef __LIBV4LCONTROL_H 23 #define __LIBV4LCONTROL_H 24 25 #include "libv4l-plugin.h" 26 27 /* Flags */ 28 #define V4LCONTROL_HFLIPPED 0x01 29 #define V4LCONTROL_VFLIPPED 0x02 30 #define V4LCONTROL_ROTATED_90_JPEG 0x04 31 #define V4LCONTROL_WANTS_WB 0x08 32 #define V4LCONTROL_WANTS_AUTOGAIN 0x10 33 #define V4LCONTROL_FORCE_TINYJPEG 0x20 34 35 /* Masks */ 36 #define V4LCONTROL_WANTS_WB_AUTOGAIN (V4LCONTROL_WANTS_WB | V4LCONTROL_WANTS_AUTOGAIN) 37 38 /* Controls */ 39 enum { 40 V4LCONTROL_WHITEBALANCE, 41 V4LCONTROL_HFLIP, 42 V4LCONTROL_VFLIP, 43 V4LCONTROL_GAMMA, 44 /* All fake controls above here are auto enabled when not present in hw */ 45 V4LCONTROL_AUTO_ENABLE_COUNT, 46 V4LCONTROL_AUTOGAIN, 47 V4LCONTROL_AUTOGAIN_TARGET, 48 V4LCONTROL_COUNT 49 }; 50 51 struct v4lcontrol_data; 52 53 struct v4lcontrol_data *v4lcontrol_create(int fd, void *dev_ops_priv, 54 const struct libv4l_dev_ops *dev_ops, int always_needs_conversion); 55 void v4lcontrol_destroy(struct v4lcontrol_data *data); 56 57 int v4lcontrol_get_bandwidth(struct v4lcontrol_data *data); 58 59 /* Functions used by v4lprocessing to get the control state */ 60 int v4lcontrol_get_flags(struct v4lcontrol_data *data); 61 int v4lcontrol_get_ctrl(struct v4lcontrol_data *data, int ctrl); 62 /* Check if the controls have changed since the last time this function 63 was called */ 64 int v4lcontrol_controls_changed(struct v4lcontrol_data *data); 65 /* Check if we must go through the conversion path (and thus alloc conversion 66 buffers, etc. in libv4l2). Note this always return 1 if we *may* need 67 rotate90 / flipping / processing, as if we actually need this may change 68 on the fly while the stream is active. */ 69 int v4lcontrol_needs_conversion(struct v4lcontrol_data *data); 70 71 /* Functions used by v4lconvert to pass vidioc calls from libv4l2 */ 72 int v4lcontrol_vidioc_queryctrl(struct v4lcontrol_data *data, void *arg); 73 int v4lcontrol_vidioc_g_ctrl(struct v4lcontrol_data *data, void *arg); 74 int v4lcontrol_vidioc_s_ctrl(struct v4lcontrol_data *data, void *arg); 75 int v4lcontrol_vidioc_g_ext_ctrls(struct v4lcontrol_data *data, void *arg); 76 int v4lcontrol_vidioc_try_ext_ctrls(struct v4lcontrol_data *data, void *arg); 77 int v4lcontrol_vidioc_s_ext_ctrls(struct v4lcontrol_data *data, void *arg); 78 79 #endif 80