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
+24 -94
View File
@@ -191,6 +191,17 @@ extern "C"
char color_space_name[32];
} gvfg_hdmi_info_t;
typedef struct
{
int connected; /* HDMI audio signal lock. */
uint32_t sample_frequency; /* HDMI audio sample-frequency code. */
uint32_t bits_per_sample;
uint32_t channels;
uint32_t format; /* HDMI audio format code. */
char sample_frequency_name[24];
char format_name[24];
} gvfg_hdmi_audio_info_t;
typedef struct
{
uint32_t version_date; /* Chip version date, interpreted in hexadecimal. */
@@ -227,35 +238,6 @@ extern "C"
uint64_t timestamp_ns; /* Monotonic SDK delivery time; same clock domain as audio. */
} gvfg_frame_t;
/* 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 struct
{
const void *data; /* PCM data. Valid until gvfg_release_channel_audio_frame(). */
@@ -394,75 +376,15 @@ extern "C"
* Select the capture output format before capture starts. Only one channel
* on a handle may select Y210 at a time; a conflicting request returns
* GVFG_EBUSY. Applications may request either channel first.
* With a locked input, success means the hardware reports the selected
* format. Without a locked input, success means the request was accepted
* and its format will be verified when capture starts.
*/
GVFG_API gvfg_status_t gvfg_set_channel_video_format(
GVFG_PARAM_IN gvfg_handle handle,
GVFG_PARAM_IN int channel_index,
GVFG_PARAM_IN gvfg_pixel_format_t format);
/* 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 gvfg_channel_osd_config_t *config,
GVFG_PARAM_OUT uint32_t *out_width,
GVFG_PARAM_OUT uint32_t *out_height);
/* 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_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);
/* 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);
/* 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 uint32_t osd_index);
/*
* Enable or disable audio for the next channel start. Video remains
* enabled; applications do not need to construct stream flag masks.
@@ -487,7 +409,8 @@ extern "C"
* - GVFG_OK on success, including when capture is already running.
* - GVFG_EINVAL if handle is NULL.
* - GVFG_ESTATE if no device is open.
* - GVFG_ETIMEOUT if a fresh signal query reports no connected input.
* - GVFG_ETIMEOUT if a fresh signal query reports no connected input or
* the hardware output format differs from the explicitly selected format.
* - GVFG_EIO or another status code if stream configuration/start fails.
*
* After success, call gvfg_read_channel_frame() to receive frames and
@@ -671,7 +594,9 @@ extern "C"
* out_status->connected set to 0. Before capture starts, this function
* refreshes the status from the capture backend. While capture is running, it returns
* the SDK cache; format-change, input-plug and input-unplug processing updates
* that cache before the corresponding public event is queued.
* that cache before the corresponding public event is queued. If the
* current state cannot be confirmed after a change, returns an error
* until the cache is valid again.
*/
GVFG_API gvfg_status_t gvfg_get_channel_signal_status(
GVFG_PARAM_IN gvfg_handle handle,
@@ -688,6 +613,11 @@ extern "C"
GVFG_PARAM_IN int channel_index,
GVFG_PARAM_OUT gvfg_hdmi_info_t *out_info);
GVFG_API gvfg_status_t gvfg_get_channel_hdmi_audio_info(
GVFG_PARAM_IN gvfg_handle handle,
GVFG_PARAM_IN int channel_index,
GVFG_PARAM_OUT gvfg_hdmi_audio_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);