Module webcodecs_video_decoder
WebCodecs VideoDecoder (src/page/bindings_video_decoder.odin, native/js/runtime/web_webcodecs_video_decoder.c). Wires to the media decoders of src/media behind an honest isConfigSupported. The engine holds the output / error callbacks; a decoded VideoFrame is delivered through the output callback (user, frame handle).
Exposed to: Window, Worker. Source: api/webcodecs_video_decoder.widl.
Odin: import "wren:webcodecs".
Types
handle VideoDecoder : Object
Checked by the browser on every call (lookup_VideoDecoder).
callback VideoDecoderOutput
void VideoDecoderOutput(i32 user, u64 frame)output(frame) and error(code) callbacks. The frame handle is a VideoFrame the guest must close.
callback VideoDecoderError
void VideoDecoderError(i32 user, i32 code)Functions
VideoDecoder_create
VideoDecoder VideoDecoder_create(VideoDecoderOutput output, i32 output_user, VideoDecoderError error, i32 error_user) raisesnew VideoDecoder({output, error}).
Raises: returns an Error (see web).
Host: VideoDecoder_create :: proc(c: ^Call, output: u32, output_user: i32, error: u32, error_user: i32) -> (u64, Api_Error)
VideoDecoder_isConfigSupported
bool VideoDecoder_isConfigSupported(string codec)VideoDecoder.isConfigSupported(config.codec): honest — true only when src/media can decode the codec.
Host: VideoDecoder_isConfigSupported :: proc(c: ^Call, codec: string) -> bool
VideoDecoder_configure
void VideoDecoder_configure(VideoDecoder decoder, string codec, bytes description, u32 coded_w, u32 coded_h) raisesdecoder.configure({codec, description, codedWidth, codedHeight}).
Raises: returns an Error (see web).
Host: VideoDecoder_configure :: proc(c: ^Call, decoder: Api_VideoDecoder, codec: string, description: []u8, coded_w: u32, coded_h: u32) -> Api_Error
VideoDecoder_decode
void VideoDecoder_decode(VideoDecoder decoder, bool key, i64 timestamp, i64 duration, bool has_duration, bytes data) raisesdecoder.decode(EncodedVideoChunk): the engine passes the chunk's fields and bytes.
Raises: returns an Error (see web).
Host: VideoDecoder_decode :: proc(c: ^Call, decoder: Api_VideoDecoder, key: bool, timestamp: i64, duration: i64, has_duration: bool, data: []u8) -> Api_Error
VideoDecoder_flush
void VideoDecoder_flush(VideoDecoder decoder) raisesdecoder.flush(): drain the pipeline (the engine resolves the promise).
Raises: returns an Error (see web).
Host: VideoDecoder_flush :: proc(c: ^Call, decoder: Api_VideoDecoder) -> Api_Error
VideoDecoder_reset
void VideoDecoder_reset(VideoDecoder decoder)Host: VideoDecoder_reset :: proc(c: ^Call, decoder: Api_VideoDecoder)
VideoDecoder_close
void VideoDecoder_close(VideoDecoder decoder)Host: VideoDecoder_close :: proc(c: ^Call, decoder: Api_VideoDecoder)
VideoDecoder_decodeQueueSize
u32 VideoDecoder_decodeQueueSize(VideoDecoder decoder)Host: VideoDecoder_decodeQueueSize :: proc(c: ^Call, decoder: Api_VideoDecoder) -> u32
VideoDecoder_state
i32 VideoDecoder_state(VideoDecoder decoder)0 unconfigured, 1 configured, 2 closed.
Host: VideoDecoder_state :: proc(c: ^Call, decoder: Api_VideoDecoder) -> i32