正如feepk 在评论中所说,您不需要手动进行任何RTSP 设置,因为VLC 使用live555 库为您完成了这项工作。您可以使用 libvlc_media_new_location 函数打开 RTSP 连接,然后传递给您的媒体播放器实例。
例如:
// You must create an instance of the VLC Library
libvlc_instance_t * vlc;
// You need a player to play media
libvlc_media_player_t *mediaPlayer;
// Media object to play.
libvlc_media_t *media;
// Configure options for this instance of VLC (global settings).
// See VLC command line documentation for options.
std::vector<const char*> options;
std::vector<const char*>::iterator option;
// Load the VLC engine
vlc = libvlc_new (int(options.size()), options.data());
// Create a media item from URL
media = libvlc_media_new_location (vlc, "RTSP_URL_HERE");
mediaPlayer = libvlc_media_player_new_from_media (media);