2017-04-25 3 views
0

J'essaie d'utiliser libvlc pour lire un flux RTSP. Voici mon code:Comment puis-je lire le flux RTSP en utilisant libvlc

MainWindow::MainWindow(QWidget *parent) : 
    QMainWindow(parent), 
    ui(new Ui::MainWindow) 
{ 
    ui->setupUi(this); 

    const char* fileName = "rtsp://184.72.239.149/vod/mp4://BigBuckBunny_175k.mov"; 
    int windId = this->winId(); 

    libvlc_instance_t *instance = libvlc_new(0, NULL); 
    libvlc_media_t *vlcMedia = libvlc_media_new_location(instance, fileName); 
    libvlc_media_player_t* player = libvlc_media_player_new_from_media(vlcMedia); 

    libvlc_media_player_set_xwindow(player, windId); 
    libvlc_media_player_play(player); 
} 

Et le problème est que le libvlc envoie une commande SETUP au serveur comme ceci:

SETUP rtsp://184.72.239.149:554/vod/mp4://bigbuckbunny_175k.mov RTSP/1.0 

Il est completelty différent du lecteur vlc. Ce que le lecteur vlc envoie est:

SETUP rtsp://184.72.239.149:554/vod/mp4://bigbuckbunny_175k.mov/trackID=0 
SETUP rtsp://184.72.239.149:554/vod/mp4://bigbuckbunny_175k.mov/trackID=1 

Répondre

0

Il existe plusieurs plugins d'accès RTSP dans libvlc. Assurez-vous que vous utilisez live555 au lieu de realrtsp.