[vlc-devel] How to change VIDEO PID, AUDIO PID, PCR PID and Program ID using libVLC

Flavio Alberto Lopes Soares flavio.thunder at gmail.com
Fri Jul 23 17:46:00 CEST 2010


Hello all,

I'm writing an application to watch Digital TV DVB system using libVLC in a
C++ application, and in my application I need to set the video PID, audio
PID and PCR pid when changing the channel, I'm using the following code to
set this :

bool VLCPlayer::setVideoPid(int pid)
{
    char vlc_option[64];
    sprintf(vlc_option, "video-es=%d", pid);
    libvlc_media_add_option(_m, vlc_option);
    return true;
}

bool VLCPlayer::setAudioPid(int pid)
{
    char vlc_option[64];
    sprintf(vlc_option, "audio-es=%d", pid);
    libvlc_media_add_option(_m, vlc_option);
    return true;
}

bool VLCPlayer::setPcrPid(int pid)
{
    char vlc_option[64];
    sprintf(vlc_option, "pcr=%d", pid);
    libvlc_media_add_option(_m, vlc_option);
    return true;
}

after doing play using this code :

bool VLCPlayer::play(Source *src)
{
    if (is_paused) {
        libvlc_media_player_play(_mp);
        is_paused = false;
        return true;
    }

    libvlc_media_add_option(_m, "dvb-initialize-frontend=0");
    libvlc_media_player_set_media(_mp, _m);
    libvlc_media_player_play(_mp);

    this->src = src;
    return true;
}

But I noticed that despite passing the correct PIDs the channel is set to a
random Service ID (Program ID) showing the wrong program, analyzing the VLC
code I saw that the Program ID is controlled by  a variable called "program"
and it is manipulated in vlc/src/input/es_out.c when changing the channel
and I concluded that I need to set this variable "program" to my channel
Service ID (Program ID) when changing the channel.

My questions are :

The way to set the video PID, audio PID and PCR PID in code above is the
correct way to do this using libVLC ?
If not how to do this ?
To set Program ID in variable "program" I must to do in the same way ?

Thanks for all help

Flavio Alberto Lopes Soares
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20100723/1b42e6b9/attachment.html>


More information about the vlc-devel mailing list