mirror of
https://github.com/processing/processing4.git
synced 2026-02-26 08:44:39 +01:00
Added newFrame() method to Capture and Movie
This commit is contained in:
@@ -26,7 +26,6 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.lang.reflect.*;
|
||||
|
||||
import org.gstreamer.*;
|
||||
@@ -94,7 +93,8 @@ public class Capture extends PImage implements PConstants {
|
||||
protected Object copyHandler;
|
||||
|
||||
protected boolean available;
|
||||
protected boolean pipelineReady;
|
||||
protected boolean pipelineReady;
|
||||
protected boolean newFrame;
|
||||
|
||||
protected RGBDataAppSink rgbSink = null;
|
||||
protected int[] copyPixels = null;
|
||||
@@ -328,6 +328,19 @@ public class Capture extends PImage implements PConstants {
|
||||
return 0 < bufWidth && 0 < bufHeight && pipelineReady;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if its called for the first time after a new
|
||||
* frame has been read, and false afterwards until another frame
|
||||
* is read.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean newFrame() {
|
||||
boolean res = newFrame;
|
||||
newFrame = false;
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* ( begin auto-generated from Capture_available.xml )
|
||||
*
|
||||
@@ -449,6 +462,7 @@ public class Capture extends PImage implements PConstants {
|
||||
}
|
||||
|
||||
available = false;
|
||||
newFrame = true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -689,7 +703,8 @@ public class Capture extends PImage implements PConstants {
|
||||
Element.linkMany(gsource, conv, videofilter, rgbSink);
|
||||
}
|
||||
|
||||
pipelineReady = true;
|
||||
pipelineReady = true;
|
||||
newFrame = false;
|
||||
}
|
||||
|
||||
protected void initResAndFps() {
|
||||
|
||||
@@ -67,6 +67,7 @@ public class Movie extends PImage implements PConstants {
|
||||
|
||||
protected boolean available;
|
||||
protected boolean sinkReady;
|
||||
protected boolean newFrame;
|
||||
|
||||
protected RGBDataAppSink rgbSink = null;
|
||||
protected int[] copyPixels = null;
|
||||
@@ -438,6 +439,19 @@ public class Movie extends PImage implements PConstants {
|
||||
return 0 < bufWidth && 0 < bufHeight && sinkReady && !seeking;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if its called for the first time after a new
|
||||
* frame has been read, and false afterwards until another frame
|
||||
* is read.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean newFrame() {
|
||||
boolean res = newFrame;
|
||||
newFrame = false;
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* ( begin auto-generated from Movie_available.xml )
|
||||
*
|
||||
@@ -649,6 +663,7 @@ public class Movie extends PImage implements PConstants {
|
||||
}
|
||||
|
||||
available = false;
|
||||
newFrame = true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -829,6 +844,7 @@ public class Movie extends PImage implements PConstants {
|
||||
});
|
||||
|
||||
sinkReady = true;
|
||||
newFrame = false;
|
||||
}
|
||||
|
||||
protected synchronized void invokeEvent(int w, int h, IntBuffer buffer) {
|
||||
|
||||
Reference in New Issue
Block a user