How to receive info of available audio/subtitle tracks?

All you've ever wanted to know about the ActiveX, Mozilla plugins, the web interface and various PHP extensions
zvona
Blank Cone
Blank Cone
Posts: 11
Joined: 30 Oct 2006 10:32
Location: Helsinki

How to receive info of available audio/subtitle tracks?

Postby zvona » 08 Dec 2006 13:14

I need to find which audio and subtitle tracks are served with video stream. It's possible to set correct track thru audio-track / sub-track and everything works when track is available.

But how can I find out the tracks that are available? I found options key-audio-track / key-subtitle-track for cycling thru the available tracks, but this doesn't seem to help. How are the available tracks returned or, in addition, how can I collect them?
Zvona

Spellcoder
Blank Cone
Blank Cone
Posts: 57
Joined: 19 Apr 2006 12:21
Location: Hengelo // The Netherlands
Contact:

Postby Spellcoder » 08 Dec 2006 20:01

This sounds a bit like the feature I requested in the 'feature request' forum.
There's no way yet to do this, but they seem to be planning to make it possible:

Forum thread: Reading audio stream information with Mozilla/ActiveX plugin
viewtopic.php?t=29337

zvona
Blank Cone
Blank Cone
Posts: 11
Joined: 30 Oct 2006 10:32
Location: Helsinki

Postby zvona » 11 Dec 2006 09:25

SpellCoder, you're correct: I'm requesting the very same feature as you've requested couple of days earlier.

Thanks for pointing out the request.
Zvona

Odysee
Blank Cone
Blank Cone
Posts: 15
Joined: 25 Oct 2006 17:18
Location: Germany

Postby Odysee » 11 Dec 2006 11:53

If you use the libvlc.dll directly, you can do that!
Take a look at the menu source, you'll find the answer!

Here my function written i managed c++:

Code: Select all

SortedList<int,String^>^ VlcControl::GetAudioTracks( ) { // create new list SortedList<int,String^>^ liEmptyAudioTracks = gcnew SortedList<int,String^>(); // check initialized if(!CheckInitialized( )) return liEmptyAudioTracks; try { // init exception libvlc_exception_t ex; call_libvlc_exception_init(&ex); // get input libvlc_input_t* p_input = call_libvlc_playlist_get_input(m_pVlcInstance, &ex); if(CheckException(&ex)) return liEmptyAudioTracks; // audio track list SortedList<int,String^>^ liAudioTracks = gcnew SortedList<int,String^>(); // get input thread vlc_object_t* p_input_thread = (vlc_object_t*)call_vlc_object_get(m_pVlcInstance->p_vlc,p_input->i_input_id ); if(p_input_thread != NULL) { // get audio vlc_value_t val; int iResult = call_var_Get(p_input_thread,"audio-es",&val); if(iResult >= 0) { // get track list vlc_value_t val_list; vlc_value_t text_list; iResult = call_var_Change( p_input_thread, "audio-es", VLC_VAR_GETLIST, &val_list, &text_list); if(iResult >= 0) { for( int i = 0; i < val_list.p_list->i_count; i++ ) { // add options vlc_value_t entryID = val_list.p_list->p_values[i]; vlc_value_t entryText = text_list.p_list->p_values[i]; liAudioTracks->Add(entryID.i_int,gcnew String(entryText.psz_string)); } // free call_var_Change( p_input_thread, "audio-es", VLC_VAR_FREELIST, &val_list, &text_list ); } } // free call_vlc_object_release( p_input_thread ); } // free input call_libvlc_input_free(p_input); // check result if(liAudioTracks->Count == 0) return liEmptyAudioTracks; return liAudioTracks; } catch(Exception^ ex) { m_strLastError = ex->Message; return liEmptyAudioTracks; } }

Spellcoder
Blank Cone
Blank Cone
Posts: 57
Joined: 19 Apr 2006 12:21
Location: Hengelo // The Netherlands
Contact:

Postby Spellcoder » 12 Dec 2006 16:55

I appreciate the help Odysee, but although I get around very good with Javascript and PHP I havn't touched a C compiler in years.

Luckily for us it seems feature requests for the browser plugins are taken very seriously, because so far you can read the aspect ratio (my previous feature request) and I noticed today code was added to the plugin to change both audio track and audio output channel (reverse, stereo, left, right, dolby).
https://trac.videolan.org/vlc/changeset/18383

I'll try the nightly tomorrow to see if it works.

zvona
Blank Cone
Blank Cone
Posts: 11
Joined: 30 Oct 2006 10:32
Location: Helsinki

Postby zvona » 13 Dec 2006 08:39

Great. Could you, Spellcoder, report to this thread whether there is real improvement on getting the audio track info.

Function was called get_track(), wasn't it?
Zvona

Spellcoder
Blank Cone
Blank Cone
Posts: 57
Joined: 19 Apr 2006 12:21
Location: Hengelo // The Netherlands
Contact:

Postby Spellcoder » 15 Dec 2006 12:18

Yes, I'll report my findings if you want. However so far I havn't been able to get the last few 0.9.0 nightlies to work. (both the VLC player and the plugin crash as soon as you try to play a video) So I'll tell you when I get it working.

Spellcoder
Blank Cone
Blank Cone
Posts: 57
Joined: 19 Apr 2006 12:21
Location: Hengelo // The Netherlands
Contact:

Postby Spellcoder » 04 Jan 2007 13:02

I tried the vlc-0.9.0-svn-20070104-0002-win32 nightly, which at least could play video again, but I havn't got the audio track methods to work yet.

I tried to use audio.get_track(), audio.set_track().... and later audio.getTrack()/audio.setTrack()..
But all give an Trying to get unsupported property on scriptable plugin object!' error in Firefox.

Does anyone know how to use the new track/channel support in the 0.9.0 plugin?

Quovodis
Cone that earned his stripes
Cone that earned his stripes
Posts: 271
Joined: 16 Jun 2004 11:13
Location: Cork, Ireland

Postby Quovodis » 04 Jan 2007 16:42

how about:

trackNo = audio.track
audio.track = trackNo

:wink:

Spellcoder
Blank Cone
Blank Cone
Posts: 57
Joined: 19 Apr 2006 12:21
Location: Hengelo // The Netherlands
Contact:

Postby Spellcoder » 05 Jan 2007 14:29

Great. Could you, Spellcoder, report to this thread whether there is real improvement on getting the audio track info.

Function was called get_track(), wasn't it?
Well, I've got it to work now. The main improvement is that you can change audio-stream while playing. (which I now use in my webapplication). However at the moment the only information you can get get is the ID of the currently selected audio-stream.

So I've added some suggestions in the feature request forum about getting an array with all the available trackID's and their language code.
( viewtopic.php?t=29337 )


Return to “Web and scripting”

Who is online

Users browsing this forum: No registered users and 5 guests