mirror of
https://github.com/processing/processing4.git
synced 2026-02-15 03:15:40 +01:00
Basic 2.0 Ref changes
This commit is contained in:
@@ -72,9 +72,16 @@ public class Capture extends PImage implements PConstants {
|
||||
protected int reqWidth;
|
||||
protected int reqHeight;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @generate Capture.xml
|
||||
* <h3>Advanced</h3>
|
||||
* Basic constructor: tries to auto-detect all the capture parameters,
|
||||
* with the exception of the resolution.
|
||||
* with the exception of the resolution.
|
||||
* @webref video
|
||||
* @usage application
|
||||
* @param parent typically use "this"
|
||||
* @param requestWidth width of the frame
|
||||
* @param requestHeight height of the frame
|
||||
*/
|
||||
public Capture(PApplet parent, int requestWidth, int requestHeight) {
|
||||
super(requestWidth, requestHeight, RGB);
|
||||
@@ -83,7 +90,9 @@ public class Capture extends PImage implements PConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor that takes resolution and framerate indicated as a single number.
|
||||
* <h3>Advanced</h3>
|
||||
* Constructor that takes resolution and framerate indicated as a single number.
|
||||
* @param frameRate number of frames to read per second
|
||||
*/
|
||||
public Capture(PApplet parent, int requestWidth, int requestHeight, int frameRate) {
|
||||
super(requestWidth, requestHeight, RGB);
|
||||
@@ -92,8 +101,10 @@ public class Capture extends PImage implements PConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* <h3>Advanced</h3>
|
||||
* This constructor allows to specify the camera name. In Linux, for example, this
|
||||
* should be a string of the form /dev/video0, /dev/video1, etc.
|
||||
* should be a string of the form /dev/video0, /dev/video1, etc.
|
||||
* @param cameraName name of the camera
|
||||
*/
|
||||
public Capture(PApplet parent, int requestWidth, int requestHeight, String cameraName) {
|
||||
super(requestWidth, requestHeight, RGB);
|
||||
@@ -102,6 +113,7 @@ public class Capture extends PImage implements PConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* <h3>Advanced</h3>
|
||||
* This constructor allows to specify the camera name and the desired framerate.
|
||||
*/
|
||||
public Capture(PApplet parent, int requestWidth, int requestHeight, int frameRate,
|
||||
@@ -113,8 +125,10 @@ public class Capture extends PImage implements PConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* <h3>Advanced</h3>
|
||||
* This constructor lets to indicate which source element to use (i.e.: v4l2src,
|
||||
* osxvideosrc, dshowvideosrc, ksvideosrc, etc).
|
||||
* osxvideosrc, dshowvideosrc, ksvideosrc, etc).
|
||||
* @param sourceName ???
|
||||
*/
|
||||
public Capture(PApplet parent, int requestWidth, int requestHeight, int frameRate,
|
||||
String sourceName, String cameraName) {
|
||||
@@ -125,9 +139,12 @@ public class Capture extends PImage implements PConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* <h3>Advanced</h3>
|
||||
* This constructor accepts an arbitrary list of string properties for the source element.
|
||||
* The camera name could be one of these properties. The framerate must be specified
|
||||
* as a fraction string: 30/1, 15/2, etc.
|
||||
* as a fraction string: 30/1, 15/2, etc.
|
||||
* @param strPropNames ???
|
||||
* @param strPropValues ???
|
||||
*/
|
||||
public Capture(PApplet parent, int requestWidth, int requestHeight, String frameRate,
|
||||
String sourceName, String[] strPropNames, String[] strPropValues) {
|
||||
@@ -137,9 +154,12 @@ public class Capture extends PImage implements PConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* <h3>Advanced</h3>
|
||||
* This constructor accepts an arbitrary list of string properties for the source element,
|
||||
* as well as a list of integer properties. This could be useful if a camera cannot by
|
||||
* specified by name but by index. Framerate must be a fraction string: 30/1, 15/2, etc.
|
||||
* specified by name but by index. Framerate must be a fraction string: 30/1, 15/2, etc.
|
||||
* @param intPropNames ???
|
||||
* @param intPropValues ???
|
||||
*/
|
||||
public Capture(PApplet parent, int requestWidth, int requestHeight, String frameRate,
|
||||
String sourceName, String[] strPropNames, String[] strPropValues,
|
||||
@@ -247,9 +267,9 @@ public class Capture extends PImage implements PConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns "true" when a new video frame is available to read.
|
||||
*
|
||||
* @return boolean
|
||||
* @generate Capture_available.xml
|
||||
* @webref capture
|
||||
* @usage web_application
|
||||
*/
|
||||
public boolean available() {
|
||||
return available;
|
||||
@@ -286,7 +306,9 @@ public class Capture extends PImage implements PConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops the capture pipeline.
|
||||
* @generate Capture_stop.xml
|
||||
* @webref capture
|
||||
* @usage web_application
|
||||
*/
|
||||
public void stop() {
|
||||
capturing = false;
|
||||
@@ -294,11 +316,13 @@ public class Capture extends PImage implements PConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the current video frame.
|
||||
*
|
||||
* @generate Capture_read.xml
|
||||
* <h3>Advanced</h3>
|
||||
* This method() and invokeEvent() are now synchronized, so that invokeEvent()
|
||||
* can't be called whilst we're busy reading. Problematic frame error
|
||||
* fixed by Charl P. Botha <charlbotha.com>
|
||||
* fixed by Charl P. Botha <charlbotha.com>
|
||||
* @webref capture
|
||||
* @usage web_application
|
||||
*/
|
||||
public synchronized void read() {
|
||||
// We loadPixels() first to ensure that at least we always have a non-null
|
||||
@@ -378,9 +402,9 @@ public class Capture extends PImage implements PConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of available capture devices.
|
||||
*
|
||||
* @return String[]
|
||||
* @generate Capture_list.xml
|
||||
* @webref capture
|
||||
* @usage web_application
|
||||
*/
|
||||
static public String[] list() {
|
||||
if (PApplet.platform == LINUX) {
|
||||
@@ -395,11 +419,11 @@ public class Capture extends PImage implements PConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* <h3>Advanced</h3>
|
||||
* Get a list of all available captures as a String array. i.e.
|
||||
* println(Capture.list()) will show you the goodies.
|
||||
*
|
||||
* @param sourceName String
|
||||
* @return String[]
|
||||
*/
|
||||
static public String[] list(String sourceName) {
|
||||
return list(sourceName, devicePropertyName());
|
||||
|
||||
@@ -32,9 +32,10 @@ import org.gstreamer.*;
|
||||
import org.gstreamer.Buffer;
|
||||
import org.gstreamer.elements.*;
|
||||
|
||||
/**
|
||||
* This class makes it possible to load movies and to play them back in many
|
||||
* ways including looping, pausing, and changing speed.
|
||||
/**
|
||||
* @generate Movie.xml
|
||||
* @webref video
|
||||
* @usage application
|
||||
*/
|
||||
public class Movie extends PImage implements PConstants {
|
||||
protected String filename;
|
||||
@@ -209,11 +210,10 @@ public class Movie extends PImage implements PConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set how often new frames are to be read from the movie. Does not actually
|
||||
* set the speed of the movie playback, that's handled by the speed() method.
|
||||
*
|
||||
* @param float ifps
|
||||
* @see speed
|
||||
* @generate Movie_frameRate.xml
|
||||
* @webref movie
|
||||
* @usage web_application
|
||||
* @param ifps speed of the movie in frames per second
|
||||
*/
|
||||
public void frameRate(float ifps) {
|
||||
// We calculate the target ratio in the case both the
|
||||
@@ -252,11 +252,12 @@ public class Movie extends PImage implements PConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a multiplier for how fast/slow the movie should be run. The default is
|
||||
* 1.0. speed(2) will play the movie at double speed (2x). speed(0.5) will
|
||||
* play at half speed. speed(-1) will play backwards at regular speed.
|
||||
*
|
||||
* @param float irate
|
||||
* @generate Movie_speed.xml
|
||||
|
||||
* @webref movie
|
||||
|
||||
* @usage web_application
|
||||
* @param irate speed multiplier for movie playback
|
||||
*/
|
||||
public void speed(float irate) {
|
||||
// If the frameRate() method is called continuously with very similar
|
||||
@@ -269,9 +270,11 @@ public class Movie extends PImage implements PConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the full length of this movie (in seconds).
|
||||
*
|
||||
* @return float
|
||||
* @generate Movie_duration.xml
|
||||
|
||||
* @webref movie
|
||||
|
||||
* @usage web_application
|
||||
*/
|
||||
public float duration() {
|
||||
float sec = gplayer.queryDuration().toSeconds();
|
||||
@@ -280,9 +283,11 @@ public class Movie extends PImage implements PConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current time in seconds.
|
||||
*
|
||||
* @return float
|
||||
* @generate Movie_time.xml
|
||||
|
||||
* @webref movie
|
||||
|
||||
* @usage web_application
|
||||
*/
|
||||
public float time() {
|
||||
float sec = gplayer.queryPosition().toSeconds();
|
||||
@@ -309,10 +314,12 @@ public class Movie extends PImage implements PConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* Jump to a specific location (in seconds). The number is a float so
|
||||
* fractions of seconds can be used.
|
||||
*
|
||||
* @param float where
|
||||
* @generate Movie_jump.xml
|
||||
|
||||
* @webref movie
|
||||
|
||||
* @usage web_application
|
||||
* @param where position to jump to specified in seconds
|
||||
*/
|
||||
public void jump(float where) {
|
||||
if (playing) {
|
||||
@@ -338,7 +345,7 @@ public class Movie extends PImage implements PConstants {
|
||||
/**
|
||||
* Jump to a specific frame.
|
||||
*
|
||||
* @param frame int
|
||||
* @param frame ???
|
||||
*/
|
||||
public void jump(int frame) {
|
||||
float srcFramerate = getSourceFrameRate();
|
||||
@@ -368,10 +375,11 @@ public class Movie extends PImage implements PConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the true or false depending on whether there is a new frame ready to
|
||||
* be read.
|
||||
*
|
||||
* @return boolean
|
||||
* @generate Movie_available.xml
|
||||
|
||||
* @webref movie
|
||||
|
||||
* @usage web_application
|
||||
*/
|
||||
public boolean available() {
|
||||
return available;
|
||||
@@ -406,7 +414,11 @@ public class Movie extends PImage implements PConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* Begin playing the movie, with no repeat.
|
||||
* @generate Movie_play.xml
|
||||
|
||||
* @webref movie
|
||||
|
||||
* @usage web_application
|
||||
*/
|
||||
public void play() {
|
||||
if (!sinkReady) {
|
||||
@@ -419,7 +431,11 @@ public class Movie extends PImage implements PConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* Begin playing the movie, with repeat.
|
||||
* @generate Movie_loop.xml
|
||||
|
||||
* @webref movie
|
||||
|
||||
* @usage web_application
|
||||
*/
|
||||
public void loop() {
|
||||
repeat = true;
|
||||
@@ -427,14 +443,22 @@ public class Movie extends PImage implements PConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* Shut off the repeating loop.
|
||||
* @generate Movie_noLoop.xml
|
||||
|
||||
* @webref movie
|
||||
|
||||
* @usage web_application
|
||||
*/
|
||||
public void noLoop() {
|
||||
repeat = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pause the movie at its current time.
|
||||
* @generate Movie_pause.xml
|
||||
|
||||
* @webref movie
|
||||
|
||||
* @usage web_application
|
||||
*/
|
||||
public void pause() {
|
||||
playing = false;
|
||||
@@ -443,7 +467,11 @@ public class Movie extends PImage implements PConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop the movie, and rewind.
|
||||
* @generate Movie_stop.xml
|
||||
|
||||
* @webref movie
|
||||
|
||||
* @usage web_application
|
||||
*/
|
||||
public void stop() {
|
||||
if (playing) {
|
||||
@@ -455,7 +483,11 @@ public class Movie extends PImage implements PConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the current video frame.
|
||||
* @generate Movie_read.xml
|
||||
|
||||
* @webref movie
|
||||
|
||||
* @usage web_application
|
||||
*/
|
||||
public synchronized void read() {
|
||||
if (fps <= 0) {
|
||||
|
||||
Reference in New Issue
Block a user