Skip to content

Commit ece3fac

Browse files
PkLabalalek
authored andcommitted
Merge pull request opencv#8112 from PkLab:Fix_7898
CoInitialize/CoUninitialize in VFW classes (opencv#8112)
1 parent 607ff2e commit ece3fac

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

modules/videoio/src/cap_vfw.cpp

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,16 @@ CvCapture* cvCreateFileCapture_VFW (const char* filename)
312312
class CvCaptureCAM_VFW : public CvCapture
313313
{
314314
public:
315-
CvCaptureCAM_VFW() { init(); }
316-
virtual ~CvCaptureCAM_VFW() { close(); }
315+
CvCaptureCAM_VFW()
316+
{
317+
CoInitialize(NULL);
318+
init();
319+
}
320+
virtual ~CvCaptureCAM_VFW()
321+
{
322+
close();
323+
CoUninitialize();
324+
}
317325

318326
virtual bool open( int index );
319327
virtual void close();
@@ -673,8 +681,16 @@ CvCapture* cvCreateCameraCapture_VFW( int index )
673681
class CvVideoWriter_VFW : public CvVideoWriter
674682
{
675683
public:
676-
CvVideoWriter_VFW() { init(); }
677-
virtual ~CvVideoWriter_VFW() { close(); }
684+
CvVideoWriter_VFW()
685+
{
686+
CoInitialize(NULL);
687+
init();
688+
}
689+
virtual ~CvVideoWriter_VFW()
690+
{
691+
close();
692+
CoUninitialize();
693+
}
678694

679695
virtual bool open( const char* filename, int fourcc,
680696
double fps, CvSize frameSize, bool isColor );

0 commit comments

Comments
 (0)