diff options
author | Sven Gothel <[email protected]> | 2012-04-16 21:18:03 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-04-16 21:18:03 +0200 |
commit | 35beeabffed61e1597aaffc0c5926ab5ef86d32e (patch) | |
tree | 6a7e91c07e7d61613b03f35a17486faf01b211fc /src/jogl/classes/jogamp/opengl/android/av | |
parent | 2f0583aad39f93a934629c21beac66a758373249 (diff) |
TextureSequence Shader Support; GLMediaPlayer uses 'int' where possible; General enhancments.
For details about TextureSequence/GLMediaPlayer shader collaboration w/ your own shader source,
see TextureSequence and TexCubeES2 / MovieSimple demo.
TextureSequence allows implementations to provide their own texture lookup function
which may provide color space conversion (YUV) .. or other runtime hw-accel features.
Have a look at the next commit, which provides an Libav/FFMpeg implementation w/ YUV/RGB shader conversion.
MovieCube adds keyboard control (Android: firm touch on display to launch keyboard, don't break it though :)
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/android/av')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java b/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java index 1239db742..f6189f03c 100644 --- a/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java +++ b/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java @@ -48,6 +48,14 @@ import android.view.Surface; * Android API Level 14: {@link Surface#Surface(android.graphics.SurfaceTexture)} */ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { + static final boolean available; + + static { + available = true; // default .. TODO: May restrict availability ? + } + + public static final boolean isAvailable() { return available; } + MediaPlayer mp; volatile boolean updateSurface = false; Object updateSurfaceLock = new Object(); @@ -61,22 +69,20 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { public AndroidGLMediaPlayerAPI14() { super(); + if(!available) { + throw new RuntimeException("AndroidGLMediaPlayerAPI14 not available"); + } this.setTextureTarget(GLES2.GL_TEXTURE_EXTERNAL_OES); this.setTextureCount(1); mp = new MediaPlayer(); } @Override - public void setPlaySpeed(float rate) { - // n/a + protected boolean setPlaySpeedImpl(float rate) { + return false; } @Override - public float getPlaySpeed() { - return 0; - } - - @Override protected boolean startImpl() { if(null != mp) { try { @@ -124,21 +130,21 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { } @Override - protected long seekImpl(long msec) { + protected int seekImpl(int msec) { if(null != mp) { - mp.seekTo((int)msec); + mp.seekTo(msec); return mp.getCurrentPosition(); } return 0; } @Override - public TextureSequence.TextureFrame getLastTexture() { + protected TextureSequence.TextureFrame getLastTextureImpl() { return lastTexFrame; } @Override - public TextureSequence.TextureFrame getNextTexture(GL gl, boolean blocking) { + protected TextureSequence.TextureFrame getNextTextureImpl(GL gl, boolean blocking) { if(null != stex && null != mp) { // Only block once, no while-loop. // This relaxes locking code of non crucial resources/events. @@ -176,7 +182,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { } @Override - public long getCurrentPosition() { + protected int getCurrentPositionImpl() { return null != mp ? mp.getCurrentPosition() : 0; } @@ -214,20 +220,16 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { } catch (IOException ioe) { throw new IOException("MediaPlayer failed to process stream <"+urlConn.getURL().toExternalForm()+">: "+ioe.getMessage(), ioe); } - width = mp.getVideoWidth(); - height = mp.getVideoHeight(); - fps = 0; - bps = 0; - totalFrames = 0; - duration = mp.getDuration(); - acodec = "unknown"; - vcodec = "unknown"; + updateAttributes(mp.getVideoWidth(), mp.getVideoHeight(), + 0, 0, 0, + 0f, 0, mp.getDuration(), + null, null); } } @Override protected TextureSequence.TextureFrame createTexImage(GL gl, int idx, int[] tex) { - lastTexFrame = new TextureSequence.TextureFrame( createTexImageImpl(gl, idx, tex, true) ); + lastTexFrame = new TextureSequence.TextureFrame( createTexImageImpl(gl, idx, tex, width, height, true) ); return lastTexFrame; } |