include/media/v4l2-common.h
Source file repositories/reference/linux-study-clean/include/media/v4l2-common.h
File Facts
- System
- Linux kernel
- Corpus path
include/media/v4l2-common.h- Extension
.h- Size
- 26162 bytes
- Lines
- 764
- Domain
- Repository Root And Misc
- Bucket
- include
- Inferred role
- Repository Root And Misc: implementation source
- Status
- source implementation candidate
Why This File Exists
Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/time.hmedia/v4l2-dev.hlinux/i2c.hlinux/spi/spi.h
Detected Declarations
struct clkstruct v4l2_devicestruct v4l2_subdevstruct v4l2_subdev_opsstruct v4l2_priv_tun_configstruct v4l2_format_infoenum v4l2_i2c_tuner_typeenum v4l2_pixel_encodingfunction v4l2_i2c_new_subdevfunction v4l2_i2c_new_subdev_boardfunction v4l2_i2c_subdev_set_namefunction v4l2_i2c_tuner_addrsfunction v4l2_i2c_subdev_unregisterfunction v4l2_spi_new_subdevfunction v4l2_spi_subdev_initfunction v4l2_is_format_rgbfunction v4l2_is_format_yuvfunction v4l2_is_format_bayerfunction devm_clk_getfunction devm_v4l2_sensor_clk_getfunction v4l2_buffer_get_timestampfunction v4l2_buffer_set_timestampfunction v4l2_is_colorspace_validfunction v4l2_is_xfer_func_validfunction v4l2_is_ycbcr_enc_validfunction v4l2_is_hsv_enc_validfunction v4l2_is_quant_valid
Annotated Snippet
struct v4l2_priv_tun_config {
int tuner;
void *priv;
};
#define TUNER_SET_CONFIG _IOW('d', 92, struct v4l2_priv_tun_config)
#define VIDIOC_INT_RESET _IOW ('d', 102, u32)
/* ------------------------------------------------------------------------- */
/* Miscellaneous helper functions */
/**
* v4l_bound_align_image - adjust video dimensions according to
* a given constraints.
*
* @width: pointer to width that will be adjusted if needed.
* @wmin: minimum width.
* @wmax: maximum width.
* @walign: least significant bit on width.
* @height: pointer to height that will be adjusted if needed.
* @hmin: minimum height.
* @hmax: maximum height.
* @halign: least significant bit on height.
* @salign: least significant bit for the image size (e. g.
* :math:`width * height`).
*
* 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 :math:`2^{walign}`,
* the @height will be a multiple of :math:`2^{halign}`, and the overall
* size :math:`width * height` will be a multiple of :math:`2^{salign}`.
*
* .. note::
*
* #. The clipping rectangle may be shrunk or enlarged to fit the alignment
* constraints.
* #. @wmax must not be smaller than @wmin.
* #. @hmax must not be smaller than @hmin.
* #. The alignments must not be so high there are no possible image
* sizes within the allowed bounds.
* #. @wmin and @hmin must be at least 1 (don't use 0).
* #. For @walign, @halign and @salign, if you don't care about a certain
* alignment, specify ``0``, as :math:`2^0 = 1` and one byte alignment
* is equivalent to no alignment.
* #. If you only want to adjust downward, specify a maximum that's the
* same as the initial value.
*/
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);
/**
* v4l2_find_nearest_size_conditional - Find the nearest size among a discrete
* set of resolutions contained in an array of a driver specific struct,
* with conditionally exlusion of certain modes
*
* @array: a driver specific array of image sizes
* @array_size: the length of the driver specific array of image sizes
* @width_field: the name of the width field in the driver specific struct
* @height_field: the name of the height field in the driver specific struct
* @width: desired width
* @height: desired height
* @func: ignores mode if returns false
* @context: context for the function
*
* Finds the closest resolution to minimize the width and height differences
* between what requested and the supported resolutions. The size of the width
* and height fields in the driver specific must equal to that of u32, i.e. four
* bytes. @func is called for each mode considered, a mode is ignored if @func
* returns false for it.
*
* Returns the best match or NULL if the length of the array is zero.
*/
#define v4l2_find_nearest_size_conditional(array, array_size, width_field, \
height_field, width, height, \
func, context) \
({ \
BUILD_BUG_ON(sizeof((array)->width_field) != sizeof(u32) || \
sizeof((array)->height_field) != sizeof(u32)); \
(typeof(&(array)[0]))__v4l2_find_nearest_size_conditional( \
(array), array_size, sizeof(*(array)), \
offsetof(typeof(*(array)), width_field), \
offsetof(typeof(*(array)), height_field), \
width, height, func, context); \
})
const void *
Annotation
- Immediate include surface: `linux/time.h`, `media/v4l2-dev.h`, `linux/i2c.h`, `linux/spi/spi.h`.
- Detected declarations: `struct clk`, `struct v4l2_device`, `struct v4l2_subdev`, `struct v4l2_subdev_ops`, `struct v4l2_priv_tun_config`, `struct v4l2_format_info`, `enum v4l2_i2c_tuner_type`, `enum v4l2_pixel_encoding`, `function v4l2_i2c_new_subdev`, `function v4l2_i2c_new_subdev_board`.
- Atlas domain: Repository Root And Misc / include.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.