diff options
author | Sven Gothel <[email protected]> | 2008-12-01 14:43:04 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2008-12-01 14:43:04 +0000 |
commit | 19a886bd801c5608bf258615608a0d9f1f0b1596 (patch) | |
tree | 1b831fdc51dbf841b70d7e84804bedc4ca9d654f | |
parent | dbe8ec3faa5243743198cc638cabd08da4471ebb (diff) |
OMX cleanup
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/branches/JOGL_2_SANDBOX@302 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4
-rwxr-xr-x | src/demos/es2/openmax/MovieCube.java | 30 | ||||
-rwxr-xr-x | src/demos/es2/openmax/MovieSimple.java | 23 |
2 files changed, 32 insertions, 21 deletions
diff --git a/src/demos/es2/openmax/MovieCube.java b/src/demos/es2/openmax/MovieCube.java index 196fd95..5af3081 100755 --- a/src/demos/es2/openmax/MovieCube.java +++ b/src/demos/es2/openmax/MovieCube.java @@ -38,19 +38,23 @@ package demos.es2.openmax; import javax.media.opengl.*; import javax.media.opengl.util.*; -import com.sun.javafx.media.video.openmax.*; +import com.sun.openmax.*; import java.nio.*; import java.net.*; import com.sun.javafx.newt.*; -public class MovieCube implements MouseListener, GLEventListener { +public class MovieCube implements MouseListener, GLEventListener, OMXEventListener { GLWindow window; boolean quit = false; Cube cube=null; String stream; - OMXMoviePlayerImpl movie=null; + OMXInstance movie=null; + + public void changedAttributes(OMXInstance omx, int event_mask) { + System.out.println("changed stream attr ("+event_mask+"): "+omx); + } public void mouseClicked(MouseEvent e) { switch(e.getClickCount()) { @@ -105,7 +109,7 @@ public class MovieCube implements MouseListener, GLEventListener { // Shut things down cooperatively if(null!=movie) { - movie.dispose(); + movie.dispose(null); movie=null; } window.close(); @@ -129,9 +133,15 @@ public class MovieCube implements MouseListener, GLEventListener { gl.glActiveTexture(GL.GL_TEXTURE0); try { - movie = new OMXMoviePlayerImpl(new URL(stream)); + movie = new OMXInstance(); + movie.addEventListener(this); + movie.setStream(4, new URL(stream)); + System.out.println("p0 "+movie); } catch (MalformedURLException mue) { mue.printStackTrace(); } if(null!=movie) { + movie.setStreamAllEGLImageTexture2D(gl); + movie.activateStream(); + System.out.println("p1 "+movie); movie.play(); } @@ -160,19 +170,12 @@ public class MovieCube implements MouseListener, GLEventListener { System.out.println("reshape "+width+"x"+height); } - public void dispose() { - if(null!=movie) { - movie.dispose(); - movie=null; - } - } - public void display(GLAutoDrawable drawable) { GL gl = drawable.getGL(); com.sun.opengl.util.texture.Texture tex = null; if(null!=movie) { - tex=movie.lockTexture(); + tex=movie.getNextTextureID(); if(null!=tex) { System.out.println("Use: "+tex); tex.enable(); @@ -182,7 +185,6 @@ public class MovieCube implements MouseListener, GLEventListener { cube.display(drawable); if(null!=tex) { tex.disable(); - movie.unlockTexture(); } } diff --git a/src/demos/es2/openmax/MovieSimple.java b/src/demos/es2/openmax/MovieSimple.java index a25da04..d386eb4 100755 --- a/src/demos/es2/openmax/MovieSimple.java +++ b/src/demos/es2/openmax/MovieSimple.java @@ -38,14 +38,14 @@ import javax.media.opengl.*; import javax.media.opengl.util.*; import javax.media.opengl.glsl.*; -import com.sun.javafx.media.video.openmax.*; +import com.sun.openmax.*; import java.nio.*; import java.net.*; import com.sun.javafx.newt.*; -public class MovieSimple implements MouseListener, GLEventListener { +public class MovieSimple implements MouseListener, GLEventListener, OMXEventListener { private GLWindow window; private boolean quit = false; @@ -56,6 +56,10 @@ public class MovieSimple implements MouseListener, GLEventListener { private long curTime; private String stream; + public void changedAttributes(OMXInstance omx, int event_mask) { + System.out.println("changed stream attr ("+event_mask+"): "+omx); + } + public void mouseClicked(MouseEvent e) { switch(e.getClickCount()) { case 2: @@ -113,7 +117,7 @@ public class MovieSimple implements MouseListener, GLEventListener { // Shut things down cooperatively if(null!=movie) { - movie.dispose(); + movie.dispose(null); movie=null; } window.close(); @@ -149,7 +153,7 @@ public class MovieSimple implements MouseListener, GLEventListener { st.attachShaderProgram(gl, sp); } - OMXMoviePlayerImpl movie=null; + OMXInstance movie=null; public void init(GLAutoDrawable drawable) { GL2ES2 gl = drawable.getGL().getGL2ES2(); @@ -239,9 +243,15 @@ public class MovieSimple implements MouseListener, GLEventListener { System.out.println(st); try { - movie = new OMXMoviePlayerImpl(new URL(stream)); + movie = new OMXInstance(); + movie.addEventListener(this); + movie.setStream(4, new URL(stream)); + System.out.println("p0 "+movie); } catch (MalformedURLException mue) { mue.printStackTrace(); } if(null!=movie) { + //movie.setStreamAllEGLImageTexture2D(gl); + //movie.activateStream(); + //System.out.println("p1 "+movie); movie.play(); } } @@ -303,7 +313,7 @@ public class MovieSimple implements MouseListener, GLEventListener { com.sun.opengl.util.texture.Texture tex = null; if(null!=movie) { - tex=movie.lockTexture(); + tex=movie.getNextTextureID(); if(null!=tex) { tex.enable(); tex.bind(); @@ -315,7 +325,6 @@ public class MovieSimple implements MouseListener, GLEventListener { if(null!=tex) { tex.disable(); - movie.unlockTexture(); } st.glUseProgram(gl, false); |