<div dir="ltr"><div><div><div>Hello,<br><br></div>I'm currently writing a video
streaming app that uses the ffmpeg libraries. I'm dealing with a
situation where I'm preparing an instance of AVFormatContext by calling
avformat_open_input. I'm using this over a network under RTSP and I need
to handle cases where a connection cannot be established. I figured the
best way to go about this is to add a connection timeout of around 5-10
seconds, but I just can't seem to figure out how to get this idea to
work. Any help is greatly appreciated.<br>
<br></div><div>code:<br> if(avformat_open_input(&formatCtx, "rtsp://<a href="http://192.168.0.100/1" target="_blank">192.168.0.100/1</a>", NULL, NULL)!=0){<br> LOGI(".100 not working... trying .101");<br>
formatCtx = NULL;<br> if(avformat_open_input(&formatCtx, "rtsp://<a href="http://192.168.0.101/1" target="_blank">192.168.0.101/1</a>", NULL, NULL)!=0)<br> return -1; // Couldn't open file<br>
<br>
<br></div>Thanks!<br><br>--<br></div><br>Ryan</div>