Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures
v4l2-ctrls.h File Reference
#include <linux/list.h>
#include <linux/videodev2.h>

Go to the source code of this file.

Data Structures

struct  v4l2_ctrl_ops
 
struct  v4l2_ctrl
 
struct  v4l2_ctrl_ref
 
struct  v4l2_ctrl_handler
 
struct  v4l2_ctrl_config
 

, @type and @flags.

The contents of , , and

struct v4l2_subscribed_event_ops v4l2_ctrl_sub_ev_ops
 
void v4l2_ctrl_fill (u32 id, const char **name, enum v4l2_ctrl_type *type, s32 *min, s32 *max, s32 *step, s32 *def, u32 *flags)
 
int v4l2_ctrl_handler_init (struct v4l2_ctrl_handler *hdl, unsigned nr_of_controls_hint)
 
void v4l2_ctrl_handler_free (struct v4l2_ctrl_handler *hdl)
 
int v4l2_ctrl_handler_setup (struct v4l2_ctrl_handler *hdl)
 
void v4l2_ctrl_handler_log_status (struct v4l2_ctrl_handler *hdl, const char *prefix)
 
struct v4l2_ctrlv4l2_ctrl_new_custom (struct v4l2_ctrl_handler *hdl, const struct v4l2_ctrl_config *cfg, void *priv)
 
struct v4l2_ctrlv4l2_ctrl_new_std (struct v4l2_ctrl_handler *hdl, const struct v4l2_ctrl_ops *ops, u32 id, s32 min, s32 max, u32 step, s32 def)
 
struct v4l2_ctrlv4l2_ctrl_new_std_menu (struct v4l2_ctrl_handler *hdl, const struct v4l2_ctrl_ops *ops, u32 id, s32 max, s32 mask, s32 def)
 
struct v4l2_ctrlv4l2_ctrl_new_std_menu_items (struct v4l2_ctrl_handler *hdl, const struct v4l2_ctrl_ops *ops, u32 id, s32 max, s32 mask, s32 def, const char *const *qmenu)
 
struct v4l2_ctrlv4l2_ctrl_new_int_menu (struct v4l2_ctrl_handler *hdl, const struct v4l2_ctrl_ops *ops, u32 id, s32 max, s32 def, const s64 *qmenu_int)
 
struct v4l2_ctrlv4l2_ctrl_add_ctrl (struct v4l2_ctrl_handler *hdl, struct v4l2_ctrl *ctrl)
 
int v4l2_ctrl_add_handler (struct v4l2_ctrl_handler *hdl, struct v4l2_ctrl_handler *add, bool(*filter)(const struct v4l2_ctrl *ctrl))
 
bool v4l2_ctrl_radio_filter (const struct v4l2_ctrl *ctrl)
 
void v4l2_ctrl_cluster (unsigned ncontrols, struct v4l2_ctrl **controls)
 
void v4l2_ctrl_auto_cluster (unsigned ncontrols, struct v4l2_ctrl **controls, u8 manual_val, bool set_volatile)
 
struct v4l2_ctrlv4l2_ctrl_find (struct v4l2_ctrl_handler *hdl, u32 id)
 
void v4l2_ctrl_activate (struct v4l2_ctrl *ctrl, bool active)
 
void v4l2_ctrl_grab (struct v4l2_ctrl *ctrl, bool grabbed)
 
s32 v4l2_ctrl_g_ctrl (struct v4l2_ctrl *ctrl)
 
int v4l2_ctrl_s_ctrl (struct v4l2_ctrl *ctrl, s32 val)
 
s64 v4l2_ctrl_g_ctrl_int64 (struct v4l2_ctrl *ctrl)
 
int v4l2_ctrl_s_ctrl_int64 (struct v4l2_ctrl *ctrl, s64 val)
 
void v4l2_ctrl_replace (struct v4l2_event *old, const struct v4l2_event *new)
 
void v4l2_ctrl_merge (const struct v4l2_event *old, struct v4l2_event *new)
 
int v4l2_ctrl_log_status (struct file *file, void *fh)
 
int v4l2_ctrl_subscribe_event (struct v4l2_fh *fh, const struct v4l2_event_subscription *sub)
 
unsigned int v4l2_ctrl_poll (struct file *file, struct poll_table_struct *wait)
 
int v4l2_queryctrl (struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc)
 
int v4l2_querymenu (struct v4l2_ctrl_handler *hdl, struct v4l2_querymenu *qm)
 
int v4l2_g_ctrl (struct v4l2_ctrl_handler *hdl, struct v4l2_control *ctrl)
 
int v4l2_s_ctrl (struct v4l2_fh *fh, struct v4l2_ctrl_handler *hdl, struct v4l2_control *ctrl)
 
int v4l2_g_ext_ctrls (struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *c)
 
int v4l2_try_ext_ctrls (struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *c)
 
int v4l2_s_ext_ctrls (struct v4l2_fh *fh, struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *c)
 
int v4l2_subdev_queryctrl (struct v4l2_subdev *sd, struct v4l2_queryctrl *qc)
 
int v4l2_subdev_querymenu (struct v4l2_subdev *sd, struct v4l2_querymenu *qm)
 
int v4l2_subdev_g_ext_ctrls (struct v4l2_subdev *sd, struct v4l2_ext_controls *cs)
 
int v4l2_subdev_try_ext_ctrls (struct v4l2_subdev *sd, struct v4l2_ext_controls *cs)
 
int v4l2_subdev_s_ext_ctrls (struct v4l2_subdev *sd, struct v4l2_ext_controls *cs)
 
int v4l2_subdev_g_ctrl (struct v4l2_subdev *sd, struct v4l2_control *ctrl)
 
int v4l2_subdev_s_ctrl (struct v4l2_subdev *sd, struct v4l2_control *ctrl)
 

Function Documentation

void v4l2_ctrl_activate ( struct v4l2_ctrl ctrl,
bool  active 
)

v4l2_ctrl_activate() - Make the control active or inactive. : The control to (de)activate. : True if the control should become active.

This sets or clears the V4L2_CTRL_FLAG_INACTIVE flag atomically. Does nothing if == NULL. This will usually be called from within the s_ctrl op. The V4L2_EVENT_CTRL event will be generated afterwards.

This function assumes that the control handler is locked.

Definition at line 1864 of file v4l2-ctrls.c.

struct v4l2_ctrl* v4l2_ctrl_add_ctrl ( struct v4l2_ctrl_handler hdl,
struct v4l2_ctrl ctrl 
)
read

v4l2_ctrl_add_ctrl() - Add a control from another handler to this handler. : The control handler. : The control to add.

It will return NULL if it was unable to add the control reference. If the control already belonged to the handler, then it will do nothing and just return .

Definition at line 1747 of file v4l2-ctrls.c.

int v4l2_ctrl_add_handler ( struct v4l2_ctrl_handler hdl,
struct v4l2_ctrl_handler add,
bool(*)(const struct v4l2_ctrl *ctrl filter 
)

v4l2_ctrl_add_handler() - Add all controls from handler to handler . : The control handler. : The control handler whose controls you want to add to the control handler. : This function will filter which controls should be added.

Does nothing if either of the two handlers is a NULL pointer. If is NULL, then all controls are added. Otherwise only those controls for which returns true will be added. In case of an error ->error will be set to the error code (if it wasn't set already).

Definition at line 1763 of file v4l2-ctrls.c.

void v4l2_ctrl_auto_cluster ( unsigned  ncontrols,
struct v4l2_ctrl **  controls,
u8  manual_val,
bool  set_volatile 
)

v4l2_ctrl_auto_cluster() - Mark all controls in the cluster as belonging to that cluster and set it up for autofoo/foo-type handling. : The number of controls in this cluster. : The cluster control array of size . The first control must be the 'auto' control (e.g. autogain, autoexposure, etc.) : The value for the first control in the cluster that equals the manual setting. : If true, then all controls except the first auto control will be volatile.

Use for control groups where one control selects some automatic feature and the other controls are only active whenever the automatic feature is turned off (manual mode). Typical examples: autogain vs gain, auto-whitebalance vs red and blue balance, etc.

The behavior of such controls is as follows:

When the autofoo control is set to automatic, then any manual controls are set to inactive and any reads will call g_volatile_ctrl (if the control was marked volatile).

When the autofoo control is set to manual, then any manual controls will be marked active, and any reads will just return the current value without going through g_volatile_ctrl.

In addition, this function will set the V4L2_CTRL_FLAG_UPDATE flag on the autofoo control and V4L2_CTRL_FLAG_INACTIVE on the foo control(s) if autofoo is in auto mode.

Definition at line 1837 of file v4l2-ctrls.c.

void v4l2_ctrl_cluster ( unsigned  ncontrols,
struct v4l2_ctrl **  controls 
)

v4l2_ctrl_cluster() - Mark all controls in the cluster as belonging to that cluster. : The number of controls in this cluster. : The cluster control array of size .

Definition at line 1817 of file v4l2-ctrls.c.

void v4l2_ctrl_fill ( u32  id,
const char **  name,
enum v4l2_ctrl_type type,
s32 min,
s32 max,
s32 step,
s32 def,
u32 flags 
)

Definition at line 810 of file v4l2-ctrls.c.

struct v4l2_ctrl* v4l2_ctrl_find ( struct v4l2_ctrl_handler hdl,
u32  id 
)
read

v4l2_ctrl_find() - Find a control with the given ID. : The control handler. : The control ID to find.

If == NULL this will return NULL as well. Will lock the handler so do not use from inside &v4l2_ctrl_ops.

Definition at line 1447 of file v4l2-ctrls.c.

s32 v4l2_ctrl_g_ctrl ( struct v4l2_ctrl ctrl)

v4l2_ctrl_g_ctrl() - Helper function to get the control's value from within a driver. : The control.

This returns the control's value safely by going through the control framework. This function will lock the control's handler, so it cannot be used from within the &v4l2_ctrl_ops functions.

This function is for integer type controls only.

Definition at line 2401 of file v4l2-ctrls.c.

s64 v4l2_ctrl_g_ctrl_int64 ( struct v4l2_ctrl ctrl)

v4l2_ctrl_g_ctrl_int64() - Helper function to get a 64-bit control's value from within a driver. : The control.

This returns the control's value safely by going through the control framework. This function will lock the control's handler, so it cannot be used from within the &v4l2_ctrl_ops functions.

This function is for 64-bit integer type controls only.

Definition at line 2413 of file v4l2-ctrls.c.

void v4l2_ctrl_grab ( struct v4l2_ctrl ctrl,
bool  grabbed 
)

v4l2_ctrl_grab() - Mark the control as grabbed or not grabbed. : The control to (de)activate. : True if the control should become grabbed.

This sets or clears the V4L2_CTRL_FLAG_GRABBED flag atomically. Does nothing if == NULL. The V4L2_EVENT_CTRL event will be generated afterwards. This will usually be called when starting or stopping streaming in the driver.

This function assumes that the control handler is not locked and will take the lock itself.

Definition at line 1890 of file v4l2-ctrls.c.

void v4l2_ctrl_handler_free ( struct v4l2_ctrl_handler hdl)

v4l2_ctrl_handler_free() - Free all controls owned by the handler and free the control list. : The control handler.

Does nothing if == NULL.

Definition at line 1348 of file v4l2-ctrls.c.

int v4l2_ctrl_handler_init ( struct v4l2_ctrl_handler hdl,
unsigned  nr_of_controls_hint 
)

v4l2_ctrl_handler_init() - Initialize the control handler. : The control handler. : A hint of how many controls this handler is expected to refer to. This is the total number, so including any inherited controls. It doesn't have to be precise, but if it is way off, then you either waste memory (too many buckets are allocated) or the control lookup becomes slower (not enough buckets are allocated, so there are more slow list lookups). It will always work, though.

Returns an error if the buckets could not be allocated. This error will also be stored in ->error.

Definition at line 1332 of file v4l2-ctrls.c.

void v4l2_ctrl_handler_log_status ( struct v4l2_ctrl_handler hdl,
const char prefix 
)

v4l2_ctrl_handler_log_status() - Log all controls owned by the handler. : The control handler. : The prefix to use when logging the control values. If the prefix does not end with a space, then ": " will be added after the prefix. If == NULL, then no prefix will be used.

For use with VIDIOC_LOG_STATUS.

Does nothing if == NULL.

Definition at line 1961 of file v4l2-ctrls.c.

int v4l2_ctrl_handler_setup ( struct v4l2_ctrl_handler hdl)

v4l2_ctrl_handler_setup() - Call the s_ctrl op for all controls belonging to the handler to initialize the hardware to the current control values. : The control handler.

Button controls will be skipped, as are read-only controls.

If == NULL, then this just returns 0.

Definition at line 1984 of file v4l2-ctrls.c.

int v4l2_ctrl_log_status ( struct file file,
void fh 
)

Definition at line 2786 of file v4l2-ctrls.c.

void v4l2_ctrl_merge ( const struct v4l2_event old,
struct v4l2_event new 
)

Definition at line 2772 of file v4l2-ctrls.c.

struct v4l2_ctrl* v4l2_ctrl_new_custom ( struct v4l2_ctrl_handler hdl,
const struct v4l2_ctrl_config cfg,
void priv 
)
read

v4l2_ctrl_new_custom() - Allocate and initialize a new custom V4L2 control. : The control handler. : The control's configuration data. : The control's driver-specific private data.

If the &v4l2_ctrl struct could not be allocated then NULL is returned and ->error is set to the error code (if it wasn't set already).

Definition at line 1610 of file v4l2-ctrls.c.

struct v4l2_ctrl* v4l2_ctrl_new_int_menu ( struct v4l2_ctrl_handler hdl,
const struct v4l2_ctrl_ops ops,
u32  id,
s32  max,
s32  def,
const s64 qmenu_int 
)
read

Definition at line 1726 of file v4l2-ctrls.c.

struct v4l2_ctrl* v4l2_ctrl_new_std ( struct v4l2_ctrl_handler hdl,
const struct v4l2_ctrl_ops ops,
u32  id,
s32  min,
s32  max,
u32  step,
s32  def 
)
read

Definition at line 1654 of file v4l2-ctrls.c.

struct v4l2_ctrl* v4l2_ctrl_new_std_menu ( struct v4l2_ctrl_handler hdl,
const struct v4l2_ctrl_ops ops,
u32  id,
s32  max,
s32  mask,
s32  def 
)
read

Definition at line 1674 of file v4l2-ctrls.c.

struct v4l2_ctrl* v4l2_ctrl_new_std_menu_items ( struct v4l2_ctrl_handler hdl,
const struct v4l2_ctrl_ops ops,
u32  id,
s32  max,
s32  mask,
s32  def,
const char *const qmenu 
)
read

Definition at line 1696 of file v4l2-ctrls.c.

unsigned int v4l2_ctrl_poll ( struct file file,
struct poll_table_struct wait 
)

Definition at line 2807 of file v4l2-ctrls.c.

bool v4l2_ctrl_radio_filter ( const struct v4l2_ctrl ctrl)

v4l2_ctrl_radio_filter() - Standard filter for radio controls. : The control that is filtered.

This will return true for any controls that are valid for radio device nodes. Those are all of the V4L2_CID_AUDIO_* user controls and all FM transmitter class controls.

This function is to be used with v4l2_ctrl_add_handler().

Definition at line 1797 of file v4l2-ctrls.c.

void v4l2_ctrl_replace ( struct v4l2_event old,
const struct v4l2_event new 
)

Definition at line 2763 of file v4l2-ctrls.c.

int v4l2_ctrl_s_ctrl ( struct v4l2_ctrl ctrl,
s32  val 
)

v4l2_ctrl_s_ctrl() - Helper function to set the control's value from within a driver. : The control. : The new value.

This set the control's new value safely by going through the control framework. This function will lock the control's handler, so it cannot be used from within the &v4l2_ctrl_ops functions.

This function is for integer type controls only.

Definition at line 2706 of file v4l2-ctrls.c.

int v4l2_ctrl_s_ctrl_int64 ( struct v4l2_ctrl ctrl,
s64  val 
)

v4l2_ctrl_s_ctrl_int64() - Helper function to set a 64-bit control's value from within a driver. : The control. : The new value.

This set the control's new value safely by going through the control framework. This function will lock the control's handler, so it cannot be used from within the &v4l2_ctrl_ops functions.

This function is for 64-bit integer type controls only.

Definition at line 2717 of file v4l2-ctrls.c.

int v4l2_ctrl_subscribe_event ( struct v4l2_fh fh,
const struct v4l2_event_subscription sub 
)

Definition at line 2798 of file v4l2-ctrls.c.

int v4l2_g_ctrl ( struct v4l2_ctrl_handler hdl,
struct v4l2_control ctrl 
)

Definition at line 2381 of file v4l2-ctrls.c.

int v4l2_g_ext_ctrls ( struct v4l2_ctrl_handler hdl,
struct v4l2_ext_controls c 
)

Definition at line 2272 of file v4l2-ctrls.c.

Definition at line 2022 of file v4l2-ctrls.c.

Definition at line 2090 of file v4l2-ctrls.c.

int v4l2_s_ctrl ( struct v4l2_fh fh,
struct v4l2_ctrl_handler hdl,
struct v4l2_control ctrl 
)

Definition at line 2680 of file v4l2-ctrls.c.

int v4l2_s_ext_ctrls ( struct v4l2_fh fh,
struct v4l2_ctrl_handler hdl,
struct v4l2_ext_controls c 
)

Definition at line 2620 of file v4l2-ctrls.c.

int v4l2_subdev_g_ctrl ( struct v4l2_subdev sd,
struct v4l2_control ctrl 
)

Definition at line 2395 of file v4l2-ctrls.c.

int v4l2_subdev_g_ext_ctrls ( struct v4l2_subdev sd,
struct v4l2_ext_controls cs 
)

Definition at line 2344 of file v4l2-ctrls.c.

int v4l2_subdev_queryctrl ( struct v4l2_subdev sd,
struct v4l2_queryctrl qc 
)

Definition at line 2081 of file v4l2-ctrls.c.

int v4l2_subdev_querymenu ( struct v4l2_subdev sd,
struct v4l2_querymenu qm 
)

Definition at line 2132 of file v4l2-ctrls.c.

int v4l2_subdev_s_ctrl ( struct v4l2_subdev sd,
struct v4l2_control ctrl 
)

Definition at line 2700 of file v4l2-ctrls.c.

int v4l2_subdev_s_ext_ctrls ( struct v4l2_subdev sd,
struct v4l2_ext_controls cs 
)

Definition at line 2633 of file v4l2-ctrls.c.

int v4l2_subdev_try_ext_ctrls ( struct v4l2_subdev sd,
struct v4l2_ext_controls cs 
)

Definition at line 2627 of file v4l2-ctrls.c.

int v4l2_try_ext_ctrls ( struct v4l2_ctrl_handler hdl,
struct v4l2_ext_controls c 
)

Definition at line 2614 of file v4l2-ctrls.c.

Variable Documentation

struct v4l2_subscribed_event_ops v4l2_ctrl_sub_ev_ops

Definition at line 2778 of file v4l2-ctrls.c.