[vlc-devel] Media Library Auto Updating Mechanism

Srikanth Raju srikiraju at gmail.com
Wed Aug 25 03:42:00 CEST 2010

Hello all,
I need to ask a question about the architecture of the Media Library module.

Essentially, the Media Library(ML) holds a bunch of ml_media_t
objects(media) inside a SQLite database. There needs to be a mechanism where
medias corresponding to input_item_ts(input item) get updated when the
input_item changes while vlc is running. Such as when the user brings up the
information dialog in the playlist or some other mechanisms( lua so on ).
There are two ways of doing this:

#1) This is what is currently implemented. We have a list of input_item_ts
that are being watched for meta change events by the ML module. A loop
thread would go over this list and garbage collect these input_items and
update into the ML any input_item_ts that were updated. The upside of this
is that threads which update input_item_t don't have to update in the ML by
running the SQL, hence there would be no slowdown of that thread. The
downside is that, now every time something obtains an input_item_t it must
register with the ML module to watch that item so as to ensure the updates
gets carried into the ML.

#2) I was thinking it would be cool if we modify input_item_t such that on
instantiation, it registers its own meta change events with the ML to that
it gets updated on the fly. This would mean we can cover all interfaces with
the ML without modifying the code of every one of them and having each of
them register with the watching mechanism. However, the downside is that it
will slow down the executing threads, as they will need to query the ML.
However, I doubt it will be much of a concern, because in a real life
scenario, the slow down will be negligible as SQL will run pretty fast. This
also means we won't need all the complex garbage collection of these
input_item_t and the code will be much simpler.

Any inputs on what approach should be taken?

Srikanth Raju
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20100825/c633d6c4/attachment.html>

More information about the vlc-devel mailing list