Add HDMI input and chip queries to GVFG SDK 3.1

- Expose HDMI input and chip information through the capture API and rename the full-frame OSD rendering entry point.
- Update the bundled Gigabyte library and add opt-in internal diagnostics with a user LED control.
- Update the customer API reference, generated PDF, and build guidance.

Validation: git diff --cached --check passed. Build and runtime tests were not run for this commit.
This commit is contained in:
Mark.lin
2026-11-17 17:40:25 +08:00
parent 47a5f041ee
commit 7a7027391e
20 changed files with 568 additions and 47 deletions
+3 -1
View File
@@ -3,7 +3,9 @@ cmake_minimum_required(VERSION 3.16)
project(gvfg_sdk LANGUAGES CXX) project(gvfg_sdk LANGUAGES CXX)
# Version policy: breaking public API changes bump MAJOR; features bump MINOR; fixes bump PATCH. # Version policy: breaking public API changes bump MAJOR; features bump MINOR; fixes bump PATCH.
set(GVFG_SDK_VERSION "3.0.0") set(GVFG_SDK_VERSION "3.1.0")
option(GVFG_ENABLE_INTERNAL_DIAGNOSTICS "Enable SDK diagnostics in non-Debug builds" OFF)
option(GVFG_EXPERIMENTAL_ZERO_COPY_OSD_INPLACE option(GVFG_EXPERIMENTAL_ZERO_COPY_OSD_INPLACE
"UNSAFE local experiment: write OSD into driver zero-copy buffers" OFF) "UNSAFE local experiment: write OSD into driver zero-copy buffers" OFF)
@@ -20,7 +20,7 @@ target_include_directories(gvfg_playback
${CMAKE_CURRENT_SOURCE_DIR}/../gvfg_preview/src ${CMAKE_CURRENT_SOURCE_DIR}/../gvfg_preview/src
) )
target_compile_definitions(gvfg_playback PRIVATE GVFG_PLAYBACK_BUILD target_compile_definitions(gvfg_playback PRIVATE GVFG_PLAYBACK_BUILD
GVFG_INTERNAL_DIAGNOSTICS=$<IF:$<CONFIG:Debug>,1,0>) GVFG_INTERNAL_DIAGNOSTICS=$<OR:$<CONFIG:Debug>,$<BOOL:${GVFG_ENABLE_INTERNAL_DIAGNOSTICS}>>)
target_link_libraries(gvfg_playback PRIVATE gvfg_audio_playback gvfg_preview user32 gdi32 comctl32) target_link_libraries(gvfg_playback PRIVATE gvfg_audio_playback gvfg_preview user32 gdi32 comctl32)
if(MSVC) if(MSVC)
target_compile_options(gvfg_playback PRIVATE /utf-8 /EHsc) target_compile_options(gvfg_playback PRIVATE /utf-8 /EHsc)
+1 -1
View File
@@ -44,7 +44,7 @@ target_compile_definitions(gvfg PRIVATE
) )
target_compile_definitions(gvfg PRIVATE target_compile_definitions(gvfg PRIVATE
GVFG_INTERNAL_DIAGNOSTICS=$<IF:$<CONFIG:Debug>,1,0> GVFG_INTERNAL_DIAGNOSTICS=$<OR:$<CONFIG:Debug>,$<BOOL:${GVFG_ENABLE_INTERNAL_DIAGNOSTICS}>>
) )
if (GVFG_EXPERIMENTAL_ZERO_COPY_OSD_INPLACE) if (GVFG_EXPERIMENTAL_ZERO_COPY_OSD_INPLACE)
target_compile_definitions(gvfg PRIVATE GVFG_EXPERIMENTAL_ZERO_COPY_OSD_INPLACE=1) target_compile_definitions(gvfg PRIVATE GVFG_EXPERIMENTAL_ZERO_COPY_OSD_INPLACE=1)
+4 -1
View File
@@ -11,7 +11,7 @@ EXPORTS
gvfg_get_osd_fonts gvfg_get_osd_fonts
gvfg_set_channel_osd_visible gvfg_set_channel_osd_visible
gvfg_measure_osd_text gvfg_measure_osd_text
gvfg_render_osd_bgra gvfg_render_osd_frame_bgra
gvfg_set_channel_osd gvfg_set_channel_osd
gvfg_clear_channel_osd gvfg_clear_channel_osd
gvfg_set_channel_audio_enabled gvfg_set_channel_audio_enabled
@@ -30,6 +30,8 @@ EXPORTS
gvfg_stop_channel gvfg_stop_channel
gvfg_get_channel_signal_status gvfg_get_channel_signal_status
gvfg_get_channel_sdi_info gvfg_get_channel_sdi_info
gvfg_get_channel_hdmi_info
gvfg_get_chip_info
gvfg_get_channel_runtime_info gvfg_get_channel_runtime_info
gvfg_get_version gvfg_get_version
gvfg_get_gigabyte_lib_version gvfg_get_gigabyte_lib_version
@@ -42,5 +44,6 @@ EXPORTS
gvfg_debug_get_channel_osd_experiment_flags gvfg_debug_get_channel_osd_experiment_flags
gvfg_debug_get_channel_osd_page_check gvfg_debug_get_channel_osd_page_check
gvfg_debug_get_device_capabilities gvfg_debug_get_device_capabilities
gvfg_debug_set_user_led
gvfg_debug_read_register gvfg_debug_read_register
gvfg_debug_write_register gvfg_debug_write_register
+46 -13
View File
@@ -177,6 +177,26 @@ extern "C"
char st352_bit_depth_name[24]; /* Null-terminated ST 352 bit-depth description. */ char st352_bit_depth_name[24]; /* Null-terminated ST 352 bit-depth description. */
} gvfg_sdi_info_t; } gvfg_sdi_info_t;
typedef struct
{
int connected;
uint32_t width;
uint32_t height;
uint32_t fps; /* HDMI input frames per second reported by GigabyteLib. */
uint32_t color_format; /* HDMI color format code. */
uint32_t color_space; /* HDMI color space and range code. */
uint32_t bit_depth; /* HDMI input bit depth. */
char fps_name[24]; /* Decimal text for fps, without a unit suffix. */
char color_format_name[24];
char color_space_name[32];
} gvfg_hdmi_info_t;
typedef struct
{
uint32_t version_date; /* Chip version date, interpreted in hexadecimal. */
uint32_t version_time; /* Chip version time, interpreted in hexadecimal. */
} gvfg_chip_info_t;
typedef struct typedef struct
{ {
int connected; /* Non-zero while this channel has a valid input signal. */ int connected; /* Non-zero while this channel has a valid input signal. */
@@ -226,7 +246,7 @@ extern "C"
typedef struct gvfg_osd_bitmap_t typedef struct gvfg_osd_bitmap_t
{ {
const uint8_t *data; /* SDK-owned; do not modify/free. See gvfg_render_osd_bgra(). */ const uint8_t *data; /* SDK-owned; do not modify/free. See the render function's lifetime. */
uint64_t data_size; /* stride * height bytes. */ uint64_t data_size; /* stride * height bytes. */
uint32_t width; uint32_t width;
uint32_t height; uint32_t height;
@@ -397,19 +417,23 @@ extern "C"
GVFG_PARAM_OUT uint32_t *out_width, GVFG_PARAM_OUT uint32_t *out_width,
GVFG_PARAM_OUT uint32_t *out_height); GVFG_PARAM_OUT uint32_t *out_height);
/* Render one standalone text bitmap; no device, channel or Start needed. /* Prepare one transparent video-sized overlay for FPGA transfer. No capture
* Same text/font/size limits as measure; ignores x/y. Auto-sized conservative * handle needed; pass the target video width/height in pixels. Output is
* text box, top-down, left-to-right B,G,R,A bytes with PREMULTIPLIED alpha. * top-down BGRA8888, premultiplied alpha, stride = width * 4.
* Transparent background; anti-aliased edges retain partial alpha. * NULL slots are omitted (hidden/unused); both NULL produce a blank frame.
* Snapshot expires at the next call to this function on the SAME thread * x/y are frame coordinates, clamped to fit; oversized text is skipped.
* (including failure), thread exit, or DLL unload. Copy before rendering a * Slot 1 is composited over slot 0. No video pixels are included.
* second OSD or handing data to another thread/asynchronous FPGA transfer. * Data is valid until the next call to this function on the same thread
* Other OSD APIs do not invalidate it. out_bitmap is empty on failure. * (including failure), thread exit or DLL unload. Copy for async transfer.
* Invalid/missing font/input or unsupported dimensions: GVFG_EINVAL; * Invalid inputs/dimensions (including byte size above UINT32_MAX) return
* allocation/render failure: GVFG_EIO. No caller-side free is needed. * GVFG_EINVAL; allocation/render failures return GVFG_EIO. On failure the
* output is empty. Does not affect GPU capture OSD.
*/ */
GVFG_API gvfg_status_t gvfg_render_osd_bgra( GVFG_API gvfg_status_t gvfg_render_osd_frame_bgra(
GVFG_PARAM_IN const gvfg_channel_osd_config_t *config, GVFG_PARAM_IN uint32_t video_width,
GVFG_PARAM_IN uint32_t video_height,
GVFG_PARAM_IN const gvfg_channel_osd_config_t *slot0,
GVFG_PARAM_IN const gvfg_channel_osd_config_t *slot1,
GVFG_PARAM_OUT gvfg_osd_bitmap_t *out_bitmap); GVFG_PARAM_OUT gvfg_osd_bitmap_t *out_bitmap);
/* Set and show slot 0 or 1 on an opened channel. Strings are copied before /* Set and show slot 0 or 1 on an opened channel. Strings are copied before
@@ -659,6 +683,15 @@ extern "C"
GVFG_PARAM_IN int channel_index, GVFG_PARAM_IN int channel_index,
GVFG_PARAM_OUT gvfg_sdi_info_t *out_info); GVFG_PARAM_OUT gvfg_sdi_info_t *out_info);
GVFG_API gvfg_status_t gvfg_get_channel_hdmi_info(
GVFG_PARAM_IN gvfg_handle handle,
GVFG_PARAM_IN int channel_index,
GVFG_PARAM_OUT gvfg_hdmi_info_t *out_info);
GVFG_API gvfg_status_t gvfg_get_chip_info(
GVFG_PARAM_IN gvfg_handle handle,
GVFG_PARAM_OUT gvfg_chip_info_t *out_info);
/* /*
* Query runtime frame-delivery diagnostics. * Query runtime frame-delivery diagnostics.
* *
+3
View File
@@ -170,6 +170,9 @@ GVFG_DEBUG_API gvfg_status_t gvfg_debug_get_channel_backend_stats(
GVFG_PARAM_IN int channel_index, GVFG_PARAM_IN int channel_index,
GVFG_PARAM_OUT gvfg_debug_backend_stats_t *out_stats); GVFG_PARAM_OUT gvfg_debug_backend_stats_t *out_stats);
/* Set the board's user LED. At least one channel must be open. */
GVFG_DEBUG_API gvfg_status_t gvfg_debug_set_user_led(gvfg_handle handle, int on);
/* Query device capabilities for internal diagnostics. At least one channel /* Query device capabilities for internal diagnostics. At least one channel
* must already be open on handle. */ * must already be open on handle. */
GVFG_DEBUG_API gvfg_status_t gvfg_debug_get_device_capabilities( GVFG_DEBUG_API gvfg_status_t gvfg_debug_get_device_capabilities(
@@ -3,6 +3,8 @@
#include <algorithm> #include <algorithm>
#include <array> #include <array>
#include <cinttypes>
#include <cstdio>
namespace namespace
{ {
@@ -12,9 +14,48 @@ namespace
constexpr uint32_t kFourccY210 = GVFG_MAKEFOURCC('Y', '2', '1', '0'); constexpr uint32_t kFourccY210 = GVFG_MAKEFOURCC('Y', '2', '1', '0');
constexpr DWORD kVideoFormatChangeTimeoutMs = 1000; constexpr DWORD kVideoFormatChangeTimeoutMs = 1000;
constexpr DWORD kVideoFormatSettleMs = 500; constexpr DWORD kVideoFormatSettleMs = 500;
// Temporary bring-up workaround: HDMI VideoSignalLock is not implemented
// by the current driver/FPGA. Set false once HDMI lock reporting is ready. const char *hdmi_color_format_name(uint32_t code)
constexpr bool kBypassHdmiSignalLock = true; {
switch (code)
{
case GVFG_HDMI_CF_RGB: return "RGB";
case GVFG_HDMI_CF_YUV_422: return "YUV 4:2:2";
case GVFG_HDMI_CF_YUV_444: return "YUV 4:4:4";
case GVFG_HDMI_CF_YUV_420: return "YUV 4:2:0";
default: return "Unknown";
}
}
const char *hdmi_color_space_name(uint32_t code)
{
switch (code)
{
case GVFG_HDMI_CS_DEFAULT_RGB: return "Default RGB";
case GVFG_HDMI_CS_RGB: return "RGB";
case GVFG_HDMI_CS_YUV_601: return "YUV 601";
case GVFG_HDMI_CS_YUV_709: return "YUV 709";
case GVFG_HDMI_CS_YCC_601: return "YCC 601";
case GVFG_HDMI_CS_YCC_709: return "YCC 709";
case GVFG_HDMI_CS_SYCC_601: return "sYCC 601";
case GVFG_HDMI_CS_ADOBE_YCC_601: return "Adobe YCC 601";
case GVFG_HDMI_CS_ADOBE_RGB: return "Adobe RGB";
case GVFG_HDMI_CS_BT2020_YCC: return "BT.2020 YCC";
case GVFG_HDMI_CS_BT2020_RGB: return "BT.2020 RGB";
case GVFG_HDMI_CS_AUTO: return "Auto";
case GVFG_HDMI_CS_LIM_RGB: return "RGB (Limited)";
case GVFG_HDMI_CS_LIM_YUV_601: return "YUV 601 (Limited)";
case GVFG_HDMI_CS_LIM_YUV_709: return "YUV 709 (Limited)";
case GVFG_HDMI_CS_LIM_YCC_601: return "YCC 601 (Limited)";
case GVFG_HDMI_CS_LIM_YCC_709: return "YCC 709 (Limited)";
case GVFG_HDMI_CS_LIM_SYCC_601: return "sYCC 601 (Limited)";
case GVFG_HDMI_CS_LIM_ADOBE_YCC_601: return "Adobe YCC 601 (Limited)";
case GVFG_HDMI_CS_LIM_ADOBE_RGB: return "Adobe RGB (Limited)";
case GVFG_HDMI_CS_LIM_BT2020_YCC: return "BT.2020 YCC (Limited)";
case GVFG_HDMI_CS_LIM_BT2020_RGB: return "BT.2020 RGB (Limited)";
default: return "Unknown";
}
}
uint64_t monotonic_ns() uint64_t monotonic_ns()
{ {
@@ -268,12 +309,7 @@ namespace gvfg::internal
if (status != GVFG_OK) if (status != GVFG_OK)
return status; return status;
gvfg_signal_status_t signal{}; gvfg_signal_status_t signal{};
// Apply the HDMI workaround here so Start, frame reads and SDK clients signal.connected = info.VideoSignalLock != 0 ? 1 : 0;
// use the same effective signal state. SDI still uses the reported lock.
// With bypass enabled, HDMI connected does not prove physical signal lock.
const bool bypassLock = kBypassHdmiSignalLock &&
info.VideoInterface == GVFG_VIDEO_INTERFACE_HDMI;
signal.connected = (bypassLock || info.VideoSignalLock != 0) ? 1 : 0;
signal.channel = channel_; signal.channel = channel_;
signal.width = info.Width; signal.width = info.Width;
signal.height = info.Height; signal.height = info.Height;
@@ -362,6 +398,72 @@ namespace gvfg::internal
return GVFG_OK; return GVFG_OK;
} }
gvfg_status_t GigabyteCaptureSession::get_hdmi_info(gvfg_hdmi_info_t &out)
{
const gvfg_status_t openStatus = ensure_vendor_channel_open();
if (openStatus != GVFG_OK)
return openStatus;
GVFG_HDMI_VIDEO_INPUT_INFO info{};
{
std::lock_guard<std::mutex> captureLock(capture_mutex_);
const gvfg_status_t status = from_vendor(
GvfgGetHdmiVideoInputInfo(context_, channel_, &info), "GvfgGetHdmiVideoInputInfo");
if (status != GVFG_OK)
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;
out.fps = info.Fps;
out.color_format = info.ColorFormat;
out.color_space = info.ColorSpace;
out.bit_depth = info.BitsPerPixel;
std::snprintf(out.fps_name, sizeof(out.fps_name), "%" PRIu32, out.fps);
strncpy_s(out.color_format_name, hdmi_color_format_name(out.color_format), _TRUNCATE);
strncpy_s(out.color_space_name, hdmi_color_space_name(out.color_space), _TRUNCATE);
return GVFG_OK;
}
gvfg_status_t GigabyteCaptureSession::get_chip_info(gvfg_chip_info_t &out)
{
const gvfg_status_t openStatus = ensure_vendor_channel_open();
if (openStatus != GVFG_OK)
return openStatus;
GVFG_CHIP_INFO info{};
std::lock_guard<std::mutex> captureLock(capture_mutex_);
const gvfg_status_t status = from_vendor(GvfgGetChipInfo(context_, &info), "GvfgGetChipInfo");
if (status == GVFG_OK)
{
out.version_date = info.VerDate;
out.version_time = info.VerTime;
}
return status;
}
gvfg_status_t GigabyteCaptureSession::set_user_led(bool on)
{
const gvfg_status_t openStatus = ensure_vendor_channel_open();
if (openStatus != GVFG_OK)
return openStatus;
std::lock_guard<std::mutex> captureLock(capture_mutex_);
return from_vendor(GvfgSetLed(context_, on ? 1u : 0u), "GvfgSetLed");
}
gvfg_status_t GigabyteCaptureSession::get_sdi_info(gvfg_sdi_info_t &out) gvfg_status_t GigabyteCaptureSession::get_sdi_info(gvfg_sdi_info_t &out)
{ {
const gvfg_status_t openStatus = ensure_vendor_channel_open(); const gvfg_status_t openStatus = ensure_vendor_channel_open();
@@ -50,6 +50,9 @@ namespace gvfg::internal
void get_cached_signal_status(gvfg_signal_status_t &out) const; void get_cached_signal_status(gvfg_signal_status_t &out) const;
gvfg_status_t get_device_capabilities(gvfg_debug_device_capabilities_t &out); gvfg_status_t get_device_capabilities(gvfg_debug_device_capabilities_t &out);
gvfg_status_t get_sdi_info(gvfg_sdi_info_t &out); gvfg_status_t get_sdi_info(gvfg_sdi_info_t &out);
gvfg_status_t get_hdmi_info(gvfg_hdmi_info_t &out);
gvfg_status_t get_chip_info(gvfg_chip_info_t &out);
gvfg_status_t set_user_led(bool on);
gvfg_status_t get_audio_format(GigabyteAudioInfo &out); gvfg_status_t get_audio_format(GigabyteAudioInfo &out);
gvfg_status_t set_event_callback(GigabyteEventCallback callback, void *user); gvfg_status_t set_event_callback(GigabyteEventCallback callback, void *user);
gvfg_status_t configure_stream(); gvfg_status_t configure_stream();
+140 -9
View File
@@ -1,5 +1,9 @@
#include "gvfg_capture.h" #include "gvfg_capture.h"
#ifdef GVFG_CAPTURE_TEST_RUNTIME
#include "gvfg_test_device.h"
#endif
#include "gvfg_debug.h" #include "gvfg_debug.h"
#include "gigabyte_capture_session.h" #include "gigabyte_capture_session.h"
#include "gpu/gvfg_gpu_osd.h" #include "gpu/gvfg_gpu_osd.h"
@@ -952,7 +956,7 @@ struct gvfg_handle_t
return channels[GVFG_CHANNEL_1].get(); return channels[GVFG_CHANNEL_1].get();
} }
gvfg_status_t openChannel(int index, int channelIndex) gvfg_status_t openChannel(int index, int channelIndex, const std::wstring *requestedPath = nullptr)
{ {
if (channelIndex != GVFG_CHANNEL_0 && channelIndex != GVFG_CHANNEL_1) if (channelIndex != GVFG_CHANNEL_0 && channelIndex != GVFG_CHANNEL_1)
return GVFG_EINVAL; return GVFG_EINVAL;
@@ -962,7 +966,8 @@ struct gvfg_handle_t
channelErrors[slot].set("gvfg_open_channel rejected: device index is invalid"); channelErrors[slot].set("gvfg_open_channel rejected: device index is invalid");
return GVFG_EINVAL; return GVFG_EINVAL;
} }
if (currentIndex >= 0 && currentIndex != index) if (currentIndex >= 0 && (currentIndex != index ||
(requestedPath && devicePath != *requestedPath)))
{ {
channelErrors[slot].set("gvfg_open_channel rejected: handle is already bound to another device"); channelErrors[slot].set("gvfg_open_channel rejected: handle is already bound to another device");
return GVFG_ESTATE; return GVFG_ESTATE;
@@ -976,7 +981,7 @@ struct gvfg_handle_t
const gvfg_status_t status = channel->open(index, const gvfg_status_t status = channel->open(index,
channelIndex, channelIndex,
devicePath.empty() ? nullptr : &devicePath); devicePath.empty() ? requestedPath : &devicePath);
if (status != GVFG_OK) if (status != GVFG_OK)
return status; return status;
@@ -1073,6 +1078,35 @@ struct gvfg_handle_t
extern "C" extern "C"
{ {
#ifdef GVFG_CAPTURE_TEST_RUNTIME
int gvfg_test_enumerate_devices(gvfg_test_device_t *devices, int capacity)
{
if (!devices || capacity <= 0)
return 0;
int written = 0;
for (const auto &device : enumerate_gigabyte_devices())
{
if (written == capacity)
break;
gvfg_test_device_t entry{};
if (device.interface_path.empty() ||
wcscpy_s(entry.interface_path, device.interface_path.c_str()) != 0)
continue;
wcsncpy_s(entry.name, device.friendly_name.c_str(), _TRUNCATE);
devices[written++] = entry;
}
return written;
}
gvfg_status_t gvfg_test_open_channel(gvfg_handle handle, const wchar_t *interface_path, int channel)
{
if (!handle || !interface_path || !*interface_path)
return GVFG_EINVAL;
const std::wstring path(interface_path);
return handle->openChannel(0, channel, &path);
}
#endif
int gvfg_enumerate_devices(gvfg_device_info_t *out_devices, int max_devices) int gvfg_enumerate_devices(gvfg_device_info_t *out_devices, int max_devices)
{ {
const std::vector<gvfg::internal::GigabyteDevice> devices = const std::vector<gvfg::internal::GigabyteDevice> devices =
@@ -1212,13 +1246,11 @@ extern "C"
catch (...) { return GVFG_EIO; } catch (...) { return GVFG_EIO; }
} }
gvfg_status_t gvfg_render_osd_bgra(const gvfg_channel_osd_config_t *config, static gvfg_status_t renderOsdBgraTile(const gvfg_channel_osd_config_t *config,
gvfg_osd_bitmap_t *out_bitmap) gvfg_osd_bitmap_t *out_bitmap,
std::vector<uint8_t> &pixels)
{ {
thread_local std::vector<uint8_t> pixels; if (!config || !config->text)
pixels.clear();
if (out_bitmap) *out_bitmap = {};
if (!config || !config->text || !out_bitmap)
return GVFG_EINVAL; return GVFG_EINVAL;
const size_t length = strnlen_s(config->text, GVFG_OSD_MAX_TEXT_CHARACTERS + 1u); const size_t length = strnlen_s(config->text, GVFG_OSD_MAX_TEXT_CHARACTERS + 1u);
if (length == 0 || length > GVFG_OSD_MAX_TEXT_CHARACTERS) if (length == 0 || length > GVFG_OSD_MAX_TEXT_CHARACTERS)
@@ -1265,6 +1297,61 @@ extern "C"
catch (...) { return GVFG_EIO; } catch (...) { return GVFG_EIO; }
} }
gvfg_status_t gvfg_render_osd_frame_bgra(uint32_t video_width, uint32_t video_height,
const gvfg_channel_osd_config_t *slot0,
const gvfg_channel_osd_config_t *slot1,
gvfg_osd_bitmap_t *out_bitmap)
{
thread_local std::vector<uint8_t> frame;
frame.clear();
if (!out_bitmap)
return GVFG_EINVAL;
*out_bitmap = {};
const uint64_t stride = static_cast<uint64_t>(video_width) * 4u;
if (!video_width || !video_height || stride > UINT32_MAX ||
stride * video_height > UINT32_MAX ||
stride * video_height > (std::numeric_limits<size_t>::max)())
return GVFG_EINVAL;
try
{
frame.assign(static_cast<size_t>(stride * video_height), 0);
std::vector<uint8_t> tilePixels;
for (const auto *slot : {slot0, slot1})
{
if (!slot)
continue;
gvfg_osd_bitmap_t tile{};
const auto status = renderOsdBgraTile(slot, &tile, tilePixels);
if (status != GVFG_OK)
return status;
if (tile.width > video_width || tile.height > video_height)
continue;
const size_t x = std::clamp<int64_t>(slot->x, 0, video_width - tile.width);
const size_t y = std::clamp<int64_t>(slot->y, 0, video_height - tile.height);
for (uint32_t row = 0; row < tile.height; ++row)
{
const auto *src = tile.data + static_cast<size_t>(row) * tile.stride;
auto *dst = frame.data() + (y + row) * static_cast<size_t>(stride) + x * 4u;
for (uint32_t col = 0; col < tile.width; ++col, src += 4, dst += 4)
{
if (!src[3])
continue;
// Both layers are premultiplied, including at glyph edges.
const unsigned remaining = 255u - src[3];
for (unsigned c = 0; c < 4; ++c)
dst[c] = static_cast<uint8_t>(src[c] + (dst[c] * remaining + 127u) / 255u);
}
}
}
*out_bitmap = {frame.data(), frame.size(), video_width, video_height,
static_cast<uint32_t>(stride)};
return GVFG_OK;
}
catch (...) { return GVFG_EIO; }
}
gvfg_status_t gvfg_set_channel_osd(gvfg_handle handle, int channel_index, gvfg_status_t gvfg_set_channel_osd(gvfg_handle handle, int channel_index,
uint32_t osd_index, const gvfg_channel_osd_config_t *config) uint32_t osd_index, const gvfg_channel_osd_config_t *config)
{ {
@@ -1549,6 +1636,39 @@ extern "C"
return channel->session->get_sdi_info(*out_info); return channel->session->get_sdi_info(*out_info);
} }
gvfg_status_t gvfg_get_channel_hdmi_info(
gvfg_handle handle, int channel_index, gvfg_hdmi_info_t *out_info)
{
if (!handle || (channel_index != GVFG_CHANNEL_0 && channel_index != GVFG_CHANNEL_1))
return GVFG_EINVAL;
if (!out_info)
return handle->rejectChannel(
channel_index, GVFG_EINVAL,
"gvfg_get_channel_hdmi_info rejected: out_info is null");
*out_info = {};
auto *channel = handle->findChannel(channel_index);
if (!channel || !channel->session)
return handle->rejectChannel(
channel_index, GVFG_ESTATE,
"gvfg_get_channel_hdmi_info rejected: channel is not open");
return channel->session->get_hdmi_info(*out_info);
}
gvfg_status_t gvfg_get_chip_info(gvfg_handle handle, gvfg_chip_info_t *out_info)
{
if (!handle)
return GVFG_EINVAL;
if (!out_info)
return handle->rejectAllChannels(GVFG_EINVAL,
"gvfg_get_chip_info rejected: out_info is null");
*out_info = {};
auto *channel = handle->findOpenChannel();
if (!channel || !channel->session)
return handle->rejectAllChannels(GVFG_ESTATE,
"gvfg_get_chip_info rejected: device is not open");
return channel->session->get_chip_info(*out_info);
}
const char *gvfg_get_version(void) const char *gvfg_get_version(void)
{ {
return GVFG_VERSION_STRING; return GVFG_VERSION_STRING;
@@ -1618,6 +1738,17 @@ extern "C"
return GVFG_OK; return GVFG_OK;
} }
gvfg_status_t gvfg_debug_set_user_led(gvfg_handle handle, int on)
{
if (!handle || (on != 0 && on != 1))
return GVFG_EINVAL;
auto *channel = handle->findOpenChannel();
if (!channel || !channel->session)
return handle->rejectAllChannels(GVFG_ESTATE,
"gvfg_debug_set_user_led rejected: device is not open");
return channel->session->set_user_led(on != 0);
}
gvfg_status_t gvfg_debug_get_device_capabilities( gvfg_status_t gvfg_debug_get_device_capabilities(
gvfg_handle handle, gvfg_debug_device_capabilities_t *out_capabilities) gvfg_handle handle, gvfg_debug_device_capabilities_t *out_capabilities)
{ {
+17
View File
@@ -0,0 +1,17 @@
#pragma once
#include "gvfg_capture.h"
// Private interface compiled only into the capture-test runtime.
struct gvfg_test_device_t
{
wchar_t interface_path[1024];
wchar_t name[256];
};
extern "C"
{
GVFG_API int gvfg_test_enumerate_devices(gvfg_test_device_t *devices, int capacity);
GVFG_API gvfg_status_t gvfg_test_open_channel(gvfg_handle handle,
const wchar_t *interface_path, int channel);
}
Binary file not shown.
+2 -3
View File
@@ -3,10 +3,9 @@
This directory contains the supervisor-provided static MSVC library used by the This directory contains the supervisor-provided static MSVC library used by the
GVFG backend. GVFG backend.
- Upstream version macro: `GVFG_SDK_VER 1.0.2` - Upstream version macro: `GVFG_SDK_VER 1.0.4`
- Library: `GvfgSdk.lib` - Library: `GvfgSdk.lib`
- SHA-256: `EC9577D4BE76861E44DFDD3B537DF2A57CCDA5A5F1B14E0BAAC92213E796A743` - SHA-256: `0BE490FB11C4509716B1281F4EE6E5D5793FB6938C432D2A5619088F26F720BF`
- Original source: `ex_demo/GigabyteLib/vfg100_0914_b`
`GvfgSdk.lib` is linked into `gvfg.dll`; it is not distributed as a separate `GvfgSdk.lib` is linked into `gvfg.dll`; it is not distributed as a separate
customer runtime dependency. The supplied package did not contain source, customer runtime dependency. The supplied package did not contain source,
+1 -1
View File
@@ -29,7 +29,7 @@ extern "C" {
#define GVFG_PARAM_OUT #define GVFG_PARAM_OUT
#define GVFG_SDK_API #define GVFG_SDK_API
#define GVFG_SDK_VER "1.0.3" #define GVFG_SDK_VER "1.0.4"
#ifdef __cplusplus #ifdef __cplusplus
+140
View File
@@ -43,6 +43,49 @@ extern "C" {
typedef struct _GVFG_CONTEXT GVFG_CONTEXT, *PGVFG_CONTEXT; typedef struct _GVFG_CONTEXT GVFG_CONTEXT, *PGVFG_CONTEXT;
// HDMI Video color format
typedef enum
{
GVFG_HDMI_CS_DEFAULT_RGB = (0<<6)+0, // 0x00 */
GVFG_HDMI_CS_RGB = (2<<6)+0, // 0x80 */
GVFG_HDMI_CS_YUV_601 = (1<<6)+1, // 0x41 */
GVFG_HDMI_CS_YUV_709 = (1<<6)+2, // 0x42 */
GVFG_HDMI_CS_YCC_601 = (1<<6)+3+(0<<2), // 0x43 */
GVFG_HDMI_CS_YCC_709 = (1<<6)+3+(1<<2), // 0x47 */
GVFG_HDMI_CS_SYCC_601 = (1<<6)+3+(2<<2), // 0x4B */
GVFG_HDMI_CS_ADOBE_YCC_601 = (1<<6)+3+(3<<2), // 0x4F */
GVFG_HDMI_CS_ADOBE_RGB = (1<<6)+3+(4<<2), // 0x53 */
GVFG_HDMI_CS_BT2020_YCC = (1<<6)+3+(5<<2), // 0x57 */
GVFG_HDMI_CS_BT2020_RGB = (1<<6)+3+(6<<2), // 0x5B */
GVFG_HDMI_CS_LIM_RGB = (1<<6)+0, // 0x40 */
GVFG_HDMI_CS_LIM_YUV_601 = (0<<6)+1, // 0x01 */
GVFG_HDMI_CS_LIM_YUV_709 = (0<<6)+2, // 0x02 */
GVFG_HDMI_CS_LIM_YCC_601 = (0<<6)+3+(0<<2), // 0x03 */
GVFG_HDMI_CS_LIM_YCC_709 = (0<<6)+3+(1<<2), // 0x07 */
GVFG_HDMI_CS_LIM_SYCC_601 = (0<<6)+3+(2<<2), // 0x0B */
GVFG_HDMI_CS_LIM_ADOBE_YCC_601 = (0<<6)+3+(3<<2), // 0x0F */
GVFG_HDMI_CS_LIM_ADOBE_RGB = (0<<6)+3+(4<<2), // 0x13 */
GVFG_HDMI_CS_LIM_BT2020_YCC = (0<<6)+3+(5<<2), // 0x17 */
GVFG_HDMI_CS_LIM_BT2020_RGB = (0<<6)+3+(6<<2), // 0x1B */
GVFG_HDMI_CS_AUTO = 255
} GVFG_HDMI_VIDEO_CS;
// HDMI Video color space
typedef enum
{
GVFG_HDMI_CF_RGB = 0,
GVFG_HDMI_CF_YUV_422 = 1,
GVFG_HDMI_CF_YUV_444 = 2,
GVFG_HDMI_CF_YUV_420 = 3,
GVFG_HDMI_CF_INVALID = 15
} GVFG_HDMI_VIDEO_CF;
// SDK API return code. // SDK API return code.
typedef enum GVFG_HRESULT { typedef enum GVFG_HRESULT {
@@ -100,6 +143,21 @@ typedef enum GVFG_HRESULT {
((ULONG)(UCHAR)(ch3) << 24)) ((ULONG)(UCHAR)(ch3) << 24))
/* GvfgGetChipInfo(...) parameter.
*
* Chip version information
*/
typedef struct _GVFG_CHIP_INFO {
// Data are in hex
UINT32 VerDate;
UINT32 VerTime;
} GVFG_CHIP_INFO, *PGVFG_CHIP_INFO;
/* GvfgGetDevInfo(...) parameter. /* GvfgGetDevInfo(...) parameter.
* *
* Device information * Device information
@@ -270,6 +328,21 @@ typedef struct _GVFG_SDI_VIDEO_INFO_STR {
typedef struct _GVFG_HDMI_VIDEO_INPUT_INFO {
UINT32 VideoSignalLock; // 0: signal is not locked.
// 1: signal is locked.
UINT32 Width; // pixels
UINT32 Height; // pixels
UINT32 Fps;
UINT32 ColorFormat; // GVFG_HDMI_VIDEO_CF;
UINT32 ColorSpace; // GVFG_HDMI_VIDEO_CS
UINT32 BitsPerPixel; // Color Depth: 8, 10, 12
} GVFG_HDMI_VIDEO_INPUT_INFO, *PGVFG_HDMI_VIDEO_INPUT_INFO;
/********************************************************************* /*********************************************************************
* FUNCTION: Create events notify handles. * FUNCTION: Create events notify handles.
* PURPOSE: Driver uses these handles to notify user active events. * PURPOSE: Driver uses these handles to notify user active events.
@@ -356,6 +429,26 @@ GVFG_SDK_API GVFG_HRESULT GvfgOpenDev(GVFG_PARAM_IN HANDLE hDev,
GVFG_SDK_API GVFG_HRESULT GvfgCloseDev(GVFG_PARAM_IN PGVFG_CONTEXT *pCxt); GVFG_SDK_API GVFG_HRESULT GvfgCloseDev(GVFG_PARAM_IN PGVFG_CONTEXT *pCxt);
/*********************************************************************
* FUNCTION: Get Gigabyte chip information.
*
*
* PURPOSE: Get the chip's version in timestamp format
*
* PARAMS: pCxt - Gigabyte device context.
* Device context created by the GvfgOpenDev(...).
*
* pChipInfo - Chip information.
*
* RETURNS: GVFG_HRESULT_OK: success.
* other: failure.
*
*********************************************************************/
GVFG_SDK_API GVFG_HRESULT GvfgGetChipInfo(GVFG_PARAM_IN PGVFG_CONTEXT pCxt,
GVFG_PARAM_OUT PGVFG_CHIP_INFO pChipInfo);
/********************************************************************* /*********************************************************************
* FUNCTION: Get Gigabyte device information. * FUNCTION: Get Gigabyte device information.
* *
@@ -738,6 +831,53 @@ GVFG_SDK_API GVFG_HRESULT GvfgSetVideoColorDepth(GVFG_PARAM_IN PGVFG_CONTEXT pCx
/*********************************************************************
* FUNCTION: Get HDMI video interface information.
*
*
* PURPOSE: This is the video input information, decoding from the HDMI payload stream.
*
* PARAMS: pCxt - Gigabyte device context.
* Device context created by the GvfgOpenDev(...)
*
* videoChn - video channel index.
*
* pHdmiInfo - HDMI video input information.
*
*
* RETURNS: GVFG_HRESULT_OK: success.
* other: failure.
*
*********************************************************************/
GVFG_SDK_API GVFG_HRESULT GvfgGetHdmiVideoInputInfo(GVFG_PARAM_IN PGVFG_CONTEXT pCxt,
GVFG_PARAM_IN ULONG videoChn,
GVFG_PARAM_OUT PGVFG_HDMI_VIDEO_INPUT_INFO pHdmiInfo);
/*********************************************************************
* FUNCTION: Set user LED ON/OFF
*
*
* PURPOSE: This is a LED for user to control.
*
* PARAMS: pCxt - Gigabyte device context.
* Device context created by the GvfgOpenDev(...)
*
* On - 1: Led on, 0: LED off
*
*
* RETURNS: GVFG_HRESULT_OK: success.
* other: failure.
*
*********************************************************************/
GVFG_SDK_API GVFG_HRESULT GvfgSetLed(GVFG_PARAM_IN PGVFG_CONTEXT pCxt, GVFG_PARAM_IN ULONG On);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
+2 -2
View File
@@ -1,6 +1,6 @@
# GVFG 客戶 API 使用手冊 # GVFG 客戶 API 使用手冊
本文件說明 SDK 3.0.0 的公開擷取介面 `gvfg_capture.h`。 本文件說明 SDK 3.1.0 的公開擷取介面 `gvfg_capture.h`。
影像/音訊/同步播放另使用 `gvfg_playback.h`,完整流程見 影像/音訊/同步播放另使用 `gvfg_playback.h`,完整流程見
[統一影音播放使用手冊](GVFG_PLAYBACK_API.md)。Capture 與 Playback 是不同 handle 與 DLL。 [統一影音播放使用手冊](GVFG_PLAYBACK_API.md)。Capture 與 Playback 是不同 handle 與 DLL。
@@ -145,7 +145,7 @@ Windows `FAILED()`/`SUCCEEDED()`。
可用 `gvfg_strerror()` 取得靜態英文說明字串;呼叫端不可釋放該字串。 可用 `gvfg_strerror()` 取得靜態英文說明字串;呼叫端不可釋放該字串。
可用 `gvfg_get_version()` 查詢目前實際載入的 `gvfg.dll` 版本。回傳值為 可用 `gvfg_get_version()` 查詢目前實際載入的 `gvfg.dll` 版本。回傳值為
靜態字串,例如 `"3.0.0"`,呼叫端不可釋放。 靜態字串,例如 `"3.1.0"`,呼叫端不可釋放。
需要記錄最近一次失敗的詳細原因時,可在 API 失敗後立即呼叫 需要記錄最近一次失敗的詳細原因時,可在 API 失敗後立即呼叫
`gvfg_get_channel_last_sdk_error_detail()`。此 API 回傳可供問題回報使用的公開診斷文字。 `gvfg_get_channel_last_sdk_error_detail()`。此 API 回傳可供問題回報使用的公開診斷文字。
@@ -1,6 +1,6 @@
# GVFG 客戶 API Reference # GVFG 客戶 API Reference
SDK 3.0.0。Capture 與 Playback 使用各自的 API 與狀態碼。 SDK 3.1.0。Capture 與 Playback 使用各自的 API 與狀態碼。
本版含不相容的 OSD 介面更新,並移除公開的 Playback 核心與 Preview delivery 詳細統計查詢。 本版含不相容的 OSD 介面更新,並移除公開的 Playback 核心與 Preview delivery 詳細統計查詢。
使用本版 header、import library 與 DLL 重新編譯;不可混用 SDK 2.x 二進位檔案。 使用本版 header、import library 與 DLL 重新編譯;不可混用 SDK 2.x 二進位檔案。
@@ -350,6 +350,47 @@ gvfg_status_t gvfg_get_channel_sdi_info(
- `GVFG_ESTATE`:指定 channel 尚未 open。 - `GVFG_ESTATE`:指定 channel 尚未 open。
- 裝置查詢失敗時可能回傳 `GVFG_EIO`。 - 裝置查詢失敗時可能回傳 `GVFG_EIO`。
### HDMI 輸入資訊與晶片版本
```c
gvfg_status_t gvfg_get_channel_hdmi_info(
gvfg_handle handle, int channel_index, gvfg_hdmi_info_t *out_info);
gvfg_status_t gvfg_get_chip_info(gvfg_handle handle, gvfg_chip_info_t *out_info);
```
- 以 `gvfg_get_channel_signal_status()` 的 `video_interface` 選擇 SDI 或 HDMI 查詢。
HDMI 查詢要求指定 channel 已 open,回傳來源鎖定狀態、寬高、FPS、色彩格式、
色彩空間及位深。來源位深與 DMA 輸出位深可不同。
- HDMI 的 `fps_name`、`color_format_name` 和 `color_space_name` 可直接顯示。
HDMI 的 `fps` 是每秒幀數,例如 `60`,`fps_name` 是對應的十進位文字 `"60"`。
色彩名稱範例為 `YUV 4:2:2` 和 `BT.2020 RGB (Limited)`。
- 晶片版本屬於裝置,只需同一 handle 至少有一個 channel 已 open。
日期與時間保留原始 32-bit 數值,將十六進位數字分別讀作 `YYYYMMDD` 和 `HHMMSS`。
例如 `0x20261113`、`0x174645` 顯示為 `2026-11-13 17:46:45`。
- 兩支 API 都要求非 NULL 的 handle 和輸出指標,否則回傳 `GVFG_EINVAL`。
查詢所需的 channel 尚未 open 時回傳 `GVFG_ESTATE`。
只有回傳 `GVFG_OK` 時才可使用輸出資料。
```c
#include <inttypes.h>
#include <stdio.h>
#include <gvfg_capture.h>
void print_chip_info(gvfg_handle handle)
{
gvfg_chip_info_t info = {0};
if (gvfg_get_chip_info(handle, &info) == GVFG_OK) {
char date[9];
char time[9];
int date_len = snprintf(date, sizeof date, "%08" PRIX32, info.version_date);
int time_len = snprintf(time, sizeof time, "%06" PRIX32, info.version_time);
if (date_len == 8 && time_len == 6)
printf("Chip version: %.4s-%.2s-%.2s %.2s:%.2s:%.2s\n",
date, date + 4, date + 6, time, time + 2, time + 4);
}
}
```
### 2.6 Zero-copy mode selection ### 2.6 Zero-copy mode selection
```c ```c
@@ -612,7 +653,7 @@ const char *gvfg_get_version(void);
const char *gvfg_get_gigabyte_lib_version(void); const char *gvfg_get_gigabyte_lib_version(void);
``` ```
- 回傳目前實際載入的 GVFG runtime DLL 版本,例如 `"3.0.0"`。 - 回傳目前實際載入的 GVFG runtime DLL 版本,例如 `"3.1.0"`。
- 回傳值是靜態 null-terminated 字串,caller 不可 free。 - 回傳值是靜態 null-terminated 字串,caller 不可 free。
- 可用於 log、問題回報,以及確認 header、DLL 是否來自同一版本。 - 可用於 log、問題回報,以及確認 header、DLL 是否來自同一版本。
- `gvfg_get_gigabyte_lib_version()` 回傳編譯進目前 runtime 的 GigabyteLib 版本常數, - `gvfg_get_gigabyte_lib_version()` 回傳編譯進目前 runtime 的 GigabyteLib 版本常數,
@@ -163,7 +163,10 @@ try {
if ((Get-Item -LiteralPath $temporaryPdf).Length -lt 10000) { if ((Get-Item -LiteralPath $temporaryPdf).Length -lt 10000) {
throw 'The generated PDF is unexpectedly small.' throw 'The generated PDF is unexpectedly small.'
} }
Copy-Item -LiteralPath $temporaryPdf -Destination $OutputPdf -Force $bundledPython = Join-Path $env:USERPROFILE '.cache/codex-runtimes/codex-primary-runtime/dependencies/python/python.exe'
$python = if (Test-Path -LiteralPath $bundledPython) { $bundledPython } else { (Get-Command python.exe -ErrorAction Stop).Source }
& $python (Join-Path $scriptDir 'build_api_reference_pdf.py') --add-bookmarks $htmlPath $temporaryPdf $OutputPdf
if ($LASTEXITCODE -ne 0) { throw 'PDF bookmark generation failed (requires Python and pypdf).' }
Write-Host "PDF created: $OutputPdf" -ForegroundColor Green Write-Host "PDF created: $OutputPdf" -ForegroundColor Green
} finally { } finally {
if (Test-Path -LiteralPath $temporaryRoot) { if (Test-Path -LiteralPath $temporaryRoot) {
@@ -133,6 +133,43 @@ def extract_banner(template_docx: Path) -> bytes:
raise RuntimeError("Branding template does not contain word/media/image1.jpeg") from error raise RuntimeError("Branding template does not contain word/media/image1.jpeg") from error
def add_pdf_bookmarks(body: str, source_pdf: Path, output_pdf: Path) -> None:
"""Reuse Edge's named destinations so bookmarks land at heading positions."""
from pypdf import PdfReader, PdfWriter
from pypdf.generic import Fit
reader = PdfReader(source_pdf)
writer = PdfWriter()
writer.clone_document_from_reader(reader)
destinations = reader.named_destinations
parent = None
count = 0
for match in re.finditer(r'<h([23])\s+id="(section-\d+)">(.*?)</h\1>', body, re.DOTALL):
level, section_id, inner = match.groups()
title = html.unescape(re.sub(r"<[^>]+>", "", inner)).strip()
destination = destinations.get('/' + section_id)
if destination is None:
destination = destinations.get(section_id)
if destination is None:
raise RuntimeError(f"PDF heading destination not found: {section_id}")
page = reader.get_destination_page_number(destination)
if page is None:
raise RuntimeError(f"PDF heading page not found: {section_id}")
bookmark = writer.add_outline_item(
title, page, parent=parent if level == '3' else None,
fit=Fit.xyz(destination.left, destination.top, destination.zoom),
)
if level == '2':
parent = bookmark
count += 1
if not count:
raise RuntimeError("No chapter headings found for PDF bookmarks.")
writer.page_mode = '/UseOutlines'
with output_pdf.open('wb') as stream:
writer.write(stream)
print(f"PDF bookmarks created: {count}")
def build_pdf(input_markdown: Path, output_pdf: Path, template_docx: Path) -> None: def build_pdf(input_markdown: Path, output_pdf: Path, template_docx: Path) -> None:
for required in (input_markdown, template_docx): for required in (input_markdown, template_docx):
if not required.is_file(): if not required.is_file():
@@ -187,7 +224,7 @@ def build_pdf(input_markdown: Path, output_pdf: Path, template_docx: Path) -> No
details = completed.stderr.decode(errors="replace").strip() details = completed.stderr.decode(errors="replace").strip()
raise RuntimeError(f"Microsoft Edge did not create a valid PDF. {details}") raise RuntimeError(f"Microsoft Edge did not create a valid PDF. {details}")
shutil.copyfile(plain_pdf, output_pdf) add_pdf_bookmarks(body, plain_pdf, output_pdf)
if not output_pdf.is_file() or output_pdf.stat().st_size < 10_000: if not output_pdf.is_file() or output_pdf.stat().st_size < 10_000:
raise RuntimeError("The generated PDF is missing or unexpectedly small.") raise RuntimeError("The generated PDF is missing or unexpectedly small.")
@@ -195,11 +232,18 @@ def build_pdf(input_markdown: Path, output_pdf: Path, template_docx: Path) -> No
def main() -> None: def main() -> None:
script_dir = Path(__file__).resolve().parent script_dir = Path(__file__).resolve().parent
parser = argparse.ArgumentParser(description=__doc__) parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--add-bookmarks', action='store_true', help='Add bookmarks using HTML, input PDF, and output PDF positional arguments.')
parser.add_argument("input_markdown", nargs="?", type=Path, default=script_dir / "GVFG_CUSTOMER_API_REFERENCE.md") parser.add_argument("input_markdown", nargs="?", type=Path, default=script_dir / "GVFG_CUSTOMER_API_REFERENCE.md")
parser.add_argument("output_pdf", nargs="?", type=Path) parser.add_argument("output_pdf", nargs="?", type=Path)
parser.add_argument("template_docx", nargs="?", type=Path, default=script_dir / "GVFG_CUSTOMER_API_REFERENCE.docx") parser.add_argument("template_docx", nargs="?", type=Path, default=script_dir / "GVFG_CUSTOMER_API_REFERENCE.docx")
args = parser.parse_args() args = parser.parse_args()
if args.add_bookmarks:
if args.output_pdf is None:
parser.error('--add-bookmarks requires HTML, input PDF, and output PDF paths')
add_pdf_bookmarks(args.input_markdown.read_text(encoding='utf-8'), args.output_pdf, args.template_docx)
return
input_markdown = args.input_markdown.resolve() input_markdown = args.input_markdown.resolve()
output_pdf = (args.output_pdf or input_markdown.with_suffix(".pdf")).resolve() output_pdf = (args.output_pdf or input_markdown.with_suffix(".pdf")).resolve()
build_pdf(input_markdown, output_pdf, args.template_docx.resolve()) build_pdf(input_markdown, output_pdf, args.template_docx.resolve())
+1 -1
View File
@@ -1,6 +1,6 @@
# GVFG SDK 與 Demo 建置說明 # GVFG SDK 與 Demo 建置說明
SDK version 由 `GVFG_SDK/CMakeLists.txt` 決定,目前為 3.0.0。 SDK version 由 `GVFG_SDK/CMakeLists.txt` 決定,目前為 3.1.0。
修改共用類別的成員配置或公開 API 後,先完整重建 SDK,再清理並重建使用它的 APP。 修改共用類別的成員配置或公開 API 後,先完整重建 SDK,再清理並重建使用它的 APP。
連結成功不代表 object 使用相同的類別大小;標頭相依追蹤失效時,舊 object 可能造成 連結成功不代表 object 使用相同的類別大小;標頭相依追蹤失效時,舊 object 可能造成