我想从RTP流中读取内容,但是当我指定“ test.sdp”时,avformat_open_input()我得到以下消息:
[rtp @ 03928900] Protocol not on whitelist 'file'!
Failed: cannot open input.
avformat_open_input() fail: Invalid data found when processing input
Run Code Online (Sandbox Code Playgroud)
通常,如果我在控制台上使用ffplay,我会添加该选项-protocol_whitelist file,udp,rtp,它将正常工作。
所以我尝试了这个:
AVDictionary *d = NULL;
av_dict_set(&d, "protocol_whitelist", "file, udp, rtp", 0);
ret = avformat_open_input(&inFormatCtx, filename, NULL, &d);
Run Code Online (Sandbox Code Playgroud)
但是,仍然弹出相同的消息。有任何想法吗?
真尴尬
avformat_open_input失败,因为我有空白。现在,删除空白即可。
av_dict_set(&d, "protocol_whitelist", "file,udp,rtp", 0);
Run Code Online (Sandbox Code Playgroud)