解决avformat_open_input()不返回

来源:互联网 发布:腾讯手机下载软件 编辑:程序博客网 时间:2024/06/06 20:01

调用VLC的函数avformat_open_input()进行拉流操作时,如果拉不到流,此函数会一直不返回。

此函数的第4个参数,可以传入参数。

参数通过av_dict_set()函数进行配置。

AVDictionary* opts = NULL;
av_dict_set(&opts, "timeout", "6000", 0); // 设置timeout,为微秒。
avformat_open_input(&m_pFormatCtx,pcURL,NULL,&opts)
这样,如果拉不到流,在timeout时间后,会返回。

原创粉丝点击