v4l: get_device_format: Do not fail on devices with exotic numerator - #244
Open
curtisy1 wants to merge 1 commit into
Open
v4l: get_device_format: Do not fail on devices with exotic numerator#244curtisy1 wants to merge 1 commit into
curtisy1 wants to merge 1 commit into
Conversation
On Asahi Linux, get_device_format currently fails because `params.interval.numerator` is 256 instead of 1.
This causes the check to fail early even though the frame rate is a whole number. The second check `params.interval.denominator % params.interval.numerator != 0` would yield true but is currently never reached.
Change the condition from `or` to `and` so that v4l devices reporting a numerator > 1 still fail if framerate is not a whole number but succeed if it is.
Output of `v4l2-ctl --all`
```
Driver Info:
Driver name : apple-isp
Card type : FaceTime HD Camera
Bus info : platform:384000000.isp
Driver version : 6.19.14
Capabilities : 0x84200001
Video Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format
Priority: 2
Video input : 0 (apple-isp: ok)
Format Video Capture:
Width/Height : 1920/1080
Pixel Format : 'NV12' (Y/UV 4:2:0)
Field : None
Bytes per Line : 1920
Size Image : 3110400
Colorspace : Rec. 709
Transfer Function : Rec. 709
YCbCr/HSV Encoding: Rec. 709
Quantization : Default (maps to Limited Range)
Flags :
Streaming Parameters Video Capture:
Capabilities : timeperframe
Frames per second: 30.000 (7680/256)
Read buffers : 2
```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Asahi Linux, get_device_format currently fails because
params.interval.numeratoris 256 instead of 1. This causes the check to fail early even though the frame rate is a whole number. The second checkparams.interval.denominator % params.interval.numerator != 0would yield true but is currently never reached.Change the condition from
ortoandso that v4l devices reporting a numerator > 1 still fail if framerate is not a whole number but succeed if it is.Output of
v4l2-ctl --all