World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
Файл hwcontext.h

См. исходные тексты.

Классы

struct  AVHWDeviceContext
 
struct  AVHWFramesContext
 
struct  AVHWFramesConstraints
 

Определения типов

typedef struct AVHWDeviceInternal AVHWDeviceInternal
 
typedef struct AVHWDeviceContext AVHWDeviceContext
 
typedef struct AVHWFramesInternal AVHWFramesInternal
 
typedef struct AVHWFramesContext AVHWFramesContext
 
typedef struct AVHWFramesConstraints AVHWFramesConstraints
 

Перечисления

enum  AVHWDeviceType {
  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
}
 
enum  AVHWFrameTransferDirection { AV_HWFRAME_TRANSFER_DIRECTION_FROM, AV_HWFRAME_TRANSFER_DIRECTION_TO }
 
enum  { AV_HWFRAME_MAP_READ = 1 << 0, AV_HWFRAME_MAP_WRITE = 1 << 1, AV_HWFRAME_MAP_OVERWRITE = 1 << 2, AV_HWFRAME_MAP_DIRECT = 1 << 3 }
 

Функции

enum AVHWDeviceType av_hwdevice_find_type_by_name (const char *name)
 
const char * av_hwdevice_get_type_name (enum AVHWDeviceType type)
 
enum AVHWDeviceType av_hwdevice_iterate_types (enum AVHWDeviceType prev)
 
AVBufferRefav_hwdevice_ctx_alloc (enum AVHWDeviceType type)
 
int av_hwdevice_ctx_init (AVBufferRef *ref)
 
int av_hwdevice_ctx_create (AVBufferRef **device_ctx, enum AVHWDeviceType type, const char *device, AVDictionary *opts, int flags)
 
int av_hwdevice_ctx_create_derived (AVBufferRef **dst_ctx, enum AVHWDeviceType type, AVBufferRef *src_ctx, int flags)
 
AVBufferRefav_hwframe_ctx_alloc (AVBufferRef *device_ctx)
 
int av_hwframe_ctx_init (AVBufferRef *ref)
 
int av_hwframe_get_buffer (AVBufferRef *hwframe_ctx, AVFrame *frame, int flags)
 
int av_hwframe_transfer_data (AVFrame *dst, const AVFrame *src, int flags)
 
int av_hwframe_transfer_get_formats (AVBufferRef *hwframe_ctx, enum AVHWFrameTransferDirection dir, enum AVPixelFormat **formats, int flags)
 
voidav_hwdevice_hwconfig_alloc (AVBufferRef *device_ctx)
 
AVHWFramesConstraintsav_hwdevice_get_hwframe_constraints (AVBufferRef *ref, const void *hwconfig)
 
void av_hwframe_constraints_free (AVHWFramesConstraints **constraints)
 
int av_hwframe_map (AVFrame *dst, const AVFrame *src, int flags)
 
int av_hwframe_ctx_create_derived (AVBufferRef **derived_frame_ctx, enum AVPixelFormat format, AVBufferRef *derived_device_ctx, AVBufferRef *source_frame_ctx, int flags)
 

Типы

◆ AVHWDeviceInternal

См. определение в файле hwcontext.h строка 41

◆ AVHWDeviceContext

This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e. state that is not tied to a concrete processing configuration. E.g., in an API that supports hardware-accelerated encoding and decoding, this struct will (if possible) wrap the state that is common to both encoding and decoding and from which specific instances of encoders or decoders can be derived.

This struct is reference-counted with the AVBuffer mechanism. The av_hwdevice_ctx_alloc() constructor yields a reference, whose data field points to the actual AVHWDeviceContext. Further objects derived from AVHWDeviceContext (such as AVHWFramesContext, describing a frame pool with specific properties) will hold an internal reference to it. After all the references are released, the AVHWDeviceContext itself will be freed, optionally invoking a user-specified callback for uninitializing the hardware state.

◆ AVHWFramesInternal

См. определение в файле hwcontext.h строка 111

◆ AVHWFramesContext

This struct describes a set or pool of "hardware" frames (i.e. those with data not located in normal system memory). All the frames in the pool are assumed to be allocated in the same way and interchangeable.

This struct is reference-counted with the AVBuffer mechanism and tied to a given AVHWDeviceContext instance. The av_hwframe_ctx_alloc() constructor yields a reference, whose data field points to the actual AVHWFramesContext struct.

◆ AVHWFramesConstraints

This struct describes the constraints on hardware frames attached to a given device with a hardware-specific configuration. This is returned by av_hwdevice_get_hwframe_constraints() and must be freed by av_hwframe_constraints_free() after use.

Перечисления

◆ AVHWDeviceType

Элементы перечислений
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 

См. определение в файле hwcontext.h строка 27

◆ AVHWFrameTransferDirection

Элементы перечислений
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.

См. определение в файле hwcontext.h строка 394

◆ anonymous enum

anonymous enum

Flags to apply to frame mappings.

Элементы перечислений
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.

См. определение в файле hwcontext.h строка 499

499  {
503  AV_HWFRAME_MAP_READ = 1 << 0,
507  AV_HWFRAME_MAP_WRITE = 1 << 1,
513  AV_HWFRAME_MAP_OVERWRITE = 1 << 2,
519  AV_HWFRAME_MAP_DIRECT = 1 << 3,
520 };

Функции

◆ av_hwdevice_find_type_by_name()

enum AVHWDeviceType av_hwdevice_find_type_by_name ( const char *  name)

Look up an AVHWDeviceType by name.

Аргументы
nameString name of the device type (case-insensitive).
Возвращает
The type from enum AVHWDeviceType, or AV_HWDEVICE_TYPE_NONE if not found.

◆ av_hwdevice_get_type_name()

const char* av_hwdevice_get_type_name ( enum AVHWDeviceType  type)

Get the string name of an AVHWDeviceType.

Аргументы
typeType from enum AVHWDeviceType.
Возвращает
Pointer to a static string containing the name, or NULL if the type is not valid.

◆ av_hwdevice_iterate_types()

enum AVHWDeviceType av_hwdevice_iterate_types ( enum AVHWDeviceType  prev)

Iterate over supported device types.

Аргументы
typeAV_HWDEVICE_TYPE_NONE initially, then the previous type returned by this function in subsequent iterations.
Возвращает
The next usable device type from enum AVHWDeviceType, or AV_HWDEVICE_TYPE_NONE if there are no more.

◆ av_hwdevice_ctx_alloc()

AVBufferRef* av_hwdevice_ctx_alloc ( enum AVHWDeviceType  type)

Allocate an AVHWDeviceContext for a given hardware type.

Аргументы
typethe type of the hardware device to allocate.
Возвращает
a reference to the newly created AVHWDeviceContext on success or NULL on failure.

◆ av_hwdevice_ctx_init()

int av_hwdevice_ctx_init ( AVBufferRef ref)

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.

Аргументы
refa reference to the AVHWDeviceContext
Возвращает
0 on success, a negative AVERROR code on failure

◆ av_hwdevice_ctx_create()

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.

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.

Аргументы
device_ctxOn 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.
typeThe type of the device to create.
deviceA type-specific string identifying the device to open.
optsA dictionary of additional (type-specific) options to use in opening the device. The dictionary remains owned by the caller.
flagscurrently unused
Возвращает
0 on success, a negative AVERROR code on failure.

◆ av_hwdevice_ctx_create_derived()

int av_hwdevice_ctx_create_derived ( AVBufferRef **  dst_ctx,
enum AVHWDeviceType  type,
AVBufferRef src_ctx,
int  flags 
)

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.

Аргументы
dst_ctxOn success, a reference to the newly-created AVHWDeviceContext.
typeThe type of the new device to create.
src_ctxA reference to an existing AVHWDeviceContext which will be used to create the new device.
flagsCurrently unused; should be set to zero.
Возвращает
Zero on success, a negative AVERROR code on failure.

◆ av_hwframe_ctx_alloc()

AVBufferRef* av_hwframe_ctx_alloc ( AVBufferRef device_ctx)

Allocate an AVHWFramesContext tied to a given device context.

Аргументы
device_ctxa 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.
Возвращает
a reference to the newly created AVHWFramesContext on success or NULL on failure.

◆ av_hwframe_ctx_init()

int av_hwframe_ctx_init ( AVBufferRef ref)

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.

Аргументы
refa reference to the AVHWFramesContext
Возвращает
0 on success, a negative AVERROR code on failure

◆ av_hwframe_get_buffer()

int av_hwframe_get_buffer ( AVBufferRef hwframe_ctx,
AVFrame frame,
int  flags 
)

Allocate a new frame attached to the given AVHWFramesContext.

Аргументы
hwframe_ctxa reference to an AVHWFramesContext
framean empty (freshly allocated or unreffed) frame to be filled with newly allocated buffers.
flagscurrently unused, should be set to zero
Возвращает
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.

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.

Аргументы
dstthe destination frame. dst is not touched on failure.
srcthe source frame.
flagscurrently unused, should be set to zero
Возвращает
0 on success, a negative AVERROR error code on failure.

◆ av_hwframe_transfer_get_formats()

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().

Аргументы
hwframe_ctxthe frame context to obtain the information for
dirthe direction of the transfer
formatsthe 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.
flagscurrently unused, should be set to zero
Возвращает
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().

Аргументы
device_ctxa reference to the associated AVHWDeviceContext.
Возвращает
The newly created HW-specific configuration structure on success or NULL on failure.

◆ av_hwdevice_get_hwframe_constraints()

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. If no HW-specific configuration is provided, returns the maximum possible capabilities of the device.

Аргументы
refa reference to the associated AVHWDeviceContext.
hwconfiga filled HW-specific configuration structure, or NULL to return the maximum possible capabilities of the device.
Возвращает
AVHWFramesConstraints structure describing the constraints on the device, or NULL if not available.

◆ av_hwframe_constraints_free()

void av_hwframe_constraints_free ( AVHWFramesConstraints **  constraints)

Free an AVHWFrameConstraints structure.

Аргументы
constraintsThe (filled or unfilled) AVHWFrameConstraints structure.

◆ av_hwframe_map()

int av_hwframe_map ( AVFrame dst,
const AVFrame src,
int  flags 
)

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.

Аргументы
dstDestination frame, to contain the mapping.
srcSource frame, to be mapped.
flagsSome combination of AV_HWFRAME_MAP_* flags.
Возвращает
Zero on success, negative AVERROR code on failure.

◆ av_hwframe_ctx_create_derived()

int av_hwframe_ctx_create_derived ( AVBufferRef **  derived_frame_ctx,
enum AVPixelFormat  format,
AVBufferRef derived_device_ctx,
AVBufferRef source_frame_ctx,
int  flags 
)

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.

Аргументы
derived_frame_ctxOn success, a reference to the newly created AVHWFramesContext.
derived_device_ctxA reference to the device to create the new AVHWFramesContext on.
source_frame_ctxA reference to an existing AVHWFramesContext which will be mapped to the derived context.
flagsSome combination of AV_HWFRAME_MAP_* flags, defining the mapping parameters to apply to frames which are allocated in the derived device.
Возвращает
Zero on success, negative AVERROR code on failure.
AV_HWFRAME_TRANSFER_DIRECTION_FROM
@ AV_HWFRAME_TRANSFER_DIRECTION_FROM
Definition: hwcontext.h:398
AV_HWDEVICE_TYPE_NONE
@ AV_HWDEVICE_TYPE_NONE
Definition: hwcontext.h:28
AV_HWDEVICE_TYPE_MEDIACODEC
@ AV_HWDEVICE_TYPE_MEDIACODEC
Definition: hwcontext.h:38
AV_HWDEVICE_TYPE_VIDEOTOOLBOX
@ AV_HWDEVICE_TYPE_VIDEOTOOLBOX
Definition: hwcontext.h:34
AV_HWDEVICE_TYPE_CUDA
@ AV_HWDEVICE_TYPE_CUDA
Definition: hwcontext.h:30
AV_HWDEVICE_TYPE_D3D11VA
@ AV_HWDEVICE_TYPE_D3D11VA
Definition: hwcontext.h:35
AV_HWFRAME_MAP_WRITE
@ AV_HWFRAME_MAP_WRITE
Definition: hwcontext.h:507
AV_HWDEVICE_TYPE_DXVA2
@ AV_HWDEVICE_TYPE_DXVA2
Definition: hwcontext.h:32
AV_HWDEVICE_TYPE_OPENCL
@ AV_HWDEVICE_TYPE_OPENCL
Definition: hwcontext.h:37
AV_HWFRAME_MAP_DIRECT
@ AV_HWFRAME_MAP_DIRECT
Definition: hwcontext.h:519
AV_HWFRAME_MAP_READ
@ AV_HWFRAME_MAP_READ
Definition: hwcontext.h:503
AV_HWDEVICE_TYPE_VAAPI
@ AV_HWDEVICE_TYPE_VAAPI
Definition: hwcontext.h:31
AV_HWDEVICE_TYPE_VDPAU
@ AV_HWDEVICE_TYPE_VDPAU
Definition: hwcontext.h:29
AV_HWDEVICE_TYPE_QSV
@ AV_HWDEVICE_TYPE_QSV
Definition: hwcontext.h:33
AV_HWFRAME_MAP_OVERWRITE
@ AV_HWFRAME_MAP_OVERWRITE
Definition: hwcontext.h:513
AV_HWDEVICE_TYPE_DRM
@ AV_HWDEVICE_TYPE_DRM
Definition: hwcontext.h:36
AV_HWFRAME_TRANSFER_DIRECTION_TO
@ AV_HWFRAME_TRANSFER_DIRECTION_TO
Definition: hwcontext.h:403