|
|
|
@ -527,4 +527,62 @@ static vector<Ext_Fourcc_API> generate_Ext_Fourcc_API() |
|
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(videoio, Videoio_Writer, testing::ValuesIn(generate_Ext_Fourcc_API())); |
|
|
|
|
|
|
|
|
|
typedef Videoio_Writer Videoio_Writer_bad_fourcc; |
|
|
|
|
|
|
|
|
|
TEST_P(Videoio_Writer_bad_fourcc, nocrash) |
|
|
|
|
{ |
|
|
|
|
if (!isBackendAvailable(apiPref, cv::videoio_registry::getStreamBackends())) |
|
|
|
|
throw SkipTestException(cv::String("Backend is not available/disabled: ") + cv::videoio_registry::getBackendName(apiPref)); |
|
|
|
|
|
|
|
|
|
VideoWriter writer; |
|
|
|
|
EXPECT_NO_THROW(writer.open(video_file, apiPref, fourcc, fps, frame_size, true)); |
|
|
|
|
ASSERT_FALSE(writer.isOpened()); |
|
|
|
|
EXPECT_NO_THROW(writer.release()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static vector<Ext_Fourcc_API> generate_Ext_Fourcc_API_nocrash() |
|
|
|
|
{ |
|
|
|
|
static const Ext_Fourcc_API params[] = { |
|
|
|
|
#ifdef HAVE_MSMF_DISABLED // MSMF opens writer stream
|
|
|
|
|
{"wmv", "aaaa", CAP_MSMF}, |
|
|
|
|
{"mov", "aaaa", CAP_MSMF}, |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#ifdef HAVE_QUICKTIME |
|
|
|
|
{"mov", "aaaa", CAP_QT}, |
|
|
|
|
{"avi", "aaaa", CAP_QT}, |
|
|
|
|
{"mkv", "aaaa", CAP_QT}, |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#ifdef HAVE_AVFOUNDATION |
|
|
|
|
{"mov", "aaaa", CAP_AVFOUNDATION}, |
|
|
|
|
{"mp4", "aaaa", CAP_AVFOUNDATION}, |
|
|
|
|
{"m4v", "aaaa", CAP_AVFOUNDATION}, |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#ifdef HAVE_FFMPEG |
|
|
|
|
{"avi", "aaaa", CAP_FFMPEG}, |
|
|
|
|
{"mkv", "aaaa", CAP_FFMPEG}, |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#ifdef HAVE_GSTREAMER |
|
|
|
|
{"avi", "aaaa", CAP_GSTREAMER}, |
|
|
|
|
{"mkv", "aaaa", CAP_GSTREAMER}, |
|
|
|
|
#endif |
|
|
|
|
{"avi", "aaaa", CAP_OPENCV_MJPEG}, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const size_t N = sizeof(params)/sizeof(params[0]); |
|
|
|
|
vector<Ext_Fourcc_API> result; result.reserve(N); |
|
|
|
|
for (size_t i = 0; i < N; i++) |
|
|
|
|
{ |
|
|
|
|
const Ext_Fourcc_API& src = params[i]; |
|
|
|
|
Ext_Fourcc_API e = { src.ext, src.fourcc, src.api }; |
|
|
|
|
result.push_back(e); |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(videoio, Videoio_Writer_bad_fourcc, testing::ValuesIn(generate_Ext_Fourcc_API_nocrash())); |
|
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|