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