[vlc-commits] qt: make NetworkMediaModel work without medialibrary

Pierre Lamot git at videolan.org
Thu Oct 15 10:33:06 CEST 2020


vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Thu Oct  8 09:07:09 2020 +0200| [9f667673bd5fffc3ab53c9447bceb3c6651bb980] | committer: Pierre Lamot

qt: make NetworkMediaModel work without medialibrary

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

 modules/gui/qt/network/networkmediamodel.cpp | 6 +++---
 modules/gui/qt/network/networkmediamodel.hpp | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/gui/qt/network/networkmediamodel.cpp b/modules/gui/qt/network/networkmediamodel.cpp
index b8b23dd66d..c41bf9ae38 100644
--- a/modules/gui/qt/network/networkmediamodel.cpp
+++ b/modules/gui/qt/network/networkmediamodel.cpp
@@ -306,7 +306,7 @@ bool NetworkMediaModel::initializeMediaSources()
         emit typeChanged();
         m_canBeIndexed = canBeIndexed( m_url, m_type );
         emit canBeIndexedChanged();
-        if ( vlc_ml_is_indexed( m_ml, QByteArray(m_treeItem.media->psz_uri).append('/').constData(), &m_indexed ) != VLC_SUCCESS ) {
+        if ( !m_ml || vlc_ml_is_indexed( m_ml, QByteArray(m_treeItem.media->psz_uri).append('/').constData(), &m_indexed ) != VLC_SUCCESS ) {
             m_indexed = false;
         }
         emit isIndexedChanged();
@@ -459,7 +459,7 @@ void NetworkMediaModel::refreshMediaList( MediaSourcePtr mediaSource,
             free(artwork);
         }
 
-        if ( item.canBeIndexed == true )
+        if ( m_ml && item.canBeIndexed == true )
         {
             if ( vlc_ml_is_indexed( m_ml, qtu( item.mainMrl.toString( QUrl::FullyEncoded ) ),
                                     &item.indexed ) != VLC_SUCCESS )
@@ -485,5 +485,5 @@ void NetworkMediaModel::refreshMediaList( MediaSourcePtr mediaSource,
 
 bool NetworkMediaModel::canBeIndexed(const QUrl& url , ItemType itemType )
 {
-    return static_cast<input_item_type_e>(itemType) != ITEM_TYPE_FILE && (url.scheme() == "smb" || url.scheme() == "ftp" || url.scheme() == "file");
+    return  m_ml && static_cast<input_item_type_e>(itemType) != ITEM_TYPE_FILE && (url.scheme() == "smb" || url.scheme() == "ftp" || url.scheme() == "file");
 }
diff --git a/modules/gui/qt/network/networkmediamodel.hpp b/modules/gui/qt/network/networkmediamodel.hpp
index 7438f219e6..28b7cbb5ca 100644
--- a/modules/gui/qt/network/networkmediamodel.hpp
+++ b/modules/gui/qt/network/networkmediamodel.hpp
@@ -183,7 +183,7 @@ private:
 
     void refreshMediaList(MediaSourcePtr s, std::vector<InputItemPtr> childrens , bool clear);
 
-    static bool canBeIndexed(const QUrl& url , ItemType itemType );
+    bool canBeIndexed(const QUrl& url , ItemType itemType );
 
 private:
     //properties of the current node



More information about the vlc-commits mailing list