Skip to main content

vulkan_frames_add_usage

Function vulkan_frames_add_usage 

Source
pub fn vulkan_frames_add_usage(
    frames: &mut AVHWFramesContext,
    usage: u32,
) -> Result<(), BridgeError>
Expand description

Adds usage to a Vulkan frames context before it allocates its pool.

FFmpeg’s Vulkan encoder requests no usage of its own. Left at zero, hwcontext_vulkan picks one: whichever of TRANSFER_DST, TRANSFER_SRC, STORAGE and SAMPLED the format supports, plus host transfer and VIDEO_ENCODE_SRC when the device has them, and it then only takes a format that supports STORAGE. A non-zero usage is used exactly as given: FFmpeg 8.0.3 drops no flag of it, and every flag must be one the format supports, or the pool’s images are created with a usage they cannot have. So an encoder-input pool asks for VULKAN_ENCODE_INPUT_USAGE, what an export does with its images and nothing else.

This must be called between av_hwframe_ctx_alloc and av_hwframe_ctx_init; afterwards the images already exist.

§Errors

Returns an error when the context is not a Vulkan one.