Basel Emad
Basel Emad

Reputation: 11

RTSP client using VLC library

I should write RTSP client in c programming using VLC library , I have some questions about this :

  1. I didn't find any already function in VLC library to send RTSP SETUP request , should I write it from scratch ?
  2. When I send the RTSP SETUP request , I must open 2 sockets for RTP and RTCP to send its ports number to live555 media server to receive the data through these port , Do you need to open another socket for UDP to receive the response of RTSP SETUP/PLAY/PAUSE/STOP request to control the transmission data process ?
  3. When I want to pause the transmission data process at application layer , I should send RTSP PAUSE request to server and send PAUSE request to player to stop the transmission data process temporarily, but I don't know what functions in VLC library are used for this purpose , can you tell me about what these functions are?

Thank you.

Upvotes: 1

Views: 3403

Answers (1)

bossbarber
bossbarber

Reputation: 890

As stated by feepk in the comments, you do not need to manually do any of the RTSP setup, as VLC does this for you using live555 library. You can open an RTSP connection using the libvlc_media_new_location function, then pass to your media player instance.

For example:

// 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);

Upvotes: 1

Related Questions