mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-12 01:40:04 +01:00
hwcontext: Hardware frame mapping
Adds the new av_hwframe_map() function, which allows mapping between hardware frames and normal memory, along with internal support for implementing it. Also adds av_hwframe_ctx_create_derived(), for creating a hardware frames context associated with one device using frames mapped from another by some hardware-specific means.
This commit is contained in:
@@ -85,6 +85,11 @@ typedef struct HWContextType {
|
||||
const AVFrame *src);
|
||||
int (*transfer_data_from)(AVHWFramesContext *ctx, AVFrame *dst,
|
||||
const AVFrame *src);
|
||||
|
||||
int (*map_to)(AVHWFramesContext *ctx, AVFrame *dst,
|
||||
const AVFrame *src, int flags);
|
||||
int (*map_from)(AVHWFramesContext *ctx, AVFrame *dst,
|
||||
const AVFrame *src, int flags);
|
||||
} HWContextType;
|
||||
|
||||
struct AVHWDeviceInternal {
|
||||
@@ -97,8 +102,43 @@ struct AVHWFramesInternal {
|
||||
void *priv;
|
||||
|
||||
AVBufferPool *pool_internal;
|
||||
|
||||
/**
|
||||
* For a derived context, a reference to the original frames
|
||||
* context it was derived from.
|
||||
*/
|
||||
AVBufferRef *source_frames;
|
||||
};
|
||||
|
||||
typedef struct HWMapDescriptor {
|
||||
/**
|
||||
* A reference to the original source of the mapping.
|
||||
*/
|
||||
AVFrame *source;
|
||||
/**
|
||||
* A reference to the hardware frames context in which this
|
||||
* mapping was made. May be the same as source->hw_frames_ctx,
|
||||
* but need not be.
|
||||
*/
|
||||
AVBufferRef *hw_frames_ctx;
|
||||
/**
|
||||
* Unmap function.
|
||||
*/
|
||||
void (*unmap)(AVHWFramesContext *ctx,
|
||||
struct HWMapDescriptor *hwmap);
|
||||
/**
|
||||
* Hardware-specific private data associated with the mapping.
|
||||
*/
|
||||
void *priv;
|
||||
} HWMapDescriptor;
|
||||
|
||||
int ff_hwframe_map_create(AVBufferRef *hwframe_ref,
|
||||
AVFrame *dst, const AVFrame *src,
|
||||
void (*unmap)(AVHWFramesContext *ctx,
|
||||
HWMapDescriptor *hwmap),
|
||||
void *priv);
|
||||
|
||||
|
||||
extern const HWContextType ff_hwcontext_type_cuda;
|
||||
extern const HWContextType ff_hwcontext_type_dxva2;
|
||||
extern const HWContextType ff_hwcontext_type_qsv;
|
||||
|
||||
Reference in New Issue
Block a user