X Tutup
Skip to content

Commit e732b98

Browse files
committed
Make overwrite a bool argument in setenv
1 parent 4cedc03 commit e732b98

File tree

2 files changed

+25
-28
lines changed

2 files changed

+25
-28
lines changed

src/processing/video/Environment.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ static public class POSIX {
5353
}
5454
}
5555

56-
public int setenv(String name, String value, int overwrite) {
56+
public int setenv(String name, String value, boolean overwrite) {
5757
if (libc instanceof UnixLibC) {
58-
return ((UnixLibC)libc).setenv(name, value, overwrite);
58+
return ((UnixLibC)libc).setenv(name, value, overwrite?1:0);
5959
}
6060
else {
6161
return ((WinLibC)libc)._putenv(name + "=" + value);

src/processing/video/Video.java

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ static protected void initImpl() {
157157
// We have a system install of GStreamer
158158
usingGStreamerSystemInstall = true;
159159
if (bitsJVM == 64) {
160-
Environment.libc.setenv("GSTREAMER_1_0_ROOT_X86_64", gstreamerLibPath, 1);
160+
Environment.libc.setenv("GSTREAMER_1_0_ROOT_X86_64", gstreamerLibPath, true);
161161
} else {
162-
Environment.libc.setenv("GSTREAMER_1_0_ROOT_X86", gstreamerLibPath, 1);
162+
Environment.libc.setenv("GSTREAMER_1_0_ROOT_X86", gstreamerLibPath, true);
163163
}
164164
}
165165
}
@@ -192,21 +192,21 @@ static protected void initImpl() {
192192
System.setProperty("jna.library.path", gstreamerLibPath);
193193
}
194194

195-
Environment.libc.setenv("GST_DEBUG", String.valueOf(DEBUG_LEVEL), 1);
195+
Environment.libc.setenv("GST_DEBUG", String.valueOf(DEBUG_LEVEL), true);
196196

197197
if (!usingGStreamerSystemInstall) {
198198
// Disable the use of gst-plugin-scanner on environments where we're
199199
// not using the host system's installation of GStreamer
200200
// the problem with gst-plugin-scanner is that the library expects it
201201
// to exist at a specific location determined at build time
202202
if (PApplet.platform != LINUX) {
203-
Environment.libc.setenv("GST_REGISTRY_FORK", "no", 1);
203+
Environment.libc.setenv("GST_REGISTRY_FORK", "no", true);
204204
}
205205

206206
// Prevent globally installed libraries from being used on platforms
207207
// where we ship GStreamer
208208
if (!gstreamerPluginPath.equals("")) {
209-
Environment.libc.setenv("GST_PLUGIN_SYSTEM_PATH_1_0", "", 1);
209+
Environment.libc.setenv("GST_PLUGIN_SYSTEM_PATH_1_0", "", true);
210210
}
211211
}
212212

@@ -216,7 +216,24 @@ static protected void initImpl() {
216216
if (loader == null) {
217217
System.err.println("Cannot load GStreamer libraries.");
218218
}
219-
}
219+
}
220+
221+
if (PApplet.platform == LINUX) {
222+
// Add gstreamer paths to LD_LIBRARY_PATH
223+
String ldLibPath = System.getenv("LD_LIBRARY_PATH");
224+
if (ldLibPath == null) {
225+
ldLibPath = "";
226+
} else {
227+
ldLibPath = ldLibPath.trim();
228+
if (!ldLibPath.equals("")) {
229+
ldLibPath += ":";
230+
}
231+
}
232+
ldLibPath += gstreamerLibPath + ":" + gstreamerPluginPath;
233+
Environment.libc.setenv("LD_LIBRARY_PATH", ldLibPath, true);
234+
// System.out.println("LD_LIBRARY_PATH from Java's System = " + System.getenv("LD_LIBRARY_PATH"));
235+
// System.out.println("LD_LIBRARY_PATH after from LibC = " + Environment.libc.getenv("LD_LIBRARY_PATH"));
236+
}
220237

221238
String[] args = { "" };
222239
Gst.setUseDefaultContext(defaultGLibContext);
@@ -327,26 +344,6 @@ static protected void buildPaths() {
327344
} else {
328345
File gstreamerLibDir = new File(gstreamerPluginPath).getParentFile();
329346
gstreamerLibPath = gstreamerLibDir.getAbsolutePath();
330-
331-
if (PApplet.platform == LINUX) {
332-
// Add gstreamer paths to LD_LIBRARY_PATH
333-
String libPath = System.getenv("LD_LIBRARY_PATH");
334-
String libPath0 = Environment.libc.getenv("LD_LIBRARY_PATH");
335-
if (libPath == null) {
336-
libPath = "";
337-
} else {
338-
libPath = libPath.trim();
339-
if (!libPath.equals("")) {
340-
libPath += ":";
341-
}
342-
}
343-
System.out.println("libPath before = " + libPath);
344-
System.out.println("libPath from Libc = " + libPath0);
345-
libPath += gstreamerLibPath + ":" + gstreamerPluginPath;
346-
Environment.libc.setenv("LD_LIBRARY_PATH", libPath, 1);
347-
System.out.println("libPath after = " + System.getenv("LD_LIBRARY_PATH"));
348-
System.out.println("libPath after from Libc = " + Environment.libc.getenv("LD_LIBRARY_PATH"));
349-
}
350347
}
351348
}
352349

0 commit comments

Comments
 (0)
X Tutup