From 2dbaba077ab5025afd369ecf51834bf46a6a6e23 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Fri, 29 Jun 2018 23:34:14 +0300 Subject: [PATCH] videoio(msmf): avoid using of C++11 code build fails with MSVS 2012 without additional flags --- modules/videoio/src/cap_msmf.cpp | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/modules/videoio/src/cap_msmf.cpp b/modules/videoio/src/cap_msmf.cpp index 8e1a60a..2a49777 100644 --- a/modules/videoio/src/cap_msmf.cpp +++ b/modules/videoio/src/cap_msmf.cpp @@ -677,8 +677,6 @@ public: MODE_HW = 1 } MSMFCapture_Mode; CvCapture_MSMF(); - CvCapture_MSMF(int); - CvCapture_MSMF(const cv::String&); virtual ~CvCapture_MSMF(); virtual bool open(int); virtual bool open(const cv::String&); @@ -741,8 +739,6 @@ CvCapture_MSMF::CvCapture_MSMF(): { configureHW(true); } -CvCapture_MSMF::CvCapture_MSMF(int index) : CvCapture_MSMF() { open(index); } -CvCapture_MSMF::CvCapture_MSMF(const cv::String& _filename) : CvCapture_MSMF() { open(_filename); } CvCapture_MSMF::~CvCapture_MSMF() { @@ -1901,17 +1897,25 @@ bool CvCapture_MSMF::setProperty( int property_id, double value ) cv::Ptr cv::cvCreateCapture_MSMF( int index ) { - cv::Ptr capture = cv::makePtr(index); - if (capture && capture->isOpened()) - return capture; + cv::Ptr capture = cv::makePtr(); + if (capture) + { + capture->open(index); + if (capture->isOpened()) + return capture; + } return cv::Ptr(); } cv::Ptr cv::cvCreateCapture_MSMF (const cv::String& filename) { - cv::Ptr capture = cv::makePtr(filename); - if (capture && capture->isOpened()) - return capture; + cv::Ptr capture = cv::makePtr(); + if (capture) + { + capture->open(filename); + if (capture->isOpened()) + return capture; + } return cv::Ptr(); } @@ -1925,8 +1929,6 @@ class CvVideoWriter_MSMF : public cv::IVideoWriter { public: CvVideoWriter_MSMF(); - CvVideoWriter_MSMF(const cv::String& filename, int fourcc, - double fps, cv::Size frameSize, bool isColor); virtual ~CvVideoWriter_MSMF(); virtual bool open(const cv::String& filename, int fourcc, double fps, cv::Size frameSize, bool isColor); @@ -1963,7 +1965,6 @@ CvVideoWriter_MSMF::CvVideoWriter_MSMF(): initiated(false) { } -CvVideoWriter_MSMF::CvVideoWriter_MSMF(const cv::String& filename, int fourcc, double fps, cv::Size frameSize, bool isColor) : CvVideoWriter_MSMF() { open(filename, fourcc, fps, frameSize, isColor); } CvVideoWriter_MSMF::~CvVideoWriter_MSMF() { @@ -2134,9 +2135,13 @@ void CvVideoWriter_MSMF::write(cv::InputArray img) cv::Ptr cv::cvCreateVideoWriter_MSMF( const cv::String& filename, int fourcc, double fps, cv::Size frameSize, int isColor ) { - cv::Ptr writer = cv::makePtr(filename, fourcc, fps, frameSize, isColor != 0); - if (writer && writer->isOpened()) - return writer; + cv::Ptr writer = cv::makePtr(); + if (writer) + { + writer->open(filename, fourcc, fps, frameSize, isColor != 0); + if (writer->isOpened()) + return writer; + } return cv::Ptr(); } -- 2.7.4