1.添加uvc视频流,

This commit is contained in:
luocai
2024-06-13 15:41:40 +08:00
parent 4febb5fb7f
commit 4724af4086
28 changed files with 1192 additions and 136 deletions

View File

@ -8,4 +8,8 @@ target_include_directories(Peripheral
target_link_libraries(Peripheral
PUBLIC Universal
PRIVATE Mfreadwrite
PRIVATE Mf
PRIVATE mfplat
PRIVATE mfuuid
)

View File

@ -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;

View File

@ -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);