[vlc-devel] Resolving browser plugin playlist issues

Niles Bindel zaggal69 at gmail.com
Mon Aug 17 21:43:00 CEST 2009

 Hi all, this is my first post to the mailing list.

I recently posted this on the forums and was told by Rémi Denis-Courmont to
post it here for discussion.  I've included my original post and his
response below.  As I state below, I have solved the initial problem fairly
simply by reusing the existing playlist functionality, but I'm still looking
for the best way to proceed within the existing code framework before trying
to submit a patch.  At this point, I don't believe Rémi's point about there
only being the one playlist per instance will be much of an issue for the
browser plugins.

Original Post:

I've been working to resolve an issue with the Mozilla plugin related to
playback of the playlist not continuing on to the next playlist item and
some audio distortion issues related to manually changing the current
playlist item. I've looked into the code for the plugin to find that, in
fact, the playback no longer supports any automatic transitioning to the
next playlist item upon reaching the end of the current item. I've also
noticed this same issue exists for the ActiveX plugin.

I decided to tackle this issue myself and after looking into the code base I
came across a MediaListPlayer that I figured would solve this issue nicely.
Unfortunately, after converting the code to use the MediaListPlayer, I
encountered a threading deadlock whenever the MediaListPlayer tried to
transition to the next media item. I traced this down to the fact that
whenever the MediaPlayer finishes playing an item it triggered the
"libvlc_MediaPlayerEndReached" event which in turn triggered the callback
function registered to the MediaListPlayer to trigger the transition to the
next playlist item. Unfortunately, this transition to the next playlist item
causes the deletion of the previous item and its callback functions (one of
which was currently in the process of executing). Therefore, the deletion
process ends up waiting for the callback to finish which never happens
because its waiting for the deletion to finish. I could get into more
details if need be, but that is the gist of it.

After thinking about the issue for a while, I decided to look at the main
playlist for VLC to see how this issue was dealt with there. This, as it
turns out, is a much more robust playlist system than the media list. After
looking through the code, it seemed that fixing the MediaListPlayer would be
a rather involved process so I set out to make the plugin work with the
existing VLC playlist. This worked like a charm, it resolved all the issues
I had been having. However, the way I managed to get it to work seems very
hacky and involved using a deprecated function
"libvlc_playlist_get_media_player" as well as including two "private"
internal files (libvlc.h and control/libvlc_internal.h) from the /src
directory in order to get access to the actual playlist.

At this point I'm willing to put in some time to patch the plugins, but I
have a few questions about how to proceed:
Is there any reason the browser plugin playlists should be using media lists
instead of the VLC playlist?
Is their someone actively working on the Media List Player?
Since it's deprecated, what is the proper way to achieve what
"libvlc_playlist_get_media_player" offers?
Is there a way to obtain the VLC playlist_t* from the VLC instance without
accessing the internal files from the /src folder?
Is there anyone I should specifically be looking to direct these questions
to? or speak with before submitting any changes?

I'm basically looking for the proper way to proceed since the changes I made
will resolve the current issues, but seem to be at odds with the overall

[image: Post] <http://forum.videolan.org/viewtopic.php?p=213372#p213372>by
* on Mon Aug 17, 2009 1:45 pm
Don't use media list player. As you noted it can deadlock. I'm planning to
remove it anyway, but this is best discussed on the vlc-devel mailing list.

It's probably a lot simpler to implement your own list and change the item
whenever you get the end of item event.

Using the playlist is problematic as well, as there is only one per instance
[image: :?] .
Rémi Denis-Courmont
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20090817/645f78f7/attachment.html>

More information about the vlc-devel mailing list