Skip to main content

Crate alpha2_ffmpeg_bridge

Crate alpha2_ffmpeg_bridge 

Source
Expand description

The unsafe boundary between the native binding and FFmpeg.

It holds what rsmpeg’s safe surface lacks: frame, plane and packet copies, codec-open and side-data helpers, container I/O, and the C shims that read hardware frames (Vulkan, D3D12, VideoToolbox). Keeping these operations in one private crate lets the rest of the native binding retain the workspace-wide unsafe_code = "forbid" policy.

Structs§

D3D12FrameInfo
D3D12 resource and decode fence retained by one hardware frame.
DecodedFrame
A frame a decoder returned, and whether every byte of its buffers, row padding included, is written.
DemuxInput
A container opened for reading under an input policy: only the demuxers it names, only the file protocol, and an interrupt callback the reader binds to its own cancellation.
DisplayRotation
The rotation a display matrix asks for, in FFmpeg’s convention.
FramePlane
One plane of a decoded frame.
NativeGpuFailure
A platform GPU call that failed inside a native interop helper.
OutputFile
A container opened for writing whose file is closed without panicking.
SampleProfile
Chroma layout, component depth, and alpha of one pixel format.
VideoToolboxFrameInfo
CoreVideo pixel-buffer identity retained by one VideoToolbox frame.
VulkanDeviceInfo
Raw shared-device description used to initialize FFmpeg’s Vulkan context.
VulkanEncodeFrameAccess
One encoder-pool frame held open for a native GPU write.
VulkanFrameAccess
Locked FFmpeg Vulkan surface state passed to the native GPU boundary.
VulkanFrameAccessGuard
Guard for one locked FFmpeg frame and queue handoff.
VulkanFrameInfo
Opaque Vulkan handles and synchronization state for one FFmpeg hardware frame.
VulkanFrameLease
Ref-counted ownership of an opaque FFmpeg Vulkan frame.
VulkanQueueGuard
One hold of a VulkanQueueLock, released when it drops.
VulkanQueueLock
Serializes one shared Vulkan queue family across FFmpeg and the renderer.
Yuv420pFrameBuffer
A reusable FFmpeg YUV420P frame the caller writes into directly.
Yuv420pFramePlanes
Writable plane memory for one reusable frame.
YuvPlaneLayout
How a planar or semi-planar YCbCr pixel format stores its samples, as yuv_layout reads it from FFmpeg’s descriptor.
YuvPlanes
The planes of a YCbCr AVFrame: luma first, then chroma.

Enums§

BridgeError
Failure returned by an operation of this crate.
GpuFault
What a failed GPU call says about the device it ran on, read from the platform’s own status for that call (a VkResult, HRESULT, or CVReturn) where it failed, not from any message.
NativeGpuBackend
The graphics API a native interop helper called.
OpenInputError
Why open_input opened nothing.

Constants§

MAX_VULKAN_PLANES
Maximum number of Vulkan images described by an FFmpeg hardware frame.
VULKAN_ENCODE_INPUT_USAGE
VkImageUsageFlags an encoder-input pool needs beyond FFmpeg’s own.

Functions§

audio_f32_interleaved
Copies a packed AV_SAMPLE_FMT_FLT frame into an owned interleaved vector.
audio_frame
Copies planar f32 samples into an owned FFmpeg audio frame of format: planar float (AV_SAMPLE_FMT_FLTP), interleaved float (AV_SAMPLE_FMT_FLT), or interleaved 16-bit (AV_SAMPLE_FMT_S16). A 16-bit sample is clamped to [-1, 1] and rounded to the nearest step.
bitstream_filter_list
Opens a bitstream filter chain, written in FFmpeg’s list syntax (name=option=value:option=value,name..., as ffmpeg -bsf takes it), for a stream that parameters describes and whose packets are timed in time_base.
channel_layout_channels
The FFmpeg channel (enum AVChannel) of each channel of layout, in its order; empty for a layout that gives only a count (AV_CHANNEL_ORDER_UNSPEC).
channel_layout_of
A channel layout of channels in this order: FFmpeg’s native order when they are in it, a custom order otherwise.
codec_parameters_extradata
A copy of a stream’s codec extradata: the sample description’s parameter sets for H.264 and HEVC.
configure_colorspace
Applies explicit matrix and range coefficients to a scaling context.
create_vulkan_device_context⚠
Initializes an FFmpeg Vulkan device context over an application-owned device.
display_rotation
Reads a stream display matrix.
exit_without_handlers
Ends the process now with code, without running its exit handlers.
frame_display_rotation
Reads the display matrix a decoder attached to one frame, as the JPEG decoder does for an Exif Orientation.
hardware_device_type_name
Returns FFmpeg’s stable name for a hardware device type.
muxer_accepts_codec
Whether the linked muxer named format (mp4, matroska, …) can store codec at normal standard compliance; None when no such muxer is linked.
open_codec_context
Opens context with options, returning what FFmpeg did not consume.
open_input
Opens url and reads its stream information with only the demuxers named in formats (comma-separated FFmpeg short names) and only the file protocol, for the input and anything it opens in turn.
packet_bytes
Copies one packet’s payload out of FFmpeg’s buffer.
packet_has_side_data
Whether packet carries side data of kind, as a demuxer marks the packet where a stream’s sample description changes (AV_PKT_DATA_NEW_EXTRADATA).
pixel_format_name
Returns FFmpeg’s stable name for a pixel-format value.
planar_frame
A frame of format holding a copy of planes (bytes and stride each), width by height pictures in the planes format stores.
rgba_frame
Copies tightly packed RGBA bytes into an owned FFmpeg frame.
runtime_configuration
Returns the linked libavcodec configure string.
runtime_version
Returns the linked FFmpeg runtime version string.
sample_profile
Describes a pixel format, or None when the value has no descriptor.
scale_frame_packed
Converts the whole of frame with context into output: target’s planes one after another without row padding, the layout av_image_copy_to_buffer writes at alignment 1, so the caller’s buffer is the only one the picture is written to.
set_output_stream_extradata
Replaces the extradata (the sample description’s parameter sets, for H.264 and HEVC) of output’s stream index with a copy of data, for a muxer whose header is not written yet.
set_packet_side_data
Gives packet side data of kind holding data, replacing any it had.
set_stream_codec_tag
Sets the codec tag (sample entry) a stream is written with; zero lets the output muxer pick the first tag its container uses for the codec.
set_stream_display_matrix
Gives a stream the display matrix display describes, as coded side data a muxer writes (MP4’s tkhd matrix): the rotation, then a horizontal flip when it mirrors, as display_rotation reads one back. Replaces any matrix the stream had.
take_packet_side_data
Takes packet’s side data of kind off it: a copy of its bytes, or None when it carries none.
vulkan_frame_info
Reads Vulkan image and synchronization metadata from an opaque hardware frame.
vulkan_frames_add_usage
Adds usage to a Vulkan frames context before it allocates its pool.
vulkan_frames_usage
Usage the pool was created with.
vulkan_get_format_callback
Returns the callback used by a Vulkan hardware decoder to select its opaque format.
yuv420p_frame
Copies owned planar 8-bit 4:2:0 samples into an FFmpeg video frame.
yuv_layout
Reads the plane layout of a YCbCr pixel format the renderer samples directly, or None for any other format.
yuv_pixel_format
The pixel format whose planes are laid out as layout: the first in FFmpeg’s table, which for 8-bit planar YUV is the limited-range format (yuv420p) rather than its deprecated full-range twin (yuvj420p).
yuv_planes
Copies the planes of a frame whose format yuv_layout accepts into tightly packed, forward rows of its samples, or returns Ok(None) for any other format so callers can convert it explicitly. Odd coded dimensions use ceil-divided chroma dimensions.

Type Aliases§

VulkanFrameDescriptor
Vulkan image and synchronization state of one hardware frame, as the shim reads it under the frame lock.