From 6dfbf326ce5ad3b4cd83760763c0ed7807803998 Mon Sep 17 00:00:00 2001
From: Antonio Ospite <ao2@ao2.it>
Date: Sat, 10 Oct 2020 21:57:45 +0200
Subject: [PATCH] opencv_trail_effect.cpp: hardcode V4L2 VideoCapture backend
 on linux

Hardcode the V4L2 backend on linux for now because the GStreamer one
lacks some functionality, see:
https://github.com/opencv/opencv/issues/18562
---
 opencv_trail_effect.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/opencv_trail_effect.cpp b/opencv_trail_effect.cpp
index bc5b187..c78f326 100644
--- a/opencv_trail_effect.cpp
+++ b/opencv_trail_effect.cpp
@@ -131,7 +131,14 @@ int main(int argc, char *argv[])
 	if (!input_file.empty()) {
 		inputVideo.open(input_file);
 	} else {
+#ifdef __linux__
+		// XXX Hardcode the V4L2 backend on linux for now because the
+		// GStreamer one lacks some functionality, see:
+		// https://github.com/opencv/opencv/issues/18562
+		inputVideo.open(0, cv::CAP_V4L2);
+#else
 		inputVideo.open(0);
+#endif
 	}
 
 	if (!inputVideo.isOpened()) {
-- 
2.1.4