mirror of
https://github.com/opencv/opencv.git
synced 2024-11-26 04:00:30 +08:00
Merge pull request #3260 from a-wi:MSMF_file_error
This commit is contained in:
commit
1920232268
@ -3847,18 +3847,25 @@ bool CvCaptureFile_MSMF::open(const char* filename)
|
|||||||
hr = enumerateCaptureFormats(videoFileSource);
|
hr = enumerateCaptureFormats(videoFileSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( captureFormats.empty() )
|
||||||
|
{
|
||||||
|
isOpened = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
hr = ImageGrabberThread::CreateInstance(&grabberThread, videoFileSource, (unsigned int)-2, true);
|
hr = ImageGrabberThread::CreateInstance(&grabberThread, videoFileSource, (unsigned int)-2, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
isOpened = SUCCEEDED(hr);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isOpened)
|
||||||
{
|
{
|
||||||
grabberThread->start();
|
grabberThread->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
isOpened = SUCCEEDED(hr);
|
|
||||||
|
|
||||||
return isOpened;
|
return isOpened;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3990,6 +3997,8 @@ HRESULT CvCaptureFile_MSMF::enumerateCaptureFormats(IMFMediaSource *pSource)
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
MediaType MT = FormatReader::Read(pType.Get());
|
MediaType MT = FormatReader::Read(pType.Get());
|
||||||
|
// We can capture only RGB video.
|
||||||
|
if( MT.MF_MT_SUBTYPE == MFVideoFormat_RGB24 )
|
||||||
captureFormats.push_back(MT);
|
captureFormats.push_back(MT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user