From 6f48dc24820e1e5cb0dea104d5a866f259674836 Mon Sep 17 00:00:00 2001 From: Maksim Shabunin Date: Thu, 23 Nov 2017 15:03:20 +0300 Subject: [PATCH] Fixed GStreamer pipeline building on Ubuntu 17 --- modules/videoio/src/cap_gstreamer.cpp | 5 +---- modules/videoio/test/test_video_io.cpp | 37 ++++++++++++---------------------- 2 files changed, 14 insertions(+), 28 deletions(-) diff --git a/modules/videoio/src/cap_gstreamer.cpp b/modules/videoio/src/cap_gstreamer.cpp index 92cfac8..6c48d85 100644 --- a/modules/videoio/src/cap_gstreamer.cpp +++ b/modules/videoio/src/cap_gstreamer.cpp @@ -78,11 +78,8 @@ #if GST_VERSION_MAJOR == 0 #define COLOR_ELEM "ffmpegcolorspace" #define COLOR_ELEM_NAME "ffmpegcsp" -#elif FULL_GST_VERSION < VERSION_NUM(1,5,0) -#define COLOR_ELEM "videoconvert" -#define COLOR_ELEM_NAME COLOR_ELEM #else -#define COLOR_ELEM "autovideoconvert" +#define COLOR_ELEM "videoconvert" #define COLOR_ELEM_NAME COLOR_ELEM #endif diff --git a/modules/videoio/test/test_video_io.cpp b/modules/videoio/test/test_video_io.cpp index ad00b5e..ff9f694 100644 --- a/modules/videoio/test/test_video_io.cpp +++ b/modules/videoio/test/test_video_io.cpp @@ -87,20 +87,18 @@ public: // TODO: fix this backend std::cout << "SKIP test: AVFoundation backend returns invalid frame count" << std::endl; return; - } else if (apiPref == CAP_VFW) { + } + else if (apiPref == CAP_VFW) + { // TODO: fix this backend std::cout << "SKIP test: Video for Windows backend not open files" << std::endl; return; - } else if (apiPref == CAP_GSTREAMER) { - // TODO: fix this backend - std::cout << "SKIP test: Gstreamer failed with read critical error" << std::endl; - return; } VideoCapture cap(video_file, apiPref); if (!cap.isOpened()) { - std::cout << "SKIP test: Can't open video: " << video_file << std::endl; + std::cout << "SKIP test: backend " << apiPref << " can't open the video: " << video_file << std::endl; return; } int n_frames = (int)cap.get(CAP_PROP_FRAME_COUNT); @@ -171,20 +169,18 @@ public: // TODO: fix this backend std::cout << "SKIP test: AVFoundation backend returns invalid frame count" << std::endl; return; - } else if (apiPref == CAP_VFW) { + } + else if (apiPref == CAP_VFW) + { // TODO: fix this backend std::cout << "SKIP test: Video for Windows backend not open files" << std::endl; return; - } else if (apiPref == CAP_GSTREAMER) { - // TODO: fix this backend - std::cout << "SKIP test: Gstreamer failed with read critical error" << std::endl; - return; } VideoCapture cap(video_file, apiPref); if (!cap.isOpened()) { - std::cout << "SKIP test: Can't open video: " << video_file << std::endl; + std::cout << "SKIP test: backend " << apiPref << " can't open the video: " << video_file << std::endl; return; } @@ -266,14 +262,12 @@ public: // TODO: fix this backend std::cout << "SKIP test: AVFoundation backend can not write video" << std::endl; return; - } else if (apiPref == CAP_VFW) { + } + else if (apiPref == CAP_VFW) + { // TODO: fix this backend std::cout << "SKIP test: Video for Windows backend not open files" << std::endl; return; - } else if (apiPref == CAP_GSTREAMER) { - // TODO: fix this backend - std::cout << "SKIP test: Gstreamer failed with write critical error" << std::endl; - return; } Mat img(frame_size, CV_8UC3); VideoWriter writer(video_file, apiPref, fourcc, fps, frame_size, true); @@ -309,11 +303,6 @@ public: if (fourcc == VideoWriter::fourcc('M', 'P', 'E', 'G') && ext == "mkv") expected_frame_count.end += 1; - // Hack! Some GStreamer encoding pipelines drop last frame in the video - // #ifdef HAVE_GSTREAMER - // expected_frame_count.start -= 1; - // #endif - ASSERT_LE(expected_frame_count.start, actual); ASSERT_GE(expected_frame_count.end, actual); @@ -439,13 +428,13 @@ Ext_Fourcc_PSNR synthetic_params[] = { #endif #ifdef HAVE_GSTREAMER - makeParam("avi", "XVID", 30.f, CAP_GSTREAMER), + // makeParam("avi", "XVID", 30.f, CAP_GSTREAMER), - corrupted frames, broken indexes makeParam("avi", "MPEG", 30.f, CAP_GSTREAMER), makeParam("avi", "IYUV", 30.f, CAP_GSTREAMER), makeParam("avi", "MJPG", 30.f, CAP_GSTREAMER), makeParam("avi", "H264", 30.f, CAP_GSTREAMER), - makeParam("mkv", "XVID", 30.f, CAP_GSTREAMER), + // makeParam("mkv", "XVID", 30.f, CAP_GSTREAMER), makeParam("mkv", "MPEG", 30.f, CAP_GSTREAMER), makeParam("mkv", "MJPG", 30.f, CAP_GSTREAMER), -- 2.7.4