Skip to content

Commit 6f48dc2

Browse files
committed
Fixed GStreamer pipeline building on Ubuntu 17
1 parent 8082011 commit 6f48dc2

File tree

2 files changed

+14
-28
lines changed

2 files changed

+14
-28
lines changed

modules/videoio/src/cap_gstreamer.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,8 @@
7878
#if GST_VERSION_MAJOR == 0
7979
#define COLOR_ELEM "ffmpegcolorspace"
8080
#define COLOR_ELEM_NAME "ffmpegcsp"
81-
#elif FULL_GST_VERSION < VERSION_NUM(1,5,0)
82-
#define COLOR_ELEM "videoconvert"
83-
#define COLOR_ELEM_NAME COLOR_ELEM
8481
#else
85-
#define COLOR_ELEM "autovideoconvert"
82+
#define COLOR_ELEM "videoconvert"
8683
#define COLOR_ELEM_NAME COLOR_ELEM
8784
#endif
8885

modules/videoio/test/test_video_io.cpp

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,18 @@ class Videoio_Test_Base
8787
// TODO: fix this backend
8888
std::cout << "SKIP test: AVFoundation backend returns invalid frame count" << std::endl;
8989
return;
90-
} else if (apiPref == CAP_VFW) {
90+
}
91+
else if (apiPref == CAP_VFW)
92+
{
9193
// TODO: fix this backend
9294
std::cout << "SKIP test: Video for Windows backend not open files" << std::endl;
9395
return;
94-
} else if (apiPref == CAP_GSTREAMER) {
95-
// TODO: fix this backend
96-
std::cout << "SKIP test: Gstreamer failed with read critical error" << std::endl;
97-
return;
9896
}
9997

10098
VideoCapture cap(video_file, apiPref);
10199
if (!cap.isOpened())
102100
{
103-
std::cout << "SKIP test: Can't open video: " << video_file << std::endl;
101+
std::cout << "SKIP test: backend " << apiPref << " can't open the video: " << video_file << std::endl;
104102
return;
105103
}
106104
int n_frames = (int)cap.get(CAP_PROP_FRAME_COUNT);
@@ -171,20 +169,18 @@ class Videoio_Bunny : public Videoio_Test_Base, public testing::TestWithParam<Ba
171169
// TODO: fix this backend
172170
std::cout << "SKIP test: AVFoundation backend returns invalid frame count" << std::endl;
173171
return;
174-
} else if (apiPref == CAP_VFW) {
172+
}
173+
else if (apiPref == CAP_VFW)
174+
{
175175
// TODO: fix this backend
176176
std::cout << "SKIP test: Video for Windows backend not open files" << std::endl;
177177
return;
178-
} else if (apiPref == CAP_GSTREAMER) {
179-
// TODO: fix this backend
180-
std::cout << "SKIP test: Gstreamer failed with read critical error" << std::endl;
181-
return;
182178
}
183179

184180
VideoCapture cap(video_file, apiPref);
185181
if (!cap.isOpened())
186182
{
187-
std::cout << "SKIP test: Can't open video: " << video_file << std::endl;
183+
std::cout << "SKIP test: backend " << apiPref << " can't open the video: " << video_file << std::endl;
188184
return;
189185
}
190186

@@ -266,14 +262,12 @@ class Videoio_Synthetic : public Videoio_Test_Base, public testing::TestWithPara
266262
// TODO: fix this backend
267263
std::cout << "SKIP test: AVFoundation backend can not write video" << std::endl;
268264
return;
269-
} else if (apiPref == CAP_VFW) {
265+
}
266+
else if (apiPref == CAP_VFW)
267+
{
270268
// TODO: fix this backend
271269
std::cout << "SKIP test: Video for Windows backend not open files" << std::endl;
272270
return;
273-
} else if (apiPref == CAP_GSTREAMER) {
274-
// TODO: fix this backend
275-
std::cout << "SKIP test: Gstreamer failed with write critical error" << std::endl;
276-
return;
277271
}
278272
Mat img(frame_size, CV_8UC3);
279273
VideoWriter writer(video_file, apiPref, fourcc, fps, frame_size, true);
@@ -309,11 +303,6 @@ class Videoio_Synthetic : public Videoio_Test_Base, public testing::TestWithPara
309303
if (fourcc == VideoWriter::fourcc('M', 'P', 'E', 'G') && ext == "mkv")
310304
expected_frame_count.end += 1;
311305

312-
// Hack! Some GStreamer encoding pipelines drop last frame in the video
313-
// #ifdef HAVE_GSTREAMER
314-
// expected_frame_count.start -= 1;
315-
// #endif
316-
317306
ASSERT_LE(expected_frame_count.start, actual);
318307
ASSERT_GE(expected_frame_count.end, actual);
319308

@@ -439,13 +428,13 @@ Ext_Fourcc_PSNR synthetic_params[] = {
439428
#endif
440429

441430
#ifdef HAVE_GSTREAMER
442-
makeParam("avi", "XVID", 30.f, CAP_GSTREAMER),
431+
// makeParam("avi", "XVID", 30.f, CAP_GSTREAMER), - corrupted frames, broken indexes
443432
makeParam("avi", "MPEG", 30.f, CAP_GSTREAMER),
444433
makeParam("avi", "IYUV", 30.f, CAP_GSTREAMER),
445434
makeParam("avi", "MJPG", 30.f, CAP_GSTREAMER),
446435
makeParam("avi", "H264", 30.f, CAP_GSTREAMER),
447436

448-
makeParam("mkv", "XVID", 30.f, CAP_GSTREAMER),
437+
// makeParam("mkv", "XVID", 30.f, CAP_GSTREAMER),
449438
makeParam("mkv", "MPEG", 30.f, CAP_GSTREAMER),
450439
makeParam("mkv", "MJPG", 30.f, CAP_GSTREAMER),
451440

0 commit comments

Comments
 (0)