summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/util
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-01-26 03:00:36 +0100
committerSven Gothel <[email protected]>2014-01-26 03:00:36 +0100
commit323476249dd94e605b6627582ad0dbcaede0159e (patch)
tree6aa545dfda4e419388f33613337b00e8c219222d /src/jogl/classes/jogamp/opengl/util
parent87135467c4f292f7e43bc3957784b0e43769c9cc (diff)
GLMediaPlayer: Add user attached objects, similar to GLContext - Allowing GLMediaEventListener impl. to access GLMediaPlayer associated objects
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/util')
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
index 0bd1aa932..7cea51dc8 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
@@ -30,6 +30,7 @@ package jogamp.opengl.util.av;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -374,6 +375,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
removeAllTextureFrames(gl);
textureCount=0;
changeState(event_mask, State.Uninitialized);
+ attachedObjects.clear();
return state;
}
}
@@ -1594,6 +1596,23 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
private final Object eventListenersLock = new Object();
+ @Override
+ public final Object getAttachedObject(String name) {
+ return attachedObjects.get(name);
+ }
+
+ @Override
+ public final Object attachObject(String name, Object obj) {
+ return attachedObjects.put(name, obj);
+ }
+
+ @Override
+ public final Object detachObject(String name) {
+ return attachedObjects.remove(name);
+ }
+
+ private final HashMap<String, Object> attachedObjects = new HashMap<String, Object>();
+
protected static final String toHexString(long v) {
return "0x"+Long.toHexString(v);
}