release method added
authorFilippo Carone <littlejohn@videolan.org>
Tue, 8 Apr 2008 21:41:59 +0000 (23:41 +0200)
committerFilippo Carone <littlejohn@videolan.org>
Tue, 8 Apr 2008 22:32:45 +0000 (00:32 +0200)
bindings/java/core/src/main/java/org/videolan/jvlc/MediaDescriptor.java

index 7e863d3..727f157 100644 (file)
@@ -36,6 +36,7 @@ public class MediaDescriptor
     private LibVlcMediaDescriptor instance;
     private LibVlc libvlc;
     private LibVlcEventManager eventManager;
+    private boolean released;
     
     /**
      * @param jvlc The jvlc instance to create the media descriptor for.
@@ -79,7 +80,7 @@ public class MediaDescriptor
     @Override
     protected void finalize() throws Throwable
     {
-        libvlc.libvlc_media_release(instance);
+        release();
         super.finalize();
     }
 
@@ -102,4 +103,19 @@ public class MediaDescriptor
     {
         return libvlc;
     }
+
+    /**
+     * 
+     */
+    public void release()
+    {
+        if (released)
+        {
+            return;
+        }
+        released = true;
+        libvlc.libvlc_media_release(instance);
+    }
+    
+    
 }