summaryrefslogtreecommitdiff
path: root/libavutil/hwcontext_internal.h
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2016-10-25 20:38:47 +0100
committerMark Thompson <sw@jkqxz.net>2016-11-03 23:49:01 +0000
commitd06aa24ba583ad08025da9e1b29afcd8218ff9b0 (patch)
tree190d5258c734a4b5b7c7f822b726a732831f89a3 /libavutil/hwcontext_internal.h
parent67351924fa91dea4339109100a4c0689f006581f (diff)
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.
Diffstat (limited to 'libavutil/hwcontext_internal.h')
-rw-r--r--libavutil/hwcontext_internal.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/libavutil/hwcontext_internal.h b/libavutil/hwcontext_internal.h
index a391e2599e..11e3a68e4c 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;