提交 fb8143d5 编写于 作者: A Adam Rankin 提交者: Vadim Pisarevsky

Using environment variable to store capture options (#9292)

* Using environment variable to store options parsed by av_dict_parse_string(ENV{OPENCV_FFMPEG_CAPTURE_OPTIONS}, ";", "|")

* Adding missing mandatory flags parameter

* Guarding against missing function via LIBAVUTIL version

* Code review fixes

Copy/paste error due to coder mistake reverted
Proper version checking for LIBAVUTIL_BUILD
上级 fd205296
......@@ -781,7 +781,23 @@ bool CvCapture_FFMPEG::open( const char* _filename )
#endif
#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0)
#ifndef NO_GETENV
char* options = getenv("OPENCV_FFMPEG_CAPTURE_OPTIONS");
if(options == NULL)
{
av_dict_set(&dict, "rtsp_transport", "tcp", 0);
}
else
{
#if LIBAVUTIL_BUILD >= (LIBAVUTIL_VERSION_MICRO >= 100 ? CALC_FFMPEG_VERSION(52, 17, 100) : CALC_FFMPEG_VERSION(52, 7, 0))
av_dict_parse_string(&dict, options, ";", "|", 0);
#else
av_dict_set(&dict, "rtsp_transport", "tcp", 0);
#endif
}
#else
av_dict_set(&dict, "rtsp_transport", "tcp", 0);
#endif
int err = avformat_open_input(&ic, _filename, NULL, &dict);
#else
int err = av_open_input_file(&ic, _filename, NULL, 0, NULL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册