aboutsummaryrefslogtreecommitdiffstats
path: root/include/media
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2013-02-16 22:19:00 +0100
committerHans Verkuil <hans.verkuil@cisco.com>2013-02-16 22:19:00 +0100
commit10ab2beb37c14a0446fdddb3caf070bbf4955f3b (patch)
tree794b0cc022b7c3d8cb709a3553f83a48ad28030f /include/media
parented72d37a33fdf43dc47787fe220532cdec9da528 (diff)
v4l2-ctrls: must be able to enable/disable controlsctrl-enable
Controls can be dependent on the chosen input/output. So it has to be possible to enable or disable groups of controls, preventing them from being seen in the application. We need to allow duplicate controls as well so that two control handlers that both have the same control will still work. The first enabled control will win. And duplicate controls are always sorted based on when they were added (so the sorted list and the hash are both stable lists/hashes). Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Diffstat (limited to 'include/media')
-rw-r--r--include/media/v4l2-ctrls.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index f00d42bc01a6..d8f5aab21d4a 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -81,6 +81,8 @@ typedef void (*v4l2_ctrl_notify_fnc)(struct v4l2_ctrl *ctrl, void *priv);
* manual mode. So if the value of the auto control equals this
* value, then the whole cluster is in manual mode. Drivers should
* never set this flag directly.
+ * @is_enabled: If 0, then this control is disabled and will be hidden for
+ * applications. Controls are always enabled by default.
* @ops: The control ops.
* @id: The control ID.
* @name: The control name.
@@ -122,6 +124,7 @@ struct v4l2_ctrl {
unsigned int is_new:1;
unsigned int is_private:1;
unsigned int is_auto:1;
+ unsigned int is_enabled:1;
unsigned int has_volatiles:1;
unsigned int call_notify:1;
unsigned int manual_mode_value:8;
@@ -538,6 +541,37 @@ void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed);
int v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl,
s32 min, s32 max, u32 step, s32 def);
+/** v4l2_ctrl_enable() - Mark the control as enabled or disabled.
+ * @ctrl: The control to en/disable.
+ * @enabled: True if the control should become enabled.
+ *
+ * Enable/disable a control.
+ * Does nothing if @ctrl == NULL.
+ * Usually called if controls are to be enabled or disabled when changing
+ * to a different input or output.
+ *
+ * When a control is disabled, then it will no longer show up in the
+ * application.
+ *
+ * This function can be called regardless of whether the control handler
+ * is locked or not.
+ */
+void v4l2_ctrl_enable(struct v4l2_ctrl *ctrl, bool enabled);
+
+/** v4l2_ctrl_handler_enable() - Mark the controls in the handler as enabled or disabled.
+ * @hdl: The control handler.
+ * @enabled: True if the controls should become enabled.
+ *
+ * Enable/disable the controls owned by the handler.
+ * Does nothing if @hdl == NULL.
+ * Usually called if controls are to be enabled or disabled when changing
+ * to a different input or output.
+ *
+ * When a control is disabled, then it will no longer show up in the
+ * application.
+ */
+void v4l2_ctrl_handler_enable(struct v4l2_ctrl_handler *hdl, bool enabled);
+
/** v4l2_ctrl_lock() - Helper function to lock the handler
* associated with the control.
* @ctrl: The control to lock.

Privacy Policy