aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorLad, Prabhakar <prabhakar.lad@ti.com>2012-09-18 14:54:38 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-10-05 20:48:03 -0400
commit117a711a2c37a0309a3e39fbd13486642b63453b (patch)
tree27fc0524ae0d20d5280a42d391ec36cc93036acb /Documentation
parent5ebef0fbe0f72fa911088800c5d0bc7a872c35de (diff)
[media] media: v4l2-ctrl: add a helper function to add standard control with driver specific menu
Add helper function v4l2_ctrl_new_std_menu_items(), which adds a standard menu control, with driver specific menu. Signed-off-by: Lad, Prabhakar <prabhakar.lad@ti.com> Signed-off-by: Manjunath Hadli <manjunath.hadli@ti.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/video4linux/v4l2-controls.txt24
1 files changed, 24 insertions, 0 deletions
diff --git a/Documentation/video4linux/v4l2-controls.txt b/Documentation/video4linux/v4l2-controls.txt
index 54270df99d5c..cfe52c798d74 100644
--- a/Documentation/video4linux/v4l2-controls.txt
+++ b/Documentation/video4linux/v4l2-controls.txt
@@ -136,11 +136,25 @@ Or alternatively for integer menu controls, by calling v4l2_ctrl_new_int_menu:
136 const struct v4l2_ctrl_ops *ops, 136 const struct v4l2_ctrl_ops *ops,
137 u32 id, s32 max, s32 def, const s64 *qmenu_int); 137 u32 id, s32 max, s32 def, const s64 *qmenu_int);
138 138
139Standard menu controls with a driver specific menu are added by calling
140v4l2_ctrl_new_std_menu_items:
141
142 struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(
143 struct v4l2_ctrl_handler *hdl,
144 const struct v4l2_ctrl_ops *ops, u32 id, s32 max,
145 s32 skip_mask, s32 def, const char * const *qmenu);
146
139These functions are typically called right after the v4l2_ctrl_handler_init: 147These functions are typically called right after the v4l2_ctrl_handler_init:
140 148
141 static const s64 exp_bias_qmenu[] = { 149 static const s64 exp_bias_qmenu[] = {
142 -2, -1, 0, 1, 2 150 -2, -1, 0, 1, 2
143 }; 151 };
152 static const char * const test_pattern[] = {
153 "Disabled",
154 "Vertical Bars",
155 "Solid Black",
156 "Solid White",
157 };
144 158
145 v4l2_ctrl_handler_init(&foo->ctrl_handler, nr_of_controls); 159 v4l2_ctrl_handler_init(&foo->ctrl_handler, nr_of_controls);
146 v4l2_ctrl_new_std(&foo->ctrl_handler, &foo_ctrl_ops, 160 v4l2_ctrl_new_std(&foo->ctrl_handler, &foo_ctrl_ops,
@@ -156,6 +170,9 @@ These functions are typically called right after the v4l2_ctrl_handler_init:
156 ARRAY_SIZE(exp_bias_qmenu) - 1, 170 ARRAY_SIZE(exp_bias_qmenu) - 1,
157 ARRAY_SIZE(exp_bias_qmenu) / 2 - 1, 171 ARRAY_SIZE(exp_bias_qmenu) / 2 - 1,
158 exp_bias_qmenu); 172 exp_bias_qmenu);
173 v4l2_ctrl_new_std_menu_items(&foo->ctrl_handler, &foo_ctrl_ops,
174 V4L2_CID_TEST_PATTERN, ARRAY_SIZE(test_pattern) - 1, 0,
175 0, test_pattern);
159 ... 176 ...
160 if (foo->ctrl_handler.error) { 177 if (foo->ctrl_handler.error) {
161 int err = foo->ctrl_handler.error; 178 int err = foo->ctrl_handler.error;
@@ -185,6 +202,13 @@ v4l2_ctrl_new_std_menu in that it doesn't have the mask argument and takes
185as the last argument an array of signed 64-bit integers that form an exact 202as the last argument an array of signed 64-bit integers that form an exact
186menu item list. 203menu item list.
187 204
205The v4l2_ctrl_new_std_menu_items function is very similar to
206v4l2_ctrl_new_std_menu but takes an extra parameter qmenu, which is the driver
207specific menu for an otherwise standard menu control. A good example for this
208control is the test pattern control for capture/display/sensors devices that
209have the capability to generate test patterns. These test patterns are hardware
210specific, so the contents of the menu will vary from device to device.
211
188Note that if something fails, the function will return NULL or an error and 212Note that if something fails, the function will return NULL or an error and
189set ctrl_handler->error to the error code. If ctrl_handler->error was already 213set ctrl_handler->error to the error code. If ctrl_handler->error was already
190set, then it will just return and do nothing. This is also true for 214set, then it will just return and do nothing. This is also true for