mirror of
https://github.com/opencv/opencv.git
synced 2025-06-12 20:42:53 +08:00
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
This commit is contained in:
parent
fd20529686
commit
fb8143d55d
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user