[vlc-devel] [PATCH] Media library core

Srikanth Raju srikiraju at gmail.com
Mon Dec 28 11:44:55 CET 2009


2009/12/28 Rémi Denis-Courmont <rem at videolan.org>

> Le lundi 28 décembre 2009, Srikanth Raju a écrit :
> > Hello,
> > I've attached new patches. I've split up the patch into two pieces.
> > The first is just the vlc_media_library.h header file. The second
> > includes the core.
> >
> > Things that need looking into:
> > * The general API in the header file. Most of the functions are
> > simple helpers, so it's not really important to look at the
> > implementation in too much detail. What I'm looking for is a holistic
> > review.
> Don't add new typedefs to vlc_common.h. This is historical.
> Also don't define identifiers with leading underscores.
> The C standard reserves those for the run-time.
> And don't cut&paste the atomic reference counting code. If you really
> need to invent your own, then factor it out. But I really don't
> understand why you need this.
Here's a quick explanation.
There is a media "pool" that contains all the media objects that are
currently in existence. This is to ensure only one media object exists for a
given id. This also acts as a cache for these medias. There is a garbage
collecting loop that runs on this pool. When the ref count of an object
becomes 1, it waits n seconds before calling the destructor of this object.

Thus, ml_gc_incref is the same as vlc_gc_incref. And ml_gc_decref should
fail in the case when the media exists in the pool, but its refs has become
0 by a call to the same function. Because it will be the job of the GC loop
to clean up the last ref held by the pool.

> > * ml_gc_incref and ml_gc_decref. These rely on a garbage collecting
> > loop in the module that tests if refs = 1 and then releases the
> > object if so. Is testing the refs "ok" by anything other than the
> > vlc_gc functions?
> That won't work as the test and release is not an atomic operation.
So, if this is implemented as an atomic operation ( similar to vlc_release
), it will be fine. Correct?

> --
> Rémi Denis-Courmont
> http://www.remlab.net/
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel

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

More information about the vlc-devel mailing list