Accepting request 542474 from home:dimstar:Factory
- Add mpv-vaapi2.patch: Fix build iwth vaapi 2.0. The patch is a backport of the commits 93c52b, f35126 and 2ecf24. - Conditionalize use of %desktop_database_post/postun and icon_theme_cache_post/postun to suse_version < 1330. The functionality has since been replaced by file triggers and the macros expand to %nil. OBS-URL: https://build.opensuse.org/request/show/542474 OBS-URL: https://build.opensuse.org/package/show/multimedia:apps/mpv?expand=0&rev=125
This commit is contained in:
parent
b3b16add9d
commit
151ef96e76
145
mpv-vaapi2.patch
Normal file
145
mpv-vaapi2.patch
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
From 6265a2d7793c52b16f48f6f8db5d8833d350abc5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: wm4 <wm4@nowhere>
|
||||||
|
Date: Fri, 29 Sep 2017 16:51:30 +0200
|
||||||
|
Subject: [PATCH] vaapi: minor changes
|
||||||
|
|
||||||
|
This is for relicensing. Some of this code is loosely based on
|
||||||
|
vo_vaapi.c from the original MPlayer-vaapi patches. Most of the code has
|
||||||
|
changed, and only the initialization code and check_status() look
|
||||||
|
remotely similar. The initialization code is changed to be like Libav's
|
||||||
|
(hwcontext_vaapi.c). check_va_status() is just a C idiom, but to play it
|
||||||
|
safe, we'll either drop it from LGPL code (or recreate it).
|
||||||
|
|
||||||
|
vaapi.c still contains plenty of code from the original patches, but the
|
||||||
|
next commits will move them out of the LGPL code paths.
|
||||||
|
---
|
||||||
|
video/vaapi.c | 14 +++++++-------
|
||||||
|
1 file changed, 7 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
|
Index: mpv-0.27.0/video/vaapi.c
|
||||||
|
===================================================================
|
||||||
|
--- mpv-0.27.0.orig/video/vaapi.c
|
||||||
|
+++ mpv-0.27.0/video/vaapi.c
|
||||||
|
@@ -30,15 +30,6 @@
|
||||||
|
#include <libavutil/hwcontext.h>
|
||||||
|
#include <libavutil/hwcontext_vaapi.h>
|
||||||
|
|
||||||
|
-bool check_va_status(struct mp_log *log, VAStatus status, const char *msg)
|
||||||
|
-{
|
||||||
|
- if (status != VA_STATUS_SUCCESS) {
|
||||||
|
- mp_err(log, "%s: %s\n", msg, vaErrorStr(status));
|
||||||
|
- return false;
|
||||||
|
- }
|
||||||
|
- return true;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
int va_get_colorspace_flag(enum mp_csp csp)
|
||||||
|
{
|
||||||
|
switch (csp) {
|
||||||
|
@@ -112,9 +103,27 @@ static void va_get_formats(struct mp_vaa
|
||||||
|
ctx->image_formats = formats;
|
||||||
|
}
|
||||||
|
|
||||||
|
-// 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;
|
||||||
|
@@ -149,6 +158,7 @@ static void va_info_callback(const char
|
||||||
|
{
|
||||||
|
va_message_callback(msg, MSGL_V);
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
static void open_lavu_vaapi_device(struct mp_vaapi_ctx *ctx)
|
||||||
|
{
|
||||||
|
@@ -181,6 +191,10 @@ struct mp_vaapi_ctx *va_initialize(VADis
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
+#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);
|
||||||
|
@@ -191,15 +205,16 @@ struct mp_vaapi_ctx *va_initialize(VADis
|
||||||
|
vaSetErrorCallback(va_error_callback);
|
||||||
|
vaSetInfoCallback(va_info_callback);
|
||||||
|
#endif
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
- int major_version, minor_version;
|
||||||
|
- int status = vaInitialize(display, &major_version, &minor_version);
|
||||||
|
- if (status != VA_STATUS_SUCCESS && probing)
|
||||||
|
- goto error;
|
||||||
|
- if (!check_va_status(res->log, status, "vaInitialize()"))
|
||||||
|
+ int major, minor;
|
||||||
|
+ int status = vaInitialize(display, &major, &minor);
|
||||||
|
+ if (status != VA_STATUS_SUCCESS) {
|
||||||
|
+ if (!probing)
|
||||||
|
+ MP_ERR(res, "Failed to initialize VAAPI: %s\n", vaErrorStr(status));
|
||||||
|
goto error;
|
||||||
|
-
|
||||||
|
- MP_VERBOSE(res, "VA API version %d.%d\n", major_version, minor_version);
|
||||||
|
+ }
|
||||||
|
+ MP_VERBOSE(res, "Initialized VAAPI: version %d.%d\n", major, minor);
|
||||||
|
|
||||||
|
va_get_formats(res);
|
||||||
|
if (!res->image_formats)
|
||||||
|
@@ -231,6 +246,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) {
|
||||||
|
@@ -241,6 +257,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);
|
||||||
|
}
|
||||||
|
Index: mpv-0.27.0/video/vaapi.h
|
||||||
|
===================================================================
|
||||||
|
--- mpv-0.27.0.orig/video/vaapi.h
|
||||||
|
+++ mpv-0.27.0/video/vaapi.h
|
||||||
|
@@ -41,9 +41,9 @@ struct mp_vaapi_ctx {
|
||||||
|
void (*destroy_native_ctx)(void *native_ctx);
|
||||||
|
};
|
||||||
|
|
||||||
|
-bool check_va_status(struct mp_log *log, VAStatus status, const char *msg);
|
||||||
|
-
|
||||||
|
-#define CHECK_VA_STATUS(ctx, msg) check_va_status((ctx)->log, status, msg)
|
||||||
|
+#define CHECK_VA_STATUS(ctx, msg) \
|
||||||
|
+ (status == VA_STATUS_SUCCESS ? true \
|
||||||
|
+ : (MP_ERR(ctx, "%s failed (%s)\n", msg, vaErrorStr(status)), false))
|
||||||
|
|
||||||
|
int va_get_colorspace_flag(enum mp_csp csp);
|
||||||
|
|
10
mpv.changes
10
mpv.changes
@ -1,3 +1,13 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Nov 16 17:36:01 UTC 2017 - dimstar@opensuse.org
|
||||||
|
|
||||||
|
- Add mpv-vaapi2.patch: Fix build iwth vaapi 2.0. The patch is a
|
||||||
|
backport of the commits 93c52b, f35126 and 2ecf24.
|
||||||
|
- Conditionalize use of %desktop_database_post/postun and
|
||||||
|
icon_theme_cache_post/postun to suse_version < 1330. The
|
||||||
|
functionality has since been replaced by file triggers and the
|
||||||
|
macros expand to %nil.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon Nov 13 15:52:36 UTC 2017 - schwab@suse.de
|
Mon Nov 13 15:52:36 UTC 2017 - schwab@suse.de
|
||||||
|
|
||||||
|
5
mpv.spec
5
mpv.spec
@ -37,6 +37,8 @@ Source2: %{name}.changes
|
|||||||
Source3: https://github.com/2ion/mpv-bash-completion/archive/%{_mbc_ver}.tar.gz#/mpv-bash-completion-%{_mbc_ver}.tar.gz
|
Source3: https://github.com/2ion/mpv-bash-completion/archive/%{_mbc_ver}.tar.gz#/mpv-bash-completion-%{_mbc_ver}.tar.gz
|
||||||
# PATCH-FIX-OPENSUSE do not require equal libav versions, obs rebuilds as needed
|
# PATCH-FIX-OPENSUSE do not require equal libav versions, obs rebuilds as needed
|
||||||
Patch0: mpv-make-ffmpeg-version-check-non-fatal.patch
|
Patch0: mpv-make-ffmpeg-version-check-non-fatal.patch
|
||||||
|
# PATCH-FIx-UPSTREAM mpv-vaapi2.patch dimstar@opensuse.org -- Fix build with vaapi 2.0
|
||||||
|
Patch1: mpv-vaapi2.patch
|
||||||
BuildRequires: bash
|
BuildRequires: bash
|
||||||
BuildRequires: hicolor-icon-theme
|
BuildRequires: hicolor-icon-theme
|
||||||
BuildRequires: libjpeg-devel
|
BuildRequires: libjpeg-devel
|
||||||
@ -194,6 +196,7 @@ features.
|
|||||||
%prep
|
%prep
|
||||||
%setup -q -a 3 -n %{name}-%{_mpv_ver}
|
%setup -q -a 3 -n %{name}-%{_mpv_ver}
|
||||||
%patch0 -p1
|
%patch0 -p1
|
||||||
|
%patch1 -p1
|
||||||
|
|
||||||
# As we downloaded specific waf version we need to put and prepare it in place.
|
# As we downloaded specific waf version we need to put and prepare it in place.
|
||||||
cp -f %{SOURCE1} waf
|
cp -f %{SOURCE1} waf
|
||||||
@ -250,6 +253,7 @@ install -D -m 0644 etc/mpv.conf %{buildroot}%{_sysconfdir}/%{name}/mpv.conf
|
|||||||
# remove shebang
|
# remove shebang
|
||||||
sed -i -e '1d' %{buildroot}%{_datadir}/bash-completion/completions/mpv
|
sed -i -e '1d' %{buildroot}%{_datadir}/bash-completion/completions/mpv
|
||||||
|
|
||||||
|
%if 0%{?suse_version} < 1330
|
||||||
%post
|
%post
|
||||||
%desktop_database_post
|
%desktop_database_post
|
||||||
%icon_theme_cache_post
|
%icon_theme_cache_post
|
||||||
@ -257,6 +261,7 @@ sed -i -e '1d' %{buildroot}%{_datadir}/bash-completion/completions/mpv
|
|||||||
%postun
|
%postun
|
||||||
%desktop_database_postun
|
%desktop_database_postun
|
||||||
%icon_theme_cache_postun
|
%icon_theme_cache_postun
|
||||||
|
%endif
|
||||||
|
|
||||||
%post -n %{lname} -p /sbin/ldconfig
|
%post -n %{lname} -p /sbin/ldconfig
|
||||||
%postun -n %{lname} -p /sbin/ldconfig
|
%postun -n %{lname} -p /sbin/ldconfig
|
||||||
|
Loading…
Reference in New Issue
Block a user