hwcontext: Move NONE to the be the first member of AVHWDeviceType
authorMark Thompson <sw@jkqxz.net>
Thu, 23 Mar 2017 19:49:39 +0000 (19:49 +0000)
committerMark Thompson <sw@jkqxz.net>
Mon, 27 Mar 2017 20:54:06 +0000 (21:54 +0100)
Also use that to fix a warning in av_hwdevice_get_type_name().

libavutil/hwcontext.c
libavutil/hwcontext.h

index 2c6d51e..ff9fe99 100644 (file)
@@ -67,7 +67,8 @@ enum AVHWDeviceType av_hwdevice_find_type_by_name(const char *name)
 
 const char *av_hwdevice_get_type_name(enum AVHWDeviceType type)
 {
-    if (type >= 0 && type < FF_ARRAY_ELEMS(hw_type_names))
+    if (type > AV_HWDEVICE_TYPE_NONE &&
+        type < FF_ARRAY_ELEMS(hw_type_names))
         return hw_type_names[type];
     else
         return NULL;
index 040e010..889e303 100644 (file)
 #include "pixfmt.h"
 
 enum AVHWDeviceType {
+    AV_HWDEVICE_TYPE_NONE,
     AV_HWDEVICE_TYPE_VDPAU,
     AV_HWDEVICE_TYPE_CUDA,
     AV_HWDEVICE_TYPE_VAAPI,
     AV_HWDEVICE_TYPE_DXVA2,
     AV_HWDEVICE_TYPE_QSV,
-    AV_HWDEVICE_TYPE_NONE,
 };
 
 typedef struct AVHWDeviceInternal AVHWDeviceInternal;