Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions source/dshow-base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <ksproxy.h>
#include <Amaudio.h>
#include <Dvdmedia.h>
#include <Propvarutil.h>

#include "ComPtr.hpp"
#include "CoTaskMemPtr.hpp"
Expand Down
24 changes: 24 additions & 0 deletions source/dshow-enum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,30 @@ static bool EnumDevice(const GUID &type, IMoniker *deviceInfo,
}

propertyData->Read(L"DevicePath", &devicePath, NULL);
if (!devicePath.bstrVal) {
/* fall back to another method to get device path */
LPMALLOC co_malloc = nullptr;
hr = CoGetMalloc(1, &co_malloc);
if (FAILED(hr))
return true;

ComPtr<IBindCtx> bind_ctx = nullptr;
hr = CreateBindCtx(0, &bind_ctx);
if (FAILED(hr))
return true;

LPOLESTR olestr = nullptr;
bool success = true;
hr = deviceInfo->GetDisplayName(bind_ctx, nullptr, &olestr);
if (SUCCEEDED(hr)) {
hr = InitVariantFromString(olestr, &devicePath);
if (FAILED(hr))
success = false;
}
co_malloc->Free(olestr);
if (!success)
return true;
}

hr = deviceInfo->BindToObject(NULL, 0, IID_IBaseFilter,
(void **)&filter);
Expand Down