Package org.videolan.libvlc
Class MediaDiscoverer
- java.lang.Object
-
- org.videolan.libvlc.MediaDiscoverer
-
- All Implemented Interfaces:
IVLCObject<MediaDiscoverer.Event>
public class MediaDiscoverer extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MediaDiscoverer.Description
static class
MediaDiscoverer.Event
static interface
MediaDiscoverer.EventListener
-
Constructor Summary
Constructors Constructor Description MediaDiscoverer(ILibVLC ILibVLC, String name)
Create a MediaDiscover.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
finalize()
long
getInstance()
ILibVLC
getLibVLC()
MediaList
getMediaList()
Get the MediaList associated with the MediaDiscoverer.boolean
isReleased()
Returns true if native object is releasedstatic MediaDiscoverer.Description[]
list(ILibVLC ILibVLC, int category)
Get media discoverers by categoryprotected MediaDiscoverer.Event
onEventNative(int eventType, long arg1, long arg2, float argf1, String args1)
Called when libvlc send events.protected void
onReleaseNative()
Called when native object is released (refcount is 0).void
release()
Release the native object if ref count is 1.boolean
retain()
Increment internal ref count of the native object.protected void
setEventListener(AbstractVLCEvent.Listener<T> listener)
Set an event listener.protected void
setEventListener(AbstractVLCEvent.Listener<T> listener, Handler handler)
Set an event listener and an executor Handlervoid
setEventListener(MediaDiscoverer.EventListener listener)
boolean
start()
Starts the discovery.void
stop()
Stops the discovery.
-
-
-
Method Detail
-
start
public boolean start()
Starts the discovery. This MediaDiscoverer should be alive (not released).- Returns:
- true the service is started
-
stop
public void stop()
Stops the discovery. This MediaDiscoverer should be alive (not released). (You can also callto stop the discovery directly
.
-
setEventListener
public void setEventListener(MediaDiscoverer.EventListener listener)
-
onEventNative
protected MediaDiscoverer.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
-
getMediaList
public MediaList getMediaList()
Get the MediaList associated with the MediaDiscoverer. This MediaDiscoverer should be alive (not released).- Returns:
- MediaList. This MediaList should be released with
IVLCObject.release()
.
-
onReleaseNative
protected void onReleaseNative()
Called when native object is released (refcount is 0). This is where you must release native resources.
-
list
@Nullable public static MediaDiscoverer.Description[] list(ILibVLC ILibVLC, int category)
Get media discoverers by category- Parameters:
category
- seeMediaDiscoverer.Description.Category
-
isReleased
public boolean isReleased()
Returns true if native object is released- Specified by:
isReleased
in interfaceIVLCObject<T extends AbstractVLCEvent>
-
retain
public final boolean retain()
Increment internal ref count of the native object.- Specified by:
retain
in 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:
release
in interfaceIVLCObject<T extends AbstractVLCEvent>
-
getLibVLC
public ILibVLC getLibVLC()
- Specified by:
getLibVLC
in 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.Listener
handler
- Handler in which events are sent. If null, a handler will be created running on the main thread
-
getInstance
public long getInstance()
-
-