summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorAlexander Preisinger <alexander.preisinger@gmail.com>2013-09-09 18:21:48 +0200
committerAlexander Preisinger <alexander.preisinger@gmail.com>2013-09-09 18:21:48 +0200
commitb30ad057a5dc4a6d866256f9e7d45de6b2859d36 (patch)
tree8b04f2c16260652772a5b3f4cf9a22650a4312fd /video
parent005407338d8943cbb5ce551ee7f6ae9ac94091a6 (diff)
downloadmpv-b30ad057a5dc4a6d866256f9e7d45de6b2859d36.tar.bz2
mpv-b30ad057a5dc4a6d866256f9e7d45de6b2859d36.tar.xz
wayland/shm: version detection that also works
The previous method would break on the next release. Because I am stupid.
Diffstat (limited to 'video')
-rw-r--r--video/out/vo_wayland.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/video/out/vo_wayland.c b/video/out/vo_wayland.c
index 291180e952..a0c7fe6673 100644
--- a/video/out/vo_wayland.c
+++ b/video/out/vo_wayland.c
@@ -41,6 +41,13 @@
#define MAX_BUFFERS 2
+// minium target version for the new formats (1.2.90)
+#define MINIMUM_VERSION (1 << 16 | 2 << 8 | 90)
+
+#define CURRENT_VERSION (WAYLAND_VERSION_MAJOR << 16 | \
+ WAYLAND_VERSION_MINOR << 8 | \
+ WAYLAND_VERSION_MICRO)
+
static void draw_image(struct vo *vo, mp_image_t *mpi);
static const struct wl_callback_listener frame_listener;
@@ -58,9 +65,7 @@ struct fmtentry {
static const struct fmtentry fmttable[] = {
{WL_SHM_FORMAT_ARGB8888, IMGFMT_BGRA}, // 8b 8g 8r 8a
{WL_SHM_FORMAT_XRGB8888, IMGFMT_BGR0},
-#if (WAYLAND_VERSION_MAJOR >= 1) \
- && (WAYLAND_VERSION_MINOR >= 2) \
- && (WAYLAND_VERSION_MICRO >= 90)
+#if CURRENT_VERSION >= MINIMUM_VERSION
{WL_SHM_FORMAT_RGB332, IMGFMT_BGR8}, // 3b 3g 2r
{WL_SHM_FORMAT_BGR233, IMGFMT_RGB8}, // 3r 3g 3b,
{WL_SHM_FORMAT_XRGB4444, IMGFMT_BGR12_LE}, // 4b 4g 4r 4a