Revert ffmpeg related changes from "thread-safe VideoWriter and VideoCapture"
This reverts commit 4abf0b3193
.
Changes are reverted because they break build of proxy dlls on Windows
This commit is contained in:
@@ -57,32 +57,11 @@ static CvCreateVideoWriter_Plugin icvCreateVideoWriter_FFMPEG_p = 0;
|
||||
static CvReleaseVideoWriter_Plugin icvReleaseVideoWriter_FFMPEG_p = 0;
|
||||
static CvWriteFrame_Plugin icvWriteFrame_FFMPEG_p = 0;
|
||||
|
||||
static cv::Mutex _icvInitFFMPEG_mutex;
|
||||
|
||||
class icvInitFFMPEG
|
||||
static void
|
||||
icvInitFFMPEG(void)
|
||||
{
|
||||
public:
|
||||
static void Init()
|
||||
{
|
||||
cv::AutoLock al(_icvInitFFMPEG_mutex);
|
||||
static icvInitFFMPEG init;
|
||||
}
|
||||
|
||||
private:
|
||||
#if defined WIN32 || defined _WIN32
|
||||
HMODULE icvFFOpenCV;
|
||||
|
||||
~icvInitFFMPEG()
|
||||
{
|
||||
if (icvFFOpenCV)
|
||||
{
|
||||
FreeLibrary(icvFFOpenCV);
|
||||
icvFFOpenCV = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
icvInitFFMPEG()
|
||||
static int ffmpegInitialized = 0;
|
||||
if( !ffmpegInitialized )
|
||||
{
|
||||
#if defined WIN32 || defined _WIN32
|
||||
const char* module_name = "opencv_ffmpeg"
|
||||
@@ -92,7 +71,7 @@ private:
|
||||
#endif
|
||||
".dll";
|
||||
|
||||
icvFFOpenCV = LoadLibrary( module_name );
|
||||
static HMODULE icvFFOpenCV = LoadLibrary( module_name );
|
||||
if( icvFFOpenCV )
|
||||
{
|
||||
icvCreateFileCapture_FFMPEG_p =
|
||||
@@ -138,8 +117,10 @@ private:
|
||||
icvReleaseVideoWriter_FFMPEG_p = (CvReleaseVideoWriter_Plugin)cvReleaseVideoWriter_FFMPEG;
|
||||
icvWriteFrame_FFMPEG_p = (CvWriteFrame_Plugin)cvWriteFrame_FFMPEG;
|
||||
#endif
|
||||
|
||||
ffmpegInitialized = 1;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
class CvCapture_FFMPEG_proxy : public CvCapture
|
||||
@@ -174,9 +155,9 @@ public:
|
||||
}
|
||||
virtual bool open( const char* filename )
|
||||
{
|
||||
icvInitFFMPEG::Init();
|
||||
close();
|
||||
|
||||
icvInitFFMPEG();
|
||||
if( !icvCreateFileCapture_FFMPEG_p )
|
||||
return false;
|
||||
ffmpegCapture = icvCreateFileCapture_FFMPEG_p( filename );
|
||||
@@ -209,6 +190,7 @@ CvCapture* cvCreateFileCapture_FFMPEG_proxy(const char * filename)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
class CvVideoWriter_FFMPEG_proxy : public CvVideoWriter
|
||||
{
|
||||
public:
|
||||
@@ -226,8 +208,8 @@ public:
|
||||
}
|
||||
virtual bool open( const char* filename, int fourcc, double fps, CvSize frameSize, bool isColor )
|
||||
{
|
||||
icvInitFFMPEG::Init();
|
||||
close();
|
||||
icvInitFFMPEG();
|
||||
if( !icvCreateVideoWriter_FFMPEG_p )
|
||||
return false;
|
||||
ffmpegWriter = icvCreateVideoWriter_FFMPEG_p( filename, fourcc, fps, frameSize.width, frameSize.height, isColor );
|
||||
|
Reference in New Issue
Block a user