Skip to content

Commit

Permalink
#3930 use prefixed capability for webcam
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Sep 2, 2023
1 parent 5dd1336 commit 718bc86
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
14 changes: 11 additions & 3 deletions xpra/client/mixins/webcam.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,17 @@ def get_caps(self) -> dict[str,Any]:


def parse_server_capabilities(self, c : typedict) -> bool:
self.server_webcam = c.boolget("webcam")
self.server_webcam_encodings = c.strtupleget("webcam.encodings", ("png", "jpeg"))
self.server_virtual_video_devices = c.intget("virtual-video-devices")
v = c.get("webcam")
if isinstance(v, dict):
cdict = typedict(v)
self.server_webcam = cdict.boolget("enabled")
self.server_webcam_encodings = cdict.strtupleget("encodings", ("png", "jpeg"))
self.server_virtual_video_devices = cdict.intget("devices")
else:
#pre v6 / 5.0.2
self.server_webcam = c.boolget("webcam")
self.server_webcam_encodings = c.strtupleget("webcam.encodings", ("png", "jpeg"))
self.server_virtual_video_devices = c.intget("virtual-video-devices")
log("webcam server support: %s (%i devices, encodings: %s)",
self.server_webcam, self.server_virtual_video_devices, csv(self.server_webcam_encodings))
if self.webcam_forwarding and self.server_webcam and self.server_virtual_video_devices>0:
Expand Down
19 changes: 12 additions & 7 deletions xpra/server/mixins/webcam.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,25 @@ def threaded_setup(self) -> None:

def get_server_features(self, _source) -> dict[str,Any]:
return {
"webcam" : self.webcam_enabled,
"webcam.encodings" : self.webcam_encodings,
"virtual-video-devices" : self.webcam_virtual_video_devices,
}
"webcam" : {
"enabled" : self.webcam_enabled,
"encodings" : self.webcam_encodings,
"devices" : self.webcam_virtual_video_devices,
},
#pre v6, v5.0.2
"webcam.encodings": self.webcam_encodings,
"virtual-video-devices": self.webcam_virtual_video_devices,
}


def get_info(self, _proto) -> dict[str,Any]:
info : dict[str,Any] = {
"" : self.webcam_enabled,
"enabled" : self.webcam_enabled,
}
if self.webcam_enabled:
info.update({
"encodings" : self.webcam_encodings,
"virtual-video-devices" : self.webcam_virtual_video_devices,
"encodings" : self.webcam_encodings,
"devices" : self.webcam_virtual_video_devices,
})
if self.webcam_device:
info["device"] = self.webcam_device
Expand Down

0 comments on commit 718bc86

Please sign in to comment.