[Android] Rename locationFromMrl to encodeVLCString

Geoffrey Métais git at videolan.org
Tue May 30 10:49:10 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue May 30 09:59:11 2017 +0200| [ac8db15318d03f9801844ae19e11b476f6c05580] | committer: Geoffrey Métais

Rename locationFromMrl to encodeVLCString

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

 libvlc/src/org/videolan/libvlc/Media.java                    | 2 +-
 libvlc/src/org/videolan/libvlc/MediaPlayer.java              | 2 +-
 libvlc/src/org/videolan/libvlc/util/VLCUtil.java             | 6 +++---
 medialibrary/src/org/videolan/medialibrary/Medialibrary.java | 8 ++++----
 medialibrary/src/org/videolan/medialibrary/Tools.java        | 2 +-
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/libvlc/src/org/videolan/libvlc/Media.java b/libvlc/src/org/videolan/libvlc/Media.java
index 41114a0f1..f3a91e8d7 100644
--- a/libvlc/src/org/videolan/libvlc/Media.java
+++ b/libvlc/src/org/videolan/libvlc/Media.java
@@ -438,7 +438,7 @@ public class Media extends VLCObject<Media.Event> {
      */
     public Media(LibVLC libVLC, Uri uri) {
         super(libVLC);
-        nativeNewFromLocation(libVLC, VLCUtil.locationFromUri(uri));
+        nativeNewFromLocation(libVLC, VLCUtil.encodeVLCUri(uri));
         mUri = uri;
     }
 
diff --git a/libvlc/src/org/videolan/libvlc/MediaPlayer.java b/libvlc/src/org/videolan/libvlc/MediaPlayer.java
index 8967a369a..ba881f0d3 100644
--- a/libvlc/src/org/videolan/libvlc/MediaPlayer.java
+++ b/libvlc/src/org/videolan/libvlc/MediaPlayer.java
@@ -977,7 +977,7 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> {
      * @return true on success.
      */
     public boolean addSlave(int type, Uri uri, boolean select) {
-        return nativeAddSlave(type, VLCUtil.locationFromUri(uri), select);
+        return nativeAddSlave(type, VLCUtil.encodeVLCUri(uri), select);
     }
 
     /**
diff --git a/libvlc/src/org/videolan/libvlc/util/VLCUtil.java b/libvlc/src/org/videolan/libvlc/util/VLCUtil.java
index 7eb6c8af2..68e1a8ab0 100644
--- a/libvlc/src/org/videolan/libvlc/util/VLCUtil.java
+++ b/libvlc/src/org/videolan/libvlc/util/VLCUtil.java
@@ -548,15 +548,15 @@ public class VLCUtil {
         return Uri.parse(sb.toString());
     }
 
-    public static String locationFromUri(@NonNull Uri uri) {
-        return locationFromMrl(uri.toString());
+    public static String encodeVLCUri(@NonNull Uri uri) {
+        return encodeVLCString(uri.toString());
     }
 
     /**
      * VLC only acccepts "-._~" in Mrl format, android Uri accepts "_-!.~'()*".
      * Therefore, encode the characters authorized by Android Uri when creating a mrl from an Uri.
      */
-    public static String locationFromMrl(@NonNull String mrl) {
+    public static String encodeVLCString(@NonNull String mrl) {
         final char[] array = mrl.toCharArray();
         final StringBuilder sb = new StringBuilder(array.length * 2);
 
diff --git a/medialibrary/src/org/videolan/medialibrary/Medialibrary.java b/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
index 3ce3d4221..b75afb7b3 100644
--- a/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
+++ b/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
@@ -92,7 +92,7 @@ public class Medialibrary {
     }
 
     public boolean addDevice(@NonNull String uuid, @NonNull String path, boolean removable, boolean notify) {
-        return nativeAddDevice(uuid, Tools.encodeVLCMrl(path), removable, notify);
+        return nativeAddDevice(VLCUtil.encodeVLCString(uuid), Tools.encodeVLCMrl(path), removable, notify);
     }
 
     public void discover(@NonNull String path) {
@@ -112,7 +112,7 @@ public class Medialibrary {
     }
 
     public boolean removeDevice(String uuid) {
-        return mIsInitiated && nativeRemoveDevice(uuid);
+        return mIsInitiated && nativeRemoveDevice(VLCUtil.encodeVLCString(uuid));
     }
 
     @Override
@@ -224,7 +224,7 @@ public class Medialibrary {
     }
 
     public boolean addToHistory(String mrl, String title) {
-        return mIsInitiated && nativeAddToHistory(mrl, title);
+        return mIsInitiated && nativeAddToHistory(Tools.encodeVLCMrl(mrl), VLCUtil.encodeVLCString(title));
     }
 
     public MediaWrapper getMedia(long id) {
@@ -232,7 +232,7 @@ public class Medialibrary {
     }
 
     public MediaWrapper getMedia(Uri uri) {
-        return mIsInitiated ? nativeGetMediaFromMrl(VLCUtil.locationFromUri(uri)) : null;
+        return mIsInitiated ? nativeGetMediaFromMrl(VLCUtil.encodeVLCUri(uri)) : null;
     }
 
     public MediaWrapper getMedia(String mrl) {
diff --git a/medialibrary/src/org/videolan/medialibrary/Tools.java b/medialibrary/src/org/videolan/medialibrary/Tools.java
index 8ef9b9adb..a82b85cd8 100644
--- a/medialibrary/src/org/videolan/medialibrary/Tools.java
+++ b/medialibrary/src/org/videolan/medialibrary/Tools.java
@@ -127,6 +127,6 @@ public class Tools {
     public static String encodeVLCMrl(String mrl) {
         if (mrl.startsWith("/"))
             mrl = "file://"+mrl;
-        return VLCUtil.locationFromMrl(mrl);
+        return VLCUtil.encodeVLCString(mrl);
     }
 }



More information about the Android mailing list