summaryrefslogtreecommitdiff
path: root/libavutil/hwcontext.h
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2017-03-04 23:57:28 +0000
committerMark Thompson <sw@jkqxz.net>2017-06-14 22:25:57 +0100
commitb22172f6f3530b8bd9d1d2c38a31b1e9c3729e42 (patch)
tree481a74e995b2bd82dba7eebee805eac5e2708598 /libavutil/hwcontext.h
parent92bd08974541611731b2d58723826ea26ecbe47d (diff)
hwcontext: Add device derivation
Creates a new device context from another of a different type which refers to the same underlying hardware. (cherry picked from commit b266ad56fe0e4ce5bb70118ba2e2b1dabfaf76ce)
Diffstat (limited to 'libavutil/hwcontext.h')
-rw-r--r--libavutil/hwcontext.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/libavutil/hwcontext.h b/libavutil/hwcontext.h
index cfc6ad0e28..782dbf22e1 100644
--- a/libavutil/hwcontext.h
+++ b/libavutil/hwcontext.h
@@ -271,6 +271,32 @@ int av_hwdevice_ctx_create(AVBufferRef **device_ctx, enum AVHWDeviceType type,
const char *device, AVDictionary *opts, int flags);
/**
+ * Create a new device of the specified type from an existing device.
+ *
+ * If the source device is a device of the target type or was originally
+ * derived from such a device (possibly through one or more intermediate
+ * devices of other types), then this will return a reference to the
+ * existing device of the same type as is requested.
+ *
+ * Otherwise, it will attempt to derive a new device from the given source
+ * device. If direct derivation to the new type is not implemented, it will
+ * attempt the same derivation from each ancestor of the source device in
+ * turn looking for an implemented derivation method.
+ *
+ * @param dst_ctx On success, a reference to the newly-created
+ * AVHWDeviceContext.
+ * @param type The type of the new device to create.
+ * @param src_ctx A reference to an existing AVHWDeviceContext which will be
+ * used to create the new device.
+ * @param flags Currently unused; should be set to zero.
+ * @return Zero on success, a negative AVERROR code on failure.
+ */
+int av_hwdevice_ctx_create_derived(AVBufferRef **dst_ctx,
+ enum AVHWDeviceType type,
+ AVBufferRef *src_ctx, int flags);
+
+
+/**
* Allocate an AVHWFramesContext tied to a given device context.
*
* @param device_ctx a reference to a AVHWDeviceContext. This function will make