How to know end of video...

This forum is about all development around libVLC.
d3x0r
Blank Cone
Blank Cone
Posts: 38
Joined: 01 Dec 2008 22:38

How to know end of video...

Postby d3x0r » 01 Dec 2008 22:49

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?

erwan10
Developer
Developer
Posts: 415
Joined: 02 Nov 2008 23:16

Re: How to know end of video...

Postby erwan10 » 02 Dec 2008 00:32

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)

d3x0r
Blank Cone
Blank Cone
Posts: 38
Joined: 01 Dec 2008 22:38

How to play next video...

Postby d3x0r » 02 Dec 2008 23:51

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.

erwan10
Developer
Developer
Posts: 415
Joined: 02 Nov 2008 23:16

Re: How to know end of video...

Postby erwan10 » 03 Dec 2008 00:55

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)

d3x0r
Blank Cone
Blank Cone
Posts: 38
Joined: 01 Dec 2008 22:38

Re: How to know end of video...

Postby d3x0r » 03 Dec 2008 03:37

(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...

erwan10
Developer
Developer
Posts: 415
Joined: 02 Nov 2008 23:16

Re: How to know end of video...

Postby erwan10 » 03 Dec 2008 11:08

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.

Beardless2
Cone that earned his stripes
Cone that earned his stripes
Posts: 125
Joined: 02 Feb 2007 09:53

Re: How to know end of video...

Postby Beardless2 » 06 Jan 2009 22:04

does anyone know the progress on this media_list deadlock fix yet?


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 11 guests