Commit 32b9f033 authored by Thomas Guillem's avatar Thomas Guillem

update with last vlc changes

libvlc_media_discoverer_services_get being renamed to libvlc_media_discoverer_list_get
parent b30765a3
......@@ -91,7 +91,7 @@ Java_org_videolan_libvlc_MediaDiscoverer_nativeStop(JNIEnv *env, jobject thiz)
static jobject
service_to_object(JNIEnv *env, libvlc_media_discoverer_service *p_service)
service_to_object(JNIEnv *env, libvlc_media_discoverer_description *p_service)
{
jstring jname = NULL;
jstring jlongName = NULL;
......@@ -100,19 +100,18 @@ service_to_object(JNIEnv *env, libvlc_media_discoverer_service *p_service)
jlongName = (*env)->NewStringUTF(env, p_service->psz_longname);
return (*env)->CallStaticObjectMethod(env, fields.MediaDiscoverer.clazz,
fields.MediaDiscoverer.createServiceFromNativeID,
fields.MediaDiscoverer.createDescriptionFromNativeID,
jname, jlongName, p_service->i_cat);
}
jobject
Java_org_videolan_libvlc_MediaDiscoverer_nativeGetServices(JNIEnv *env,
jobject thiz,
Java_org_videolan_libvlc_MediaDiscoverer_nativeList(JNIEnv *env, jobject thiz,
jobject libVlc,
jint i_category)
{
vlcjni_object *p_lib_obj = VLCJniObject_getInstance(env, libVlc);
libvlc_instance_t *p_libvlc = p_lib_obj->u.p_libvlc;
libvlc_media_discoverer_service **pp_services = NULL;
libvlc_media_discoverer_description **pp_services = NULL;
unsigned int i_nb_services = 0;
jobjectArray array;
......@@ -120,13 +119,14 @@ Java_org_videolan_libvlc_MediaDiscoverer_nativeGetServices(JNIEnv *env,
return NULL;
i_nb_services =
libvlc_media_discoverer_services_get( p_libvlc, i_category,
libvlc_media_discoverer_list_get( p_libvlc, i_category,
&pp_services);
if (i_nb_services == 0)
return NULL;
array = (*env)->NewObjectArray(env, i_nb_services,
fields.MediaDiscoverer.Service.clazz, NULL);
fields.MediaDiscoverer.Description.clazz,
NULL);
if (!array)
goto error;
......@@ -139,6 +139,6 @@ Java_org_videolan_libvlc_MediaDiscoverer_nativeGetServices(JNIEnv *env,
error:
if (pp_services)
libvlc_media_discoverer_services_release(pp_services, i_nb_services);
libvlc_media_discoverer_list_release(pp_services, i_nb_services);
return array;
}
......@@ -188,8 +188,8 @@ jint JNI_OnLoad(JavaVM *vm, void *reserved)
"org/videolan/libvlc/MediaPlayer$Equalizer", true);
GET_CLASS(fields.MediaDiscoverer.clazz,
"org/videolan/libvlc/MediaDiscoverer", true);
GET_CLASS(fields.MediaDiscoverer.Service.clazz,
"org/videolan/libvlc/MediaDiscoverer$Service", true);
GET_CLASS(fields.MediaDiscoverer.Description.clazz,
"org/videolan/libvlc/MediaDiscoverer$Description", true);
GET_CLASS(fields.Dialog.clazz,
"org/videolan/libvlc/Dialog", true);
......@@ -277,11 +277,11 @@ jint JNI_OnLoad(JavaVM *vm, void *reserved)
"(ILjava/lang/String;)Lorg/videolan/libvlc/MediaPlayer$TrackDescription;");
GET_ID(GetStaticMethodID,
fields.MediaDiscoverer.createServiceFromNativeID,
fields.MediaDiscoverer.createDescriptionFromNativeID,
fields.MediaDiscoverer.clazz,
"createServiceFromNative",
"createDescriptionFromNative",
"(Ljava/lang/String;Ljava/lang/String;I)"
"Lorg/videolan/libvlc/MediaDiscoverer$Service;");
"Lorg/videolan/libvlc/MediaDiscoverer$Description;");
GET_ID(GetStaticMethodID,
fields.Dialog.displayErrorFromNativeID,
......
......@@ -85,9 +85,9 @@ struct fields {
struct {
struct {
jclass clazz;
} Service;
} Description;
jclass clazz;
jmethodID createServiceFromNativeID;
jmethodID createDescriptionFromNativeID;
} MediaDiscoverer;
struct {
jclass clazz;
......
......@@ -11,7 +11,7 @@ Java_org_videolan_libvlc_LibVLC_nativeRelease
Java_org_videolan_libvlc_LibVLC_nativeSetOnHardwareAccelerationError
Java_org_videolan_libvlc_LibVLC_nativeSetUserAgent
Java_org_videolan_libvlc_LibVLC_version
Java_org_videolan_libvlc_MediaDiscoverer_nativeGetServices
Java_org_videolan_libvlc_MediaDiscoverer_nativeList
Java_org_videolan_libvlc_MediaDiscoverer_nativeNew
Java_org_videolan_libvlc_MediaDiscoverer_nativeRelease
Java_org_videolan_libvlc_MediaDiscoverer_nativeStart
......
......@@ -36,7 +36,7 @@ public class MediaDiscoverer extends VLCObject<MediaDiscoverer.Event> {
}
}
public static class Service {
public static class Description {
public static class Category {
/** devices, like portable music player */
public static final int Devices = 0;
......@@ -51,7 +51,7 @@ public class MediaDiscoverer extends VLCObject<MediaDiscoverer.Event> {
public final String longName;
public final int category;
private Service(String name, String longName, int category)
private Description(String name, String longName, int category)
{
this.name = name;
this.longName = longName;
......@@ -60,9 +60,9 @@ public class MediaDiscoverer extends VLCObject<MediaDiscoverer.Event> {
}
@SuppressWarnings("unused") /* Used from JNI */
private static Service createServiceFromNative(String name, String longName, int category)
private static Description createDescriptionFromNative(String name, String longName, int category)
{
return new Service(name, longName, category);
return new Description(name, longName, category);
}
public interface EventListener extends VLCEvent.Listener<MediaDiscoverer.Event> {}
......@@ -143,12 +143,12 @@ public class MediaDiscoverer extends VLCObject<MediaDiscoverer.Event> {
}
/**
* Get media discoverer services by category
* @param category see {@link MediaDiscoverer.Service.Category}
* Get media discoverers by category
* @param category see {@link Description.Category}
*/
@Nullable
public static Service[] getServices(LibVLC libVLC, int category) {
return nativeGetServices(libVLC, category);
public static Description[] list(LibVLC libVLC, int category) {
return nativeList(libVLC, category);
}
/* JNI */
......@@ -156,5 +156,5 @@ public class MediaDiscoverer extends VLCObject<MediaDiscoverer.Event> {
private native void nativeRelease();
private native boolean nativeStart();
private native void nativeStop();
private static native Service[] nativeGetServices(LibVLC libVLC, int category);
private static native Description[] nativeList(LibVLC libVLC, int category);
}
......@@ -129,19 +129,20 @@ public class MediaBrowser {
@MainThread
public void discoverNetworkShares() {
reset();
final MediaDiscoverer.Service services[] =
MediaDiscoverer.getServices(mLibVlc, MediaDiscoverer.Service.Category.Lan);
if (services == null)
final MediaDiscoverer.Description descriptions[] =
MediaDiscoverer.list(mLibVlc, MediaDiscoverer.Description.Category.Lan);
if (descriptions == null)
return;
for (MediaDiscoverer.Service service : services) {
Log.i(TAG, "starting " + service.name + " discover (" + service.longName + ")");
startMediaDiscoverer(service.name);
for (MediaDiscoverer.Description description : descriptions) {
Log.i(TAG, "starting " + description.name + " discover (" + description.longName + ")");
startMediaDiscoverer(description.name);
}
}
/**
* Discover networks shares using a specified Discoverer
* @param serviceName see {@link MediaDiscoverer.Service.Category#name}
* @param serviceName see {@link MediaDiscoverer.Description.Category#name}
*/
@MainThread
public void discoverNetworkShares(String serviceName) {
......
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