mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-26 00:21:17 +00:00
media: v4l2-core: Implement v4l2_ctrl_new_std_compound
Currently compound controls do not have a simple way of initializing its values. This results in ofuscated code with type_ops init. This patch introduces a new field on the control with the default value for the compound control that can be set with the brand new v4l2_ctrl_new_std_compound function Suggested-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Ricardo Ribalda Delgado <ribalda@kernel.org> [hverkuil@xs4all.nl: fix checkpatch warning] Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
parent
d8b1ad7ce7
commit
b35d6c02aa
2 changed files with 65 additions and 7 deletions
|
@ -200,6 +200,9 @@ typedef void (*v4l2_ctrl_notify_fnc)(struct v4l2_ctrl *ctrl, void *priv);
|
|||
* not freed when the control is deleted. Should this be needed
|
||||
* then a new internal bitfield can be added to tell the framework
|
||||
* to free this pointer.
|
||||
* @p_def: The control's default value represented via a union which
|
||||
* provides a standard way of accessing control types
|
||||
* through a pointer (for compound controls only).
|
||||
* @p_cur: The control's current value represented via a union which
|
||||
* provides a standard way of accessing control types
|
||||
* through a pointer.
|
||||
|
@ -254,6 +257,7 @@ struct v4l2_ctrl {
|
|||
s32 val;
|
||||
} cur;
|
||||
|
||||
union v4l2_ctrl_ptr p_def;
|
||||
union v4l2_ctrl_ptr p_new;
|
||||
union v4l2_ctrl_ptr p_cur;
|
||||
};
|
||||
|
@ -646,6 +650,24 @@ struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(struct v4l2_ctrl_handler *hdl,
|
|||
u64 mask, u8 def,
|
||||
const char * const *qmenu);
|
||||
|
||||
/**
|
||||
* v4l2_ctrl_new_std_compound() - Allocate and initialize a new standard V4L2
|
||||
* compound control.
|
||||
*
|
||||
* @hdl: The control handler.
|
||||
* @ops: The control ops.
|
||||
* @id: The control ID.
|
||||
* @p_def: The control's default value.
|
||||
*
|
||||
* Sames as v4l2_ctrl_new_std(), but with support to compound controls, thanks
|
||||
* to the @p_def field.
|
||||
*
|
||||
*/
|
||||
struct v4l2_ctrl *v4l2_ctrl_new_std_compound(struct v4l2_ctrl_handler *hdl,
|
||||
const struct v4l2_ctrl_ops *ops,
|
||||
u32 id,
|
||||
const union v4l2_ctrl_ptr p_def);
|
||||
|
||||
/**
|
||||
* v4l2_ctrl_new_int_menu() - Create a new standard V4L2 integer menu control.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue