[vlc-devel] Get and set audio, video, pcr, etc PIDs from a stream using libVLC

Flavio Alberto Lopes Soares flavio.thunder at gmail.com
Thu Nov 26 14:34:17 CET 2009


Hello all,

    I'm a newbie in VLC and libVLC and I need to get and set the audio/video
PID in a stream played by libVLC in my application, I read the code from Qt4
gui to know how it works and I saw that it does a var_Set() on "video-es"
and "audio-es" variables, but the Qt4 gui acts as a plugin, but I need to do
the same thing in an "normal" (not a plugin) application using libVLC
(bellow a snippet of my code) . I noticed that var_Set() needs vlc_object_t
* as parameter and I try to get the vlc_object_t * using
libvlc_get_vlc_instance() call, I'm using a stream in my test code that I
know has audio pids 514 and 517 and swapping in each 4 seconds but the test
code doesn't works, it never change the PID.
    I believe the problem is because libvlc_get_vlc_instance() is not
returning the correct vlc_object_t * but I don't know how to get the correct
object.

    There's some way to get the correct object containing the "audio-es"
("video-es" too) variables to use var_Set in a regular application ?
    There's some way to do this in regular libVLC API ?

Thanks for all help

Flavio Alberto Lopes Soares

Player::Player()
{
.
.
.
_vlcinstance=libvlc_new(sizeof(vlc_args) / sizeof(vlc_args[0]),
vlc_args,&_vlcexcep);
.
.
.
_vlcobj = libvlc_get_vlc_instance(_vlcinstance);
.
.
.
}

void Player::changeaudio()
{
   /*let's change the audio pid of a stream... */
   /*I know this stream has audio pids 514 (portuguese), 517 (Spanish)*/

    if (val.i_int == 517)
        val.i_int = 514;
    else
      val.i_int = 517;

    var_Set( _vlcobj, "audio-es", val );
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20091126/17532080/attachment.html>


More information about the vlc-devel mailing list