oa::video
video module in the OA Vision public surface.
MdRust public API
Public Types
Public Functions
pub fn from_texture( texture: &Texture, timing: VideoFrameTiming, color: VideoColorInfo, ) -> Result<VideoFrame>pub fn from_texture_with_ready( texture: &Texture, timing: VideoFrameTiming, color: VideoColorInfo, ready: &Event, ) -> Result<VideoFrame>pub fn letterbox( frame: &VideoFrame, width: u32, height: u32, fill: [u8; 3], interpolation: VideoInterpolation, ) -> Result<VideoFrame>pub fn overlay_boxes( frame: &VideoFrame, boxes: &[VideoBox], border: Option<u32>, ) -> Result<VideoFrame>pub fn parse_av1_frame_header( payload: &[u8], sequence: &Av1SequenceHeader, references: &Av1ReferenceState, ) -> Result<Av1FrameHeader>pub fn parse_h264_pps( nal: &[u8], sps: &H264SequenceParameterSet, ) -> Result<H264PictureParameterSet>pub fn parse_h264_slice_header( nal: &[u8], sps: &H264SequenceParameterSet, pps: &H264PictureParameterSet, ) -> Result<H264SliceHeader>pub fn parse_h265_slice_header( nal: &[u8], sps: &H265SequenceParameterSet, pps: &H265PictureParameterSet, ) -> Result<H265SliceHeader>pub fn query_decode_capabilities( engine: &Engine, profile: VideoDecodeProfile, ) -> Result<VideoDecodeCapabilities>pub fn query_decode_formats( engine: &Engine, profile: VideoDecodeProfile, ) -> Result<VideoDecodeFormats>pub fn query_encode_capabilities( engine: &Engine, profile: VideoEncodeProfile, ) -> Result<VideoEncodeCapabilities>pub fn query_encode_formats( engine: &Engine, profile: VideoEncodeProfile, ) -> Result<VideoEncodeFormats>Function Documentation
Alpha-composite front over back plane-by-plane; alpha is 0-255. Both frames must share format, extent, and engine. Each component blends with rounding (front*a + back*(255-a) + 127) / 255. Errors Returns an error for non-device-planar inputs, mismatched frames, or a runtime recording failure.
Convert a frame between Nv12 and Yuv420Planar8 plane layouts without changing content, extent, or component ranges. Each plane is repacked by a resample dispatch at identity mapping; NV12’s interleaved chroma pair splits into two dispatches (or merges from two) through per-component stride selection. Errors Returns an error for a non-device-planar frame, a same-format or non-admitted target, or a runtime recording failure.
Convert a frame’s component range between limited and full. The frame’s color metadata is updated to the target range; Unspecified input uses BT.709 limited as the source. Same-range requests return a copy at identity. Errors Returns an error for a non-device-planar frame or a runtime recording failure.
Extract a luma-space region; chroma extents follow the format’s rules. x and y must be even so chroma stays subsample-aligned. Errors Returns an error for a non-device-planar frame, odd offsets, or a region outside the visible extent.
Emit borrowed NAL payloads as canonical four-byte-start-code Annex-B. Errors Returns an error when the output size overflows or host allocation fails.
Copy the first H.264 picture parameter set payload.
Copy the first H.265 picture parameter set payload.
Copy the first H.264 sequence parameter set payload.
Copy the first H.265 sequence parameter set payload.
Copy the first H.265 video parameter set payload.
Mirror a frame along one axis in place-size output. Errors Returns an error for a non-device-planar frame.
Retain a render Texture as one timestamped video frame. The returned frame shares a buffer-backed Texture’s packed RGBA8 storage, semantic identity, and exact Matrix producer readiness. It performs no pixel copy, submission, wait, or Image conversion. Render targets require from_texture_with_ready so their producer completion is not lost. Errors Returns an error for a render-target-backed Texture.
Retain a texture and its exact producer completion in one video frame. This is the render-target path: it shares the texture and event without a readback, wait, or pixel copy. The event must belong to the texture’s Engine. Errors Returns an error when ready comes from a different Engine.
Inspect one raw access unit or the first frame of an IVF byte stream. Errors Returns an error for malformed IVF framing, invalid OBU structure, count overflow, or an empty frame payload.
Convert an MP4 length-prefixed H.264/H.265 sample into Annex-B NAL units. Errors Returns an error for a length width other than 1, 2, or 4, a truncated length field, a zero-sized NAL unit, arithmetic overflow, or payload overrun.
Aspect-preserving resize into a fixed extent with a constant fill. fill is a YUV code triplet in the frame’s component range. Errors Returns an error for a non-device-planar frame or a zero extent.
Draw rectangles into a new device-planar frame. The base frame is copied once at identity; each box then writes its scaled region on luma and each chroma component with exclusive single-component dispatches. border draws a hollow ring of that width in luma pixels instead of filling. Errors Returns an error for a non-device-planar frame, a box outside the visible extent, or a runtime recording failure.
Stencil fill onto a frame wherever the mask’s luma byte is nonzero. mask must be a device-planar frame of the same luma extent whose luma plane is the stencil. Chroma components apply the mask at chroma resolution; edge columns under odd extents follow the chroma rounding. Errors Returns an error for non-device-planar inputs, mismatched extents, or a runtime recording failure.
Extend a frame with a constant border. fill is a YUV code triplet in the frame’s component range. left and top must be even so chroma stays subsample-aligned. Errors Returns an error for a non-device-planar frame, odd offsets, or extent overflow.
Parse one AV1 frame or frame-header OBU payload against explicit reference state. Errors Returns an error for truncated or inconsistent syntax and for donor features that are not yet represented: frame IDs, decoder-model removal timing, short reference signaling, non-uniform tiles, and film grain.
Split one raw AV1 access-unit payload into borrowed OBUs. Errors Returns an error for forbidden/reserved header bits, truncated extensions or LEB128 sizes, payload overruns, empty input, and arithmetic overflow.
Parse one AV1 sequence-header OBU payload. Pass Av1Obu::payload from an OBU whose type is Av1ObuType::SequenceHeader. The returned representation is independent of Vulkan’s standard-video C structures and retains the stream metadata needed to create exact backend profiles and session parameters. Errors Returns an error when the payload is empty or truncated, declares a reserved profile, carries an invalid frame-ID length, or encodes a chroma layout outside the AV1 profile rules.
Parse the tile ranges carried by one frame or tile-group OBU. Returned offsets are relative to the access-unit byte slice originally passed to super::parse_av1_obus, matching Vulkan Video’s source-buffer offset convention. Errors Returns an error for an incompatible OBU type, missing payload, invalid tile count/range/size width, truncated size fields, payload overruns, or offsets that do not fit Vulkan’s 32-bit tile arrays.
Parse one raw H.264 PPS NAL unit without an Annex-B start code.
Parse one raw H.264 coded-slice NAL using its resolved SPS and PPS. The returned picture-order-count field contains the coded LSB for POC type zero. POC types one and two require prior-picture state and therefore return None; the decoder session must derive the final POC rather than inventing a stateless approximation.
Parse one raw H.264 SPS NAL unit without an Annex-B start code.
Parse one raw H.265 PPS NAL unit without an Annex-B start code.
Parse one raw H.265 coded-slice NAL using its resolved SPS and PPS. Dependent slice segments and inline inter-predicted short-term reference sets require additional retained state and fail with MissingCapability.
Parse one raw H.265 SPS NAL unit without an Annex-B start code.
Parse one raw H.265 VPS NAL unit without an Annex-B start code.
Split an Annex-B byte stream into borrowed H.264 NAL payloads. Both 00 00 01 and 00 00 00 01 start codes are recognized. Bytes before the first start code and empty units are ignored, matching the donor oa::FnVideo::parseNalAnnexB contract.
Query the selected device’s exact limits for one decoder profile. Extension advertisement alone does not prove that a particular profile, chroma layout, bit depth, or codec option is usable. This query presents the complete profile to Vulkan and returns MissingCapability when rejected. Errors Returns an error when the codec extension is unavailable, the exact profile is unsupported, or the Vulkan capability query fails.
Enumerate decoded-output and DPB image formats for one exact profile. Errors Returns an error when the profile or its codec extension is unsupported, a Vulkan enumeration fails, or the driver reports an unreasonable result size.
Query Vulkan Video queues and codec extensions on the Engine’s selected device. This query reports both physical-device advertisement and whether Engine creation enabled video queues, and whether at least one qualified codec session path exists. Errors Returns an error when Vulkan device-extension or queue-family enumeration fails.
Query exact H.264 or H.265 encoder limits without creating a session.
Enumerate encode-input and DPB formats for one exact profile.
Stretch a frame to a new extent in luma space; chroma planes follow. Errors Returns an error for a non-device-planar frame or a zero extent.
Rotate a frame ninety degrees clockwise. Errors Returns an error for a non-device-planar frame.
Join frames of matching cross-extent along one axis. Along-axis extents of all but the last frame must be even so chroma offsets stay subsample-aligned. Errors Returns an error for an empty batch, non-device-planar frames, mixed formats or cross-extents, odd alignment, or extent overflow.
Threshold a frame’s luma plane; chroma planes are copied unchanged. value >= threshold maps to high, otherwise low. Errors Returns an error for a non-device-planar frame or a runtime recording failure.
Convert one or more video frames into a single batched F32 Matrix. This is the only colorimetric YUV→RGB boundary in oa::video. Inputs must be device-planar frames with identical format, visible extent and resolved color metadata; stage host-planar frames with VideoFrame::upload first. The call records asynchronously and returns the output immediately; reading it is an explicit submission and observation point. Errors Returns an error for an empty or mixed-geometry batch, an ineligible backing, a crop outside the visible region, zero output extents, an unsupported layout or bit depth, or a runtime recording failure.