From 35beeabffed61e1597aaffc0c5926ab5ef86d32e Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 16 Apr 2012 21:18:03 +0200 Subject: 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 :) --- .../com/jogamp/opengl/util/av/GLMediaPlayer.java | 44 ++++++++++++++++++---- 1 file changed, 36 insertions(+), 8 deletions(-) (limited to 'src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java') diff --git a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java index d86c8bfd0..8430d6137 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java @@ -47,6 +47,15 @@ import com.jogamp.opengl.util.texture.TextureSequence; * {@link #pause()} Playing Paused * {@link #destroy(GL)} ANY Uninitialized * + *

+ * Variable type, value range and dimension has been chosen to suit embedded CPUs + * and characteristics of audio and video streaming. + * Milliseconds of type integer with a maximum value of {@link Integer#MAX_VALUE} + * will allow tracking time up 2,147,483.647 seconds or + * 24 days 20 hours 31 minutes and 23 seconds. + * Milliseconds granularity is also more than enough to deal with A-V synchronization, + * where the threshold usually lies within 100ms. + *

*/ public interface GLMediaPlayer extends TextureSequence { public static final boolean DEBUG = Debug.debug("GLMediaPlayer"); @@ -57,6 +66,7 @@ public interface GLMediaPlayer extends TextureSequence { static final int EVENT_CHANGE_FPS = 1<<1; static final int EVENT_CHANGE_BPS = 1<<2; static final int EVENT_CHANGE_LENGTH = 1<<3; + static final int EVENT_CHANGE_CODEC = 1<<3; /** * @param mp the event source @@ -136,7 +146,7 @@ public interface GLMediaPlayer extends TextureSequence { /** * @return time current position in milliseconds **/ - public long getCurrentPosition(); + public int getCurrentPosition(); /** * Allowed in state Stopped, Playing and Paused, otherwise ignored. @@ -144,20 +154,26 @@ public interface GLMediaPlayer extends TextureSequence { * @param msec absolute desired time position in milliseconds * @return time current position in milliseconds, after seeking to the desired position **/ - public long seek(long msec); + public int seek(int msec); /** * {@inheritDoc} */ - public TextureSequence.TextureFrame getLastTexture(); + @Override + public TextureSequence.TextureFrame getLastTexture() throws IllegalStateException; /** * {@inheritDoc} * + *

+ * In case the current state is not {@link State#Playing}, {@link #getLastTexture()} is returned. + *

+ * * @see #addEventListener(GLMediaEventListener) * @see GLMediaEventListener#newFrameAvailable(GLMediaPlayer, long) */ - public TextureSequence.TextureFrame getNextTexture(GL gl, boolean blocking); + @Override + public TextureSequence.TextureFrame getNextTexture(GL gl, boolean blocking) throws IllegalStateException; public URLConnection getURLConnection(); @@ -182,19 +198,31 @@ public interface GLMediaPlayer extends TextureSequence { /** * @return total duration of stream in msec. */ - public long getDuration(); + public int getDuration(); /** * Warning: Optional information, may not be supported by implementation. * @return the overall bitrate of the stream. */ - public long getBitrate(); + public long getStreamBitrate(); + /** + * Warning: Optional information, may not be supported by implementation. + * @return video bitrate + */ + public int getVideoBitrate(); + + /** + * Warning: Optional information, may not be supported by implementation. + * @return the audio bitrate + */ + public int getAudioBitrate(); + /** * Warning: Optional information, may not be supported by implementation. * @return the framerate of the video */ - public int getFramerate(); + public float getFramerate(); public int getWidth(); @@ -207,5 +235,5 @@ public interface GLMediaPlayer extends TextureSequence { public void removeEventListener(GLMediaEventListener l); public GLMediaEventListener[] getEventListeners(); - + } -- cgit v1.2.3