Add dual-slot font-selectable OSD and privatize playback diagnostics for SDK 3.0.0

- replace the single-overlay API with two independently configured OSD slots per channel, simplify NUL-terminated text/font settings, and add explicit visibility controls that preserve cached glyphs separately from Clear

- enumerate installed Windows font families as an SDK-owned UTF-8 list without callbacks or caller-side free, refresh installed fonts on demand, and use the selected family consistently for measurement and rendering with invalid/missing-font rejection

- retain per-slot YUV and A8 mask caches, blend slot 1 over slot 0 in one GPU dispatch/readback, preserve hidden surfaces, and skip oversized slots independently while capture and the other slot continue

- move detailed playback core statistics to a private Debug-only header/export, remove the public legacy statistics query and compatibility layouts, and retain public preview/delivery statistics

- bump the SDK major version to 3.0.0 for the breaking OSD and playback API changes and document matching header, import-library and runtime deployment requirements

- refresh the capture/playback guides, internal build notes and API reference, document all 51 public Capture/Playback functions, add checked OSD usage examples, and regenerate the branded 23-page PDF

Validation: git diff --cached --check and public API documentation coverage checks passed. The regenerated PDF passed text/content checks and visual review of its rendered pages, including the OSD types, API contracts and examples. Earlier session SDK Release compilation and synthetic YUY2/Y210 blending checks passed; no new build, hardware capture, FPGA upload or long-duration runtime validation was performed during this commit pass.
This commit is contained in:
Mark.lin
2026-10-29 09:02:54 +08:00
parent bfa9397f6b
commit c8b2d0608a
24 changed files with 796 additions and 482 deletions
+45 -33
View File
@@ -207,21 +207,24 @@ extern "C"
uint64_t timestamp_ns; /* Monotonic SDK delivery time; same clock domain as audio. */
} gvfg_frame_t;
/*
* Text overlay applied by the SDK to subsequently delivered video frames.
* The text is copied by gvfg_set_channel_osd(); the caller does not need to
* keep the pointer alive after that function returns.
*/
typedef struct
/* Strings are copied synchronously by gvfg_set_channel_osd(). */
typedef struct gvfg_channel_osd_config_t
{
const char *text; /* Printable English ASCII text (0x20-0x7e). */
uint32_t text_length; /* 1 through GVFG_OSD_MAX_TEXT_CHARACTERS. */
int32_t x; /* Measured text-box left in frame pixels; clamped to fit. */
int32_t y; /* Measured text-box top in frame pixels; clamped to fit. */
uint32_t font_size_px; /* Font size in pixels; must be non-zero. */
uint32_t color_rgb; /* 0x00RRGGBB. */
const char *text; /* NUL-terminated printable ASCII, 1..32 characters. */
const char *font_family; /* NUL-terminated UTF-8 installed font family name. */
uint32_t font_size_px; /* Non-zero em size; 96-DPI rendering, not ink height. */
uint32_t color_rgb; /* 0x00RRGGBB. */
int32_t x; /* Text-box left in frame pixels; clamped to fit. */
int32_t y; /* Text-box top in frame pixels; clamped to fit. */
} gvfg_channel_osd_config_t;
typedef struct gvfg_osd_font_list_t
{
uint32_t count;
const char *const *names; /* SDK-owned UTF-8 family names; do not modify/free. */
} gvfg_osd_font_list_t;
#define GVFG_OSD_SLOT_COUNT 2u
#define GVFG_OSD_MAX_TEXT_CHARACTERS 32u
typedef struct
@@ -368,40 +371,49 @@ extern "C"
GVFG_PARAM_IN int channel_index,
GVFG_PARAM_IN gvfg_pixel_format_t format);
/*
* Measure printable ASCII text as a single non-wrapping line, using the
* same font/layout as SDK OSD. No capture handle or open device is needed.
* Returns a conservative whole-text box in pixels, including glyph
* overhang and a one-pixel guard per edge; these are not pixel-tight bounds.
* Both outputs must be non-NULL and are zeroed on failure.
* Returns GVFG_EINVAL for invalid input or unrepresentable dimensions,
* and GVFG_EIO on measurement failure.
/* Refresh installed fonts and return an SDK-owned snapshot. No device needed.
* Pointers expire at the next call (including a failed call), or DLL unload.
* Copy names before then. Serialize calls and use of this borrowed list.
* Returns an empty list on failure; no callback or caller-side free is needed.
*/
GVFG_API gvfg_status_t gvfg_get_osd_fonts(
GVFG_PARAM_OUT gvfg_osd_font_list_t *out_list);
/* Measure the same conservative text box used for rendering, including
* overhang and a one-pixel guard per edge. Ignores x/y/color; no device needed.
* Outputs are zeroed on failure. Missing font/invalid input: GVFG_EINVAL.
*/
GVFG_API gvfg_status_t gvfg_measure_osd_text(
GVFG_PARAM_IN const char *text,
GVFG_PARAM_IN uint32_t text_length,
GVFG_PARAM_IN uint32_t font_size_px,
GVFG_PARAM_IN const gvfg_channel_osd_config_t *config,
GVFG_PARAM_OUT uint32_t *out_width,
GVFG_PARAM_OUT uint32_t *out_height);
/*
* Enable or update SDK-side OSD for an opened channel. The configuration
* is copied synchronously and applies to subsequent YUY2 or Y210 frames.
* Text is rendered as BT.709 limited-range video and blended by the GPU.
* The single-line measured text box is positioned at x/y, clamped inside
* each frame. If the whole box is larger than the frame, OSD is temporarily
* skipped while capture continues. It resumes when settings or frame size
* change so that the text fits; text is not wrapped, shrunk, or truncated.
/* Set and show slot 0 or 1 on an opened channel. Strings are copied before
* return; slot 1 is blended over slot 0. Applies to subsequent YUY2/Y210
* frames using BT.709 limited range. X/Y are clamped to fit the text box.
* An oversized slot is skipped until settings/frame size allow it to fit;
* capture and the other slot continue. No wrapping/shrinking/truncation.
*/
GVFG_API gvfg_status_t gvfg_set_channel_osd(
GVFG_PARAM_IN gvfg_handle handle,
GVFG_PARAM_IN int channel_index,
GVFG_PARAM_IN uint32_t osd_index,
GVFG_PARAM_IN const gvfg_channel_osd_config_t *config);
/* Disable SDK-side OSD for subsequently delivered frames. */
/* visible must be 0 or 1. Retains settings and cached glyph surfaces.
* Showing an unconfigured/cleared slot returns GVFG_ESTATE.
*/
GVFG_API gvfg_status_t gvfg_set_channel_osd_visible(
GVFG_PARAM_IN gvfg_handle handle,
GVFG_PARAM_IN int channel_index,
GVFG_PARAM_IN uint32_t osd_index,
GVFG_PARAM_IN int visible);
/* Disable one slot and discard its settings and cached glyph surfaces. */
GVFG_API gvfg_status_t gvfg_clear_channel_osd(
GVFG_PARAM_IN gvfg_handle handle,
GVFG_PARAM_IN int channel_index);
GVFG_PARAM_IN int channel_index,
GVFG_PARAM_IN uint32_t osd_index);
/*
* Enable or disable audio for the next channel start. Video remains