Skip to content

Commit a9edcc1

Browse files
committed
Merge pull request opencv#19110 from alalek:test_videoio_require_ffmpeg
2 parents a8adb99 + 48d9031 commit a9edcc1

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

modules/videoio/test/test_main.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,20 @@
22
// It is subject to the license terms in the LICENSE file found in the top-level directory
33
// of this distribution and at http://opencv.org/license.html.
44
#include "test_precomp.hpp"
5+
#include <opencv2/core/utils/logger.hpp>
56

6-
CV_TEST_MAIN("highgui")
7+
static
8+
void initTests()
9+
{
10+
#ifndef WINRT // missing getenv
11+
const std::vector<cv::VideoCaptureAPIs> backends = cv::videoio_registry::getStreamBackends();
12+
const char* requireFFmpeg = getenv("OPENCV_TEST_VIDEOIO_BACKEND_REQUIRE_FFMPEG");
13+
if (requireFFmpeg && !isBackendAvailable(cv::CAP_FFMPEG, backends))
14+
{
15+
CV_LOG_FATAL(NULL, "OpenCV-Test: required FFmpeg backend is not available (broken plugin?). STOP.");
16+
exit(1);
17+
}
18+
#endif
19+
}
20+
21+
CV_TEST_MAIN("highgui", initTests())

0 commit comments

Comments
 (0)