From 7f0079dec5da19072cfe64aee233ecacd8ef2ffd Mon Sep 17 00:00:00 2001
From: AlexeyAB <alexeyab84@gmail.com>
Date: Tue, 19 Jun 2018 12:00:36 +0000
Subject: [PATCH] Output video-file has the same FPS as source video-stream. Exit from demo by ESC.

---
 src/http_stream.cpp |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/http_stream.cpp b/src/http_stream.cpp
index 1b65173..b122f5b 100644
--- a/src/http_stream.cpp
+++ b/src/http_stream.cpp
@@ -248,6 +248,22 @@
 	}
 	return src;
 }
+
+int get_stream_fps_cpp(CvCapture *cap) {
+	int fps = 25;
+	try {
+		cv::VideoCapture &cpp_cap = *(cv::VideoCapture *)cap;
+#ifndef CV_VERSION_EPOCH	// OpenCV 3.x
+		fps = cpp_cap.get(CAP_PROP_FPS);
+#else						// OpenCV 2.x
+		fps = cpp_cap.get(CV_CAP_PROP_FPS);
+#endif		
+	}
+	catch (...) {
+		std::cout << " Can't get FPS of source videofile. For output video FPS = 25 by default. \n";
+	}
+	return fps;
+}
 // ----------------------------------------
 extern "C" {
 	image ipl_to_image(IplImage* src);	// image.c

--
Gitblit v1.10.0