diff --git a/xpra/client/mixins/audio.py b/xpra/client/mixins/audio.py index 59866576c3..9c59ddbd73 100644 --- a/xpra/client/mixins/audio.py +++ b/xpra/client/mixins/audio.py @@ -187,12 +187,10 @@ def get_info(self) -> dict[str,Any]: def get_caps(self) -> dict[str,Any]: - d : dict[str,Any] = {} - avcaps = self.get_avsync_capabilities() - acaps = self.get_audio_capabilities() - d["av-sync"] = avcaps - d["audio"] = acaps - return d + return { + "av-sync" : self.get_avsync_capabilities(), + "audio" : self.get_audio_capabilities(), + } def get_audio_capabilities(self) -> dict[str,Any]: if not self.audio_properties: @@ -229,18 +227,13 @@ def get_avsync_capabilities(self) -> dict[str,Any]: def parse_server_capabilities(self, c : typedict) -> bool: self.server_av_sync = c.boolget("av-sync.enabled") avsynclog("av-sync: server=%s, client=%s", self.server_av_sync, self.av_sync) - audio = c.get("audio") - if audio and isinstance(audio, dict): - c = typedict(audio) - prefix = "" - else: - prefix = "sound." - self.server_pulseaudio_id = c.strget(f"{prefix}pulseaudio.id") - self.server_pulseaudio_server = c.strget(f"{prefix}pulseaudio.server") - self.server_audio_decoders = c.strtupleget(f"{prefix}decoders") - self.server_audio_encoders = c.strtupleget(f"{prefix}encoders") - self.server_audio_receive = c.boolget(f"{prefix}receive") - self.server_audio_send = c.boolget(f"{prefix}send") + audio = typedict(c.dictget("audio") or {}) + self.server_pulseaudio_id = audio.strget("pulseaudio.id") + self.server_pulseaudio_server = audio.strget("pulseaudio.server") + self.server_audio_decoders = audio.strtupleget("decoders") + self.server_audio_encoders = audio.strtupleget("encoders") + self.server_audio_receive = audio.boolget("receive") + self.server_audio_send = audio.boolget("send") log("pulseaudio id=%s, server=%s, audio decoders=%s, audio encoders=%s, receive=%s, send=%s", self.server_pulseaudio_id, self.server_pulseaudio_server, csv(self.server_audio_decoders), csv(self.server_audio_encoders), diff --git a/xpra/client/mixins/display.py b/xpra/client/mixins/display.py index 6470eb719e..88927bb424 100644 --- a/xpra/client/mixins/display.py +++ b/xpra/client/mixins/display.py @@ -147,9 +147,13 @@ def get_caps(self) -> dict[str,Any]: monitors = self.get_monitors_info() caps["monitors"] = adjust_monitor_refresh_rate(self.refresh_rate, monitors) caps.update(self.get_screen_caps()) + dpi_caps = self.get_dpi_caps() + caps["dpi"] = dpi_caps + scaling_caps = self.get_scaling_caps() + caps["screen-scaling"] = scaling_caps caps.update(flatten_dict({ - "dpi" : self.get_dpi_caps(), - "screen-scaling" : self.get_scaling_caps(), + "dpi" : dpi_caps, + "screen-scaling" : scaling_caps, })) return caps @@ -201,32 +205,6 @@ def get_screen_caps(self) -> dict[str,Any]: caps["antialias"] = aa return caps - #this is the format we should be moving towards - #with proper namespace: - #def get_info(self) -> dict: - # sinfo = self.get_screen_caps() - # sinfo["scaling"] = self.get_scaling_caps() - # sinfo["dpi"] = self.get_dpi_caps() - # return { - # "desktop" : self.get_desktop_caps(), - # "screen" : sinfo, - # } - - #def get_desktop_info(self): - # caps = { - # "show" : True, - # } - # wm_name = get_wm_name() - # if wm_name: - # caps["wm_name"] = wm_name - # _, _, sss, ndesktops, desktop_names, u_root_w, u_root_h, xdpi, ydpi = self._last_screen_settings - # caps["unscaled-size"] = u_root_w, u_root_h - # caps["size"] = self.cp(u_root_w, u_root_h) - # caps["dpi"] = (xdpi, ydpi) - # caps["count"] = ndesktops - # caps["names"] = desktop_names - # caps["screens"] = len(sss) - def parse_server_capabilities(self, c : typedict) -> bool: self.server_display = c.strget("display") diff --git a/xpra/server/source/audio.py b/xpra/server/source/audio.py index 73ffb491bb..457f798377 100644 --- a/xpra/server/source/audio.py +++ b/xpra/server/source/audio.py @@ -12,7 +12,7 @@ from xpra.server.source.stub_source_mixin import StubSourceMixin from xpra.common import FULL_INFO from xpra.os_util import get_machine_id, get_user_uuid, bytestostr -from xpra.util import csv, envbool, envint, flatten_dict, typedict, first_time, NotificationID +from xpra.util import csv, envbool, envint, typedict, first_time, NotificationID from xpra.log import Logger log = Logger("audio") @@ -110,9 +110,8 @@ def stop_new_stream_notification(self, proc) -> None: def parse_client_caps(self, c:typedict) -> None: self.wants_audio = "audio" in c.strtupleget("wants") - audio = c.dictget("audio") + audio = typedict(c.dictget("audio") or {}) if audio: - audio = typedict(audio) self.pulseaudio_id = audio.strget("pulseaudio.id", "") self.pulseaudio_cookie_hash = audio.strget("pulseaudio.cookie-hash", "") self.pulseaudio_server = audio.strget("pulseaudio.server", "") @@ -120,15 +119,6 @@ def parse_client_caps(self, c:typedict) -> None: self.audio_encoders = audio.strtupleget("encoders", ()) self.audio_receive = audio.boolget("receive") self.audio_send = audio.boolget("send") - else: - #pre v4.4: - self.pulseaudio_id = c.strget("sound.pulseaudio.id", "") - self.pulseaudio_cookie_hash = c.strget("sound.pulseaudio.cookie-hash", "") - self.pulseaudio_server = c.strget("sound.pulseaudio.server", "") - self.audio_decoders = c.strtupleget("sound.decoders", ()) - self.audio_encoders = c.strtupleget("sound.encoders", ()) - self.audio_receive = c.boolget("sound.receive") - self.audio_send = c.boolget("sound.send") log("pulseaudio id=%s, cookie-hash=%s, server=%s, audio decoders=%s, audio encoders=%s, receive=%s, send=%s", self.pulseaudio_id, self.pulseaudio_cookie_hash, self.pulseaudio_server, self.audio_decoders, self.audio_encoders, self.audio_receive, self.audio_send) @@ -149,9 +139,7 @@ def get_caps(self) -> dict[str,Any]: "send" : self.supports_speaker and len(self.speaker_codecs)>0, "receive" : self.supports_microphone and len(self.microphone_codecs)>0, }) - caps = flatten_dict({"sound" : audio_props}) - caps["audio"] = audio_props - return caps + return {"audio" : audio_props} def audio_loop_check(self, mode:str="speaker") -> bool: