aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/av/GLMediaEventListener.java17
-rw-r--r--src/jogl/classes/com/jogamp/opengl/av/GLMediaPlayer.java90
-rw-r--r--src/jogl/classes/com/jogamp/opengl/av/GLMediaPlayerFactory.java18
3 files changed, 125 insertions, 0 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/av/GLMediaEventListener.java b/src/jogl/classes/com/jogamp/opengl/av/GLMediaEventListener.java
new file mode 100644
index 000000000..a02c8a362
--- /dev/null
+++ b/src/jogl/classes/com/jogamp/opengl/av/GLMediaEventListener.java
@@ -0,0 +1,17 @@
+
+package com.jogamp.opengl.av;
+
+import com.jogamp.opengl.av.GLMediaPlayer.TextureFrame;
+
+public interface GLMediaEventListener {
+
+ static final int EVENT_CHANGE_SIZE = 1<<0;
+ static final int EVENT_CHANGE_FPS = 1<<1;
+ static final int EVENT_CHANGE_BPS = 1<<2;
+ static final int EVENT_CHANGE_LENGTH = 1<<3;
+
+ public void attributesChanges(GLMediaPlayer mp, int event_mask);
+ public void newFrameAvailable(GLMediaPlayer mp, TextureFrame frame);
+
+}
+
diff --git a/src/jogl/classes/com/jogamp/opengl/av/GLMediaPlayer.java b/src/jogl/classes/com/jogamp/opengl/av/GLMediaPlayer.java
new file mode 100644
index 000000000..71e0e16d9
--- /dev/null
+++ b/src/jogl/classes/com/jogamp/opengl/av/GLMediaPlayer.java
@@ -0,0 +1,90 @@
+package com.jogamp.opengl.av;
+
+import java.io.IOException;
+import java.net.URL;
+
+import javax.media.opengl.GL;
+
+import com.jogamp.opengl.util.texture.Texture;
+
+/**
+ * Lifecycle of an GLMediaPlayer:
+ * <ul>
+ * <li>{@link #setStream(GL, URL)}</li>
+ * <li>{@link #start()}</li>
+ * <li>{@link #stop()}</li>
+ * <li>{@link #destroy(GL)}</li>
+ * </ul>
+ */
+public interface GLMediaPlayer {
+
+ public static class TextureFrame {
+ public TextureFrame(Texture t) {
+ texture = t;
+ }
+
+ public final Texture getTexture() { return texture; }
+
+ public String toString() {
+ return "TextureFrame[" + texture + "]";
+ }
+ protected final Texture texture;
+ }
+
+ /** Sets the stream to be used. Initializes all stream related states and GL resources. */
+ public void setStream(GL gl, URL url) throws IOException;
+
+ /** Releases the GL and stream resources. */
+ public void destroy(GL gl);
+
+ public void setPlaySpeed(float rate);
+
+ public float getPlaySpeed();
+
+ public void start();
+
+ public void pause();
+
+ public void stop();
+
+ /**
+ * @return time current position in milliseconds
+ **/
+ public int 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 boolean isValid();
+
+ public URL getURL();
+
+ public String getVideoCodec();
+
+ public String getAudioCodec();
+
+ public long getTotalFrames();
+
+ public long getBitrate();
+
+ public int getFramerate();
+
+ public int getWidth();
+
+ public int getHeight();
+
+ public String toString();
+
+ public void addEventListener(GLMediaEventListener l);
+
+ public void removeEventListener(GLMediaEventListener l);
+
+ public GLMediaEventListener[] getEventListeners();
+}
diff --git a/src/jogl/classes/com/jogamp/opengl/av/GLMediaPlayerFactory.java b/src/jogl/classes/com/jogamp/opengl/av/GLMediaPlayerFactory.java
new file mode 100644
index 000000000..0025a70ba
--- /dev/null
+++ b/src/jogl/classes/com/jogamp/opengl/av/GLMediaPlayerFactory.java
@@ -0,0 +1,18 @@
+package com.jogamp.opengl.av;
+
+import com.jogamp.common.os.AndroidVersion;
+import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.ReflectionUtil;
+
+public class GLMediaPlayerFactory {
+ private static final String AndroidGLMediaPlayerAPI14ClazzName = "jogamp.opengl.android.av.AndroidGLMediaPlayerAPI14";
+
+ public static GLMediaPlayer create() {
+ if(Platform.OS_TYPE.equals(Platform.OSType.ANDROID)) {
+ if(AndroidVersion.SDK_INT >= 14) {
+ return (GLMediaPlayer) ReflectionUtil.createInstance(AndroidGLMediaPlayerAPI14ClazzName, GLMediaPlayerFactory.class.getClassLoader());
+ }
+ }
+ return null;
+ }
+}