Add HDMI audio input queries and split OSD into a helper in GVFG SDK 3.2

- Expose HDMI audio input information through the capture API and refresh the bundled Gigabyte library.
- Move OSD rendering into gvfg_osd.dll, connect channel OSD through the capture frame processor, and remove the experimental in-place zero-copy OSD path.
- Update playback integration, the customer API documentation, and the internal build guide.

Validation: git diff --cached --check passed. The MSVC Release SDK build passed. Capture hardware and runtime behavior were not tested.
This commit is contained in:
2026-11-25 09:35:49 +08:00
parent 7a7027391e
commit a47ab190bc
26 changed files with 1080 additions and 867 deletions
+96 -87
View File
@@ -1,104 +1,113 @@
#ifndef GVFG_OSD_H
#define GVFG_OSD_H
#pragma once
#include <stdint.h>
#include "gvfg_capture.h"
#if defined(_WIN32)
# if defined(GVFG_OSD_BUILD)
# define GVFG_OSD_API __declspec(dllexport)
# else
# define GVFG_OSD_API __declspec(dllimport)
# endif
#else
# define GVFG_OSD_API
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Strings are copied synchronously by gvfg_set_channel_osd(). */
typedef struct gvfg_channel_osd_config_t
{
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;
typedef struct gvfg_osd_bitmap_t
{
const uint8_t *data; /* SDK-owned; do not modify/free. See the render function's lifetime. */
uint64_t data_size; /* stride * height bytes. */
uint32_t width;
uint32_t height;
uint32_t stride; /* Byte distance between rows; width * 4. */
} gvfg_osd_bitmap_t;
#define GVFG_OSD_SLOT_COUNT 2u
#define GVFG_OSD_MAX_TEXT_CHARACTERS 32u
typedef void *gvfg_osd_handle;
/* 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_OSD_API gvfg_status_t gvfg_get_osd_fonts(
GVFG_PARAM_OUT gvfg_osd_font_list_t *out_list);
typedef enum gvfg_osd_status_t
{
GVFG_OSD_OK = 0,
GVFG_OSD_EINVAL = -1,
GVFG_OSD_ENOMEM = -2,
GVFG_OSD_ERENDER = -3
} gvfg_osd_status_t;
/* 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_OSD_API gvfg_status_t gvfg_measure_osd_text(
GVFG_PARAM_IN const gvfg_channel_osd_config_t *config,
GVFG_PARAM_OUT uint32_t *out_width,
GVFG_PARAM_OUT uint32_t *out_height);
typedef enum gvfg_osd_pixel_format_t
{
GVFG_OSD_PIXFMT_YUY2 = 1,
GVFG_OSD_PIXFMT_Y210 = 2
} gvfg_osd_pixel_format_t;
/* Prepare one transparent video-sized overlay for FPGA transfer. No capture
* handle needed; pass the target video width/height in pixels. Output is
* top-down BGRA8888, premultiplied alpha, stride = width * 4.
* NULL slots are omitted (hidden/unused); both NULL produce a blank frame.
* x/y are frame coordinates, clamped to fit; oversized text is skipped.
* Slot 1 is composited over slot 0. No video pixels are included.
* Data is valid until the next call to this function on the same thread
* (including failure), thread exit or DLL unload. Copy for async transfer.
* Invalid inputs/dimensions (including byte size above UINT32_MAX) return
* GVFG_EINVAL; allocation/render failures return GVFG_EIO. On failure the
* output is empty. Does not affect GPU capture OSD.
*/
GVFG_OSD_API gvfg_status_t gvfg_render_osd_frame_bgra(
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);
/*
* Generates an off-line OSD surface using the requested installed system font. Text is
* restricted to printable ASCII and at most GVFG_OSD_MAX_TEXT_CHARACTERS
* characters on one line without wrapping. color_rgb is 0xRRGGBB.
* x/y identify the top-left of the conservative measured text box (including
* glyph overhang and a one-pixel guard). They are clamped to keep that box
* inside the frame. Rendering returns EINVAL if the box cannot fit the frame.
* Output YUV uses BT.709 limited range. The mask is one coverage byte per
* pixel: 0 is transparent and 255 is fully covered.
*/
typedef struct gvfg_osd_config_t
{
uint32_t struct_size;
uint32_t width;
uint32_t height;
uint32_t pixel_format;
const char *text;
const char *font_family; /* UTF-8, NUL-terminated. */
uint32_t text_length;
int32_t x;
int32_t y;
uint32_t font_size_px;
uint32_t color_rgb;
} gvfg_osd_config_t;
/* 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_OSD_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);
/* All buffers are caller-owned and are used only for the duration of render. */
typedef struct gvfg_osd_output_t
{
uint32_t struct_size;
void *yuv_data;
uint64_t yuv_size;
uint32_t yuv_stride;
void *mask_data;
uint64_t mask_size;
uint32_t mask_stride;
} gvfg_osd_output_t;
/* visible must be 0 or 1. Retains settings and cached glyph surfaces.
* Showing an unconfigured/cleared slot returns GVFG_ESTATE.
*/
GVFG_OSD_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);
gvfg_osd_status_t gvfg_osd_create(
gvfg_osd_handle *out_handle);
void gvfg_osd_destroy(
gvfg_osd_handle handle);
/* Conservative whole-text bounds in pixels, not pixel-tight raster bounds. */
gvfg_osd_status_t gvfg_osd_measure(
gvfg_osd_handle handle,
const char *text,
uint32_t text_length,
uint32_t font_size_px,
const char *font_family,
uint32_t *out_width,
uint32_t *out_height);
/* SDK-owned snapshot, invalidated by the next call. Serialize call/read access. */
gvfg_osd_status_t gvfg_osd_get_fonts(uint32_t *out_count, const char *const **out_names);
gvfg_osd_status_t gvfg_osd_render(
gvfg_osd_handle handle,
const gvfg_osd_config_t *config,
const gvfg_osd_output_t *output);
/* Caller-owned, top-down BGRA8888 with premultiplied alpha. Ignores pixel_format.
* Unlike YUV output, width may be odd. No RGB/YUV conversion is performed.
*/
gvfg_osd_status_t gvfg_osd_render_bgra(
gvfg_osd_handle handle,
const gvfg_osd_config_t *config,
void *data, uint64_t data_size, uint32_t stride);
const char *gvfg_osd_strerror(
gvfg_osd_status_t status);
/* Disable one slot and discard its settings and cached glyph surfaces. */
GVFG_OSD_API gvfg_status_t gvfg_clear_channel_osd(
GVFG_PARAM_IN gvfg_handle handle,
GVFG_PARAM_IN int channel_index,
GVFG_PARAM_IN uint32_t osd_index);
#ifdef __cplusplus
}
#endif
#endif