From 323476249dd94e605b6627582ad0dbcaede0159e Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Sun, 26 Jan 2014 03:00:36 +0100
Subject: GLMediaPlayer: Add user attached objects, similar to GLContext -
 Allowing GLMediaEventListener impl. to access GLMediaPlayer associated
 objects

---
 .../jogamp/opengl/util/av/GLMediaPlayerImpl.java      | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

(limited to 'src/jogl/classes/jogamp/opengl/util')

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);
     }
-- 
cgit v1.2.3