removed libstdc++ dependency
This commit is contained in:
@@ -57,21 +57,42 @@ static CvCreateVideoWriter_Plugin icvCreateVideoWriter_FFMPEG_p = 0;
|
||||
static CvReleaseVideoWriter_Plugin icvReleaseVideoWriter_FFMPEG_p = 0;
|
||||
static CvWriteFrame_Plugin icvWriteFrame_FFMPEG_p = 0;
|
||||
|
||||
static void
|
||||
icvInitFFMPEG(void)
|
||||
static cv::Mutex _icvInitFFMPEG_mutex;
|
||||
|
||||
class icvInitFFMPEG
|
||||
{
|
||||
static int ffmpegInitialized = 0;
|
||||
if( !ffmpegInitialized )
|
||||
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()
|
||||
{
|
||||
#if defined WIN32 || defined _WIN32
|
||||
const char* module_name = "opencv_ffmpeg"
|
||||
CVAUX_STR(CV_VERSION_EPOCH) CVAUX_STR(CV_VERSION_MAJOR) CVAUX_STR(CV_VERSION_MINOR)
|
||||
CVAUX_STR(CV_MAJOR_VERSION) CVAUX_STR(CV_MINOR_VERSION) CVAUX_STR(CV_SUBMINOR_VERSION)
|
||||
#if (defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__)
|
||||
"_64"
|
||||
#endif
|
||||
".dll";
|
||||
|
||||
static HMODULE icvFFOpenCV = LoadLibrary( module_name );
|
||||
icvFFOpenCV = LoadLibrary( module_name );
|
||||
if( icvFFOpenCV )
|
||||
{
|
||||
icvCreateFileCapture_FFMPEG_p =
|
||||
@@ -93,18 +114,24 @@ icvInitFFMPEG(void)
|
||||
icvWriteFrame_FFMPEG_p =
|
||||
(CvWriteFrame_Plugin)GetProcAddress(icvFFOpenCV, "cvWriteFrame_FFMPEG");
|
||||
|
||||
if( icvCreateFileCapture_FFMPEG_p == NULL ||
|
||||
icvReleaseCapture_FFMPEG_p == NULL ||
|
||||
icvGrabFrame_FFMPEG_p == NULL ||
|
||||
icvRetrieveFrame_FFMPEG_p == NULL ||
|
||||
icvSetCaptureProperty_FFMPEG_p == NULL ||
|
||||
icvGetCaptureProperty_FFMPEG_p == NULL ||
|
||||
icvCreateVideoWriter_FFMPEG_p == NULL ||
|
||||
icvReleaseVideoWriter_FFMPEG_p == NULL ||
|
||||
icvWriteFrame_FFMPEG_p == NULL )
|
||||
#if 0
|
||||
if( icvCreateFileCapture_FFMPEG_p != 0 &&
|
||||
icvReleaseCapture_FFMPEG_p != 0 &&
|
||||
icvGrabFrame_FFMPEG_p != 0 &&
|
||||
icvRetrieveFrame_FFMPEG_p != 0 &&
|
||||
icvSetCaptureProperty_FFMPEG_p != 0 &&
|
||||
icvGetCaptureProperty_FFMPEG_p != 0 &&
|
||||
icvCreateVideoWriter_FFMPEG_p != 0 &&
|
||||
icvReleaseVideoWriter_FFMPEG_p != 0 &&
|
||||
icvWriteFrame_FFMPEG_p != 0 )
|
||||
{
|
||||
fprintf(stderr, "Failed to load FFMPEG plugin: module handle=%p\n", icvFFOpenCV);
|
||||
printf("Successfully initialized ffmpeg plugin!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Failed to load FFMPEG plugin: module handle=%p\n", icvFFOpenCV);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#elif defined HAVE_FFMPEG
|
||||
icvCreateFileCapture_FFMPEG_p = (CvCreateFileCapture_Plugin)cvCreateFileCapture_FFMPEG;
|
||||
@@ -117,13 +144,12 @@ icvInitFFMPEG(void)
|
||||
icvReleaseVideoWriter_FFMPEG_p = (CvReleaseVideoWriter_Plugin)cvReleaseVideoWriter_FFMPEG;
|
||||
icvWriteFrame_FFMPEG_p = (CvWriteFrame_Plugin)cvWriteFrame_FFMPEG;
|
||||
#endif
|
||||
|
||||
ffmpegInitialized = 1;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class CvCapture_FFMPEG_proxy : public CvCapture
|
||||
class CvCapture_FFMPEG_proxy :
|
||||
public CvCapture
|
||||
{
|
||||
public:
|
||||
CvCapture_FFMPEG_proxy() { ffmpegCapture = 0; }
|
||||
@@ -146,18 +172,18 @@ public:
|
||||
unsigned char* data = 0;
|
||||
int step=0, width=0, height=0, cn=0;
|
||||
|
||||
if(!ffmpegCapture ||
|
||||
!icvRetrieveFrame_FFMPEG_p(ffmpegCapture,&data,&step,&width,&height,&cn))
|
||||
return 0;
|
||||
if (!ffmpegCapture ||
|
||||
!icvRetrieveFrame_FFMPEG_p(ffmpegCapture, &data, &step, &width, &height, &cn))
|
||||
return 0;
|
||||
cvInitImageHeader(&frame, cvSize(width, height), 8, cn);
|
||||
cvSetData(&frame, data, step);
|
||||
return &frame;
|
||||
}
|
||||
virtual bool open( const char* filename )
|
||||
{
|
||||
icvInitFFMPEG::Init();
|
||||
close();
|
||||
|
||||
icvInitFFMPEG();
|
||||
if( !icvCreateFileCapture_FFMPEG_p )
|
||||
return false;
|
||||
ffmpegCapture = icvCreateFileCapture_FFMPEG_p( filename );
|
||||
@@ -190,8 +216,8 @@ CvCapture* cvCreateFileCapture_FFMPEG_proxy(const char * filename)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
class CvVideoWriter_FFMPEG_proxy : public CvVideoWriter
|
||||
class CvVideoWriter_FFMPEG_proxy :
|
||||
public CvVideoWriter
|
||||
{
|
||||
public:
|
||||
CvVideoWriter_FFMPEG_proxy() { ffmpegWriter = 0; }
|
||||
@@ -208,8 +234,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