We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
Playback FasterMovies memory problem (Read 290 times)
Playback FasterMovies memory problem
Mar 2nd, 2009, 7:43pm
 
Hi,

I need to play some movie and I use FasterMovie class in OPENGL.
In order to make this, I create fm as FasterMovie class istance and, to change movie, I assign null to fm; then i call the FasterMovie constructor with the new movie url. I've tried to call System.gc() after fm null assignement but when the application load the new movie (or the same) the memory allocated increase more than it decrease closing the movie.
The result is an out of memory error after some times of movie load.

why this happen?
Re: Playback FasterMovies memory problem
Reply #1 - Mar 2nd, 2009, 7:44pm
 
Here a code example:

import processing.opengl.*;
import processing.video.*;
import javax.media.opengl.*;
import java.nio.*;
import com.sun.opengl.util.*;

FasterMovie fm;
IntBuffer buf;
int movie_focus;

PGraphicsOpenGL pgl;
GL gl;

void setup ()
{
 size(1024,768,OPENGL);

 fm = new FasterMovie(this, "Sharkwater.mov", false);
 fm.loop();
 buf = BufferUtil.newIntBuffer(fm.width*fm.height);

 pgl = (PGraphicsOpenGL) g;
}

void draw ()
{
 background(0);

   gl = pgl.beginGL();
   gl.glRasterPos2f(abs(width-fm.width)/2+1, height-abs(height-fm.height)/2 - 1);
   gl.glDrawPixels(fm.width,fm.height,GL.GL_RGBA,GL.GL_UNSIGNED_BYTE,buf);
   pgl.endGL();

   buf.put(fm.pixels);
   buf.rewind();
 
}

void keyPressed() {
   fm = null;
   buf = null;
   
   System.gc();
   
   fm = new FasterMovie(this, "Sharkwater.mov", false);
   fm.loop();
   buf = BufferUtil.newIntBuffer(fm.width*fm.height);

   System.gc();
   
}



Re: Playback FasterMovies memory problem
Reply #2 - Mar 2nd, 2009, 7:51pm
 
Sorry..

I work on Windows XP, Intel core-duo QUAD width 2 GB of RAM and I use Processing 1.0.2.
The movie is a .mov 852x480 pixels. Duration 1'15".

thanks in advance for your help.

lucascamel
Page Index Toggle Pages: 1