[Android] update with last vlc changes

Thomas Guillem git at videolan.org
Thu Feb 11 18:23:32 CET 2016


vlc-android | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Feb 11 18:22:38 2016 +0100| [32b9f033f95d6566939d6709dd5f57eeb4402932] | committer: Thomas Guillem

update with last vlc changes

libvlc_media_discoverer_services_get being renamed to libvlc_media_discoverer_list_get

> https://code.videolan.org/videolan/vlc-android/commit/32b9f033f95d6566939d6709dd5f57eeb4402932
---

 libvlc/jni/libvlcjni-mediadiscoverer.c               | 20 ++++++++++----------
 libvlc/jni/libvlcjni.c                               | 10 +++++-----
 libvlc/jni/utils.h                                   |  4 ++--
 libvlc/libvlcjni.sym                                 |  2 +-
 libvlc/src/org/videolan/libvlc/MediaDiscoverer.java  | 18 +++++++++---------
 .../src/org/videolan/libvlc/util/MediaBrowser.java   | 15 ++++++++-------
 6 files changed, 35 insertions(+), 34 deletions(-)

diff --git a/libvlc/jni/libvlcjni-mediadiscoverer.c b/libvlc/jni/libvlcjni-mediadiscoverer.c
index 2a3787d..8a82352 100644
--- a/libvlc/jni/libvlcjni-mediadiscoverer.c
+++ b/libvlc/jni/libvlcjni-mediadiscoverer.c
@@ -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,
-                                                           jobject libVlc,
-                                                           jint i_category)
+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;
 }
diff --git a/libvlc/jni/libvlcjni.c b/libvlc/jni/libvlcjni.c
index 0262482..9a98fa9 100644
--- a/libvlc/jni/libvlcjni.c
+++ b/libvlc/jni/libvlcjni.c
@@ -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,
diff --git a/libvlc/jni/utils.h b/libvlc/jni/utils.h
index 6544169..ce14de1 100644
--- a/libvlc/jni/utils.h
+++ b/libvlc/jni/utils.h
@@ -85,9 +85,9 @@ struct fields {
     struct {
         struct {
             jclass clazz;
-        } Service;
+        } Description;
         jclass clazz;
-        jmethodID createServiceFromNativeID;
+        jmethodID createDescriptionFromNativeID;
     } MediaDiscoverer;
     struct {
         jclass clazz;
diff --git a/libvlc/libvlcjni.sym b/libvlc/libvlcjni.sym
index 37bf9eb..15284a4 100644
--- a/libvlc/libvlcjni.sym
+++ b/libvlc/libvlcjni.sym
@@ -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
diff --git a/libvlc/src/org/videolan/libvlc/MediaDiscoverer.java b/libvlc/src/org/videolan/libvlc/MediaDiscoverer.java
index 112e3fa..dd17de4 100644
--- a/libvlc/src/org/videolan/libvlc/MediaDiscoverer.java
+++ b/libvlc/src/org/videolan/libvlc/MediaDiscoverer.java
@@ -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);
 }
diff --git a/libvlc/src/org/videolan/libvlc/util/MediaBrowser.java b/libvlc/src/org/videolan/libvlc/util/MediaBrowser.java
index 1719650..2ddb187 100644
--- a/libvlc/src/org/videolan/libvlc/util/MediaBrowser.java
+++ b/libvlc/src/org/videolan/libvlc/util/MediaBrowser.java
@@ -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) {



More information about the Android mailing list