|
|
|
@ -303,6 +303,54 @@ const videoio_container_params_t videoio_container_params[] = |
|
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(/**/, videoio_container, testing::ValuesIn(videoio_container_params)); |
|
|
|
|
|
|
|
|
|
typedef tuple<string, string, int> videoio_skip_params_t; |
|
|
|
|
typedef testing::TestWithParam< videoio_skip_params_t > videoio_skip; |
|
|
|
|
|
|
|
|
|
TEST_P(videoio_skip, DISABLED_read) // optional test, may fail in some configurations
|
|
|
|
|
{ |
|
|
|
|
#if CV_VERSION_MAJOR >= 4 |
|
|
|
|
if (!videoio_registry::hasBackend(CAP_FFMPEG)) |
|
|
|
|
throw SkipTestException("Backend was not found"); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
const string path = get<0>(GetParam()); |
|
|
|
|
const string env = get<1>(GetParam()); |
|
|
|
|
const int expectedFrameNumber = get<2>(GetParam()); |
|
|
|
|
|
|
|
|
|
#ifdef _WIN32 |
|
|
|
|
_putenv_s("OPENCV_FFMPEG_CAPTURE_OPTIONS", env.c_str()); |
|
|
|
|
#else |
|
|
|
|
setenv("OPENCV_FFMPEG_CAPTURE_OPTIONS", env.c_str(), 1); |
|
|
|
|
#endif |
|
|
|
|
VideoCapture container(findDataFile(path), CAP_FFMPEG); |
|
|
|
|
#ifdef _WIN32 |
|
|
|
|
_putenv_s("OPENCV_FFMPEG_CAPTURE_OPTIONS", ""); |
|
|
|
|
#else |
|
|
|
|
setenv("OPENCV_FFMPEG_CAPTURE_OPTIONS", "", 1); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
ASSERT_TRUE(container.isOpened()); |
|
|
|
|
|
|
|
|
|
Mat reference; |
|
|
|
|
int nframes = 0, n_err = 0; |
|
|
|
|
while (container.isOpened()) |
|
|
|
|
{ |
|
|
|
|
if (container.read(reference)) |
|
|
|
|
nframes++; |
|
|
|
|
else if (++n_err > 3) |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
EXPECT_EQ(expectedFrameNumber, nframes); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const videoio_skip_params_t videoio_skip_params[] = |
|
|
|
|
{ |
|
|
|
|
videoio_skip_params_t("video/big_buck_bunny.mp4", "", 125), |
|
|
|
|
videoio_skip_params_t("video/big_buck_bunny.mp4", "avdiscard;nonkey", 11) |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(/**/, videoio_skip, testing::ValuesIn(videoio_skip_params)); |
|
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
|
|
//////////////////////////////// Parallel VideoWriters and VideoCaptures ////////////////////////////////////
|
|
|
|
|