Go to the source code of this file.
| Enumerator | |
|---|---|
| AV_HWDEVICE_TYPE_NONE | |
| AV_HWDEVICE_TYPE_VDPAU | |
| AV_HWDEVICE_TYPE_CUDA | |
| AV_HWDEVICE_TYPE_VAAPI | |
| AV_HWDEVICE_TYPE_DXVA2 | |
| AV_HWDEVICE_TYPE_QSV | |
| AV_HWDEVICE_TYPE_VIDEOTOOLBOX | |
| AV_HWDEVICE_TYPE_D3D11VA | |
| AV_HWDEVICE_TYPE_DRM | |
| AV_HWDEVICE_TYPE_OPENCL | |
| AV_HWDEVICE_TYPE_MEDIACODEC | |
| AV_HWDEVICE_TYPE_VULKAN | |
| AV_HWDEVICE_TYPE_D3D12VA | |
Definition at line 27 of file hwcontext.h.
| Enumerator | |
|---|---|
| AV_HWFRAME_TRANSFER_DIRECTION_FROM | Transfer the data from the queried hw frame. |
| AV_HWFRAME_TRANSFER_DIRECTION_TO | Transfer the data to the queried hw frame. |
Definition at line 403 of file hwcontext.h.
Flags to apply to frame mappings.
| Enumerator | |
|---|---|
| AV_HWFRAME_MAP_READ | The mapping must be readable. |
| AV_HWFRAME_MAP_WRITE | The mapping must be writeable. |
| AV_HWFRAME_MAP_OVERWRITE | The mapped frame will be overwritten completely in subsequent operations, so the current frame data need not be loaded. Any values which are not overwritten are unspecified. |
| AV_HWFRAME_MAP_DIRECT | The mapping must be direct. That is, there must not be any copying in the map or unmap steps. Note that performance of direct mappings may be much lower than normal memory. |
Definition at line 508 of file hwcontext.h.
Look up an AVHWDeviceType by name.
Definition at line 102 of file hwcontext.c.
Referenced by create_hwaccel(), hw_device_init_from_string(), hwmap_config_output(), hwupload_query_formats(), ist_add(), main(), qsv_device_create(), and test_device_type().
Get the string name of an AVHWDeviceType.
Definition at line 112 of file hwcontext.c.
Referenced by amf_init_context(), choose_decoder(), ff_decode_get_hw_frames_ctx(), hw_device_default_name(), hw_device_for_filter(), hw_device_setup_for_decode(), hw_device_setup_for_encode(), ist_add(), main(), opt_init_hw_device(), print_codec(), show_hwaccels(), test_derivation(), and test_device_type().
Iterate over supported device types.
Definition at line 121 of file hwcontext.c.
Referenced by ist_add(), main(), opt_init_hw_device(), show_hwaccels(), and test_derivation().
Allocate an AVHWDeviceContext for a given hardware type.
Definition at line 161 of file hwcontext.c.
Referenced by av_hwdevice_ctx_create(), av_hwdevice_ctx_create_derived_opts(), qsv_init_child_ctx(), and rkmpp_init_decoder().
Finalize the device context before use.
This function must be called after the context is filled with all the required information and before it is used in any way.
Definition at line 208 of file hwcontext.c.
Referenced by av_hwdevice_ctx_create(), av_hwdevice_ctx_create_derived_opts(), qsv_init_child_ctx(), and rkmpp_init_decoder().
Open a device of the specified type and create an AVHWDeviceContext for it.
This is a convenience function intended to cover the simple cases. Callers who need to fine-tune device creation/management should open the device manually and then wrap it in an AVHWDeviceContext using av_hwdevice_ctx_alloc()/av_hwdevice_ctx_init().
The returned context is already initialized and ready for use, the caller should not call av_hwdevice_ctx_init() on it. The user_opaque/free fields of the created AVHWDeviceContext are set by this function and should not be touched by the caller.
Definition at line 600 of file hwcontext.c.
Referenced by create_hwaccel(), cudaupload_init(), cuvid_decode_init(), ddagrab_config_props(), hw_decoder_init(), hw_device_init_from_string(), hw_device_init_from_type(), kmsgrab_read_header(), main(), qsv_device_create(), and test_device().
Create a new device of the specified type from an existing device.
If the source device is a device of the target type or was originally derived from such a device (possibly through one or more intermediate devices of other types), then this will return a reference to the existing device of the same type as is requested.
Otherwise, it will attempt to derive a new device from the given source device. If direct derivation to the new type is not implemented, it will attempt the same derivation from each ancestor of the source device in turn looking for an implemented derivation method.
Definition at line 703 of file hwcontext.c.
Referenced by create_hwaccel(), hw_device_init_from_string(), hwmap_config_output(), hwupload_query_formats(), and test_derivation().
Create a new device of the specified type from an existing device.
This function performs the same action as av_hwdevice_ctx_create_derived, however, it is able to set options for the new device to be derived.
Definition at line 636 of file hwcontext.c.
Referenced by av_hwdevice_ctx_create_derived().
Allocate an AVHWFramesContext tied to a given device context.
Definition at line 248 of file hwcontext.c.
Referenced by av_hwframe_ctx_create_derived(), avcodec_get_hw_frames_parameters(), config_output(), cudaupload_config_output(), cuvid_decode_init(), ff_opencl_filter_config_output(), ff_vaapi_vpp_config_output(), ff_vk_decode_init(), ff_vk_filter_init_context(), hwmap_config_output(), hwupload_config_output(), init_hwframe_ctx(), init_hwframes_ctx(), init_stage(), init_vpp_session(), kmsgrab_read_header(), nppsharpen_config(), qsv_decode_preinit(), qsv_frame_alloc(), qsv_init_child_ctx(), rkmpp_retrieve_frame(), scale_vt_config_output(), set_hwframe_ctx(), transpose_vt_recreate_hw_ctx(), and vaapi_encode_create_recon_frames().
Finalize the context before use.
This function must be called after the context is filled with all the required information and before it is attached to any frames.
Definition at line 322 of file hwcontext.c.
Referenced by config_output(), cudaupload_config_output(), ff_decode_get_hw_frames_ctx(), ff_opencl_filter_config_output(), ff_vaapi_vpp_config_output(), ff_vk_decode_init(), ff_vk_filter_init_context(), hwmap_config_output(), hwupload_config_output(), init_hwframe_ctx(), init_hwframes_ctx(), init_stage(), init_vpp_session(), kmsgrab_read_header(), nppsharpen_config(), nvdec_init_hwframes(), qsv_decode_preinit(), qsv_frame_alloc(), qsv_init_child_ctx(), rkmpp_retrieve_frame(), scale_vt_config_output(), set_hwframe_ctx(), transpose_vt_recreate_hw_ctx(), and vaapi_encode_create_recon_frames().
Allocate a new frame attached to the given AVHWFramesContext.
Definition at line 491 of file hwcontext.c.
Referenced by av_frame_make_writable(), av_hwframe_get_buffer(), avcodec_default_get_buffer2(), cuda_bilateral_process(), cudachromakey_process(), cudacolorspace_conv(), cudascale_scale(), cuvid_output_frame(), ff_default_get_video_buffer2(), hwframe_pool_prealloc(), init_hwframe_ctx(), init_stage(), main(), nppscale_scale(), nppsharpen_config(), nppsharpen_filter_frame(), npptranspose_filter(), query_frame(), vaapi_encode_issue(), and vk_get_dpb_pool().
Copy data to or from a hw surface.
At least one of dst/src must have an AVHWFramesContext attached.
If src has an AVHWFramesContext attached, then the format of dst (if set) must use one of the formats returned by av_hwframe_transfer_get_formats(src, AV_HWFRAME_TRANSFER_DIRECTION_FROM). If dst has an AVHWFramesContext attached, then the format of src must use one of the formats returned by av_hwframe_transfer_get_formats(dst, AV_HWFRAME_TRANSFER_DIRECTION_TO)
dst may be "clean" (i.e. with data/buf pointers unset), in which case the data buffers will be allocated by this function using av_frame_get_buffer(). If dst->format is set, then this format will be used, otherwise (when dst->format is AV_PIX_FMT_NONE) the first acceptable format will be chosen.
The two frames must have matching allocated dimensions (i.e. equal to AVHWFramesContext.width/height), since not all device types support transferring a sub-rectangle of the whole surface. The display dimensions (i.e. AVFrame.width/height) may be smaller than the allocated dimensions, but also have to be equal for both frames. When the display dimensions are smaller than the allocated dimensions, the content of the padding in the destination frame is unspecified.
Definition at line 433 of file hwcontext.c.
Referenced by conv_cuda_convert(), cudaupload_filter_frame(), cuvid_output_frame(), decode_packet(), decode_write(), frame_copy_video(), hwaccel_retrieve_data(), hwdownload_filter_frame(), hwupload_filter_frame(), main(), qsv_transfer_data_child(), and transfer_data_alloc().
Get a list of possible source or target formats usable in av_hwframe_transfer_data().
Definition at line 371 of file hwcontext.c.
Referenced by hwdownload_config_output(), and transfer_data_alloc().
Allocate a HW-specific configuration structure for a given HW device.
After use, the user must free all members as required by the specific hardware structure being used, then free the structure itself with av_free().
Definition at line 555 of file hwcontext.c.
Referenced by ff_vaapi_vpp_config_output(), vaapi_decode_make_config(), and vaapi_encode_create_recon_frames().
Get the constraints on HW frames given a device and the HW-specific configuration to be used with that device.
If no HW-specific configuration is provided, returns the maximum possible capabilities of the device.
Definition at line 566 of file hwcontext.c.
Referenced by ff_vaapi_vpp_config_output(), hwupload_query_formats(), vaapi_decode_make_config(), and vaapi_encode_create_recon_frames().
Free an AVHWFrameConstraints structure.
Definition at line 591 of file hwcontext.c.
Referenced by av_hwdevice_get_hwframe_constraints(), ff_vaapi_vpp_config_output(), hwupload_query_formats(), vaapi_decode_make_config(), and vaapi_encode_create_recon_frames().
Map a hardware frame.
This has a number of different possible effects, depending on the format and origin of the src and dst frames. On input, src should be a usable frame with valid buffers and dst should be blank (typically as just created by av_frame_alloc()). src should have an associated hwframe context, and dst may optionally have a format and associated hwframe context.
If src was created by mapping a frame from the hwframe context of dst, then this function undoes the mapping - dst is replaced by a reference to the frame that src was originally mapped from.
If both src and dst have an associated hwframe context, then this function attempts to map the src frame from its hardware context to that of dst and then fill dst with appropriate data to be usable there. This will only be possible if the hwframe contexts and associated devices are compatible - given compatible devices, av_hwframe_ctx_create_derived() can be used to create a hwframe context for dst in which mapping should be possible.
If src has a hwframe context but dst does not, then the src frame is mapped to normal memory and should thereafter be usable as a normal frame. If the format is set on dst, then the mapping will attempt to create dst with that format and fail if it is not possible. If format is unset (is AV_PIX_FMT_NONE) then dst will be mapped with whatever the most appropriate format to use is (probably the sw_format of the src hwframe context).
A return value of AVERROR(ENOSYS) indicates that the mapping is not possible with the given arguments and hwframe setup, while other return values indicate that it failed somehow.
On failure, the destination frame will be left blank, except for the hw_frames_ctx/format fields thay may have been set by the caller - those will be preserved as they were.
Definition at line 778 of file hwcontext.c.
Referenced by av_hwframe_get_buffer(), hwmap_filter_frame(), hwmap_get_buffer(), qsv_frame_lock(), and qsv_map_from().
Create and initialise an AVHWFramesContext as a mapping of another existing AVHWFramesContext on a different device.
av_hwframe_ctx_init() should not be called after this.
Definition at line 856 of file hwcontext.c.
Referenced by hwmap_config_output().