Page 1 of 1
libvlc_MediaParsedChanged arrives too early before media_tracks filled in - new libvlc_MediaTracksChanged event?
Posted: 07 Mar 2019 08:29
by oviano
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?
Re: libvlc_MediaParsedChanged arrives too early before media_tracks filled in - new libvlc_MediaTracksChanged event?
Posted: 07 Mar 2019 11:35
by unidan
Hi,
What is your code?
Re: libvlc_MediaParsedChanged arrives too early before media_tracks filled in - new libvlc_MediaTracksChanged event?
Posted: 07 Mar 2019 12:46
by oviano
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.
Re: libvlc_MediaParsedChanged arrives too early before media_tracks filled in - new libvlc_MediaTracksChanged event?
Posted: 10 Mar 2019 11:46
by Jean-Baptiste Kempf
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.