libvlc_MediaParsedChanged arrives too early before media_tracks filled in - new libvlc_MediaTracksChanged event?

This forum is about all development around libVLC.
oviano
Cone that earned his stripes
Cone that earned his stripes
Posts: 120
Joined: 12 Jan 2012 11:12

libvlc_MediaParsedChanged arrives too early before media_tracks filled in - new libvlc_MediaTracksChanged event?

Postby oviano » 07 Mar 2019 08:29

I'm using the imem callback interface to feed libVLC the data, and I was hoping to be able to use the above event to read the media track information such as video size, frame rate, codec etc.

However, when the above event arrives the track info hasn't been filled in, everything is zero. A short while later (maybe one loop of the engine) this information is all present. This means the above event isn't quite right. Also, if the media information changes for some reason (new bitrate for example), I am guessing the media parsed event isn't going to be sent again? Or is it?

Perhaps we could have an event specific to the media tracks info changing?

unidan
Developer
Developer
Posts: 1493
Joined: 25 Mar 2018 01:00

Re: libvlc_MediaParsedChanged arrives too early before media_tracks filled in - new libvlc_MediaTracksChanged event?

Postby unidan » 07 Mar 2019 11:35

Hi,

What is your code?

oviano
Cone that earned his stripes
Cone that earned his stripes
Posts: 120
Joined: 12 Jan 2012 11:12

Re: libvlc_MediaParsedChanged arrives too early before media_tracks filled in - new libvlc_MediaTracksChanged event?

Postby oviano » 07 Mar 2019 12:46

Not sure what exactly you are asking - it's a custom video player linking to libVLC which uses the imem callbacks to receive data, and a custom vout plugin (vbridge that receives HW surfaces), but the pseudo code is like this:

- create media, attach MediaParsed event
- create player, attach MediaPlayerESAdded event
- run player
- call pre-parse media
- media preparse event received (but no track info yet)
- player ESadded events received for both video and audio (but track info, width/height etc is zero)
- video format callback called
- display callback called the first time (track info width/height still zero at this point)
- display callback called the second time (now we have valid track info, width/height, framerate etc.)

By the way my source is mpegts so maybe the above sequence of events would be different for different containers.

Anyway, the solution is to have a new libvlc_MediaTracksChanged event, hooked in via sending a new vlc_InputItemTracksInfoChanged inside input_item_UpdateTracksInfo.

This works, and I can provide a patch if you are interested, but only against the Vlc-3.0 branch as I am using that not latest master/4.0.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: libvlc_MediaParsedChanged arrives too early before media_tracks filled in - new libvlc_MediaTracksChanged event?

Postby Jean-Baptiste Kempf » 10 Mar 2019 11:46

This works, and I can provide a patch if you are interested, but only against the Vlc-3.0 branch as I am using that not latest master/4.0.
Any patch is cool. We will adapt to 4.0.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 6 guests