Skip to content

qt: fix device subnodes appears as empty in Browse view

Pierre Lamot requested to merge chub/vlc:qt/network-device-rework into master

The original issue was due to device model being unloaded when the BrowseHomePage was closed to open the subview, model close would remove the items from the media tree, so the tree appeared as empty. This means that the MediaTreeItem needs to keep a reference to their source to remain valid.

Now there are different drawback from doing this:

  • Source needs to be used with a listener, if we go back and forth between a the browse home page and a subview, we would create listener on the mediasouce each time without releasing them as MediaTreeItem needs to be kept in history in order to be able to browse back in tree.
  • Sources are aggregated in NetworkDeviceModel, ideally we want to keep only track of the media source that created the inputItem

In this merge request:

  • MLThreadRunner is made independant from the medialibrary to be re-usable for other purpose. The goal was to avoid having DeviceSourceProvider living in another thread and reuse existing patterns
  • MediaSouceModel and DeviceSourceProvider is closer to VLC C model, DeviceSourceProvider exposes all the sources for a given services_discovery_category_e and MediaSouceModel expose all the medias of a given source. The media aggregation is delegated to the NetworkDeviceModel.
  • MediaTreeItem keeps a reference to the MediaSouceModel
  • the MediaSouceModel are globally cached, this allows re-referencing a media source without creating a new listener, the cache use a weak pointer mechanism this allows releasing the model when no-one is using it.

Merge request reports

Loading