Skip to main content

ProviderStreamEmitFn

Type Alias ProviderStreamEmitFn 

Source
pub type ProviderStreamEmitFn = extern "C" fn(event_json: StbString, user_data: *mut c_void) -> i32;
Expand description

Per-chunk callback a streaming provider invokes while the response is still being produced (for register_streaming_provider).

event_json is an owning StbString the plugin produces and transfers to the host: the host reclaims it with the producer’s plugin_free_string — the one the plugin passed to register_streaming_provider — exactly like a tool’s partial-progress chunk. The host must not use its own free_string for it: the allocation belongs to the plugin’s SDK instance.

The callback is invoked synchronously inside the request fn, on the same thread, only for the duration of that call — a plugin must never retain emit, emit_user_data, or the struct they live in past the request. Returns 0 on success; nonzero means the host rejected the chunk (a malformed envelope), which a plugin may ignore or treat as a request failure.