kmsgrab: Fix build failure with old libdrm
authorJun Zhao <jun.zhao@intel.com>
Thu, 14 Sep 2017 00:21:38 +0000 (20:21 -0400)
committerMark Thompson <sw@jkqxz.net>
Thu, 14 Sep 2017 21:40:09 +0000 (22:40 +0100)
DRM_FORMAT_R8 was added in libdrm 2.4.68.
DRM_FORMAT_R16 was added in libdrm 2.4.82.

Signed-off-by: Jun Zhao <jun.zhao@intel.com>
Signed-off-by: Mark Thompson <sw@jkqxz.net>
libavdevice/kmsgrab.c

index d222abf..67a83ef 100644 (file)
@@ -202,8 +202,12 @@ static const struct {
     enum AVPixelFormat pixfmt;
     uint32_t drm_format;
 } kmsgrab_formats[] = {
+#ifdef DRM_FORMAT_R8
     { AV_PIX_FMT_GRAY8,    DRM_FORMAT_R8       },
+#endif
+#ifdef DRM_FORMAT_R16
     { AV_PIX_FMT_GRAY16LE, DRM_FORMAT_R16      },
+#endif
     { AV_PIX_FMT_RGB24,    DRM_FORMAT_RGB888   },
     { AV_PIX_FMT_BGR24,    DRM_FORMAT_BGR888   },
     { AV_PIX_FMT_0RGB,     DRM_FORMAT_XRGB8888 },