Expose the remaining GigabyteLib queries

Compared with aac4edd:

- expose optional device capability and SDI detail queries through the public GVFG API

- use GvfgGetDevInfo only when an application requests device capabilities

- use GvfgGetSdiVideoInputInfo and GvfgStringifySdiVideoInputInfo only when an application requests SDI details

- return both native SDI values and the vendor-formatted mode, resolution, frame-rate, and scan strings

- source the device interface GUID directly from the supervisor-provided gvfgsdkapi.h

- preserve the existing capture path and all previous public exports
This commit is contained in:
Mark.lin
2026-09-14 10:59:37 +08:00
parent aac4eddaf7
commit 82933f8967
6 changed files with 115 additions and 2 deletions
+2
View File
@@ -25,6 +25,8 @@ EXPORTS
gvfg_stop
gvfg_stop_channel
gvfg_get_channel_signal_status
gvfg_get_device_capabilities
gvfg_get_channel_sdi_info
gvfg_get_channel_runtime_info
gvfg_get_version
gvfg_pixel_format_name
+32
View File
@@ -132,6 +132,28 @@ extern "C"
char name[128]; /* Display name for UI/logging. UTF-8, null-terminated. */
} gvfg_device_info_t;
typedef struct
{
uint32_t video_channel_count;
int has_audio;
} gvfg_device_capabilities_t;
typedef struct
{
int connected;
uint32_t mode;
uint32_t resolution;
uint32_t fps;
int progressive;
int level_b;
uint32_t st352_payload;
uint32_t error_count;
char mode_name[16];
char resolution_name[64];
char fps_name[24];
char scan_name[16];
} gvfg_sdi_info_t;
typedef struct
{
int connected; /* Non-zero while this channel has a valid input signal. */
@@ -562,6 +584,16 @@ extern "C"
_In_ int channel_index,
_Out_ gvfg_signal_status_t *out_status);
/* Optional vendor-backed device and SDI detail queries. */
GVFG_API gvfg_status_t gvfg_get_device_capabilities(
_In_ gvfg_handle handle,
_Out_ gvfg_device_capabilities_t *out_capabilities);
GVFG_API gvfg_status_t gvfg_get_channel_sdi_info(
_In_ gvfg_handle handle,
_In_ int channel_index,
_Out_ gvfg_sdi_info_t *out_info);
/*
* Query runtime frame-delivery diagnostics.
*
@@ -238,6 +238,54 @@ gvfg_status_t GigabyteCaptureSession::get_signal_status(gvfg_signal_status_t &ou
return status;
}
gvfg_status_t GigabyteCaptureSession::get_device_capabilities(
gvfg_device_capabilities_t &out) const
{
const gvfg_status_t openStatus = ensure_vendor_channel_open();
if (openStatus != GVFG_OK)
return openStatus;
GVFG_DEV_INFO info{};
const gvfg_status_t status = from_vendor(GvfgGetDevInfo(context_, &info), "GvfgGetDevInfo");
if (status != GVFG_OK)
return status;
out = {};
out.video_channel_count = info.NumVideoChn;
out.has_audio = info.HasAudio ? 1 : 0;
return GVFG_OK;
}
gvfg_status_t GigabyteCaptureSession::get_sdi_info(gvfg_sdi_info_t &out) const
{
const gvfg_status_t openStatus = ensure_vendor_channel_open();
if (openStatus != GVFG_OK)
return openStatus;
GVFG_SDI_VIDEO_INFO info{};
gvfg_status_t status = from_vendor(
GvfgGetSdiVideoInputInfo(context_, channel_, &info), "GvfgGetSdiVideoInputInfo");
if (status != GVFG_OK)
return status;
GVFG_SDI_VIDEO_INFO_STR text{};
status = from_vendor(
GvfgStringifySdiVideoInputInfo(context_, &info, &text),
"GvfgStringifySdiVideoInputInfo");
if (status != GVFG_OK)
return status;
out = {};
out.connected = info.VideoSignalLock ? 1 : 0;
out.mode = info.Mode;
out.resolution = info.Resol;
out.fps = info.Fps;
out.progressive = info.Progressive ? 1 : 0;
out.level_b = info.LevelB ? 1 : 0;
out.st352_payload = info.St352Payload;
out.error_count = info.ErrorCount;
strncpy_s(out.mode_name, text.Mode, _TRUNCATE);
strncpy_s(out.resolution_name, text.Resol, _TRUNCATE);
strncpy_s(out.fps_name, text.Fps, _TRUNCATE);
strncpy_s(out.scan_name, text.Progressive, _TRUNCATE);
return GVFG_OK;
}
gvfg_status_t GigabyteCaptureSession::get_audio_format(GigabyteAudioInfo &out) const
{
const gvfg_status_t openStatus = ensure_vendor_channel_open();
@@ -47,6 +47,8 @@ namespace gvfg::internal
gvfg_status_t set_audio_enabled(bool enabled);
gvfg_status_t set_video_format(gvfg_pixel_format_t format);
gvfg_status_t get_signal_status(gvfg_signal_status_t &out) const;
gvfg_status_t get_device_capabilities(gvfg_device_capabilities_t &out) const;
gvfg_status_t get_sdi_info(gvfg_sdi_info_t &out) const;
gvfg_status_t get_audio_format(GigabyteAudioInfo &out) const;
gvfg_status_t set_event_callback(GigabyteEventCallback callback, void *user, uint32_t eventMask);
gvfg_status_t configure_stream();
@@ -1,4 +1,5 @@
#include "gigabyte_device.h"
#include "gvfgsdkapi.h"
#include <windows.h>
#include <setupapi.h>
@@ -10,8 +11,7 @@
namespace
{
// Device interface exported by pcie_s2mm_driver.
const GUID kGigabyteDeviceInterfaceGuid =
{0x8c47b9c3, 0x1faa, 0x4557, {0xbc, 0x1d, 0xf2, 0x25, 0xd2, 0x6c, 0x9e, 0x91}};
const GUID kGigabyteDeviceInterfaceGuid = GUID_DEVINTERFACE_GVFG100;
std::wstring device_property(HDEVINFO info, SP_DEVINFO_DATA &deviceInfo, DWORD property)
{
+29
View File
@@ -1258,6 +1258,35 @@ extern "C"
"gvfg_get_channel_runtime_info rejected: channel is not open");
}
gvfg_status_t gvfg_get_device_capabilities(
gvfg_handle handle, gvfg_device_capabilities_t *out_capabilities)
{
if (!handle || !out_capabilities)
return GVFG_EINVAL;
gvfg_channel_session_t *channel = handle->findOpenChannel();
if (!channel || !channel->session)
return handle->rejectAllChannels(
GVFG_ESTATE, "gvfg_get_device_capabilities rejected: no channel is open");
return channel->session->get_device_capabilities(*out_capabilities);
}
gvfg_status_t gvfg_get_channel_sdi_info(
gvfg_handle handle, int channel_index, gvfg_sdi_info_t *out_info)
{
if (!handle)
return GVFG_EINVAL;
if (!out_info)
return handle->rejectChannel(
channel_index, GVFG_EINVAL,
"gvfg_get_channel_sdi_info rejected: out_info is null");
gvfg_channel_session_t *channel = handle->findChannel(channel_index);
if (!channel || !channel->session)
return handle->rejectChannel(
channel_index, GVFG_ESTATE,
"gvfg_get_channel_sdi_info rejected: channel is not open");
return channel->session->get_sdi_info(*out_info);
}
const char *gvfg_get_version(void)
{
return GVFG_VERSION_STRING;