Page 1 of 1

Audio track selection

Posted: 07 Aug 2009 16:44
by uj2
Hello!

I have videos with multiple audio tracks and I want to handle them from my code, which uses libvlc api. I've tried libvlc_audio_get_track_count, libvlc_audio_get_track_description, but the first always returns 0, and the second -- NULL. How can I do just that: enumerate audio tracks in video file and select specific track (just like menu in Audio -> Audio Track). Thanks in advance.

Re: Audio track selection

Posted: 13 Aug 2009 15:03
by XilasZ
I did it in my program, i have a menu to select tracks (audio/video/subtitles).

When are you calling get_track_count and get_track_description ?
As far as i know, vlc can provide track list only if it is playing something. Even if you call them right after calling play(), it might fails because it hasn't started yet.
To solve this, i get track lists in the positionchanged event (fired by libvlc).

Re: Audio track selection

Posted: 17 Aug 2009 15:57
by uj2
Actually it's true. I'm playing network stream, so I think audio track info is not available till stream is cached. Making a slight delay fixed situation, thank you.