[vlc-devel] playlist: flat / tree separation

Jakob Leben jakob.leben at gmail.com
Fri Aug 21 14:43:07 CEST 2009


I remember someone said that the separation between flat and tree playlist
remained because some modules were not compatible with tree playlist. I
think keeping this separation complicates many algorithms concerning the
playlist and I see it as a big step forward to remove this separation. Does
anybody know of a case where tree structure would still be a problem?

In my opinion we could simply implement a "flatten down" function and
wherever a flat representation of a tree of items is needed, it could be
flattened in one step. And I certainly don't see a big profit in having a
flat and a tree representation at the same time, as synchronizing them is
quite a problem and even impossible in some cases (moving and adding items
in flat structure doesn't have a uniquely matching and equivalent action in
tree structure - regarding the item position). I also think that from an
end-user's point of view, they either want a flat or a tree representation
of a group of items and they can be offered the "flatten" operation through
GUI as well.

The core of the change would be to have only one "playlist_item_t *p_root"
field in playlist_t structure and under it only one node for playlist, media
library and services discoveries each.
"grep"-ing the vlc repository for "p_root_onelevel", "p_root_category",
"p_local_onelevel", "p_local_category", "p_ml_onelevel" or "p_ml_category"
which are fields of public playlist_t structure returns only a dozen of
different files, so I guess the amount of code affected by the change need
not be too huge.

If somebody agrees about the benefit in doing this change, I would like to
hear advice about how to make the transition smooth, meaning that the code
dependent on the basic change in playlist_t could be modified chunk by chunk
and not yet adjusted code would still work during the process.
My idea is to add the new p_root field *besides* p_root_onelevel and
p_root_category, and modifying the core playlist functions to always keep
the structures under *p_root* and *p_root_category* a copy of each other.
Next we implement the flatten function. Then we go to modify the relevant
code in vlc/modules/ to only reference *playlist_t :: p_root* and use the
flatten function where flat representation is needed. Only in the end we
change the src/playlist code to forget about p_root_onelevel and

Any thoughts very welcome, please.

Best regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20090821/92a2a45d/attachment.html>

More information about the vlc-devel mailing list