diff options
author | Sven Gothel <[email protected]> | 2012-04-11 19:46:37 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-04-11 19:46:37 +0200 |
commit | f10b30c16aeec428378d1d560d030b2d39801c4e (patch) | |
tree | 869ca02373385659ed356d781a602fdc2d7d1666 /src/jogl/classes/jogamp/opengl/omx/OMXGLMediaPlayer.java | |
parent | 41b75429e3801f8bf8d5eea679487ccc49ce2584 (diff) |
Refine GLMediaPlayer/TextureSequence, add MovieCube demo, fix minor bug in Texture
- Add TextureSequence, base interface of GLMediaPlayer to genralize texture streams
- TextureSequence / GLMediaPlayer: Use inner classes for event and texture data
- getLastTexture() shall never return 'null', initialization of TextureSequence (initGLStream(..), etc)
shall provide a TextureFrame w/ the stream's dimension.
- GLMediaPlayerImpl.createTexImageImpl() y-flip defaults to 'false'
impl. shall define y-flip, if required.
- Added MovieCube demo
- Fix Texture: initialize aspectRation for 'wrapping' ctor
-
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/omx/OMXGLMediaPlayer.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/omx/OMXGLMediaPlayer.java | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/src/jogl/classes/jogamp/opengl/omx/OMXGLMediaPlayer.java b/src/jogl/classes/jogamp/opengl/omx/OMXGLMediaPlayer.java index 7c775dd9f..c005c2ea6 100644 --- a/src/jogl/classes/jogamp/opengl/omx/OMXGLMediaPlayer.java +++ b/src/jogl/classes/jogamp/opengl/omx/OMXGLMediaPlayer.java @@ -7,11 +7,10 @@ import java.net.URL; import javax.media.opengl.GL; import javax.media.opengl.GLException; -import com.jogamp.opengl.av.GLMediaEventListener; -import com.jogamp.opengl.util.texture.TextureCoords; +import com.jogamp.opengl.util.texture.TextureSequence; -import jogamp.opengl.av.EGLMediaPlayerImpl; import jogamp.opengl.egl.EGL; +import jogamp.opengl.util.av.EGLMediaPlayerImpl; public class OMXGLMediaPlayer extends EGLMediaPlayerImpl { protected long moviePtr = 0; @@ -26,7 +25,7 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl { protected long o_totalFrames = 0; protected long o_duration = 0; - protected TextureFrame lastTex = null; + protected TextureSequence.TextureFrame lastTex = null; public OMXGLMediaPlayer() { super(TextureType.KHRImage, true); @@ -41,7 +40,7 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl { } @Override - protected TextureFrame createTexImage(GL gl, int idx, int[] tex) { + protected TextureSequence.TextureFrame createTexImage(GL gl, int idx, int[] tex) { final EGLTextureFrame eglTex = (EGLTextureFrame) super.createTexImage(gl, idx, tex); _setStreamEGLImageTexture2D(moviePtr, idx, tex[idx], eglTex.getImage(), eglTex.getSync()); lastTex = eglTex; @@ -49,8 +48,9 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl { } @Override - protected void destroyTexImage(GL gl, TextureFrame imgTex) { - super.destroyTexImage(gl, imgTex); + protected void destroyTexImage(GL gl, TextureSequence.TextureFrame imgTex) { + lastTex = null; + super.destroyTexImage(gl, imgTex); } @Override @@ -76,7 +76,7 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl { System.out.println("setURL: p1 "+this); _setStream(moviePtr, textureCount, path); - System.out.println("setURL: p2 "+this); + System.out.println("setURL: p2 "+this); } @Override @@ -135,18 +135,18 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl { } @Override - public TextureFrame getLastTexture() { + public TextureSequence.TextureFrame getLastTexture() { return lastTex; } @Override - public synchronized TextureFrame getNextTexture(GL gl, boolean blocking) { + public synchronized TextureSequence.TextureFrame getNextTexture(GL gl, boolean blocking) { if(0==moviePtr) { throw new GLException("OMX native instance null"); } final int nextTex = _getNextTextureID(moviePtr, blocking); if(0 < nextTex) { - final TextureFrame eglImgTex = texFrameMap.get(new Integer(_getNextTextureID(moviePtr, blocking))); + final TextureSequence.TextureFrame eglImgTex = texFrameMap.get(new Integer(_getNextTextureID(moviePtr, blocking))); if(null!=eglImgTex) { lastTex = eglImgTex; } @@ -154,12 +154,6 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl { return lastTex; } - @Override - public TextureCoords getTextureCoords() { - return lastTex.getTexture().getImageTexCoords(); - } - - protected void attributesUpdated() { int event_mask = 0; if( o_width != width || o_height != height ) { |