Skip to content

Commit

Permalink
webcam: ignore fractional FPS
Browse files Browse the repository at this point in the history
Those aren't supported here, so ignore them explicitly, instead of
falling back into noisy catch-all statement.
  • Loading branch information
marmarek committed Oct 8, 2024
1 parent f205b3d commit 69a1bcb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sender/webcam.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ def parameters(self):
interval_re = re.compile(
rb"\t\t\tInterval: Discrete [0-9.]+s \([0-9]+\.0+ fps\)\Z"
)
frac_interval_re = re.compile(
rb"\t\t\tInterval: Discrete [0-9.]+s \([0-9]+\.0*[1-9][0-9]* fps\)\Z"
)
proc = subprocess.run(
("v4l2-ctl", "--list-formats-ext"),
stdout=subprocess.PIPE,
Expand All @@ -86,6 +89,9 @@ def parameters(self):
elif interval_re.match(i):
fps = int(i[22:].split(b"(", 1)[1].split(b".", 1)[0])
formats.append((width, height, fps, {"fmt": fmt}))
elif frac_interval_re.match(i):
# factional FPS not supported
continue
elif i in (
b"",
b"ioctl: VIDIOC_ENUM_FMT",
Expand Down

0 comments on commit 69a1bcb

Please sign in to comment.