]> git.sesse.net Git - ffmpeg/blobdiff - libavutil/hwcontext_internal.h
Merge commit 'ca62236a89f47bd871eaf69d8d9e837c93c55a6c'
[ffmpeg] / libavutil / hwcontext_internal.h
index 30fce2afd95f58a011b07a263111fdd8ca372d2e..2d75d3db0877e2602965c0d7794ce9a48c87c9ab 100644 (file)
@@ -66,6 +66,8 @@ typedef struct HWContextType {
 
     int              (*device_create)(AVHWDeviceContext *ctx, const char *device,
                                       AVDictionary *opts, int flags);
+    int              (*device_derive)(AVHWDeviceContext *dst_ctx,
+                                      AVHWDeviceContext *src_ctx, int flags);
 
     int              (*device_init)(AVHWDeviceContext *ctx);
     void             (*device_uninit)(AVHWDeviceContext *ctx);
@@ -90,11 +92,22 @@ typedef struct HWContextType {
                                const AVFrame *src, int flags);
     int              (*map_from)(AVHWFramesContext *ctx, AVFrame *dst,
                                  const AVFrame *src, int flags);
+
+    int              (*frames_derive_to)(AVHWFramesContext *dst_ctx,
+                                         AVHWFramesContext *src_ctx, int flags);
+    int              (*frames_derive_from)(AVHWFramesContext *dst_ctx,
+                                           AVHWFramesContext *src_ctx, int flags);
 } HWContextType;
 
 struct AVHWDeviceInternal {
     const HWContextType *hw_type;
     void                *priv;
+
+    /**
+     * For a derived device, a reference to the original device
+     * context it was derived from.
+     */
+    AVBufferRef *source_device;
 };
 
 struct AVHWFramesInternal {
@@ -108,6 +121,11 @@ struct AVHWFramesInternal {
      * context it was derived from.
      */
     AVBufferRef *source_frames;
+    /**
+     * Flags to apply to the mapping from the source to the derived
+     * frame context when trying to allocate in the derived context.
+     */
+    int source_allocation_map_flags;
 };
 
 typedef struct HWMapDescriptor {
@@ -140,9 +158,12 @@ int ff_hwframe_map_create(AVBufferRef *hwframe_ref,
 
 
 extern const HWContextType ff_hwcontext_type_cuda;
+extern const HWContextType ff_hwcontext_type_d3d11va;
+extern const HWContextType ff_hwcontext_type_drm;
 extern const HWContextType ff_hwcontext_type_dxva2;
 extern const HWContextType ff_hwcontext_type_qsv;
 extern const HWContextType ff_hwcontext_type_vaapi;
 extern const HWContextType ff_hwcontext_type_vdpau;
+extern const HWContextType ff_hwcontext_type_videotoolbox;
 
 #endif /* AVUTIL_HWCONTEXT_INTERNAL_H */