Avutil.HwContextHardware acceleration: devices, and pools of frames on a device.
type device_type = [ | `None| `Vdpau| `Cuda| `Vaapi| `Dxva2| `Qsv| `Videotoolbox| `D3d11va| `Drm| `Opencl| `Mediacodec| `Vulkan| `D3d12va| `Amf| `Ohcodec ]The kinds of hardware device (VAAPI, CUDA, VideoToolbox and so on), generated from FFmpeg's headers at build time.
An open hardware device. The value owns one reference to it, is immutable, and drops the reference when it is collected. A frame context and an encoder given the device take references of their own, so the device stays open as long as one of them needs it.
A pool of hardware frames on a device. The value owns one reference to it, is immutable, and drops the reference when it is collected. The pool keeps its device open by itself, and an encoder given the pool takes a reference of its own.
val create_device_context :
?device:string ->
?opts:opts ->
device_type ->
device_contextcreate_device_context ?device ?opts device_type opens a hardware device of that type.
The call may take time; it releases the OCaml runtime lock while FFmpeg opens the device, so other threads run meanwhile.
val create_frame_context :
width:int ->
height:int ->
src_pixel_format:Pixel_format.t ->
dst_pixel_format:Pixel_format.t ->
device_context ->
frame_contextcreate_frame_context ~width ~height ~src_pixel_format ~dst_pixel_format device creates and initialises a pool of hardware frames on device. Every parameter of the pool other than the ones below keeps FFmpeg's default. The call releases the OCaml runtime lock while FFmpeg initialises the pool.