mirror of
https://github.com/taigrr/vidnumerator.git
synced 2026-04-01 20:58:51 -07:00
update readme
This commit is contained in:
2
LICENSE
2
LICENSE
@@ -1,4 +1,4 @@
|
|||||||
Copyright (C) 2023 by Tai Groot <tai@taigrr.com>
|
Copyright (C) 2023-2025 by Tai Groot <tai@taigrr.com>
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
purpose with or without fee is hereby granted.
|
purpose with or without fee is hereby granted.
|
||||||
|
|||||||
26
README.md
26
README.md
@@ -6,3 +6,29 @@ The list of strings returned are the full filepaths to valid devices.
|
|||||||
|
|
||||||
>[!IMPORTANT]
|
>[!IMPORTANT]
|
||||||
>In order for this library to work properly, the executing user must have either root or video group privileges
|
>In order for this library to work properly, the executing user must have either root or video group privileges
|
||||||
|
|
||||||
|
## Technical Details
|
||||||
|
|
||||||
|
The library works by:
|
||||||
|
|
||||||
|
1. Scanning `/dev` for files matching the pattern `video*`
|
||||||
|
2. Using the `VIDIOC_QUERYCAP` ioctl to check if each device is a video capture device
|
||||||
|
3. Filtering out non-capture devices (like metadata control handles)
|
||||||
|
|
||||||
|
The core functionality is implemented through direct syscalls to the Linux kernel's V4L2 (Video4Linux2) API. The library uses the `VIDIOC_QUERYCAP` ioctl command to query device capabilities and determine if a device supports video capture.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```go
|
||||||
|
devices, err := vidnumerator.EnumeratedVideoDevices()
|
||||||
|
if err != nil {
|
||||||
|
// handle error
|
||||||
|
}
|
||||||
|
// devices will contain paths like "/dev/video0", "/dev/video2", etc.
|
||||||
|
```
|
||||||
|
|
||||||
|
## Implementation Notes
|
||||||
|
|
||||||
|
- Uses direct syscalls via `golang.org/x/sys/unix`
|
||||||
|
- Implements custom ioctl constants for V4L2 device querying
|
||||||
|
- Checks for specific device capabilities (0x4200001) to identify capture devices
|
||||||
|
|||||||
Reference in New Issue
Block a user