[Android] Use LibVLC encoding for medialibrary
Geoffrey Métais
git at videolan.org
Wed Feb 5 15:30:39 CET 2020
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Feb 5 11:56:25 2020 +0100| [4c7a2a4a0d10d6fdf6ce38d01fd9eed4c134b122] | committer: Geoffrey Métais
Use LibVLC encoding for medialibrary
> https://code.videolan.org/videolan/vlc-android/commit/4c7a2a4a0d10d6fdf6ce38d01fd9eed4c134b122
---
medialibrary/src/org/videolan/medialibrary/MedialibraryImpl.java | 5 +++--
medialibrary/src/org/videolan/medialibrary/Tools.java | 7 ++-----
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/medialibrary/src/org/videolan/medialibrary/MedialibraryImpl.java b/medialibrary/src/org/videolan/medialibrary/MedialibraryImpl.java
index 54acd8d63..6a9f3b069 100644
--- a/medialibrary/src/org/videolan/medialibrary/MedialibraryImpl.java
+++ b/medialibrary/src/org/videolan/medialibrary/MedialibraryImpl.java
@@ -30,6 +30,7 @@ import androidx.annotation.Nullable;
import androidx.annotation.WorkerThread;
import org.videolan.libvlc.LibVLC;
+import org.videolan.libvlc.util.VLCUtil;
import org.videolan.medialibrary.interfaces.Medialibrary;
import org.videolan.medialibrary.interfaces.media.Album;
import org.videolan.medialibrary.interfaces.media.Artist;
@@ -118,7 +119,7 @@ public class MedialibraryImpl extends Medialibrary {
public boolean addDevice(@NonNull String uuid, @NonNull String path, boolean removable) {
if (!mIsInitiated) return false;
- final boolean added = nativeAddDevice(Tools.encodeVLCString(uuid), Tools.encodeVLCMrl(path), removable);
+ final boolean added = nativeAddDevice(VLCUtil.encodeVLCString(uuid), Tools.encodeVLCMrl(path), removable);
synchronized (onDeviceChangeListeners) {
for (OnDeviceChangeListener listener : onDeviceChangeListeners) listener.onDeviceChange();
}
@@ -146,7 +147,7 @@ public class MedialibraryImpl extends Medialibrary {
public boolean removeDevice(String uuid, String path) {
if (!mIsInitiated) return false;
- final boolean removed = !TextUtils.isEmpty(uuid) && !TextUtils.isEmpty(path) && nativeRemoveDevice(Tools.encodeVLCString(uuid), Tools.encodeVLCMrl(path));
+ final boolean removed = !TextUtils.isEmpty(uuid) && !TextUtils.isEmpty(path) && nativeRemoveDevice(VLCUtil.encodeVLCString(uuid), Tools.encodeVLCMrl(path));
synchronized (onDeviceChangeListeners) {
for (OnDeviceChangeListener listener : onDeviceChangeListeners) listener.onDeviceChange();
}
diff --git a/medialibrary/src/org/videolan/medialibrary/Tools.java b/medialibrary/src/org/videolan/medialibrary/Tools.java
index 60d888ca3..e74469d90 100644
--- a/medialibrary/src/org/videolan/medialibrary/Tools.java
+++ b/medialibrary/src/org/videolan/medialibrary/Tools.java
@@ -7,6 +7,7 @@ import android.text.TextUtils;
import androidx.annotation.Nullable;
+import org.videolan.libvlc.util.VLCUtil;
import org.videolan.medialibrary.interfaces.media.MediaWrapper;
import org.videolan.medialibrary.media.MediaLibraryItem;
@@ -133,13 +134,9 @@ public class Tools {
return sb.toString();
}
- public static String encodeVLCString(String mrl) {
- return Uri.encode(Uri.decode(mrl), ".-_~/()&!$*+,;='@:?");
- }
-
public static String encodeVLCMrl(String mrl) {
if (mrl.startsWith("/")) mrl = "file://"+mrl;
- return encodeVLCString(mrl);
+ return VLCUtil.encodeVLCString(mrl);
}
/**
More information about the Android
mailing list