diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2012-09-14 06:15:03 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-10-01 16:07:07 -0400 |
commit | 34a6b7d093d8fe738ada191b36648d00bc18b7eb (patch) | |
tree | 854584731068996a381af03b95884911c07074b5 /include/media | |
parent | a4f64407b9b33122a58cb78afd73f86d4bb022c4 (diff) |
[media] v4l2-ctrls: add a filter function to v4l2_ctrl_add_handler
With a filter function you can control more precisely which controls
are added. This is useful in particular for radio device nodes for
combined TV/Radio cards where you want to show just the radio-specific
controls and not controls like brightness.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include/media')
-rw-r--r-- | include/media/v4l2-ctrls.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index 6890f5e11ad0..801adb466bd2 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h | |||
@@ -384,14 +384,28 @@ struct v4l2_ctrl *v4l2_ctrl_add_ctrl(struct v4l2_ctrl_handler *hdl, | |||
384 | * @hdl: The control handler. | 384 | * @hdl: The control handler. |
385 | * @add: The control handler whose controls you want to add to | 385 | * @add: The control handler whose controls you want to add to |
386 | * the @hdl control handler. | 386 | * the @hdl control handler. |
387 | * @filter: This function will filter which controls should be added. | ||
387 | * | 388 | * |
388 | * Does nothing if either of the two is a NULL pointer. | 389 | * Does nothing if either of the two handlers is a NULL pointer. |
390 | * If @filter is NULL, then all controls are added. Otherwise only those | ||
391 | * controls for which @filter returns true will be added. | ||
389 | * In case of an error @hdl->error will be set to the error code (if it | 392 | * In case of an error @hdl->error will be set to the error code (if it |
390 | * wasn't set already). | 393 | * wasn't set already). |
391 | */ | 394 | */ |
392 | int v4l2_ctrl_add_handler(struct v4l2_ctrl_handler *hdl, | 395 | int v4l2_ctrl_add_handler(struct v4l2_ctrl_handler *hdl, |
393 | struct v4l2_ctrl_handler *add); | 396 | struct v4l2_ctrl_handler *add, |
397 | bool (*filter)(const struct v4l2_ctrl *ctrl)); | ||
394 | 398 | ||
399 | /** v4l2_ctrl_radio_filter() - Standard filter for radio controls. | ||
400 | * @ctrl: The control that is filtered. | ||
401 | * | ||
402 | * This will return true for any controls that are valid for radio device | ||
403 | * nodes. Those are all of the V4L2_CID_AUDIO_* user controls and all FM | ||
404 | * transmitter class controls. | ||
405 | * | ||
406 | * This function is to be used with v4l2_ctrl_add_handler(). | ||
407 | */ | ||
408 | bool v4l2_ctrl_radio_filter(const struct v4l2_ctrl *ctrl); | ||
395 | 409 | ||
396 | /** v4l2_ctrl_cluster() - Mark all controls in the cluster as belonging to that cluster. | 410 | /** v4l2_ctrl_cluster() - Mark all controls in the cluster as belonging to that cluster. |
397 | * @ncontrols: The number of controls in this cluster. | 411 | * @ncontrols: The number of controls in this cluster. |