Date: Sunday, October 29, 2017 @ 21:31:26 Author: eworm Revision: 264701
archrelease: copy trunk to staging-i686, staging-x86_64 Added: mpv/repos/staging-i686/ mpv/repos/staging-i686/0001-opengl-backend-support-multiple-backends.patch (from rev 264700, mpv/trunk/0001-opengl-backend-support-multiple-backends.patch) mpv/repos/staging-i686/0002-vaapi-Use-libva2-message-callbacks.patch (from rev 264700, mpv/trunk/0002-vaapi-Use-libva2-message-callbacks.patch) mpv/repos/staging-i686/PKGBUILD (from rev 264700, mpv/trunk/PKGBUILD) mpv/repos/staging-x86_64/ mpv/repos/staging-x86_64/0001-opengl-backend-support-multiple-backends.patch (from rev 264700, mpv/trunk/0001-opengl-backend-support-multiple-backends.patch) mpv/repos/staging-x86_64/0002-vaapi-Use-libva2-message-callbacks.patch (from rev 264700, mpv/trunk/0002-vaapi-Use-libva2-message-callbacks.patch) mpv/repos/staging-x86_64/PKGBUILD (from rev 264700, mpv/trunk/PKGBUILD) --------------------------------------------------------------------+ staging-i686/0001-opengl-backend-support-multiple-backends.patch | 291 ++++++++++ staging-i686/0002-vaapi-Use-libva2-message-callbacks.patch | 91 +++ staging-i686/PKGBUILD | 68 ++ staging-x86_64/0001-opengl-backend-support-multiple-backends.patch | 291 ++++++++++ staging-x86_64/0002-vaapi-Use-libva2-message-callbacks.patch | 91 +++ staging-x86_64/PKGBUILD | 68 ++ 6 files changed, 900 insertions(+) Copied: mpv/repos/staging-i686/0001-opengl-backend-support-multiple-backends.patch (from rev 264700, mpv/trunk/0001-opengl-backend-support-multiple-backends.patch) =================================================================== --- staging-i686/0001-opengl-backend-support-multiple-backends.patch (rev 0) +++ staging-i686/0001-opengl-backend-support-multiple-backends.patch 2017-10-29 21:31:26 UTC (rev 264701) @@ -0,0 +1,291 @@ +From 9c397af0dabfff7177bcb76409af5b8f9ae608cf Mon Sep 17 00:00:00 2001 +From: Drew DeVault <s...@cmpwn.com> +Date: Thu, 27 Apr 2017 17:19:58 -0400 +Subject: [PATCH 1/4] --opengl-backend: support multiple backends + +Will attempt each backend specified in order. The x11 backend is still +preferred, even on Wayland, but the user can now use +--opengl-backend=wayland,x11 to prefer wayland and fall back to x11 if +wayland is unavailable. +--- + video/out/opengl/context.c | 66 +++++++++++++++++++++++++++++++++++++++++----- + video/out/opengl/context.h | 8 ++---- + video/out/vo_opengl.c | 7 +++-- + 3 files changed, 64 insertions(+), 17 deletions(-) + +diff --git a/video/out/opengl/context.c b/video/out/opengl/context.c +index 72311e11fa..568bb662b8 100644 +--- a/video/out/opengl/context.c ++++ b/video/out/opengl/context.c +@@ -89,6 +89,30 @@ static const struct mpgl_driver *const backends[] = { + #endif + }; + ++static bool get_desc(struct m_obj_desc *dst, int index) ++{ ++ if (index >= MP_ARRAY_SIZE(backends) - 1) ++ return false; ++ const struct mpgl_driver *driver = backends[index]; ++ *dst = (struct m_obj_desc) { ++ .name = driver->name, ++ .description = driver->name, ++ .priv_size = sizeof(struct mpgl_driver), ++ .p = driver, ++ }; ++ return true; ++} ++ ++// for backend option ++const struct m_obj_list mpgl_backend_list = { ++ .get_desc = get_desc, ++ .description = "OpenGL windowing backends", ++ .allow_unknown_entries = true, ++ .allow_disable_entries = true, ++ .allow_trailer = true, ++ .disallow_positional_parameters = true, ++}; ++ + // 0-terminated list of desktop GL versions a backend should try to + // initialize. The first entry is the most preferred version. + const int mpgl_preferred_gl_versions[] = { +@@ -100,7 +124,7 @@ const int mpgl_preferred_gl_versions[] = { + 0 + }; + +-int mpgl_find_backend(const char *name) ++static int mpgl_find_backend(const char *name) + { + if (name == NULL || strcmp(name, "auto") == 0) + return -1; +@@ -126,7 +150,7 @@ int mpgl_validate_backend_opt(struct mp_log *log, const struct m_option *opt, + return mpgl_find_backend(s) >= -1 ? 1 : M_OPT_INVALID; + } + +-static void *get_native_display(void *pctx, const char *name) ++static void *get_native_display(const char *name) + { + MPGLContext *ctx = pctx; + if (!ctx->native_display_type || !name) +@@ -186,11 +210,41 @@ cleanup: + + // Create a VO window and create a GL context on it. + // vo_flags: passed to the backend's create window function +-MPGLContext *mpgl_init(struct vo *vo, const char *backend_name, int vo_flags) ++MPGLContext *mpgl_init(struct vo *vo, struct m_obj_settings *backend_list, int vo_flags) + { + MPGLContext *ctx = NULL; +- int index = mpgl_find_backend(backend_name); +- if (index == -1) { ++ if (backend_list && backend_list[0].name) { ++ int n; ++ for (n = 0; backend_list[n].name; n++) { ++ // Something like "--opengl-backend=name," allows fallback to autoprobing. ++ int index = mpgl_find_backend(backend_list[n].name); ++ if (index == -1 || strlen(backend_list[n].name) == 0) ++ goto autoprobe; ++ if (index == -2) { ++ MP_FATAL(vo, "Unknown opengl backend '%s'\n", backend_list[n].name); ++ exit(-2); ++ return NULL; ++ } ++ ctx = init_backend(vo, backends[index], true, vo_flags); ++ if (ctx) ++ break; ++ } ++ if (!ctx && !vo->probing) { ++ // Now try with probing off ++ for (n = 0; backend_list[n].name; n++) { ++ int index = mpgl_find_backend(backend_list[n].name); ++ ctx = init_backend(vo, backends[index], false, vo_flags); ++ if (ctx) ++ break; ++ } ++ if (!ctx) { ++ // Backend explicitly requested, but unable to fulfill ++ return NULL; ++ } ++ } ++ } ++ if (!ctx) { ++autoprobe: + for (int n = 0; n < MP_ARRAY_SIZE(backends); n++) { + ctx = init_backend(vo, backends[n], true, vo_flags); + if (ctx) +@@ -204,8 +258,6 @@ MPGLContext *mpgl_init(struct vo *vo, const char *backend_name, int vo_flags) + break; + } + } +- } else if (index >= 0) { +- ctx = init_backend(vo, backends[index], false, vo_flags); + } + return ctx; + } +diff --git a/video/out/opengl/context.h b/video/out/opengl/context.h +index 229c5ef54f..7cf439c1a0 100644 +--- a/video/out/opengl/context.h ++++ b/video/out/opengl/context.h +@@ -100,17 +100,13 @@ typedef struct MPGLContext { + void *priv; + } MPGLContext; + +-MPGLContext *mpgl_init(struct vo *vo, const char *backend_name, int vo_flags); ++MPGLContext *mpgl_init(struct vo *vo, struct m_obj_settings *backend_list, int vo_flags); + void mpgl_uninit(MPGLContext *ctx); + int mpgl_reconfig_window(struct MPGLContext *ctx); + int mpgl_control(struct MPGLContext *ctx, int *events, int request, void *arg); + void mpgl_start_frame(struct MPGLContext *ctx); + void mpgl_swap_buffers(struct MPGLContext *ctx); + +-int mpgl_find_backend(const char *name); +- +-struct m_option; +-int mpgl_validate_backend_opt(struct mp_log *log, const struct m_option *opt, +- struct bstr name, struct bstr param); ++extern const struct m_obj_list mpgl_backend_list; + + #endif +diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c +index 9b3f944e21..91e55b3b2f 100644 +--- a/video/out/vo_opengl.c ++++ b/video/out/vo_opengl.c +@@ -55,7 +55,7 @@ struct vo_opengl_opts { + int allow_sw; + int swap_interval; + int vsync_fences; +- char *backend; ++ struct m_obj_settings *backend_list; + int es; + int pattern[2]; + }; +@@ -383,7 +383,7 @@ static int preinit(struct vo *vo) + if (p->opts.allow_sw) + vo_flags |= VOFLAG_SW; + +- p->glctx = mpgl_init(vo, p->opts.backend, vo_flags); ++ p->glctx = mpgl_init(vo, p->opts.backend_list, vo_flags); + if (!p->glctx) + goto err_out; + p->gl = p->glctx->gl; +@@ -438,8 +438,7 @@ const struct vo_driver video_out_opengl = { + OPT_FLAG("opengl-waitvsync", opts.waitvsync, 0), + OPT_INT("opengl-swapinterval", opts.swap_interval, 0), + OPT_FLAG("opengl-debug", opts.use_gl_debug, 0), +- OPT_STRING_VALIDATE("opengl-backend", opts.backend, 0, +- mpgl_validate_backend_opt), ++ OPT_SETTINGSLIST("opengl-backend", opts.backend_list, 0, &mpgl_backend_list ), + OPT_FLAG("opengl-sw", opts.allow_sw, 0), + OPT_CHOICE("opengl-es", opts.es, 0, ({"no", -1}, {"auto", 0}, + {"yes", 1}, {"force2", 2})), +From 4e89fae50f70d065ff8ffee40aa8dffe8131210e Mon Sep 17 00:00:00 2001 +From: Drew DeVault <s...@cmpwn.com> +Date: Thu, 27 Apr 2017 17:51:39 -0400 +Subject: [PATCH 2/4] Update mpv.1 +--- + DOCS/man/options.rst | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst +index 925c501881..5d57720e3d 100644 +--- a/DOCS/man/options.rst ++++ b/DOCS/man/options.rst +@@ -4480,9 +4480,10 @@ The following video options are currently all specific to ``--vo=opengl`` and + Continue even if a software renderer is detected. + + ``--opengl-backend=<sys>`` +- The value ``auto`` (the default) selects the windowing backend. You can +- also pass ``help`` to get a complete list of compiled in backends (sorted +- by autoprobe order). ++ Specify a priority list of windowing backends to use with OpenGL. The value ++ ``auto`` (the default) automatically probes for the most suitable backend. ++ You can also pass ``help`` to get a complete list of compiled in backends ++ (sorted by autoprobe order). + + auto + auto-select (default) +From 3fb437fa09ebf20635c02f41ce0e3d13423d1454 Mon Sep 17 00:00:00 2001 +From: Drew DeVault <s...@cmpwn.com> +Date: Thu, 27 Apr 2017 20:12:51 -0400 +Subject: [PATCH 3/4] Let options handle invalid backends +--- + video/out/opengl/context.c | 17 +++++++++-------- + 1 file changed, 9 insertions(+), 8 deletions(-) + +diff --git a/video/out/opengl/context.c b/video/out/opengl/context.c +index 568bb662b8..8aa44b67cc 100644 +--- a/video/out/opengl/context.c ++++ b/video/out/opengl/context.c +@@ -91,6 +91,14 @@ static const struct mpgl_driver *const backends[] = { + + static bool get_desc(struct m_obj_desc *dst, int index) + { ++ if (index == 0) { ++ *dst = (struct m_obj_desc) { ++ .name = "auto", ++ .description = "automatically select most suitable backend" ++ }; ++ return true; ++ } ++ index--; + if (index >= MP_ARRAY_SIZE(backends) - 1) + return false; + const struct mpgl_driver *driver = backends[index]; +@@ -107,8 +115,6 @@ static bool get_desc(struct m_obj_desc *dst, int index) + const struct m_obj_list mpgl_backend_list = { + .get_desc = get_desc, + .description = "OpenGL windowing backends", +- .allow_unknown_entries = true, +- .allow_disable_entries = true, + .allow_trailer = true, + .disallow_positional_parameters = true, + }; +@@ -218,13 +224,8 @@ MPGLContext *mpgl_init(struct vo *vo, struct m_obj_settings *backend_list, int v + for (n = 0; backend_list[n].name; n++) { + // Something like "--opengl-backend=name," allows fallback to autoprobing. + int index = mpgl_find_backend(backend_list[n].name); +- if (index == -1 || strlen(backend_list[n].name) == 0) ++ if (index < 0 || strlen(backend_list[n].name) == 0) + goto autoprobe; +- if (index == -2) { +- MP_FATAL(vo, "Unknown opengl backend '%s'\n", backend_list[n].name); +- exit(-2); +- return NULL; +- } + ctx = init_backend(vo, backends[index], true, vo_flags); + if (ctx) + break; +From 605785c4846ecaa969309f7fb63cfba59751ba61 Mon Sep 17 00:00:00 2001 +From: Drew DeVault <s...@cmpwn.com> +Date: Fri, 26 May 2017 15:31:24 -0400 +Subject: [PATCH 4/4] Updates following HEAD +--- + video/out/opengl/context.c | 17 +---------------- + 1 file changed, 1 insertion(+), 16 deletions(-) + +diff --git a/video/out/opengl/context.c b/video/out/opengl/context.c +index 8aa44b67cc..4cc0829c90 100644 +--- a/video/out/opengl/context.c ++++ b/video/out/opengl/context.c +@@ -141,22 +141,7 @@ static int mpgl_find_backend(const char *name) + return -2; + } + +-int mpgl_validate_backend_opt(struct mp_log *log, const struct m_option *opt, +- struct bstr name, struct bstr param) +-{ +- if (bstr_equals0(param, "help")) { +- mp_info(log, "OpenGL windowing backends:\n"); +- mp_info(log, " auto (autodetect)\n"); +- for (int n = 0; n < MP_ARRAY_SIZE(backends); n++) +- mp_info(log, " %s\n", backends[n]->name); +- return M_OPT_EXIT; +- } +- char s[20]; +- snprintf(s, sizeof(s), "%.*s", BSTR_P(param)); +- return mpgl_find_backend(s) >= -1 ? 1 : M_OPT_INVALID; +-} +- +-static void *get_native_display(const char *name) ++static void *get_native_display(void *pctx, const char *name) + { + MPGLContext *ctx = pctx; + if (!ctx->native_display_type || !name) Copied: mpv/repos/staging-i686/0002-vaapi-Use-libva2-message-callbacks.patch (from rev 264700, mpv/trunk/0002-vaapi-Use-libva2-message-callbacks.patch) =================================================================== --- staging-i686/0002-vaapi-Use-libva2-message-callbacks.patch (rev 0) +++ staging-i686/0002-vaapi-Use-libva2-message-callbacks.patch 2017-10-29 21:31:26 UTC (rev 264701) @@ -0,0 +1,91 @@ +From 2ecf240b1cd20875991a5b18efafbe799864ff7f Mon Sep 17 00:00:00 2001 +From: Mark Thompson <s...@jkqxz.net> +Date: Mon, 9 Oct 2017 20:10:26 +0100 +Subject: vaapi: Use libva2 message callbacks + +They are no longer global, so they work vaguely sensibly. +--- + video/vaapi.c | 32 +++++++++++++++++++++++++++++--- + 1 file changed, 29 insertions(+), 3 deletions(-) + +diff --git a/video/vaapi.c b/video/vaapi.c +index 6bedbbaa18..3b1cb9cc41 100644 +--- a/video/vaapi.c ++++ b/video/vaapi.c +@@ -40,9 +40,27 @@ int va_get_colorspace_flag(enum mp_csp csp) + return 0; + } + +-// VA message callbacks are global and do not have a context parameter, so it's +-// impossible to know from which VADisplay they originate. Try to route them +-// to existing mpv/libmpv instances within this process. ++#if VA_CHECK_VERSION(1, 0, 0) ++static void va_message_callback(void *context, const char *msg, int mp_level) ++{ ++ struct mp_vaapi_ctx *res = context; ++ mp_msg(res->log, mp_level, "libva: %s", msg); ++} ++ ++static void va_error_callback(void *context, const char *msg) ++{ ++ va_message_callback(context, msg, MSGL_ERR); ++} ++ ++static void va_info_callback(void *context, const char *msg) ++{ ++ va_message_callback(context, msg, MSGL_V); ++} ++#else ++// Pre-libva2 VA message callbacks are global and do not have a context ++// parameter, so it's impossible to know from which VADisplay they ++// originate. Try to route them to existing mpv/libmpv instances within ++// this process. + static pthread_mutex_t va_log_mutex = PTHREAD_MUTEX_INITIALIZER; + static struct mp_vaapi_ctx **va_mpv_clients; + static int num_va_mpv_clients; +@@ -77,6 +95,7 @@ static void va_info_callback(const char *msg) + { + va_message_callback(msg, MSGL_V); + } ++#endif + + static void open_lavu_vaapi_device(struct mp_vaapi_ctx *ctx) + { +@@ -108,6 +127,10 @@ struct mp_vaapi_ctx *va_initialize(VADisplay *display, struct mp_log *plog, + }, + }; + ++#if VA_CHECK_VERSION(1, 0, 0) ++ vaSetErrorCallback(display, va_error_callback, res); ++ vaSetInfoCallback(display, va_info_callback, res); ++#else + pthread_mutex_lock(&va_log_mutex); + MP_TARRAY_APPEND(NULL, va_mpv_clients, num_va_mpv_clients, res); + pthread_mutex_unlock(&va_log_mutex); +@@ -117,6 +140,7 @@ struct mp_vaapi_ctx *va_initialize(VADisplay *display, struct mp_log *plog, + #ifdef VA_FOURCC_I010 + vaSetErrorCallback(va_error_callback); + vaSetInfoCallback(va_info_callback); ++#endif + #endif + + int major, minor; +@@ -154,6 +178,7 @@ void va_destroy(struct mp_vaapi_ctx *ctx) + if (ctx->destroy_native_ctx) + ctx->destroy_native_ctx(ctx->native_ctx); + ++#if !VA_CHECK_VERSION(1, 0, 0) + pthread_mutex_lock(&va_log_mutex); + for (int n = 0; n < num_va_mpv_clients; n++) { + if (va_mpv_clients[n] == ctx) { +@@ -164,6 +189,7 @@ void va_destroy(struct mp_vaapi_ctx *ctx) + if (num_va_mpv_clients == 0) + TA_FREEP(&va_mpv_clients); // avoid triggering leak detectors + pthread_mutex_unlock(&va_log_mutex); ++#endif + + talloc_free(ctx); + } +-- +cgit v1.1-22-g1649 + Copied: mpv/repos/staging-i686/PKGBUILD (from rev 264700, mpv/trunk/PKGBUILD) =================================================================== --- staging-i686/PKGBUILD (rev 0) +++ staging-i686/PKGBUILD 2017-10-29 21:31:26 UTC (rev 264701) @@ -0,0 +1,68 @@ +# $Id$ +# Maintainer: Christian Hesse <m...@eworm.de> +# Contributor: Bartłomiej Piotrowski <bpiotrow...@archlinux.org> +# Contributor: Eivind Uggedal <eiv...@uggedal.com> + +pkgname=mpv +epoch=1 +pkgver=0.27.0 +pkgrel=3 +_waf_version=1.8.12 +pkgdesc='a free, open source, and cross-platform media player' +arch=('i686' 'x86_64') +license=('GPL') +url='http://mpv.io' +depends=( + 'ffmpeg' 'lcms2' 'libcdio-paranoia' 'libgl' 'libxss' + 'libxinerama' 'libxv' 'libxkbcommon' 'libva' 'wayland' 'libcaca' + 'desktop-file-utils' 'hicolor-icon-theme' 'xdg-utils' 'lua52' 'libdvdnav' + 'libxrandr' 'jack' 'rubberband' 'uchardet' 'libarchive' +) +makedepends=('mesa' 'python-docutils' 'ladspa') +optdepends=('youtube-dl: for video-sharing websites playback') +options=('!emptydirs') +source=("$pkgname-$pkgver.tar.gz::https://github.com/mpv-player/$pkgname/archive/v$pkgver.tar.gz" + '0001-opengl-backend-support-multiple-backends.patch' + '0002-vaapi-Use-libva2-message-callbacks.patch' + "http://www.freehackers.org/~tnagy/release/waf-${_waf_version}") +sha256sums=('341d8bf18b75c1f78d5b681480b5b7f5c8b87d97a0d4f53a5648ede9c219a49c' + '609e0530f1b0cdb910dcffb5f62bf55936540e24105ce1b2daf1bd6291a7d58a' + '3c3517f4f4c71e39e1e04ea440688fc8d7b3dc55e6bc0a9398d11a9b75bde07d' + '01bf2beab2106d1558800c8709bc2c8e496d3da4a2ca343fe091f22fca60c98b') + +prepare() { + cd ${pkgname}-${pkgver} + + # --opengl-backend: support multiple backends (#4384) (FS#53962) + patch -Np1 < "${srcdir}"/0001-opengl-backend-support-multiple-backends.patch + + # vaapi: Use libva2 message callbacks + patch -Np1 < "${srcdir}"/0002-vaapi-Use-libva2-message-callbacks.patch + + install -m755 "${srcdir}"/waf-${_waf_version} waf +} + +build() { + cd ${pkgname}-${pkgver} + + ./waf configure --prefix=/usr \ + --confdir=/etc/mpv \ + --enable-cdda \ + --enable-dvb \ + --enable-dvdnav \ + --enable-encoding \ + --enable-libarchive \ + --enable-libmpv-shared \ + --enable-zsh-comp + + ./waf build +} + +package() { + cd ${pkgname}-${pkgver} + + ./waf install --destdir="$pkgdir" + + install -m644 DOCS/{encoding.rst,tech-overview.txt} \ + "$pkgdir"/usr/share/doc/mpv +} Copied: mpv/repos/staging-x86_64/0001-opengl-backend-support-multiple-backends.patch (from rev 264700, mpv/trunk/0001-opengl-backend-support-multiple-backends.patch) =================================================================== --- staging-x86_64/0001-opengl-backend-support-multiple-backends.patch (rev 0) +++ staging-x86_64/0001-opengl-backend-support-multiple-backends.patch 2017-10-29 21:31:26 UTC (rev 264701) @@ -0,0 +1,291 @@ +From 9c397af0dabfff7177bcb76409af5b8f9ae608cf Mon Sep 17 00:00:00 2001 +From: Drew DeVault <s...@cmpwn.com> +Date: Thu, 27 Apr 2017 17:19:58 -0400 +Subject: [PATCH 1/4] --opengl-backend: support multiple backends + +Will attempt each backend specified in order. The x11 backend is still +preferred, even on Wayland, but the user can now use +--opengl-backend=wayland,x11 to prefer wayland and fall back to x11 if +wayland is unavailable. +--- + video/out/opengl/context.c | 66 +++++++++++++++++++++++++++++++++++++++++----- + video/out/opengl/context.h | 8 ++---- + video/out/vo_opengl.c | 7 +++-- + 3 files changed, 64 insertions(+), 17 deletions(-) + +diff --git a/video/out/opengl/context.c b/video/out/opengl/context.c +index 72311e11fa..568bb662b8 100644 +--- a/video/out/opengl/context.c ++++ b/video/out/opengl/context.c +@@ -89,6 +89,30 @@ static const struct mpgl_driver *const backends[] = { + #endif + }; + ++static bool get_desc(struct m_obj_desc *dst, int index) ++{ ++ if (index >= MP_ARRAY_SIZE(backends) - 1) ++ return false; ++ const struct mpgl_driver *driver = backends[index]; ++ *dst = (struct m_obj_desc) { ++ .name = driver->name, ++ .description = driver->name, ++ .priv_size = sizeof(struct mpgl_driver), ++ .p = driver, ++ }; ++ return true; ++} ++ ++// for backend option ++const struct m_obj_list mpgl_backend_list = { ++ .get_desc = get_desc, ++ .description = "OpenGL windowing backends", ++ .allow_unknown_entries = true, ++ .allow_disable_entries = true, ++ .allow_trailer = true, ++ .disallow_positional_parameters = true, ++}; ++ + // 0-terminated list of desktop GL versions a backend should try to + // initialize. The first entry is the most preferred version. + const int mpgl_preferred_gl_versions[] = { +@@ -100,7 +124,7 @@ const int mpgl_preferred_gl_versions[] = { + 0 + }; + +-int mpgl_find_backend(const char *name) ++static int mpgl_find_backend(const char *name) + { + if (name == NULL || strcmp(name, "auto") == 0) + return -1; +@@ -126,7 +150,7 @@ int mpgl_validate_backend_opt(struct mp_log *log, const struct m_option *opt, + return mpgl_find_backend(s) >= -1 ? 1 : M_OPT_INVALID; + } + +-static void *get_native_display(void *pctx, const char *name) ++static void *get_native_display(const char *name) + { + MPGLContext *ctx = pctx; + if (!ctx->native_display_type || !name) +@@ -186,11 +210,41 @@ cleanup: + + // Create a VO window and create a GL context on it. + // vo_flags: passed to the backend's create window function +-MPGLContext *mpgl_init(struct vo *vo, const char *backend_name, int vo_flags) ++MPGLContext *mpgl_init(struct vo *vo, struct m_obj_settings *backend_list, int vo_flags) + { + MPGLContext *ctx = NULL; +- int index = mpgl_find_backend(backend_name); +- if (index == -1) { ++ if (backend_list && backend_list[0].name) { ++ int n; ++ for (n = 0; backend_list[n].name; n++) { ++ // Something like "--opengl-backend=name," allows fallback to autoprobing. ++ int index = mpgl_find_backend(backend_list[n].name); ++ if (index == -1 || strlen(backend_list[n].name) == 0) ++ goto autoprobe; ++ if (index == -2) { ++ MP_FATAL(vo, "Unknown opengl backend '%s'\n", backend_list[n].name); ++ exit(-2); ++ return NULL; ++ } ++ ctx = init_backend(vo, backends[index], true, vo_flags); ++ if (ctx) ++ break; ++ } ++ if (!ctx && !vo->probing) { ++ // Now try with probing off ++ for (n = 0; backend_list[n].name; n++) { ++ int index = mpgl_find_backend(backend_list[n].name); ++ ctx = init_backend(vo, backends[index], false, vo_flags); ++ if (ctx) ++ break; ++ } ++ if (!ctx) { ++ // Backend explicitly requested, but unable to fulfill ++ return NULL; ++ } ++ } ++ } ++ if (!ctx) { ++autoprobe: + for (int n = 0; n < MP_ARRAY_SIZE(backends); n++) { + ctx = init_backend(vo, backends[n], true, vo_flags); + if (ctx) +@@ -204,8 +258,6 @@ MPGLContext *mpgl_init(struct vo *vo, const char *backend_name, int vo_flags) + break; + } + } +- } else if (index >= 0) { +- ctx = init_backend(vo, backends[index], false, vo_flags); + } + return ctx; + } +diff --git a/video/out/opengl/context.h b/video/out/opengl/context.h +index 229c5ef54f..7cf439c1a0 100644 +--- a/video/out/opengl/context.h ++++ b/video/out/opengl/context.h +@@ -100,17 +100,13 @@ typedef struct MPGLContext { + void *priv; + } MPGLContext; + +-MPGLContext *mpgl_init(struct vo *vo, const char *backend_name, int vo_flags); ++MPGLContext *mpgl_init(struct vo *vo, struct m_obj_settings *backend_list, int vo_flags); + void mpgl_uninit(MPGLContext *ctx); + int mpgl_reconfig_window(struct MPGLContext *ctx); + int mpgl_control(struct MPGLContext *ctx, int *events, int request, void *arg); + void mpgl_start_frame(struct MPGLContext *ctx); + void mpgl_swap_buffers(struct MPGLContext *ctx); + +-int mpgl_find_backend(const char *name); +- +-struct m_option; +-int mpgl_validate_backend_opt(struct mp_log *log, const struct m_option *opt, +- struct bstr name, struct bstr param); ++extern const struct m_obj_list mpgl_backend_list; + + #endif +diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c +index 9b3f944e21..91e55b3b2f 100644 +--- a/video/out/vo_opengl.c ++++ b/video/out/vo_opengl.c +@@ -55,7 +55,7 @@ struct vo_opengl_opts { + int allow_sw; + int swap_interval; + int vsync_fences; +- char *backend; ++ struct m_obj_settings *backend_list; + int es; + int pattern[2]; + }; +@@ -383,7 +383,7 @@ static int preinit(struct vo *vo) + if (p->opts.allow_sw) + vo_flags |= VOFLAG_SW; + +- p->glctx = mpgl_init(vo, p->opts.backend, vo_flags); ++ p->glctx = mpgl_init(vo, p->opts.backend_list, vo_flags); + if (!p->glctx) + goto err_out; + p->gl = p->glctx->gl; +@@ -438,8 +438,7 @@ const struct vo_driver video_out_opengl = { + OPT_FLAG("opengl-waitvsync", opts.waitvsync, 0), + OPT_INT("opengl-swapinterval", opts.swap_interval, 0), + OPT_FLAG("opengl-debug", opts.use_gl_debug, 0), +- OPT_STRING_VALIDATE("opengl-backend", opts.backend, 0, +- mpgl_validate_backend_opt), ++ OPT_SETTINGSLIST("opengl-backend", opts.backend_list, 0, &mpgl_backend_list ), + OPT_FLAG("opengl-sw", opts.allow_sw, 0), + OPT_CHOICE("opengl-es", opts.es, 0, ({"no", -1}, {"auto", 0}, + {"yes", 1}, {"force2", 2})), +From 4e89fae50f70d065ff8ffee40aa8dffe8131210e Mon Sep 17 00:00:00 2001 +From: Drew DeVault <s...@cmpwn.com> +Date: Thu, 27 Apr 2017 17:51:39 -0400 +Subject: [PATCH 2/4] Update mpv.1 +--- + DOCS/man/options.rst | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst +index 925c501881..5d57720e3d 100644 +--- a/DOCS/man/options.rst ++++ b/DOCS/man/options.rst +@@ -4480,9 +4480,10 @@ The following video options are currently all specific to ``--vo=opengl`` and + Continue even if a software renderer is detected. + + ``--opengl-backend=<sys>`` +- The value ``auto`` (the default) selects the windowing backend. You can +- also pass ``help`` to get a complete list of compiled in backends (sorted +- by autoprobe order). ++ Specify a priority list of windowing backends to use with OpenGL. The value ++ ``auto`` (the default) automatically probes for the most suitable backend. ++ You can also pass ``help`` to get a complete list of compiled in backends ++ (sorted by autoprobe order). + + auto + auto-select (default) +From 3fb437fa09ebf20635c02f41ce0e3d13423d1454 Mon Sep 17 00:00:00 2001 +From: Drew DeVault <s...@cmpwn.com> +Date: Thu, 27 Apr 2017 20:12:51 -0400 +Subject: [PATCH 3/4] Let options handle invalid backends +--- + video/out/opengl/context.c | 17 +++++++++-------- + 1 file changed, 9 insertions(+), 8 deletions(-) + +diff --git a/video/out/opengl/context.c b/video/out/opengl/context.c +index 568bb662b8..8aa44b67cc 100644 +--- a/video/out/opengl/context.c ++++ b/video/out/opengl/context.c +@@ -91,6 +91,14 @@ static const struct mpgl_driver *const backends[] = { + + static bool get_desc(struct m_obj_desc *dst, int index) + { ++ if (index == 0) { ++ *dst = (struct m_obj_desc) { ++ .name = "auto", ++ .description = "automatically select most suitable backend" ++ }; ++ return true; ++ } ++ index--; + if (index >= MP_ARRAY_SIZE(backends) - 1) + return false; + const struct mpgl_driver *driver = backends[index]; +@@ -107,8 +115,6 @@ static bool get_desc(struct m_obj_desc *dst, int index) + const struct m_obj_list mpgl_backend_list = { + .get_desc = get_desc, + .description = "OpenGL windowing backends", +- .allow_unknown_entries = true, +- .allow_disable_entries = true, + .allow_trailer = true, + .disallow_positional_parameters = true, + }; +@@ -218,13 +224,8 @@ MPGLContext *mpgl_init(struct vo *vo, struct m_obj_settings *backend_list, int v + for (n = 0; backend_list[n].name; n++) { + // Something like "--opengl-backend=name," allows fallback to autoprobing. + int index = mpgl_find_backend(backend_list[n].name); +- if (index == -1 || strlen(backend_list[n].name) == 0) ++ if (index < 0 || strlen(backend_list[n].name) == 0) + goto autoprobe; +- if (index == -2) { +- MP_FATAL(vo, "Unknown opengl backend '%s'\n", backend_list[n].name); +- exit(-2); +- return NULL; +- } + ctx = init_backend(vo, backends[index], true, vo_flags); + if (ctx) + break; +From 605785c4846ecaa969309f7fb63cfba59751ba61 Mon Sep 17 00:00:00 2001 +From: Drew DeVault <s...@cmpwn.com> +Date: Fri, 26 May 2017 15:31:24 -0400 +Subject: [PATCH 4/4] Updates following HEAD +--- + video/out/opengl/context.c | 17 +---------------- + 1 file changed, 1 insertion(+), 16 deletions(-) + +diff --git a/video/out/opengl/context.c b/video/out/opengl/context.c +index 8aa44b67cc..4cc0829c90 100644 +--- a/video/out/opengl/context.c ++++ b/video/out/opengl/context.c +@@ -141,22 +141,7 @@ static int mpgl_find_backend(const char *name) + return -2; + } + +-int mpgl_validate_backend_opt(struct mp_log *log, const struct m_option *opt, +- struct bstr name, struct bstr param) +-{ +- if (bstr_equals0(param, "help")) { +- mp_info(log, "OpenGL windowing backends:\n"); +- mp_info(log, " auto (autodetect)\n"); +- for (int n = 0; n < MP_ARRAY_SIZE(backends); n++) +- mp_info(log, " %s\n", backends[n]->name); +- return M_OPT_EXIT; +- } +- char s[20]; +- snprintf(s, sizeof(s), "%.*s", BSTR_P(param)); +- return mpgl_find_backend(s) >= -1 ? 1 : M_OPT_INVALID; +-} +- +-static void *get_native_display(const char *name) ++static void *get_native_display(void *pctx, const char *name) + { + MPGLContext *ctx = pctx; + if (!ctx->native_display_type || !name) Copied: mpv/repos/staging-x86_64/0002-vaapi-Use-libva2-message-callbacks.patch (from rev 264700, mpv/trunk/0002-vaapi-Use-libva2-message-callbacks.patch) =================================================================== --- staging-x86_64/0002-vaapi-Use-libva2-message-callbacks.patch (rev 0) +++ staging-x86_64/0002-vaapi-Use-libva2-message-callbacks.patch 2017-10-29 21:31:26 UTC (rev 264701) @@ -0,0 +1,91 @@ +From 2ecf240b1cd20875991a5b18efafbe799864ff7f Mon Sep 17 00:00:00 2001 +From: Mark Thompson <s...@jkqxz.net> +Date: Mon, 9 Oct 2017 20:10:26 +0100 +Subject: vaapi: Use libva2 message callbacks + +They are no longer global, so they work vaguely sensibly. +--- + video/vaapi.c | 32 +++++++++++++++++++++++++++++--- + 1 file changed, 29 insertions(+), 3 deletions(-) + +diff --git a/video/vaapi.c b/video/vaapi.c +index 6bedbbaa18..3b1cb9cc41 100644 +--- a/video/vaapi.c ++++ b/video/vaapi.c +@@ -40,9 +40,27 @@ int va_get_colorspace_flag(enum mp_csp csp) + return 0; + } + +-// VA message callbacks are global and do not have a context parameter, so it's +-// impossible to know from which VADisplay they originate. Try to route them +-// to existing mpv/libmpv instances within this process. ++#if VA_CHECK_VERSION(1, 0, 0) ++static void va_message_callback(void *context, const char *msg, int mp_level) ++{ ++ struct mp_vaapi_ctx *res = context; ++ mp_msg(res->log, mp_level, "libva: %s", msg); ++} ++ ++static void va_error_callback(void *context, const char *msg) ++{ ++ va_message_callback(context, msg, MSGL_ERR); ++} ++ ++static void va_info_callback(void *context, const char *msg) ++{ ++ va_message_callback(context, msg, MSGL_V); ++} ++#else ++// Pre-libva2 VA message callbacks are global and do not have a context ++// parameter, so it's impossible to know from which VADisplay they ++// originate. Try to route them to existing mpv/libmpv instances within ++// this process. + static pthread_mutex_t va_log_mutex = PTHREAD_MUTEX_INITIALIZER; + static struct mp_vaapi_ctx **va_mpv_clients; + static int num_va_mpv_clients; +@@ -77,6 +95,7 @@ static void va_info_callback(const char *msg) + { + va_message_callback(msg, MSGL_V); + } ++#endif + + static void open_lavu_vaapi_device(struct mp_vaapi_ctx *ctx) + { +@@ -108,6 +127,10 @@ struct mp_vaapi_ctx *va_initialize(VADisplay *display, struct mp_log *plog, + }, + }; + ++#if VA_CHECK_VERSION(1, 0, 0) ++ vaSetErrorCallback(display, va_error_callback, res); ++ vaSetInfoCallback(display, va_info_callback, res); ++#else + pthread_mutex_lock(&va_log_mutex); + MP_TARRAY_APPEND(NULL, va_mpv_clients, num_va_mpv_clients, res); + pthread_mutex_unlock(&va_log_mutex); +@@ -117,6 +140,7 @@ struct mp_vaapi_ctx *va_initialize(VADisplay *display, struct mp_log *plog, + #ifdef VA_FOURCC_I010 + vaSetErrorCallback(va_error_callback); + vaSetInfoCallback(va_info_callback); ++#endif + #endif + + int major, minor; +@@ -154,6 +178,7 @@ void va_destroy(struct mp_vaapi_ctx *ctx) + if (ctx->destroy_native_ctx) + ctx->destroy_native_ctx(ctx->native_ctx); + ++#if !VA_CHECK_VERSION(1, 0, 0) + pthread_mutex_lock(&va_log_mutex); + for (int n = 0; n < num_va_mpv_clients; n++) { + if (va_mpv_clients[n] == ctx) { +@@ -164,6 +189,7 @@ void va_destroy(struct mp_vaapi_ctx *ctx) + if (num_va_mpv_clients == 0) + TA_FREEP(&va_mpv_clients); // avoid triggering leak detectors + pthread_mutex_unlock(&va_log_mutex); ++#endif + + talloc_free(ctx); + } +-- +cgit v1.1-22-g1649 + Copied: mpv/repos/staging-x86_64/PKGBUILD (from rev 264700, mpv/trunk/PKGBUILD) =================================================================== --- staging-x86_64/PKGBUILD (rev 0) +++ staging-x86_64/PKGBUILD 2017-10-29 21:31:26 UTC (rev 264701) @@ -0,0 +1,68 @@ +# $Id$ +# Maintainer: Christian Hesse <m...@eworm.de> +# Contributor: Bartłomiej Piotrowski <bpiotrow...@archlinux.org> +# Contributor: Eivind Uggedal <eiv...@uggedal.com> + +pkgname=mpv +epoch=1 +pkgver=0.27.0 +pkgrel=3 +_waf_version=1.8.12 +pkgdesc='a free, open source, and cross-platform media player' +arch=('i686' 'x86_64') +license=('GPL') +url='http://mpv.io' +depends=( + 'ffmpeg' 'lcms2' 'libcdio-paranoia' 'libgl' 'libxss' + 'libxinerama' 'libxv' 'libxkbcommon' 'libva' 'wayland' 'libcaca' + 'desktop-file-utils' 'hicolor-icon-theme' 'xdg-utils' 'lua52' 'libdvdnav' + 'libxrandr' 'jack' 'rubberband' 'uchardet' 'libarchive' +) +makedepends=('mesa' 'python-docutils' 'ladspa') +optdepends=('youtube-dl: for video-sharing websites playback') +options=('!emptydirs') +source=("$pkgname-$pkgver.tar.gz::https://github.com/mpv-player/$pkgname/archive/v$pkgver.tar.gz" + '0001-opengl-backend-support-multiple-backends.patch' + '0002-vaapi-Use-libva2-message-callbacks.patch' + "http://www.freehackers.org/~tnagy/release/waf-${_waf_version}") +sha256sums=('341d8bf18b75c1f78d5b681480b5b7f5c8b87d97a0d4f53a5648ede9c219a49c' + '609e0530f1b0cdb910dcffb5f62bf55936540e24105ce1b2daf1bd6291a7d58a' + '3c3517f4f4c71e39e1e04ea440688fc8d7b3dc55e6bc0a9398d11a9b75bde07d' + '01bf2beab2106d1558800c8709bc2c8e496d3da4a2ca343fe091f22fca60c98b') + +prepare() { + cd ${pkgname}-${pkgver} + + # --opengl-backend: support multiple backends (#4384) (FS#53962) + patch -Np1 < "${srcdir}"/0001-opengl-backend-support-multiple-backends.patch + + # vaapi: Use libva2 message callbacks + patch -Np1 < "${srcdir}"/0002-vaapi-Use-libva2-message-callbacks.patch + + install -m755 "${srcdir}"/waf-${_waf_version} waf +} + +build() { + cd ${pkgname}-${pkgver} + + ./waf configure --prefix=/usr \ + --confdir=/etc/mpv \ + --enable-cdda \ + --enable-dvb \ + --enable-dvdnav \ + --enable-encoding \ + --enable-libarchive \ + --enable-libmpv-shared \ + --enable-zsh-comp + + ./waf build +} + +package() { + cd ${pkgname}-${pkgver} + + ./waf install --destdir="$pkgdir" + + install -m644 DOCS/{encoding.rst,tech-overview.txt} \ + "$pkgdir"/usr/share/doc/mpv +}