diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2014-06-12 06:54:16 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-07-17 09:38:44 -0400 |
commit | d9a2547150245f34a050f744ea46542c44792652 (patch) | |
tree | b8d20d264d795e1bd8015fe84ce6402f87990e9b /include/media/v4l2-ctrls.h | |
parent | 5082c2417841e64df975789011e182ce99a9dacd (diff) |
[media] v4l2-ctrls: add support for compound types
This patch implements initial support for compound types.
The changes are fairly obvious: basic support for is_ptr types, the
type_is_int function is replaced by a is_int bitfield, and
v4l2_query_ext_ctrl is added.
Note that this patch does not yet add support for N-dimensional
arrays, that comes later. So v4l2_query_ext_ctrl just sets elems to
1 and nr_of_dims and dims[] are all zero.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'include/media/v4l2-ctrls.h')
-rw-r--r-- | include/media/v4l2-ctrls.h | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index a2e8f038a8ed..9024daebdf3b 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h | |||
@@ -73,6 +73,12 @@ typedef void (*v4l2_ctrl_notify_fnc)(struct v4l2_ctrl *ctrl, void *priv); | |||
73 | * members are in 'automatic' mode or 'manual' mode. This is | 73 | * members are in 'automatic' mode or 'manual' mode. This is |
74 | * used for autogain/gain type clusters. Drivers should never | 74 | * used for autogain/gain type clusters. Drivers should never |
75 | * set this flag directly. | 75 | * set this flag directly. |
76 | * @is_int: If set, then this control has a simple integer value (i.e. it | ||
77 | * uses ctrl->val). | ||
78 | * @is_string: If set, then this control has type V4L2_CTRL_TYPE_STRING. | ||
79 | * @is_ptr: If set, then this control is an array and/or has type >= V4L2_CTRL_COMPOUND_TYPES | ||
80 | * and/or has type V4L2_CTRL_TYPE_STRING. In other words, struct | ||
81 | * v4l2_ext_control uses field p to point to the data. | ||
76 | * @has_volatiles: If set, then one or more members of the cluster are volatile. | 82 | * @has_volatiles: If set, then one or more members of the cluster are volatile. |
77 | * Drivers should never touch this flag. | 83 | * Drivers should never touch this flag. |
78 | * @call_notify: If set, then call the handler's notify function whenever the | 84 | * @call_notify: If set, then call the handler's notify function whenever the |
@@ -90,6 +96,7 @@ typedef void (*v4l2_ctrl_notify_fnc)(struct v4l2_ctrl *ctrl, void *priv); | |||
90 | * @maximum: The control's maximum value. | 96 | * @maximum: The control's maximum value. |
91 | * @default_value: The control's default value. | 97 | * @default_value: The control's default value. |
92 | * @step: The control's step value for non-menu controls. | 98 | * @step: The control's step value for non-menu controls. |
99 | * @elem_size: The size in bytes of the control. | ||
93 | * @menu_skip_mask: The control's skip mask for menu controls. This makes it | 100 | * @menu_skip_mask: The control's skip mask for menu controls. This makes it |
94 | * easy to skip menu items that are not valid. If bit X is set, | 101 | * easy to skip menu items that are not valid. If bit X is set, |
95 | * then menu item X is skipped. Of course, this only works for | 102 | * then menu item X is skipped. Of course, this only works for |
@@ -104,7 +111,6 @@ typedef void (*v4l2_ctrl_notify_fnc)(struct v4l2_ctrl *ctrl, void *priv); | |||
104 | * @cur: The control's current value. | 111 | * @cur: The control's current value. |
105 | * @val: The control's new s32 value. | 112 | * @val: The control's new s32 value. |
106 | * @val64: The control's new s64 value. | 113 | * @val64: The control's new s64 value. |
107 | * @string: The control's new string value. | ||
108 | * @priv: The control's private pointer. For use by the driver. It is | 114 | * @priv: The control's private pointer. For use by the driver. It is |
109 | * untouched by the control framework. Note that this pointer is | 115 | * untouched by the control framework. Note that this pointer is |
110 | * not freed when the control is deleted. Should this be needed | 116 | * not freed when the control is deleted. Should this be needed |
@@ -123,6 +129,9 @@ struct v4l2_ctrl { | |||
123 | unsigned int is_new:1; | 129 | unsigned int is_new:1; |
124 | unsigned int is_private:1; | 130 | unsigned int is_private:1; |
125 | unsigned int is_auto:1; | 131 | unsigned int is_auto:1; |
132 | unsigned int is_int:1; | ||
133 | unsigned int is_string:1; | ||
134 | unsigned int is_ptr:1; | ||
126 | unsigned int has_volatiles:1; | 135 | unsigned int has_volatiles:1; |
127 | unsigned int call_notify:1; | 136 | unsigned int call_notify:1; |
128 | unsigned int manual_mode_value:8; | 137 | unsigned int manual_mode_value:8; |
@@ -132,6 +141,7 @@ struct v4l2_ctrl { | |||
132 | const char *name; | 141 | const char *name; |
133 | enum v4l2_ctrl_type type; | 142 | enum v4l2_ctrl_type type; |
134 | s64 minimum, maximum, default_value; | 143 | s64 minimum, maximum, default_value; |
144 | u32 elem_size; | ||
135 | union { | 145 | union { |
136 | u64 step; | 146 | u64 step; |
137 | u64 menu_skip_mask; | 147 | u64 menu_skip_mask; |
@@ -141,17 +151,19 @@ struct v4l2_ctrl { | |||
141 | const s64 *qmenu_int; | 151 | const s64 *qmenu_int; |
142 | }; | 152 | }; |
143 | unsigned long flags; | 153 | unsigned long flags; |
154 | void *priv; | ||
144 | union { | 155 | union { |
145 | s32 val; | 156 | s32 val; |
146 | s64 val64; | 157 | s64 val64; |
147 | char *string; | 158 | char *string; |
148 | } cur; | 159 | void *p; |
160 | }; | ||
149 | union { | 161 | union { |
150 | s32 val; | 162 | s32 val; |
151 | s64 val64; | 163 | s64 val64; |
152 | char *string; | 164 | char *string; |
153 | }; | 165 | void *p; |
154 | void *priv; | 166 | } cur; |
155 | }; | 167 | }; |
156 | 168 | ||
157 | /** struct v4l2_ctrl_ref - The control reference. | 169 | /** struct v4l2_ctrl_ref - The control reference. |
@@ -212,6 +224,7 @@ struct v4l2_ctrl_handler { | |||
212 | * @max: The control's maximum value. | 224 | * @max: The control's maximum value. |
213 | * @step: The control's step value for non-menu controls. | 225 | * @step: The control's step value for non-menu controls. |
214 | * @def: The control's default value. | 226 | * @def: The control's default value. |
227 | * @elem_size: The size in bytes of the control. | ||
215 | * @flags: The control's flags. | 228 | * @flags: The control's flags. |
216 | * @menu_skip_mask: The control's skip mask for menu controls. This makes it | 229 | * @menu_skip_mask: The control's skip mask for menu controls. This makes it |
217 | * easy to skip menu items that are not valid. If bit X is set, | 230 | * easy to skip menu items that are not valid. If bit X is set, |
@@ -235,6 +248,7 @@ struct v4l2_ctrl_config { | |||
235 | s64 max; | 248 | s64 max; |
236 | u64 step; | 249 | u64 step; |
237 | s64 def; | 250 | s64 def; |
251 | u32 elem_size; | ||
238 | u32 flags; | 252 | u32 flags; |
239 | u64 menu_skip_mask; | 253 | u64 menu_skip_mask; |
240 | const char * const *qmenu; | 254 | const char * const *qmenu; |
@@ -659,6 +673,7 @@ unsigned int v4l2_ctrl_poll(struct file *file, struct poll_table_struct *wait); | |||
659 | 673 | ||
660 | /* Helpers for ioctl_ops. If hdl == NULL then they will all return -EINVAL. */ | 674 | /* Helpers for ioctl_ops. If hdl == NULL then they will all return -EINVAL. */ |
661 | int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc); | 675 | int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc); |
676 | int v4l2_query_ext_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_query_ext_ctrl *qc); | ||
662 | int v4l2_querymenu(struct v4l2_ctrl_handler *hdl, struct v4l2_querymenu *qm); | 677 | int v4l2_querymenu(struct v4l2_ctrl_handler *hdl, struct v4l2_querymenu *qm); |
663 | int v4l2_g_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_control *ctrl); | 678 | int v4l2_g_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_control *ctrl); |
664 | int v4l2_s_ctrl(struct v4l2_fh *fh, struct v4l2_ctrl_handler *hdl, | 679 | int v4l2_s_ctrl(struct v4l2_fh *fh, struct v4l2_ctrl_handler *hdl, |