AVDictionary* options = nullptr;
av_dict_set(&options, "timeout", "3000000", 0); //设置超时断开连接时间
if (avformat_open_input(&pFormatCtx, url, NULL, &options) != 0) {
printf("Couldn't open input stream.(无法打开输入流)\n");
return -1;
}
https://www.jianshu.com/p/e75e3f1fb6b0?tdsourcetag=s_pcqq_aiomsg
本文介绍如何使用FFmpeg的AVDictionary结构体设置超时选项,并演示了通过avformat_open_input函数打开输入流的过程。如果打开失败,将打印错误信息并返回-1。

3946

被折叠的 条评论
为什么被折叠?



