diff options
author | Clément Bœsch <cboesch@gopro.com> | 2017-03-30 11:36:37 +0300 |
---|---|---|
committer | Clément Bœsch <cboesch@gopro.com> | 2017-03-30 11:36:37 +0300 |
commit | 4cda23f1f146211825edbf7a4aed0feeaa00711f (patch) | |
tree | e8fa1d53400df0e7b07599f63018d46cde142cd4 /libavutil/hwcontext_internal.h | |
parent | 03f5e80bdbbfa3229b6af3ad7bc94cc1468cc1b6 (diff) | |
parent | d06aa24ba583ad08025da9e1b29afcd8218ff9b0 (diff) |
Merge commit 'd06aa24ba583ad08025da9e1b29afcd8218ff9b0'
* commit 'd06aa24ba583ad08025da9e1b29afcd8218ff9b0':
hwcontext: Hardware frame mapping
Merged-by: Clément Bœsch <cboesch@gopro.com>
Diffstat (limited to 'libavutil/hwcontext_internal.h')
-rw-r--r-- | libavutil/hwcontext_internal.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/libavutil/hwcontext_internal.h b/libavutil/hwcontext_internal.h index 079e42b37b..30fce2afd9 100644 --- a/libavutil/hwcontext_internal.h +++ b/libavutil/hwcontext_internal.h @@ -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; |