]> git.sesse.net Git - ffmpeg/blobdiff - libavutil/hwcontext.h
Merge commit '80fb19bc234a3f2350d891adf39f3738a8e4849f'
[ffmpeg] / libavutil / hwcontext.h
index 44be1977a8f9710cd6f5a4ec560fcb1511104830..4e9da0224d2517f2ae191575c1aafcc0bf09d569 100644 (file)
@@ -28,6 +28,7 @@ enum AVHWDeviceType {
     AV_HWDEVICE_TYPE_VDPAU,
     AV_HWDEVICE_TYPE_CUDA,
     AV_HWDEVICE_TYPE_VAAPI,
+    AV_HWDEVICE_TYPE_DXVA2,
 };
 
 typedef struct AVHWDeviceInternal AVHWDeviceInternal;
@@ -169,7 +170,7 @@ typedef struct AVHWFramesContext {
      * A pool from which the frames are allocated by av_hwframe_get_buffer().
      * This field may be set by the caller before calling av_hwframe_ctx_init().
      * The buffers returned by calling av_buffer_pool_get() on this pool must
-     * have the properties described in the documentation in the correponding hw
+     * have the properties described in the documentation in the corresponding hw
      * type's header (hwcontext_*.h). The pool will be freed strictly before
      * this struct's free() callback is invoked.
      *
@@ -240,6 +241,34 @@ AVBufferRef *av_hwdevice_ctx_alloc(enum AVHWDeviceType type);
  */
 int av_hwdevice_ctx_init(AVBufferRef *ref);
 
+/**
+ * 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.
+ *
+ * @param device_ctx On 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.
+ * @param type The type of the device to create.
+ * @param device A type-specific string identifying the device to open.
+ * @param opts A dictionary of additional (type-specific) options to use in
+ *             opening the device. The dictionary remains owned by the caller.
+ * @param flags currently unused
+ *
+ * @return 0 on success, a negative AVERROR code on failure.
+ */
+int av_hwdevice_ctx_create(AVBufferRef **device_ctx, enum AVHWDeviceType type,
+                           const char *device, AVDictionary *opts, int flags);
+
 /**
  * Allocate an AVHWFramesContext tied to a given device context.
  *
@@ -377,7 +406,7 @@ void *av_hwdevice_hwconfig_alloc(AVBufferRef *device_ctx);
 /**
  * Get the constraints on HW frames given a device and the HW-specific
  * configuration to be used with that device.  If no HW-specific
- * confgiuration is provided, returns the maximum possible capabilities
+ * configuration is provided, returns the maximum possible capabilities
  * of the device.
  *
  * @param device_ctx a reference to the associated AVHWDeviceContext.