Hi,

this is the piece of code responsable of open the stream :

    const char *filename = "rtsp://hostname/live.sdp";

    av_register_all();
    avformat_network_init();

    AVFormatContext *pFormatCtx = NULL;

    // Open video file
    if (avformat_open_input(&pFormatCtx, filename, NULL, NULL) != 0){
        std::cout << "could not open file " << filename << std::endl;
        return -1; // Couldn't open file
    }else{
        std::cout << "video opened" << std::endl;
    }

The problem is that when the host is down the function avformat_open_input does not return any value, it just stay there forever.

Best,
Yari

Il 16.06.2015 18:38, Talgorn François-Xavier ha scritto:
Hello,
If you copy/paste your code it will be much easier to help you.
The first question would be: do you manage the return code to see what's going 
on ? (avformat_open_input returns a  negative error code in case of failure).


Le 16 juin 2015 à 16:09, yari mattei <[email protected]> a écrit :

Hi guys,

I am using the FFMPEG API to implement a RTSP stream reader and I have a 
problem.

If I try to connect to a stream wchich is unavailable the program is freezing 
(it try to connect forever without any massage or possibility to handle this)

The function I am using is avformat_open_input(&pFormatCtx, filename, NULL, 
NULL).

Do you know if there is a way to handle this problem? Or any other API which 
allows to handle it?

Cheers,
Yari
_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user
_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user

_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to