diff --git a/library.properties b/library.properties index d63f320..700f426 100644 --- a/library.properties +++ b/library.properties @@ -40,11 +40,11 @@ paragraph = This uses GL textures and accelerated video decoding. Recommended fo # compare different versions of the same library, and check if an update is # available. You should think of it as a counter, counting the total number of # releases you've had. -version = 7 +version = 8 # The version as the user will see it. If blank, the version attribute will be # used here. This should be a single word, with no spaces. -prettyVersion = 1.2.2 +prettyVersion = 1.2.3 # The min and max revision of Processing compatible with your library. # Note that these fields use the revision and not the version of Processing, diff --git a/src/gohai/glvideo/GLVideo.java b/src/gohai/glvideo/GLVideo.java index 76d94b3..6575145 100644 --- a/src/gohai/glvideo/GLVideo.java +++ b/src/gohai/glvideo/GLVideo.java @@ -23,6 +23,8 @@ package gohai.glvideo; import java.io.File; +import java.nio.file.Files; +import java.nio.file.Paths; import processing.core.*; import processing.opengl.*; @@ -88,7 +90,7 @@ public static void enableDebug() { } public static void enableDebug(int level) { - System.loadLibrary("glvideo"); + loadNativeLibrary(); gstreamer_setEnvVar("GST_DEBUG_NO_COLOR", "1"); gstreamer_setEnvVar("GST_DEBUG", Integer.toString(level)); if (2 < level) { @@ -106,7 +108,7 @@ protected static void loadGStreamer() { boolean use_host_gstreamer = false; if (!loaded) { - System.loadLibrary("glvideo"); + loadNativeLibrary(); loaded = true; String jar = GLVideo.class.getProtectionDomain().getCodeSource().getLocation().getPath(); @@ -150,6 +152,32 @@ protected static void loadGStreamer() { } } + protected static void loadNativeLibrary() { + // Raspbian August 2017 renamed libraries gstgl depends on + workaroundBrcm(); + System.loadLibrary("glvideo"); + } + + protected static void workaroundBrcm() { + File new_lib = new File("/opt/vc/lib/libbrcmGLESv2.so"); + + String jar = GLVideo.class.getProtectionDomain().getCodeSource().getLocation().getPath(); + String nativeLib = jar.substring(0, jar.lastIndexOf(File.separatorChar)); + File symlink = new File(nativeLib + "/linux-armv6hf/libGLESv2.so"); + + if (new_lib.isFile() && !symlink.isFile()) { + // attempt to create symlinks that make it compatible + // with earlier Raspbian releases + try { + Files.createSymbolicLink(Paths.get(nativeLib + "/linux-armv6hf/libGLESv2.so"), Paths.get("/opt/vc/lib/libbrcmGLESv2.so")); + Files.createSymbolicLink(Paths.get(nativeLib + "/linux-armv6hf/libEGL.so"), Paths.get("/opt/vc/lib/libbrcmEGL.so")); + System.out.println("GLVideo: Created compatibility symlinks"); + } catch (Exception e) { + System.err.println("GLVideo: Error creating compatibility symlinks"); + } + } + } + public void dispose() { close(); }