Skip to content

Commit 70525a3

Browse files
jluebbeEmantor
authored andcommitted
driver/usbvideodriver: use elif if a sequence of conditions
Only one of these can match anyway, so using 'if' is just confusing. Signed-off-by: Jan Luebbe <[email protected]>
1 parent 71bfcd2 commit 70525a3

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

labgrid/driver/usbvideodriver.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,43 +27,43 @@ def get_qualities(self):
2727
("mid", "video/x-h264,width=1280,height=720,framerate=15/2"),
2828
("high", "video/x-h264,width=1920,height=1080,framerate=10/1"),
2929
])
30-
if match == (0x046d, 0x0892):
30+
elif match == (0x046d, 0x0892):
3131
return ("mid", [
3232
("low", "image/jpeg,width=640,height=360,framerate=5/1"),
3333
("mid", "image/jpeg,width=1280,height=720,framerate=15/2"),
3434
("high", "image/jpeg,width=1920,height=1080,framerate=10/1"),
3535
])
36-
if match == (0x046d, 0x08e5): # Logitech HD Pro Webcam C920
36+
elif match == (0x046d, 0x08e5): # Logitech HD Pro Webcam C920
3737
return ("mid", [
3838
("low", "image/jpeg,width=640,height=360,framerate=5/1"),
3939
("mid", "image/jpeg,width=1280,height=720,framerate=15/2"),
4040
("high", "image/jpeg,width=1920,height=1080,framerate=10/1"),
4141
])
42-
if match == (0x1224, 0x2825): # LogiLink UA0371
42+
elif match == (0x1224, 0x2825): # LogiLink UA0371
4343
return ("mid", [
4444
("low", "image/jpeg,width=640,height=480,framerate=30/1"),
4545
("mid", "image/jpeg,width=1280,height=720,framerate=30/1"),
4646
("high", "image/jpeg,width=1920,height=1080,framerate=30/1"),
4747
])
48-
if match == (0x05a3, 0x9331): # WansView Webcam 102
48+
elif match == (0x05a3, 0x9331): # WansView Webcam 102
4949
return ("mid", [
5050
("low","video/x-h264,width=640,height=360,framerate=30/1"),
5151
("mid","video/x-h264,width=1280,height=720,framerate=30/1"),
5252
("high","video/x-h264,width=1920,height=1080,framerate=30/1"),
5353
])
54-
if match == (0x534d, 0x2109): # MacroSilicon
54+
elif match == (0x534d, 0x2109): # MacroSilicon
5555
return ("mid", [
5656
("low", "image/jpeg,width=720,height=480,framerate=10/1"),
5757
("mid", "image/jpeg,width=1280,height=720,framerate=10/1"),
5858
("high", "image/jpeg,width=1920,height=1080,framerate=10/1"),
5959
])
60-
if match == (0x1d6c, 0x0103): # HD 2MP WEBCAM
60+
elif match == (0x1d6c, 0x0103): # HD 2MP WEBCAM
6161
return ("mid", [
6262
("low", "video/x-h264,width=640,height=480,framerate=25/1"),
6363
("mid", "video/x-h264,width=1280,height=720,framerate=25/1"),
6464
("high", "video/x-h264,width=1920,height=1080,framerate=25/1"),
6565
])
66-
if match == (0x0c45, 0x636d): # AUKEY PC-LM1E
66+
elif match == (0x0c45, 0x636d): # AUKEY PC-LM1E
6767
return ("mid", [
6868
("low", "image/jpeg,width=640,height=480,pixel-aspect-ratio=1/1,framerate=30/1"),
6969
("mid", "image/jpeg,width=864,height=480,pixel-aspect-ratio=1/1,framerate=30/1"),
@@ -130,8 +130,7 @@ def stream(self, caps_hint=None, controls=None):
130130

131131
tx_cmd = self.video.command_prefix + ["gst-launch-1.0", "-q"]
132132
tx_cmd += pipeline.split()
133-
rx_cmd = ["gst-launch-1.0"]
134-
rx_cmd += "playbin3 buffer-duration=0 uri=fd://0".split()
133+
rx_cmd = ["gst-launch-1.0", "playbin3", "buffer-duration=0", "uri=fd://0"]
135134

136135
tx = subprocess.Popen(
137136
tx_cmd,

0 commit comments

Comments
 (0)