getBufferPixels() removes the buffers from the cache, fixes the #2424

This commit is contained in:
codeanticode
2014-04-05 00:11:34 -04:00
parent 1e63889060
commit c7c20f0183
3 changed files with 19 additions and 6 deletions
@@ -428,7 +428,7 @@ public class Capture extends PImage implements PConstants {
public synchronized void loadPixels() {
super.loadPixels();
if (useBufferSink) {
if (useBufferSink) {
if (natBuffer != null) {
// This means that the OpenGL texture hasn't been created so far (the
// video frame not drawn using image()), but the user wants to use the
@@ -436,17 +436,17 @@ public class Capture extends PImage implements PConstants {
IntBuffer buf = natBuffer.getByteBuffer().asIntBuffer();
buf.rewind();
buf.get(pixels);
Video.convertToARGB(pixels, width, height);
Video.convertToARGB(pixels, width, height);
} else if (sinkGetMethod != null) {
try {
sinkGetMethod.invoke(bufferSink, new Object[] { pixels });
sinkGetMethod.invoke(bufferSink, new Object[] { pixels });
} catch (Exception e) {
e.printStackTrace();
}
}
// super.loadPixels() sets loaded to true, but in the useBufferSink mode,
// the contents of the pixels array is overriden by the buffers coming
// the contents of the pixels array is overwritten by the buffers coming
// from gstreamer, so we don't want PGraphicsOpenGL replacing the OpenGL
// texture with the pixels.
setLoaded(false);
@@ -570,7 +570,7 @@ public class Movie extends PImage implements PConstants {
}
// super.loadPixels() sets loaded to true, but in the useBufferSink mode,
// the contents of the pixels array is overriden by the buffers coming
// the contents of the pixels array is overwritten by the buffers coming
// from gstreamer, so we don't want PGraphicsOpenGL replacing the OpenGL
// texture with the pixels.
setLoaded(false);