[Libav-user] avformat_open_input: adding a timeout

Ryan Grewatz grewa008 at d.umn.edu
Sat Jul 26 00:09:56 CEST 2014


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.

    if(avformat_open_input(&formatCtx, "rtsp://", NULL,
        LOGI(".100 not working... trying .101");
        formatCtx = NULL;
        if(avformat_open_input(&formatCtx, "rtsp://", NULL,
            return -1; // Couldn't open file



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20140725/fe103531/attachment.html>

More information about the Libav-user mailing list