Audio track selection

This forum is about all development around libVLC.
uj2
Blank Cone
Blank Cone
Posts: 11
Joined: 28 Jul 2009 16:28

Audio track selection

Postby uj2 » 07 Aug 2009 16:44

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.

XilasZ
Developer
Developer
Posts: 189
Joined: 16 Jun 2009 20:35

Re: Audio track selection

Postby XilasZ » 13 Aug 2009 15:03

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).

uj2
Blank Cone
Blank Cone
Posts: 11
Joined: 28 Jul 2009 16:28

Re: Audio track selection

Postby uj2 » 17 Aug 2009 15:57

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.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 46 guests