From 718bc86b18a0f6cf94a3e79a0e46fe6d31f700fa Mon Sep 17 00:00:00 2001 From: totaam Date: Sat, 2 Sep 2023 23:29:29 +0700 Subject: [PATCH] #3930 use prefixed capability for webcam --- xpra/client/mixins/webcam.py | 14 +++++++++++--- xpra/server/mixins/webcam.py | 19 ++++++++++++------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/xpra/client/mixins/webcam.py b/xpra/client/mixins/webcam.py index 84d8ed1ec5..bce3e24d3f 100644 --- a/xpra/client/mixins/webcam.py +++ b/xpra/client/mixins/webcam.py @@ -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: diff --git a/xpra/server/mixins/webcam.py b/xpra/server/mixins/webcam.py index f27e601172..55e2c7423a 100644 --- a/xpra/server/mixins/webcam.py +++ b/xpra/server/mixins/webcam.py @@ -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