Package org.videolan.libvlc
Class MediaList
- java.lang.Object
-
- org.videolan.libvlc.MediaList
-
- All Implemented Interfaces:
IMediaList,IVLCObject<IMediaList.Event>
public class MediaList extends Object implements IMediaList
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.videolan.libvlc.interfaces.IMediaList
IMediaList.Event, IMediaList.EventListener
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidfinalize()intgetCount()Get the number of Media.longgetInstance()ILibVLCgetLibVLC()IMediagetMediaAt(int index)Get a Media at specified index.booleanisLocked()booleanisReleased()Returns true if native object is releasedprotected IMediaList.EventonEventNative(int eventType, long arg1, long arg2, float argf1, String args1)Called when libvlc send events.voidonReleaseNative()Called when native object is released (refcount is 0).voidrelease()Release the native object if ref count is 1.booleanretain()Increment internal ref count of the native object.protected voidsetEventListener(AbstractVLCEvent.Listener<T> listener)Set an event listener.protected voidsetEventListener(AbstractVLCEvent.Listener<T> listener, Handler handler)Set an event listener and an executor HandlervoidsetEventListener(IMediaList.EventListener listener, Handler handler)-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.videolan.libvlc.interfaces.IVLCObject
getLibVLC, isReleased, release, retain
-
-
-
-
Constructor Detail
-
MediaList
public MediaList(ILibVLC ILibVLC)
Create a MediaList from libVLC- Parameters:
ILibVLC- a valid libVLC
-
MediaList
protected MediaList(MediaDiscoverer md)
- Parameters:
md- Should not be released
-
MediaList
protected MediaList(IMedia m)
- Parameters:
m- Should not be released
-
-
Method Detail
-
setEventListener
public void setEventListener(IMediaList.EventListener listener, Handler handler)
- Specified by:
setEventListenerin interfaceIMediaList
-
onEventNative
protected IMediaList.Event onEventNative(int eventType, long arg1, long arg2, float argf1, @Nullable String args1)
Called when libvlc send events.- Parameters:
eventType- event typearg1- first argumentarg2- second argumentargf1- first float argument- Returns:
- Event that will be dispatched to listeners
-
getCount
public int getCount()
Get the number of Media.- Specified by:
getCountin interfaceIMediaList
-
getMediaAt
public IMedia getMediaAt(int index)
Get a Media at specified index.- Specified by:
getMediaAtin interfaceIMediaList- Parameters:
index- index of the media- Returns:
- Media hold by MediaList. This Media should be released with
IVLCObject.release().
-
onReleaseNative
public void onReleaseNative()
Called when native object is released (refcount is 0). This is where you must release native resources.
-
isLocked
public boolean isLocked()
- Specified by:
isLockedin interfaceIMediaList
-
isReleased
public boolean isReleased()
Returns true if native object is released- Specified by:
isReleasedin interfaceIVLCObject<T extends AbstractVLCEvent>
-
retain
public final boolean retain()
Increment internal ref count of the native object.- Specified by:
retainin interfaceIVLCObject<T extends AbstractVLCEvent>- Returns:
- true if media is retained
-
release
public final void release()
Release the native object if ref count is 1. After this call, native calls are not possible anymore. You can still call others methods to retrieve cached values. For example: if you parse, then release a media, you'll still be able to retrieve all Metas or Tracks infos.- Specified by:
releasein interfaceIVLCObject<T extends AbstractVLCEvent>
-
getLibVLC
public ILibVLC getLibVLC()
- Specified by:
getLibVLCin interfaceIVLCObject<T extends AbstractVLCEvent>
-
setEventListener
protected void setEventListener(AbstractVLCEvent.Listener<T> listener)
Set an event listener. Events are sent via the android main thread.- Parameters:
listener- seeAbstractVLCEvent.Listener
-
setEventListener
protected void setEventListener(AbstractVLCEvent.Listener<T> listener, Handler handler)
Set an event listener and an executor Handler- Parameters:
listener- seeAbstractVLCEvent.Listenerhandler- Handler in which events are sent. If null, a handler will be created running on the main thread
-
getInstance
public long getInstance()
-
-