summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-04-03 18:49:24 +0200
committerSven Gothel <[email protected]>2012-04-03 18:49:24 +0200
commitc594cf1dc9f37dd1a6d861a1aa5426abbd082d60 (patch)
treef72ea63ca9040b17b6203b63e9c7c3678a1881eb /src/jogl/classes/com/jogamp/opengl
parent48581e36773e58e20a3e780caf5b1c29b4805285 (diff)
GLMediaPlayer: API and implementation update. First working version on Android API 14
- Introduce states - Customize / Access texture target,count,features. - Expose TextureFrame. - Use 'long' for all time values in msec. - Mark information optional in API doc (fps, bps, ..)
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/av/GLMediaPlayer.java112
1 files changed, 100 insertions, 12 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/av/GLMediaPlayer.java b/src/jogl/classes/com/jogamp/opengl/av/GLMediaPlayer.java
index 71e0e16d9..0d07f69ac 100644
--- a/src/jogl/classes/com/jogamp/opengl/av/GLMediaPlayer.java
+++ b/src/jogl/classes/com/jogamp/opengl/av/GLMediaPlayer.java
@@ -5,6 +5,8 @@ import java.net.URL;
import javax.media.opengl.GL;
+import jogamp.opengl.Debug;
+
import com.jogamp.opengl.util.texture.Texture;
/**
@@ -17,63 +19,149 @@ import com.jogamp.opengl.util.texture.Texture;
* </ul>
*/
public interface GLMediaPlayer {
+ public static final boolean DEBUG = Debug.debug("GLMediaPlayer");
+
+ public enum State {
+ Uninitialized(0), Stopped(1), Playing(2), Paused(3);
+
+ public final int id;
+ State(int id){
+ this.id = id;
+ }
+ }
+
public static class TextureFrame {
public TextureFrame(Texture t) {
texture = t;
+ // stMatrix = new float[4*4];
+ // ProjectFloat.makeIdentityf(stMatrix, 0);
}
public final Texture getTexture() { return texture; }
+ // public final float[] getSTMatrix() { return stMatrix; }
public String toString() {
return "TextureFrame[" + texture + "]";
}
protected final Texture texture;
+ // protected final float[] stMatrix;
}
- /** Sets the stream to be used. Initializes all stream related states and GL resources. */
+ public int getTextureCount();
+
+ public int getTextureTarget();
+
+ /** Sets the texture min-mag filter, defaults to {@link GL#GL_NEAREST}. */
+ public void setTextureMinMagFilter(int[] minMagFilter);
+ public int[] getTextureMinMagFilter();
+
+ /** Sets the texture min-mag filter, defaults to {@link GL#GL_CLAMP_TO_EDGE}. */
+ public void setTextureWrapST(int[] wrapST);
+ public int[] getTextureWrapST();
+
+ /**
+ * Sets the stream to be used. Initializes all stream related states and GL resources.
+ * <ul>
+ * <li>ANY -> Uninitialized - invokes destroy(GL)</li>
+ * <li>Uninitialized -> Stopped</li>
+ * </ul>
+ */
public void setStream(GL gl, URL url) throws IOException;
- /** Releases the GL and stream resources. */
+ /**
+ * Releases the GL and stream resources.
+ * <p>
+ * <code>ANY</code> -> Uninitialized
+ * </p>
+ */
public void destroy(GL gl);
public void setPlaySpeed(float rate);
public float getPlaySpeed();
- public void start();
-
- public void pause();
+ /**
+ * Stopped/Paused -> Playing
+ */
+ public State start();
- public void stop();
+ /**
+ * Playing -> Paused
+ */
+ public State pause();
/**
+ * Playing/Paused -> Stopped
+ */
+ public State stop();
+
+ /**
+ * @return the current state, either Uninitialized, Stopped, Playing, Paused
+ */
+ public State getState();
+
+ /**
* @return time current position in milliseconds
**/
- public int getCurrentPosition();
+ public long getCurrentPosition();
/**
* @param msec absolute desired time position in milliseconds
* @return time current position in milliseconds, after seeking to the desired position
**/
- public int seek(int msec);
-
- public Texture getLastTextureID();
-
- public Texture getNextTextureID();
+ public long seek(long msec);
+ /**
+ * @return the last updated texture. Not blocking.
+ */
+ public TextureFrame getLastTexture();
+
+ /**
+ * @return the next texture, which should be rendered. May block, depending on implementation.
+ *
+ * @see #addEventListener(GLMediaEventListener)
+ * @see GLMediaEventListener#newFrameAvailable(GLMediaPlayer, TextureFrame)
+ */
+ public TextureFrame getNextTexture();
+
public boolean isValid();
public URL getURL();
+ /**
+ * <i>Warning:</i> Optional information, may not be supported by implementation.
+ * @return the code of the video stream, if available
+ */
public String getVideoCodec();
+ /**
+ * <i>Warning:</i> Optional information, may not be supported by implementation.
+ * @return the code of the audio stream, if available
+ */
public String getAudioCodec();
+ /**
+ * <i>Warning:</i> Optional information, may not be supported by implementation.
+ * @return the total number of video frames
+ */
public long getTotalFrames();
+ /**
+ * @return total duration of stream in msec.
+ */
+ public long getDuration();
+
+ /**
+ * <i>Warning:</i> Optional information, may not be supported by implementation.
+ * @return the overall bitrate of the stream.
+ */
public long getBitrate();
+ /**
+ * <i>Warning:</i> Optional information, may not be supported by implementation.
+ * @return the framerate of the video
+ */
public int getFramerate();
public int getWidth();