Unify playback and harden preview/audio recovery for SDK 2.1.1

- expose one gvfg_playback DLL backed by static audio and preview libraries, retain public backend data types, and remove obsolete standalone backend exports and unused wrappers

- centralize playback clocks, timestamp scheduling, optional synchronization, audio rate correction, bounded queues and fallback while preserving legacy statistics buffer sizes

- provide still-image presentation and a helper-owned NO SIGNAL card with explicit SDK connection state, native window ownership and UI-thread checks

- report monitoring failures through EAUDIO without stopping video, retain the failed output state across timeline resets, and reject audio-only startup when output is unavailable

- make clearing an unconfigured preview a successful no-op so resetting before the first frame cannot leave playback stopped

- trace actual format-change events before event resets in Debug builds and refresh video metadata after plugin stream recovery while retaining the existing temporary HDMI lock bypass

- update SDK 2.1.1 public documentation, the playback guide and rendered API reference to describe the unified lifecycle, error handling and delivery boundaries

Validation: Full SDK Release build and git diff --cached --check passed. Native tests passed for video/reset lifecycle with synchronization enabled and disabled, signal-card lifecycle, bounded queue pressure and legacy statistics guards. Process-local WASAPI failure injection verified continued video, persistent monitoring failure and audio-only rejection; real WASAPI silence playback advanced the output clock in both synchronization modes. Public exports and rendered PDF pages/portable links were checked. No hardware capture, unplug/replug or long-running acoustic A/V synchronization test was performed.
This commit is contained in:
Mark.lin
2026-10-22 14:02:43 +08:00
parent da2ad24459
commit bfa9397f6b
36 changed files with 2389 additions and 2089 deletions
@@ -1,40 +1,8 @@
#pragma once
/*
* Optional GVFG preview helper API.
*
* Standalone preview helper. Applications provide the frame buffer, pixel
* format, and row stride explicitly; gvfg_preview.dll does not depend on
* gvfg.dll.
*/
/* Public image and presentation types used by gvfg_playback.h. */
#include <stdint.h>
#ifdef _WIN32
#ifdef GVFG_PREVIEW_BUILD
#define GVFG_PREVIEW_API __declspec(dllexport)
#else
#define GVFG_PREVIEW_API __declspec(dllimport)
#endif
#else
#define GVFG_PREVIEW_API
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef enum
{
GVFG_PREVIEW_OK = 0,
GVFG_PREVIEW_EINVAL = -1,
GVFG_PREVIEW_ESTATE = -2,
GVFG_PREVIEW_ENOTSUP = -3,
GVFG_PREVIEW_ERENDER = -4
} gvfg_preview_status_t;
typedef struct gvfg_preview_handle_t *gvfg_preview_handle;
typedef enum
{
GVFG_PREVIEW_PIXFMT_YUY2 = 1,
@@ -105,69 +73,3 @@ typedef struct
uint64_t slots_busy;
uint64_t last_busy_id;
} gvfg_preview_delivery_stats_t;
GVFG_PREVIEW_API gvfg_preview_status_t gvfg_preview_get_delivery_stats(
gvfg_preview_handle handle, gvfg_preview_delivery_stats_t *out_stats);
/* Call after stopping submissions. Wait at most timeout_ms for queued work.
* Returns ESTATE if work remains; does not discard or reset counters. */
GVFG_PREVIEW_API gvfg_preview_status_t gvfg_preview_wait_idle(
gvfg_preview_handle handle, uint32_t timeout_ms);
GVFG_PREVIEW_API gvfg_preview_status_t gvfg_preview_create(
gvfg_preview_handle *out_handle);
GVFG_PREVIEW_API gvfg_preview_status_t gvfg_preview_destroy(
gvfg_preview_handle handle);
/*
* Attach a native window handle for preview output.
*
* On Windows, native_window_handle is an HWND.
*/
GVFG_PREVIEW_API gvfg_preview_status_t gvfg_preview_attach_window(
gvfg_preview_handle handle,
void *native_window_handle);
/* Pre-create GPU resources before the first captured frame is held. */
GVFG_PREVIEW_API gvfg_preview_status_t gvfg_preview_prepare(
gvfg_preview_handle handle,
int width,
int height,
int bit_depth);
/*
* Upload one frame to an internal GPU slot and queue it for preview.
*
* The frame memory remains owned by the caller and must remain valid until
* this function returns. GPU conversion and Present continue on the internal
* preview worker. Up to three pending frames are retained in FIFO order.
* Frames waiting longer than 50 ms are discarded; if the queue is full,
* the incoming frame is skipped. No SDK frame is retained for queueing.
* The age limit excludes time spent rendering or waiting inside Present.
*/
GVFG_PREVIEW_API gvfg_preview_status_t gvfg_preview_render_frame(
gvfg_preview_handle handle,
const gvfg_preview_frame_t *frame);
/* Replace the last presented frame with a solid black frame. */
GVFG_PREVIEW_API gvfg_preview_status_t gvfg_preview_clear(
gvfg_preview_handle handle);
GVFG_PREVIEW_API gvfg_preview_status_t gvfg_preview_get_info(
gvfg_preview_handle handle,
gvfg_preview_info_t *out_info);
GVFG_PREVIEW_API gvfg_preview_status_t gvfg_preview_get_stats(
gvfg_preview_handle handle,
gvfg_preview_stats_t *out_stats);
GVFG_PREVIEW_API gvfg_preview_status_t gvfg_preview_shutdown(
gvfg_preview_handle handle);
GVFG_PREVIEW_API const char *gvfg_preview_strerror(
gvfg_preview_status_t status);
#ifdef __cplusplus
}
#endif