From dc08a953fa36e7956416e7e2b972f86cc1aa7177 Mon Sep 17 00:00:00 2001 From: "Mark.lin" Date: Fri, 11 Sep 2026 13:30:49 +0800 Subject: [PATCH] Add stable suffixes to enumerated device names Compared with cae4a04: - Append a one-based numeric suffix to every device name returned by gvfg_enumerate_devices so otherwise identical capture devices remain distinguishable in upper-layer selectors. - Truncate the original display name when necessary so the suffix and null terminator always fit within the fixed public name buffer. - Preserve the existing fallback name and device enumeration count behavior. Validation: git diff --check and focused source inspection passed. No configure, build, runtime enumeration, capture, or hardware validation was run for this change. --- GVFG_SDK/sdk/gvfg/src/gvfg_capture.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/GVFG_SDK/sdk/gvfg/src/gvfg_capture.cpp b/GVFG_SDK/sdk/gvfg/src/gvfg_capture.cpp index 256240e..0bbdbee 100644 --- a/GVFG_SDK/sdk/gvfg/src/gvfg_capture.cpp +++ b/GVFG_SDK/sdk/gvfg/src/gvfg_capture.cpp @@ -1097,6 +1097,14 @@ extern "C" sizeof(out_devices[i].name)); if (!out_devices[i].name[0]) copy_cstr(out_devices[i].name, sizeof(out_devices[i].name), "GVFG Capture"); + + const std::string suffix = " #" + std::to_string(i + 1); + std::string displayName = out_devices[i].name; + const size_t maxNameLength = sizeof(out_devices[i].name) - 1; + if (displayName.size() + suffix.size() > maxNameLength) + displayName.resize(maxNameLength - suffix.size()); + displayName += suffix; + copy_cstr(out_devices[i].name, sizeof(out_devices[i].name), displayName.c_str()); } return written; }