From 57ad715fcfcdc9115db5aaf1bf4be248a08fd72e Mon Sep 17 00:00:00 2001 From: codeanticode Date: Thu, 18 Aug 2011 22:32:09 +0000 Subject: [PATCH] Updated video examples to reflect new library and class names --- .../Capture/AsciiVideo/AsciiVideo.pde | 9 +- .../BackgroundSubtraction.pde | 6 +- .../BrightnessThresholding.pde | 6 +- .../BrightnessTracking/BrightnessTracking.pde | 6 +- .../Capture/ColorSorting/ColorSorting.pde | 6 +- .../examples/Capture/Disgrand/Disgrand.pde | 7 +- .../FrameDifferencing/FrameDifferencing.pde | 6 +- .../Capture/Framingham/Framingham.pde | 6 +- .../GettingStartedCaptureLinux.pde | 14 +-- .../GettingStartedCaptureMac.pde | 10 +- .../GettingStartedCaptureWin.pde | 8 +- .../examples/Capture/HsvSpace/HsvSpace.pde | 10 +- .../examples/Capture/LivePocky/LivePocky.pde | 8 +- .../video/examples/Capture/Mirror/Mirror.pde | 6 +- .../examples/Capture/Mirror2/Mirror2.pde | 6 +- .../Capture/RadialPocky/RadialPocky.pde | 7 +- .../examples/Capture/SlitScan/SlitScan.pde | 7 +- .../video/examples/Movie/Frames/Frames.pde | 8 +- .../video/examples/Movie/Loop/Loop.pde | 74 ++++++------- .../examples/Movie/Pixelate/Pixelate.pde | 100 +++++++++--------- .../video/examples/Movie/Reverse/Reverse.pde | 8 +- .../video/examples/Movie/Scratch/Scratch.pde | 98 ++++++++--------- .../video/examples/Movie/Speed/Speed.pde | 8 +- 23 files changed, 210 insertions(+), 214 deletions(-) diff --git a/java/libraries/video/examples/Capture/AsciiVideo/AsciiVideo.pde b/java/libraries/video/examples/Capture/AsciiVideo/AsciiVideo.pde index ccfb2e103..aa9151a4d 100644 --- a/java/libraries/video/examples/Capture/AsciiVideo/AsciiVideo.pde +++ b/java/libraries/video/examples/Capture/AsciiVideo/AsciiVideo.pde @@ -9,10 +9,9 @@ * See the keyPressed function for more options, like changing the font size. */ -import processing.opengl.*; -import codeanticode.gsvideo.*; +import processing.video.*; -GSCapture video; +Capture video; boolean cheatScreen; // All ASCII characters, sorted according to their visual density @@ -34,7 +33,7 @@ public void setup() { //size(screen.width, screen.height, OPENGL); // Uses the default video input, see the reference if this causes an error - video = new GSCapture(this, 160, 120); + video = new Capture(this, 160, 120); video.start(); int count = video.width * video.height; println(count); @@ -61,7 +60,7 @@ public void setup() { } -public void captureEvent(GSCapture c) { +public void captureEvent(Capture c) { c.read(); } diff --git a/java/libraries/video/examples/Capture/BackgroundSubtraction/BackgroundSubtraction.pde b/java/libraries/video/examples/Capture/BackgroundSubtraction/BackgroundSubtraction.pde index 3f6619ca6..46ec4c11a 100644 --- a/java/libraries/video/examples/Capture/BackgroundSubtraction/BackgroundSubtraction.pde +++ b/java/libraries/video/examples/Capture/BackgroundSubtraction/BackgroundSubtraction.pde @@ -9,17 +9,17 @@ */ -import codeanticode.gsvideo.*; +import processing.video.*; int numPixels; int[] backgroundPixels; -GSCapture video; +Capture video; void setup() { // Change size to 320 x 240 if too slow at 640 x 480 size(640, 480); - video = new GSCapture(this, width, height); + video = new Capture(this, width, height); video.start(); numPixels = video.width * video.height; // Create array to store the background image diff --git a/java/libraries/video/examples/Capture/BrightnessThresholding/BrightnessThresholding.pde b/java/libraries/video/examples/Capture/BrightnessThresholding/BrightnessThresholding.pde index 825a4a92d..180e2dbfd 100644 --- a/java/libraries/video/examples/Capture/BrightnessThresholding/BrightnessThresholding.pde +++ b/java/libraries/video/examples/Capture/BrightnessThresholding/BrightnessThresholding.pde @@ -9,18 +9,18 @@ */ -import codeanticode.gsvideo.*; +import processing.video.*; color black = color(0); color white = color(255); int numPixels; -GSCapture video; +Capture video; void setup() { size(640, 480); // Change size to 320 x 240 if too slow at 640 x 480 strokeWeight(5); // Uses the default video input, see the reference if this causes an error - video = new GSCapture(this, width, height); + video = new Capture(this, width, height); video.start(); numPixels = video.width * video.height; noCursor(); diff --git a/java/libraries/video/examples/Capture/BrightnessTracking/BrightnessTracking.pde b/java/libraries/video/examples/Capture/BrightnessTracking/BrightnessTracking.pde index 01678794e..967df6ad1 100644 --- a/java/libraries/video/examples/Capture/BrightnessTracking/BrightnessTracking.pde +++ b/java/libraries/video/examples/Capture/BrightnessTracking/BrightnessTracking.pde @@ -8,14 +8,14 @@ */ -import codeanticode.gsvideo.*; +import processing.video.*; -GSCapture video; +Capture video; void setup() { size(640, 480); // Change size to 320 x 240 if too slow at 640 x 480 // Uses the default video input, see the reference if this causes an error - video = new GSCapture(this, width, height); + video = new Capture(this, width, height); video.start(); noStroke(); smooth(); diff --git a/java/libraries/video/examples/Capture/ColorSorting/ColorSorting.pde b/java/libraries/video/examples/Capture/ColorSorting/ColorSorting.pde index b61ac8b6b..d44b55986 100644 --- a/java/libraries/video/examples/Capture/ColorSorting/ColorSorting.pde +++ b/java/libraries/video/examples/Capture/ColorSorting/ColorSorting.pde @@ -9,9 +9,9 @@ */ -import codeanticode.gsvideo.*; +import processing.video.*; -GSCapture video; +Capture video; boolean cheatScreen; Tuple[] captureColors; @@ -27,7 +27,7 @@ public void setup() { noCursor(); // Uses the default video input, see the reference if this causes an error - video = new GSCapture(this, 160, 120); + video = new Capture(this, 160, 120); video.start(); int count = (video.width * video.height) / (increment * increment); diff --git a/java/libraries/video/examples/Capture/Disgrand/Disgrand.pde b/java/libraries/video/examples/Capture/Disgrand/Disgrand.pde index ad06f8a8c..fa1afaf9d 100644 --- a/java/libraries/video/examples/Capture/Disgrand/Disgrand.pde +++ b/java/libraries/video/examples/Capture/Disgrand/Disgrand.pde @@ -8,10 +8,9 @@ * and arranges them into vertical bars. */ - -import codeanticode.gsvideo.*; +import processing.video.*; -GSCapture video; +Capture video; boolean cheatScreen; Tuple[] captureColors; @@ -27,7 +26,7 @@ public void setup() { noCursor(); // Uses the default video input, see the reference if this causes an error - video = new GSCapture(this, 160, 120); + video = new Capture(this, 160, 120); video.start(); int count = (video.width * video.height) / (increment * increment); diff --git a/java/libraries/video/examples/Capture/FrameDifferencing/FrameDifferencing.pde b/java/libraries/video/examples/Capture/FrameDifferencing/FrameDifferencing.pde index 897bc8cfd..e54f92c27 100644 --- a/java/libraries/video/examples/Capture/FrameDifferencing/FrameDifferencing.pde +++ b/java/libraries/video/examples/Capture/FrameDifferencing/FrameDifferencing.pde @@ -8,16 +8,16 @@ */ -import codeanticode.gsvideo.*; +import processing.video.*; int numPixels; int[] previousFrame; -GSCapture video; +Capture video; void setup() { size(640, 480); // Change size to 320 x 240 if too slow at 640 x 480 // Uses the default video input, see the reference if this causes an error - video = new GSCapture(this, width, height); + video = new Capture(this, width, height); video.start(); numPixels = video.width * video.height; // Create an array to store the previously captured frame diff --git a/java/libraries/video/examples/Capture/Framingham/Framingham.pde b/java/libraries/video/examples/Capture/Framingham/Framingham.pde index e522c9aab..e3363f16a 100644 --- a/java/libraries/video/examples/Capture/Framingham/Framingham.pde +++ b/java/libraries/video/examples/Capture/Framingham/Framingham.pde @@ -8,9 +8,9 @@ */ -import codeanticode.gsvideo.*; +import processing.video.*; -GSCapture video; +Capture video; int column; int columnCount; int lastRow; @@ -23,7 +23,7 @@ void setup() { size(640, 480, P3D); // Uses the default video input, see the reference if this causes an error - video = new GSCapture(this, 160, 120); + video = new Capture(this, 160, 120); video.start(); // Also try with other video sizes diff --git a/java/libraries/video/examples/Capture/GettingStartedCaptureLinux/GettingStartedCaptureLinux.pde b/java/libraries/video/examples/Capture/GettingStartedCaptureLinux/GettingStartedCaptureLinux.pde index f2016788a..1772f959c 100644 --- a/java/libraries/video/examples/Capture/GettingStartedCaptureLinux/GettingStartedCaptureLinux.pde +++ b/java/libraries/video/examples/Capture/GettingStartedCaptureLinux/GettingStartedCaptureLinux.pde @@ -5,16 +5,16 @@ * * Reading and displaying an image from an attached Capture device. */ -import codeanticode.gsvideo.*; +import processing.video.*; -GSCapture cam; +Capture cam; void setup() { size(640, 480); /* // List functionality still not ready on Linux - String[] cameras = GSCapture.list(); + String[] cameras = Capture.list(); if (cameras.length == 0) { @@ -24,16 +24,16 @@ void setup() { println("Available cameras:"); for (int i = 0; i < cameras.length; i++) println(cameras[i]); - cam = new GSCapture(this, 640, 480, cameras[0]); + cam = new Capture(this, 640, 480, cameras[0]); } However, different cameras can be selected by using their device file: - cam = new GSCapture(this, 640, 480, "/dev/video0"); - cam = new GSCapture(this, 640, 480, "/dev/video1"); + cam = new Capture(this, 640, 480, "/dev/video0"); + cam = new Capture(this, 640, 480, "/dev/video1"); etc. */ - cam = new GSCapture(this, 640, 480); + cam = new Capture(this, 640, 480); cam.start(); /* diff --git a/java/libraries/video/examples/Capture/GettingStartedCaptureMac/GettingStartedCaptureMac.pde b/java/libraries/video/examples/Capture/GettingStartedCaptureMac/GettingStartedCaptureMac.pde index e9b43a8da..a3e61bc52 100644 --- a/java/libraries/video/examples/Capture/GettingStartedCaptureMac/GettingStartedCaptureMac.pde +++ b/java/libraries/video/examples/Capture/GettingStartedCaptureMac/GettingStartedCaptureMac.pde @@ -5,9 +5,9 @@ * * Reading and displaying an image from an attached Capture device. */ -import codeanticode.gsvideo.*; +import processing.video.*; -GSCapture cam; +Capture cam; void setup() { size(640, 480); @@ -15,7 +15,7 @@ void setup() { /* // List functionality hasn't been tested on Mac OSX. Uncomment this // code to try it out. - String[] cameras = GSCapture.list(); + String[] cameras = Capture.list(); if (cameras.length == 0) { @@ -25,10 +25,10 @@ void setup() { println("Available cameras:"); for (int i = 0; i < cameras.length; i++) println(cameras[i]); - cam = new GSCapture(this, 320, 240, cameras[0]); + cam = new Capture(this, 320, 240, cameras[0]); } */ - cam = new GSCapture(this, 640, 480); + cam = new Capture(this, 640, 480); cam.start(); /* diff --git a/java/libraries/video/examples/Capture/GettingStartedCaptureWin/GettingStartedCaptureWin.pde b/java/libraries/video/examples/Capture/GettingStartedCaptureWin/GettingStartedCaptureWin.pde index 42b798b1d..ea6ef7feb 100644 --- a/java/libraries/video/examples/Capture/GettingStartedCaptureWin/GettingStartedCaptureWin.pde +++ b/java/libraries/video/examples/Capture/GettingStartedCaptureWin/GettingStartedCaptureWin.pde @@ -5,14 +5,14 @@ * * Reading and displaying an image from an attached Capture device. */ -import codeanticode.gsvideo.*; +import processing.video.*; -GSCapture cam; +Capture cam; void setup() { size(640, 480); - String[] cameras = GSCapture.list(); + String[] cameras = Capture.list(); if (cameras.length == 0) { @@ -23,7 +23,7 @@ void setup() { for (int i = 0; i < cameras.length; i++) { println(cameras[i]); } - cam = new GSCapture(this, 640, 480, cameras[0]); + cam = new Capture(this, 640, 480, cameras[0]); cam.start(); /* diff --git a/java/libraries/video/examples/Capture/HsvSpace/HsvSpace.pde b/java/libraries/video/examples/Capture/HsvSpace/HsvSpace.pde index b56e68f8b..8ff72eb39 100644 --- a/java/libraries/video/examples/Capture/HsvSpace/HsvSpace.pde +++ b/java/libraries/video/examples/Capture/HsvSpace/HsvSpace.pde @@ -6,11 +6,11 @@ * * Arrange the pixels from live video into the HSV Color Cone. */ -import processing.opengl.*; -import codeanticode.gsvideo.*; + +import processing.video.*; import java.awt.Color; -GSCapture video; +Capture video; int count; boolean cheatScreen = true; @@ -40,7 +40,7 @@ public void setup() { size(640, 480, P3D); //size(screen.width, screen.height, OPENGL); - video = new GSCapture(this, 160, 120); + video = new Capture(this, 160, 120); video.start(); count = video.width * video.height; @@ -133,7 +133,7 @@ void draw() { } -void captureEvent(GSCapture c) { +void captureEvent(Capture c) { c.read(); c.loadPixels(); } diff --git a/java/libraries/video/examples/Capture/LivePocky/LivePocky.pde b/java/libraries/video/examples/Capture/LivePocky/LivePocky.pde index b1ec0ba67..6713873d8 100644 --- a/java/libraries/video/examples/Capture/LivePocky/LivePocky.pde +++ b/java/libraries/video/examples/Capture/LivePocky/LivePocky.pde @@ -7,9 +7,9 @@ * Unwrap each frame of live video into a single line of pixels. */ -import codeanticode.gsvideo.*; +import processing.video.*; -GSCapture video; +Capture video; int count; int writeRow; int maxRows; @@ -21,7 +21,7 @@ void setup() { size(600, 400); // Uses the default video input, see the reference if this causes an error - video = new GSCapture(this, 160, 120); + video = new Capture(this, 160, 120); video.start(); maxRows = height * 2; @@ -44,7 +44,7 @@ void draw() { } -void captureEvent(GSCapture c) { +void captureEvent(Capture c) { c.read(); c.loadPixels(); arraycopy(c.pixels, 0, buffer, writeRow * width, width); diff --git a/java/libraries/video/examples/Capture/Mirror/Mirror.pde b/java/libraries/video/examples/Capture/Mirror/Mirror.pde index 91bc36b57..17f4110ca 100644 --- a/java/libraries/video/examples/Capture/Mirror/Mirror.pde +++ b/java/libraries/video/examples/Capture/Mirror/Mirror.pde @@ -7,7 +7,7 @@ * Each pixel from the video source is drawn as a rectangle with rotation based on brightness. */ -import codeanticode.gsvideo.*; +import processing.video.*; // Size of each cell in the grid @@ -15,7 +15,7 @@ int cellSize = 20; // Number of columns and rows in our system int cols, rows; // Variable for capture device -GSCapture video; +Capture video; void setup() { @@ -26,7 +26,7 @@ void setup() { colorMode(RGB, 255, 255, 255, 100); // Uses the default video input, see the reference if this causes an error - video = new GSCapture(this, width, height); + video = new Capture(this, width, height); video.start(); background(0); diff --git a/java/libraries/video/examples/Capture/Mirror2/Mirror2.pde b/java/libraries/video/examples/Capture/Mirror2/Mirror2.pde index 4ba79c591..badbe83b9 100644 --- a/java/libraries/video/examples/Capture/Mirror2/Mirror2.pde +++ b/java/libraries/video/examples/Capture/Mirror2/Mirror2.pde @@ -7,14 +7,14 @@ * Each pixel from the video source is drawn as a rectangle with size based on brightness. */ -import codeanticode.gsvideo.*; +import processing.video.*; // Size of each cell in the grid int cellSize = 15; // Number of columns and rows in our system int cols, rows; // Variable for capture device -GSCapture video; +Capture video; void setup() { @@ -26,7 +26,7 @@ void setup() { rectMode(CENTER); // Uses the default video input, see the reference if this causes an error - video = new GSCapture(this, width, height); + video = new Capture(this, width, height); video.start(); background(0); diff --git a/java/libraries/video/examples/Capture/RadialPocky/RadialPocky.pde b/java/libraries/video/examples/Capture/RadialPocky/RadialPocky.pde index 61fa34fc9..c4b43ee22 100644 --- a/java/libraries/video/examples/Capture/RadialPocky/RadialPocky.pde +++ b/java/libraries/video/examples/Capture/RadialPocky/RadialPocky.pde @@ -7,10 +7,9 @@ * Unwrap each frame of live video into a single line of pixels along a circle */ -import codeanticode.gsvideo.*; +import processing.video.*; - -GSCapture video; +Capture video; int videoCount; int currentAngle; int pixelCount; @@ -25,7 +24,7 @@ void setup() { size(600, 600); // Uses the default video input, see the reference if this causes an error - video = new GSCapture(this, 160, 120); + video = new Capture(this, 160, 120); video.start(); videoCount = video.width * video.height; diff --git a/java/libraries/video/examples/Capture/SlitScan/SlitScan.pde b/java/libraries/video/examples/Capture/SlitScan/SlitScan.pde index 9cded760f..46b2989b1 100644 --- a/java/libraries/video/examples/Capture/SlitScan/SlitScan.pde +++ b/java/libraries/video/examples/Capture/SlitScan/SlitScan.pde @@ -12,19 +12,18 @@ * Created December 2006. * Updated June 2007 by fry. */ -import codeanticode.gsvideo.*; +import processing.video.*; -GSCapture video; +Capture video; int videoSliceX; int drawPositionX; - void setup() { size(600, 240); // Uses the default video input, see the reference if this causes an error - video = new GSCapture(this, 320, 240); + video = new Capture(this, 320, 240); video.start(); videoSliceX = video.width / 2; diff --git a/java/libraries/video/examples/Movie/Frames/Frames.pde b/java/libraries/video/examples/Movie/Frames/Frames.pde index 26ece2f61..69c9ff7a5 100644 --- a/java/libraries/video/examples/Movie/Frames/Frames.pde +++ b/java/libraries/video/examples/Movie/Frames/Frames.pde @@ -6,9 +6,9 @@ * arrow keys. */ -import codeanticode.gsvideo.*; +import processing.video.*; -GSMovie movie; +Movie movie; int newFrame = 0; PFont font; @@ -19,14 +19,14 @@ void setup() { // in play mode is needed so at least one frame is read // and we can get duration, size and other information from // the video stream. - movie = new GSMovie(this, "station.mov"); + movie = new Movie(this, "station.mov"); movie.play(); font = loadFont("DejaVuSans-24.vlw"); textFont(font, 24); } -void movieEvent(GSMovie movie) { +void movieEvent(Movie movie) { movie.read(); } diff --git a/java/libraries/video/examples/Movie/Loop/Loop.pde b/java/libraries/video/examples/Movie/Loop/Loop.pde index 39fe9bee6..47cf19608 100644 --- a/java/libraries/video/examples/Movie/Loop/Loop.pde +++ b/java/libraries/video/examples/Movie/Loop/Loop.pde @@ -1,37 +1,37 @@ -/** - * Loop. - * Built-in video library replaced with gsvideo by Andres Colubri - * - * Move the cursor across the screen to draw. - * Shows how to load and play a QuickTime movie file. - * - * Note: GSVideo uses GStreamer as the underlying multimedia library - * for reading media files, decoding, encoding, etc. - * It is based on a set of Java bindings for GStreamer called - * gstreamer-java originally created by Wayne Meissner and currently - * mantained by a small team of volunteers. GStreamer-java can be - * used from any Java program, and it is available for download at - * the following website: - * http://code.google.com/p/gstreamer-java/ - */ - -import codeanticode.gsvideo.*; - -GSMovie movie; - -void setup() { - size(640, 480); - background(0); - // Load and play the video in a loop - movie = new GSMovie(this, "station.mov"); - movie.loop(); -} - -void movieEvent(GSMovie movie) { - movie.read(); -} - -void draw() { - tint(255, 20); - image(movie, mouseX-movie.width/2, mouseY-movie.height/2); -} +/** + * Loop. + * Built-in video library replaced with gsvideo by Andres Colubri + * + * Move the cursor across the screen to draw. + * Shows how to load and play a QuickTime movie file. + * + * Note: GSVideo uses GStreamer as the underlying multimedia library + * for reading media files, decoding, encoding, etc. + * It is based on a set of Java bindings for GStreamer called + * gstreamer-java originally created by Wayne Meissner and currently + * mantained by a small team of volunteers. GStreamer-java can be + * used from any Java program, and it is available for download at + * the following website: + * http://code.google.com/p/gstreamer-java/ + */ + +import processing.video.*; + +Movie movie; + +void setup() { + size(640, 480); + 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); +} diff --git a/java/libraries/video/examples/Movie/Pixelate/Pixelate.pde b/java/libraries/video/examples/Movie/Pixelate/Pixelate.pde index f7ae5ac87..a4b62aada 100644 --- a/java/libraries/video/examples/Movie/Pixelate/Pixelate.pde +++ b/java/libraries/video/examples/Movie/Pixelate/Pixelate.pde @@ -1,50 +1,50 @@ -/** - * Pixelate - * by Hernando Barragan. - * Built-in video library replaced with gsvideo by Andres Colubri - * - * 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 codeanticode.gsvideo.*; - -int numPixels; -int blockSize = 10; -GSMovie myMovie; -color myMovieColors[]; - -void setup() { - size(640, 480); - noStroke(); - background(0); - myMovie = new GSMovie(this, "station.mov"); - myMovie.loop(); - numPixels = width / blockSize; - myMovieColors = new color[numPixels * numPixels]; -} - - -// Read new values from movie -void movieEvent(GSMovie m) { - m.read(); - m.loadPixels(); - - for (int j = 0; j < numPixels; j++) { - for (int i = 0; i < numPixels; i++) { - myMovieColors[j*numPixels + i] = m.get(i, j); - } - } -} - - -// Display values from movie -void draw() { - 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); - } - } -} +/** + * Pixelate + * by Hernando Barragan. + * Built-in video library replaced with gsvideo by Andres Colubri + * + * 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); + 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(); + m.loadPixels(); + + for (int j = 0; j < numPixels; j++) { + for (int i = 0; i < numPixels; i++) { + myMovieColors[j*numPixels + i] = m.get(i, j); + } + } +} + + +// Display values from movie +void draw() { + 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); + } + } +} diff --git a/java/libraries/video/examples/Movie/Reverse/Reverse.pde b/java/libraries/video/examples/Movie/Reverse/Reverse.pde index a34fc39e9..c3c0b5e08 100644 --- a/java/libraries/video/examples/Movie/Reverse/Reverse.pde +++ b/java/libraries/video/examples/Movie/Reverse/Reverse.pde @@ -13,19 +13,19 @@ * */ -import codeanticode.gsvideo.*; +import processing.video.*; -GSMovie myMovie; +Movie myMovie; boolean speedSet = false; public void setup() { size(320, 240); background(0); - myMovie = new GSMovie(this, "balloon.ogg"); + myMovie = new Movie(this, "balloon.ogg"); myMovie.play(); } -public void movieEvent(GSMovie myMovie) { +public void movieEvent(Movie myMovie) { myMovie.read(); } diff --git a/java/libraries/video/examples/Movie/Scratch/Scratch.pde b/java/libraries/video/examples/Movie/Scratch/Scratch.pde index 450835079..2ca65618a 100644 --- a/java/libraries/video/examples/Movie/Scratch/Scratch.pde +++ b/java/libraries/video/examples/Movie/Scratch/Scratch.pde @@ -1,49 +1,49 @@ -/** - * Scratch. - * by Andres Colubri - * - * Move the cursor horizontally across the screen to set - * the position in the movie file. - */ - -import codeanticode.gsvideo.*; - -GSMovie movie; - -void setup() { - size(640, 480); - background(0); - // Load and set the video to play. Setting the video - // in play mode is needed so at least one frame is read - // and we can get duration, size and other information from - // the video stream. - movie = new GSMovie(this, "station.mov"); - movie.play(); -} - -void movieEvent(GSMovie 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; - - // If the new time is different enough from the current position, - // then we jump to the new position. But how different? Here the - // difference has been set to 0.1 (1 tenth of a second), but it can - // be smaller. My guess is that the smallest value should correspond - // to the duration of a single frame (for instance 1/24 if the frame rate - // of the video file is 24fps). Setting even smaller values seem to lead - // to choppiness. This will become trickier once the GSMovie.speed() - // and GSMovie.frameRate() methods become functional. - if (0.1 < abs(t - movie.time())) { - // The movie stream must be in play mode in order to jump to another - // position along the stream. Otherwise it won't work. - movie.play(); - movie.jump(t); - movie.pause(); - } - image(movie, 0, 0, width, height); -} +/** + * 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); + background(0); + // Load and set the video to play. Setting the video + // in play mode is needed so at least one frame is read + // and we can get duration, size and other information from + // the video stream. + movie = new Movie(this, "station.mov"); + movie.play(); +} + +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; + + // If the new time is different enough from the current position, + // then we jump to the new position. But how different? Here the + // difference has been set to 0.1 (1 tenth of a second), but it can + // be smaller. My guess is that the smallest value should correspond + // to the duration of a single frame (for instance 1/24 if the frame rate + // of the video file is 24fps). Setting even smaller values seem to lead + // to choppiness. This will become trickier once the Movie.speed() + // and Movie.frameRate() methods become functional. + if (0.1 < abs(t - movie.time())) { + // The movie stream must be in play mode in order to jump to another + // position along the stream. Otherwise it won't work. + movie.play(); + movie.jump(t); + movie.pause(); + } + image(movie, 0, 0, width, height); +} diff --git a/java/libraries/video/examples/Movie/Speed/Speed.pde b/java/libraries/video/examples/Movie/Speed/Speed.pde index cc269772b..7eb6fd175 100644 --- a/java/libraries/video/examples/Movie/Speed/Speed.pde +++ b/java/libraries/video/examples/Movie/Speed/Speed.pde @@ -6,21 +6,21 @@ * */ -import codeanticode.gsvideo.*; +import processing.video.*; -GSMovie movie; +Movie movie; public void setup() { size(320, 240); background(0); - movie = new GSMovie(this, "balloon.ogg"); + movie = new Movie(this, "balloon.ogg"); movie.loop(); PFont font = loadFont("DejaVuSans-24.vlw"); textFont(font, 24); } -public void movieEvent(GSMovie movie) { +public void movieEvent(Movie movie) { movie.read(); }