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:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user