.TH "capture_hook.h" 3 "Bark" \" -*- nroff -*- .ad l .nh .SH NAME capture_hook.h \- Bark screen and window capture provider interface\&. .SH SYNOPSIS .br .PP .SS "Classes" .in +1c .ti -1c .RI "struct \fBbark_capture_cfg\fP" .br .RI "Capture stream configuration passed to \fBbark_capture_start()\fP\&. " .ti -1c .RI "struct \fBbark_capture_source\fP" .br .RI "Selectable monitor or window descriptor returned by \fBbark_capture_list_sources()\fP\&. " .ti -1c .RI "struct \fBbark_capture_frame_meta\fP" .br .RI "Metadata produced by single-frame capture via \fBbark_capture_grab_frame()\fP\&. " .ti -1c .RI "struct \fBbark_capture_ops\fP" .br .RI "Custom screen-capture provider vtable passed to \fBbark_capture_register()\fP\&. " .in -1c .SS "Macros" .in +1c .ti -1c .RI "#define \fBBARK_CAPTURE_SOURCE_TITLE_MAX\fP 128u" .br .RI "Maximum UTF-8 byte length (including NUL) for a capture source title\&. " .ti -1c .RI "#define \fBBARK_CAPTURE_FLAG_ASYNC_ZERO_COPY\fP (1u << 0)" .br .RI "Provider uses asynchronous zero-copy media transport (e\&.g\&. browser MediaStream)\&. " .ti -1c .RI "#define \fBBARK_CAPTURE_FLAG_OS_PICKER\fP (1u << 1)" .br .RI "Provider presents a native OS or browser picker when starting with \fBBARK_CAPTURE_TARGET_PROMPT\fP\&. " .ti -1c .RI "#define \fBBARK_CAPTURE_FLAG_ENUM_SOURCES\fP (1u << 2)" .br .RI "Provider supports enumerating sources via \fBbark_capture_list_sources()\fP\&. " .in -1c .SS "Typedefs" .in +1c .ti -1c .RI "typedef struct \fBbark_capture_cfg\fP \fBbark_capture_cfg_t\fP" .br .RI "Capture stream configuration passed to \fBbark_capture_start()\fP\&. " .ti -1c .RI "typedef struct \fBbark_capture_source\fP \fBbark_capture_source_t\fP" .br .RI "Selectable monitor or window descriptor returned by \fBbark_capture_list_sources()\fP\&. " .ti -1c .RI "typedef struct \fBbark_capture_frame_meta\fP \fBbark_capture_frame_meta_t\fP" .br .RI "Metadata produced by single-frame capture via \fBbark_capture_grab_frame()\fP\&. " .ti -1c .RI "typedef void(* \fBbark_capture_frame_fn\fP) (const uint8_t *rgba, uint16_t w, uint16_t h, void *user)" .br .RI "Worker-thread RGBA8 capture frame callback\&. " .ti -1c .RI "typedef void(* \fBbark_capture_state_fn\fP) (int active, uint16_t w, uint16_t h, void *user)" .br .RI "Main-thread capture lifecycle callback driven by \fBbark_capture_poll()\fP\&. " .ti -1c .RI "typedef int(* \fBbark_capture_gate_fn\fP) (void *gate_user)" .br .RI "Optional host permission gate returning \fBBARK_OK\fP to permit or \fBBARK_ERR_UNAVAILABLE\fP to deny\&. " .ti -1c .RI "typedef struct \fBbark_capture_ops\fP \fBbark_capture_ops_t\fP" .br .RI "Custom screen-capture provider vtable passed to \fBbark_capture_register()\fP\&. " .in -1c .SS "Enumerations" .in +1c .ti -1c .RI "enum \fBbark_capture_target_kind\fP { \fBBARK_CAPTURE_TARGET_PROMPT\fP = 0u, \fBBARK_CAPTURE_TARGET_MONITOR\fP = 1u, \fBBARK_CAPTURE_TARGET_WINDOW\fP = 2u }" .br .RI "Capture target selection modes\&. " .ti -1c .RI "enum \fBbark_capture_backend\fP { \fBBARK_CAPTURE_BACKEND_NONE\fP = 0u, \fBBARK_CAPTURE_BACKEND_HEADLESS\fP = 1u, \fBBARK_CAPTURE_BACKEND_X11\fP = 2u, \fBBARK_CAPTURE_BACKEND_GDI\fP = 3u, \fBBARK_CAPTURE_BACKEND_CG\fP = 4u, \fBBARK_CAPTURE_BACKEND_WAYLAND\fP = 5u, \fBBARK_CAPTURE_BACKEND_WGC\fP = 6u, \fBBARK_CAPTURE_BACKEND_SCK\fP = 7u }" .br .RI "Active OS screen-capture backend identifier\&. " .in -1c .SS "Functions" .in +1c .ti -1c .RI "int \fBbark_capture_grab_frame\fP (uint8_t *rgba_out, uint32_t max_w, uint32_t max_h, \fBbark_capture_frame_meta_t\fP *meta_out)" .br .RI "Grab a single RGBA8 screenshot frame into caller memory\&. " .ti -1c .RI "const \fBbark_capture_ops_t\fP * \fBbark_capture_builtin_ops\fP (void)" .br .RI "Return the built-in cross-platform capture provider vtable\&. " .ti -1c .RI "void \fBbark_capture_set_gate\fP (\fBbark_capture_gate_fn\fP fn, void *gate_user)" .br .RI "Install or clear (NULL) a host authorization gate for capture and source enumeration\&. " .ti -1c .RI "int \fBbark_capture_register\fP (const \fBbark_capture_ops_t\fP *ops, void *prov_ctx)" .br .RI "Register a capture provider implementation\&. " .ti -1c .RI "int \fBbark_capture_unregister\fP (const \fBbark_capture_ops_t\fP *ops)" .br .RI "Unregister a previously registered capture provider\&. " .ti -1c .RI "int \fBbark_capture_autoload\fP (void)" .br .RI "Load and register the default (or \fRBARK_CAPTURE_MODULE\fP override) capture provider\&. " .ti -1c .RI "void \fBbark_capture_unload\fP (void)" .br .RI "Release a reference acquired via \fBbark_capture_autoload()\fP\&. " .ti -1c .RI "int \fBbark_capture_available\fP (void)" .br .RI "Return non-zero if a capture provider is installed and permitted\&. " .ti -1c .RI "const char * \fBbark_capture_provider_name\fP (void)" .br .RI "Return the active capture provider's name, or NULL if none\&. " .ti -1c .RI "uint32_t \fBbark_capture_flags\fP (void)" .br .RI "Return capability flags (\fRBARK_CAPTURE_FLAG_*\fP) of the active capture provider\&. " .ti -1c .RI "int \fBbark_capture_list_sources\fP (\fBbark_capture_source_t\fP *out, uint32_t max_count)" .br .RI "Enumerate selectable monitors and windows (respects host permission gate)\&. " .ti -1c .RI "int \fBbark_capture_start\fP (const \fBbark_capture_cfg_t\fP *cfg, \fBbark_capture_frame_fn\fP on_frame, void *user)" .br .RI "Start screen capture streaming RGBA8 frames to \fRon_frame\fP\&. " .ti -1c .RI "int \fBbark_capture_start_ex\fP (const \fBbark_capture_cfg_t\fP *cfg, \fBbark_capture_frame_fn\fP on_frame, \fBbark_capture_state_fn\fP on_state, void *user)" .br .RI "Start screen capture with both worker-thread frame and main-thread state callbacks\&. " .ti -1c .RI "int \fBbark_capture_update\fP (const \fBbark_capture_cfg_t\fP *cfg)" .br .RI "Update live capture resolution or FPS\&. " .ti -1c .RI "void \fBbark_capture_poll\fP (void)" .br .RI "Pump pending main-thread capture state callbacks\&. " .ti -1c .RI "void \fBbark_capture_stop\fP (void)" .br .RI "Stop active screen capture\&. " .ti -1c .RI "int \fBbark_capture_probe\fP (void)" .br .RI "Probe whether capture can start and deliver a valid RGBA8 frame\&. " .in -1c .SH "Detailed Description" .PP Bark screen and window capture provider interface\&. Capability-gated screen capture primitive and custom provider hook\&. .PP Provides OS monitor/window enumeration and screen capture across Linux (Wayland portal/PipeWire + X11), macOS (ScreenCaptureKit/CoreGraphics), Windows (WGC/GDI), browser WASM (\fRgetDisplayMedia\fP), and headless mode, with an optional host authorization gate\&. .SH "Typedef Documentation" .PP .SS "typedef void(* bark_capture_frame_fn) (const uint8_t *rgba, uint16_t w, uint16_t h, void *user)" .PP Worker-thread RGBA8 capture frame callback\&. Called with tightly-packed RGBA8 pixels (\fRw\fP * h * 4 bytes), or with \fRrgba=NULL\fP, w=0, h=0 when the picker is canceled or target is lost\&. .SH "Enumeration Type Documentation" .PP .SS "enum \fBbark_capture_backend\fP" .PP Active OS screen-capture backend identifier\&. .PP \fBEnumerator\fP .in +1c .TP \f(BIBARK_CAPTURE_BACKEND_NONE \fP No backend active\&. .TP \f(BIBARK_CAPTURE_BACKEND_HEADLESS \fP Deterministic synthetic RGBA8 pattern\&. .TP \f(BIBARK_CAPTURE_BACKEND_X11 \fP Linux X11 MIT-SHM / XComposite capture\&. .TP \f(BIBARK_CAPTURE_BACKEND_GDI \fP Windows GDI capture\&. .TP \f(BIBARK_CAPTURE_BACKEND_CG \fP macOS CoreGraphics capture\&. .TP \f(BIBARK_CAPTURE_BACKEND_WAYLAND \fP Linux Wayland xdg-desktop-portal + PipeWire\&. .TP \f(BIBARK_CAPTURE_BACKEND_WGC \fP Windows Graphics Capture (D3D11)\&. .TP \f(BIBARK_CAPTURE_BACKEND_SCK \fP macOS ScreenCaptureKit\&. .SS "enum \fBbark_capture_target_kind\fP" .PP Capture target selection modes\&. .PP \fBEnumerator\fP .in +1c .TP \f(BIBARK_CAPTURE_TARGET_PROMPT \fP Show OS/browser picker if supported, else default display\&. .TP \f(BIBARK_CAPTURE_TARGET_MONITOR \fP Capture a specific monitor by \fRtarget_id\fP or \fRdisplay_index\fP\&. .TP \f(BIBARK_CAPTURE_TARGET_WINDOW \fP Capture a specific application window by \fRtarget_id\fP\&. .SH "Author" .PP Generated automatically by Doxygen for Bark from the source code\&.