Page 1 of 1

Reliable use of new libvlc_media_tracks_get()

Posted: 28 Apr 2013 21:56
by sherington
Hi,

I have been incorporating the new libvlc_media_tracks_get() API into my bindings. I am trying to find the most reliable instant at which to invoke this libvlc method in order to get fully populated data.

If I wait for a "playing" event from the media player, I see nothing returned.

If I wait until I get a "vout" event from the media player, I see this information returned:

Code: Select all

VideoTrackInfo[ codecName=mpgv, id=1, bitRate=0, language=null, description=null width=0, height=0, sampleAspectRatio=9216, sampleAspectRatioBase=6480, frameRate=0, frameRateBase=0 ] AudioTrackInfo[ codecName=a52, id=2, bitRate=0, language=en, description=null channels=0 rate=0 ]
In this case it is mostly OK, but some information is not present - for video: width, height and frame-rate is not present; for audio: channels, rate and bit-rate is not present.

If after I receive the "vout" event I wait a little while longer, e.g. sleep for 500ms, and invoke the libvlc_media_tracks_get again, this time I get those 'extra' fields populated:

Code: Select all

VideoTrackInfo[ codecName=mpgv, id=1, bitRate=0, language=null, description=null width=720, height=576, sampleAspectRatio=9216, sampleAspectRatioBase=6480, frameRate=50, frameRateBase=2 ] AudioTrackInfo[ codecName=a52, id=2, bitRate=384000, language=null, description=null channels=6 rate=48000 ]
So my question is, is there any reliable way to know when it is the right time to invoke libvlc_media_tracks_get() and return all of the fields populated? I suspect not because I don't see any other media player event that looks relevant.

Any hints?

Re: Reliable use of new libvlc_media_tracks_get()

Posted: 03 May 2013 14:03
by mangokm40
I hope it's OK to bump this, as I have the same question.

Thanks

Re: Reliable use of new libvlc_media_tracks_get()

Posted: 03 May 2013 15:12
by RĂ©mi Denis-Courmont
Never. Some inputs can add and remove tracks dynamically. You need to follow the media player events.