summaryrefslogtreecommitdiff
path: root/libavutil/hwcontext.h
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2017-03-04 23:57:29 +0000
committerMark Thompson <sw@jkqxz.net>2017-06-14 22:26:29 +0100
commit0b1794a43e1083644aa3db2a09323681cfe080ec (patch)
treef594529bc78f7a2066d038cf526a8686706ec1bc /libavutil/hwcontext.h
parentb22172f6f3530b8bd9d1d2c38a31b1e9c3729e42 (diff)
hwcontext: Make it easier to work with device types
Adds functions to convert to/from strings and a function to iterate over all supported device types. Also adds a new invalid type AV_HWDEVICE_TYPE_NONE, which acts as a sentinel value. (cherry picked from commit b7487f4f3c39b4b202e1ea7bb2de13902f2dee45)
Diffstat (limited to 'libavutil/hwcontext.h')
-rw-r--r--libavutil/hwcontext.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/libavutil/hwcontext.h b/libavutil/hwcontext.h
index 782dbf22e1..37e8831f6b 100644
--- a/libavutil/hwcontext.h
+++ b/libavutil/hwcontext.h
@@ -31,6 +31,7 @@ enum AVHWDeviceType {
AV_HWDEVICE_TYPE_DXVA2,
AV_HWDEVICE_TYPE_QSV,
AV_HWDEVICE_TYPE_VIDEOTOOLBOX,
+ AV_HWDEVICE_TYPE_NONE,
};
typedef struct AVHWDeviceInternal AVHWDeviceInternal;
@@ -224,6 +225,33 @@ typedef struct AVHWFramesContext {
} AVHWFramesContext;
/**
+ * Look up an AVHWDeviceType by name.
+ *
+ * @param name String name of the device type (case-insensitive).
+ * @return The type from enum AVHWDeviceType, or AV_HWDEVICE_TYPE_NONE if
+ * not found.
+ */
+enum AVHWDeviceType av_hwdevice_find_type_by_name(const char *name);
+
+/** Get the string name of an AVHWDeviceType.
+ *
+ * @param type Type from enum AVHWDeviceType.
+ * @return Pointer to a static string containing the name, or NULL if the type
+ * is not valid.
+ */
+const char *av_hwdevice_get_type_name(enum AVHWDeviceType type);
+
+/**
+ * Iterate over supported device types.
+ *
+ * @param type AV_HWDEVICE_TYPE_NONE initially, then the previous type
+ * returned by this function in subsequent iterations.
+ * @return The next usable device type from enum AVHWDeviceType, or
+ * AV_HWDEVICE_TYPE_NONE if there are no more.
+ */
+enum AVHWDeviceType av_hwdevice_iterate_types(enum AVHWDeviceType prev);
+
+/**
* Allocate an AVHWDeviceContext for a given hardware type.
*
* @param type the type of the hardware device to allocate.