Page 1 of 1

How to know end of video...

Posted: 01 Dec 2008 22:49
by d3x0r
I have an interface mostly working...[http://sack.svn.sourceforge.net/viewvc/sack/src/vlclib/] but I want to watch the status of the current clip to know how close it is to the end.

libvlc_media_player_get_length doesn't return a non 0 value until
libvlc_media_player_get_time returns non 0.

once the end of the stream is reached... libvlc_media_player_get_time does not return when called.
libvlc_media_list_player_get_state also does not return if the movie clip has played to the end.

So.. what is the proper way to know when the clip is done/nearing the end?

Re: How to know end of video...

Posted: 02 Dec 2008 00:32
by erwan10
Have you looked at events associated with the media_player.
Instead of actively probing vlc, just let callbacks work for you !
(libvlc_MediaPlayerPositionChanged and libvlc_MediaPlayerEndReached should be the events you are looking for)

How to play next video...

Posted: 02 Dec 2008 23:51
by d3x0r
Okay so I figured out how to connect to events... there seem to be two event managers though, one per media and one on the media player. I attached to libvlc_MediaPlayerEndReached... and I get the vent, what is the appropriate sequence of steps to play the next clip?

The medias are all in a media list and I have a media_list_player.

Re: How to know end of video...

Posted: 03 Dec 2008 00:55
by erwan10
As of today, if you use a media_list, you may encounter some problems (transition between media items leads to a deadlock issue, a patch has been proposed for review, stay tuned ...)

Ideally, media_list automates playing out one item after another. You don't have to worry about playing the next item. Of course, you can use "libvlc_media_list_player_next()" or "libvlc_media_list_player_play_item_at_index()" if you want to force playing another item before the previous one reached the end. In any case, the event "libvlc_MediaListPlayerNextItemSet" lets you know a new media is being launched if you need it.

Up to now, I have kept away from media_list for the reason mentioned above. I manage a local list of media in C++ and just use media_player. I know a media is over thanks to the "libvlc_MediaPlayerEndReached" event. When that happens, you can start a new one. (just a tricky point, don't launch it in the callback as you will get a deadlock issue too)

Re: How to know end of video...

Posted: 03 Dec 2008 03:37
by d3x0r
(just a tricky point, don't launch it in the callback as you will get a deadlock issue too)
Thanx great to know.
I actually don't want the list to be used, I want to start a seperate player instance on another surface and cross ideally the last frame of the first with the first frame of the second, instead of waiting for the video to pass through the steps to pick a decoder, load, prebuffer, etc...

Re: How to know end of video...

Posted: 03 Dec 2008 11:08
by erwan10
If you use two different media_players, you won't have any deadlock problems. (The deadlock issue occurs only if you re-use the same media_player).

As for managing vlc on a frame basis, I'm not so sure you can achieve something by just using two media_players.
And there is no such thing as pre-roll available for libvlc api developpers.

The only way I can figure out working on a (almost) frame basis is through the use of vmem. (see http://wiki.videolan.org/LibVLC_SampleCode_SDL). You could even devise things like blending the last 10 sec of a video with the first 10 sec of a new video with vmem. vmem gives you back the rendered picture. It's up to you to decide what to do with them.

Re: How to know end of video...

Posted: 06 Jan 2009 22:04
by Beardless2
does anyone know the progress on this media_list deadlock fix yet?