1.25. V4L2 common functions and data structures

int v4l2_ctrl_query_fill(struct v4l2_queryctrl * qctrl, s32 min, s32 max, s32 step, s32 def)

Fill in a struct v4l2_queryctrl

Parameters

struct v4l2_queryctrl * qctrl
pointer to the struct v4l2_queryctrl to be filled
s32 min
minimum value for the control
s32 max
maximum value for the control
s32 step
control step
s32 def
default value for the control

Description

Fills the struct v4l2_queryctrl fields for the query control.

Note

This function assumes that the qctrl->id field is filled.

Returns -EINVAL if the control is not known by the V4L2 core, 0 on success.

struct v4l2_subdev * v4l2_i2c_new_subdev(struct v4l2_device * v4l2_dev, struct i2c_adapter * adapter, const char * client_type, u8 addr, const unsigned short * probe_addrs)

Load an i2c module and return an initialized struct v4l2_subdev.

Parameters

struct v4l2_device * v4l2_dev
pointer to struct v4l2_device
struct i2c_adapter * adapter
pointer to struct i2c_adapter
const char * client_type
name of the chip that’s on the adapter.
u8 addr
I2C address. If zero, it will use probe_addrs
const unsigned short * probe_addrs
array with a list of address. The last entry at such array should be I2C_CLIENT_END.

Description

returns a struct v4l2_subdev pointer.

struct v4l2_subdev * v4l2_i2c_new_subdev_board(struct v4l2_device * v4l2_dev, struct i2c_adapter * adapter, struct i2c_board_info * info, const unsigned short * probe_addrs)

Load an i2c module and return an initialized struct v4l2_subdev.

Parameters

struct v4l2_device * v4l2_dev
pointer to struct v4l2_device
struct i2c_adapter * adapter
pointer to struct i2c_adapter
struct i2c_board_info * info
pointer to struct i2c_board_info used to replace the irq, platform_data and addr arguments.
const unsigned short * probe_addrs
array with a list of address. The last entry at such array should be I2C_CLIENT_END.

Description

returns a struct v4l2_subdev pointer.

void v4l2_i2c_subdev_init(struct v4l2_subdev * sd, struct i2c_client * client, const struct v4l2_subdev_ops * ops)

Initializes a struct v4l2_subdev with data from an i2c_client struct.

Parameters

struct v4l2_subdev * sd
pointer to struct v4l2_subdev
struct i2c_client * client
pointer to struct i2c_client
const struct v4l2_subdev_ops * ops
pointer to struct v4l2_subdev_ops
unsigned short v4l2_i2c_subdev_addr(struct v4l2_subdev * sd)

returns i2c client address of struct v4l2_subdev.

Parameters

struct v4l2_subdev * sd
pointer to struct v4l2_subdev

Description

Returns the address of an I2C sub-device

enum v4l2_i2c_tuner_type

specifies the range of tuner address that should be used when seeking for I2C devices.

Constants

ADDRS_RADIO
Radio tuner addresses. Represent the following I2C addresses: 0x10 (if compiled with tea5761 support) and 0x60.
ADDRS_DEMOD
Demod tuner addresses. Represent the following I2C addresses: 0x42, 0x43, 0x4a and 0x4b.
ADDRS_TV
TV tuner addresses. Represent the following I2C addresses: 0x42, 0x43, 0x4a, 0x4b, 0x60, 0x61, 0x62, 0x63 and 0x64.
ADDRS_TV_WITH_DEMOD
TV tuner addresses if demod is present, this excludes addresses used by the demodulator from the list of candidates. Represent the following I2C addresses: 0x60, 0x61, 0x62, 0x63 and 0x64.

NOTE

All I2C addresses above use the 7-bit notation.

const unsigned short * v4l2_i2c_tuner_addrs(enum v4l2_i2c_tuner_type type)

Return a list of I2C tuner addresses to probe.

Parameters

enum v4l2_i2c_tuner_type type
type of the tuner to seek, as defined by enum v4l2_i2c_tuner_type.

NOTE

Use only if the tuner addresses are unknown.

struct v4l2_subdev * v4l2_spi_new_subdev(struct v4l2_device * v4l2_dev, struct spi_master * master, struct spi_board_info * info)

Load an spi module and return an initialized struct v4l2_subdev.

Parameters

struct v4l2_device * v4l2_dev
pointer to struct v4l2_device.
struct spi_master * master
pointer to struct spi_master.
struct spi_board_info * info
pointer to struct spi_board_info.

Description

returns a struct v4l2_subdev pointer.

void v4l2_spi_subdev_init(struct v4l2_subdev * sd, struct spi_device * spi, const struct v4l2_subdev_ops * ops)

Initialize a v4l2_subdev with data from an spi_device struct.

Parameters

struct v4l2_subdev * sd
pointer to struct v4l2_subdev
struct spi_device * spi
pointer to struct spi_device.
const struct v4l2_subdev_ops * ops
pointer to struct v4l2_subdev_ops
void v4l_bound_align_image(unsigned int * width, unsigned int wmin, unsigned int wmax, unsigned int walign, unsigned int * height, unsigned int hmin, unsigned int hmax, unsigned int halign, unsigned int salign)

adjust video dimensions according to a given constraints.

Parameters

unsigned int * width
pointer to width that will be adjusted if needed.
unsigned int wmin
minimum width.
unsigned int wmax
maximum width.
unsigned int walign
least significant bit on width.
unsigned int * height
pointer to height that will be adjusted if needed.
unsigned int hmin
minimum height.
unsigned int hmax
maximum height.
unsigned int halign
least significant bit on width.
unsigned int salign
least significant bit for the image size (e. g.

System Message: WARNING/2 (width * height)

latex exited with error [stdout] This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2011/06/27> Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, lo aded. (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls Document Class: article 2007/10/19 v1.4h Standard LaTeX document class (/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo)) (/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty (/usr/share/texlive/texmf-dist/tex/latex/ucs/utf8x.def)) (/usr/share/texlive/texmf-dist/tex/latex/ucs/ucs.sty (/usr/share/texlive/texmf-dist/tex/latex/ucs/data/uni-global.def)) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?’ option. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amscls/amsthm.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty)) ! LaTeX Error: File `anyfontsize.sty’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: sty) Enter file name: ! Emergency stop. <read *> l.9 \usepackage {bm}^^M No pages of output. Transcript written on math.log.
).

Description

Clip an image to have width between wmin and wmax, and height between hmin and hmax, inclusive.

Additionally, the width will be a multiple of

System Message: WARNING/2 (2^{walign})

latex exited with error [stdout] This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2011/06/27> Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, lo aded. (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls Document Class: article 2007/10/19 v1.4h Standard LaTeX document class (/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo)) (/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty (/usr/share/texlive/texmf-dist/tex/latex/ucs/utf8x.def)) (/usr/share/texlive/texmf-dist/tex/latex/ucs/ucs.sty (/usr/share/texlive/texmf-dist/tex/latex/ucs/data/uni-global.def)) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?’ option. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amscls/amsthm.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty)) ! LaTeX Error: File `anyfontsize.sty’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: sty) Enter file name: ! Emergency stop. <read *> l.9 \usepackage {bm}^^M No pages of output. Transcript written on math.log.
, the height will be a multiple of

System Message: WARNING/2 (2^{halign})

latex exited with error [stdout] This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2011/06/27> Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, lo aded. (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls Document Class: article 2007/10/19 v1.4h Standard LaTeX document class (/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo)) (/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty (/usr/share/texlive/texmf-dist/tex/latex/ucs/utf8x.def)) (/usr/share/texlive/texmf-dist/tex/latex/ucs/ucs.sty (/usr/share/texlive/texmf-dist/tex/latex/ucs/data/uni-global.def)) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?’ option. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amscls/amsthm.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty)) ! LaTeX Error: File `anyfontsize.sty’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: sty) Enter file name: ! Emergency stop. <read *> l.9 \usepackage {bm}^^M No pages of output. Transcript written on math.log.
, and the overall size

System Message: WARNING/2 (width * height)

latex exited with error [stdout] This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2011/06/27> Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, lo aded. (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls Document Class: article 2007/10/19 v1.4h Standard LaTeX document class (/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo)) (/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty (/usr/share/texlive/texmf-dist/tex/latex/ucs/utf8x.def)) (/usr/share/texlive/texmf-dist/tex/latex/ucs/ucs.sty (/usr/share/texlive/texmf-dist/tex/latex/ucs/data/uni-global.def)) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?’ option. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amscls/amsthm.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty)) ! LaTeX Error: File `anyfontsize.sty’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: sty) Enter file name: ! Emergency stop. <read *> l.9 \usepackage {bm}^^M No pages of output. Transcript written on math.log.
will be a multiple of

System Message: WARNING/2 (2^{salign})

latex exited with error [stdout] This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2011/06/27> Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, lo aded. (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls Document Class: article 2007/10/19 v1.4h Standard LaTeX document class (/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo)) (/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty (/usr/share/texlive/texmf-dist/tex/latex/ucs/utf8x.def)) (/usr/share/texlive/texmf-dist/tex/latex/ucs/ucs.sty (/usr/share/texlive/texmf-dist/tex/latex/ucs/data/uni-global.def)) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?’ option. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amscls/amsthm.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty)) ! LaTeX Error: File `anyfontsize.sty’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: sty) Enter file name: ! Emergency stop. <read *> l.9 \usepackage {bm}^^M No pages of output. Transcript written on math.log.
.

Note

  1. The clipping rectangle may be shrunk or enlarged to fit the alignment constraints.
  2. wmax must not be smaller than wmin.
  3. hmax must not be smaller than hmin.
  4. The alignments must not be so high there are no possible image sizes within the allowed bounds.
  5. wmin and hmin must be at least 1 (don’t use 0).
  6. For walign, halign and salign, if you don’t care about a certain alignment, specify 0, as

    System Message: WARNING/2 (2^0 = 1)

    latex exited with error [stdout] This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2011/06/27> Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, lo aded. (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls Document Class: article 2007/10/19 v1.4h Standard LaTeX document class (/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo)) (/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty (/usr/share/texlive/texmf-dist/tex/latex/ucs/utf8x.def)) (/usr/share/texlive/texmf-dist/tex/latex/ucs/ucs.sty (/usr/share/texlive/texmf-dist/tex/latex/ucs/data/uni-global.def)) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?’ option. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amscls/amsthm.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty)) ! LaTeX Error: File `anyfontsize.sty’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: sty) Enter file name: ! Emergency stop. <read *> l.9 \usepackage {bm}^^M No pages of output. Transcript written on math.log.
    and one byte alignment is equivalent to no alignment.
  7. If you only want to adjust downward, specify a maximum that’s the same as the initial value.
const struct v4l2_frmsize_discrete * v4l2_find_nearest_format(const struct v4l2_frmsize_discrete * sizes, const size_t num_sizes, s32 width, s32 height)

find the nearest format size among a discrete set of resolutions.

Parameters

const struct v4l2_frmsize_discrete * sizes
array of struct v4l2_frmsize_discrete image sizes.
const size_t num_sizes
length of sizes array.
s32 width
desired width.
s32 height
desired height.

Description

Finds the closest resolution to minimize the width and height differences between what requested and the supported resolutions.

void v4l2_get_timestamp(struct timeval * tv)

helper routine to get a timestamp to be used when filling streaming metadata. Internally, it uses ktime_get_ts(), which is the recommended way to get it.

Parameters

struct timeval * tv
pointer to struct timeval to be filled.
struct v4l2_ioctl_ops

describe operations for each V4L2 ioctl

Definition

struct v4l2_ioctl_ops {
  int (*vidioc_querycap)(struct file *file, void *fh, struct v4l2_capability *cap);
  int (*vidioc_enum_fmt_vid_cap)(struct file *file, void *fh, struct v4l2_fmtdesc *f);
  int (*vidioc_enum_fmt_vid_overlay)(struct file *file, void *fh, struct v4l2_fmtdesc *f);
  int (*vidioc_enum_fmt_vid_out)(struct file *file, void *fh, struct v4l2_fmtdesc *f);
  int (*vidioc_enum_fmt_vid_cap_mplane)(struct file *file, void *fh, struct v4l2_fmtdesc *f);
  int (*vidioc_enum_fmt_vid_out_mplane)(struct file *file, void *fh, struct v4l2_fmtdesc *f);
  int (*vidioc_enum_fmt_sdr_cap)(struct file *file, void *fh, struct v4l2_fmtdesc *f);
  int (*vidioc_enum_fmt_sdr_out)(struct file *file, void *fh, struct v4l2_fmtdesc *f);
  int (*vidioc_enum_fmt_meta_cap)(struct file *file, void *fh, struct v4l2_fmtdesc *f);
  int (*vidioc_g_fmt_vid_cap)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_g_fmt_vid_overlay)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_g_fmt_vid_out)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_g_fmt_vid_out_overlay)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_g_fmt_vbi_cap)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_g_fmt_vbi_out)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_g_fmt_sliced_vbi_cap)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_g_fmt_sliced_vbi_out)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_g_fmt_vid_cap_mplane)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_g_fmt_vid_out_mplane)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_g_fmt_sdr_cap)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_g_fmt_sdr_out)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_g_fmt_meta_cap)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_s_fmt_vid_cap)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_s_fmt_vid_overlay)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_s_fmt_vid_out)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_s_fmt_vid_out_overlay)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_s_fmt_vbi_cap)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_s_fmt_vbi_out)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_s_fmt_sliced_vbi_cap)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_s_fmt_sliced_vbi_out)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_s_fmt_vid_cap_mplane)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_s_fmt_vid_out_mplane)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_s_fmt_sdr_cap)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_s_fmt_sdr_out)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_s_fmt_meta_cap)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_try_fmt_vid_cap)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_try_fmt_vid_overlay)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_try_fmt_vid_out)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_try_fmt_vid_out_overlay)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_try_fmt_vbi_cap)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_try_fmt_vbi_out)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_try_fmt_sliced_vbi_cap)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_try_fmt_sliced_vbi_out)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_try_fmt_vid_cap_mplane)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_try_fmt_vid_out_mplane)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_try_fmt_sdr_cap)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_try_fmt_sdr_out)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_try_fmt_meta_cap)(struct file *file, void *fh, struct v4l2_format *f);
  int (*vidioc_reqbufs)(struct file *file, void *fh, struct v4l2_requestbuffers *b);
  int (*vidioc_querybuf)(struct file *file, void *fh, struct v4l2_buffer *b);
  int (*vidioc_qbuf)(struct file *file, void *fh, struct v4l2_buffer *b);
  int (*vidioc_expbuf)(struct file *file, void *fh, struct v4l2_exportbuffer *e);
  int (*vidioc_dqbuf)(struct file *file, void *fh, struct v4l2_buffer *b);
  int (*vidioc_create_bufs)(struct file *file, void *fh, struct v4l2_create_buffers *b);
  int (*vidioc_prepare_buf)(struct file *file, void *fh, struct v4l2_buffer *b);
  int (*vidioc_overlay)(struct file *file, void *fh, unsigned int i);
  int (*vidioc_g_fbuf)(struct file *file, void *fh, struct v4l2_framebuffer *a);
  int (*vidioc_s_fbuf)(struct file *file, void *fh, const struct v4l2_framebuffer *a);
  int (*vidioc_streamon)(struct file *file, void *fh, enum v4l2_buf_type i);
  int (*vidioc_streamoff)(struct file *file, void *fh, enum v4l2_buf_type i);
  int (*vidioc_g_std)(struct file *file, void *fh, v4l2_std_id *norm);
  int (*vidioc_s_std)(struct file *file, void *fh, v4l2_std_id norm);
  int (*vidioc_querystd)(struct file *file, void *fh, v4l2_std_id *a);
  int (*vidioc_enum_input)(struct file *file, void *fh, struct v4l2_input *inp);
  int (*vidioc_g_input)(struct file *file, void *fh, unsigned int *i);
  int (*vidioc_s_input)(struct file *file, void *fh, unsigned int i);
  int (*vidioc_enum_output)(struct file *file, void *fh, struct v4l2_output *a);
  int (*vidioc_g_output)(struct file *file, void *fh, unsigned int *i);
  int (*vidioc_s_output)(struct file *file, void *fh, unsigned int i);
  int (*vidioc_queryctrl)(struct file *file, void *fh, struct v4l2_queryctrl *a);
  int (*vidioc_query_ext_ctrl)(struct file *file, void *fh, struct v4l2_query_ext_ctrl *a);
  int (*vidioc_g_ctrl)(struct file *file, void *fh, struct v4l2_control *a);
  int (*vidioc_s_ctrl)(struct file *file, void *fh, struct v4l2_control *a);
  int (*vidioc_g_ext_ctrls)(struct file *file, void *fh, struct v4l2_ext_controls *a);
  int (*vidioc_s_ext_ctrls)(struct file *file, void *fh, struct v4l2_ext_controls *a);
  int (*vidioc_try_ext_ctrls)(struct file *file, void *fh, struct v4l2_ext_controls *a);
  int (*vidioc_querymenu)(struct file *file, void *fh, struct v4l2_querymenu *a);
  int (*vidioc_enumaudio)(struct file *file, void *fh, struct v4l2_audio *a);
  int (*vidioc_g_audio)(struct file *file, void *fh, struct v4l2_audio *a);
  int (*vidioc_s_audio)(struct file *file, void *fh, const struct v4l2_audio *a);
  int (*vidioc_enumaudout)(struct file *file, void *fh, struct v4l2_audioout *a);
  int (*vidioc_g_audout)(struct file *file, void *fh, struct v4l2_audioout *a);
  int (*vidioc_s_audout)(struct file *file, void *fh, const struct v4l2_audioout *a);
  int (*vidioc_g_modulator)(struct file *file, void *fh, struct v4l2_modulator *a);
  int (*vidioc_s_modulator)(struct file *file, void *fh, const struct v4l2_modulator *a);
  int (*vidioc_cropcap)(struct file *file, void *fh, struct v4l2_cropcap *a);
  int (*vidioc_g_crop)(struct file *file, void *fh, struct v4l2_crop *a);
  int (*vidioc_s_crop)(struct file *file, void *fh, const struct v4l2_crop *a);
  int (*vidioc_g_selection)(struct file *file, void *fh, struct v4l2_selection *s);
  int (*vidioc_s_selection)(struct file *file, void *fh, struct v4l2_selection *s);
  int (*vidioc_g_jpegcomp)(struct file *file, void *fh, struct v4l2_jpegcompression *a);
  int (*vidioc_s_jpegcomp)(struct file *file, void *fh, const struct v4l2_jpegcompression *a);
  int (*vidioc_g_enc_index)(struct file *file, void *fh, struct v4l2_enc_idx *a);
  int (*vidioc_encoder_cmd)(struct file *file, void *fh, struct v4l2_encoder_cmd *a);
  int (*vidioc_try_encoder_cmd)(struct file *file, void *fh, struct v4l2_encoder_cmd *a);
  int (*vidioc_decoder_cmd)(struct file *file, void *fh, struct v4l2_decoder_cmd *a);
  int (*vidioc_try_decoder_cmd)(struct file *file, void *fh, struct v4l2_decoder_cmd *a);
  int (*vidioc_g_parm)(struct file *file, void *fh, struct v4l2_streamparm *a);
  int (*vidioc_s_parm)(struct file *file, void *fh, struct v4l2_streamparm *a);
  int (*vidioc_g_tuner)(struct file *file, void *fh, struct v4l2_tuner *a);
  int (*vidioc_s_tuner)(struct file *file, void *fh, const struct v4l2_tuner *a);
  int (*vidioc_g_frequency)(struct file *file, void *fh, struct v4l2_frequency *a);
  int (*vidioc_s_frequency)(struct file *file, void *fh, const struct v4l2_frequency *a);
  int (*vidioc_enum_freq_bands)(struct file *file, void *fh, struct v4l2_frequency_band *band);
  int (*vidioc_g_sliced_vbi_cap)(struct file *file, void *fh, struct v4l2_sliced_vbi_cap *a);
  int (*vidioc_log_status)(struct file *file, void *fh);
  int (*vidioc_s_hw_freq_seek)(struct file *file, void *fh, const struct v4l2_hw_freq_seek *a);
#ifdef CONFIG_VIDEO_ADV_DEBUG;
  int (*vidioc_g_register)(struct file *file, void *fh, struct v4l2_dbg_register *reg);
  int (*vidioc_s_register)(struct file *file, void *fh, const struct v4l2_dbg_register *reg);
  int (*vidioc_g_chip_info)(struct file *file, void *fh, struct v4l2_dbg_chip_info *chip);
#endif;
  int (*vidioc_enum_framesizes)(struct file *file, void *fh, struct v4l2_frmsizeenum *fsize);
  int (*vidioc_enum_frameintervals)(struct file *file, void *fh, struct v4l2_frmivalenum *fival);
  int (*vidioc_s_dv_timings)(struct file *file, void *fh, struct v4l2_dv_timings *timings);
  int (*vidioc_g_dv_timings)(struct file *file, void *fh, struct v4l2_dv_timings *timings);
  int (*vidioc_query_dv_timings)(struct file *file, void *fh, struct v4l2_dv_timings *timings);
  int (*vidioc_enum_dv_timings)(struct file *file, void *fh, struct v4l2_enum_dv_timings *timings);
  int (*vidioc_dv_timings_cap)(struct file *file, void *fh, struct v4l2_dv_timings_cap *cap);
  int (*vidioc_g_edid)(struct file *file, void *fh, struct v4l2_edid *edid);
  int (*vidioc_s_edid)(struct file *file, void *fh, struct v4l2_edid *edid);
  int (*vidioc_subscribe_event)(struct v4l2_fh *fh, const struct v4l2_event_subscription *sub);
  int (*vidioc_unsubscribe_event)(struct v4l2_fh *fh, const struct v4l2_event_subscription *sub);
  long (*vidioc_default)(struct file *file, void *fh, bool valid_prio, unsigned int cmd, void *arg);
};

Members

vidioc_querycap
pointer to the function that implements VIDIOC_QUERYCAP ioctl
vidioc_enum_fmt_vid_cap
pointer to the function that implements VIDIOC_ENUM_FMT ioctl logic for video capture in single plane mode
vidioc_enum_fmt_vid_overlay
pointer to the function that implements VIDIOC_ENUM_FMT ioctl logic for video overlay
vidioc_enum_fmt_vid_out
pointer to the function that implements VIDIOC_ENUM_FMT ioctl logic for video output in single plane mode
vidioc_enum_fmt_vid_cap_mplane
pointer to the function that implements VIDIOC_ENUM_FMT ioctl logic for video capture in multiplane mode
vidioc_enum_fmt_vid_out_mplane
pointer to the function that implements VIDIOC_ENUM_FMT ioctl logic for video output in multiplane mode
vidioc_enum_fmt_sdr_cap
pointer to the function that implements VIDIOC_ENUM_FMT ioctl logic for Software Defined Radio capture
vidioc_enum_fmt_sdr_out
pointer to the function that implements VIDIOC_ENUM_FMT ioctl logic for Software Defined Radio output
vidioc_enum_fmt_meta_cap
pointer to the function that implements VIDIOC_ENUM_FMT ioctl logic for metadata capture
vidioc_g_fmt_vid_cap
pointer to the function that implements VIDIOC_G_FMT ioctl logic for video capture in single plane mode
vidioc_g_fmt_vid_overlay
pointer to the function that implements VIDIOC_G_FMT ioctl logic for video overlay
vidioc_g_fmt_vid_out
pointer to the function that implements VIDIOC_G_FMT ioctl logic for video out in single plane mode
vidioc_g_fmt_vid_out_overlay
pointer to the function that implements VIDIOC_G_FMT ioctl logic for video overlay output
vidioc_g_fmt_vbi_cap
pointer to the function that implements VIDIOC_G_FMT ioctl logic for raw VBI capture
vidioc_g_fmt_vbi_out
pointer to the function that implements VIDIOC_G_FMT ioctl logic for raw VBI output
vidioc_g_fmt_sliced_vbi_cap
pointer to the function that implements VIDIOC_G_FMT ioctl logic for sliced VBI capture
vidioc_g_fmt_sliced_vbi_out
pointer to the function that implements VIDIOC_G_FMT ioctl logic for sliced VBI output
vidioc_g_fmt_vid_cap_mplane
pointer to the function that implements VIDIOC_G_FMT ioctl logic for video capture in multiple plane mode
vidioc_g_fmt_vid_out_mplane
pointer to the function that implements VIDIOC_G_FMT ioctl logic for video out in multiplane plane mode
vidioc_g_fmt_sdr_cap
pointer to the function that implements VIDIOC_G_FMT ioctl logic for Software Defined Radio capture
vidioc_g_fmt_sdr_out
pointer to the function that implements VIDIOC_G_FMT ioctl logic for Software Defined Radio output
vidioc_g_fmt_meta_cap
pointer to the function that implements VIDIOC_G_FMT ioctl logic for metadata capture
vidioc_s_fmt_vid_cap
pointer to the function that implements VIDIOC_S_FMT ioctl logic for video capture in single plane mode
vidioc_s_fmt_vid_overlay
pointer to the function that implements VIDIOC_S_FMT ioctl logic for video overlay
vidioc_s_fmt_vid_out
pointer to the function that implements VIDIOC_S_FMT ioctl logic for video out in single plane mode
vidioc_s_fmt_vid_out_overlay
pointer to the function that implements VIDIOC_S_FMT ioctl logic for video overlay output
vidioc_s_fmt_vbi_cap
pointer to the function that implements VIDIOC_S_FMT ioctl logic for raw VBI capture
vidioc_s_fmt_vbi_out
pointer to the function that implements VIDIOC_S_FMT ioctl logic for raw VBI output
vidioc_s_fmt_sliced_vbi_cap
pointer to the function that implements VIDIOC_S_FMT ioctl logic for sliced VBI capture
vidioc_s_fmt_sliced_vbi_out
pointer to the function that implements VIDIOC_S_FMT ioctl logic for sliced VBI output
vidioc_s_fmt_vid_cap_mplane
pointer to the function that implements VIDIOC_S_FMT ioctl logic for video capture in multiple plane mode
vidioc_s_fmt_vid_out_mplane
pointer to the function that implements VIDIOC_S_FMT ioctl logic for video out in multiplane plane mode
vidioc_s_fmt_sdr_cap
pointer to the function that implements VIDIOC_S_FMT ioctl logic for Software Defined Radio capture
vidioc_s_fmt_sdr_out
pointer to the function that implements VIDIOC_S_FMT ioctl logic for Software Defined Radio output
vidioc_s_fmt_meta_cap
pointer to the function that implements VIDIOC_S_FMT ioctl logic for metadata capture
vidioc_try_fmt_vid_cap
pointer to the function that implements VIDIOC_TRY_FMT ioctl logic for video capture in single plane mode
vidioc_try_fmt_vid_overlay
pointer to the function that implements VIDIOC_TRY_FMT ioctl logic for video overlay
vidioc_try_fmt_vid_out
pointer to the function that implements VIDIOC_TRY_FMT ioctl logic for video out in single plane mode
vidioc_try_fmt_vid_out_overlay
pointer to the function that implements VIDIOC_TRY_FMT ioctl logic for video overlay output
vidioc_try_fmt_vbi_cap
pointer to the function that implements VIDIOC_TRY_FMT ioctl logic for raw VBI capture
vidioc_try_fmt_vbi_out
pointer to the function that implements VIDIOC_TRY_FMT ioctl logic for raw VBI output
vidioc_try_fmt_sliced_vbi_cap
pointer to the function that implements VIDIOC_TRY_FMT ioctl logic for sliced VBI capture
vidioc_try_fmt_sliced_vbi_out
pointer to the function that implements VIDIOC_TRY_FMT ioctl logic for sliced VBI output
vidioc_try_fmt_vid_cap_mplane
pointer to the function that implements VIDIOC_TRY_FMT ioctl logic for video capture in multiple plane mode
vidioc_try_fmt_vid_out_mplane
pointer to the function that implements VIDIOC_TRY_FMT ioctl logic for video out in multiplane plane mode
vidioc_try_fmt_sdr_cap
pointer to the function that implements VIDIOC_TRY_FMT ioctl logic for Software Defined Radio capture
vidioc_try_fmt_sdr_out
pointer to the function that implements VIDIOC_TRY_FMT ioctl logic for Software Defined Radio output
vidioc_try_fmt_meta_cap
pointer to the function that implements VIDIOC_TRY_FMT ioctl logic for metadata capture
vidioc_reqbufs
pointer to the function that implements VIDIOC_REQBUFS ioctl
vidioc_querybuf
pointer to the function that implements VIDIOC_QUERYBUF ioctl
vidioc_qbuf
pointer to the function that implements VIDIOC_QBUF ioctl
vidioc_expbuf
pointer to the function that implements VIDIOC_EXPBUF ioctl
vidioc_dqbuf
pointer to the function that implements VIDIOC_DQBUF ioctl
vidioc_create_bufs
pointer to the function that implements VIDIOC_CREATE_BUFS ioctl
vidioc_prepare_buf
pointer to the function that implements VIDIOC_PREPARE_BUF ioctl
vidioc_overlay
pointer to the function that implements VIDIOC_OVERLAY ioctl
vidioc_g_fbuf
pointer to the function that implements VIDIOC_G_FBUF ioctl
vidioc_s_fbuf
pointer to the function that implements VIDIOC_S_FBUF ioctl
vidioc_streamon
pointer to the function that implements VIDIOC_STREAMON ioctl
vidioc_streamoff
pointer to the function that implements VIDIOC_STREAMOFF ioctl
vidioc_g_std
pointer to the function that implements VIDIOC_G_STD ioctl
vidioc_s_std
pointer to the function that implements VIDIOC_S_STD ioctl
vidioc_querystd
pointer to the function that implements VIDIOC_QUERYSTD ioctl
vidioc_enum_input
pointer to the function that implements VIDIOC_ENUM_INPUT ioctl
vidioc_g_input
pointer to the function that implements VIDIOC_G_INPUT ioctl
vidioc_s_input
pointer to the function that implements VIDIOC_S_INPUT ioctl
vidioc_enum_output
pointer to the function that implements VIDIOC_ENUM_OUTPUT ioctl
vidioc_g_output
pointer to the function that implements VIDIOC_G_OUTPUT ioctl
vidioc_s_output
pointer to the function that implements VIDIOC_S_OUTPUT ioctl
vidioc_queryctrl
pointer to the function that implements VIDIOC_QUERYCTRL ioctl
vidioc_query_ext_ctrl
pointer to the function that implements VIDIOC_QUERY_EXT_CTRL ioctl
vidioc_g_ctrl
pointer to the function that implements VIDIOC_G_CTRL ioctl
vidioc_s_ctrl
pointer to the function that implements VIDIOC_S_CTRL ioctl
vidioc_g_ext_ctrls
pointer to the function that implements VIDIOC_G_EXT_CTRLS ioctl
vidioc_s_ext_ctrls
pointer to the function that implements VIDIOC_S_EXT_CTRLS ioctl
vidioc_try_ext_ctrls
pointer to the function that implements VIDIOC_TRY_EXT_CTRLS ioctl
vidioc_querymenu
pointer to the function that implements VIDIOC_QUERYMENU ioctl
vidioc_enumaudio
pointer to the function that implements VIDIOC_ENUMAUDIO ioctl
vidioc_g_audio
pointer to the function that implements VIDIOC_G_AUDIO ioctl
vidioc_s_audio
pointer to the function that implements VIDIOC_S_AUDIO ioctl
vidioc_enumaudout
pointer to the function that implements VIDIOC_ENUMAUDOUT ioctl
vidioc_g_audout
pointer to the function that implements VIDIOC_G_AUDOUT ioctl
vidioc_s_audout
pointer to the function that implements VIDIOC_S_AUDOUT ioctl
vidioc_g_modulator
pointer to the function that implements VIDIOC_G_MODULATOR ioctl
vidioc_s_modulator
pointer to the function that implements VIDIOC_S_MODULATOR ioctl
vidioc_cropcap
pointer to the function that implements VIDIOC_CROPCAP ioctl
vidioc_g_crop
pointer to the function that implements VIDIOC_G_CROP ioctl
vidioc_s_crop
pointer to the function that implements VIDIOC_S_CROP ioctl
vidioc_g_selection
pointer to the function that implements VIDIOC_G_SELECTION ioctl
vidioc_s_selection
pointer to the function that implements VIDIOC_S_SELECTION ioctl
vidioc_g_jpegcomp
pointer to the function that implements VIDIOC_G_JPEGCOMP ioctl
vidioc_s_jpegcomp
pointer to the function that implements VIDIOC_S_JPEGCOMP ioctl
vidioc_g_enc_index
pointer to the function that implements VIDIOC_G_ENC_INDEX ioctl
vidioc_encoder_cmd
pointer to the function that implements VIDIOC_ENCODER_CMD ioctl
vidioc_try_encoder_cmd
pointer to the function that implements VIDIOC_TRY_ENCODER_CMD ioctl
vidioc_decoder_cmd
pointer to the function that implements VIDIOC_DECODER_CMD ioctl
vidioc_try_decoder_cmd
pointer to the function that implements VIDIOC_TRY_DECODER_CMD ioctl
vidioc_g_parm
pointer to the function that implements VIDIOC_G_PARM ioctl
vidioc_s_parm
pointer to the function that implements VIDIOC_S_PARM ioctl
vidioc_g_tuner
pointer to the function that implements VIDIOC_G_TUNER ioctl
vidioc_s_tuner
pointer to the function that implements VIDIOC_S_TUNER ioctl
vidioc_g_frequency
pointer to the function that implements VIDIOC_G_FREQUENCY ioctl
vidioc_s_frequency
pointer to the function that implements VIDIOC_S_FREQUENCY ioctl
vidioc_enum_freq_bands
pointer to the function that implements VIDIOC_ENUM_FREQ_BANDS ioctl
vidioc_g_sliced_vbi_cap
pointer to the function that implements VIDIOC_G_SLICED_VBI_CAP ioctl
vidioc_log_status
pointer to the function that implements VIDIOC_LOG_STATUS ioctl
vidioc_s_hw_freq_seek
pointer to the function that implements VIDIOC_S_HW_FREQ_SEEK ioctl
vidioc_g_register
pointer to the function that implements VIDIOC_DBG_G_REGISTER ioctl
vidioc_s_register
pointer to the function that implements VIDIOC_DBG_S_REGISTER ioctl
vidioc_g_chip_info
pointer to the function that implements VIDIOC_DBG_G_CHIP_INFO ioctl
vidioc_enum_framesizes
pointer to the function that implements VIDIOC_ENUM_FRAMESIZES ioctl
vidioc_enum_frameintervals
pointer to the function that implements VIDIOC_ENUM_FRAMEINTERVALS ioctl
vidioc_s_dv_timings
pointer to the function that implements VIDIOC_S_DV_TIMINGS ioctl
vidioc_g_dv_timings
pointer to the function that implements VIDIOC_G_DV_TIMINGS ioctl
vidioc_query_dv_timings
pointer to the function that implements VIDIOC_QUERY_DV_TIMINGS ioctl
vidioc_enum_dv_timings
pointer to the function that implements VIDIOC_ENUM_DV_TIMINGS ioctl
vidioc_dv_timings_cap
pointer to the function that implements VIDIOC_DV_TIMINGS_CAP ioctl
vidioc_g_edid
pointer to the function that implements VIDIOC_G_EDID ioctl
vidioc_s_edid
pointer to the function that implements VIDIOC_S_EDID ioctl
vidioc_subscribe_event
pointer to the function that implements VIDIOC_SUBSCRIBE_EVENT ioctl
vidioc_unsubscribe_event
pointer to the function that implements VIDIOC_UNSUBSCRIBE_EVENT ioctl
vidioc_default
pointed used to allow other ioctls
const char * v4l2_norm_to_name(v4l2_std_id id)

Ancillary routine to analog TV standard name from its ID.

Parameters

v4l2_std_id id
analog TV standard ID.

Return

returns a string with the name of the analog TV standard. If the standard is not found or if id points to multiple standard, it returns “Unknown”.

void v4l2_video_std_frame_period(int id, struct v4l2_fract * frameperiod)

Ancillary routine that fills a struct v4l2_fract pointer with the default framerate fraction.

Parameters

int id
analog TV sdandard ID.
struct v4l2_fract * frameperiod
struct v4l2_fract pointer to be filled
int v4l2_video_std_construct(struct v4l2_standard * vs, int id, const char * name)

Ancillary routine that fills in the fields of a v4l2_standard structure according to the id parameter.

Parameters

struct v4l2_standard * vs
struct v4l2_standard pointer to be filled
int id
analog TV sdandard ID.
const char * name
name of the standard to be used

Description

Note

This ancillary routine is obsolete. Shouldn’t be used on newer drivers.

void v4l_printk_ioctl(const char * prefix, unsigned int cmd)

Ancillary routine that prints the ioctl in a human-readable format.

Parameters

const char * prefix
prefix to be added at the ioctl prints.
unsigned int cmd
ioctl name

Description

Note

If prefix != NULL, then it will issue a printk(KERN_DEBUG "``s: ”, prefix)`` first.

struct mutex * v4l2_ioctl_get_lock(struct video_device * vdev, unsigned int cmd)

get the mutex (if any) that it is need to lock for a given command.

Parameters

struct video_device * vdev
Pointer to struct video_device.
unsigned int cmd
Ioctl name.

Description

Note

Internal use only. Should not be used outside V4L2 core.

long int v4l2_compat_ioctl32(struct file * file, unsigned int cmd, unsigned long arg)

32 Bits compatibility layer for 64 bits processors

Parameters

struct file * file
Pointer to struct file.
unsigned int cmd
Ioctl name.
unsigned long arg
Ioctl argument.
v4l2_kioctl

Typedef: Typedef used to pass an ioctl handler.

Syntax

long v4l2_kioctl (struct file * file, unsigned int cmd, void * arg);

Parameters

struct file * file
Pointer to struct file.
unsigned int cmd
Ioctl name.
void * arg
Ioctl argument.
long int video_usercopy(struct file * file, unsigned int cmd, unsigned long int arg, v4l2_kioctl func)

copies data from/to userspace memory when an ioctl is issued.

Parameters

struct file * file
Pointer to struct file.
unsigned int cmd
Ioctl name.
unsigned long int arg
Ioctl argument.
v4l2_kioctl func
function that will handle the ioctl

Description

Note

This routine should be used only inside the V4L2 core.

long int video_ioctl2(struct file * file, unsigned int cmd, unsigned long int arg)

Handles a V4L2 ioctl.

Parameters

struct file * file
Pointer to struct file.
unsigned int cmd
Ioctl name.
unsigned long int arg
Ioctl argument.

Description

Method used to hancle an ioctl. Should be used to fill the v4l2_ioctl_ops.unlocked_ioctl on all V4L2 drivers.