编译通过,尚差链接错误
parent
16c2747b11
commit
5a40ac88a4
|
@ -1,6 +1,7 @@
|
||||||
#include "CameraCapture.h"
|
#include "CameraCapture.h"
|
||||||
#include "Debuger.h"
|
#include "Debuger.h"
|
||||||
|
|
||||||
|
|
||||||
#pragma comment(lib, "strmiids")
|
#pragma comment(lib, "strmiids")
|
||||||
|
|
||||||
//define release maco
|
//define release maco
|
||||||
|
@ -237,20 +238,23 @@ bool Camera::Open(std::wstring &camera_name)
|
||||||
|
|
||||||
if (names.empty())
|
if (names.empty())
|
||||||
{
|
{
|
||||||
Close(); return false;
|
Close();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
bool founded = false;
|
||||||
|
for(std::wstring i : names ){
|
||||||
|
if(i == camera_name){
|
||||||
|
founded = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!founded){
|
||||||
|
|
||||||
auto name_it = find(names.begin(), names.end(), camera_name);
|
}
|
||||||
if (name_it == names.end())
|
int deviceID = 0;
|
||||||
{
|
|
||||||
Close(); return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int deviceID = static_cast<int>(distance(names.begin(), name_it));
|
|
||||||
|
|
||||||
|
|
||||||
// create grabber filter instance
|
// create grabber filter instance
|
||||||
CHECK_HR(CoCreateInstance(CLSID_SampleGrabber, NULL, CLSCTX_INPROC_SERVER,
|
CHECK_HR(CoCreateInstance(IID_ISampleGrabber, NULL, CLSCTX_INPROC_SERVER,
|
||||||
IID_IBaseFilter, (LPVOID*)&pSampleGrabberFilter));
|
IID_IBaseFilter, (LPVOID*)&pSampleGrabberFilter));
|
||||||
|
|
||||||
// bind source device
|
// bind source device
|
||||||
|
@ -294,7 +298,7 @@ bool Camera::Open(std::wstring &camera_name)
|
||||||
mediaType.formattype = FORMAT_VideoInfo;
|
mediaType.formattype = FORMAT_VideoInfo;
|
||||||
hr = mSampGrabber->SetMediaType(&mediaType);
|
hr = mSampGrabber->SetMediaType(&mediaType);
|
||||||
|
|
||||||
CHECK_HR(CoCreateInstance(CLSID_NullRenderer, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)(&dest_filter)));
|
CHECK_HR(CoCreateInstance(CLSID_NullRenderer, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)(&dest_filter)));
|
||||||
mGraphBuilder->AddFilter(dest_filter, L"NullRenderer");
|
mGraphBuilder->AddFilter(dest_filter, L"NullRenderer");
|
||||||
|
|
||||||
// connect source filter to grabber filter
|
// connect source filter to grabber filter
|
||||||
|
|
Loading…
Reference in New Issue