Page 1 of 1

Problem to load a M3U playlist

Posted: 23 Dec 2008 18:09
by SaiyanRiku
Hi,

I have a problem with libvlc.
My program is based on the libVLC tutorial (http://wiki.videolan.org/LibVLC_Tutorial) with 0.9.x versions.

When I try to load a M3U playlist as a media, it doesn't work, for example :

Code: Select all

m = libvlc_media_new (inst, "http://viphttp.yacast.net/V4/radiofrance/franceinfo_bd.m3u", &ex);
But when I open it with VLC it works fine.

Any idea about the problem?

Thanks

Re: Problem to load a M3U playlist

Posted: 23 Dec 2008 20:50
by erwan10
see this link http://mailman.videolan.org/pipermail/v ... 54167.html which answers a similar problem

Re: Problem to load a M3U playlist

Posted: 24 Dec 2008 14:35
by SaiyanRiku
Thanks, it works,
but in fact, it doesn't resolve my problem because in my program, I have a lot of URL's and I don't know if the media is a playlist or a simple video stream.
Do we have a medium to know the type of the media?

And I have another problem, the media subitem seems to be another problem, when I try :

Code: Select all

libvlc_media_list_player_play(mlp, &ex); raise (&ex); libvlc_media_list_t *ml2; ml2 = libvlc_media_subitems (m, &ex); raise (&ex); if(ml2 != NULL){ ... }
the sub media list is randomly created. I think it's due to the play fonction which start in a thread.
So, is a way exists to don't have this problem.

Thanks for all,

I hope my english is a little understandable...

Re: Problem to load a M3U playlist

Posted: 24 Dec 2008 15:54
by erwan10
You're right . A media_player starts a new thread. Therefore, for a m3u file, the subitems are not available right away. Inserting a small sleep is an easy way to work out this problem. Another solution is to wait for the end of the media_player (using events and callbacks).

Also, if you use media_list, from what I recall, libvlc_media_list_add_file_content is blocking (no additional thread). So you are sure the subitems are available as soon as you exit this function.

As for knowing what a media is, m3u extension is definitively a playlist whether there is one or more items in it. And this process can be used recursively (embedded m3u files within m3u files work)