Skip to content

Commit ad5dfb4

Browse files
authored
Merge pull request #866 from ejoerns/topic/hd-2mp-webcam
Add Support for "HD 2MP WEBCAM" to USBVideoDriver
2 parents 8fdc22c + 254defe commit ad5dfb4

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

doc/configuration.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2239,9 +2239,12 @@ Arguments:
22392239
Although the driver can be used from Python code by calling the `stream()`
22402240
method, it is currently mainly useful for the ``video`` subcommand of
22412241
``labgrid-client``.
2242-
It supports the `Logitech HD Pro Webcam C920` with the USB ID 046d:082d, but
2243-
other cameras can be added to `get_qualities()` in
2242+
It supports the `Logitech HD Pro Webcam C920` with the USB ID 046d:082d and a
2243+
few others.
2244+
More cameras can be added to `get_qualities()` and `get_pipeline()` in
22442245
``labgrid/driver/usbvideodriver.py``.
2246+
Appropriate configuration parameters can be determined by using the GStreamer
2247+
``gst-device-monitor-1.0`` command line utility.
22452248

22462249
USBAudioInputDriver
22472250
~~~~~~~~~~~~~~~~~~~

labgrid/driver/usbvideodriver.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ def get_qualities(self):
4040
("mid", "image/jpeg,width=1280,height=720,framerate=10/1"),
4141
("high", "image/jpeg,width=1920,height=1080,framerate=10/1"),
4242
])
43+
if match == (0x1d6c, 0x0103): # HD 2MP WEBCAM
44+
return ("mid", [
45+
("low", "video/x-h264,width=640,height=480,framerate=25/1"),
46+
("mid", "video/x-h264,width=1280,height=720,framerate=25/1"),
47+
("high", "video/x-h264,width=1920,height=1080,framerate=25/1"),
48+
])
4349
raise InvalidConfigError("Unknown USB video device {:04x}:{:04x}".format(*match))
4450

4551
def select_caps(self, hint=None):
@@ -65,6 +71,9 @@ def get_pipeline(self, path, caps, controls=None):
6571
inner = None
6672
elif match == (0x534d, 0x2109):
6773
inner = None # just forward the jpeg frames
74+
elif match == (0x1d6c, 0x0103):
75+
controls = controls or "focus_auto=1"
76+
inner = "h264parse"
6877
else:
6978
raise InvalidConfigError("Unknown USB video device {:04x}:{:04x}".format(*match))
7079

0 commit comments

Comments
 (0)