Temporarily removing Movie examples

This commit is contained in:
Casey Reas
2012-08-31 19:04:59 +00:00
parent b2835fc818
commit d564962e0f
8 changed files with 0 additions and 280 deletions
@@ -1,86 +0,0 @@
/**
* Frames.
* by Andres Colubri
*
* Moves through the video one frame at the time by using the
* arrow keys. Because it estimates the frame counts using the
* framerate of the movie file, and also, many movie codecs don't
* actually support jumping to arbitrary frames, don't expect
* accurate results in most cases.
*
*/
import processing.video.*;
Movie movie;
int newFrame;
PFont font;
void setup() {
size(320, 240, P2D);
background(0);
movie = new Movie(this, "station.mov");
newFrame = 0;
setFrame(newFrame);
noLoop();
font = loadFont("DejaVuSans-24.vlw");
textFont(font, 24);
}
void movieEvent(Movie movie) {
movie.read();
}
void draw() {
image(movie, 0, 0, width, height);
fill(240, 20, 30);
text(getFrame() + " / " + (getLength() - 1), 10, 30);
}
void keyPressed() {
if (key == CODED) {
if (keyCode == LEFT) {
if (0 < newFrame) newFrame--;
} else if (keyCode == RIGHT) {
if (newFrame < getLength() - 1) newFrame++;
}
}
setFrame(newFrame);
}
int getFrame() {
return ceil(movie.time() * movie.frameRate) - 1;
}
void setFrame(int n) {
movie.play();
float srcFramerate = movie.frameRate;
// The duration of a single frame:
float frameDuration = 1.0 / srcFramerate;
// We move to the middle of the frame by adding 0.5:
float where = (n + 0.5) * frameDuration;
// Taking into account border effects:
float diff = movie.duration() - where;
if (diff < 0) {
where += diff - 0.25 * frameDuration;
}
movie.jump(where);
movie.pause();
redraw();
}
int getLength() {
return int(movie.duration() * movie.frameRate);
}
@@ -1,28 +0,0 @@
/**
* Loop.
*
* Move the cursor across the screen to draw.
* Shows how to load and play a QuickTime movie file.
*
*/
import processing.video.*;
Movie movie;
void setup() {
size(640, 480, P2D);
background(0);
// Load and play the video in a loop
movie = new Movie(this, "station.mov");
movie.loop();
}
void movieEvent(Movie movie) {
movie.read();
}
void draw() {
tint(255, 20);
image(movie, mouseX-movie.width/2, mouseY-movie.height/2);
}
@@ -1,50 +0,0 @@
/**
* Pixelate
* by Hernando Barragan.
*
* Load a QuickTime file and display the video signal
* using rectangles as pixels by reading the values stored
* in the current video frame pixels array.
*/
import processing.video.*;
int numPixels;
int blockSize = 10;
Movie myMovie;
color myMovieColors[];
void setup() {
size(640, 480, P2D);
noStroke();
background(0);
myMovie = new Movie(this, "station.mov");
myMovie.loop();
numPixels = width / blockSize;
myMovieColors = new color[numPixels * numPixels];
}
// Read new values from movie
void movieEvent(Movie m) {
m.read();
}
// Display values from movie
void draw() {
myMovie.loadPixels();
for (int j = 0; j < numPixels; j++) {
for (int i = 0; i < numPixels; i++) {
myMovieColors[j*numPixels + i] = myMovie.get(i, j);
}
}
for (int j = 0; j < numPixels; j++) {
for (int i = 0; i < numPixels; i++) {
fill(myMovieColors[j*numPixels + i]);
rect(i*blockSize, j*blockSize, blockSize-1, blockSize-1);
}
}
}
@@ -1,45 +0,0 @@
/**
* Reverse playback example.
*
* The Movie.speed() method allows to
* change the playback speed. Use negative
* values for backwards playback. Note that
* not all video formats support backwards
* playback. This depends on the underlying
* gstreamer plugins used by gsvideo. For
* example, the theora codec does support
* backward playback, but not so the H264
* codec, at least in its current version.
*
*/
import processing.video.*;
Movie myMovie;
boolean speedSet = false;
void setup() {
size(320, 240, P2D);
background(0);
myMovie = new Movie(this, "balloon.ogg");
myMovie.play();
}
void movieEvent(Movie myMovie) {
myMovie.read();
}
void draw() {
if (!speedSet) {
// Setting the speed should be done only once,
// this is the reason for the if statement.
speedSet = true;
myMovie.jump(myMovie.duration());
// -1 means backward playback at normal speed.
myMovie.speed(-1.0);
// Setting to play again, since the movie stop
// playback once it reached the end.
myMovie.play();
}
image(myMovie, 0, 0, width, height);
}
@@ -1,37 +0,0 @@
/**
* Scratch.
* by Andres Colubri
*
* Move the cursor horizontally across the screen to set
* the position in the movie file.
*/
import processing.video.*;
Movie movie;
void setup() {
size(640, 480, P2D);
background(0);
movie = new Movie(this, "station.mov");
// Pausing the video at the first frame.
movie.play();
movie.jump(0);
movie.pause();
}
void movieEvent(Movie movie) {
movie.read();
}
void draw() {
// A new time position is calculated using the current mouse location:
float f = constrain((float)mouseX / width, 0, 1);
float t = movie.duration() * f;
movie.play();
movie.jump(t);
movie.pause();
image(movie, 0, 0, width, height);
}
@@ -1,34 +0,0 @@
/**
* GSVideo movie speed example.
*
* Use the Movie.speed() method to change
* the playback speed.
*
*/
import processing.video.*;
Movie movie;
void setup() {
size(320, 240, P2D);
background(0);
movie = new Movie(this, "balloon.ogg");
movie.loop();
PFont font = loadFont("DejaVuSans-24.vlw");
textFont(font, 24);
}
void movieEvent(Movie movie) {
movie.read();
}
void draw() {
image(movie, 0, 0, width, height);
float newSpeed = map(mouseX, 0, width, 0.1, 2);
movie.speed(newSpeed);
fill(240, 20, 30);
text(nfc(newSpeed, 2) + "X", width - 80, 30);
}