如何使用libvlc读取rtps流(错误)

时间:2018-06-04 19:19:31

标签: c++ rtsp libvlc

我从sourceForge下载了this project示例。 我目前正在尝试修改“simplest_libvlc_player”项目,以便它可以显示我的rtsp流...... 这是项目的.cpp代码:

#include <Windows.h>
#include "vlc/vlc.h"
int main(int argc, char* argv[])
 {
    libvlc_instance_t * inst;
    libvlc_media_player_t *mp;
    libvlc_media_t *m;

 // Load the VLC engine 
    inst = libvlc_new (0, NULL);

    m = libvlc_media_new_location(inst, "‪rtsp://user:password@XXX.XXX.XXX.XXX/stream0/"); //This is the line I changed

 // Create a media player playing environement 
    mp = libvlc_media_player_new_from_media (m);

 // No need to keep the media now
    libvlc_media_release (m);

 // play the media_player
    libvlc_media_player_play (mp);

 // Let it play 
    _sleep (5000);

 // Stop playing
    libvlc_media_player_stop (mp);

 // Free the media_player
    libvlc_media_player_release (mp);

    libvlc_release (inst);

    return 0;
}

我收到了错误:

main input error: open of '?rtsp://user:password@XXX.XXX.XXX.XXX/stream0' failed

我想知道我做错了什么...... 当我在VlcMediaPlayer的开放网络流中打开它时,我的rtsp链接工作... 我没有通过wireshark看到任何东西......这就像程序甚至没有尝试将我的凭据发送到我的远程流...... 我也不知道它为什么会放一个'?'在我的错误链接之前。

0 个答案:

没有答案