[Android] Use full mrl with Medialibrary

Geoffrey Métais git at videolan.org
Tue Jan 10 18:15:28 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jan 10 18:15:01 2017 +0100| [146ef16f9645d8b0d352981fda97805bfc259166] | committer: Geoffrey Métais

Use full mrl with Medialibrary

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

 medialibrary/jni/medialibrary.cpp                                   | 2 +-
 vlc-android/src/org/videolan/vlc/PlaybackService.java               | 2 +-
 .../src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java       | 2 +-
 vlc-android/src/org/videolan/vlc/gui/helpers/AsyncImageLoader.java  | 2 +-
 vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 6 +++---
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/medialibrary/jni/medialibrary.cpp b/medialibrary/jni/medialibrary.cpp
index 2889116..8da78e5 100644
--- a/medialibrary/jni/medialibrary.cpp
+++ b/medialibrary/jni/medialibrary.cpp
@@ -110,7 +110,7 @@ entryPoints(JNIEnv* env, jobject thiz)
     jobjectArray mediaRefs = (jobjectArray) env->NewObjectArray(entryPoints.size(), env->FindClass("java/lang/String"), NULL);
     int index = -1;
     for(medialibrary::FolderPtr const& entrypoint : entryPoints) {
-        env->SetObjectArrayElement(mediaRefs, ++index, env->NewStringUTF(entrypoint->path().c_str()));
+        env->SetObjectArrayElement(mediaRefs, ++index, env->NewStringUTF(entrypoint->mrl().c_str()));
     }
     return mediaRefs;
 }
diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 1244007..be09ed4 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -1403,7 +1403,7 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
         List<MediaWrapper> playList = new ArrayList<>(locations.length);
         for (int i = 0 ; i < locations.length ; ++i) {
             String mrl = Uri.decode(locations[i]);
-            MediaWrapper mw = mMedialibrary.getMedia(Strings.removeFileProtocole(mrl));
+            MediaWrapper mw = mMedialibrary.getMedia(mrl);
             if (mw == null)
                 mw = new MediaWrapper(Uri.parse(mrl));
             playList.add(mw);
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
index 4503215..77466d8 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
@@ -421,7 +421,7 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
         if (! (mAdapter.getItem(position) instanceof MediaWrapper))
             return super.onContextItemSelected(item);
         Uri uri = ((MediaWrapper) mAdapter.getItem(position)).getUri();
-        MediaWrapper mwFromMl = "file".equals(uri.getScheme()) ? mMediaLibrary.getMedia(uri.getPath()) : null;
+        MediaWrapper mwFromMl = "file".equals(uri.getScheme()) ? mMediaLibrary.getMedia(uri.toString()) : null;
         final MediaWrapper mw = mwFromMl != null ? mwFromMl : (MediaWrapper) mAdapter.getItem(position);
         switch (id){
             case R.id.directory_view_play_all:
diff --git a/vlc-android/src/org/videolan/vlc/gui/helpers/AsyncImageLoader.java b/vlc-android/src/org/videolan/vlc/gui/helpers/AsyncImageLoader.java
index 6401645..c1c7b49 100644
--- a/vlc-android/src/org/videolan/vlc/gui/helpers/AsyncImageLoader.java
+++ b/vlc-android/src/org/videolan/vlc/gui/helpers/AsyncImageLoader.java
@@ -94,7 +94,7 @@ public class AsyncImageLoader {
             if (!isMedia && !(type == MediaWrapper.TYPE_DIR && "upnp".equals(uri.getScheme())))
                 return;
             if (item.getId() == 0L && (isMedia) && "file".equals(uri.getScheme())) {
-                MediaWrapper mw = VLCApplication.getMLInstance().getMedia(uri.getPath());
+                MediaWrapper mw = VLCApplication.getMLInstance().getMedia(uri.toString());
                 if (mw != null)
                     item = mw;
             }
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index 9149ac6..af27559 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -2892,7 +2892,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         if (length == 0) {
             MediaWrapper media = mService.getCurrentMediaWrapper();
             if (media.getId() == 0)
-                media = VLCApplication.getMLInstance().getMedia(mUri.getPath());
+                media = VLCApplication.getMLInstance().getMedia(mUri.toString());
             if (media != null)
                 length = (int) media.getLength();
         }
@@ -3045,11 +3045,11 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
             MediaWrapper media;
             if (openedMedia == null || openedMedia.getId() <= 0L) {
                 Medialibrary ml = VLCApplication.getMLInstance();
-                media = ml.getMedia(mUri.getPath());
+                media = ml.getMedia(mUri.toString());
                 if (media == null && TextUtils.equals(mUri.getScheme(), "file") &&
                         mUri.getPath() != null && mUri.getPath().startsWith("/sdcard")) {
                     mUri = FileUtils.convertLocalUri(mUri);
-                    media = ml.getMedia(mUri.getPath());
+                    media = ml.getMedia(mUri.toString());
                 }
             } else
                 media = openedMedia;



More information about the Android mailing list