Commit 7c1e2611 authored by Filippo Carone's avatar Filippo Carone

minor changes to JVLC class

parent 1d1c5f07
...@@ -67,11 +67,21 @@ public class JVLC ...@@ -67,11 +67,21 @@ public class JVLC
this(args.split(" ")); 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) public MediaInstance play(String media)
{ {
MediaDescriptor mediaDescriptor = new MediaDescriptor(this, media); MediaDescriptor mediaDescriptor = new MediaDescriptor(this, media);
MediaInstance mediaInstance = new MediaInstance(mediaDescriptor); MediaInstance mediaInstance = new MediaInstance(mediaDescriptor);
mediaInstance.play(); mediaInstance.play();
mediaDescriptor.release();
return mediaInstance; return mediaInstance;
} }
...@@ -82,20 +92,18 @@ public class JVLC ...@@ -82,20 +92,18 @@ public class JVLC
libvlc.libvlc_video_set_parent(instance, drawable, exception ); libvlc.libvlc_video_set_parent(instance, drawable, exception );
} }
/* public Logger getLogger()
* Core methods
*/
private LibVlcInstance createInstance(String[] args)
{ {
libvlc_exception_t exception = new libvlc_exception_t(); return new Logger(this);
libvlc.libvlc_exception_init(exception);
return libvlc.libvlc_new(args.length, args, exception);
} }
public Logger getLogger() /**
* Returns the mediaList.
* @return the mediaList
*/
public MediaList getMediaList()
{ {
return new Logger(this); return mediaList;
} }
public VLM getVLM() public VLM getVLM()
...@@ -145,8 +153,10 @@ public class JVLC ...@@ -145,8 +153,10 @@ public class JVLC
*/ */
public void release() public void release()
{ {
if (!released) if (released)
{ {
return;
}
released = true; released = true;
if (vlm != null) if (vlm != null)
{ {
...@@ -155,7 +165,6 @@ public class JVLC ...@@ -155,7 +165,6 @@ public class JVLC
} }
libvlc.libvlc_release(instance); libvlc.libvlc_release(instance);
} }
}
/* /*
* (non-Javadoc) * (non-Javadoc)
...@@ -164,21 +173,8 @@ public class JVLC ...@@ -164,21 +173,8 @@ public class JVLC
@Override @Override
protected void finalize() throws Throwable protected void finalize() throws Throwable
{ {
if (!released) release();
{
released = true;
libvlc.libvlc_release(instance);
}
super.finalize(); super.finalize();
} }
/**
* Returns the mediaList.
* @return the mediaList
*/
public MediaList getMediaList()
{
return mediaList;
}
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment