Introduction
WSCLib SDK is a GPU-accelerated video output framework for Windows, built on Direct3D 11. It consists of four libraries:
| Library | Description |
| WSCLib | Core rendering engine — output windows, frame submission, color/crop/flip/rotate, overlays, recording, streaming |
| WSCLibVideo | Video playback — VLC and Media Foundation backends with DXVA2/D3D11VA hardware decode |
| WSCLibInput | Camera/audio capture — webcam enumeration, WASAPI audio, automatic frame delivery |
| WSCLibWeb | Headless Chromium browser rendering via CEF — web pages as BGRA frames to WSCLib outputs |
Architecture
┌────────────────┐ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ WSCLibVideo │ │ WSCLibInput │ │ WSCLibWeb │ │ Your App │
│ (VLC / MF) │ │ (Camera/Audio) │ │ (CEF/Chromium)│ │ │
└───────┬────────┘ └────────┬─────────┘ └────────┬────────┘ └────────┬────────┘
│ AttachOutput │ AttachOutput │ AttachOutput │ SubmitFrame
▼ ▼ ▼ ▼
┌────────────────────────────────────────────────────────────────────────────────────┐
│ WSCLib │
│ D3D11 Rendering │ Video Processor │ Overlays │ Recording │ Streaming │
└────────────────────────────────────────────────────────────────────────────────────┘
Quick Start
Basic Usage (BGRA frame)
void WSC_Shutdown()
Shut down WSCLib and release all resources.
WSCResult WSC_Init()
Initialize WSCLib with the default GPU adapter.
WSCResult WSC_SubmitFrame(int outputId, const void *bgra, int width, int height, int pitch)
Submit a BGRA frame from CPU memory.
WSCResult WSC_DestroyOutput(int outputId)
Destroy an output and free its GPU resources.
int WSC_CreateOutputFromNative(HWND nativeHwnd)
Create an output bound directly to an existing native HWND.
Video Playback
void WSCV_Shutdown()
Shut down engines and destroy all players.
WSCVResult WSCV_Init()
Initialize VLC and Media Foundation engines.
int WSCV_CreatePlayerMF(const char *filePath)
Create a Media Foundation player with D3D11 hardware decode.
WSCVResult WSCV_AttachOutput(int playerId, int outputId)
Attach a WSCLib output to this player.
WSCVResult WSCV_Play(int playerId)
Start or resume playback.
WSCVResult WSCV_Stop(int playerId)
Stop playback.
WSCVResult WSCV_DestroyPlayer(int playerId)
Destroy a player and free resources.
Camera Capture
int WSCI_CreateCapture(int videoDeviceIndex, const WSCICaptureFormat *format)
Create a video capture from a device index.
WSCIResult WSCI_StartCapture(int captureId)
Start capturing frames.
WSCIResult WSCI_Init()
Initialize Media Foundation for capture.
WSCIResult WSCI_AttachOutput(int captureId, int outputId)
Attach a WSCLib output — each captured frame auto-submits to WSC_SubmitFrame().
Web Browser Rendering
while (running) {
}
int WSCW_CreateBrowser(const char *url, int width, int height)
Create an off-screen browser and navigate to a URL.
WSCWResult WSCW_DestroyBrowser(int browserId)
Destroy a browser and free resources.
WSCWResult WSCW_Init()
Initialize CEF engine.
void WSCW_DoMessageLoopWork()
Pump CEF message loop.
void WSCW_Shutdown()
Shut down CEF engine and destroy all browsers.
WSCWResult WSCW_AttachOutput(int browserId, int outputId)
Attach a WSCLib output to this browser.
Web Navigation & JavaScript
WSCWResult WSCW_SetFrameRate(int browserId, int fps)
Set the frame rate for off-screen rendering.
WSCWResult WSCW_Resize(int browserId, int width, int height)
Resize the virtual viewport.
WSCWResult WSCW_ExecuteJS(int browserId, const char *code)
Execute JavaScript code in the browser's main frame.
WSCWResult WSCW_Navigate(int browserId, const char *url)
Navigate to a new URL.
WSCWResult WSCW_Reload(int browserId)
Reload the current page.
WSCWResult WSCW_GoBack(int browserId)
Navigate back.
WSCWResult WSCW_GoForward(int browserId)
Navigate forward.
Web Mouse & Keyboard Input
Hardware Capabilities
Query capabilities at runtime:
printf("D3D11 Video Processor — NV12 zero-copy, HW color adjust\n");
printf("NVENC — hardware H.264 encoding\n");
unsigned WSC_GetCapabilities()
Query available hardware capabilities.
@ WSC_CAP_NVENC
Definition wsclib.h:447
@ WSC_CAP_VIDEO_PROC
Definition wsclib.h:450
NV12 Video Processor Path
When WSC_CAP_VIDEO_PROC is available, NV12 frames bypass the 3D pipeline entirely. Color conversion (YUV→RGB), scaling, brightness/contrast/saturation/hue adjustments, and rotation are performed by the GPU's dedicated Video engine. This shows as GPU-Copy in Task Manager instead of GPU-3D.
The NV12 path is automatic when using WSCLibVideo:
- VLC backend: Requests NV12 from VLC via format callback
- MF backend: Requests NV12 output from SourceReader, submits DXVA textures directly
Module Groups