Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* let the users choose the decoders enabled via the command line or config file
* add "all" and "none" special keywords

git-svn-id: https://xpra.org/svn/Xpra/trunk@6966 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Jul 27, 2014
1 parent a3116ed commit 22160f9
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 17 deletions.
19 changes: 19 additions & 0 deletions src/etc/xpra/xpra.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,25 @@ pings = no
#encoding = rgb
#encoding = webp

# Used by the server to encode video:
# video-encoders = x264, vpx, nvenc
# video-encoders = none
# video-encoders = all
video-encoders = all

# Used by both the client and server for colourspace conversion:
# csc-modules = swscale, cython, opencl
# csc-modules = none
# csc-modules = all
video-encoders = all

# Used the client for decoding:
# video-decoders = avcodec2, vpx
# video-decoders = avcodec, vpx
# video-decoders = none
# video-decoders = all
video-decoders = all

# Use fixed quality
# (value is a percentage or "auto"):
#quality = 80
Expand Down
4 changes: 2 additions & 2 deletions src/xpra/client/ui_client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from xpra.platform.gui import init as gui_init, ready as gui_ready, get_native_notifier_classes, get_native_tray_classes, get_native_system_tray_classes, get_native_tray_menu_helper_classes, ClientExtras
from xpra.codecs.codec_constants import get_PIL_decodings
from xpra.codecs.loader import codec_versions, has_codec, get_codec, PREFERED_ENCODING_ORDER, ALL_NEW_ENCODING_NAMES_TO_OLD, OLD_ENCODING_NAMES_TO_NEW
from xpra.codecs.video_helper import getVideoHelper, ALL_VIDEO_DECODER_OPTIONS, NO_GFX_CSC_OPTIONS
from xpra.codecs.video_helper import getVideoHelper, NO_GFX_CSC_OPTIONS
from xpra.simple_stats import std_unit
from xpra.net import compression, packet_encoding
from xpra.daemon_thread import make_daemon_thread
Expand Down Expand Up @@ -250,7 +250,7 @@ def init(self, opts):
#until we add the ability to choose decoders, use all of them:
#(and default to non grahics card csc modules if not specified)
vh = getVideoHelper()
vh.set_modules(video_decoders=ALL_VIDEO_DECODER_OPTIONS, csc_modules=opts.csc_modules or NO_GFX_CSC_OPTIONS)
vh.set_modules(video_decoders=opts.video_decoders, csc_modules=opts.csc_modules or NO_GFX_CSC_OPTIONS)
vh.init()


Expand Down
6 changes: 4 additions & 2 deletions src/xpra/scripts/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ def read_xpra_defaults(conf_dir=DEFAULT_XPRA_CONF_DIR):
#arrays of strings (default value, allowed options):
"video-encoders" : list,
"csc-modules" : list,
"video-decoders" : list,
"speaker-codec" : list,
"microphone-codec" : list,
"compressors" : list,
Expand Down Expand Up @@ -385,8 +386,9 @@ def get_defaults():
"opengl" : OPENGL_DEFAULT,
"mdns" : os.name=="posix" and not sys.platform.startswith("darwin"),
"swap-keys" : sys.platform.startswith("darwin"), #only used on osx
"video-encoders" : [],
"csc-modules" : [],
"video-encoders" : ["all"],
"csc-modules" : ["all"],
"video-decoders" : ["all"],
"speaker-codec" : [],
"microphone-codec" : [],
"compressors" : [],
Expand Down
45 changes: 32 additions & 13 deletions src/xpra/scripts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,9 @@ def parse_cmdline(cmdline):
group.add_option("--csc-modules", action="store",
dest="csc_modules", default=defaults.csc_modules,
help="Specify which colourspace conversion modules to enable, to get a list of all the options specify 'help' (default: %default)")
group.add_option("--video-decoders", action="store",
dest="video_decoders", default=defaults.video_decoders,
help="Specify which video decoders to enable, to get a list of all the options specify 'help'")
group.add_option("--min-quality", action="store",
metavar="MIN-LEVEL",
dest="min_quality", type="int", default=defaults.min_quality,
Expand Down Expand Up @@ -547,26 +550,42 @@ def parse_cmdline(cmdline):
if not [x for x in pe_map.keys() if getattr(packet_encoding, "use_%s" % x)]:
parser.error("at least one valid packet encoder must be enabled")

#special case for video encoders and csc, stored as lists, but command line option is a CSV string:
#special case for video encoders/decoders and csc, stored as lists, but command line option is a CSV string:
from xpra.codecs.video_helper import ALL_VIDEO_ENCODER_OPTIONS as aveco
from xpra.codecs.video_helper import ALL_CSC_MODULE_OPTIONS as acsco
from xpra.codecs.video_helper import ALL_VIDEO_DECODER_OPTIONS as avedo
if (supports_server or supports_shadow):
if type(options.video_encoders)==str:
if options.video_encoders=="help":
from xpra.codecs.video_helper import ALL_VIDEO_ENCODER_OPTIONS as aveco
vestr = options.video_encoders.strip().lower()
if vestr=="help":
print("the following video encoders may be available: %s" % ", ".join(aveco))
sys.exit(0)
elif options.video_encoders=="none":
options.video_encoders = []
else:
options.video_encoders = [x.strip() for x in options.video_encoders.split(",")]
options.video_encoders = [x.strip() for x in vestr.split(",")]
if type(options.csc_modules)==str:
if options.csc_modules=="help":
from xpra.codecs.video_helper import ALL_CSC_MODULE_OPTIONS as acsco
cscstr = options.csc_modules.strip().lower()
if cscstr=="help":
print("the following csc modules may be available: %s" % ", ".join(acsco))
sys.exit(0)
elif options.csc_modules=="none":
options.csc_modules = []
else:
options.csc_modules = [x.strip() for x in options.csc_modules.split(",")]
options.csc_modules = [x.strip() for x in cscstr.split(",")]
if type(options.video_decoders)==str:
vdstr = options.video_decoders.strip().lower()
if vdstr=="help":
print("the following video decoders may be available: %s" % ", ".join(avedo))
sys.exit(0)
options.video_decoders = [x.strip() for x in vdstr.split(",")]

if options.video_encoders==["none"]:
options.video_encoders = []
elif options.video_encoders==["all"]:
options.video_encoders = aveco
if options.csc_modules==["none"]:
options.csc_modules = []
elif options.csc_modules==["all"]:
options.csc_modules = acsco
if options.video_decoders==["none"]:
options.video_decoders = []
elif options.video_decoders==["all"]:
options.video_decoders = avedo

#special handling for URL mode:
#xpra attach xpra://[mode:]host:port/?param1=value1&param2=value2
Expand Down

0 comments on commit 22160f9

Please sign in to comment.