Reliable use of new libvlc_media_tracks_get()

This forum is about all development around libVLC.
sherington
Cone that earned his stripes
Cone that earned his stripes
Posts: 491
Joined: 10 Sep 2008 11:57
VLC version: master
Operating System: Linux

Reliable use of new libvlc_media_tracks_get()

Postby sherington » 28 Apr 2013 21:56

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?

mangokm40
Cone that earned his stripes
Cone that earned his stripes
Posts: 130
Joined: 20 May 2010 20:00

Re: Reliable use of new libvlc_media_tracks_get()

Postby mangokm40 » 03 May 2013 14:03

I hope it's OK to bump this, as I have the same question.

Thanks

Rémi Denis-Courmont
Developer
Developer
Posts: 15228
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Reliable use of new libvlc_media_tracks_get()

Postby Rémi Denis-Courmont » 03 May 2013 15:12

Never. Some inputs can add and remove tracks dynamically. You need to follow the media player events.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 32 guests