[Libav-user] Check an address to see if there is any video stream on it or not

Hadi hadi.hadizadeh at hotmail.com
Sun Jan 12 17:22:50 CET 2014


I want to read a video stream from a UDP address using libavcodec functions. To do so, I use the following code:

char *url = "udp://127.0.0.1:1000";
AVFormatContext *oc = NULL;
avformat_open_input(&oc, url, NULL , NULL);

If we run this code, then function "avformat_open_input" starts listening on the given UDP address, and it looks like the program is halted if there is no video stream at the given UDP address.

Now, I want to write a code to first check the given UDP address quickly to see whether there is any data on it or not, if there is no data then the program should neglect running "avformat_open_input", otherwise it should run this function so that I can avoid the halting situation.

Any idea how I can do this? Thanks! 		 	   		  


More information about the Libav-user mailing list