#include "buffer.h"
#include "frame.h"
#include "log.h"
#include "pixfmt.h"
Go to the source code of this file.
|
AVBufferRef * | av_hwdevice_ctx_alloc (enum AVHWDeviceType type) |
| Allocate an AVHWDeviceContext for a given pixel format. More...
|
|
int | av_hwdevice_ctx_init (AVBufferRef *ref) |
| Finalize the device context before use. More...
|
|
int | av_hwdevice_ctx_create (AVBufferRef **device_ctx, enum AVHWDeviceType type, const char *device, AVDictionary *opts, int flags) |
| Open a device of the specified type and create an AVHWDeviceContext for it. More...
|
|
AVBufferRef * | av_hwframe_ctx_alloc (AVBufferRef *device_ctx) |
| Allocate an AVHWFramesContext tied to a given device context. More...
|
|
int | av_hwframe_ctx_init (AVBufferRef *ref) |
| Finalize the context before use. More...
|
|
int | av_hwframe_get_buffer (AVBufferRef *hwframe_ctx, AVFrame *frame, int flags) |
| Allocate a new frame attached to the given AVHWFramesContext. More...
|
|
int | av_hwframe_transfer_data (AVFrame *dst, const AVFrame *src, int flags) |
| Copy data to or from a hw surface. More...
|
|
int | av_hwframe_transfer_get_formats (AVBufferRef *hwframe_ctx, enum AVHWFrameTransferDirection dir, enum AVPixelFormat **formats, int flags) |
| Get a list of possible source or target formats usable in av_hwframe_transfer_data(). More...
|
|
void * | av_hwdevice_hwconfig_alloc (AVBufferRef *device_ctx) |
| Allocate a HW-specific configuration structure for a given HW device. More...
|
|
AVHWFramesConstraints * | av_hwdevice_get_hwframe_constraints (AVBufferRef *ref, const void *hwconfig) |
| Get the constraints on HW frames given a device and the HW-specific configuration to be used with that device. More...
|
|
void | av_hwframe_constraints_free (AVHWFramesConstraints **constraints) |
| Free an AVHWFrameConstraints structure. More...
|
|
◆ AVHWDeviceInternal
◆ AVHWFramesInternal
◆ AVHWDeviceType
Enumerator |
---|
AV_HWDEVICE_TYPE_VDPAU | |
AV_HWDEVICE_TYPE_CUDA | |
AV_HWDEVICE_TYPE_VAAPI | |
AV_HWDEVICE_TYPE_DXVA2 | |
AV_HWDEVICE_TYPE_QSV | |
Definition at line 27 of file hwcontext.h.
◆ AVHWFrameTransferDirection
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 328 of file hwcontext.h.
◆ av_hwdevice_ctx_alloc()
Allocate an AVHWDeviceContext for a given pixel format.
- Parameters
-
format | a hwaccel pixel format (AV_PIX_FMT_FLAG_HWACCEL must be set on the corresponding format descriptor) |
- Returns
- a reference to the newly created AVHWDeviceContext on success or NULL on failure.
◆ av_hwdevice_ctx_init()
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.
- Parameters
-
- Returns
- 0 on success, a negative AVERROR code on failure
◆ av_hwdevice_ctx_create()
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.
- Parameters
-
device_ctx | On success, a reference to the newly-created device context will be written here. The reference is owned by the caller and must be released with av_buffer_unref() when no longer needed. On failure, NULL will be written to this pointer. |
type | The type of the device to create. |
device | A type-specific string identifying the device to open. |
opts | A dictionary of additional (type-specific) options to use in opening the device. The dictionary remains owned by the caller. |
flags | currently unused |
- Returns
- 0 on success, a negative AVERROR code on failure.
◆ av_hwframe_ctx_alloc()
Allocate an AVHWFramesContext tied to a given device context.
- Parameters
-
device_ctx | a reference to a AVHWDeviceContext. This function will make a new reference for internal use, the one passed to the function remains owned by the caller. |
- Returns
- a reference to the newly created AVHWFramesContext on success or NULL on failure.
◆ av_hwframe_ctx_init()
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.
- Parameters
-
- Returns
- 0 on success, a negative AVERROR code on failure
◆ av_hwframe_get_buffer()
Allocate a new frame attached to the given AVHWFramesContext.
- Parameters
-
hwframe_ctx | a reference to an AVHWFramesContext |
frame | an empty (freshly allocated or unreffed) frame to be filled with newly allocated buffers. |
flags | currently unused, should be set to zero |
- Returns
- 0 on success, a negative AVERROR code on failure
◆ av_hwframe_transfer_data()
int av_hwframe_transfer_data |
( |
AVFrame * |
dst, |
|
|
const AVFrame * |
src, |
|
|
int |
flags |
|
) |
| |
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.
- Parameters
-
dst | the destination frame. dst is not touched on failure. |
src | the source frame. |
flags | currently unused, should be set to zero |
- Returns
- 0 on success, a negative AVERROR error code on failure.
◆ av_hwframe_transfer_get_formats()
Get a list of possible source or target formats usable in av_hwframe_transfer_data().
- Parameters
-
hwframe_ctx | the frame context to obtain the information for |
dir | the direction of the transfer |
formats | the pointer to the output format list will be written here. The list is terminated with AV_PIX_FMT_NONE and must be freed by the caller when no longer needed using av_free(). If this function returns successfully, the format list will have at least one item (not counting the terminator). On failure, the contents of this pointer are unspecified. |
flags | currently unused, should be set to zero |
- Returns
- 0 on success, a negative AVERROR code on failure.
◆ av_hwdevice_hwconfig_alloc()
void* av_hwdevice_hwconfig_alloc |
( |
AVBufferRef * |
device_ctx | ) |
|
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().
- Parameters
-
- Returns
- The newly created HW-specific configuration structure on success or NULL on failure.
◆ av_hwdevice_get_hwframe_constraints()
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.
- Parameters
-
device_ctx | a reference to the associated AVHWDeviceContext. |
hwconfig | a filled HW-specific configuration structure, or NULL to return the maximum possible capabilities of the device. |
- Returns
- AVHWFramesConstraints structure describing the constraints on the device, or NULL if not available.
◆ av_hwframe_constraints_free()
Free an AVHWFrameConstraints structure.
- Parameters
-
constraints | The (filled or unfilled) AVHWFrameConstraints structure. |