[Android] MediaWrapper: stop using libvlcTitle when it contains '://'

popy popy git at videolan.org
Wed Jan 24 13:35:27 UTC 2024


vlc-android | branch: master | popy popy <tobias.diendorfer at gmail.com> | Thu Nov  9 10:09:05 2023 +0000| [60c682c83173319f6b32b18f70645b1bdc3d84b5] | committer: Duncan McNamara

MediaWrapper: stop using libvlcTitle when it contains '://'

Fixes #3007

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

 .../org/videolan/medialibrary/interfaces/media/MediaWrapper.java | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/medialibrary/src/org/videolan/medialibrary/interfaces/media/MediaWrapper.java b/medialibrary/src/org/videolan/medialibrary/interfaces/media/MediaWrapper.java
index b53443c91e..aa840cec85 100644
--- a/medialibrary/src/org/videolan/medialibrary/interfaces/media/MediaWrapper.java
+++ b/medialibrary/src/org/videolan/medialibrary/interfaces/media/MediaWrapper.java
@@ -396,6 +396,9 @@ public abstract class MediaWrapper extends MediaLibraryItem implements Parcelabl
      * will be replaced with the filename even though the medialibrary has a correct title.
      * This won't work for network shares as they will return null titles, so
      * they are exempted as directories
+     * This also won't work for media streams (ex.: udp://@... multicast streams) as libvlc will
+     * return the url (ex.: udp://...) as title, so on streams we look for :// in libvlc title and
+     * ignore those title updates.     
      * @param media media to update
      * @return title string
      */
@@ -403,7 +406,11 @@ public abstract class MediaWrapper extends MediaLibraryItem implements Parcelabl
         String libvlcTitle = getMetaId(media, mTitle, Media.Meta.Title, true);
         String fileName = getFileName();
         if (media.getType() == Media.Type.Directory ||
-                (!TextUtils.isEmpty(libvlcTitle) && !libvlcTitle.equals(fileName)))
+                (!TextUtils.isEmpty(libvlcTitle) &&
+                        !libvlcTitle.equals(fileName) &&
+                        !(media.getType() == Media.Type.Stream && libvlcTitle.toLowerCase().contains("://"))
+                )
+        )
             return libvlcTitle;
         return getTitle();
     }



More information about the Android mailing list