diff --git a/java/libraries/video/src/processing/video/LibraryPath.java b/java/libraries/video/src/processing/video/LibraryPath.java index 0fe59a989..f697de048 100644 --- a/java/libraries/video/src/processing/video/LibraryPath.java +++ b/java/libraries/video/src/processing/video/LibraryPath.java @@ -50,7 +50,7 @@ class LibraryPath { // as well as exported applications. n1 = path.indexOf("video.jar"); } else if (Platform.isLinux()) { - // TODO: what's up? + return ""; } if ((-1 < n0) && (-1 < n1)) { diff --git a/java/libraries/video/src/processing/video/QTKitCaptureDevice.java b/java/libraries/video/src/processing/video/QTKitCaptureDevice.java new file mode 100644 index 000000000..a3b6fd0b6 --- /dev/null +++ b/java/libraries/video/src/processing/video/QTKitCaptureDevice.java @@ -0,0 +1,23 @@ +package processing.video; + +import com.sun.jna.Library; +import com.sun.jna.Native; + +/** + * This JNA interface provides access to the environment variable-related functions in the C library. + * How to use: + * CLibrary clib = CLibrary.INSTANCE; + * String s = clib.getenv("DYLD_LIBRARY_PATH"); + */ +public interface QTKitCaptureDevice extends Library { + QTKitCaptureDevice INSTANCE = (QTKitCaptureDevice)Native.loadLibrary("c", QTKitCaptureDevice.class); + + int setenv(String name, String value, int overwrite); + String getenv(String name); + int unsetenv(String name); + int putenv(String string); +} + + + + diff --git a/java/libraries/video/src/processing/video/Video.java b/java/libraries/video/src/processing/video/Video.java index f9c65f6cf..b9f989c40 100644 --- a/java/libraries/video/src/processing/video/Video.java +++ b/java/libraries/video/src/processing/video/Video.java @@ -20,12 +20,8 @@ package processing.video; import org.gstreamer.*; - -// TODO: update to latest gstreamer on windows, jmcvideo on mac, seeking in gspipeline, check sf tracker - import processing.core.PApplet; import processing.core.PConstants; - import java.io.File; import java.util.List; @@ -43,7 +39,7 @@ public class Video implements PConstants { protected static boolean defaultGLibContext = false; // Priority is given to global install of GStreamer if this is set to true. - public static boolean globalGStreamer = true; + public static boolean globalGStreamer = false; // Direct buffer pass enabled by default. public static boolean passDirectBuffer = true; @@ -56,7 +52,6 @@ public class Video implements PConstants { globalGStreamerPath = "/System/Library/Frameworks/GStreamer.framework/Versions/Current/lib"; } else if (PApplet.platform == WINDOWS) { globalGStreamerPath = ""; - //globalGStreamerPath = "C://Program Files (x86)//OSSBuild//GStreamer//v0.10.7//lib"; } else if (PApplet.platform == LINUX) { globalGStreamerPath = "/usr/lib"; } else {} @@ -161,8 +156,8 @@ public class Video implements PConstants { if (localGStreamerPath.equals("")) { LibraryPath libPath = new LibraryPath(); String path = libPath.get(); - gstreamerBinPath = path + "/linux"; - gstreamerPluginsPath = path + "/linux/" + localPluginsFolder; + gstreamerBinPath = path + "/linux" + bitsJVM; + gstreamerPluginsPath = gstreamerBinPath + "/" + localPluginsFolder; } else { gstreamerBinPath = localGStreamerPath; gstreamerPluginsPath = localGStreamerPath + "/" + localPluginsFolder; @@ -179,8 +174,8 @@ public class Video implements PConstants { if (localGStreamerPath.equals("")) { LibraryPath libPath = new LibraryPath(); String path = libPath.get(); - gstreamerBinPath = path + "\\win32"; - gstreamerPluginsPath = path + "\\win32\\" + localPluginsFolder; + gstreamerBinPath = path + "\\windows" + bitsJVM; + gstreamerPluginsPath = gstreamerBinPath + "\\" + localPluginsFolder; } else { gstreamerBinPath = localGStreamerPath; gstreamerPluginsPath = localGStreamerPath + "\\" + localPluginsFolder; @@ -197,8 +192,8 @@ public class Video implements PConstants { if (localGStreamerPath.equals("")) { LibraryPath libPath = new LibraryPath(); String path = libPath.get(); - gstreamerBinPath = path + "/macosx"; - gstreamerPluginsPath = path + "/macosx/" + localPluginsFolder; + gstreamerBinPath = path + "/macosx" + bitsJVM; + gstreamerPluginsPath = gstreamerBinPath + "/" + localPluginsFolder; } else { gstreamerBinPath = localGStreamerPath; gstreamerPluginsPath = localGStreamerPath + "/" + localPluginsFolder; @@ -207,6 +202,10 @@ public class Video implements PConstants { } protected static boolean lookForGlobalGStreamer() { + LibraryPath libPath = new LibraryPath(); + String locPath = libPath.get(); + locPath = locPath.replace("/", System.getProperty("file.separator")); + String[] searchPaths = null; if (!globalGStreamerPath.equals("")) { searchPaths = new String[] {globalGStreamerPath}; @@ -218,9 +217,9 @@ public class Video implements PConstants { searchPaths = lpaths.split(pathsep); } - for (int i = 0; i < searchPaths.length; i++) { + for (int i = 0; i < searchPaths.length; i++) { String path = searchPaths[i]; - if (libgstreamerPresent(path, "libgstreamer")) { + if ((locPath.equals("") || path.indexOf(locPath) == -1) && libgstreamerPresent(path, "libgstreamer")) { globalGStreamerPath = path; return true; }