From 5043af02f93e8dc0232b83c9d72770aced8c569b Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Mon, 4 Jan 2016 10:52:07 +0000 Subject: [PATCH] #1041: * add a "--minimal" build option to turn most things off by default * use this minimal build for the "Sound" sub-application installation (had to keep "gtk3" and "client" to avoid weird errors) * move gobject signal import code around so we can init sound without having the gtk bits installed * if the "Sound" subapp is installed, prefer it to the GStreamer 0.10 bundled in the main directory * default to GStreamer 1.x on win32 (means all platforms now) git-svn-id: https://xpra.org/svn/Xpra/trunk@11579 3bb7dfac-3a0b-4e04-842a-767bc560f471 --- src/setup.py | 206 +++++++++++++++------------- src/win32/BUILD.BAT | 4 +- src/win32/PY27_MSVC_BUILD.BAT | 7 +- src/xpra/gtk_common/gobject_util.py | 12 +- src/xpra/gtk_common/gtk_util.py | 2 - src/xpra/platform/win32/paths.py | 7 + src/xpra/sound/gstreamer_util.py | 17 ++- src/xpra/sound/sink.py | 3 +- src/xpra/sound/sound_pipeline.py | 6 +- src/xpra/sound/src.py | 4 +- 10 files changed, 154 insertions(+), 114 deletions(-) diff --git a/src/setup.py b/src/setup.py index e1b803508e..89adfedb36 100755 --- a/src/setup.py +++ b/src/setup.py @@ -109,37 +109,42 @@ def is_msvc(): #ugly: assume we want to use visual studio if we find the env var: return os.environ.get("VCINSTALLDIR") is not None +DEFAULT = True +if "--minimal" in sys.argv: + sys.argv.remove("--minimal") + DEFAULT = False + from xpra.platform.features import LOCAL_SERVERS_SUPPORTED, SHADOW_SUPPORTED -shadow_ENABLED = SHADOW_SUPPORTED and not PYTHON3 #shadow servers use some GTK2 code.. -server_ENABLED = (LOCAL_SERVERS_SUPPORTED or shadow_ENABLED) and not PYTHON3 -client_ENABLED = True - -x11_ENABLED = not WIN32 and not OSX -dbus_ENABLED = x11_ENABLED -gtk_x11_ENABLED = not WIN32 and not OSX -gtk2_ENABLED = client_ENABLED and not PYTHON3 -gtk3_ENABLED = PYTHON3 -opengl_ENABLED = client_ENABLED -html5_ENABLED = not WIN32 and not OSX - -bencode_ENABLED = True -cython_bencode_ENABLED = True -clipboard_ENABLED = not PYTHON3 +shadow_ENABLED = SHADOW_SUPPORTED and not PYTHON3 and DEFAULT #shadow servers use some GTK2 code.. +server_ENABLED = (LOCAL_SERVERS_SUPPORTED or shadow_ENABLED) and not PYTHON3 and DEFAULT +client_ENABLED = DEFAULT + +x11_ENABLED = DEFAULT and not WIN32 and not OSX +dbus_ENABLED = DEFAULT and x11_ENABLED +gtk_x11_ENABLED = DEFAULT and not WIN32 and not OSX +gtk2_ENABLED = DEFAULT and client_ENABLED and not PYTHON3 +gtk3_ENABLED = DEFAULT and PYTHON3 +opengl_ENABLED = DEFAULT and client_ENABLED +html5_ENABLED = DEFAULT and not WIN32 and not OSX + +bencode_ENABLED = DEFAULT +cython_bencode_ENABLED = DEFAULT +clipboard_ENABLED = DEFAULT and not PYTHON3 Xdummy_ENABLED = None #None means auto-detect Xdummy_wrapper_ENABLED = None #None means auto-detect if WIN32 or OSX: Xdummy_ENABLED = False -sound_ENABLED = True -printing_ENABLED = True - -enc_proxy_ENABLED = True -enc_x264_ENABLED = True #too important to detect -enc_x265_ENABLED = pkg_config_ok("--exists", "x265") -pillow_ENABLED = True -webp_ENABLED = pkg_config_ok("--atleast-version=0.3", "libwebp", fallback=WIN32) -vpx_ENABLED = pkg_config_ok("--atleast-version=1.0", "vpx", fallback=WIN32) or pkg_config_ok("--atleast-version=1.0", "libvpx", fallback=WIN32) +sound_ENABLED = DEFAULT +printing_ENABLED = DEFAULT + +enc_proxy_ENABLED = DEFAULT +enc_x264_ENABLED = DEFAULT #too important to detect +enc_x265_ENABLED = DEFAULT and pkg_config_ok("--exists", "x265") +pillow_ENABLED = DEFAULT +webp_ENABLED = DEFAULT and pkg_config_ok("--atleast-version=0.3", "libwebp", fallback=WIN32) +vpx_ENABLED = DEFAULT and (pkg_config_ok("--atleast-version=1.0", "vpx", fallback=WIN32) or pkg_config_ok("--atleast-version=1.0", "libvpx", fallback=WIN32)) #ffmpeg 2 onwards: -dec_avcodec2_ENABLED = pkg_config_ok("--atleast-version=55", "libavcodec", fallback=WIN32) +dec_avcodec2_ENABLED = DEFAULT and pkg_config_ok("--atleast-version=55", "libavcodec", fallback=WIN32) # some version strings I found: # Fedora: # * 19: 54.92.100 @@ -149,8 +154,8 @@ def is_msvc(): # * jessie and sid: (last updated 2014-05-26): 55.34.1 # (moved to ffmpeg2 style buffer API sometime in early 2014) # * wheezy: 53.35 -csc_swscale_ENABLED = pkg_config_ok("--exists", "libswscale", fallback=WIN32) -csc_cython_ENABLED = True +csc_swscale_ENABLED = DEFAULT and pkg_config_ok("--exists", "libswscale", fallback=WIN32) +csc_cython_ENABLED = DEFAULT if WIN32: WIN32_BUILD_LIB_PREFIX = os.environ.get("XPRA_WIN32_BUILD_LIB_PREFIX", "C:\\") nvenc4_sdk = WIN32_BUILD_LIB_PREFIX + "nvenc_4.0.0_sdk" @@ -161,17 +166,18 @@ def is_msvc(): import pycuda except: pycuda = None - nvenc4_ENABLED = pycuda and os.path.exists(nvenc4_sdk) and is_msvc() - nvenc5_ENABLED = pycuda and os.path.exists(nvenc5_sdk) and is_msvc() - nvenc6_ENABLED = pycuda and os.path.exists(nvenc6_sdk) and is_msvc() + nvenc4_ENABLED = DEFAULT and pycuda and os.path.exists(nvenc4_sdk) and is_msvc() + nvenc5_ENABLED = DEFAULT and pycuda and os.path.exists(nvenc5_sdk) and is_msvc() + nvenc6_ENABLED = DEFAULT and pycuda and os.path.exists(nvenc6_sdk) and is_msvc() else: - nvenc4_ENABLED = pkg_config_ok("--exists", "nvenc4") - nvenc5_ENABLED = pkg_config_ok("--exists", "nvenc5") - nvenc6_ENABLED = pkg_config_ok("--exists", "nvenc6") + nvenc4_ENABLED = DEFAULT and pkg_config_ok("--exists", "nvenc4") + nvenc5_ENABLED = DEFAULT and pkg_config_ok("--exists", "nvenc5") + nvenc6_ENABLED = DEFAULT and pkg_config_ok("--exists", "nvenc6") -csc_opencl_ENABLED = pkg_config_ok("--exists", "OpenCL") and check_pyopencl_AMD() +csc_opencl_ENABLED = DEFAULT and pkg_config_ok("--exists", "OpenCL") and check_pyopencl_AMD() memoryview_ENABLED = sys.version>='2.7' +#Cython / gcc / packagingt build options: annotate_ENABLED = True warn_ENABLED = True strict_ENABLED = True @@ -259,9 +265,9 @@ def is_msvc(): exit(1) if client_ENABLED and not gtk2_ENABLED and not gtk3_ENABLED: print("Warning: client is enabled but none of the client toolkits are!?") - if not client_ENABLED and not server_ENABLED: + if DEFAULT and (not client_ENABLED and not server_ENABLED): print("Warning: you probably want to build at least the client or server!") - if not pillow_ENABLED: + if DEFAULT and not pillow_ENABLED: print("Warning: including Python Pillow is VERY STRONGLY recommended") if memoryview_ENABLED and sys.version<"2.7": print("Error: memoryview support requires Python version 2.7 or greater") @@ -271,11 +277,15 @@ def is_msvc(): #******************************************************************************* # default sets: -external_includes = ["Crypto", "Crypto.Cipher", - "hashlib", +external_includes = ["hashlib", "ctypes", "platform"] +if DEFAULT: + external_includes += ["Crypto", "Crypto.Cipher"] +else: + excludes += ["Crypto", "Crypto.Cipher"] -if gtk3_ENABLED: + +if gtk3_ENABLED or (sound_ENABLED and PYTHON3): external_includes += ["gi"] elif gtk2_ENABLED or x11_ENABLED: external_includes += "cairo", "pango", "pangocairo", "atk", "glib", "gobject", "gio", "gtk.keysyms" @@ -294,7 +304,10 @@ def is_msvc(): "cookielib", "BaseHTTPServer", "ftplib", "httplib", "fileinput", "distutils", "setuptools", "doctest" ] - +if not client_ENABLED and not server_ENABLED: + excludes += ["PIL"] +if not dbus_ENABLED: + excludes += ["dbus"] #because of differences in how we specify packages and modules @@ -1186,26 +1199,28 @@ def do_add_DLLs(*dll_names): print(" - lib%s*.dll" % x) add_data_files("", [os.path.join(gnome_include_path, dll) for dll in dll_files]) - #list of DLLs we want to include, without the "lib" prefix, or the version and extension #(ie: "libatk-1.0-0.dll" -> "atk") - add_DLLs('atk', 'cairo-gobject', - 'dbus', 'dbus-glib', - 'gdk', 'gdk_pixbuf', 'gtk', - 'jasper', "epoxy", "harfbuzz", "tiff", - 'gio', 'stdc++', 'girepository', 'glib', - 'gnutls', 'gobject', 'gthread', - 'harfbuzz-gobject', - 'intl', 'jpeg', 'orc', - 'p11-kit', 'proxy', - 'pango', 'pangocairo', 'pangoft2', 'pangowin32', - 'png16', - 'rsvg', 'webp', - 'winpthread', - 'zzz') - #these are missing in newer aio installers (sigh): - do_add_DLLs('javascriptcoregtk', - 'gdkglext', 'gtkglext') + if sound_ENABLED or gtk3_ENABLED: + add_DLLs('gio', 'girepository', 'glib', + 'gnutls', 'gobject', 'gthread', + 'orc', 'stdc++', + 'proxy', + 'winpthread', + 'zzz') + if gtk3_ENABLED: + add_DLLs('atk', + 'dbus', 'dbus-glib', + 'gdk', 'gdk_pixbuf', 'gtk', + 'cairo-gobject', 'pango', 'pangocairo', 'pangoft2', 'pangowin32', + 'harfbuzz', 'harfbuzz-gobject', + 'jasper', 'epoxy', + 'intl', + 'p11-kit', + 'jpeg', 'png16', 'rsvg', 'webp', 'tiff') + #these are missing in newer aio installers (sigh): + do_add_DLLs('javascriptcoregtk', + 'gdkglext', 'gtkglext') if os.environ.get("VCINSTALLDIR"): #Visual Studio may link our avcodec2 module against libiconv... do_add_DLLs("iconv") @@ -1213,27 +1228,30 @@ def do_add_DLLs(*dll_names): #ie: libpyglib-gi-2.0-python34 # pyglib-gi-2.0-python%s%s' % (sys.version_info[0], sys.version_info[1]) - add_dir('etc', ["fonts", "gtk-3.0", "pango", "pkcs11"]) #add "dbus-1"? - add_dir('lib', ["gdk-pixbuf-2.0", "gio", "gtk-3.0", - "libvisual-0.4", "p11-kit", "pkcs11"]) - add_dir('share', ["fontconfig", "fonts", "glib-2.0", #add "dbus-1"? - "icons", "p11-kit", "xml", - {"locale" : ["en"]}, - {"themes" : ["Default"]} - ]) - #FIXME: remove version from those filenames: - add_gi("Atk-1.0", "cairo-1.0", "fontconfig-2.0", - "freetype2-2.0", "GDesktopEnums-3.0", - "Gdk-3.0", - "GdkGLExt-3.0", "GtkGLExt-3.0", - "GdkPixbuf-2.0", - "Gio-2.0", "GIRepository-2.0", - "GL-1.0", "Glib-2.0", "GModule-2.0", - "GObject-2.0", - "Gtk-3.0", "HarfBuzz-0.0", - "Libproxy-1.0", "libxml2-2.0", - "Pango-1.0", "PangoCairo-1.0", "PangoFT2-1.0", - "Rsvg-2.0", "win32-1.0") + if gtk3_ENABLED: + add_dir('etc', ["fonts", "gtk-3.0", "pango", "pkcs11"]) #add "dbus-1"? + add_dir('lib', ["gdk-pixbuf-2.0", "gtk-3.0", + "libvisual-0.4", "p11-kit", "pkcs11"]) + add_dir('share', ["fontconfig", "fonts", "glib-2.0", #add "dbus-1"? + "icons", "p11-kit", "xml", + {"locale" : ["en"]}, + {"themes" : ["Default"]} + ]) + if gtk3_ENABLED or sound_ENABLED: + add_dir('lib', ["gio"]) + packages.append("gi") + add_gi("Gio-2.0", "GIRepository-2.0", "Glib-2.0", "GModule-2.0", + "GObject-2.0", "win32-1.0") + if gtk3_ENABLED: + add_gi("Atk-1.0", + "fontconfig-2.0", "freetype2-2.0", + "GDesktopEnums-3.0", + "GdkGLExt-3.0", "GtkGLExt-3.0", "GL-1.0", + "GdkPixbuf-2.0", "Gdk-3.0", "Gtk-3.0" + "HarfBuzz-0.0", + "Libproxy-1.0", "libxml2-2.0", + "cairo-1.0", "Pango-1.0", "PangoCairo-1.0", "PangoFT2-1.0", + "Rsvg-2.0") if sound_ENABLED: add_dir("share", ["gst-plugins-bad", "gst-plugins-base", "gstreamer-1.0"]) @@ -1260,12 +1278,12 @@ def do_add_DLLs(*dll_names): add_dir(os.path.join("lib", "gstreamer-1.0"), [("libgst%s.dll" % x) for x in GST_PLUGINS]) #END OF SOUND - #pillow needs urllib: - external_excludes.remove("urllib") - #pillow links against zlib, but expects the DLL to be named z.dll: - data_files.append((os.path.join(gnome_include_path, "libzzz.dll"), "z.dll")) + if client_ENABLED or sound_ENABLED: + #pillow needs urllib: + external_excludes.remove("urllib") + #pillow links against zlib, but expects the DLL to be named z.dll: + data_files.append((os.path.join(gnome_include_path, "libzzz.dll"), "z.dll")) - packages.append("gi") #I am reluctant to add these to py2exe because it figures it out already: external_includes += ["encodings", "multiprocessing", ] #ensure that cx_freeze won't automatically grab other versions that may lay on our path: @@ -1406,24 +1424,28 @@ def add_gui_exe(*args): #UI applications (detached from shell: no text output if ran from cmd.exe) add_gui_exe("scripts/xpra", "xpra_txt.ico", "Xpra") - add_gui_exe("xpra/gtk_common/gtk_view_keyboard.py", "keyboard.ico", "GTK_Keyboard_Test") + if DEFAULT: + add_gui_exe("scripts/xpra_launcher", "xpra.ico", "Xpra-Launcher") + add_gui_exe("xpra/gtk_common/gtk_view_keyboard.py", "keyboard.ico", "GTK_Keyboard_Test") add_gui_exe("xpra/scripts/bug_report.py", "bugs.ico", "Bug_Report") - add_gui_exe("scripts/xpra_launcher", "xpra.ico", "Xpra-Launcher") - if not PYTHON3: + if gtk2_ENABLED: #these need porting.. add_gui_exe("xpra/gtk_common/gtk_view_clipboard.py","clipboard.ico", "GTK_Clipboard_Test") #Console: provide an Xpra_cmd.exe we can run from the cmd.exe shell add_console_exe("scripts/xpra", "xpra_txt.ico", "Xpra_cmd") + add_console_exe("win32/python_execfile.py", "python.ico", "Python_execfile") add_console_exe("xpra/scripts/version.py", "information.ico", "Version_info") add_console_exe("xpra/scripts/config.py", "gears.ico", "Config_info") add_console_exe("xpra/net/net_util.py", "network.ico", "Network_info") - add_console_exe("xpra/scripts/gtk_info.py", "gtk.ico", "GTK_info") - add_console_exe("xpra/gtk_common/keymap.py", "keymap.ico", "Keymap_info") - add_console_exe("win32/python_execfile.py", "python.ico", "Python_execfile") - add_console_exe("xpra/codecs/loader.py", "encoding.ico", "Encoding_info") + if gtk2_ENABLED or gtk3_ENABLED: + add_console_exe("xpra/scripts/gtk_info.py", "gtk.ico", "GTK_info") + add_console_exe("xpra/gtk_common/keymap.py", "keymap.ico", "Keymap_info") + if client_ENABLED: + add_console_exe("xpra/codecs/loader.py", "encoding.ico", "Encoding_info") add_console_exe("xpra/platform/paths.py", "directory.ico", "Path_info") add_console_exe("xpra/platform/features.py", "features.ico", "Feature_info") - add_console_exe("xpra/platform/gui.py", "browse.ico", "NativeGUI_info") + if client_ENABLED: + add_console_exe("xpra/platform/gui.py", "browse.ico", "NativeGUI_info") if sound_ENABLED: add_console_exe("xpra/sound/gstreamer_util.py", "gstreamer.ico", "GStreamer_info") add_console_exe("xpra/sound/src.py", "microphone.ico", "Sound_Record") diff --git a/src/win32/BUILD.BAT b/src/win32/BUILD.BAT index 96c056d5f1..4de52b103a 100644 --- a/src/win32/BUILD.BAT +++ b/src/win32/BUILD.BAT @@ -27,7 +27,7 @@ SET EXTRA_VERSION= FOR /F "delims=" %%i IN ('%PYTHON_EXE% -c "import sys;print(sys.version_info.major)"') DO set PYTHON_MAJOR_VERSION=%%i FOR /F "delims=" %%i IN ('%PYTHON_EXE% -c "import sys;print(sys.version_info.minor)"') DO set PYTHON_MINOR_VERSION=%%i -ECHO Found Python version %PYTHON_MAJOR_VERSION%.%PYTHON_MINOR_VERSION% +ECHO Found Python version %PYTHON_MAJOR_VERSION%.%PYTHON_MINOR_VERSION% REM "FLAGS TO DISABLE / ENABLE FEATURES" SET SHOW_DEPENDENCIES=0 @@ -41,7 +41,7 @@ if "%DO_BUILD%"=="1" ( SET VERSION=ERROR FOR /F "delims=" %%i IN ('%PYTHON_EXE% -c "from xpra import __version__;print(__version__)"') DO set VERSION=%%i -ECHO Building Xpra Version %VERSION% +ECHO Building Xpra version %VERSION% SET SVNVERSION=ERROR FOR /F "delims=" %%i IN ('%SVNVERSION_EXE% -n ..') DO set SVNVERSION=%%i ECHO Found svnversion %SVNVERSION% diff --git a/src/win32/PY27_MSVC_BUILD.BAT b/src/win32/PY27_MSVC_BUILD.BAT index ee07729440..b83d56738f 100644 --- a/src/win32/PY27_MSVC_BUILD.BAT +++ b/src/win32/PY27_MSVC_BUILD.BAT @@ -11,7 +11,10 @@ SET PYTHON=C:\Python27 SET BUILD_ARGS= SET COMPILER_ARGS=--compiler=msvc SET DIST=dist -SET BUNDLE_GSTREAMER1=0 +SET BUNDLE_GSTREAMER1=1 + +RMDIR /S /Q %DIST% +MKDIR %DIST% CALL win32\BUILD.BAT if %ERRORLEVEL% NEQ 0 ( @@ -35,7 +38,7 @@ if "%BUNDLE_GSTREAMER1%"=="1" ( SET CL_VERSION=2010 SET PYTHON=C:\Python34 SET DIST=dist\Sound - SET BUILD_ARGS=--minimal --with-bencode --with-cython_bencode --with-sound + SET BUILD_ARGS=--minimal --with-bencode --with-cython_bencode --with-sound --with-gtk3 --with-client CALL win32\BUILD.BAT if %ERRORLEVEL% NEQ 0 ( ECHO "build error, see output above" diff --git a/src/xpra/gtk_common/gobject_util.py b/src/xpra/gtk_common/gobject_util.py index fa8fb1c5ad..7de4b72b8c 100644 --- a/src/xpra/gtk_common/gobject_util.py +++ b/src/xpra/gtk_common/gobject_util.py @@ -4,14 +4,16 @@ # Xpra is released under the terms of the GNU GPL v2, or, at your option, any # later version. See the file COPYING for details. + from xpra.gtk_common.gobject_compat import import_gobject gobject = import_gobject() - - +gobject.threads_init() +try: + SIGNAL_RUN_LAST = gobject.SIGNAL_RUN_LAST +except: + SIGNAL_RUN_LAST = gobject.SignalFlags.RUN_LAST def n_arg_signal(n): - from xpra.gtk_common.gtk_util import SIGNAL_RUN_LAST - return (SIGNAL_RUN_LAST, - gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,) * n) + return (SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,) * n) no_arg_signal = n_arg_signal(0) one_arg_signal = n_arg_signal(1) diff --git a/src/xpra/gtk_common/gtk_util.py b/src/xpra/gtk_common/gtk_util.py index e448ab08cc..0d1baa34cf 100644 --- a/src/xpra/gtk_common/gtk_util.py +++ b/src/xpra/gtk_common/gtk_util.py @@ -152,7 +152,6 @@ def pixbuf_new_from_data(*args): MESSAGE_INFO = gtk.MessageType.INFO BUTTONS_CLOSE = gtk.ButtonsType.CLOSE DIALOG_DESTROY_WITH_PARENT = 0 - SIGNAL_RUN_LAST = gobject.SignalFlags.RUN_LAST WINDOW_POPUP = gtk.WindowType.POPUP WINDOW_TOPLEVEL = gtk.WindowType.TOPLEVEL @@ -302,7 +301,6 @@ def cairo_set_source_pixbuf(cr, pixbuf, x, y): MESSAGE_INFO = gtk.MESSAGE_INFO BUTTONS_CLOSE = gtk.BUTTONS_CLOSE DIALOG_DESTROY_WITH_PARENT = gtk.DIALOG_DESTROY_WITH_PARENT - SIGNAL_RUN_LAST = gobject.SIGNAL_RUN_LAST WINDOW_POPUP = gtk.WINDOW_POPUP WINDOW_TOPLEVEL = gtk.WINDOW_TOPLEVEL diff --git a/src/xpra/platform/win32/paths.py b/src/xpra/platform/win32/paths.py index 74e41df940..a76cd26bb4 100644 --- a/src/xpra/platform/win32/paths.py +++ b/src/xpra/platform/win32/paths.py @@ -111,4 +111,11 @@ def do_get_app_dir(): return default_get_app_dir() def do_get_sound_command(): + from xpra.sound.gstreamer_util import GSTREAMER1 + if GSTREAMER1: + from xpra.platform.paths import get_app_dir + app_dir = get_app_dir() + #is there a python3 bundled sound subdirectory + sound_exe = os.path.join(app_dir, "Sound", "xpra_cmd.exe") + return [sound_exe] return ["xpra_cmd.exe"] diff --git a/src/xpra/sound/gstreamer_util.py b/src/xpra/sound/gstreamer_util.py index 5ee1635e05..4a7cc5bedc 100755 --- a/src/xpra/sound/gstreamer_util.py +++ b/src/xpra/sound/gstreamer_util.py @@ -32,8 +32,7 @@ def get_queue_time(default_value=450, prefix=""): OSX = sys.platform.startswith("darwin") ALLOW_SOUND_LOOP = os.environ.get("XPRA_ALLOW_SOUND_LOOP", "0")=="1" -DEFAULT_GSTREAMER1 = not WIN32 or sys.version_info[0]>=3 -GSTREAMER1 = os.environ.get("XPRA_GSTREAMER1", str(int(DEFAULT_GSTREAMER1)))=="1" +GSTREAMER1 = os.environ.get("XPRA_GSTREAMER1", "1")=="1" MONITOR_DEVICE_NAME = os.environ.get("XPRA_MONITOR_DEVICE_NAME", "") def force_enabled(codec_name): return os.environ.get("XPRA_SOUND_CODEC_ENABLE_%s" % codec_name.upper(), "0")=="1" @@ -234,8 +233,18 @@ def import_gst(): if has_gst is not None: return gst - from xpra.gtk_common.gobject_compat import is_gtk3 - if is_gtk3(): + GTK3 = GSTREAMER1 + #the GTK gi bindings may not have been included if we're using a minimal build: + try: + from xpra.gtk_common.gobject_util import gobject + GTK3 = gobject.pygobject_version[0]>=3 + except ValueError as e: + log("cannot probe GTK3 support: %s", e) + pass + except ImportError as e: + log("cannot probe GTK3 support: %s", e) + pass + if GTK3: imports = [ (import_gst1, 1) ] else: imports = [ diff --git a/src/xpra/sound/sink.py b/src/xpra/sound/sink.py index 7447e775bf..e38eb4132c 100755 --- a/src/xpra/sound/sink.py +++ b/src/xpra/sound/sink.py @@ -8,7 +8,8 @@ from collections import deque from threading import Lock -from xpra.sound.sound_pipeline import SoundPipeline, gobject, one_arg_signal +from xpra.sound.sound_pipeline import SoundPipeline +from xpra.gtk_common.gobject_util import one_arg_signal, gobject from xpra.sound.gstreamer_util import plugin_str, get_decoder_parser, get_queue_time, normv, get_codecs, get_default_sink, get_sink_plugins, \ MP3, CODEC_ORDER, gst, QUEUE_LEAK, MS_TO_NS diff --git a/src/xpra/sound/sound_pipeline.py b/src/xpra/sound/sound_pipeline.py index 2024a15976..12fecf3da2 100644 --- a/src/xpra/sound/sound_pipeline.py +++ b/src/xpra/sound/sound_pipeline.py @@ -11,10 +11,8 @@ log = Logger("sound") from xpra.util import csv -from xpra.gtk_common.gobject_compat import import_gobject, import_glib -from xpra.gtk_common.gobject_util import one_arg_signal -gobject = import_gobject() -gobject.threads_init() +from xpra.gtk_common.gobject_compat import import_glib +from xpra.gtk_common.gobject_util import one_arg_signal, gobject FAULT_RATE = int(os.environ.get("XPRA_SOUND_FAULT_INJECTION_RATE", "0")) _counter = 0 diff --git a/src/xpra/sound/src.py b/src/xpra/sound/src.py index fe74b86c79..f32bc0dd10 100755 --- a/src/xpra/sound/src.py +++ b/src/xpra/sound/src.py @@ -10,8 +10,8 @@ from xpra.os_util import SIGNAMES, Queue from xpra.util import csv -from xpra.sound.sound_pipeline import SoundPipeline, gobject -from xpra.gtk_common.gobject_util import n_arg_signal +from xpra.sound.sound_pipeline import SoundPipeline +from xpra.gtk_common.gobject_util import n_arg_signal, gobject from xpra.sound.gstreamer_util import get_source_plugins, plugin_str, get_encoder_formatter, normv, get_codecs, get_gst_version, get_queue_time, \ MP3, CODEC_ORDER, ENCODER_DEFAULT_OPTIONS, MUXER_DEFAULT_OPTIONS, ENCODER_NEEDS_AUDIOCONVERT, MS_TO_NS, GST_QUEUE_LEAK_DOWNSTREAM from xpra.scripts.config import InitExit