Record PCI location paths during GVFG device enumeration
- Read Windows PCI location paths for capture devices. - Remove per-query HDMI video debug output and simplify frame descriptor transfer. - Document repository workflow and validation in AGENTS.md. Validation: git diff --cached --check passed. Build and runtime tests were not run for this commit.
This commit is contained in:
@@ -438,18 +438,6 @@ namespace gvfg::internal
|
||||
return status;
|
||||
}
|
||||
|
||||
char debugMessage[256];
|
||||
std::snprintf(debugMessage, sizeof(debugMessage),
|
||||
"[GVFG] GvfgGetHdmiVideoInputInfo CH%" PRIu32
|
||||
" | VideoSignalLock=%" PRIu32 " | %" PRIu32 "x%" PRIu32
|
||||
" @ %" PRIu32 " fps | ColorFormat=0x%08" PRIX32
|
||||
" | ColorSpace=0x%08" PRIX32 " | BitsPerPixel=%" PRIu32 "\n",
|
||||
static_cast<uint32_t>(channel_), static_cast<uint32_t>(info.VideoSignalLock),
|
||||
static_cast<uint32_t>(info.Width), static_cast<uint32_t>(info.Height),
|
||||
static_cast<uint32_t>(info.Fps), static_cast<uint32_t>(info.ColorFormat),
|
||||
static_cast<uint32_t>(info.ColorSpace), static_cast<uint32_t>(info.BitsPerPixel));
|
||||
OutputDebugStringA(debugMessage);
|
||||
|
||||
out.connected = info.VideoSignalLock != 0;
|
||||
out.width = info.Width;
|
||||
out.height = info.Height;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <setupapi.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <cwchar>
|
||||
|
||||
#pragma comment(lib, "SetupAPI.lib")
|
||||
|
||||
@@ -27,6 +28,26 @@ namespace
|
||||
return {};
|
||||
return reinterpret_cast<const wchar_t *>(bytes.data());
|
||||
}
|
||||
|
||||
std::wstring pci_location_path(HDEVINFO info, SP_DEVINFO_DATA &deviceInfo)
|
||||
{
|
||||
DWORD required = 0;
|
||||
SetupDiGetDeviceRegistryPropertyW(info, &deviceInfo, SPDRP_LOCATION_PATHS,
|
||||
nullptr, nullptr, 0, &required);
|
||||
if (required < 2 * sizeof(wchar_t))
|
||||
return {};
|
||||
|
||||
std::vector<wchar_t> paths(required / sizeof(wchar_t) + 2);
|
||||
DWORD type = 0;
|
||||
if (!SetupDiGetDeviceRegistryPropertyW(info, &deviceInfo, SPDRP_LOCATION_PATHS,
|
||||
&type, reinterpret_cast<BYTE *>(paths.data()),
|
||||
required, nullptr) || type != REG_MULTI_SZ)
|
||||
return {};
|
||||
for (const wchar_t *path = paths.data(); *path; path += std::wcslen(path) + 1)
|
||||
if (_wcsnicmp(path, L"PCIROOT(", 8) == 0)
|
||||
return path;
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
namespace gvfg::internal
|
||||
@@ -58,6 +79,7 @@ namespace gvfg::internal
|
||||
|
||||
GigabyteDevice device;
|
||||
device.interface_path = detail->DevicePath;
|
||||
device.pci_location_path = pci_location_path(info, deviceInfo);
|
||||
device.friendly_name = device_property(info, deviceInfo, SPDRP_FRIENDLYNAME);
|
||||
if (device.friendly_name.empty())
|
||||
device.friendly_name = device_property(info, deviceInfo, SPDRP_DEVICEDESC);
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace gvfg::internal
|
||||
{
|
||||
std::wstring interface_path;
|
||||
std::wstring friendly_name;
|
||||
std::wstring pci_location_path;
|
||||
};
|
||||
|
||||
std::vector<GigabyteDevice> enumerate_gigabyte_devices();
|
||||
|
||||
@@ -157,7 +157,6 @@ struct gvfg_channel_session_t
|
||||
return stOpen;
|
||||
}
|
||||
|
||||
currentIndex = index;
|
||||
syncSessionEventCallback();
|
||||
selectedChannel = static_cast<uint32_t>(channelIndex);
|
||||
resetRuntimeCounters();
|
||||
@@ -254,7 +253,6 @@ struct gvfg_channel_session_t
|
||||
session->close();
|
||||
session.reset();
|
||||
}
|
||||
currentIndex = -1;
|
||||
}
|
||||
|
||||
gvfg_status_t getSignalStatus(gvfg_signal_status_t &out)
|
||||
@@ -503,15 +501,7 @@ struct gvfg_channel_session_t
|
||||
|
||||
updateRuntimeFps(now_ns());
|
||||
|
||||
out.data = frame.data;
|
||||
out.data_size = static_cast<uint64_t>(frame.data_size);
|
||||
out.width = static_cast<int>(frame.width);
|
||||
out.height = static_cast<int>(frame.height);
|
||||
out.row_stride_bytes = frame.row_stride_bytes;
|
||||
out.pixel_format = frame.pixel_format;
|
||||
out.bit_depth = static_cast<int>(frame.bit_depth);
|
||||
out.frame_id = frame.frame_id;
|
||||
out.timestamp_ns = frame.timestamp_ns;
|
||||
out = frame;
|
||||
if (timing)
|
||||
timing->frame_id = out.frame_id;
|
||||
noteDeliveredFrame(out.width, out.height, out.bit_depth, out.pixel_format);
|
||||
@@ -824,7 +814,6 @@ struct gvfg_channel_session_t
|
||||
|
||||
ChannelErrorState &errorState;
|
||||
std::unique_ptr<gvfg::internal::GigabyteCaptureSession> session;
|
||||
int currentIndex = -1;
|
||||
uint32_t selectedChannel = GVFG_CHANNEL_0;
|
||||
bool zeroCopyRequested = false;
|
||||
bool audioEnabled = false;
|
||||
|
||||
Reference in New Issue
Block a user