[vlc-devel] commit: minor changes to JVLC class (Filippo Carone )

git version control git at videolan.org
Wed Apr 9 00:32:02 CEST 2008


vlc | branch: master | Filippo Carone <littlejohn at videolan.org> | Tue Apr  8 23:41:41 2008 +0200| [7c1e261199a69bc92f4f0bbd774725555139cce4]

minor changes to JVLC class

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7c1e261199a69bc92f4f0bbd774725555139cce4
---

 .../core/src/main/java/org/videolan/jvlc/JVLC.java |   64 +++++++++----------
 1 files changed, 30 insertions(+), 34 deletions(-)

diff --git a/bindings/java/core/src/main/java/org/videolan/jvlc/JVLC.java b/bindings/java/core/src/main/java/org/videolan/jvlc/JVLC.java
index 32cf179..23dcfeb 100644
--- a/bindings/java/core/src/main/java/org/videolan/jvlc/JVLC.java
+++ b/bindings/java/core/src/main/java/org/videolan/jvlc/JVLC.java
@@ -48,7 +48,7 @@ public class JVLC
     
     private VLM vlm;
     
-    private volatile boolean released; 
+    private volatile boolean released;
     
     public JVLC()
     {
@@ -67,11 +67,21 @@ public class JVLC
         this(args.split(" "));
     }
 
+    /*
+     * Core methods
+     */
+    private LibVlcInstance createInstance(String[] args)
+    {
+        libvlc_exception_t exception = new libvlc_exception_t();
+        return libvlc.libvlc_new(args.length, args, exception);
+    }
+
     public MediaInstance play(String media)
     {
         MediaDescriptor mediaDescriptor = new MediaDescriptor(this, media);
         MediaInstance mediaInstance = new MediaInstance(mediaDescriptor);
         mediaInstance.play();
+        mediaDescriptor.release();
         return mediaInstance;
     }
 
@@ -82,22 +92,20 @@ public class JVLC
         libvlc.libvlc_video_set_parent(instance, drawable, exception );
     }
 
-    /*
-     * Core methods
-     */
-    private LibVlcInstance createInstance(String[] args)
-    {
-        libvlc_exception_t exception = new libvlc_exception_t();
-        libvlc.libvlc_exception_init(exception);
-
-        return libvlc.libvlc_new(args.length, args, exception);
-    }
-
     public Logger getLogger()
     {
         return new Logger(this);
     }
     
+    /**
+     * Returns the mediaList.
+     * @return the mediaList
+     */
+    public MediaList getMediaList()
+    {
+        return mediaList;
+    }
+
     public VLM getVLM()
     {
         if (vlm != null)
@@ -145,16 +153,17 @@ public class JVLC
      */
     public void release()
     {
-        if (!released)
+        if (released)
         {
-            released = true;
-            if (vlm != null)
-            {
-                vlm.release();
-                vlm = null;
-            }
-            libvlc.libvlc_release(instance);
+            return;
         }
+        released = true;
+        if (vlm != null)
+        {
+            vlm.release();
+            vlm = null;
+        }
+        libvlc.libvlc_release(instance);
     }
 
     /*
@@ -164,21 +173,8 @@ public class JVLC
     @Override
     protected void finalize() throws Throwable
     {
-        if (!released)
-        {
-            released = true;
-            libvlc.libvlc_release(instance);
-        }
+        release();
         super.finalize();
     }
     
-    /**
-     * Returns the mediaList.
-     * @return the mediaList
-     */
-    public MediaList getMediaList()
-    {
-        return mediaList;
-    }
-    
 }




More information about the vlc-devel mailing list