Skip to content

qt: refactor media tree/source models

Romain Vimont requested to merge rom1v/vlc:media_tree_listener into master

Context: A media source is a "front-end" of a service discovery (1-to-1 relationship). It embeds a media tree to expose the tree of media loaded by the service discovery or media added as the result of a preparse (concretely, double-click on a folder or a zip will "expand" new items in the tree).

Currently, the Qt models/views browse a media source, even if semantically, they would only need a media tree.

The purpose of this change is to make NetworkMediaModel more generic so that it can browse any media tree, even without media source instance. In particular, this will allow to expose a media tree for a specific media (input_item_t), which is not created from a service discovery.

Changes:

  • Make some core functions public (the vlc_media_tree_t "methods").
  • Use one "callbacks" instance per listener, so that each client can provide its own additional data.
  • Refactor NetworkSourceListener into a MediaTreeListener, which is only linked to a media tree, not a media source.
  • Refactor NetworkMediaModel to be totally independent of media sources, and NetworkDeviceModel store its media source (which is not directly stored in the listener anymore, because it's not meaningful for all clients) in its listener callbacks implementation.

Read individual commit messages for more details (especially qt: use one "callbacks" instance per listener).

Edited by Romain Vimont

Merge request reports