public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Andreas Sturmlechner" <asturm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: media-video/vlc/, media-video/vlc/files/
Date: Wed, 15 Jan 2025 20:31:41 +0000 (UTC)	[thread overview]
Message-ID: <1736973089.46ba3724fb99c3c0ff8cabf14487c1e8a5d2a0cc.asturm@gentoo> (raw)

commit:     46ba3724fb99c3c0ff8cabf14487c1e8a5d2a0cc
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Wed Jan 15 20:24:19 2025 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Wed Jan 15 20:31:29 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=46ba3724

media-video/vlc: Use upstream patch to fix USE=vaapi w/ >=ffmpeg-5

Bug: https://bugs.gentoo.org/864721
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 .../vlc/files/vlc-3.0.21-vaapi-w-ffmpeg5.patch     | 149 +++++++++++++++++++++
 .../{vlc-3.0.9999.ebuild => vlc-3.0.21-r3.ebuild}  |  28 +---
 media-video/vlc/vlc-3.0.9999.ebuild                |   1 -
 3 files changed, 156 insertions(+), 22 deletions(-)

diff --git a/media-video/vlc/files/vlc-3.0.21-vaapi-w-ffmpeg5.patch b/media-video/vlc/files/vlc-3.0.21-vaapi-w-ffmpeg5.patch
new file mode 100644
index 000000000000..322818b348b7
--- /dev/null
+++ b/media-video/vlc/files/vlc-3.0.21-vaapi-w-ffmpeg5.patch
@@ -0,0 +1,149 @@
+From ba5dc03aecc1d96f81b76838f845ebde7348cf62 Mon Sep 17 00:00:00 2001
+From: David Rosca <nowrep@gmail.com>
+Date: Fri, 20 Dec 2024 20:24:36 +0100
+Subject: [PATCH] avcodec: vaapi: Support VAAPI with latest FFmpeg
+
+---
+ configure.ac                            | 20 +------------
+ modules/codec/Makefile.am               |  2 +-
+ modules/codec/avcodec/avcommon_compat.h |  3 ++
+ modules/codec/avcodec/vaapi.c           | 38 +++++++++++++++++++++++--
+ 4 files changed, 41 insertions(+), 22 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 00afb063c455..089339e10e0b 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -2550,25 +2550,7 @@ AM_CONDITIONAL([HAVE_VAAPI], [test "${have_vaapi}" = "yes"])
+ AM_CONDITIONAL([HAVE_VAAPI_DRM], [test "${have_vaapi_drm}" = "yes"])
+ AM_CONDITIONAL([HAVE_VAAPI_X11], [test "${have_vaapi_x11}" = "yes"])
+ AM_CONDITIONAL([HAVE_VAAPI_WL], [test "${have_vaapi_wl}" = "yes"])
+-
+-have_avcodec_vaapi="no"
+-AS_IF([test "${have_vaapi}" = "yes" -a "${have_avcodec}" = "yes"], [
+-  VLC_SAVE_FLAGS
+-  CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}"
+-  CFLAGS="${CFLAGS} ${AVCODEC_CFLAGS}"
+-  AC_CHECK_HEADERS([libavcodec/vaapi.h], [
+-    AC_MSG_NOTICE([VA API acceleration activated])
+-    have_avcodec_vaapi="yes"
+-  ],[
+-    AS_IF([test -n "${enable_libva}"], [
+-      AC_MSG_ERROR([libva is present but libavcodec/vaapi.h is missing])
+-    ], [
+-      AC_MSG_WARN([libva is present but libavcodec/vaapi.h is missing ])
+-    ])
+-  ])
+-  VLC_RESTORE_FLAGS
+-])
+-AM_CONDITIONAL([HAVE_AVCODEC_VAAPI], [test "${have_avcodec_vaapi}" = "yes"])
++AM_CONDITIONAL([HAVE_AVCODEC_VAAPI], [test "${have_vaapi}" = "yes" -a "${have_avcodec}" = "yes"])
+ 
+ dnl
+ dnl dxva2 needs avcodec
+diff --git a/modules/codec/Makefile.am b/modules/codec/Makefile.am
+index 6d9465fdaef9..dd04391c1bf7 100644
+--- a/modules/codec/Makefile.am
++++ b/modules/codec/Makefile.am
+@@ -416,7 +416,7 @@ libvaapi_plugin_la_SOURCES = \
+ 	codec/avcodec/vaapi.c hw/vaapi/vlc_vaapi.c hw/vaapi/vlc_vaapi.h
+ libvaapi_plugin_la_CPPFLAGS = $(AM_CPPFLAGS)
+ libvaapi_plugin_la_CFLAGS = $(AM_CFLAGS) $(AVCODEC_CFLAGS)
+-libvaapi_plugin_la_LIBADD = $(LIBVA_LIBS)
++libvaapi_plugin_la_LIBADD = $(LIBVA_LIBS) $(AVCODEC_LIBS)
+ if HAVE_AVCODEC_VAAPI
+ if HAVE_VAAPI_DRM
+ codec_LTLIBRARIES += libvaapi_drm_plugin.la
+diff --git a/modules/codec/avcodec/avcommon_compat.h b/modules/codec/avcodec/avcommon_compat.h
+index ac02c06d2339..8ab6910f3250 100644
+--- a/modules/codec/avcodec/avcommon_compat.h
++++ b/modules/codec/avcodec/avcommon_compat.h
+@@ -84,6 +84,9 @@
+ #ifndef FF_API_AVIO_WRITE_NONCONST // removed in ffmpeg 7
+ # define FF_API_AVIO_WRITE_NONCONST (LIBAVFORMAT_VERSION_MAJOR < 61)
+ #endif
++#ifndef FF_API_STRUCT_VAAPI_CONTEXT
++# define FF_API_STRUCT_VAAPI_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 59)
++#endif
+ 
+ #endif /* HAVE_LIBAVCODEC_AVCODEC_H */
+ 
+diff --git a/modules/codec/avcodec/vaapi.c b/modules/codec/avcodec/vaapi.c
+index c83269e43f30..e203baaf9ee2 100644
+--- a/modules/codec/avcodec/vaapi.c
++++ b/modules/codec/avcodec/vaapi.c
+@@ -42,12 +42,25 @@
+ # include <va/va_drm.h>
+ #endif
+ #include <libavcodec/avcodec.h>
++#if FF_API_STRUCT_VAAPI_CONTEXT
+ #include <libavcodec/vaapi.h>
++#else
++#include <libavutil/hwcontext_vaapi.h>
++#endif
+ 
+ #include "avcodec.h"
+ #include "va.h"
+ #include "../../hw/vaapi/vlc_vaapi.h"
+ 
++#if !FF_API_STRUCT_VAAPI_CONTEXT
++struct vaapi_context
++{
++    VADisplay display;
++    VAConfigID config_id;
++    VAContextID context_id;
++};
++#endif
++
+ struct vlc_va_sys_t
+ {
+     struct vlc_vaapi_instance *va_inst;
+@@ -145,8 +158,10 @@ static void Delete(vlc_va_t *va, void **hwctx)
+ 
+     (void) hwctx;
+ 
+-    vlc_vaapi_DestroyContext(o, sys->hw_ctx.display, sys->hw_ctx.context_id);
+-    vlc_vaapi_DestroyConfig(o, sys->hw_ctx.display, sys->hw_ctx.config_id);
++    if (sys->hw_ctx.context_id != VA_INVALID_ID)
++        vlc_vaapi_DestroyContext(o, sys->hw_ctx.display, sys->hw_ctx.context_id);
++    if (sys->hw_ctx.config_id != VA_INVALID_ID)
++        vlc_vaapi_DestroyConfig(o, sys->hw_ctx.display, sys->hw_ctx.config_id);
+     vlc_vaapi_ReleaseInstance(sys->va_inst);
+     free(sys);
+ }
+@@ -196,6 +211,7 @@ static int Create(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *d
+     sys->hw_ctx.config_id = VA_INVALID_ID;
+     sys->hw_ctx.context_id = VA_INVALID_ID;
+ 
++#if FF_API_STRUCT_VAAPI_CONTEXT
+     sys->hw_ctx.config_id =
+         vlc_vaapi_CreateConfigChecked(o, sys->hw_ctx.display, i_profile,
+                                       VAEntrypointVLD, i_vlc_chroma);
+@@ -211,6 +227,24 @@ static int Create(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *d
+         goto error;
+ 
+     ctx->hwaccel_context = &sys->hw_ctx;
++#else
++    AVBufferRef *hwdev_ref = av_hwdevice_ctx_alloc(AV_HWDEVICE_TYPE_VAAPI);
++    if (hwdev_ref == NULL)
++        goto error;
++
++    AVHWDeviceContext *hwdev_ctx = (void *) hwdev_ref->data;
++    AVVAAPIDeviceContext *vadev_ctx = hwdev_ctx->hwctx;
++    vadev_ctx->display = va_dpy;
++
++    if (av_hwdevice_ctx_init(hwdev_ref) < 0)
++    {
++        av_buffer_unref(&hwdev_ref);
++        goto error;
++    }
++
++    ctx->hw_device_ctx = hwdev_ref;
++#endif
++
+     va->sys = sys;
+     va->description = vaQueryVendorString(sys->hw_ctx.display);
+     va->get = Get;
+-- 
+GitLab
+

diff --git a/media-video/vlc/vlc-3.0.9999.ebuild b/media-video/vlc/vlc-3.0.21-r3.ebuild
similarity index 95%
copy from media-video/vlc/vlc-3.0.9999.ebuild
copy to media-video/vlc/vlc-3.0.21-r3.ebuild
index 73417535b63d..540d7d7a940b 100644
--- a/media-video/vlc/vlc-3.0.9999.ebuild
+++ b/media-video/vlc/vlc-3.0.21-r3.ebuild
@@ -1,35 +1,19 @@
-# Copyright 2000-2024 Gentoo Authors
+# Copyright 2000-2025 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
 
 LUA_COMPAT=( lua5-{1..2} )
-
-MY_PV="${PV/_/-}"
-MY_PV="${MY_PV/-beta/-test}"
-MY_P="${PN}-${MY_PV}"
-if [[ ${PV} = *9999 ]] ; then
-	if [[ ${PV%.9999} != ${PV} ]] ; then
-		EGIT_BRANCH="3.0.x"
-	fi
-	EGIT_REPO_URI="https://code.videolan.org/videolan/vlc.git"
-	inherit git-r3
-else
-	if [[ ${MY_P} = ${P} ]] ; then
-		SRC_URI="https://download.videolan.org/pub/videolan/${PN}/${PV}/${P}.tar.xz"
-	else
-		SRC_URI="https://download.videolan.org/pub/videolan/testing/${MY_P}/${MY_P}.tar.xz"
-	fi
-	S="${WORKDIR}/${MY_P}"
-	KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv -sparc ~x86"
-fi
 inherit autotools flag-o-matic lua-single toolchain-funcs virtualx xdg
 
 DESCRIPTION="Media player and framework with support for most multimedia files and streaming"
 HOMEPAGE="https://www.videolan.org/vlc/"
+SRC_URI="https://download.videolan.org/pub/videolan/${PN}/${PV}/${P}.tar.xz
+	https://dev.gentoo.org/~asturm/distfiles/${P}-taglib2.tar.xz"
 
 LICENSE="LGPL-2.1 GPL-2"
 SLOT="0/5-9" # vlc - vlccore
+KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv -sparc ~x86"
 
 IUSE="a52 alsa aom archive aribsub bidi bluray cddb chromaprint chromecast dav1d dbus
 	dc1394 debug directx dts +dvbpsi dvd +encode faad fdk +ffmpeg flac fluidsynth
@@ -233,7 +217,9 @@ PATCHES=(
 	"${FILESDIR}"/${PN}-3.0.11.1-configure_lua_version.patch
 	"${FILESDIR}"/${PN}-3.0.18-drop-minizip-dep.patch
 	"${FILESDIR}"/${PN}-3.0.21-freerdp-2.patch # bug 919296, 590164
-	"${FILESDIR}"/${PN}-3.0.21-vaapi-without-ffmpeg4.patch # bug 864721, thx Fedora
+	"${WORKDIR}"/${P}-taglib2 # bug 938946, in 3.0.x branch
+	"${FILESDIR}"/${PN}-3.0.2.1-vdpau.patch # bug 946178
+	"${FILESDIR}"/${P}-vaapi-w-ffmpeg5.patch # bug 864721, in 3.0.x branch
 )
 
 DOCS=( AUTHORS THANKS NEWS README doc/fortunes.txt )

diff --git a/media-video/vlc/vlc-3.0.9999.ebuild b/media-video/vlc/vlc-3.0.9999.ebuild
index 73417535b63d..c3e406c30347 100644
--- a/media-video/vlc/vlc-3.0.9999.ebuild
+++ b/media-video/vlc/vlc-3.0.9999.ebuild
@@ -233,7 +233,6 @@ PATCHES=(
 	"${FILESDIR}"/${PN}-3.0.11.1-configure_lua_version.patch
 	"${FILESDIR}"/${PN}-3.0.18-drop-minizip-dep.patch
 	"${FILESDIR}"/${PN}-3.0.21-freerdp-2.patch # bug 919296, 590164
-	"${FILESDIR}"/${PN}-3.0.21-vaapi-without-ffmpeg4.patch # bug 864721, thx Fedora
 )
 
 DOCS=( AUTHORS THANKS NEWS README doc/fortunes.txt )


             reply	other threads:[~2025-01-15 20:31 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-15 20:31 Andreas Sturmlechner [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-03-21 22:43 [gentoo-commits] repo/gentoo:master commit in: media-video/vlc/, media-video/vlc/files/ Andreas Sturmlechner
2025-02-12 22:43 Andreas Sturmlechner
2025-01-08  8:22 Sam James
2024-10-04 17:37 Andreas Sturmlechner
2024-07-03 14:26 Ben Kohler
2024-03-17  4:02 Sam James
2023-05-27  2:17 Sam James
2023-05-13 22:52 Sam James
2021-11-07 15:41 Andreas Sturmlechner
2021-08-31 19:06 Pacho Ramos
2021-06-22 18:43 Sam James
2021-04-23  8:09 Sergei Trofimovich
2019-08-01 15:34 Andreas Sturmlechner
2019-03-10  9:34 Andreas Sturmlechner
2019-02-27 22:20 Thomas Raschbacher
2019-02-24 18:01 Andreas Sturmlechner
2018-11-08 12:29 Andreas Sturmlechner
2018-03-18 20:21 Andreas Sturmlechner
2017-12-09 13:52 Andreas Sturmlechner
2017-08-29 19:40 Andreas Sturmlechner
2016-11-26 18:00 Michael Palimaka
2016-11-26 18:00 Michael Palimaka
2016-02-09  7:41 Lars Wendler
2015-10-28  1:43 Ian Delaney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1736973089.46ba3724fb99c3c0ff8cabf14487c1e8a5d2a0cc.asturm@gentoo \
    --to=asturm@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox