- 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.
114 lines
4.8 KiB
C
114 lines
4.8 KiB
C
#pragma once
|
|
|
|
#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
|
|
|
|
/* 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);
|
|
|
|
/* 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);
|
|
|
|
/* 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);
|
|
|
|
/* 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);
|
|
|
|
/* 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);
|
|
|
|
/* 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
|