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
+60 -48
View File
@@ -682,11 +682,11 @@ struct gvfg_channel_session_t
return session->set_video_format(format);
}
gvfg_status_t setOsd(const gvfg_channel_osd_config_t &config)
gvfg_status_t setOsd(uint32_t index, const gvfg_channel_osd_config_t &config)
{
if (!session)
return reject(GVFG_ESTATE, "gvfg_set_channel_osd rejected: channel is not open");
const gvfg_status_t status = osdProcessor.configure(config);
const gvfg_status_t status = osdProcessor.configure(index, config);
return status == GVFG_OK
? GVFG_OK
: reject(status, status == GVFG_EINVAL
@@ -694,12 +694,19 @@ struct gvfg_channel_session_t
: "gvfg_set_channel_osd failed to store configuration");
}
gvfg_status_t clearOsd()
gvfg_status_t clearOsd(uint32_t index)
{
if (!session)
return reject(GVFG_ESTATE, "gvfg_clear_channel_osd rejected: channel is not open");
osdProcessor.clear();
return GVFG_OK;
return osdProcessor.clear(index);
}
gvfg_status_t setOsdVisible(uint32_t index, int visible)
{
if (!session)
return reject(GVFG_ESTATE, "OSD visibility rejected: channel is not open");
const gvfg_status_t status = osdProcessor.setVisible(index, visible);
return status == GVFG_OK ? status : reject(status, "OSD visibility rejected: invalid slot, visibility, or no saved configuration");
}
gvfg_status_t setAudioEnabled(bool enabled)
@@ -1173,68 +1180,73 @@ extern "C"
return handle->setChannelVideoFormat(channel_index, format);
}
gvfg_status_t gvfg_measure_osd_text(const char *text, uint32_t text_length,
uint32_t font_size_px,
uint32_t *out_width, uint32_t *out_height)
gvfg_status_t gvfg_get_osd_fonts(gvfg_osd_font_list_t *out_list)
{
if (out_width)
*out_width = 0;
if (out_height)
*out_height = 0;
if (!text || text_length == 0 || text_length > GVFG_OSD_MAX_TEXT_CHARACTERS ||
font_size_px == 0 || !out_width || !out_height)
if (!out_list)
return GVFG_EINVAL;
for (uint32_t i = 0; i < text_length; ++i)
{
const unsigned char c = static_cast<unsigned char>(text[i]);
if (c < 0x20 || c > 0x7e)
return GVFG_EINVAL;
}
*out_list = {};
const auto status = gvfg_osd_get_fonts(&out_list->count, &out_list->names);
return status == GVFG_OSD_OK ? GVFG_OK : GVFG_EIO;
}
gvfg_status_t gvfg_measure_osd_text(const gvfg_channel_osd_config_t *config,
uint32_t *out_width, uint32_t *out_height)
{
if (out_width) *out_width = 0;
if (out_height) *out_height = 0;
if (!config || !config->text || !out_width || !out_height)
return GVFG_EINVAL;
const size_t length = strnlen_s(config->text, GVFG_OSD_MAX_TEXT_CHARACTERS + 1u);
if (length == 0 || length > GVFG_OSD_MAX_TEXT_CHARACTERS)
return GVFG_EINVAL;
try
{
gvfg_osd_handle rawHandle = nullptr;
if (gvfg_osd_create(&rawHandle) != GVFG_OSD_OK)
return GVFG_EIO;
const std::unique_ptr<void, decltype(&gvfg_osd_destroy)> helper(
rawHandle, &gvfg_osd_destroy);
const gvfg_osd_status_t status = gvfg_osd_measure(
helper.get(), text, text_length, font_size_px, out_width, out_height);
if (status == GVFG_OSD_OK)
return GVFG_OK;
return status == GVFG_OSD_EINVAL ? GVFG_EINVAL : GVFG_EIO;
}
catch (...)
{
*out_width = 0;
*out_height = 0;
return GVFG_EIO;
const std::unique_ptr<void, decltype(&gvfg_osd_destroy)> helper(rawHandle, &gvfg_osd_destroy);
const auto status = gvfg_osd_measure(helper.get(), config->text,
static_cast<uint32_t>(length), config->font_size_px, config->font_family,
out_width, out_height);
return status == GVFG_OSD_OK ? GVFG_OK :
status == GVFG_OSD_EINVAL ? GVFG_EINVAL : GVFG_EIO;
}
catch (...) { return GVFG_EIO; }
}
gvfg_status_t gvfg_set_channel_osd(gvfg_handle handle,
int channel_index,
const gvfg_channel_osd_config_t *config)
gvfg_status_t gvfg_set_channel_osd(gvfg_handle handle, int channel_index,
uint32_t osd_index, const gvfg_channel_osd_config_t *config)
{
if (!handle)
return GVFG_EINVAL;
if (!config)
return handle->rejectChannel(channel_index, GVFG_EINVAL,
"gvfg_set_channel_osd rejected: config is null");
gvfg_channel_session_t *channel = handle->findChannel(channel_index);
return channel ? channel->setOsd(*config)
: handle->rejectChannel(channel_index, GVFG_ESTATE,
"gvfg_set_channel_osd rejected: channel is not open");
if (!config || osd_index >= GVFG_OSD_SLOT_COUNT)
return handle->rejectChannel(channel_index, GVFG_EINVAL, "OSD config or index is invalid");
auto *channel = handle->findChannel(channel_index);
return channel ? channel->setOsd(osd_index, *config)
: handle->rejectChannel(channel_index, GVFG_ESTATE, "OSD channel is not open");
}
gvfg_status_t gvfg_clear_channel_osd(gvfg_handle handle, int channel_index)
gvfg_status_t gvfg_set_channel_osd_visible(gvfg_handle handle, int channel_index,
uint32_t osd_index, int visible)
{
if (!handle)
return GVFG_EINVAL;
gvfg_channel_session_t *channel = handle->findChannel(channel_index);
return channel ? channel->clearOsd()
: handle->rejectChannel(channel_index, GVFG_ESTATE,
"gvfg_clear_channel_osd rejected: channel is not open");
if (osd_index >= GVFG_OSD_SLOT_COUNT || (visible != 0 && visible != 1))
return handle->rejectChannel(channel_index, GVFG_EINVAL, "OSD index or visibility is invalid");
auto *channel = handle->findChannel(channel_index);
return channel ? channel->setOsdVisible(osd_index, visible)
: handle->rejectChannel(channel_index, GVFG_ESTATE, "OSD channel is not open");
}
gvfg_status_t gvfg_clear_channel_osd(gvfg_handle handle, int channel_index, uint32_t osd_index)
{
if (!handle)
return GVFG_EINVAL;
if (osd_index >= GVFG_OSD_SLOT_COUNT)
return handle->rejectChannel(channel_index, GVFG_EINVAL, "OSD index is invalid");
auto *channel = handle->findChannel(channel_index);
return channel ? channel->clearOsd(osd_index)
: handle->rejectChannel(channel_index, GVFG_ESTATE, "OSD channel is not open");
}
gvfg_status_t gvfg_set_channel_audio_enabled(gvfg_handle handle,