[vlc-devel] [PATCH] qt: add nodes that are already preparsed when initializing NetworkMediaModel

Pierre Lamot pierre at videolabs.io
Mon Sep 14 18:00:22 CEST 2020


  vlc_media_tree_Preparse will only notify about newly found entry. If entries
  are already in the tree they won't show up.
---
 modules/gui/qt/network/networkmediamodel.cpp | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/modules/gui/qt/network/networkmediamodel.cpp b/modules/gui/qt/network/networkmediamodel.cpp
index ddb87b5e2b..08eb764c24 100644
--- a/modules/gui/qt/network/networkmediamodel.cpp
+++ b/modules/gui/qt/network/networkmediamodel.cpp
@@ -328,6 +328,21 @@ bool NetworkMediaModel::initializeMediaSources()
         emit isIndexedChanged();
     }
 
+    {
+        input_item_node_t* mediaNode = nullptr;
+        vlc_media_tree_Lock(tree);
+        std::vector<InputItemPtr> itemList;
+        if (vlc_media_tree_Find( tree, m_treeItem.media.get(), &mediaNode, nullptr))
+        {
+            itemList.reserve(mediaNode->i_children);
+            for (int i = 0; i < mediaNode->i_children; i++)
+                itemList.emplace_back(mediaNode->pp_children[i]->p_item);
+        }
+        vlc_media_tree_Unlock(tree);
+        if (!itemList.empty())
+            refreshMediaList( m_treeItem.source, std::move( itemList ), true );
+    }
+
     vlc_media_tree_PreparseCancel( libvlc, this );
     m_preparseSem.acquire();
     vlc_media_tree_Preparse( tree, libvlc, m_treeItem.media.get(), this );
-- 
2.25.1



More information about the vlc-devel mailing list