Appendix B. Common definitions for V4L2 and V4L2 subdev interfaces
Prev | Part I. Video for Linux Two API Specification | Next

## Appendix B. Common definitions for V4L2 and V4L2 subdev interfaces

## Common selection definitions

While the V4L2 selection API and V4L2 subdev selection APIs are very similar, there's one fundamental difference between the two. On sub-device API, the selection rectangle refers to the media bus format, and is bound to a sub-device's pad. On the V4L2 interface the selection rectangles refer to the in-memory pixel format.

This section defines the common definitions of the selection interfaces on the two APIs.

### Selection targets

The precise meaning of the selection targets may be dependent on which of the two interfaces they are used.

Table B.1. Selection target definitions

Target name | id | Definition | Valid for V4L2 | Valid for V4L2 subdev
--- | --- | --- | --- | ---
`V4L2_SEL_TGT_CROP` | 0x0000 | Crop rectangle. Defines the cropped area. | Yes | Yes
`V4L2_SEL_TGT_CROP_DEFAULT` | 0x0001 | Suggested cropping rectangle that covers the "whole picture". | Yes | No
`V4L2_SEL_TGT_CROP_BOUNDS` | 0x0002 | Bounds of the crop rectangle. All valid crop rectangles fit inside the crop bounds rectangle. | Yes | Yes
`V4L2_SEL_TGT_COMPOSE` | 0x0100 | Compose rectangle. Used to configure scaling and composition. | Yes | Yes
`V4L2_SEL_TGT_COMPOSE_DEFAULT` | 0x0101 | Suggested composition rectangle that covers the "whole picture". | Yes | No
`V4L2_SEL_TGT_COMPOSE_BOUNDS` | 0x0102 | Bounds of the compose rectangle. All valid compose rectangles fit inside the compose bounds rectangle. | Yes | Yes
`V4L2_SEL_TGT_COMPOSE_PADDED` | 0x0103 | The active area and all padding pixels that are inserted or modified by hardware. | Yes | No

### Selection flags

Table B.2. Selection flag definitions

Flag name | id | Definition | Valid for V4L2 | Valid for V4L2 subdev
--- | --- | --- | --- | ---
`V4L2_SEL_FLAG_GE` | (1 << 0) | Suggest the driver it should choose greater or equal rectangle (in size) than was requested. Albeit the driver may choose a lesser size, it will only do so due to hardware limitations. Without this flag (and `V4L2_SEL_FLAG_LE`) the behaviour is to choose the closest possible rectangle. | Yes | Yes
`V4L2_SEL_FLAG_LE` | (1 << 1) | Suggest the driver it should choose lesser or equal rectangle (in size) than was requested. Albeit the driver may choose a greater size, it will only do so due to hardware limitations. | Yes | Yes
`V4L2_SEL_FLAG_KEEP_CONFIG` | (1 << 2) | The configuration must not be propagated to any further processing steps. If this flag is not given, the configuration is propagated inside the subdevice to all further processing steps. | No | Yes

Prev | Up | Next
V4L2 write() | Home | Appendix C. Video For Linux Two Header File