[vlc-devel] [PATCH 15/19] qt: cache item url in playlist item
Fatih Uzunoglu
fuzun54 at outlook.com
Wed Aug 12 23:17:22 CEST 2020
---
modules/gui/qt/playlist/playlist_item.cpp | 12 +++++++++---
modules/gui/qt/playlist/playlist_item.hpp | 5 +++++
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/modules/gui/qt/playlist/playlist_item.cpp b/modules/gui/qt/playlist/playlist_item.cpp
index c9bb3d2995..6ba6dc7f68 100644
--- a/modules/gui/qt/playlist/playlist_item.cpp
+++ b/modules/gui/qt/playlist/playlist_item.cpp
@@ -65,15 +65,21 @@ vlc_tick_t PlaylistItem::getDuration() const
return d->duration;
}
+QUrl PlaylistItem::getUrl() const
+{
+ return d->url;
+}
+
void PlaylistItem::sync() {
input_item_t *media = vlc_playlist_item_GetMedia(d->item.get());
vlc_mutex_lock(&media->lock);
- d->title = media->psz_name;
+ d->title = media->psz_name;
d->duration = media->i_duration;
+ d->url = media->psz_uri;
if (media->p_meta) {
- d->artist = vlc_meta_Get(media->p_meta, vlc_meta_Artist);
- d->album = vlc_meta_Get(media->p_meta, vlc_meta_Album);
+ d->artist = vlc_meta_Get(media->p_meta, vlc_meta_Artist);
+ d->album = vlc_meta_Get(media->p_meta, vlc_meta_Album);
d->artwork = vlc_meta_Get(media->p_meta, vlc_meta_ArtworkURL);
}
vlc_mutex_unlock(&media->lock);
diff --git a/modules/gui/qt/playlist/playlist_item.hpp b/modules/gui/qt/playlist/playlist_item.hpp
index 88cca497fd..c9be09555c 100644
--- a/modules/gui/qt/playlist/playlist_item.hpp
+++ b/modules/gui/qt/playlist/playlist_item.hpp
@@ -54,6 +54,7 @@ public:
Q_PROPERTY(QString album READ getAlbum CONSTANT )
Q_PROPERTY(QUrl artwork READ getArtwork CONSTANT )
Q_PROPERTY(vlc_tick_t duration READ getDuration CONSTANT )
+ Q_PROPERTY(QUrl url READ getUrl CONSTANT )
PlaylistItem(vlc_playlist_item_t *item = nullptr);
@@ -76,6 +77,8 @@ public:
vlc_tick_t getDuration() const;
+ QUrl getUrl() const;
+
void sync();
@@ -92,6 +95,8 @@ private:
QUrl artwork;
vlc_tick_t duration;
+
+ QUrl url;
};
QExplicitlySharedDataPointer<Data> d;
--
2.25.1
More information about the vlc-devel
mailing list