Skip to content

Commit

Permalink
#3835 add 'audio=on|off'
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Apr 24, 2023
1 parent 0998d7e commit 301c5ae
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 14 deletions.
3 changes: 3 additions & 0 deletions fs/etc/xpra/conf.d/20_sound.conf.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
################################################################################
# Sound

# This option can disable all audio related features:
audio = yes

# Forward sound output to clients:
#speaker = off
#speaker = disabled
Expand Down
5 changes: 4 additions & 1 deletion xpra/scripts/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,7 @@ def may_create_user_config(xpra_conf_filename=DEFAULT_XPRA_CONF_FILENAME):
"debug" : str,
"input-method" : str,
"video-scaling" : str,
"audio" : bool,
"microphone" : str,
"speaker" : str,
"sound-source" : str,
Expand Down Expand Up @@ -728,6 +729,7 @@ def may_create_user_config(xpra_conf_filename=DEFAULT_XPRA_CONF_FILENAME):
"refresh-rate",
"exit-with-windows",
"bind-quic",
"audio",
]
OPTIONS_COMPAT_NAMES = {
"--compression_level=" : "-z"
Expand Down Expand Up @@ -788,7 +790,7 @@ def may_create_user_config(xpra_conf_filename=DEFAULT_XPRA_CONF_FILENAME):
"title", "session-name",
"clipboard", "clipboard-direction", "clipboard-filter-file",
"input-method",
"microphone", "speaker", "sound-source", "pulseaudio",
"audio", "microphone", "speaker", "sound-source", "pulseaudio",
"idle-timeout", "server-idle-timeout",
"use-display",
"fake-xinerama", "resize-display", "dpi", "pixel-depth",
Expand Down Expand Up @@ -1053,6 +1055,7 @@ def get_defaults():
"dbus-proxy" : not OSX and not WIN32,
"mmap" : "yes",
"mmap-group" : "auto",
"audio" : True,
"speaker" : ["disabled", "on"][has_sound_support() and not is_arm()],
"microphone" : ["disabled", "off"][has_sound_support()],
"video-scaling" : "auto",
Expand Down
2 changes: 1 addition & 1 deletion xpra/scripts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1724,7 +1724,7 @@ def impcheck(*modules):
from xpra.client.gui import mixin_features
mixin_features.display = opts.windows
mixin_features.windows = opts.windows
mixin_features.audio = (bo(opts.speaker) or bo(opts.microphone)) and impcheck("sound")
mixin_features.audio = b(opts.audio) and (bo(opts.speaker) or bo(opts.microphone)) and impcheck("sound")
mixin_features.webcam = bo(opts.webcam) and impcheck("codecs")
mixin_features.clipboard = b(opts.clipboard) and impcheck("clipboard")
mixin_features.notifications = opts.notifications and impcheck("notifications")
Expand Down
33 changes: 22 additions & 11 deletions xpra/scripts/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1092,19 +1092,8 @@ def dcsv(v):
group.add_option("--mdns", action="store", metavar="yes|no",
dest="mdns", default=defaults.mdns,
help="Publish the session information via mDNS. Default: %s." % enabled_str(defaults.mdns))
legacy_bool_parse("pulseaudio")
legacy_bool_parse("dbus-proxy")
legacy_bool_parse("dbus-control")
group.add_option("--pulseaudio", action="store", metavar="yes|no|auto",
dest="pulseaudio", default=defaults.pulseaudio,
help="Start a pulseaudio server for the session."
+" Default: %s." % enabled_or_auto(defaults.pulseaudio))
group.add_option("--pulseaudio-command", action="store",
dest="pulseaudio_command", default=defaults.pulseaudio_command,
help="The command used to start the pulseaudio server. Default: '%default'.")
group.add_option("--pulseaudio-configure-commands", action="append",
dest="pulseaudio_configure_commands", default=defaults.pulseaudio_configure_commands,
help="The commands used to configure the pulseaudio server. Default: '%default'.")
group.add_option("--dbus-proxy", action="store", metavar="yes|no",
dest="dbus_proxy", default=defaults.dbus_proxy,
help="Forward dbus calls from the client. Default: %s." % enabled_str(defaults.dbus_proxy))
Expand Down Expand Up @@ -1191,9 +1180,30 @@ def dcsv(v):
dest="remote_logging", default=defaults.remote_logging,
help="Forward all the client's log output to the server. "
+" Default: %s." % enabled_str(defaults.remote_logging))

group = optparse.OptionGroup(parser, "Audio Options",
"These options be specified on the client or on the server, "
"but the server's settings will have precedence over the client's.")
parser.add_option_group(group)
legacy_bool_parse("audio")
legacy_bool_parse("pulseaudio")
legacy_bool_parse("speaker")
legacy_bool_parse("microphone")
legacy_bool_parse("av-sync")
group.add_option("--audio", action="store", metavar="yes|no",
dest="audio", default=defaults.audio,
help="Enable or disable all audio support."
+" Default: %s." % enabled_str(defaults.audio))
group.add_option("--pulseaudio", action="store", metavar="yes|no|auto",
dest="pulseaudio", default=defaults.pulseaudio,
help="Start a pulseaudio server for the session."
+" Default: %s." % enabled_or_auto(defaults.pulseaudio))
group.add_option("--pulseaudio-command", action="store",
dest="pulseaudio_command", default=defaults.pulseaudio_command,
help="The command used to start the pulseaudio server. Default: '%default'.")
group.add_option("--pulseaudio-configure-commands", action="append",
dest="pulseaudio_configure_commands", default=defaults.pulseaudio_configure_commands,
help="The commands used to configure the pulseaudio server. Default: '%default'.")
group.add_option("--speaker", action="store", metavar="on|off|disabled",
dest="speaker", default=defaults.speaker,
help="Forward sound output to the client(s). Default: %s." % sound_option(defaults.speaker))
Expand All @@ -1218,6 +1228,7 @@ def dcsv(v):
group.add_option("--av-sync", action="store",
dest="av_sync", default=defaults.av_sync,
help="Try to synchronize sound and video. Default: %s." % enabled_str(defaults.av_sync))

group = optparse.OptionGroup(parser, "Encoding and Compression Options",
"These options are used by the client to specify the desired picture and network data compression."
"They may also be specified on the server as default settings.")
Expand Down
2 changes: 1 addition & 1 deletion xpra/scripts/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def impcheck(*modules):
server_features.notifications = opts.notifications and impcheck("notifications")
server_features.webcam = b(opts.webcam) and impcheck("codecs")
server_features.clipboard = b(opts.clipboard) and impcheck("clipboard")
server_features.audio = (b(opts.speaker) or b(opts.microphone)) and impcheck("sound")
server_features.audio = b(opts.audio) and impcheck("sound")
server_features.av_sync = server_features.audio and b(opts.av_sync)
server_features.fileprint = b(opts.printing) or b(opts.file_transfer)
server_features.mmap = b(opts.mmap)
Expand Down

0 comments on commit 301c5ae

Please sign in to comment.