\r
const size_t n = sizeof(codec_bmp_tags)/sizeof(codec_bmp_tags[0]);\r
\r
+ bool created = false;\r
+\r
for (size_t j = 0; j < n; ++j)\r
{\r
stringstream s; s << codec_bmp_tags[j].tag;\r
\r
+ const string filename = ts->get_data_path() + "../../../../output_"+s.str()+".avi";\r
+\r
Mat img(img_r, img_c, CV_8UC3, Scalar::all(0));\r
try\r
{\r
- VideoWriter writer(string(ts->get_data_path()) + "video/output_"+s.str()+".avi", codec_bmp_tags[j].tag, fps, frame_s);\r
+ VideoWriter writer(filename, codec_bmp_tags[j].tag, fps, frame_s);\r
+\r
+ if (writer.isOpened() == false)\r
+ {\r
+ ts->printf(ts->LOG, "\n\nFile name: %s\n", filename.c_str());\r
+ ts->printf(ts->LOG, "Codec id: %d Codec tag: %d\n", j, codec_bmp_tags[j].tag);\r
+ ts->printf(ts->LOG, "Error: cannot create video file.");\r
+ ts->set_failed_test_info(ts->FAIL_INVALID_OUTPUT);\r
+ }\r
\r
- if (writer.isOpened() == false) ts->set_failed_test_info(cvtest::TS::FAIL_EXCEPTION);\r
+ else\r
\r
- for (int i = 0 ; i < static_cast<int>(fps * time_sec); i++ )\r
{\r
- //circle(img, Point2i(img_c / 2, img_r / 2), cv::min(img_r, img_c) / 2 * (i + 1), Scalar(255, 0, 0, 0), 2);\r
- rectangle(img, Point2i(coeff * i, coeff * i), Point2i(coeff * (i + 1), coeff * (i + 1)),\r
- Scalar::all(255 * (1.0 - static_cast<double>(i) / (fps * time_sec * 2) )), -1);\r
- writer << img;\r
+ for (int i = 0 ; i < static_cast<int>(fps * time_sec); i++ )\r
+ {\r
+ //circle(img, Point2i(img_c / 2, img_r / 2), cv::min(img_r, img_c) / 2 * (i + 1), Scalar(255, 0, 0, 0), 2);\r
+ rectangle(img, Point2i(coeff * i, coeff * i), Point2i(coeff * (i + 1), coeff * (i + 1)),\r
+ Scalar::all(255 * (1.0 - static_cast<double>(i) / (fps * time_sec * 2) )), -1);\r
+ writer << img;\r
+ }\r
+\r
+ if (!created) created = true;\r
+ else remove(filename.c_str());\r
}\r
}\r
catch(...)\r
{\r
- ts->set_failed_test_info(cvtest::TS::FAIL_EXCEPTION);\r
+ ts->set_failed_test_info(ts->FAIL_INVALID_OUTPUT);\r
}\r
ts->set_failed_test_info(cvtest::TS::OK);\r
\r