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
+2 -2
View File
@@ -1,6 +1,6 @@
# GVFG 客戶 API 使用手冊
本文件說明 SDK 3.0.0 的公開擷取介面 `gvfg_capture.h`。
本文件說明 SDK 3.1.0 的公開擷取介面 `gvfg_capture.h`。
影像/音訊/同步播放另使用 `gvfg_playback.h`,完整流程見
[統一影音播放使用手冊](GVFG_PLAYBACK_API.md)。Capture 與 Playback 是不同 handle 與 DLL。
@@ -145,7 +145,7 @@ Windows `FAILED()`/`SUCCEEDED()`。
可用 `gvfg_strerror()` 取得靜態英文說明字串;呼叫端不可釋放該字串。
可用 `gvfg_get_version()` 查詢目前實際載入的 `gvfg.dll` 版本。回傳值為
靜態字串,例如 `"3.0.0"`,呼叫端不可釋放。
靜態字串,例如 `"3.1.0"`,呼叫端不可釋放。
需要記錄最近一次失敗的詳細原因時,可在 API 失敗後立即呼叫
`gvfg_get_channel_last_sdk_error_detail()`。此 API 回傳可供問題回報使用的公開診斷文字。
@@ -1,6 +1,6 @@
# GVFG 客戶 API Reference
SDK 3.0.0。Capture 與 Playback 使用各自的 API 與狀態碼。
SDK 3.1.0。Capture 與 Playback 使用各自的 API 與狀態碼。
本版含不相容的 OSD 介面更新,並移除公開的 Playback 核心與 Preview delivery 詳細統計查詢。
使用本版 header、import library 與 DLL 重新編譯;不可混用 SDK 2.x 二進位檔案。
@@ -350,6 +350,47 @@ gvfg_status_t gvfg_get_channel_sdi_info(
- `GVFG_ESTATE`:指定 channel 尚未 open。
- 裝置查詢失敗時可能回傳 `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
```c
@@ -612,7 +653,7 @@ const char *gvfg_get_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。
- 可用於 log、問題回報,以及確認 header、DLL 是否來自同一版本。
- `gvfg_get_gigabyte_lib_version()` 回傳編譯進目前 runtime 的 GigabyteLib 版本常數,
@@ -163,7 +163,10 @@ try {
if ((Get-Item -LiteralPath $temporaryPdf).Length -lt 10000) {
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
} finally {
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
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:
for required in (input_markdown, template_docx):
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()
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:
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:
script_dir = Path(__file__).resolve().parent
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("output_pdf", nargs="?", type=Path)
parser.add_argument("template_docx", nargs="?", type=Path, default=script_dir / "GVFG_CUSTOMER_API_REFERENCE.docx")
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()
output_pdf = (args.output_pdf or input_markdown.with_suffix(".pdf")).resolve()
build_pdf(input_markdown, output_pdf, args.template_docx.resolve())
+1 -1
View File
@@ -1,6 +1,6 @@
# GVFG SDK 與 Demo 建置說明
SDK version 由 `GVFG_SDK/CMakeLists.txt` 決定,目前為 3.0.0。
SDK version 由 `GVFG_SDK/CMakeLists.txt` 決定,目前為 3.1.0。
修改共用類別的成員配置或公開 API 後,先完整重建 SDK,再清理並重建使用它的 APP。
連結成功不代表 object 使用相同的類別大小;標頭相依追蹤失效時,舊 object 可能造成