Documentation/userspace-api/media/v4l/standard.rst
Source file repositories/reference/linux-study-clean/Documentation/userspace-api/media/v4l/standard.rst
File Facts
- System
- Linux kernel
- Corpus path
Documentation/userspace-api/media/v4l/standard.rst- Extension
.rst- Size
- 5967 bytes
- Lines
- 187
- Domain
- Support Tooling And Documentation
- Bucket
- Documentation
- Inferred role
- Support Tooling And Documentation: documentation
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
if (-1 == ioctl(fd, VIDIOC_G_STD, &std_id)) {
/* Note when VIDIOC_ENUMSTD always returns ENOTTY this
is no video device or it falls under the USB exception,
and VIDIOC_G_STD returning ENOTTY is no error. */
perror("VIDIOC_G_STD");
exit(EXIT_FAILURE);
}
memset(&standard, 0, sizeof(standard));
standard.index = 0;
while (0 == ioctl(fd, VIDIOC_ENUMSTD, &standard)) {
if (standard.id & std_id) {
printf("Current video standard: %s\\n", standard.name);
exit(EXIT_SUCCESS);
}
standard.index++;
}
/* EINVAL indicates the end of the enumeration, which cannot be
empty unless this device falls under the USB exception. */
if (errno == EINVAL || standard.index == 0) {
perror("VIDIOC_ENUMSTD");
exit(EXIT_FAILURE);
}
Example: Listing the video standards supported by the current input
===================================================================
.. code-block:: c
struct v4l2_input input;
struct v4l2_standard standard;
memset(&input, 0, sizeof(input));
if (-1 == ioctl(fd, VIDIOC_G_INPUT, &input.index)) {
perror("VIDIOC_G_INPUT");
exit(EXIT_FAILURE);
}
if (-1 == ioctl(fd, VIDIOC_ENUMINPUT, &input)) {
perror("VIDIOC_ENUM_INPUT");
exit(EXIT_FAILURE);
}
printf("Current input %s supports:\\n", input.name);
memset(&standard, 0, sizeof(standard));
standard.index = 0;
while (0 == ioctl(fd, VIDIOC_ENUMSTD, &standard)) {
if (standard.id & input.std)
printf("%s\\n", standard.name);
standard.index++;
}
/* EINVAL indicates the end of the enumeration, which cannot be
empty unless this device falls under the USB exception. */
if (errno != EINVAL || standard.index == 0) {
perror("VIDIOC_ENUMSTD");
exit(EXIT_FAILURE);
}
Example: Selecting a new video standard
Annotation
- Atlas domain: Support Tooling And Documentation / Documentation.
- Implementation status: atlas-only.
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.