From c1b1e2c3963a5b51ed4a81b4c8e960cde4385d9f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Juho=20V=C3=A4h=C3=A4-Herttua?= Date: Mon, 19 Mar 2012 14:40:55 +0200 Subject: [PATCH] Make it possible to init shairplay library without using the default loader. --- src/bindings/python/Shairplay.py | 40 +++++++++++++++++--------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/src/bindings/python/Shairplay.py b/src/bindings/python/Shairplay.py index 3e54d60..0add4be 100644 --- a/src/bindings/python/Shairplay.py +++ b/src/bindings/python/Shairplay.py @@ -42,25 +42,7 @@ class RaopNativeCallbacks(Structure): ("audio_flush", audio_flush_prototype), ("audio_destroy", audio_destroy_prototype)] -def LoadShairplay(path): - if sys.maxsize < 2**32: - libname = "shairplay32" - else: - libname = "shairplay64" - - if platform.system() == "Windows": - libname = libname + ".dll" - elif platform.system() == "Darwin": - libname = "lib" + libname + ".dylib" - else: - libname = "lib" + libname + ".so" - - try: - fullpath = os.path.join(path, libname) - libshairplay = cdll.LoadLibrary(fullpath) - except: - raise RuntimeError("Couldn't load shairplay library " + libname) - +def InitShairplay(libshairplay): # Initialize dnssd related functions libshairplay.dnssd_init.restype = c_void_p libshairplay.dnssd_init.argtypes = [POINTER(c_int)] @@ -85,6 +67,26 @@ def LoadShairplay(path): libshairplay.raop_destroy.restype = None libshairplay.raop_destroy.argtypes = [c_void_p] +def LoadShairplay(path): + if sys.maxsize < 2**32: + libname = "shairplay32" + else: + libname = "shairplay64" + + if platform.system() == "Windows": + libname = libname + ".dll" + elif platform.system() == "Darwin": + libname = "lib" + libname + ".dylib" + else: + libname = "lib" + libname + ".so" + + try: + fullpath = os.path.join(path, libname) + libshairplay = cdll.LoadLibrary(fullpath) + except: + raise RuntimeError("Couldn't load shairplay library " + libname) + + InitShairplay(libshairplay) return libshairplay RSA_KEY = """ -- 2.34.1