1.添加uvc视频流,
This commit is contained in:
@ -8,4 +8,8 @@ target_include_directories(Peripheral
|
||||
|
||||
target_link_libraries(Peripheral
|
||||
PUBLIC Universal
|
||||
PRIVATE Mfreadwrite
|
||||
PRIVATE Mf
|
||||
PRIVATE mfplat
|
||||
PRIVATE mfuuid
|
||||
)
|
||||
|
@ -116,6 +116,38 @@ void DeviceDiscovery::enterOtaMode(const std::shared_ptr<Device> &device, std::e
|
||||
&llTimeStamp, &pSample);
|
||||
}
|
||||
|
||||
std::vector<std::string> DeviceDiscovery::devices() {
|
||||
std::vector<std::string> ret;
|
||||
IMFAttributes *attributes = nullptr;
|
||||
boost::scope::scope_exit guard([&attributes] { SafeRelease(&attributes); });
|
||||
auto result = MFCreateAttributes(&attributes, 1);
|
||||
if (FAILED(result)) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
result = attributes->SetGUID(MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE, MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_GUID);
|
||||
if (FAILED(result)) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
UINT32 count;
|
||||
IMFActivate **devices = nullptr;
|
||||
result = MFEnumDeviceSources(attributes, &devices, &count);
|
||||
if (FAILED(result)) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (count == 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
auto name = this->deviceName(devices[i]);
|
||||
ret.push_back(name);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
DeviceDiscovery::Resolutions DeviceDiscovery::deviceResolutions(const std::shared_ptr<Device> &source) {
|
||||
DeviceDiscovery::Resolutions ret;
|
||||
HRESULT result = S_OK;
|
||||
|
@ -24,6 +24,7 @@ public:
|
||||
DeviceDiscovery();
|
||||
std::shared_ptr<Device> find(const std::string &deviceName, std::error_code &error);
|
||||
void enterOtaMode(const std::shared_ptr<Device> &device, std::error_code &error);
|
||||
std::vector<std::string> devices();
|
||||
|
||||
protected:
|
||||
std::string deviceName(IMFActivate *device);
|
||||
|
Reference in New Issue
Block a user