mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Moving some methods around
This commit is contained in:
@@ -124,7 +124,7 @@ public class Capture extends PImage implements PConstants {
|
||||
|
||||
/**
|
||||
* <h3>Advanced</h3>
|
||||
* Constructor that takes resolution and framerate indicated as a single number.
|
||||
* Constructor that takes resolution and framerate.
|
||||
*
|
||||
* @param frameRate number of frames to read per second
|
||||
*/
|
||||
@@ -135,8 +135,7 @@ 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.
|
||||
* This constructor allows to specify resolution and camera name.
|
||||
*
|
||||
* @param cameraName name of the camera
|
||||
*/
|
||||
@@ -154,7 +153,7 @@ public class Capture extends PImage implements PConstants {
|
||||
|
||||
/**
|
||||
* <h3>Advanced</h3>
|
||||
* This constructor allows to specify the camera name and the desired framerate.
|
||||
* This constructor allows to specify the camera name and the desired framerate, in addition to the resolution.
|
||||
*/
|
||||
public Capture(PApplet parent, int requestWidth, int requestHeight, String cameraName, int frameRate) {
|
||||
super(requestWidth, requestHeight, RGB);
|
||||
@@ -234,7 +233,7 @@ public class Capture extends PImage implements PConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the stream is already producing frames.
|
||||
* Returns true if the capture device is already producing frames.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
@@ -279,7 +278,7 @@ public class Capture extends PImage implements PConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the capture pipeline.
|
||||
* Starts capturing frames from the selected device.
|
||||
*/
|
||||
public void start() {
|
||||
boolean init = false;
|
||||
@@ -380,6 +379,7 @@ public class Capture extends PImage implements PConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* <h3>Advanced</h3>
|
||||
* Returns the name of the source element used for capture.
|
||||
*
|
||||
* @return String
|
||||
@@ -463,6 +463,7 @@ public class Capture extends PImage implements PConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* <h3>Advanced</h3>
|
||||
* Returns a list with the resolutions supported by the capture device,
|
||||
* including width, height and frame rate.
|
||||
*
|
||||
@@ -485,6 +486,7 @@ public class Capture extends PImage implements PConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* <h3>Advanced</h3>
|
||||
* Prints all the gstreamer elements currently used in the
|
||||
* current pipeline instance.
|
||||
*
|
||||
|
||||
@@ -146,63 +146,6 @@ public class Movie extends PImage implements PConstants {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints all the gstreamer elements currently used in the
|
||||
* current player instance.
|
||||
*
|
||||
*/
|
||||
public void printElements() {
|
||||
List<Element> list = gplayer.getElementsRecursive();
|
||||
PApplet.println(list);
|
||||
for (Element element : list) {
|
||||
PApplet.println(element.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the object to use as destination for the frames read from the stream.
|
||||
* The color conversion mask is automatically set to the one required to
|
||||
* copy the frames to OpenGL.
|
||||
*
|
||||
* @param Object dest
|
||||
*/
|
||||
public void setPixelDest(Object dest) {
|
||||
copyHandler = dest;
|
||||
if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) {
|
||||
copyMask = "red_mask=(int)0xFF000000, green_mask=(int)0xFF0000, blue_mask=(int)0xFF00";
|
||||
} else {
|
||||
copyMask = "red_mask=(int)0xFF, green_mask=(int)0xFF00, blue_mask=(int)0xFF0000";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the object to use as destination for the frames read from the stream.
|
||||
*
|
||||
* @param Object dest
|
||||
* @param String mask
|
||||
*/
|
||||
public void setPixelDest(Object dest, String mask) {
|
||||
copyHandler = dest;
|
||||
copyMask = mask;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses a generic object as handler of the movie. This object should have a
|
||||
* movieEvent method that receives a GSMovie argument. This method will
|
||||
* be called upon a new frame read event.
|
||||
*
|
||||
*/
|
||||
public void setEventHandlerObject(Object obj) {
|
||||
eventHandler = obj;
|
||||
|
||||
try {
|
||||
movieEventMethod = eventHandler.getClass().getMethod("movieEvent",
|
||||
new Class[] { Movie.class });
|
||||
} catch (Exception e) {
|
||||
// no such method, or an error.. which is fine, just ignore
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the width of the source video. Note: calling this method repeatedly
|
||||
* can slow down playback performance.
|
||||
@@ -700,6 +643,63 @@ public class Movie extends PImage implements PConstants {
|
||||
return filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints all the gstreamer elements currently used in the
|
||||
* current player instance.
|
||||
*
|
||||
*/
|
||||
public void printElements() {
|
||||
List<Element> list = gplayer.getElementsRecursive();
|
||||
PApplet.println(list);
|
||||
for (Element element : list) {
|
||||
PApplet.println(element.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the object to use as destination for the frames read from the stream.
|
||||
* The color conversion mask is automatically set to the one required to
|
||||
* copy the frames to OpenGL.
|
||||
*
|
||||
* @param Object dest
|
||||
*/
|
||||
public void setPixelDest(Object dest) {
|
||||
copyHandler = dest;
|
||||
if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) {
|
||||
copyMask = "red_mask=(int)0xFF000000, green_mask=(int)0xFF0000, blue_mask=(int)0xFF00";
|
||||
} else {
|
||||
copyMask = "red_mask=(int)0xFF, green_mask=(int)0xFF00, blue_mask=(int)0xFF0000";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the object to use as destination for the frames read from the stream.
|
||||
*
|
||||
* @param Object dest
|
||||
* @param String mask
|
||||
*/
|
||||
public void setPixelDest(Object dest, String mask) {
|
||||
copyHandler = dest;
|
||||
copyMask = mask;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses a generic object as handler of the movie. This object should have a
|
||||
* movieEvent method that receives a GSMovie argument. This method will
|
||||
* be called upon a new frame read event.
|
||||
*
|
||||
*/
|
||||
public void setEventHandlerObject(Object obj) {
|
||||
eventHandler = obj;
|
||||
|
||||
try {
|
||||
movieEventMethod = eventHandler.getClass().getMethod("movieEvent",
|
||||
new Class[] { Movie.class });
|
||||
} catch (Exception e) {
|
||||
// no such method, or an error.. which is fine, just ignore
|
||||
}
|
||||
}
|
||||
|
||||
protected void initGStreamer(PApplet parent, String filename) {
|
||||
this.parent = parent;
|
||||
gplayer = null;
|
||||
|
||||
Reference in New Issue
Block a user