aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/av/EGLMediaPlayerImpl.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-04-09 04:49:41 +0200
committerSven Gothel <[email protected]>2012-04-09 04:49:41 +0200
commit3a26aa701b4a1a0991cd997a0d295a1b83cd12f3 (patch)
tree0bbf0c79127ab8329220e2766177c3073244277b /src/jogl/classes/jogamp/opengl/av/EGLMediaPlayerImpl.java
parent1e61021a062b1403f7eed948ac9d2ea0c04ea951 (diff)
GLMediaPlayer*: Revised - Working on buggy MediaPlayer impl. (Android ICS Tegra)
GLMediaPlayer: Merging 'initStream()' and 'initGL()' to 'initGLStream()' due to incompatible/buggy implementations (Android/Tegra) requiring the GL texture being setup before preparing the stream. This also implies that w/o an GL context we cannot fetch the stream information (size, ..) hence we need to evaluate this detail (FIXME). 'getNextTexture(GL gl, boolean blocking)' can request the impl. to block GLMediaEventListener: The TextureFrame not yet available, adding 'when'
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/av/EGLMediaPlayerImpl.java')
-rw-r--r--src/jogl/classes/jogamp/opengl/av/EGLMediaPlayerImpl.java22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/jogl/classes/jogamp/opengl/av/EGLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/av/EGLMediaPlayerImpl.java
index abc5d5912..2f6744fc5 100644
--- a/src/jogl/classes/jogamp/opengl/av/EGLMediaPlayerImpl.java
+++ b/src/jogl/classes/jogamp/opengl/av/EGLMediaPlayerImpl.java
@@ -27,8 +27,11 @@
*/
package jogamp.opengl.av;
-import javax.media.opengl.GLContext;
+import java.nio.IntBuffer;
+import javax.media.opengl.GL;
+
+import com.jogamp.common.nio.Buffers;
import com.jogamp.opengl.util.texture.Texture;
import jogamp.opengl.egl.EGL;
@@ -80,22 +83,23 @@ public abstract class EGLMediaPlayerImpl extends GLMediaPlayerImpl {
}
@Override
- protected TextureFrame createTexImage(GLContext ctx, int idx, int[] tex) {
- final Texture texture = super.createTexImageImpl(ctx, idx, tex, true);
+ protected TextureFrame createTexImage(GL gl, int idx, int[] tex) {
+ final Texture texture = super.createTexImageImpl(gl, idx, tex, true);
final long image;
final long sync;
- final EGLContext eglCtx = (EGLContext) ctx;
+ final EGLContext eglCtx = (EGLContext) gl.getContext();
final EGLExt eglExt = eglCtx.getEGLExt();
final EGLDrawable eglDrawable = (EGLDrawable) eglCtx.getGLDrawable();
int[] tmp = new int[1];
+ IntBuffer nioTmp = Buffers.newDirectIntBuffer(1);
if(TextureType.KHRImage == texType) {
// create EGLImage from texture
- tmp[0] = EGL.EGL_NONE;
+ nioTmp.put(0, EGL.EGL_NONE);
image = eglExt.eglCreateImageKHR( eglDrawable.getDisplay(), eglCtx.getHandle(),
EGLExt.EGL_GL_TEXTURE_2D_KHR,
- tex[idx], tmp, 0);
+ null /* buffer */, nioTmp);
if (0==image) {
throw new RuntimeException("EGLImage creation failed: "+EGL.eglGetError()+", ctx "+eglCtx+", tex "+tex[idx]+", err "+toHexString(EGL.eglGetError()));
}
@@ -119,8 +123,8 @@ public abstract class EGLMediaPlayerImpl extends GLMediaPlayerImpl {
}
@Override
- protected void destroyTexImage(GLContext ctx, TextureFrame imgTex) {
- final EGLContext eglCtx = (EGLContext) ctx;
+ protected void destroyTexImage(GL gl, TextureFrame imgTex) {
+ final EGLContext eglCtx = (EGLContext) gl.getContext();
final EGLExt eglExt = eglCtx.getEGLExt();
final EGLDrawable eglDrawable = (EGLDrawable) eglCtx.getGLDrawable();
final EGLTextureFrame eglTex = (EGLTextureFrame) imgTex;
@@ -131,6 +135,6 @@ public abstract class EGLMediaPlayerImpl extends GLMediaPlayerImpl {
if(0!=eglTex.getSync()) {
eglExt.eglDestroySyncKHR(eglDrawable.getDisplay(), eglTex.getSync());
}
- super.destroyTexImage(ctx, imgTex);
+ super.destroyTexImage(gl, imgTex);
}
}