codeanticode.gsvideo
Class GSMovie

java.lang.Object
  extended by processing.core.PImage
      extended by codeanticode.gsvideo.GSMovie
All Implemented Interfaces:
java.lang.Cloneable, processing.core.PConstants

public class GSMovie
extends processing.core.PImage
implements processing.core.PConstants

This class makes it possible to load movies and to play them back in many ways including looping, pausing, and changing speed.


Field Summary
 
Fields inherited from class processing.core.PImage
format, height, parent, pixels, width
 
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
 
Constructor Summary
GSMovie(processing.core.PApplet parent, java.lang.String filename)
          Creates an instance of GSMovie loading the movie from filename and with fps = 30.
GSMovie(processing.core.PApplet parent, java.lang.String filename, int ifps)
          Creates an instance of GSMovie loading the movie from filename and with fps = ifps.
 
Method Summary
 boolean available()
          Return the true or false depending on whether there is a new frame ready to be read.
 void dispose()
           
 float duration()
          Get the full length of this movie (in seconds).
 long frame()
          Return the current frame.
 void frameRate(int ifps)
          Set how often new frames are to be read from the movie.
 java.lang.String getFilename()
           
 void goToBeginning()
          Goes to the first frame of the movie.
 void jump(float where)
          Jump to a specific location (in seconds).
 long length()
          Get the full length of this movie (in frames).
 void loop()
          Begin playing the movie, with repeat.
 boolean newFrame()
          Return true or false depending on whether a new frame has been read.
 void noLoop()
          Shut off the repeating loop.
 void oldFrame()
          Sets the value of newFrame to false.
 void pause()
          Pause the movie at its current time.
 void play()
          Begin playing the movie, with no repeat.
 void read()
          Reads the current video frame.
 void speed(float irate)
          Set a multiplier for how fast/slow the movie should be run.
 void stop()
          Stop the movie, and rewind.
 float time()
          Return the current time in seconds.
 void volume(double v)
          Change the volume.
 void volume(int v)
          Change the volume.
 
Methods inherited from class processing.core.PImage
blend, blend, blendColor, clone, copy, copy, filter, filter, get, get, get, getCache, getImage, init, isModified, loadPixels, mask, mask, removeCache, resize, save, set, set, setCache, setModified, setModified, updatePixels, updatePixels
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GSMovie

public GSMovie(processing.core.PApplet parent,
               java.lang.String filename)
Creates an instance of GSMovie loading the movie from filename and with fps = 30.

Parameters:
parent - PApplet
filename - String

GSMovie

public GSMovie(processing.core.PApplet parent,
               java.lang.String filename,
               int ifps)
Creates an instance of GSMovie loading the movie from filename and with fps = ifps.

Parameters:
parent - PApplet
filename - String
ifps - int
Method Detail

duration

public float duration()
Get the full length of this movie (in seconds).

Returns:
float

frameRate

public void frameRate(int ifps)
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.

Parameters:
int - ifps
See Also:
speed

speed

public void speed(float irate)
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.

Parameters:
float - irate

time

public float time()
Return the current time in seconds.

Returns:
float

frame

public long frame()
Return the current frame.

Returns:
long

length

public long length()
Get the full length of this movie (in frames).

Returns:
float

jump

public void jump(float where)
Jump to a specific location (in seconds). The number is a float so fractions of seconds can be used.

Parameters:
float - where

available

public boolean available()
Return the true or false depending on whether there is a new frame ready to be read.

Returns:
boolean

newFrame

public boolean newFrame()
Return true or false depending on whether a new frame has been read.

Returns:
boolean

oldFrame

public void oldFrame()
Sets the value of newFrame to false.


play

public void play()
Begin playing the movie, with no repeat.


loop

public void loop()
Begin playing the movie, with repeat.


noLoop

public void noLoop()
Shut off the repeating loop.


pause

public void pause()
Pause the movie at its current time.


stop

public void stop()
Stop the movie, and rewind.


read

public void read()
Reads the current video frame.


goToBeginning

public void goToBeginning()
Goes to the first frame of the movie.


volume

public void volume(double v)
Change the volume. Values are from 0 to 1.


volume

public void volume(int v)
Change the volume. Values are a percent from 0 to 100.


getFilename

public java.lang.String getFilename()

dispose

public void dispose()


processing library gsvideo by Andres Colubri. (c) 2008