libVLC get language code from audio track
Posted: 13 Nov 2015 12:41
Hi all,
when playing a transport stream I can get the description to the played audio track with e.g. libvlc_audio_get_track_description(). This work fine and I get something like "[Russisch]". Is there a way to get the language code (ISO639) instead of the localized description? I tried something like this:
... when the media is playing already. The array stored at mtArray has 2 elements (which is fine: video + audio), but language and description is empty. Is there another way I can try?
Thanks in advance,
Jörg
P.S. Many thanks for the great API and the nice support!
when playing a transport stream I can get the description to the played audio track with e.g. libvlc_audio_get_track_description(). This work fine and I get something like "[Russisch]". Is there a way to get the language code (ISO639) instead of the localized description? I tried something like this:
Code: Select all
// get current played media ...
libvlc_media_t* pCurrentMedia = libvlc_media_player_get_media(pMediaPlayer);
if (pCurrentMedia != NULL)
{
libvlc_media_track_t** mtArray;
int iTracks;
if ((iTracks = libvlc_media_tracks_get(pCurrentMedia, &mtArray)) > 0)
{
for (int i = 0; i < iTracks; i++)
{
cout << "Language: " << mtArray[i]->psz_language << ", Descr.: " << mtArray[i]->psz_description << endl;
}
libvlc_media_tracks_release(mtArray, iTracks);
}
}
Thanks in advance,
Jörg
P.S. Many thanks for the great API and the nice support!