diff options
author | Matteo Bernardini | 2017-11-28 20:23:41 +0100 |
---|---|---|
committer | Matteo Bernardini | 2018-06-09 08:34:47 +0200 |
commit | c18a71bd6d8d9b2d58c938c9a020925b78499e7f (patch) | |
tree | cc8d972f2178843cd3cc7aa82c59549002a7c604 | |
parent | 81c344443219574587ae3d6bccb8f19c1bd346af (diff) | |
download | old.slackbuilds-mpv.tar.gz |
multimedia/mpv: Patch for the newer VAAPI.mpv
Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org>
-rw-r--r-- | multimedia/mpv/mpv.SlackBuild | 3 | ||||
-rw-r--r-- | multimedia/mpv/vaapi-Use-libva2-message-callbacks.patch | 91 |
2 files changed, 94 insertions, 0 deletions
diff --git a/multimedia/mpv/mpv.SlackBuild b/multimedia/mpv/mpv.SlackBuild index 484cf9486c..3394de552d 100644 --- a/multimedia/mpv/mpv.SlackBuild +++ b/multimedia/mpv/mpv.SlackBuild @@ -73,6 +73,9 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; +# Fix for the newer VAAPI +patch -p1 < $CWD/vaapi-Use-libva2-message-callbacks.patch + DOCS="Copyright LICENSE README.md RELEASE_NOTES" MANUAL="DOCS/*.md DOCS/*.rst DOCS/*.txt" diff --git a/multimedia/mpv/vaapi-Use-libva2-message-callbacks.patch b/multimedia/mpv/vaapi-Use-libva2-message-callbacks.patch new file mode 100644 index 0000000000..6ac3abe82b --- /dev/null +++ b/multimedia/mpv/vaapi-Use-libva2-message-callbacks.patch @@ -0,0 +1,91 @@ +From 2ecf240b1cd20875991a5b18efafbe799864ff7f Mon Sep 17 00:00:00 2001 +From: Mark Thompson <sw@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 + |