[vlc-commits] macosx/playlist item: expose URL

Felix Paul Kühne git at videolan.org
Mon Jul 8 21:38:08 CEST 2019


vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Mon Jul  8 20:35:44 2019 +0200| [e802900e8f6527de1bdca7115973c7c6d0604f51] | committer: Felix Paul Kühne

macosx/playlist item: expose URL

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e802900e8f6527de1bdca7115973c7c6d0604f51
---

 modules/gui/macosx/playlist/VLCPlaylistItem.h |  1 +
 modules/gui/macosx/playlist/VLCPlaylistItem.m | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/modules/gui/macosx/playlist/VLCPlaylistItem.h b/modules/gui/macosx/playlist/VLCPlaylistItem.h
index 2664beda2c..a7cc2b524b 100644
--- a/modules/gui/macosx/playlist/VLCPlaylistItem.h
+++ b/modules/gui/macosx/playlist/VLCPlaylistItem.h
@@ -31,6 +31,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (readonly) vlc_playlist_item_t *playlistItem;
 @property (readwrite, retain) NSString *title;
+ at property (readonly, copy, nullable) NSURL *url;
 @property (readonly, copy, nullable) NSString *path;
 @property (readwrite, assign) vlc_tick_t duration;
 @property (readonly, nullable) VLCInputItem *inputItem;
diff --git a/modules/gui/macosx/playlist/VLCPlaylistItem.m b/modules/gui/macosx/playlist/VLCPlaylistItem.m
index d15bb24170..be6a18450e 100644
--- a/modules/gui/macosx/playlist/VLCPlaylistItem.m
+++ b/modules/gui/macosx/playlist/VLCPlaylistItem.m
@@ -79,6 +79,25 @@
     vlc_mutex_unlock(&p_media->lock);
 }
 
+- (NSURL *)url
+{
+    if (_playlistItem) {
+        return nil;
+    }
+
+    input_item_t *p_media = vlc_playlist_item_GetMedia(_playlistItem);
+    if (!p_media) {
+        return nil;
+    }
+    char *psz_url = input_item_GetURI(p_media);
+    if (!psz_url)
+        return nil;
+
+    NSURL *url = [NSURL URLWithString:toNSStr(psz_url)];
+    free(psz_url);
+    return url;
+}
+
 - (NSString *)path
 {
     if (!_playlistItem) {



More information about the vlc-commits mailing list