FreeBSD Bugzilla – Attachment 241531 Details for
Bug 261302
multimedia/ffmpeg: update to 6.0
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for exp-run
ffmpeg6-exprun-git-am.patch (text/plain), 125.40 KB, created by
Daniel Engberg
on 2023-04-16 18:14:52 UTC
(
hide
)
Description:
Patch for exp-run
Filename:
MIME Type:
Creator:
Daniel Engberg
Created:
2023-04-16 18:14:52 UTC
Size:
125.40 KB
patch
obsolete
>From b70152e0b529f76810337617fb73e8a7d0fa01d0 Mon Sep 17 00:00:00 2001 >From: Daniel Engberg <daniel.engberg.lists@pyret.net> >Date: Sun, 16 Apr 2023 19:26:08 +0200 >Subject: [PATCH] Patches... > >--- > audio/chromaprint/Makefile | 7 +- > audio/chromaprint/distinfo | 6 +- > audio/spek/Makefile | 15 +- > audio/spek/distinfo | 5 +- > audio/spek/files/patch-src_spek-audio.cc | 58 - > audio/spek/pkg-plist | 14 + > graphics/synfig/Makefile | 24 +- > graphics/synfig/distinfo | 3 +- > ...h-src_modules_mod__libavcodec_trgt__av.cpp | 51 + > graphics/synfigstudio/Makefile | 25 +- > graphics/synfigstudio/distinfo | 3 +- > ...-av_stream_get_first_dts-for-qt5-webengine | 35 + > multimedia/ffmpegthumbnailer/Makefile | 22 +- > multimedia/ffmpegthumbnailer/distinfo | 6 +- > .../files/patch-CMakeLists.txt | 52 - > multimedia/kodi/files/patch-ffmpeg6 | 2114 +++++++++++++++++ > multimedia/libxine/Makefile | 12 +- > multimedia/libxine/distinfo | 6 +- > multimedia/libxine/files/patch-dav1d-1.0 | 47 - > .../files/patch-include-xine-xineutils.h | 22 - > ...atch-src_combined_ffmpeg_demux__avformat.c | 35 + > ...h-src_combined_ffmpeg_ff__audio__decoder.c | 152 ++ > multimedia/libxine/pkg-plist | 2 +- > multimedia/vdr-plugin-xineliboutput/Makefile | 2 +- > multimedia/vlc/Makefile | 1 + > multimedia/xine/Makefile | 4 +- > .../patch-add-support-for-ffmpeg5-and-later | 140 ++ > 27 files changed, 2615 insertions(+), 248 deletions(-) > delete mode 100644 audio/spek/files/patch-src_spek-audio.cc > create mode 100644 graphics/synfig/files/patch-src_modules_mod__libavcodec_trgt__av.cpp > create mode 100644 multimedia/ffmpeg/files/ffmpeg-patch-add-av_stream_get_first_dts-for-qt5-webengine > delete mode 100644 multimedia/ffmpegthumbnailer/files/patch-CMakeLists.txt > create mode 100644 multimedia/kodi/files/patch-ffmpeg6 > delete mode 100644 multimedia/libxine/files/patch-dav1d-1.0 > delete mode 100644 multimedia/libxine/files/patch-include-xine-xineutils.h > create mode 100644 multimedia/libxine/files/patch-src_combined_ffmpeg_demux__avformat.c > create mode 100644 multimedia/libxine/files/patch-src_combined_ffmpeg_ff__audio__decoder.c > create mode 100644 www/qt5-webengine/files/patch-add-support-for-ffmpeg5-and-later > >diff --git a/audio/chromaprint/Makefile b/audio/chromaprint/Makefile >index a9ebc1437aa8..9d037ba2e099 100644 >--- a/audio/chromaprint/Makefile >+++ b/audio/chromaprint/Makefile >@@ -1,7 +1,7 @@ > PORTNAME= chromaprint >-PORTVERSION= 1.5.1 >+DISTVERSION= 1.5.1.a.20221217 > CATEGORIES= audio >-MASTER_SITES= https://github.com/acoustid/${PORTNAME}/releases/download/v${PORTVERSION}/ >+#MASTER_SITES= https://github.com/acoustid/${PORTNAME}/releases/download/v${DISTVERSION}/ > > MAINTAINER= jhale@FreeBSD.org > COMMENT= AcoustID audio fingerprinting library >@@ -14,6 +14,9 @@ LICENSE_FILE_MIT= ${WRKSRC}/LICENSE.md > LIB_DEPENDS= libavcodec.so:multimedia/ffmpeg > > USES= cmake compiler:c++11-lib pathfix >+USE_GITHUB= yes >+GH_ACCOUNT= acoustid >+GH_TAGNAME= aa67c95 > USE_LDCONFIG= yes > > CMAKE_ARGS= -DBUILD_TOOLS:BOOL=true \ >diff --git a/audio/chromaprint/distinfo b/audio/chromaprint/distinfo >index 419f5d9decd7..d42def2d7cbd 100644 >--- a/audio/chromaprint/distinfo >+++ b/audio/chromaprint/distinfo >@@ -1,3 +1,3 @@ >-TIMESTAMP = 1663260813 >-SHA256 (chromaprint-1.5.1.tar.gz) = a1aad8fa3b8b18b78d3755b3767faff9abb67242e01b478ec9a64e190f335e1c >-SIZE (chromaprint-1.5.1.tar.gz) = 1581159 >+TIMESTAMP = 1678719395 >+SHA256 (acoustid-chromaprint-1.5.1.a.20221217-aa67c95_GH0.tar.gz) = 0893b7198121dd2add81aa1233e5312cbc7446bdd6b6418a5af6ab24e82cb6b3 >+SIZE (acoustid-chromaprint-1.5.1.a.20221217-aa67c95_GH0.tar.gz) = 1581151 >diff --git a/audio/spek/Makefile b/audio/spek/Makefile >index cf91c9221c34..55e0baae5ee2 100644 >--- a/audio/spek/Makefile >+++ b/audio/spek/Makefile >@@ -1,8 +1,7 @@ > PORTNAME= spek >-PORTVERSION= 0.8.2 >-PORTREVISION= 17 >+DISTVERSION= 0.8.5 > CATEGORIES= audio >-MASTER_SITES= https://github.com/alexkay/${PORTNAME}/releases/download/v${PORTVERSION}/ >+MASTER_SITES= https://github.com/alexkay/${PORTNAME}/releases/download/v${DISTVERSION}/ > > MAINTAINER= alexander@kojevnikov.com > COMMENT= Acoustic spectrum analyser >@@ -12,10 +11,10 @@ LICENSE= GPLv3+ > > LIB_DEPENDS= libavcodec.so:multimedia/ffmpeg > >-USES= compiler:c++11-lib desktop-file-utils gmake gnome pkgconfig \ >- tar:xz >+USES= compiler:c++11-lib desktop-file-utils gmake gnome \ >+ localbase:ldflags pkgconfig tar:xz > USE_GNOME= intltool >-USE_WX= 3.0 >+USE_WX= 3.2+ > WX_CONF_ARGS= absolute > GNU_CONFIGURE= yes > >@@ -24,8 +23,4 @@ OPTIONS_SUB= yes > NLS_USES= gettext > NLS_CONFIGURE_ENABLE= nls > >-post-patch: >- @${REINPLACE_CMD} -e "s,^itlocaledir =.*$$,itlocaledir = ${PREFIX}/share/locale,g" \ >- ${WRKSRC}/po/Makefile.in.in >- > .include <bsd.port.mk> >diff --git a/audio/spek/distinfo b/audio/spek/distinfo >index dbbfeb6bc6bf..be19f0b996ac 100644 >--- a/audio/spek/distinfo >+++ b/audio/spek/distinfo >@@ -1,2 +1,3 @@ >-SHA256 (spek-0.8.2.tar.xz) = 59f69b41155ee1a4552eb9f66b602fc059de8f31e3f05889f24d362b3e6c78ae >-SIZE (spek-0.8.2.tar.xz) = 171628 >+TIMESTAMP = 1678742866 >+SHA256 (spek-0.8.5.tar.xz) = 1bccf85a14a01af8f2f30476cbad004e8bf6031f500e562bbe5bbd1e5eb16c59 >+SIZE (spek-0.8.5.tar.xz) = 430464 >diff --git a/audio/spek/files/patch-src_spek-audio.cc b/audio/spek/files/patch-src_spek-audio.cc >deleted file mode 100644 >index b2fa0fad9051..000000000000 >--- a/audio/spek/files/patch-src_spek-audio.cc >+++ /dev/null >@@ -1,58 +0,0 @@ >-Fix build with ffmpeg 3.x. >- >---- src/spek-audio.cc.orig 2016-12-28 01:32:07 UTC >-+++ src/spek-audio.cc >-@@ -199,7 +199,7 @@ AudioFileImpl::AudioFileImpl( >- this->packet.data = nullptr; >- this->packet.size = 0; >- this->offset = 0; >-- this->frame = avcodec_alloc_frame(); >-+ this->frame = av_frame_alloc(); >- this->buffer_size = 0; >- this->buffer = nullptr; >- this->frames_per_interval = 0; >-@@ -215,7 +215,7 @@ AudioFileImpl::~AudioFileImpl() >- if (this->frame) { >- // TODO: Remove this check after Debian switches to libav 9. >- #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54, 28, 0) >-- avcodec_free_frame(&this->frame); >-+ av_frame_free(&this->frame); >- #else >- av_freep(&this->frame); >- #endif >-@@ -224,7 +224,7 @@ AudioFileImpl::~AudioFileImpl() >- this->packet.data -= this->offset; >- this->packet.size += this->offset; >- this->offset = 0; >-- av_free_packet(&this->packet); >-+ av_packet_unref(&this->packet); >- } >- if (this->format_context) { >- if (this->audio_stream >= 0) { >-@@ -255,7 +255,7 @@ int AudioFileImpl::read() >- >- for (;;) { >- while (this->packet.size > 0) { >-- avcodec_get_frame_defaults(this->frame); >-+ av_frame_unref(this->frame); >- auto codec_context = this->format_context->streams[this->audio_stream]->codec; >- int got_frame = 0; >- int len = avcodec_decode_audio4(codec_context, this->frame, &got_frame, &this->packet); >-@@ -299,7 +299,7 @@ int AudioFileImpl::read() >- this->packet.data -= this->offset; >- this->packet.size += this->offset; >- this->offset = 0; >-- av_free_packet(&this->packet); >-+ av_packet_unref(&this->packet); >- } >- >- int res = 0; >-@@ -307,7 +307,7 @@ int AudioFileImpl::read() >- if (this->packet.stream_index == this->audio_stream) { >- break; >- } >-- av_free_packet(&this->packet); >-+ av_packet_unref(&this->packet); >- } >- if (res < 0) { >- // End of file or error. >diff --git a/audio/spek/pkg-plist b/audio/spek/pkg-plist >index 7800824366ea..c4ec36e35814 100644 >--- a/audio/spek/pkg-plist >+++ b/audio/spek/pkg-plist >@@ -7,21 +7,35 @@ share/icons/hicolor/24x24/apps/spek.png > share/icons/hicolor/32x32/apps/spek.png > share/icons/hicolor/48x48/apps/spek.png > share/icons/hicolor/scalable/apps/spek.svg >+%%NLS%%share/locale/bs/LC_MESSAGES/spek.mo >+%%NLS%%share/locale/ca/LC_MESSAGES/spek.mo > %%NLS%%share/locale/cs/LC_MESSAGES/spek.mo > %%NLS%%share/locale/da/LC_MESSAGES/spek.mo > %%NLS%%share/locale/de/LC_MESSAGES/spek.mo >+%%NLS%%share/locale/el/LC_MESSAGES/spek.mo > %%NLS%%share/locale/eo/LC_MESSAGES/spek.mo > %%NLS%%share/locale/es/LC_MESSAGES/spek.mo >+%%NLS%%share/locale/fi/LC_MESSAGES/spek.mo > %%NLS%%share/locale/fr/LC_MESSAGES/spek.mo >+%%NLS%%share/locale/gl/LC_MESSAGES/spek.mo >+%%NLS%%share/locale/he/LC_MESSAGES/spek.mo >+%%NLS%%share/locale/hr/LC_MESSAGES/spek.mo >+%%NLS%%share/locale/hu/LC_MESSAGES/spek.mo > %%NLS%%share/locale/it/LC_MESSAGES/spek.mo > %%NLS%%share/locale/ja/LC_MESSAGES/spek.mo >+%%NLS%%share/locale/ko/LC_MESSAGES/spek.mo >+%%NLS%%share/locale/lv/LC_MESSAGES/spek.mo > %%NLS%%share/locale/nb/LC_MESSAGES/spek.mo >+%%NLS%%share/locale/nn/LC_MESSAGES/spek.mo > %%NLS%%share/locale/nl/LC_MESSAGES/spek.mo > %%NLS%%share/locale/pl/LC_MESSAGES/spek.mo > %%NLS%%share/locale/pt_BR/LC_MESSAGES/spek.mo > %%NLS%%share/locale/ru/LC_MESSAGES/spek.mo >+%%NLS%%share/locale/sk/LC_MESSAGES/spek.mo >+%%NLS%%share/locale/sr@latin/LC_MESSAGES/spek.mo > %%NLS%%share/locale/sv/LC_MESSAGES/spek.mo > %%NLS%%share/locale/tr/LC_MESSAGES/spek.mo >+%%NLS%%share/locale/th/LC_MESSAGES/spek.mo > %%NLS%%share/locale/uk/LC_MESSAGES/spek.mo > %%NLS%%share/locale/vi/LC_MESSAGES/spek.mo > %%NLS%%share/locale/zh_CN/LC_MESSAGES/spek.mo >diff --git a/graphics/synfig/Makefile b/graphics/synfig/Makefile >index d2a205dc43ba..866acf7897ce 100644 >--- a/graphics/synfig/Makefile >+++ b/graphics/synfig/Makefile >@@ -1,7 +1,7 @@ > PORTNAME= synfig >-PORTVERSION= 1.4.4 >-DISTVERSIONPREFIX=v >-PORTREVISION= 1 >+DISTVERSIONPREFIX= v >+DISTVERSION= 1.4.4 >+PORTREVISION= 2 > CATEGORIES= graphics devel multimedia > > MAINTAINER= portmaster@BSDforge.com >@@ -26,22 +26,24 @@ LIB_DEPENDS= libImath.so:math/Imath \ > libpng.so:graphics/png \ > libtiff.so:graphics/tiff > >-PORTSCOUT= limitw:1,even >- > USES= autoreconf compiler:c++11-lang gmake gnome iconv jpeg \ >- libtool localbase magick:6 mlt:6 pathfix pkgconfig >+ libtool localbase magick:7 mlt:7 pathfix pkgconfig > USE_CXXSTD= c++11 > USE_GITHUB= yes > USE_GNOME= cairo glibmm intltool libxml++26 pango >+USE_LDCONFIG= yes >+ >+PORTSCOUT= limitw:1,even >+ > GNU_CONFIGURE= yes >-CONFIGURE_ARGS= ${ICONV_CONFIGURE_ARG} >-CONFIGURE_ENV+= ac_cv_path_SED=${LOCALBASE}/bin/gsed >-# Other spurious uses of direct sed have popped up >-BINARY_ALIAS= sed=${LOCALBASE}/bin/gsed > INSTALL_TARGET= install-strip >-USE_LDCONFIG= yes > WRKSRC_SUBDIR= synfig-core > >+BINARY_ALIAS= sed=${LOCALBASE}/bin/gsed >+ >+CONFIGURE_ENV+= ac_cv_path_SED=${LOCALBASE}/bin/gsed >+CONFIGURE_ARGS= ${ICONV_CONFIGURE_ARG} >+ > OPTIONS_DEFINE= DOCS NLS > OPTIONS_SUB= yes > >diff --git a/graphics/synfig/distinfo b/graphics/synfig/distinfo >index d3ccbfa9733b..30c6d8a6d569 100644 >--- a/graphics/synfig/distinfo >+++ b/graphics/synfig/distinfo >@@ -1,4 +1,3 @@ >-TIMESTAMP = 1673053271 >+TIMESTAMP = 1680950793 > SHA256 (synfig-synfig-v1.4.4_GH0.tar.gz) = 83357c3282ecb4e6be46771fde1688662ca184eab8901cef66fe2bf000b99519 >-SHA512 (synfig-synfig-v1.4.4_GH0.tar.gz) = 1b0ef61cae21130c6d8068212cacf6d6a2d6264a06fa5275f50384a45ae1e75b2df21c11c920de42588bc924e385de5ce2b4f7565ab85026bf835c13eddb9eb5 > SIZE (synfig-synfig-v1.4.4_GH0.tar.gz) = 12943798 >diff --git a/graphics/synfig/files/patch-src_modules_mod__libavcodec_trgt__av.cpp b/graphics/synfig/files/patch-src_modules_mod__libavcodec_trgt__av.cpp >new file mode 100644 >index 000000000000..1cab65ab6bbb >--- /dev/null >+++ b/graphics/synfig/files/patch-src_modules_mod__libavcodec_trgt__av.cpp >@@ -0,0 +1,51 @@ >+--- src/modules/mod_libavcodec/trgt_av.cpp.orig 2022-12-24 14:01:41 UTC >++++ src/modules/mod_libavcodec/trgt_av.cpp >+@@ -38,6 +38,7 @@ >+ extern "C" >+ { >+ #ifdef HAVE_LIBAVFORMAT_AVFORMAT_H >++# include <libavcodec/avcodec.h> >+ # include <libavformat/avformat.h> >+ #elif defined(HAVE_AVFORMAT_H) >+ # include <avformat.h> >+@@ -234,12 +235,14 @@ class Target_LibAVCodec::Internal (public) >+ close(); >+ >+ if (!av_registered) { >+- av_register_all(); >++#if LIBAVCODEC_VERSION_MAJOR < 59 >++ av_register_all(); >++#endif >+ av_registered = true; >+ } >+ >+ // guess format >+- AVOutputFormat *format = av_guess_format(NULL, filename.c_str(), NULL); >++ const AVOutputFormat *format = av_guess_format(NULL, filename.c_str(), NULL); >+ if (!format) { >+ synfig::warning("Target_LibAVCodec: unable to guess the output format, defaulting to MPEG"); >+ format = av_guess_format("mpeg", NULL, NULL); >+@@ -254,7 +257,7 @@ class Target_LibAVCodec::Internal (public) >+ context = avformat_alloc_context(); >+ assert(context); >+ context->oformat = format; >+- if (filename.size() + 1 > sizeof(context->filename)) { >++ /*if (filename.size() + 1 > sizeof(context->filename)) { >+ synfig::error( >+ "Target_LibAVCodec: filename too long, max length is %d, filename is '%s'", >+ sizeof(context->filename) - 1, >+@@ -262,7 +265,13 @@ class Target_LibAVCodec::Internal (public) >+ close(); >+ return false; >+ } >+- memcpy(context->filename, filename.c_str(), filename.size() + 1); >++ memcpy(context->filename, filename.c_str(), filename.size() + 1);*/ >++ context->url = av_strndup(filename.c_str(), filename.size()); >++ if (!context->url) { >++ synfig::error("Target_LibAVCodec: cannot allocate space for filename"); >++ close(); >++ return false; >++ } >+ >+ packet = av_packet_alloc(); >+ assert(packet); >diff --git a/graphics/synfigstudio/Makefile b/graphics/synfigstudio/Makefile >index 352bbd4403cc..cda60e2afc4b 100644 >--- a/graphics/synfigstudio/Makefile >+++ b/graphics/synfigstudio/Makefile >@@ -1,7 +1,7 @@ > PORTNAME= synfigstudio >-PORTVERSION= 1.4.4 >-DISTVERSIONPREFIX=v >-PORTREVISION= 2 >+DISTVERSIONPREFIX= v >+DISTVERSION= 1.4.4 >+PORTREVISION= 3 > CATEGORIES= graphics multimedia > > MAINTAINER= portmaster@BSDforge.com >@@ -24,22 +24,25 @@ LIB_DEPENDS= libImath.so:math/Imath \ > libsynfig.so:graphics/synfig > RUN_DEPENDS= xdg-open:devel/xdg-utils > >-PORTSCOUT= limitw:1,even >- >-USES= autoreconf compiler:c++11-lang desktop-file-utils \ >- gmake gnome libtool localbase magick:6 mlt:6 pathfix pkgconfig \ >+USES= autoreconf compiler:c++11-lang desktop-file-utils gmake \ >+ gnome libtool localbase magick:7 mlt:7 pathfix pkgconfig \ > shared-mime-info >+USE_CXXSTD= c++11 > USE_GITHUB= yes > GH_ACCOUNT= synfig > GH_PROJECT= synfig >-WRKSRC_SUBDIR= synfig-studio >-USE_CXXSTD= c++11 > USE_GNOME= gdkpixbuf2 gtkmm30 intltool >+USE_LDCONFIG= yes >+ >+PORTSCOUT= limitw:1,even >+ > GNU_CONFIGURE= yes >+INSTALL_TARGET= install-strip >+WRKSRC_SUBDIR= synfig-studio >+ > BINARY_ALIAS= sed=${LOCALBASE}/bin/gsed >+ > CONFIGURE_ARGS= --disable-update-mimedb >-INSTALL_TARGET= install-strip >-USE_LDCONFIG= yes > > OPTIONS_DEFINE= DOCS JACK NLS > OPTIONS_SUB= yes >diff --git a/graphics/synfigstudio/distinfo b/graphics/synfigstudio/distinfo >index e790156deeab..db253a958263 100644 >--- a/graphics/synfigstudio/distinfo >+++ b/graphics/synfigstudio/distinfo >@@ -1,4 +1,3 @@ >-TIMESTAMP = 1673068380 >+TIMESTAMP = 1680950823 > SHA256 (synfig-synfig-v1.4.4_GH0.tar.gz) = 83357c3282ecb4e6be46771fde1688662ca184eab8901cef66fe2bf000b99519 >-SHA512 (synfig-synfig-v1.4.4_GH0.tar.gz) = 1b0ef61cae21130c6d8068212cacf6d6a2d6264a06fa5275f50384a45ae1e75b2df21c11c920de42588bc924e385de5ce2b4f7565ab85026bf835c13eddb9eb5 > SIZE (synfig-synfig-v1.4.4_GH0.tar.gz) = 12943798 >diff --git a/multimedia/ffmpeg/files/ffmpeg-patch-add-av_stream_get_first_dts-for-qt5-webengine b/multimedia/ffmpeg/files/ffmpeg-patch-add-av_stream_get_first_dts-for-qt5-webengine >new file mode 100644 >index 000000000000..936cd1d90f26 >--- /dev/null >+++ b/multimedia/ffmpeg/files/ffmpeg-patch-add-av_stream_get_first_dts-for-qt5-webengine >@@ -0,0 +1,35 @@ >+Add "av_stream_get_first_dts" symbol for www/qt5-webengine >+ >+Obtained from: >+ >+https://github.com/archlinux/svntogit-packages/blob/packages/ffmpeg/trunk/add-av_stream_get_first_dts-for-chromium.patch >+ >+--- libavformat/avformat.h.orig 2023-02-27 20:43:45 UTC >++++ libavformat/avformat.h >+@@ -1019,6 +1019,10 @@ int64_t av_stream_get_end_pts(const AVStream *st); >+ int64_t av_stream_get_end_pts(const AVStream *st); >+ #endif >+ >++// Chromium: We use the internal field first_dts vvv >++int64_t av_stream_get_first_dts(const AVStream *st); >++// Chromium: We use the internal field first_dts ^^^ >++ >+ #define AV_PROGRAM_RUNNING 1 >+ >+ /** >+--- libavformat/mux_utils.c.orig 2023-02-27 20:43:45 UTC >++++ libavformat/mux_utils.c >+@@ -40,6 +40,13 @@ int64_t av_stream_get_end_pts(const AVStream *st) >+ } >+ #endif >+ >++// Chromium: We use the internal field first_dts vvv >++int64_t av_stream_get_first_dts(const AVStream *st) >++{ >++ return cffstream(st)->first_dts; >++} >++// Chromium: We use the internal field first_dts ^^^ >++ >+ int avformat_query_codec(const AVOutputFormat *ofmt, enum AVCodecID codec_id, >+ int std_compliance) >+ { >diff --git a/multimedia/ffmpegthumbnailer/Makefile b/multimedia/ffmpegthumbnailer/Makefile >index 0160384bf703..b686ad34347b 100644 >--- a/multimedia/ffmpegthumbnailer/Makefile >+++ b/multimedia/ffmpegthumbnailer/Makefile >@@ -1,7 +1,7 @@ > PORTNAME= ffmpegthumbnailer >-PORTVERSION= 2.2.2 >+DISTVERSION= 2.2.2.a.20221021 > CATEGORIES= multimedia graphics >-MASTER_SITES= https://github.com/dirkvdb/${PORTNAME}/releases/download/${PORTVERSION}/ >+#MASTER_SITES= https://github.com/dirkvdb/${PORTNAME}/releases/download/${PORTVERSION}/ > > MAINTAINER= ports@FreeBSD.org > COMMENT= Lightweight video thumbnailer that can be used by file managers >@@ -13,24 +13,26 @@ LICENSE_FILE= ${WRKSRC}/COPYING > LIB_DEPENDS= libpng.so:graphics/png \ > libavformat.so:multimedia/ffmpeg > >-USES= cmake compiler:c++11-lib gnome jpeg localbase pkgconfig tar:bz2 >+USES= cmake:testing compiler:c++11-lib gnome jpeg localbase pkgconfig tar:bz2 >+USE_GITHUB= yes >+GH_ACCOUNT= dirkvdb >+GH_TAGNAME= e0bf01d >+ > USE_GNOME= glib20 > USE_LDCONFIG= yes > > EXTRACT_CMD= ${SETENV} LC_ALL=en_US.UTF-8 /usr/bin/bsdtar >+CMAKE_TESTING_ON= ENABLE_TESTS > >+CMAKE_OFF= ENABLE_TESTS > CMAKE_ON= ENABLE_GIO > >-OPTIONS_DEFINE= TEST THUMBNAILER >-THUMBNAILER_DESC=Register as a system thumbnailer >-OPTIONS_SUB= yes >+OPTIONS_DEFINE= THUMBNAILER > OPTIONS_DEFAULT=THUMBNAILER >+OPTIONS_SUB= yes > >-TEST_CMAKE_BOOL= ENABLE_TESTS >+THUMBNAILER_DESC= Register as a system thumbnailer > > THUMBNAILER_CMAKE_ON= -DENABLE_THUMBNAILER:BOOL=ON > >-do-test: >- (cd ${TEST_WRKSRC} && CTEST_OUTPUT_ON_FAILURE=1 ctest) >- > .include <bsd.port.mk> >diff --git a/multimedia/ffmpegthumbnailer/distinfo b/multimedia/ffmpegthumbnailer/distinfo >index e3f4747e9420..fe6986688b27 100644 >--- a/multimedia/ffmpegthumbnailer/distinfo >+++ b/multimedia/ffmpegthumbnailer/distinfo >@@ -1,3 +1,3 @@ >-TIMESTAMP = 1595238599 >-SHA256 (ffmpegthumbnailer-2.2.2.tar.bz2) = 1cb24059c38223f657b300c84dd80491b7040d4b69471c4fea69be862bc99b5b >-SIZE (ffmpegthumbnailer-2.2.2.tar.bz2) = 1201838 >+TIMESTAMP = 1678817076 >+SHA256 (dirkvdb-ffmpegthumbnailer-2.2.2.a.20221021-e0bf01d_GH0.tar.gz) = 56e100ef6e6a8ce18e6015b79efad6601a636b03b6bcf9abf6b6f73c501e13e7 >+SIZE (dirkvdb-ffmpegthumbnailer-2.2.2.a.20221021-e0bf01d_GH0.tar.gz) = 1291600 >diff --git a/multimedia/ffmpegthumbnailer/files/patch-CMakeLists.txt b/multimedia/ffmpegthumbnailer/files/patch-CMakeLists.txt >deleted file mode 100644 >index 2d065734fdf0..000000000000 >--- a/multimedia/ffmpegthumbnailer/files/patch-CMakeLists.txt >+++ /dev/null >@@ -1,52 +0,0 @@ >---- CMakeLists.txt.orig 2019-10-03 19:51:17 UTC >-+++ CMakeLists.txt >-@@ -1,4 +1,4 @@ >--cmake_minimum_required(VERSION 3.5) >-+cmake_minimum_required(VERSION 3.12) >- >- list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) >- >-@@ -92,6 +92,15 @@ add_library(libffmpegthumbnailerobj OBJECT >- libffmpegthumbnailer/filmstripfilter.cpp >- ) >- >-+target_link_libraries(libffmpegthumbnailerobj >-+ FFmpeg::avformat >-+ FFmpeg::avcodec >-+ FFmpeg::avutil >-+ FFmpeg::avfilter >-+ $<$<BOOL:${HAVE_JPEG}>:${JPEG_LIBRARIES}> >-+ $<$<BOOL:${HAVE_PNG}>:PNG::PNG> >-+) >-+ >- # we use our own deprecated struct menbers, so disable the warning about it >- set_source_files_properties(libffmpegthumbnailer/videothumbnailerc.cpp PROPERTIES COMPILE_FLAGS -Wno-deprecated-declarations) >- >-@@ -118,12 +127,7 @@ set (FFMPEGTHUMBNAILER_SOVERSION_AGE 1) >- if (ENABLE_STATIC) >- add_library(libffmpegthumbnailerstatic STATIC $<TARGET_OBJECTS:libffmpegthumbnailerobj>) >- target_link_libraries(libffmpegthumbnailerstatic >-- FFmpeg::avformat >-- FFmpeg::avcodec >-- FFmpeg::avutil >-- FFmpeg::avfilter >-- $<$<BOOL:${HAVE_JPEG}>:${JPEG_LIBRARIES}> >-- $<$<BOOL:${HAVE_PNG}>:PNG::PNG> >-+ libffmpegthumbnailerobj >- $<$<BOOL:${ENABLE_GIO}>:${CMAKE_DL_LIBS}> >- ) >- >-@@ -140,12 +144,7 @@ endif () >- if (ENABLE_SHARED) >- add_library(libffmpegthumbnailer SHARED $<TARGET_OBJECTS:libffmpegthumbnailerobj>) >- target_link_libraries(libffmpegthumbnailer >-- FFmpeg::avformat >-- FFmpeg::avcodec >-- FFmpeg::avutil >-- FFmpeg::avfilter >-- $<$<BOOL:${HAVE_JPEG}>:${JPEG_LIBRARIES}> >-- $<$<BOOL:${HAVE_PNG}>:PNG::PNG> >-+ libffmpegthumbnailerobj >- ) >- >- set_target_properties(libffmpegthumbnailer PROPERTIES >diff --git a/multimedia/kodi/files/patch-ffmpeg6 b/multimedia/kodi/files/patch-ffmpeg6 >new file mode 100644 >index 000000000000..3c05394fd5d2 >--- /dev/null >+++ b/multimedia/kodi/files/patch-ffmpeg6 >@@ -0,0 +1,2114 @@ >+diff -urN cmake/modules/FindFFMPEG.cmake.orig cmake/modules/FindFFMPEG.cmake >+--- cmake/modules/FindFFMPEG.cmake.orig 2023-03-11 22:16:38.000000000 +0000 >++++ cmake/modules/FindFFMPEG.cmake 2023-03-16 21:56:53.268867000 +0000 >+@@ -151,14 +151,14 @@ >+ set(REQUIRED_FFMPEG_VERSION undef) >+ else() >+ # required ffmpeg library versions >+- set(REQUIRED_FFMPEG_VERSION 4.4.1) >+- set(_avcodec_ver ">=58.134.100") >+- set(_avfilter_ver ">=7.110.100") >+- set(_avformat_ver ">=58.76.100") >+- set(_avutil_ver ">=56.70.100") >+- set(_postproc_ver ">=55.9.100") >+- set(_swresample_ver ">=3.9.100") >+- set(_swscale_ver ">=5.9.100") >++ set(REQUIRED_FFMPEG_VERSION 6.0.0) >++ set(_avcodec_ver ">=60.2.100") >++ set(_avfilter_ver ">=9.3.100") >++ set(_avformat_ver ">=60.3.100") >++ set(_avutil_ver ">=58.2.100") >++ set(_postproc_ver ">=57.1.100") >++ set(_swresample_ver ">=4.10.100") >++ set(_swscale_ver ">=7.1.100") >+ endif() >+ >+ # Allows building with external ffmpeg not found in system paths, >+diff -urN tools/buildsteps/windows/patches/0001-ffmpeg-windows-configure-detect-openssl.patch.orig tools/buildsteps/windows/patches/0001-ffmpeg-windows-configure-detect-openssl.patch >+--- tools/buildsteps/windows/patches/0001-ffmpeg-windows-configure-detect-openssl.patch.orig 2023-03-11 22:16:38.000000000 +0000 >++++ tools/buildsteps/windows/patches/0001-ffmpeg-windows-configure-detect-openssl.patch 2023-03-16 21:56:20.716741000 +0000 >+@@ -11,7 +11,7 @@ >+ index d7a3f507e8..4b85e881b1 100755 >+ --- a/configure >+ +++ b/configure >+-@@ -6530,6 +6530,8 @@ enabled openssl && { check_pkg_config openssl openssl openssl/ssl.h OP >++@@ -6728,6 +6728,8 @@ enabled openssl && { check_pkg_config openssl openssl openssl/ssl.h OP >+ check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto || >+ check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 || >+ check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 || >+diff -urN tools/buildsteps/windows/patches/0002-ffmpeg-windows-configure-fix-zlib-conflict.patch.orig tools/buildsteps/windows/patches/0002-ffmpeg-windows-configure-fix-zlib-conflict.patch >+--- tools/buildsteps/windows/patches/0002-ffmpeg-windows-configure-fix-zlib-conflict.patch.orig 2023-03-11 22:16:38.000000000 +0000 >++++ tools/buildsteps/windows/patches/0002-ffmpeg-windows-configure-fix-zlib-conflict.patch 2023-03-16 21:56:20.716863000 +0000 >+@@ -11,16 +11,16 @@ >+ index 4b85e881b1..da457705d1 100755 >+ --- a/configure >+ +++ b/configure >+-@@ -7627,6 +7627,9 @@ print_config CONFIG_ "$config_files" $CONFIG_LIST \ >++@@ -7825,6 +7825,9 @@ print_config CONFIG_ "$config_files" $CONFIG_LIST \ >++ print_config CONFIG_ "$config_files" $CONFIG_LIST \ >+ $CONFIG_EXTRA \ >+- $ALL_COMPONENTS \ >+ >+ +echo "#if defined(HAVE_UNISTD_H) && HAVE_UNISTD_H == 0" >> $TMPH >+ +echo "#undef HAVE_UNISTD_H" >> $TMPH >+ +echo "#endif" >> $TMPH >+ echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH >+- echo "endif # FFMPEG_CONFIG_MAK" >> ffbuild/config.mak >+ >++ # Do not overwrite an unchanged config.h to avoid superfluous rebuilds. >+ -- >+ 2.29.2 >+ >+diff -urN tools/buildsteps/windows/patches/0003-ffmpeg-windows-configure-allow-building-static.patch.orig tools/buildsteps/windows/patches/0003-ffmpeg-windows-configure-allow-building-static.patch >+--- tools/buildsteps/windows/patches/0003-ffmpeg-windows-configure-allow-building-static.patch.orig 2023-03-11 22:16:38.000000000 +0000 >++++ tools/buildsteps/windows/patches/0003-ffmpeg-windows-configure-allow-building-static.patch 2023-03-16 21:56:20.716987000 +0000 >+@@ -11,7 +11,7 @@ >+ index da457705d1..e3a8f45ff4 100755 >+ --- a/configure >+ +++ b/configure >+-@@ -5440,6 +5440,8 @@ case $target_os in >++@@ -5566,6 +5566,8 @@ case $target_os in >+ enabled shared && ! enabled small && test_cmd $windres --version && enable gnu_windres >+ enabled x86_32 && check_ldflags -Wl,--large-address-aware >+ shlibdir_default="$bindir_default" >+@@ -20,7 +20,7 @@ >+ SLIBPREF="" >+ SLIBSUF=".dll" >+ SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)' >+-@@ -5489,6 +5491,8 @@ case $target_os in >++@@ -5615,6 +5617,8 @@ case $target_os in >+ fi >+ enabled x86_32 && check_ldflags -LARGEADDRESSAWARE >+ shlibdir_default="$bindir_default" >+diff -urN tools/buildsteps/windows/patches/0004-ffmpeg-windows-configure-detect-libdav1d.patch.orig tools/buildsteps/windows/patches/0004-ffmpeg-windows-configure-detect-libdav1d.patch >+--- tools/buildsteps/windows/patches/0004-ffmpeg-windows-configure-detect-libdav1d.patch.orig 2023-03-11 22:16:38.000000000 +0000 >++++ tools/buildsteps/windows/patches/0004-ffmpeg-windows-configure-detect-libdav1d.patch 2023-03-16 21:56:20.717110000 +0000 >+@@ -11,7 +11,7 @@ >+ index e3a8f45ff4..983d7e1078 100755 >+ --- a/configure >+ +++ b/configure >+-@@ -6358,7 +6358,7 @@ enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 && >++@@ -6541,7 +6541,7 @@ enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 && >+ die "ERROR: libcelt must be installed and version must be >= 0.11.0."; } >+ enabled libcaca && require_pkg_config libcaca caca caca.h caca_create_canvas >+ enabled libcodec2 && require libcodec2 codec2/codec2.h codec2_create -lcodec2 >+diff -urN tools/depends/target/ffmpeg/CMakeLists.txt.orig tools/depends/target/ffmpeg/CMakeLists.txt >+--- tools/depends/target/ffmpeg/CMakeLists.txt.orig 2023-03-11 22:16:38.000000000 +0000 >++++ tools/depends/target/ffmpeg/CMakeLists.txt 2023-03-16 21:56:20.716595000 +0000 >+@@ -92,6 +92,7 @@ >+ elseif(CORE_SYSTEM_NAME STREQUAL darwin_embedded) >+ list(APPEND ffmpeg_conf --disable-crystalhd >+ --enable-videotoolbox >++ --disable-filter=yadif_videotoolbox >+ --target-os=darwin >+ ) >+ elseif(CORE_SYSTEM_NAME STREQUAL osx) >+diff -urN tools/depends/target/ffmpeg/FFMPEG-VERSION.orig tools/depends/target/ffmpeg/FFMPEG-VERSION >+--- tools/depends/target/ffmpeg/FFMPEG-VERSION.orig 2023-03-11 22:16:38.000000000 +0000 >++++ tools/depends/target/ffmpeg/FFMPEG-VERSION 2023-03-16 22:05:45.344450000 +0000 >+@@ -1,5 +1,5 @@ >+ LIBNAME=ffmpeg >+-BASE_URL=https://github.com/xbmc/FFmpeg >+-VERSION=4.4.1-Nexus-Alpha1 >++VERSION=6.0 >+ ARCHIVE=$(LIBNAME)-$(VERSION).tar.gz >+-SHA512=8beb04d577b5251e74b0d52f4d130997a8ba94bbd488c7c8309e6b45095c27807e150212888ce3a384b23dff52f8df1a7bde5407bae924ddc363f8125c0616c5 >++SHA512=b3214328f2792364353f38c6b46a71d4970c071d8656b20780abf0e02950167d0933eae825c09102cf8fb19fc679ac444bf1f41a448b624eaa5ea6b0f0bdf4f5 >++ >+diff -urN xbmc/cdrip/EncoderFFmpeg.cpp.orig xbmc/cdrip/EncoderFFmpeg.cpp >+--- xbmc/cdrip/EncoderFFmpeg.cpp.orig 2023-03-11 22:16:38.000000000 +0000 >++++ xbmc/cdrip/EncoderFFmpeg.cpp 2023-03-16 21:56:20.710403000 +0000 >+@@ -11,6 +11,7 @@ >+ #include "ServiceBroker.h" >+ #include "addons/Addon.h" >+ #include "addons/AddonManager.h" >++#include "cores/FFmpeg.h" >+ #include "settings/Settings.h" >+ #include "settings/SettingsComponent.h" >+ #include "utils/StringUtils.h" >+@@ -19,24 +20,9 @@ >+ #include "utils/log.h" >+ >+ using namespace KODI::CDRIP; >++using FFMPEG_HELP_TOOLS::FFMpegErrorToString; >++using FFMPEG_HELP_TOOLS::FFMpegException; >+ >+-namespace >+-{ >+- >+-struct EncoderException : public std::exception >+-{ >+- std::string s; >+- template<typename... Args> >+- EncoderException(const std::string& fmt, Args&&... args) >+- : s(StringUtils::Format(fmt, std::forward<Args>(args)...)) >+- { >+- } >+- ~EncoderException() throw() {} // Updated >+- const char* what() const throw() { return s.c_str(); } >+-}; >+- >+-} /* namespace */ >+- >+ bool CEncoderFFmpeg::Init() >+ { >+ try >+@@ -54,7 +40,7 @@ >+ } >+ else >+ { >+- throw EncoderException("Could not get add-on: {}", addonId); >++ throw FFMpegException("Could not get add-on: {}", addonId); >+ } >+ >+ // Hack fix about PTS on generated files. >+@@ -66,50 +52,50 @@ >+ else if (addonId == "audioencoder.kodi.builtin.wma") >+ m_samplesCountMultiply = 1000; >+ else >+- throw EncoderException("Internal add-on id \"{}\" not known as usable", addonId); >++ throw FFMpegException("Internal add-on id \"{}\" not known as usable", addonId); >+ >+ const std::string filename = URIUtils::GetFileName(m_strFile); >+ >+ m_formatCtx = avformat_alloc_context(); >+ if (!m_formatCtx) >+- throw EncoderException("Could not allocate output format context"); >++ throw FFMpegException("Could not allocate output format context"); >+ >+ m_bcBuffer = static_cast<uint8_t*>(av_malloc(BUFFER_SIZE + AV_INPUT_BUFFER_PADDING_SIZE)); >+ if (!m_bcBuffer) >+- throw EncoderException("Could not allocate buffer"); >++ throw FFMpegException("Could not allocate buffer"); >+ >+ m_formatCtx->pb = avio_alloc_context(m_bcBuffer, BUFFER_SIZE, AVIO_FLAG_WRITE, this, nullptr, >+ avio_write_callback, avio_seek_callback); >+ if (!m_formatCtx->pb) >+- throw EncoderException("Failed to allocate ByteIOContext"); >++ throw FFMpegException("Failed to allocate ByteIOContext"); >+ >+ /* Guess the desired container format based on the file extension. */ >+ m_formatCtx->oformat = av_guess_format(nullptr, filename.c_str(), nullptr); >+ if (!m_formatCtx->oformat) >+- throw EncoderException("Could not find output file format"); >++ throw FFMpegException("Could not find output file format"); >+ >+ m_formatCtx->url = av_strdup(filename.c_str()); >+ if (!m_formatCtx->url) >+- throw EncoderException("Could not allocate url"); >++ throw FFMpegException("Could not allocate url"); >+ >+ /* Find the encoder to be used by its name. */ >+- AVCodec* codec = avcodec_find_encoder(m_formatCtx->oformat->audio_codec); >++ const AVCodec* codec = avcodec_find_encoder(m_formatCtx->oformat->audio_codec); >+ if (!codec) >+- throw EncoderException("Unable to find a suitable FFmpeg encoder"); >++ throw FFMpegException("Unable to find a suitable FFmpeg encoder"); >+ >+ /* Create a new audio stream in the output file container. */ >+ m_stream = avformat_new_stream(m_formatCtx, nullptr); >+ if (!m_stream) >+- throw EncoderException("Failed to allocate AVStream context"); >++ throw FFMpegException("Failed to allocate AVStream context"); >+ >+ m_codecCtx = avcodec_alloc_context3(codec); >+ if (!m_codecCtx) >+- throw EncoderException("Failed to allocate the encoder context"); >++ throw FFMpegException("Failed to allocate the encoder context"); >+ >+ /* Set the basic encoder parameters. >+ * The input file's sample rate is used to avoid a sample rate conversion. */ >+- m_codecCtx->channels = m_iInChannels; >+- m_codecCtx->channel_layout = av_get_default_channel_layout(m_iInChannels); >++ av_channel_layout_uninit(&m_codecCtx->ch_layout); >++ av_channel_layout_default(&m_codecCtx->ch_layout, m_iInChannels); >+ m_codecCtx->sample_rate = m_iInSampleRate; >+ m_codecCtx->sample_fmt = codec->sample_fmts[0]; >+ m_codecCtx->bit_rate = bitrate; >+@@ -128,14 +114,14 @@ >+ >+ int err = avcodec_open2(m_codecCtx, codec, nullptr); >+ if (err < 0) >+- throw EncoderException("Failed to open the codec {} (error '{}')", >+- codec->long_name ? codec->long_name : codec->name, >+- FFmpegErrorToString(err)); >++ throw FFMpegException("Failed to open the codec {} (error '{}')", >++ codec->long_name ? codec->long_name : codec->name, >++ FFMpegErrorToString(err)); >+ >+ err = avcodec_parameters_from_context(m_stream->codecpar, m_codecCtx); >+ if (err < 0) >+- throw EncoderException("Failed to copy encoder parameters to output stream (error '{}')", >+- FFmpegErrorToString(err)); >++ throw FFMpegException("Failed to copy encoder parameters to output stream (error '{}')", >++ FFMpegErrorToString(err)); >+ >+ m_inFormat = GetInputFormat(m_iInBitsPerSample); >+ m_outFormat = m_codecCtx->sample_fmt; >+@@ -150,44 +136,48 @@ >+ >+ m_bufferFrame = av_frame_alloc(); >+ if (!m_bufferFrame || !m_buffer) >+- throw EncoderException("Failed to allocate necessary buffers"); >++ throw FFMpegException("Failed to allocate necessary buffers"); >+ >+ m_bufferFrame->nb_samples = m_codecCtx->frame_size; >+ m_bufferFrame->format = m_inFormat; >+- m_bufferFrame->channel_layout = m_codecCtx->channel_layout; >++ >++ av_channel_layout_uninit(&m_bufferFrame->ch_layout); >++ av_channel_layout_copy(&m_bufferFrame->ch_layout, &m_codecCtx->ch_layout); >++ >+ m_bufferFrame->sample_rate = m_codecCtx->sample_rate; >+ >+ err = av_frame_get_buffer(m_bufferFrame, 0); >+ if (err < 0) >+- throw EncoderException("Could not allocate output frame samples (error '{}')", >+- FFmpegErrorToString(err)); >++ throw FFMpegException("Could not allocate output frame samples (error '{}')", >++ FFMpegErrorToString(err)); >+ >+ avcodec_fill_audio_frame(m_bufferFrame, m_iInChannels, m_inFormat, m_buffer, m_neededBytes, 0); >+ >+ if (m_needConversion) >+ { >+- m_swrCtx = swr_alloc_set_opts(nullptr, m_codecCtx->channel_layout, m_outFormat, >+- m_codecCtx->sample_rate, m_codecCtx->channel_layout, m_inFormat, >++ int ret = swr_alloc_set_opts2(&m_swrCtx, &m_codecCtx->ch_layout, m_outFormat, >++ m_codecCtx->sample_rate, &m_codecCtx->ch_layout, m_inFormat, >+ m_codecCtx->sample_rate, 0, nullptr); >+- if (!m_swrCtx || swr_init(m_swrCtx) < 0) >+- throw EncoderException("Failed to initialize the resampler"); >++ if (ret || swr_init(m_swrCtx) < 0) >++ throw FFMpegException("Failed to initialize the resampler"); >+ >+ m_resampledBufferSize = >+ av_samples_get_buffer_size(nullptr, m_iInChannels, m_neededFrames, m_outFormat, 0); >+ m_resampledBuffer = static_cast<uint8_t*>(av_malloc(m_resampledBufferSize)); >+ m_resampledFrame = av_frame_alloc(); >+ if (!m_resampledBuffer || !m_resampledFrame) >+- throw EncoderException("Failed to allocate a frame for resampling"); >++ throw FFMpegException("Failed to allocate a frame for resampling"); >+ >+ m_resampledFrame->nb_samples = m_neededFrames; >+ m_resampledFrame->format = m_outFormat; >+- m_resampledFrame->channel_layout = m_codecCtx->channel_layout; >++ av_channel_layout_uninit(&m_resampledFrame->ch_layout); >++ av_channel_layout_copy(&m_resampledFrame->ch_layout, &m_codecCtx->ch_layout); >+ m_resampledFrame->sample_rate = m_codecCtx->sample_rate; >+ >+ err = av_frame_get_buffer(m_resampledFrame, 0); >+ if (err < 0) >+- throw EncoderException("Could not allocate output resample frame samples (error '{}')", >+- FFmpegErrorToString(err)); >++ throw FFMpegException("Could not allocate output resample frame samples (error '{}')", >++ FFMpegErrorToString(err)); >+ >+ avcodec_fill_audio_frame(m_resampledFrame, m_iInChannels, m_outFormat, m_resampledBuffer, >+ m_resampledBufferSize, 0); >+@@ -204,7 +194,7 @@ >+ /* write the header */ >+ err = avformat_write_header(m_formatCtx, nullptr); >+ if (err != 0) >+- throw EncoderException("Failed to write the header (error '{}')", FFmpegErrorToString(err)); >++ throw FFMpegException("Failed to write the header (error '{}')", FFMpegErrorToString(err)); >+ >+ CLog::Log(LOGDEBUG, "CEncoderFFmpeg::{} - Successfully initialized with muxer {} and codec {}", >+ __func__, >+@@ -212,16 +202,19 @@ >+ : m_formatCtx->oformat->name, >+ codec->long_name ? codec->long_name : codec->name); >+ } >+- catch (EncoderException& caught) >++ catch (const FFMpegException& caught) >+ { >+ CLog::Log(LOGERROR, "CEncoderFFmpeg::{} - {}", __func__, caught.what()); >+ >+ av_freep(&m_buffer); >++ av_channel_layout_uninit(&m_bufferFrame->ch_layout); >+ av_frame_free(&m_bufferFrame); >+ swr_free(&m_swrCtx); >++ av_channel_layout_uninit(&m_resampledFrame->ch_layout); >+ av_frame_free(&m_resampledFrame); >+ av_freep(&m_resampledBuffer); >+ av_free(m_bcBuffer); >++ av_channel_layout_uninit(&m_codecCtx->ch_layout); >+ avcodec_free_context(&m_codecCtx); >+ if (m_formatCtx) >+ { >+@@ -299,7 +292,7 @@ >+ if (swr_convert(m_swrCtx, m_resampledFrame->data, m_neededFrames, >+ const_cast<const uint8_t**>(m_bufferFrame->extended_data), >+ m_neededFrames) < 0) >+- throw EncoderException("Error resampling audio"); >++ throw FFMpegException("Error resampling audio"); >+ >+ frame = m_resampledFrame; >+ } >+@@ -316,8 +309,8 @@ >+ m_bufferSize = 0; >+ err = avcodec_send_frame(m_codecCtx, frame); >+ if (err < 0) >+- throw EncoderException("Error sending a frame for encoding (error '{}')", __func__, >+- FFmpegErrorToString(err)); >++ throw FFMpegException("Error sending a frame for encoding (error '{}')", >++ FFMpegErrorToString(err)); >+ >+ while (err >= 0) >+ { >+@@ -329,19 +322,18 @@ >+ } >+ else if (err < 0) >+ { >+- throw EncoderException("Error during encoding (error '{}')", __func__, >+- FFmpegErrorToString(err)); >++ throw FFMpegException("Error during encoding (error '{}')", FFMpegErrorToString(err)); >+ } >+ >+ err = av_write_frame(m_formatCtx, pkt); >+ if (err < 0) >+- throw EncoderException("Failed to write the frame data (error '{}')", __func__, >+- FFmpegErrorToString(err)); >++ throw FFMpegException("Failed to write the frame data (error '{}')", >++ FFMpegErrorToString(err)); >+ >+ av_packet_unref(pkt); >+ } >+ } >+- catch (EncoderException& caught) >++ catch (const FFMpegException& caught) >+ { >+ CLog::Log(LOGERROR, "CEncoderFFmpeg::{} - {}", __func__, caught.what()); >+ } >+@@ -366,8 +358,10 @@ >+ >+ /* Flush if needed */ >+ av_freep(&m_buffer); >++ av_channel_layout_uninit(&m_bufferFrame->ch_layout); >+ av_frame_free(&m_bufferFrame); >+ swr_free(&m_swrCtx); >++ av_channel_layout_uninit(&m_resampledFrame->ch_layout); >+ av_frame_free(&m_resampledFrame); >+ av_freep(&m_resampledBuffer); >+ m_needConversion = false; >+@@ -379,6 +373,7 @@ >+ >+ /* cleanup */ >+ av_free(m_bcBuffer); >++ av_channel_layout_uninit(&m_codecCtx->ch_layout); >+ avcodec_free_context(&m_codecCtx); >+ av_freep(&m_formatCtx->pb); >+ avformat_free_context(m_formatCtx); >+@@ -400,14 +395,6 @@ >+ case 32: >+ return AV_SAMPLE_FMT_S32; >+ default: >+- throw EncoderException("Invalid input bits per sample"); >++ throw FFMpegException("Invalid input bits per sample"); >+ } >+-} >+- >+-std::string CEncoderFFmpeg::FFmpegErrorToString(int err) >+-{ >+- std::string text; >+- text.reserve(AV_ERROR_MAX_STRING_SIZE); >+- av_strerror(err, text.data(), AV_ERROR_MAX_STRING_SIZE); >+- return text; >+ } >+diff -urN xbmc/cdrip/EncoderFFmpeg.h.orig xbmc/cdrip/EncoderFFmpeg.h >+--- xbmc/cdrip/EncoderFFmpeg.h.orig 2023-03-11 22:16:38.000000000 +0000 >++++ xbmc/cdrip/EncoderFFmpeg.h 2023-03-16 21:56:20.696794000 +0000 >+@@ -39,7 +39,6 @@ >+ void SetTag(const std::string& tag, const std::string& value); >+ bool WriteFrame(); >+ AVSampleFormat GetInputFormat(int inBitsPerSample); >+- std::string FFmpegErrorToString(int err); >+ >+ AVFormatContext* m_formatCtx{nullptr}; >+ AVCodecContext* m_codecCtx{nullptr}; >+diff -urN xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.cpp.orig xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.cpp >+--- xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.cpp.orig 2023-03-11 22:16:38.000000000 +0000 >++++ xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.cpp 2023-03-16 21:56:20.710706000 +0000 >+@@ -10,14 +10,25 @@ >+ #define DTS_ENCODE_BITRATE 1411200 >+ >+ #include "cores/AudioEngine/Encoders/AEEncoderFFmpeg.h" >+-#include "cores/AudioEngine/Utils/AEUtil.h" >++ >+ #include "ServiceBroker.h" >+-#include "utils/log.h" >++#include "cores/AudioEngine/Utils/AEUtil.h" >++#include "cores/FFmpeg.h" >+ #include "settings/Settings.h" >+ #include "settings/SettingsComponent.h" >+-#include <string.h> >++#include "utils/log.h" >++ >++extern "C" >++{ >++#include <libavutil/channel_layout.h> >++} >++ >+ #include <cassert> >++#include <string.h> >+ >++using FFMPEG_HELP_TOOLS::FFMpegErrorToString; >++using FFMPEG_HELP_TOOLS::FFMpegException; >++ >+ CAEEncoderFFmpeg::CAEEncoderFFmpeg() : m_CodecCtx(NULL), m_SwrCtx(NULL) >+ { >+ } >+@@ -26,6 +37,7 @@ >+ { >+ Reset(); >+ swr_free(&m_SwrCtx); >++ av_channel_layout_uninit(&m_CodecCtx->ch_layout); >+ avcodec_free_context(&m_CodecCtx); >+ } >+ >+@@ -81,7 +93,7 @@ >+ >+ bool ac3 = CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(CSettings::SETTING_AUDIOOUTPUT_AC3PASSTHROUGH); >+ >+- AVCodec *codec = NULL; >++ const AVCodec* codec = nullptr; >+ >+ /* fallback to ac3 if we support it, we might not have DTS support */ >+ if (ac3) >+@@ -102,7 +114,8 @@ >+ >+ m_CodecCtx->bit_rate = m_BitRate; >+ m_CodecCtx->sample_rate = format.m_sampleRate; >+- m_CodecCtx->channel_layout = AV_CH_LAYOUT_5POINT1_BACK; >++ av_channel_layout_uninit(&m_CodecCtx->ch_layout); >++ av_channel_layout_from_mask(&m_CodecCtx->ch_layout, AV_CH_LAYOUT_5POINT1_BACK); >+ >+ /* select a suitable data format */ >+ if (codec->sample_fmts) >+@@ -179,22 +192,28 @@ >+ LOGERROR, >+ "CAEEncoderFFmpeg::Initialize - Unable to find a suitable data format for the codec ({})", >+ m_CodecName); >++ av_channel_layout_uninit(&m_CodecCtx->ch_layout); >+ avcodec_free_context(&m_CodecCtx); >+ return false; >+ } >+ } >+ >+- m_CodecCtx->channels = BuildChannelLayout(m_CodecCtx->channel_layout, m_Layout); >++ uint64_t mask = m_CodecCtx->ch_layout.u.mask; >++ av_channel_layout_uninit(&m_CodecCtx->ch_layout); >++ av_channel_layout_from_mask(&m_CodecCtx->ch_layout, mask); >++ m_CodecCtx->ch_layout.nb_channels = BuildChannelLayout(mask, m_Layout); >+ >+ /* open the codec */ >+ if (avcodec_open2(m_CodecCtx, codec, NULL)) >+ { >++ av_channel_layout_uninit(&m_CodecCtx->ch_layout); >+ avcodec_free_context(&m_CodecCtx); >+ return false; >+ } >+ >+ format.m_frames = m_CodecCtx->frame_size; >+- format.m_frameSize = m_CodecCtx->channels * (CAEUtil::DataFormatToBits(format.m_dataFormat) >> 3); >++ int channels = m_CodecCtx->ch_layout.nb_channels; >++ format.m_frameSize = channels * (CAEUtil::DataFormatToBits(format.m_dataFormat) >> 3); >+ format.m_channelLayout = m_Layout; >+ >+ m_CurrentFormat = format; >+@@ -204,14 +223,14 @@ >+ >+ if (m_NeedConversion) >+ { >+- m_SwrCtx = swr_alloc_set_opts(NULL, >+- m_CodecCtx->channel_layout, m_CodecCtx->sample_fmt, m_CodecCtx->sample_rate, >+- m_CodecCtx->channel_layout, AV_SAMPLE_FMT_FLT, m_CodecCtx->sample_rate, >+- 0, NULL); >+- if (!m_SwrCtx || swr_init(m_SwrCtx) < 0) >++ int ret = swr_alloc_set_opts2(&m_SwrCtx, &m_CodecCtx->ch_layout, m_CodecCtx->sample_fmt, >++ m_CodecCtx->sample_rate, &m_CodecCtx->ch_layout, >++ AV_SAMPLE_FMT_FLT, m_CodecCtx->sample_rate, 0, NULL); >++ if (ret || swr_init(m_SwrCtx) < 0) >+ { >+ CLog::Log(LOGERROR, "CAEEncoderFFmpeg::Initialize - Failed to initialise resampler."); >+ swr_free(&m_SwrCtx); >++ av_channel_layout_uninit(&m_CodecCtx->ch_layout); >+ avcodec_free_context(&m_CodecCtx); >+ return false; >+ } >+@@ -242,62 +261,78 @@ >+ >+ int CAEEncoderFFmpeg::Encode(uint8_t *in, int in_size, uint8_t *out, int out_size) >+ { >+- int got_output; >+- AVFrame *frame; >++ int size = 0; >++ int err = AVERROR_UNKNOWN; >++ AVFrame* frame = nullptr; >++ AVPacket* pkt = nullptr; >+ >+ if (!m_CodecCtx) >+- return 0; >++ return size; >+ >+- /* allocate the input frame >+- * sadly, we have to alloc/dealloc it everytime since we have no guarantee the >+- * data argument will be constant over iterated calls and the frame needs to >+- * setup pointers inside data */ >+- frame = av_frame_alloc(); >+- if (!frame) >+- return 0; >++ try >++ { >++ /* allocate the input frame and output packet >++ * sadly, we have to alloc/dealloc it everytime since we have no guarantee the >++ * data argument will be constant over iterated calls and the frame needs to >++ * setup pointers inside data */ >++ frame = av_frame_alloc(); >++ pkt = av_packet_alloc(); >++ if (!frame || !pkt) >++ throw FFMpegException( >++ "Failed to allocate \"AVFrame\" or \"AVPacket\" for encoding (error '{}')", >++ strerror(errno)); >+ >+- frame->nb_samples = m_CodecCtx->frame_size; >+- frame->format = m_CodecCtx->sample_fmt; >+- frame->channel_layout = m_CodecCtx->channel_layout; >+- frame->channels = m_CodecCtx->channels; >++ frame->nb_samples = m_CodecCtx->frame_size; >++ frame->format = m_CodecCtx->sample_fmt; >++ av_channel_layout_uninit(&frame->ch_layout); >++ av_channel_layout_copy(&frame->ch_layout, &m_CodecCtx->ch_layout); >++ int channelNum = m_CodecCtx->ch_layout.nb_channels; >+ >+- avcodec_fill_audio_frame(frame, m_CodecCtx->channels, m_CodecCtx->sample_fmt, >+- in, in_size, 0); >++ avcodec_fill_audio_frame(frame, channelNum, m_CodecCtx->sample_fmt, in, in_size, 0); >+ >+- /* initialize the output packet */ >+- AVPacket* pkt = av_packet_alloc(); >+- if (!pkt) >+- { >+- CLog::Log(LOGERROR, "CAEEncoderFFmpeg::{} - av_packet_alloc failed: {}", __FUNCTION__, >+- strerror(errno)); >+- av_frame_free(&frame); >+- return 0; >+- } >++ pkt->size = out_size; >++ pkt->data = out; >+ >+- pkt->size = out_size; >+- pkt->data = out; >++ /* encode it */ >++ err = avcodec_send_frame(m_CodecCtx, frame); >++ if (err < 0) >++ throw FFMpegException("Error sending a frame for encoding (error '{}')", >++ FFMpegErrorToString(err)); >+ >+- /* encode it */ >+- int ret = avcodec_encode_audio2(m_CodecCtx, pkt, frame, &got_output); >++ while (err >= 0) >++ { >++ err = avcodec_receive_packet(m_CodecCtx, pkt); >++ if (err == AVERROR(EAGAIN) || err == AVERROR_EOF) >++ { >++ av_channel_layout_uninit(&frame->ch_layout); >++ av_frame_free(&frame); >++ av_packet_free(&pkt); >++ return (err == AVERROR(EAGAIN)) ? -1 : 0; >++ } >++ else if (err < 0) >++ { >++ throw FFMpegException("Error during encoding (error '{}')", FFMpegErrorToString(err)); >++ } >+ >+- int size = pkt->size; >++ av_packet_unref(pkt); >++ } >+ >++ size = pkt->size; >++ } >++ catch (const FFMpegException& caught) >++ { >++ CLog::Log(LOGERROR, "CAEEncoderFFmpeg::{} - {}", __func__, caught.what()); >++ } >++ >+ /* free temporary data */ >+ av_frame_free(&frame); >+ >+ /* free the packet */ >+ av_packet_free(&pkt); >+ >+- if (ret < 0 || !got_output) >+- { >+- CLog::Log(LOGERROR, "CAEEncoderFFmpeg::Encode - Encoding failed"); >+- return 0; >+- } >+- >+ /* return the number of frames used */ >+ return size; >+ } >+- >+ >+ int CAEEncoderFFmpeg::GetData(uint8_t **data) >+ { >+diff -urN xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp.orig xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp >+--- xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp.orig 2023-03-11 22:16:38.000000000 +0000 >++++ xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp 2023-03-16 21:56:20.711552000 +0000 >+@@ -16,17 +16,16 @@ >+ #include "ActiveAESound.h" >+ #include "ActiveAEStream.h" >+ #include "ServiceBroker.h" >++#include "cores/AudioEngine/AEResampleFactory.h" >++#include "cores/AudioEngine/Encoders/AEEncoderFFmpeg.h" >+ #include "cores/AudioEngine/Interfaces/IAudioCallback.h" >+-#include "cores/AudioEngine/Utils/AEUtil.h" >+ #include "cores/AudioEngine/Utils/AEStreamData.h" >+ #include "cores/AudioEngine/Utils/AEStreamInfo.h" >+-#include "cores/AudioEngine/AEResampleFactory.h" >+-#include "cores/AudioEngine/Encoders/AEEncoderFFmpeg.h" >+- >++#include "cores/AudioEngine/Utils/AEUtil.h" >+ #include "settings/Settings.h" >+ #include "settings/SettingsComponent.h" >+-#include "windowing/WinSystem.h" >+ #include "utils/log.h" >++#include "windowing/WinSystem.h" >+ >+ using namespace std::chrono_literals; >+ >+@@ -3043,8 +3042,8 @@ >+ AVFormatContext *fmt_ctx = nullptr; >+ AVCodecContext *dec_ctx = nullptr; >+ AVIOContext *io_ctx; >+- AVInputFormat *io_fmt = nullptr; >+- AVCodec *dec = nullptr; >++ const AVInputFormat* io_fmt = nullptr; >++ const AVCodec* dec = nullptr; >+ SampleConfig config; >+ >+ // No custom deleter until sound is registered >+@@ -3096,8 +3095,8 @@ >+ AVCodecID codecId = fmt_ctx->streams[0]->codecpar->codec_id; >+ dec = avcodec_find_decoder(codecId); >+ config.sample_rate = fmt_ctx->streams[0]->codecpar->sample_rate; >+- config.channels = fmt_ctx->streams[0]->codecpar->channels; >+- config.channel_layout = fmt_ctx->streams[0]->codecpar->channel_layout; >++ config.channels = fmt_ctx->streams[0]->codecpar->ch_layout.nb_channels; >++ config.channel_layout = fmt_ctx->streams[0]->codecpar->ch_layout.u.mask; >+ } >+ } >+ if (dec == nullptr) >+@@ -3113,10 +3112,14 @@ >+ >+ dec_ctx = avcodec_alloc_context3(dec); >+ dec_ctx->sample_rate = config.sample_rate; >+- dec_ctx->channels = config.channels; >++ AVChannelLayout layout = {}; >+ if (!config.channel_layout) >+- config.channel_layout = av_get_default_channel_layout(config.channels); >+- dec_ctx->channel_layout = config.channel_layout; >++ av_channel_layout_default(&layout, config.channels); >++ else >++ av_channel_layout_from_mask(&layout, config.channel_layout); >++ config.channel_layout = layout.u.mask; >++ av_channel_layout_copy(&dec_ctx->ch_layout, &layout); >++ av_channel_layout_uninit(&layout); >+ >+ AVPacket* avpkt = av_packet_alloc(); >+ if (!avpkt) >+@@ -3183,6 +3186,7 @@ >+ >+ av_packet_free(&avpkt); >+ av_frame_free(&decoded_frame); >++ av_channel_layout_uninit(&dec_ctx->ch_layout); >+ avcodec_free_context(&dec_ctx); >+ avformat_close_input(&fmt_ctx); >+ if (io_ctx) >+diff -urN xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp.orig xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp >+--- xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp.orig 2023-03-11 22:16:38.000000000 +0000 >++++ xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp 2023-03-16 21:56:20.711812000 +0000 >+@@ -12,8 +12,8 @@ >+ #include <algorithm> >+ >+ extern "C" { >+-#include <libavfilter/avfilter.h> >+ #include <libavcodec/avcodec.h> >++#include <libavfilter/avfilter.h> >+ #include <libavfilter/buffersink.h> >+ #include <libavfilter/buffersrc.h> >+ #include <libswresample/swresample.h> >+@@ -171,7 +171,10 @@ >+ } >+ >+ if (m_pOutFrame) >++ { >++ av_channel_layout_uninit(&m_pOutFrame->ch_layout); >+ av_frame_free(&m_pOutFrame); >++ } >+ >+ if (m_pConvertFrame) >+ av_frame_free(&m_pConvertFrame); >+@@ -205,10 +208,9 @@ >+ if (!frame) >+ return -1; >+ >+- int channels = av_get_channel_layout_nb_channels(m_channelLayout); >+- >+- frame->channel_layout = m_channelLayout; >+- frame->channels = channels; >++ av_channel_layout_uninit(&frame->ch_layout); >++ av_channel_layout_from_mask(&frame->ch_layout, m_channelLayout); >++ int channels = frame->ch_layout.nb_channels; >+ frame->sample_rate = m_sampleRate; >+ frame->nb_samples = src_samples; >+ frame->format = m_sampleFormat; >+@@ -224,6 +226,7 @@ >+ src_buffer[0], src_bufsize, 16); >+ if (result < 0) >+ { >++ av_channel_layout_uninit(&frame->ch_layout); >+ av_frame_free(&frame); >+ CLog::Log(LOGERROR, "CActiveAEFilter::ProcessFilter - avcodec_fill_audio_frame failed"); >+ m_filterEof = true; >+@@ -231,6 +234,7 @@ >+ } >+ >+ result = av_buffersrc_write_frame(m_pFilterCtxIn, frame); >++ av_channel_layout_uninit(&frame->ch_layout); >+ av_frame_free(&frame); >+ if (result < 0) >+ { >+@@ -284,7 +288,8 @@ >+ { >+ av_frame_unref(m_pOutFrame); >+ m_pOutFrame->format = m_sampleFormat; >+- m_pOutFrame->channel_layout = m_channelLayout; >++ av_channel_layout_uninit(&m_pOutFrame->ch_layout); >++ av_channel_layout_from_mask(&m_pOutFrame->ch_layout, m_channelLayout); >+ m_pOutFrame->sample_rate = m_sampleRate; >+ result = swr_convert_frame(m_pConvertCtx, m_pOutFrame, m_pConvertFrame); >+ av_frame_unref(m_pConvertFrame); >+@@ -302,7 +307,10 @@ >+ >+ if (m_hasData) >+ { >+- int channels = av_get_channel_layout_nb_channels(m_channelLayout); >++ AVChannelLayout layout = {}; >++ av_channel_layout_from_mask(&layout, m_channelLayout); >++ int channels = layout.nb_channels; >++ av_channel_layout_uninit(&layout); >+ int planes = av_sample_fmt_is_planar(m_sampleFormat) ? channels : 1; >+ int samples = std::min(dst_samples, m_pOutFrame->nb_samples - m_sampleOffset); >+ int bytes = samples * av_get_bytes_per_sample(m_sampleFormat) * channels / planes; >+diff -urN xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp.orig xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp >+--- xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp.orig 2023-03-11 22:16:38.000000000 +0000 >++++ xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp 2023-03-16 21:56:20.712034000 +0000 >+@@ -49,15 +49,30 @@ >+ m_doesResample = true; >+ >+ if (m_dst_chan_layout == 0) >+- m_dst_chan_layout = av_get_default_channel_layout(m_dst_channels); >++ { >++ AVChannelLayout layout = {}; >++ av_channel_layout_default(&layout, m_dst_channels); >++ m_dst_chan_layout = layout.u.mask; >++ av_channel_layout_uninit(&layout); >++ } >+ if (m_src_chan_layout == 0) >+- m_src_chan_layout = av_get_default_channel_layout(m_src_channels); >++ { >++ AVChannelLayout layout = {}; >++ av_channel_layout_default(&layout, m_src_channels); >++ m_src_chan_layout = layout.u.mask; >++ av_channel_layout_uninit(&layout); >++ } >+ >+- m_pContext = swr_alloc_set_opts(NULL, m_dst_chan_layout, m_dst_fmt, m_dst_rate, >+- m_src_chan_layout, m_src_fmt, m_src_rate, >+- 0, NULL); >++ AVChannelLayout dstChLayout = {}; >++ AVChannelLayout srcChLayout = {}; >+ >+- if (!m_pContext) >++ av_channel_layout_from_mask(&dstChLayout, m_dst_chan_layout); >++ av_channel_layout_from_mask(&srcChLayout, m_src_chan_layout); >++ >++ int ret = swr_alloc_set_opts2(&m_pContext, &dstChLayout, m_dst_fmt, m_dst_rate, &srcChLayout, >++ m_src_fmt, m_src_rate, 0, NULL); >++ >++ if (ret) >+ { >+ CLog::Log(LOGERROR, "CActiveAEResampleFFMPEG::Init - create context failed"); >+ return false; >+@@ -126,10 +141,12 @@ >+ else if (upmix && m_src_channels == 2 && m_dst_channels > 2) >+ { >+ memset(m_rematrix, 0, sizeof(m_rematrix)); >++ av_channel_layout_uninit(&dstChLayout); >++ av_channel_layout_from_mask(&dstChLayout, m_dst_chan_layout); >+ for (int out=0; out<m_dst_channels; out++) >+ { >+- uint64_t out_chan = av_channel_layout_extract_channel(m_dst_chan_layout, out); >+- switch(out_chan) >++ AVChannel outChan = av_channel_layout_channel_from_index(&dstChLayout, out); >++ switch (outChan) >+ { >+ case AV_CH_FRONT_LEFT: >+ case AV_CH_BACK_LEFT: >+@@ -153,6 +170,8 @@ >+ break; >+ } >+ } >++ >++ av_channel_layout_uninit(&dstChLayout); >+ >+ if (swr_set_matrix(m_pContext, (const double*)m_rematrix, AE_CH_MAX) < 0) >+ { >+diff -urN xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp.orig xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp >+--- xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp.orig 2023-03-11 22:16:38.000000000 +0000 >++++ xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp 2023-03-16 21:56:20.705902000 +0000 >+@@ -88,7 +88,7 @@ >+ for(unsigned int i=0; i<m_format.m_channelLayout.Count(); i++) >+ { >+ avLast = avCur; >+- avCur = CAEUtil::GetAVChannel(m_format.m_channelLayout[i]); >++ avCur = CAEUtil::GetAVChannelMask(m_format.m_channelLayout[i]); >+ if(avCur < avLast) >+ { >+ needRemap = true; >+diff -urN xbmc/cores/AudioEngine/Utils/AEUtil.cpp.orig xbmc/cores/AudioEngine/Utils/AEUtil.cpp >+--- xbmc/cores/AudioEngine/Utils/AEUtil.cpp.orig 2023-03-11 22:16:38.000000000 +0000 >++++ xbmc/cores/AudioEngine/Utils/AEUtil.cpp 2023-03-16 21:56:20.712279000 +0000 >+@@ -19,10 +19,6 @@ >+ #include <xmmintrin.h> >+ #endif >+ >+-extern "C" { >+-#include <libavutil/channel_layout.h> >+-} >+- >+ void AEDelayStatus::SetDelay(double d) >+ { >+ delay = d; >+@@ -550,34 +546,64 @@ >+ } >+ } >+ >+-uint64_t CAEUtil::GetAVChannel(enum AEChannel aechannel) >++uint64_t CAEUtil::GetAVChannelMask(enum AEChannel aechannel) >+ { >++ enum AVChannel ch = GetAVChannel(aechannel); >++ if (ch == AV_CHAN_NONE) >++ return 0; >++ return (1ULL << ch); >++} >++ >++enum AVChannel CAEUtil::GetAVChannel(enum AEChannel aechannel) >++{ >+ switch (aechannel) >+ { >+- case AE_CH_FL: return AV_CH_FRONT_LEFT; >+- case AE_CH_FR: return AV_CH_FRONT_RIGHT; >+- case AE_CH_FC: return AV_CH_FRONT_CENTER; >+- case AE_CH_LFE: return AV_CH_LOW_FREQUENCY; >+- case AE_CH_BL: return AV_CH_BACK_LEFT; >+- case AE_CH_BR: return AV_CH_BACK_RIGHT; >+- case AE_CH_FLOC: return AV_CH_FRONT_LEFT_OF_CENTER; >+- case AE_CH_FROC: return AV_CH_FRONT_RIGHT_OF_CENTER; >+- case AE_CH_BC: return AV_CH_BACK_CENTER; >+- case AE_CH_SL: return AV_CH_SIDE_LEFT; >+- case AE_CH_SR: return AV_CH_SIDE_RIGHT; >+- case AE_CH_TC: return AV_CH_TOP_CENTER; >+- case AE_CH_TFL: return AV_CH_TOP_FRONT_LEFT; >+- case AE_CH_TFC: return AV_CH_TOP_FRONT_CENTER; >+- case AE_CH_TFR: return AV_CH_TOP_FRONT_RIGHT; >+- case AE_CH_TBL: return AV_CH_TOP_BACK_LEFT; >+- case AE_CH_TBC: return AV_CH_TOP_BACK_CENTER; >+- case AE_CH_TBR: return AV_CH_TOP_BACK_RIGHT; >+- default: >+- return 0; >++ case AE_CH_FL: >++ return AV_CHAN_FRONT_LEFT; >++ case AE_CH_FR: >++ return AV_CHAN_FRONT_RIGHT; >++ case AE_CH_FC: >++ return AV_CHAN_FRONT_CENTER; >++ case AE_CH_LFE: >++ return AV_CHAN_LOW_FREQUENCY; >++ case AE_CH_BL: >++ return AV_CHAN_BACK_LEFT; >++ case AE_CH_BR: >++ return AV_CHAN_BACK_RIGHT; >++ case AE_CH_FLOC: >++ return AV_CHAN_FRONT_LEFT_OF_CENTER; >++ case AE_CH_FROC: >++ return AV_CHAN_FRONT_RIGHT_OF_CENTER; >++ case AE_CH_BC: >++ return AV_CHAN_BACK_CENTER; >++ case AE_CH_SL: >++ return AV_CHAN_SIDE_LEFT; >++ case AE_CH_SR: >++ return AV_CHAN_SIDE_RIGHT; >++ case AE_CH_TC: >++ return AV_CHAN_TOP_CENTER; >++ case AE_CH_TFL: >++ return AV_CHAN_TOP_FRONT_LEFT; >++ case AE_CH_TFC: >++ return AV_CHAN_TOP_FRONT_CENTER; >++ case AE_CH_TFR: >++ return AV_CHAN_TOP_FRONT_RIGHT; >++ case AE_CH_TBL: >++ return AV_CHAN_TOP_BACK_LEFT; >++ case AE_CH_TBC: >++ return AV_CHAN_TOP_BACK_CENTER; >++ case AE_CH_TBR: >++ return AV_CHAN_TOP_BACK_RIGHT; >++ default: >++ return AV_CHAN_NONE; >+ } >+ } >+ >+ int CAEUtil::GetAVChannelIndex(enum AEChannel aechannel, uint64_t layout) >+ { >+- return av_get_channel_layout_channel_index(layout, GetAVChannel(aechannel)); >++ AVChannelLayout ch_layout = {}; >++ av_channel_layout_from_mask(&ch_layout, layout); >++ int idx = av_channel_layout_index_from_channel(&ch_layout, GetAVChannel(aechannel)); >++ av_channel_layout_uninit(&ch_layout); >++ return idx; >+ } >+diff -urN xbmc/cores/AudioEngine/Utils/AEUtil.h.orig xbmc/cores/AudioEngine/Utils/AEUtil.h >+--- xbmc/cores/AudioEngine/Utils/AEUtil.h.orig 2023-03-11 22:16:38.000000000 +0000 >++++ xbmc/cores/AudioEngine/Utils/AEUtil.h 2023-03-16 21:56:20.712441000 +0000 >+@@ -13,6 +13,7 @@ >+ #include <math.h> >+ >+ extern "C" { >++#include <libavutil/channel_layout.h> >+ #include <libavutil/samplefmt.h> >+ } >+ >+@@ -171,6 +172,7 @@ >+ static uint64_t GetAVChannelLayout(const CAEChannelInfo &info); >+ static CAEChannelInfo GetAEChannelLayout(uint64_t layout); >+ static AVSampleFormat GetAVSampleFormat(AEDataFormat format); >+- static uint64_t GetAVChannel(enum AEChannel aechannel); >++ static uint64_t GetAVChannelMask(enum AEChannel aechannel); >++ static enum AVChannel GetAVChannel(enum AEChannel aechannel); >+ static int GetAVChannelIndex(enum AEChannel aechannel, uint64_t layout); >+ }; >+diff -urN xbmc/cores/FFmpeg.cpp.orig xbmc/cores/FFmpeg.cpp >+--- xbmc/cores/FFmpeg.cpp.orig 2023-03-11 22:16:38.000000000 +0000 >++++ xbmc/cores/FFmpeg.cpp 2023-03-16 21:56:20.712628000 +0000 >+@@ -16,11 +16,29 @@ >+ #include "utils/StringUtils.h" >+ #include "utils/log.h" >+ >++extern "C" >++{ >++#include <libavcodec/bsf.h> >++} >++ >+ #include <map> >+ #include <mutex> >+ >+ static thread_local CFFmpegLog* CFFmpegLogTls; >+ >++namespace FFMPEG_HELP_TOOLS >++{ >++ >++std::string FFMpegErrorToString(int err) >++{ >++ std::string text; >++ text.resize(AV_ERROR_MAX_STRING_SIZE); >++ av_strerror(err, text.data(), AV_ERROR_MAX_STRING_SIZE); >++ return text; >++} >++ >++} // namespace FFMPEG_HELP_TOOLS >++ >+ void CFFmpegLog::SetLogLevel(int level) >+ { >+ CFFmpegLog::ClearLogLevel(); >+@@ -117,3 +135,128 @@ >+ buffer.erase(0, start); >+ } >+ >++std::tuple<uint8_t*, int> GetPacketExtradata(const AVPacket* pkt, >++ const AVCodecParserContext* parserCtx, >++ AVCodecContext* codecCtx) >++{ >++ constexpr int FF_MAX_EXTRADATA_SIZE = ((1 << 28) - AV_INPUT_BUFFER_PADDING_SIZE); >++ >++ if (!pkt) >++ return std::make_tuple(nullptr, 0); >++ >++ uint8_t* extraData = nullptr; >++ int extraDataSize = 0; >++ >++ /* extract_extradata bitstream filter is implemented only >++ * for certain codecs, as noted in discussion of PR#21248 >++ */ >++ >++ AVCodecID codecId = codecCtx->codec_id; >++ >++ // clang-format off >++ if ( >++ codecId != AV_CODEC_ID_MPEG1VIDEO && >++ codecId != AV_CODEC_ID_MPEG2VIDEO && >++ codecId != AV_CODEC_ID_H264 && >++ codecId != AV_CODEC_ID_HEVC && >++ codecId != AV_CODEC_ID_MPEG4 && >++ codecId != AV_CODEC_ID_VC1 && >++ codecId != AV_CODEC_ID_AV1 && >++ codecId != AV_CODEC_ID_AVS2 && >++ codecId != AV_CODEC_ID_AVS3 && >++ codecId != AV_CODEC_ID_CAVS >++ ) >++ // clang-format on >++ return std::make_tuple(nullptr, 0); >++ >++ const AVBitStreamFilter* f = av_bsf_get_by_name("extract_extradata"); >++ if (!f) >++ return std::make_tuple(nullptr, 0); >++ >++ AVBSFContext* bsf = nullptr; >++ int ret = av_bsf_alloc(f, &bsf); >++ if (ret < 0) >++ return std::make_tuple(nullptr, 0); >++ >++ bsf->par_in->codec_id = codecId; >++ >++ ret = av_bsf_init(bsf); >++ if (ret < 0) >++ { >++ av_bsf_free(&bsf); >++ return std::make_tuple(nullptr, 0); >++ } >++ >++ AVPacket* dstPkt = av_packet_alloc(); >++ if (!dstPkt) >++ { >++ CLog::LogF(LOGERROR, "failed to allocate packet"); >++ >++ av_bsf_free(&bsf); >++ return std::make_tuple(nullptr, 0); >++ } >++ AVPacket* pktRef = dstPkt; >++ >++ ret = av_packet_ref(pktRef, pkt); >++ if (ret < 0) >++ { >++ av_bsf_free(&bsf); >++ av_packet_free(&dstPkt); >++ return std::make_tuple(nullptr, 0); >++ } >++ >++ ret = av_bsf_send_packet(bsf, pktRef); >++ if (ret < 0) >++ { >++ av_packet_unref(pktRef); >++ av_bsf_free(&bsf); >++ av_packet_free(&dstPkt); >++ return std::make_tuple(nullptr, 0); >++ } >++ >++ ret = 0; >++ while (ret >= 0) >++ { >++ ret = av_bsf_receive_packet(bsf, pktRef); >++ if (ret < 0) >++ { >++ if (ret != AVERROR(EAGAIN) && ret != AVERROR_EOF) >++ break; >++ >++ continue; >++ } >++ >++ size_t retExtraDataSize = 0; >++ uint8_t* retExtraData = >++ av_packet_get_side_data(pktRef, AV_PKT_DATA_NEW_EXTRADATA, &retExtraDataSize); >++ if (retExtraData && retExtraDataSize > 0 && retExtraDataSize < FF_MAX_EXTRADATA_SIZE) >++ { >++ extraData = static_cast<uint8_t*>(av_malloc(retExtraDataSize + AV_INPUT_BUFFER_PADDING_SIZE)); >++ if (!extraData) >++ { >++ CLog::LogF(LOGERROR, "failed to allocate {} bytes for extradata", retExtraDataSize); >++ >++ av_packet_unref(pktRef); >++ av_bsf_free(&bsf); >++ av_packet_free(&dstPkt); >++ return std::make_tuple(nullptr, 0); >++ } >++ >++ CLog::LogF(LOGDEBUG, "fetching extradata, extradata_size({})", retExtraDataSize); >++ >++ memcpy(extraData, retExtraData, retExtraDataSize); >++ memset(extraData + retExtraDataSize, 0, AV_INPUT_BUFFER_PADDING_SIZE); >++ extraDataSize = retExtraDataSize; >++ >++ av_packet_unref(pktRef); >++ break; >++ } >++ >++ av_packet_unref(pktRef); >++ } >++ >++ av_bsf_free(&bsf); >++ av_packet_free(&dstPkt); >++ >++ return std::make_tuple(extraData, extraDataSize); >++} >+diff -urN xbmc/cores/FFmpeg.h.orig xbmc/cores/FFmpeg.h >+--- xbmc/cores/FFmpeg.h.orig 2023-03-11 22:16:38.000000000 +0000 >++++ xbmc/cores/FFmpeg.h 2023-03-16 21:56:20.712753000 +0000 >+@@ -10,6 +10,7 @@ >+ >+ #include "ServiceBroker.h" >+ #include "utils/CPUInfo.h" >++#include "utils/StringUtils.h" >+ >+ extern "C" { >+ #include <libavcodec/avcodec.h> >+@@ -21,6 +22,26 @@ >+ #include <libpostproc/postprocess.h> >+ } >+ >++#include <tuple> >++ >++namespace FFMPEG_HELP_TOOLS >++{ >++ >++struct FFMpegException : public std::exception >++{ >++ std::string s; >++ template<typename... Args> >++ FFMpegException(const std::string& fmt, Args&&... args) >++ : s(StringUtils::Format(fmt, std::forward<Args>(args)...)) >++ { >++ } >++ const char* what() const noexcept override { return s.c_str(); } >++}; >++ >++std::string FFMpegErrorToString(int err); >++ >++} // namespace FFMPEG_HELP_TOOLS >++ >+ inline int PPCPUFlags() >+ { >+ unsigned int cpuFeatures = CServiceBroker::GetCPUInfo()->GetCPUFeatures(); >+@@ -51,3 +72,6 @@ >+ int level; >+ }; >+ >++std::tuple<uint8_t*, int> GetPacketExtradata(const AVPacket* pkt, >++ const AVCodecParserContext* parserCtx, >++ AVCodecContext* codecCtx); >+diff -urN xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp.orig xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp >+--- xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp.orig 2023-03-11 22:16:38.000000000 +0000 >++++ xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp 2023-03-16 21:56:53.273377000 +0000 >+@@ -7,14 +7,16 @@ >+ */ >+ >+ #include "DVDAudioCodecFFmpeg.h" >+-#include "ServiceBroker.h" >++ >+ #include "../../DVDStreamInfo.h" >+-#include "utils/log.h" >++#include "DVDCodecs/DVDCodecs.h" >++#include "ServiceBroker.h" >++#include "cores/AudioEngine/Utils/AEUtil.h" >++#include "cores/FFmpeg.h" >+ #include "settings/AdvancedSettings.h" >+ #include "settings/Settings.h" >+ #include "settings/SettingsComponent.h" >+-#include "DVDCodecs/DVDCodecs.h" >+-#include "cores/AudioEngine/Utils/AEUtil.h" >++#include "utils/log.h" >+ >+ extern "C" { >+ #include <libavutil/opt.h> >+@@ -44,7 +46,7 @@ >+ return false; >+ } >+ >+- AVCodec* pCodec = NULL; >++ const AVCodec* pCodec = nullptr; >+ bool allowdtshddecode = true; >+ >+ // set any special options >+@@ -71,13 +73,28 @@ >+ m_pCodecContext->debug = 0; >+ m_pCodecContext->workaround_bugs = 1; >+ >++#if LIBAVCODEC_VERSION_MAJOR < 60 >+ if (pCodec->capabilities & AV_CODEC_CAP_TRUNCATED) >+ m_pCodecContext->flags |= AV_CODEC_FLAG_TRUNCATED; >++#endif >+ >+ m_matrixEncoding = AV_MATRIX_ENCODING_NONE; >+ m_channels = 0; >+- m_pCodecContext->channels = hints.channels; >+- m_hint_layout = hints.channellayout; >++ av_channel_layout_uninit(&m_pCodecContext->ch_layout); >++ >++ if (hints.channels > 0 && hints.channellayout > 0) >++ { >++ m_pCodecContext->ch_layout.order = AV_CHANNEL_ORDER_NATIVE; >++ m_pCodecContext->ch_layout.nb_channels = hints.channels; >++ m_pCodecContext->ch_layout.u.mask = hints.channellayout; >++ } >++ else if (hints.channels > 0) >++ { >++ av_channel_layout_default(&m_pCodecContext->ch_layout, hints.channels); >++ } >++ >++ m_hint_layout = m_pCodecContext->ch_layout.u.mask; >++ >+ m_pCodecContext->sample_rate = hints.samplerate; >+ m_pCodecContext->block_align = hints.blockalign; >+ m_pCodecContext->bit_rate = hints.bitrate; >+@@ -259,12 +276,13 @@ >+ m_format.m_frameSize = m_format.m_channelLayout.Count() * >+ CAEUtil::DataFormatToBits(m_format.m_dataFormat) >> 3; >+ >+- int planes = av_sample_fmt_is_planar(m_pCodecContext->sample_fmt) ? m_pFrame->channels : 1; >++ int channels = m_pFrame->ch_layout.nb_channels; >++ int planes = av_sample_fmt_is_planar(m_pCodecContext->sample_fmt) ? channels : 1; >++ >+ for (int i=0; i<planes; i++) >+ dst[i] = m_pFrame->extended_data[i]; >+ >+- return m_pFrame->nb_samples * m_pFrame->channels * >+- av_get_bytes_per_sample(m_pCodecContext->sample_fmt); >++ return m_pFrame->nb_samples * channels * av_get_bytes_per_sample(m_pCodecContext->sample_fmt); >+ } >+ >+ return 0; >+@@ -278,7 +296,7 @@ >+ >+ int CDVDAudioCodecFFmpeg::GetChannels() >+ { >+- return m_pCodecContext->channels; >++ return m_pCodecContext->ch_layout.nb_channels; >+ } >+ >+ int CDVDAudioCodecFFmpeg::GetSampleRate() >+@@ -345,28 +363,33 @@ >+ >+ void CDVDAudioCodecFFmpeg::BuildChannelMap() >+ { >+- if (m_channels == m_pCodecContext->channels && m_layout == m_pCodecContext->channel_layout) >++ int codecChannels = m_pCodecContext->ch_layout.nb_channels; >++ uint64_t codecChannelLayout = m_pCodecContext->ch_layout.u.mask; >++ if (m_channels == codecChannels && m_layout == codecChannelLayout) >+ return; //nothing to do here >+ >+- m_channels = m_pCodecContext->channels; >+- m_layout = m_pCodecContext->channel_layout; >++ m_channels = codecChannels; >++ m_layout = codecChannelLayout; >+ >+ int64_t layout; >+ >+- int bits = count_bits(m_pCodecContext->channel_layout); >+- if (bits == m_pCodecContext->channels) >+- layout = m_pCodecContext->channel_layout; >++ int bits = count_bits(codecChannelLayout); >++ if (bits == codecChannels) >++ layout = codecChannelLayout; >+ else >+ { >+ CLog::Log(LOGINFO, >+ "CDVDAudioCodecFFmpeg::GetChannelMap - FFmpeg reported {} channels, but the layout " >+ "contains {} - trying hints", >+- m_pCodecContext->channels, bits); >+- if (static_cast<int>(count_bits(m_hint_layout)) == m_pCodecContext->channels) >++ codecChannels, bits); >++ if (static_cast<int>(count_bits(m_hint_layout)) == codecChannels) >+ layout = m_hint_layout; >+ else >+ { >+- layout = av_get_default_channel_layout(m_pCodecContext->channels); >++ AVChannelLayout def_layout = {}; >++ av_channel_layout_default(&def_layout, codecChannels); >++ layout = def_layout.u.mask; >++ av_channel_layout_uninit(&def_layout); >+ CLog::Log(LOGINFO, "Using default layout..."); >+ } >+ } >+@@ -392,7 +415,7 @@ >+ if (layout & AV_CH_TOP_BACK_CENTER ) m_channelLayout += AE_CH_BC ; >+ if (layout & AV_CH_TOP_BACK_RIGHT ) m_channelLayout += AE_CH_BR ; >+ >+- m_channels = m_pCodecContext->channels; >++ m_channels = codecChannels; >+ } >+ >+ CAEChannelInfo CDVDAudioCodecFFmpeg::GetChannelMap() >+diff -urN xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp.orig xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp >+--- xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp.orig 2023-03-11 22:16:38.000000000 +0000 >++++ xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp 2023-03-16 21:56:20.713197000 +0000 >+@@ -10,6 +10,7 @@ >+ >+ #include "DVDOverlayImage.h" >+ #include "DVDStreamInfo.h" >++#include "cores/FFmpeg.h" >+ #include "cores/VideoPlayer/Interface/DemuxPacket.h" >+ #include "cores/VideoPlayer/Interface/TimingConstants.h" >+ #include "utils/EndianSwap.h" >+@@ -39,7 +40,7 @@ >+ if (hints.codec == AV_CODEC_ID_EIA_608) >+ return false; >+ >+- AVCodec* pCodec = avcodec_find_decoder(hints.codec); >++ const AVCodec* pCodec = avcodec_find_decoder(hints.codec); >+ if (!pCodec) >+ { >+ CLog::Log(LOGDEBUG, "{} - Unable to find codec {}", __FUNCTION__, hints.codec); >+diff -urN xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp.orig xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp >+--- xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp.orig 2023-03-11 22:16:38.000000000 +0000 >++++ xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp 2023-03-16 21:56:53.273710000 +0000 >+@@ -12,6 +12,7 @@ >+ #include "DVDCodecs/DVDFactoryCodec.h" >+ #include "DVDStreamInfo.h" >+ #include "ServiceBroker.h" >++#include "cores/FFmpeg.h" >+ #include "cores/VideoPlayer/Interface/TimingConstants.h" >+ #include "cores/VideoPlayer/VideoRenderers/RenderManager.h" >+ #include "cores/VideoSettings.h" >+@@ -27,12 +28,13 @@ >+ #include <mutex> >+ >+ extern "C" { >+-#include <libavutil/opt.h> >+-#include <libavutil/mastering_display_metadata.h> >+ #include <libavfilter/avfilter.h> >+ #include <libavfilter/buffersink.h> >+ #include <libavfilter/buffersrc.h> >++#include <libavutil/mastering_display_metadata.h> >++#include <libavutil/opt.h> >+ #include <libavutil/pixdesc.h> >++#include <libavutil/video_enc_params.h> >+ } >+ >+ #ifndef TARGET_POSIX >+@@ -327,7 +329,7 @@ >+ m_hints = hints; >+ m_options = options; >+ >+- AVCodec* pCodec = nullptr; >++ const AVCodec* pCodec = nullptr; >+ >+ m_iOrientation = hints.orientation; >+ >+@@ -367,6 +369,7 @@ >+ m_pCodecContext->workaround_bugs = FF_BUG_AUTODETECT; >+ m_pCodecContext->get_format = GetFormat; >+ m_pCodecContext->codec_tag = hints.codec_tag; >++ m_pCodecContext->flags = AV_CODEC_FLAG_COPY_OPAQUE; >+ >+ // setup threading model >+ if (!(hints.codecOptions & CODEC_FORCE_SOFTWARE)) >+@@ -543,19 +546,6 @@ >+ CLog::Log(LOGDEBUG, "CDVDVideoCodecFFmpeg - Updated codec: {}", m_name); >+ } >+ >+-union pts_union >+-{ >+- double pts_d; >+- int64_t pts_i; >+-}; >+- >+-static int64_t pts_dtoi(double pts) >+-{ >+- pts_union u; >+- u.pts_d = pts; >+- return u.pts_i; >+-} >+- >+ bool CDVDVideoCodecFFmpeg::AddData(const DemuxPacket &packet) >+ { >+ if (!m_pCodecContext) >+@@ -573,7 +563,6 @@ >+ m_started = true; >+ >+ m_dts = packet.dts; >+- m_pCodecContext->reordered_opaque = pts_dtoi(packet.pts); >+ >+ AVPacket* avpkt = av_packet_alloc(); >+ if (!avpkt) >+@@ -1048,24 +1037,27 @@ >+ pVideoPicture->qscale_type = 0; >+ >+ AVFrameSideData* sd; >+- sd = av_frame_get_side_data(m_pFrame, AV_FRAME_DATA_QP_TABLE_PROPERTIES); >++ >++ // https://github.com/FFmpeg/FFmpeg/blob/991d417692/doc/APIchanges#L18-L20 >++ sd = av_frame_get_side_data(m_pFrame, AV_FRAME_DATA_VIDEO_ENC_PARAMS); >+ if (sd) >+ { >+- struct qp_properties >+- { >+- int stride; >+- int type; >+- }; >++ unsigned int mb_h = (m_pFrame->height + 15) / 16; >++ unsigned int mb_w = (m_pFrame->width + 15) / 16; >++ unsigned int nb_mb = mb_h * mb_w; >++ unsigned int block_idx; >+ >+- auto qp = reinterpret_cast<qp_properties*>(sd->data); >+- >+- sd = av_frame_get_side_data(m_pFrame, AV_FRAME_DATA_QP_TABLE_DATA); >+- if (sd && sd->buf && qp) >++ auto par = reinterpret_cast<AVVideoEncParams*>(sd->data); >++ if (par->type == AV_VIDEO_ENC_PARAMS_MPEG2 && (par->nb_blocks == 0 || par->nb_blocks == nb_mb)) >+ { >+- // this seems wrong but it's what ffmpeg does internally >+- pVideoPicture->qp_table = reinterpret_cast<int8_t*>(sd->buf->data); >+- pVideoPicture->qstride = qp->stride; >+- pVideoPicture->qscale_type = qp->type; >++ pVideoPicture->qstride = mb_w; >++ pVideoPicture->qscale_type = par->type; >++ pVideoPicture->qp_table = static_cast<int8_t*>(av_malloc(nb_mb)); >++ for (block_idx = 0; block_idx < nb_mb; block_idx++) >++ { >++ AVVideoBlockParams* b = av_video_enc_params_block(par, block_idx); >++ pVideoPicture->qp_table[block_idx] = par->qp + b->delta_qp; >++ } >+ } >+ } >+ >+@@ -1159,8 +1151,9 @@ >+ const AVFilter* outFilter = avfilter_get_by_name("buffersink"); // should be last filter in the graph for now >+ >+ std::string args = StringUtils::Format( >+- "{}:{}:{}:{}:{}:{}:{}", m_pCodecContext->width, m_pCodecContext->height, >+- m_pCodecContext->pix_fmt, m_pCodecContext->time_base.num ? m_pCodecContext->time_base.num : 1, >++ "video_size={}x{}:pix_fmt={}:time_base={}/{}:pixel_aspect={}/{}", m_pCodecContext->width, >++ m_pCodecContext->height, m_pCodecContext->pix_fmt, >++ m_pCodecContext->time_base.num ? m_pCodecContext->time_base.num : 1, >+ m_pCodecContext->time_base.num ? m_pCodecContext->time_base.den : 1, >+ m_pCodecContext->sample_aspect_ratio.num != 0 ? m_pCodecContext->sample_aspect_ratio.num : 1, >+ m_pCodecContext->sample_aspect_ratio.num != 0 ? m_pCodecContext->sample_aspect_ratio.den : 1); >+diff -urN xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoPPFFmpeg.cpp.orig xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoPPFFmpeg.cpp >+--- xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoPPFFmpeg.cpp.orig 2023-03-11 22:16:38.000000000 +0000 >++++ xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoPPFFmpeg.cpp 2023-03-16 21:56:20.713709000 +0000 >+@@ -118,6 +118,8 @@ >+ m_pMode, m_pContext, >+ pSource->pict_type | pSource->qscale_type ? PP_PICT_TYPE_QP2 : 0); >+ >++ // https://github.com/FFmpeg/FFmpeg/blob/991d417692/doc/APIchanges#L18-L20 >++ av_free(pSource->qp_table); >+ >+ pPicture->SetParams(*pSource); >+ if (pPicture->videoBuffer) >+diff -urN xbmc/cores/VideoPlayer/DVDCodecs/Video/DXVA.cpp.orig xbmc/cores/VideoPlayer/DVDCodecs/Video/DXVA.cpp >+--- xbmc/cores/VideoPlayer/DVDCodecs/Video/DXVA.cpp.orig 2023-03-11 22:16:38.000000000 +0000 >++++ xbmc/cores/VideoPlayer/DVDCodecs/Video/DXVA.cpp 2023-03-16 21:56:53.271687000 +0000 >+@@ -973,7 +973,8 @@ >+ m_event.Set(); >+ m_avD3D11Context = av_d3d11va_alloc_context(); >+ m_avD3D11Context->cfg = reinterpret_cast<D3D11_VIDEO_DECODER_CONFIG*>(av_mallocz(sizeof(D3D11_VIDEO_DECODER_CONFIG))); >+- m_avD3D11Context->surface = reinterpret_cast<ID3D11VideoDecoderOutputView**>(av_mallocz_array(32, sizeof(ID3D11VideoDecoderOutputView*))); >++ m_avD3D11Context->surface = reinterpret_cast<ID3D11VideoDecoderOutputView**>( >++ av_calloc(32, sizeof(ID3D11VideoDecoderOutputView*))); >+ m_bufferPool.reset(); >+ >+ DX::Windowing()->Register(this); >+@@ -1537,8 +1538,6 @@ >+ m_state = DXVA_RESET; >+ return -1; >+ } >+- >+- pic->reordered_opaque = avctx->reordered_opaque; >+ >+ for (unsigned i = 0; i < 4; i++) >+ { >+diff -urN xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp.orig xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp >+--- xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp.orig 2023-03-11 22:16:38.000000000 +0000 >++++ xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp 2023-03-16 21:56:53.274356000 +0000 >+@@ -868,7 +868,6 @@ >+ } >+ pic->buf[0] = buffer; >+ >+- pic->reordered_opaque = avctx->reordered_opaque; >+ va->Acquire(); >+ return 0; >+ } >+@@ -1259,7 +1258,9 @@ >+ >+ IHardwareDecoder* CDecoder::Create(CDVDStreamInfo &hint, CProcessInfo &processInfo, AVPixelFormat fmt) >+ { >+- if (fmt == AV_PIX_FMT_VAAPI_VLD && CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(SETTING_VIDEOPLAYER_USEVAAPI)) >++ // https://github.com/FFmpeg/FFmpeg/blob/56450a0ee4fdda160f4039fc2ae33edfd27765c9/doc/APIchanges#L18-L26 >++ if (fmt == AV_PIX_FMT_VAAPI && >++ CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(SETTING_VIDEOPLAYER_USEVAAPI)) >+ return new VAAPI::CDecoder(processInfo); >+ >+ return nullptr; >+@@ -2966,10 +2967,11 @@ >+ const AVFilter* srcFilter = avfilter_get_by_name("buffer"); >+ const AVFilter* outFilter = avfilter_get_by_name("buffersink"); >+ >+- std::string args = StringUtils::Format("{}:{}:{}:{}:{}:{}:{}", m_config.vidWidth, >+- m_config.vidHeight, AV_PIX_FMT_NV12, 1, 1, >+- (m_config.aspect.num != 0) ? m_config.aspect.num : 1, >+- (m_config.aspect.num != 0) ? m_config.aspect.den : 1); >++ std::string args = >++ StringUtils::Format("video_size={}x{}:pix_fmt={}:time_base={}/{}:pixel_aspect={}/{}", >++ m_config.vidWidth, m_config.vidHeight, AV_PIX_FMT_NV12, 1, 1, >++ (m_config.aspect.num != 0) ? m_config.aspect.num : 1, >++ (m_config.aspect.num != 0) ? m_config.aspect.den : 1); >+ >+ if (avfilter_graph_create_filter(&m_pFilterIn, srcFilter, "src", args.c_str(), NULL, m_pFilterGraph) < 0) >+ { >+diff -urN xbmc/cores/VideoPlayer/DVDCodecs/Video/VDPAU.cpp.orig xbmc/cores/VideoPlayer/DVDCodecs/Video/VDPAU.cpp >+--- xbmc/cores/VideoPlayer/DVDCodecs/Video/VDPAU.cpp.orig 2023-03-11 22:16:38.000000000 +0000 >++++ xbmc/cores/VideoPlayer/DVDCodecs/Video/VDPAU.cpp 2023-03-16 21:56:53.273163000 +0000 >+@@ -1045,7 +1045,6 @@ >+ } >+ pic->buf[0] = buffer; >+ >+- pic->reordered_opaque= avctx->reordered_opaque; >+ return 0; >+ } >+ >+diff -urN xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp.orig xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp >+--- xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp.orig 2023-03-11 22:16:38.000000000 +0000 >++++ xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp 2023-03-16 21:56:20.714592000 +0000 >+@@ -10,13 +10,13 @@ >+ >+ #include "DVDDemuxUtils.h" >+ #include "DVDInputStreams/DVDInputStream.h" >++#include "cores/FFmpeg.h" >+ #include "cores/VideoPlayer/Interface/TimingConstants.h" >+ #include "utils/log.h" >+ >++#include <tuple> >+ #include <utility> >+ >+-#define FF_MAX_EXTRADATA_SIZE ((1 << 28) - AV_INPUT_BUFFER_PADDING_SIZE) >+- >+ class CDemuxStreamClientInternal >+ { >+ public: >+@@ -130,7 +130,7 @@ >+ >+ if (stream->m_context == nullptr) >+ { >+- AVCodec *codec = avcodec_find_decoder(st->codec); >++ const AVCodec* codec = avcodec_find_decoder(st->codec); >+ if (codec == nullptr) >+ { >+ CLog::Log(LOGERROR, "{} - can't find decoder", __FUNCTION__); >+@@ -149,17 +149,26 @@ >+ stream->m_context->time_base.den = DVD_TIME_BASE; >+ } >+ >+- if (stream->m_parser_split && stream->m_parser->parser->split) >++ if (stream->m_parser_split && stream->m_parser && stream->m_parser->parser) >+ { >+- int len = stream->m_parser->parser->split(stream->m_context, pkt->pData, pkt->iSize); >+- if (len > 0 && len < FF_MAX_EXTRADATA_SIZE) >++ AVPacket* avpkt = av_packet_alloc(); >++ if (!avpkt) >+ { >++ CLog::LogF(LOGERROR, "av_packet_alloc failed: {}", strerror(errno)); >++ return false; >++ } >++ >++ avpkt->data = pkt->pData; >++ avpkt->size = pkt->iSize; >++ avpkt->dts = avpkt->pts = AV_NOPTS_VALUE; >++ >++ auto [retExtraData, len] = GetPacketExtradata(avpkt, stream->m_parser, stream->m_context); >++ if (len > 0) >++ { >+ st->changes++; >+ st->disabled = false; >+ st->ExtraSize = len; >+- st->ExtraData = std::make_unique<uint8_t[]>(len + AV_INPUT_BUFFER_PADDING_SIZE); >+- memcpy(st->ExtraData.get(), pkt->pData, len); >+- memset(st->ExtraData.get() + len, 0, AV_INPUT_BUFFER_PADDING_SIZE); >++ st->ExtraData = std::unique_ptr<uint8_t[]>(retExtraData); >+ stream->m_parser_split = false; >+ change = true; >+ CLog::Log(LOGDEBUG, "CDVDDemuxClient::ParsePacket - split extradata"); >+@@ -167,21 +176,12 @@ >+ // Allow ffmpeg to transport codec information to stream->m_context >+ if (!avcodec_open2(stream->m_context, stream->m_context->codec, nullptr)) >+ { >+- AVPacket* avpkt = av_packet_alloc(); >+- if (!avpkt) >+- { >+- CLog::Log(LOGERROR, "CDVDDemuxClient::{} - av_packet_alloc failed: {}", __FUNCTION__, >+- strerror(errno)); >+- return false; >+- } >+- avpkt->data = pkt->pData; >+- avpkt->size = pkt->iSize; >+- avpkt->dts = avpkt->pts = AV_NOPTS_VALUE; >+ avcodec_send_packet(stream->m_context, avpkt); >+ avcodec_close(stream->m_context); >+- av_packet_free(&avpkt); >+ } >+ } >++ >++ av_packet_free(&avpkt); >+ } >+ >+ uint8_t *outbuf = nullptr; >+@@ -219,10 +219,12 @@ >+ case STREAM_AUDIO: >+ { >+ CDemuxStreamClientInternalTpl<CDemuxStreamAudio>* sta = static_cast<CDemuxStreamClientInternalTpl<CDemuxStreamAudio>*>(st); >+- if (stream->m_context->channels != sta->iChannels && stream->m_context->channels != 0) >++ int streamChannels = stream->m_context->ch_layout.nb_channels; >++ if (streamChannels != sta->iChannels && streamChannels != 0) >+ { >+- CLog::Log(LOGDEBUG, "CDVDDemuxClient::ParsePacket - ({}) channels changed from {} to {}", st->uniqueId, sta->iChannels, stream->m_context->channels); >+- sta->iChannels = stream->m_context->channels; >++ CLog::Log(LOGDEBUG, "CDVDDemuxClient::ParsePacket - ({}) channels changed from {} to {}", >++ st->uniqueId, sta->iChannels, streamChannels); >++ sta->iChannels = streamChannels; >+ sta->changes++; >+ sta->disabled = false; >+ } >+@@ -234,7 +236,7 @@ >+ sta->changes++; >+ sta->disabled = false; >+ } >+- if (stream->m_context->channels) >++ if (streamChannels) >+ st->changes = -1; // stop parsing >+ break; >+ } >+diff -urN xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp.orig xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp >+--- xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp.orig 2023-03-11 22:16:38.000000000 +0000 >++++ xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp 2023-03-16 21:56:53.267762000 +0000 >+@@ -34,10 +34,12 @@ >+ >+ #include <mutex> >+ #include <sstream> >++#include <tuple> >+ #include <utility> >+ >+ extern "C" >+ { >++#include "libavutil/channel_layout.h" >+ #include "libavutil/pixdesc.h" >+ } >+ >+@@ -104,8 +106,6 @@ >+ } >+ } // namespace >+ >+-#define FF_MAX_EXTRADATA_SIZE ((1 << 28) - AV_INPUT_BUFFER_PADDING_SIZE) >+- >+ std::string CDemuxStreamAudioFFmpeg::GetStreamName() >+ { >+ if (!m_stream) >+@@ -235,7 +235,7 @@ >+ >+ bool CDVDDemuxFFmpeg::Open(const std::shared_ptr<CDVDInputStream>& pInput, bool fileinfo) >+ { >+- AVInputFormat* iformat = NULL; >++ const AVInputFormat* iformat = nullptr; >+ std::string strFile; >+ m_streaminfo = !pInput->IsRealtime() && !m_reopen; >+ m_reopen = false; >+@@ -323,7 +323,6 @@ >+ } >+ if (result < 0) >+ { >+- m_pFormatContext->flags |= AVFMT_FLAG_PRIV_OPT; >+ if (avformat_open_input(&m_pFormatContext, strFile.c_str(), iformat, &options) < 0) >+ { >+ CLog::Log(LOGDEBUG, "Error, could not open file {}", CURL::GetRedacted(strFile)); >+@@ -335,7 +334,6 @@ >+ avformat_close_input(&m_pFormatContext); >+ m_pFormatContext = avformat_alloc_context(); >+ m_pFormatContext->interrupt_callback = int_cb; >+- m_pFormatContext->flags &= ~AVFMT_FLAG_PRIV_OPT; >+ AVDictionary* options = GetFFMpegOptionsFromInput(); >+ av_dict_set_int(&options, "load_all_variants", 0, AV_OPT_SEARCH_CHILDREN); >+ if (avformat_open_input(&m_pFormatContext, strFile.c_str(), iformat, &options) < 0) >+@@ -422,9 +420,7 @@ >+ // is present, we assume it is PCM audio. >+ // AC3 is always wrapped in iec61937 (ffmpeg "spdif"), while DTS >+ // may be just padded. >+- AVInputFormat* iformat2; >+- iformat2 = av_find_input_format("spdif"); >+- >++ const AVInputFormat* iformat2 = av_find_input_format("spdif"); >+ if (iformat2 && iformat2->read_probe(&pd) > AVPROBE_SCORE_MAX / 4) >+ { >+ iformat = iformat2; >+@@ -544,12 +540,6 @@ >+ m_streaminfo = true; >+ } >+ >+- if (iformat && (strcmp(iformat->name, "mov,mp4,m4a,3gp,3g2,mj2") == 0)) >+- { >+- if (URIUtils::IsRemote(strFile)) >+- m_pFormatContext->iformat->flags |= AVFMT_NOGENSEARCH; >+- } >+- >+ // we need to know if this is matroska, avi or sup later >+ m_bMatroska = strncmp(m_pFormatContext->iformat->name, "matroska", 8) == 0; // for "matroska.webm" >+ m_bAVI = strcmp(m_pFormatContext->iformat->name, "avi") == 0; >+@@ -604,9 +594,6 @@ >+ // if format can be nonblocking, let's use that >+ m_pFormatContext->flags |= AVFMT_FLAG_NONBLOCK; >+ >+- // deprecated, will be always set in future versions >+- m_pFormatContext->flags |= AVFMT_FLAG_KEEP_SIDE_DATA; >+- >+ UpdateCurrentPTS(); >+ >+ // select the correct program if requested >+@@ -647,7 +634,10 @@ >+ { >+ int idx = m_pFormatContext->programs[i]->stream_index[j]; >+ AVStream* st = m_pFormatContext->streams[idx]; >+- if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && st->codec_info_nb_frames > 0) || >++ // Related to https://patchwork.ffmpeg.org/project/ffmpeg/patch/20210429143825.53040-1-jamrial@gmail.com/ >++ // has been replaced with AVSTREAM_EVENT_FLAG_NEW_PACKETS. >++ if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && >++ (st->event_flags & AVSTREAM_EVENT_FLAG_NEW_PACKETS)) || >+ (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && st->codecpar->sample_rate > 0)) >+ { >+ nProgram = i; >+@@ -1218,8 +1208,11 @@ >+ else if (stream->type == STREAM_AUDIO) >+ { >+ CDemuxStreamAudioFFmpeg* audiostream = dynamic_cast<CDemuxStreamAudioFFmpeg*>(stream); >+- if (audiostream && (audiostream->iChannels != m_pFormatContext->streams[pPacket->iStreamId]->codecpar->channels || >+- audiostream->iSampleRate != m_pFormatContext->streams[pPacket->iStreamId]->codecpar->sample_rate)) >++ int codecparChannels = >++ m_pFormatContext->streams[pPacket->iStreamId]->codecpar->ch_layout.nb_channels; >++ if (audiostream && (audiostream->iChannels != codecparChannels || >++ audiostream->iSampleRate != >++ m_pFormatContext->streams[pPacket->iStreamId]->codecpar->sample_rate)) >+ { >+ // content has changed >+ stream = AddStream(pPacket->iStreamId); >+@@ -1401,9 +1394,10 @@ >+ if (idx >= 0) >+ { >+ AVStream* stream = m_pFormatContext->streams[idx]; >+- if (stream && stream->cur_dts != (int64_t)AV_NOPTS_VALUE) >++ >++ if (stream && m_pkt.pkt.dts != (int64_t)AV_NOPTS_VALUE) >+ { >+- double ts = ConvertTimestamp(stream->cur_dts, stream->time_base.den, stream->time_base.num); >++ double ts = ConvertTimestamp(m_pkt.pkt.dts, stream->time_base.den, stream->time_base.num); >+ m_currentPts = ts; >+ } >+ } >+@@ -1614,14 +1608,20 @@ >+ { >+ CDemuxStreamAudioFFmpeg* st = new CDemuxStreamAudioFFmpeg(pStream); >+ stream = st; >+- st->iChannels = pStream->codecpar->channels; >++ int codecparChannels = pStream->codecpar->ch_layout.nb_channels; >++ int codecparChannelLayout = pStream->codecpar->ch_layout.u.mask; >++ st->iChannels = codecparChannels; >++ st->iChannelLayout = codecparChannelLayout; >+ st->iSampleRate = pStream->codecpar->sample_rate; >+ st->iBlockAlign = pStream->codecpar->block_align; >+ st->iBitRate = static_cast<int>(pStream->codecpar->bit_rate); >+ st->iBitsPerSample = pStream->codecpar->bits_per_raw_sample; >+- st->iChannelLayout = pStream->codecpar->channel_layout; >+ char buf[32] = {}; >+- av_get_channel_layout_string(buf, 31, st->iChannels, st->iChannelLayout); >++ // https://github.com/FFmpeg/FFmpeg/blob/6ccc3989d15/doc/APIchanges#L50-L53 >++ AVChannelLayout layout = {}; >++ av_channel_layout_from_mask(&layout, st->iChannelLayout); >++ av_channel_layout_describe(&layout, buf, sizeof(buf)); >++ av_channel_layout_uninit(&layout); >+ st->m_channelLayoutName = buf; >+ if (st->iBitsPerSample == 0) >+ st->iBitsPerSample = pStream->codecpar->bits_per_coded_sample; >+@@ -1663,16 +1663,6 @@ >+ st->iFpsScale = 0; >+ } >+ >+- if (pStream->codec_info_nb_frames > 0 && >+- pStream->codec_info_nb_frames <= 2 && >+- m_pInput->IsStreamType(DVDSTREAM_TYPE_DVD)) >+- { >+- CLog::Log(LOGDEBUG, "{} - fps may be unreliable since ffmpeg decoded only {} frame(s)", >+- __FUNCTION__, pStream->codec_info_nb_frames); >+- st->iFpsRate = 0; >+- st->iFpsScale = 0; >+- } >+- >+ st->iWidth = pStream->codecpar->width; >+ st->iHeight = pStream->codecpar->height; >+ st->fAspect = SelectAspect(pStream, st->bForcedAspect); >+@@ -1693,7 +1683,8 @@ >+ st->colorRange = pStream->codecpar->color_range; >+ st->hdr_type = DetermineHdrType(pStream); >+ >+- int size = 0; >++ // https://github.com/FFmpeg/FFmpeg/blob/release/5.0/doc/APIchanges >++ size_t size = 0; >+ uint8_t* side_data = nullptr; >+ >+ side_data = av_stream_get_side_data(pStream, AV_PKT_DATA_MASTERING_DISPLAY_METADATA, &size); >+@@ -2103,7 +2094,7 @@ >+ return strName; >+ } >+ >+- AVCodec* codec = avcodec_find_decoder(stream->codec); >++ const AVCodec* codec = avcodec_find_decoder(stream->codec); >+ if (codec) >+ strName = avcodec_get_name(codec->id); >+ } >+@@ -2158,8 +2149,8 @@ >+ if (m_pFormatContext->streams[idx]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) >+ { >+ CDemuxStreamAudioFFmpeg* audiostream = dynamic_cast<CDemuxStreamAudioFFmpeg*>(stream); >+- if (audiostream && >+- m_pFormatContext->streams[idx]->codecpar->channels != audiostream->iChannels) >++ int codecparChannels = m_pFormatContext->streams[idx]->codecpar->ch_layout.nb_channels; >++ if (audiostream && codecparChannels != audiostream->iChannels) >+ { >+ return true; >+ } >+@@ -2279,7 +2270,7 @@ >+ >+ parser->second->m_parserCtx = av_parser_init(st->codecpar->codec_id); >+ >+- AVCodec* codec = avcodec_find_decoder(st->codecpar->codec_id); >++ const AVCodec* codec = avcodec_find_decoder(st->codecpar->codec_id); >+ if (codec == nullptr) >+ { >+ CLog::Log(LOGERROR, "{} - can't find decoder", __FUNCTION__); >+@@ -2295,45 +2286,37 @@ >+ >+ if (parser->second->m_parserCtx && >+ parser->second->m_parserCtx->parser && >+- parser->second->m_parserCtx->parser->split && >+ !st->codecpar->extradata) >+ { >+- int i = parser->second->m_parserCtx->parser->split(parser->second->m_codecCtx, pkt->data, pkt->size); >+- if (i > 0 && i < FF_MAX_EXTRADATA_SIZE) >++ auto [retExtraData, i] = >++ GetPacketExtradata(pkt, parser->second->m_parserCtx, parser->second->m_codecCtx); >++ if (i > 0) >+ { >+- st->codecpar->extradata = (uint8_t*)av_malloc(i + AV_INPUT_BUFFER_PADDING_SIZE); >+- if (st->codecpar->extradata) >++ st->codecpar->extradata_size = i; >++ st->codecpar->extradata = retExtraData; >++ >++ if (parser->second->m_parserCtx->parser->parser_parse) >+ { >+- CLog::Log(LOGDEBUG, >+- "CDVDDemuxFFmpeg::ParsePacket() fetching extradata, extradata_size({})", i); >+- st->codecpar->extradata_size = i; >+- memcpy(st->codecpar->extradata, pkt->data, i); >+- memset(st->codecpar->extradata + i, 0, AV_INPUT_BUFFER_PADDING_SIZE); >++ parser->second->m_codecCtx->extradata = st->codecpar->extradata; >++ parser->second->m_codecCtx->extradata_size = st->codecpar->extradata_size; >++ const uint8_t* outbufptr; >++ int bufSize; >++ parser->second->m_parserCtx->flags |= PARSER_FLAG_COMPLETE_FRAMES; >++ parser->second->m_parserCtx->parser->parser_parse(parser->second->m_parserCtx, >++ parser->second->m_codecCtx, &outbufptr, >++ &bufSize, pkt->data, pkt->size); >++ parser->second->m_codecCtx->extradata = nullptr; >++ parser->second->m_codecCtx->extradata_size = 0; >+ >+- if (parser->second->m_parserCtx->parser->parser_parse) >++ if (parser->second->m_parserCtx->width != 0) >+ { >+- parser->second->m_codecCtx->extradata = st->codecpar->extradata; >+- parser->second->m_codecCtx->extradata_size = st->codecpar->extradata_size; >+- const uint8_t* outbufptr; >+- int bufSize; >+- parser->second->m_parserCtx->flags |= PARSER_FLAG_COMPLETE_FRAMES; >+- parser->second->m_parserCtx->parser->parser_parse(parser->second->m_parserCtx, >+- parser->second->m_codecCtx, >+- &outbufptr, &bufSize, >+- pkt->data, pkt->size); >+- parser->second->m_codecCtx->extradata = nullptr; >+- parser->second->m_codecCtx->extradata_size = 0; >+- >+- if (parser->second->m_parserCtx->width != 0) >+- { >+- st->codecpar->width = parser->second->m_parserCtx->width; >+- st->codecpar->height = parser->second->m_parserCtx->height; >+- } >+- else >+- { >+- CLog::Log(LOGERROR, "CDVDDemuxFFmpeg::ParsePacket() invalid width/height"); >+- } >++ st->codecpar->width = parser->second->m_parserCtx->width; >++ st->codecpar->height = parser->second->m_parserCtx->height; >+ } >++ else >++ { >++ CLog::Log(LOGERROR, "CDVDDemuxFFmpeg::ParsePacket() invalid width/height"); >++ } >+ } >+ } >+ } >+@@ -2357,7 +2340,8 @@ >+ { >+ if (!m_startTime) >+ { >+- m_startTime = av_rescale(st->cur_dts, st->time_base.num, st->time_base.den) - 0.000001; >++ m_startTime = >++ av_rescale(m_pkt.pkt.dts, st->time_base.num, st->time_base.den) - 0.000001; >+ m_seekStream = idx; >+ } >+ return TRANSPORT_STREAM_STATE::READY; >+@@ -2377,7 +2361,8 @@ >+ { >+ if (!m_startTime) >+ { >+- m_startTime = av_rescale(st->cur_dts, st->time_base.num, st->time_base.den) - 0.000001; >++ m_startTime = >++ av_rescale(m_pkt.pkt.dts, st->time_base.num, st->time_base.den) - 0.000001; >+ m_seekStream = i; >+ } >+ return TRANSPORT_STREAM_STATE::READY; >+@@ -2410,7 +2395,8 @@ >+ { >+ if (!m_startTime) >+ { >+- m_startTime = av_rescale(st->cur_dts, st->time_base.num, st->time_base.den) - 0.000001; >++ m_startTime = >++ av_rescale(m_pkt.pkt.dts, st->time_base.num, st->time_base.den) - 0.000001; >+ m_seekStream = idx; >+ } >+ return TRANSPORT_STREAM_STATE::READY; >+@@ -2430,7 +2416,8 @@ >+ { >+ if (!m_startTime) >+ { >+- m_startTime = av_rescale(st->cur_dts, st->time_base.num, st->time_base.den) - 0.000001; >++ m_startTime = >++ av_rescale(m_pkt.pkt.dts, st->time_base.num, st->time_base.den) - 0.000001; >+ m_seekStream = i; >+ } >+ return TRANSPORT_STREAM_STATE::READY; >+diff -urN xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamAddon.cpp.orig xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamAddon.cpp >+--- xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamAddon.cpp.orig 2023-03-11 22:16:38.000000000 +0000 >++++ xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamAddon.cpp 2023-03-16 21:56:20.715583000 +0000 >+@@ -12,6 +12,7 @@ >+ #include "addons/addoninfo/AddonType.h" >+ #include "addons/binary-addons/AddonDll.h" >+ #include "addons/kodi-dev-kit/include/kodi/addon-instance/VideoCodec.h" >++#include "cores/FFmpeg.h" >+ #include "cores/VideoPlayer/DVDDemuxers/DVDDemux.h" >+ #include "cores/VideoPlayer/DVDDemuxers/DVDDemuxUtils.h" >+ #include "cores/VideoPlayer/Interface/DemuxCrypto.h" >+@@ -392,7 +393,7 @@ >+ return nullptr; >+ >+ std::string codecName(stream->m_codecName); >+- AVCodec* codec = nullptr; >++ const AVCodec* codec = nullptr; >+ >+ if (stream->m_streamType != INPUTSTREAM_TYPE_TELETEXT && >+ stream->m_streamType != INPUTSTREAM_TYPE_RDS && stream->m_streamType != INPUTSTREAM_TYPE_ID3) >+diff -urN xbmc/filesystem/AudioBookFileDirectory.cpp.orig xbmc/filesystem/AudioBookFileDirectory.cpp >+--- xbmc/filesystem/AudioBookFileDirectory.cpp.orig 2023-03-11 22:16:38.000000000 +0000 >++++ xbmc/filesystem/AudioBookFileDirectory.cpp 2023-03-16 21:56:20.715726000 +0000 >+@@ -11,6 +11,7 @@ >+ #include "TextureDatabase.h" >+ #include "URL.h" >+ #include "Util.h" >++#include "cores/FFmpeg.h" >+ #include "filesystem/File.h" >+ #include "guilib/LocalizeStrings.h" >+ #include "music/tags/MusicInfoTag.h" >+@@ -149,7 +150,7 @@ >+ >+ m_ioctx->max_packet_size = 32768; >+ >+- AVInputFormat* iformat=nullptr; >++ const AVInputFormat* iformat = nullptr; >+ av_probe_input_buffer(m_ioctx, &iformat, url.Get().c_str(), nullptr, 0, 0); >+ >+ bool contains = false; >+diff -urN xbmc/guilib/FFmpegImage.cpp.orig xbmc/guilib/FFmpegImage.cpp >+--- xbmc/guilib/FFmpegImage.cpp.orig 2023-03-11 22:16:38.000000000 +0000 >++++ xbmc/guilib/FFmpegImage.cpp 2023-03-16 21:56:53.271294000 +0000 >+@@ -52,7 +52,7 @@ >+ AVFrame* frame_temporary = nullptr; >+ SwsContext* sws = nullptr; >+ AVCodecContext* avOutctx = nullptr; >+- AVCodec* codec = nullptr; >++ const AVCodec* codec = nullptr; >+ ~ThumbDataManagement() >+ { >+ av_free(intermediateBuffer); >+@@ -198,7 +198,7 @@ >+ bool is_png = (bufSize > 3 && buffer[1] == 'P' && buffer[2] == 'N' && buffer[3] == 'G'); >+ bool is_tiff = (bufSize > 2 && buffer[0] == 'I' && buffer[1] == 'I' && buffer[2] == '*'); >+ >+- AVInputFormat* inp = nullptr; >++ const AVInputFormat* inp = nullptr; >+ if (is_jpeg) >+ inp = av_find_input_format("image2"); >+ else if (m_strMimeType == "image/apng") >+@@ -236,7 +236,7 @@ >+ return false; >+ } >+ AVCodecParameters* codec_params = m_fctx->streams[0]->codecpar; >+- AVCodec* codec = avcodec_find_decoder(codec_params->codec_id); >++ const AVCodec* codec = avcodec_find_decoder(codec_params->codec_id); >+ m_codec_ctx = avcodec_alloc_context3(codec); >+ if (!m_codec_ctx) >+ { >+@@ -294,7 +294,8 @@ >+ return nullptr; >+ } >+ //we need milliseconds >+- frame->pkt_duration = av_rescale_q(frame->pkt_duration, m_fctx->streams[0]->time_base, AVRational{ 1, 1000 }); >++ frame->duration = >++ av_rescale_q(frame->duration, m_fctx->streams[0]->time_base, AVRational{1, 1000}); >+ m_height = frame->height; >+ m_width = frame->width; >+ m_originalWidth = m_width; >+@@ -745,7 +746,7 @@ >+ if (avframe == nullptr) >+ return nullptr; >+ std::shared_ptr<Frame> frame(new Frame()); >+- frame->m_delay = (unsigned int)avframe->pkt_duration; >++ frame->m_delay = (unsigned int)avframe->duration; >+ frame->m_pitch = avframe->width * 4; >+ frame->m_pImage = (unsigned char*) av_malloc(avframe->height * frame->m_pitch); >+ DecodeFrame(avframe, avframe->width, avframe->height, frame->m_pitch, frame->m_pImage); >+diff -urN xbmc/music/tags/MusicInfoTagLoaderFFmpeg.cpp.orig xbmc/music/tags/MusicInfoTagLoaderFFmpeg.cpp >+--- xbmc/music/tags/MusicInfoTagLoaderFFmpeg.cpp.orig 2023-03-11 22:16:38.000000000 +0000 >++++ xbmc/music/tags/MusicInfoTagLoaderFFmpeg.cpp 2023-03-16 21:56:20.716138000 +0000 >+@@ -58,7 +58,7 @@ >+ if (file.IoControl(IOCTRL_SEEK_POSSIBLE, NULL) != 1) >+ ioctx->seekable = 0; >+ >+- AVInputFormat* iformat=NULL; >++ const AVInputFormat* iformat = nullptr; >+ av_probe_input_buffer(ioctx, &iformat, strFileName.c_str(), NULL, 0, 0); >+ >+ if (avformat_open_input(&fctx, strFileName.c_str(), iformat, NULL) < 0) >+diff -urN xbmc/video/tags/VideoTagLoaderFFmpeg.cpp.orig xbmc/video/tags/VideoTagLoaderFFmpeg.cpp >+--- xbmc/video/tags/VideoTagLoaderFFmpeg.cpp.orig 2023-03-11 22:16:38.000000000 +0000 >++++ xbmc/video/tags/VideoTagLoaderFFmpeg.cpp 2023-03-16 21:56:20.716302000 +0000 >+@@ -65,7 +65,7 @@ >+ if (m_file->IoControl(IOCTRL_SEEK_POSSIBLE, nullptr) != 1) >+ m_ioctx->seekable = 0; >+ >+- AVInputFormat* iformat = nullptr; >++ const AVInputFormat* iformat = nullptr; >+ av_probe_input_buffer(m_ioctx, &iformat, m_item.GetPath().c_str(), nullptr, 0, 0); >+ if (avformat_open_input(&m_fctx, m_item.GetPath().c_str(), iformat, nullptr) < 0) >+ { >diff --git a/multimedia/libxine/Makefile b/multimedia/libxine/Makefile >index e532126cb596..a38dad5418a9 100644 >--- a/multimedia/libxine/Makefile >+++ b/multimedia/libxine/Makefile >@@ -1,10 +1,9 @@ > PORTNAME= xine >-DISTVERSION= 1.2.12 >-PORTREVISION= 5 >+DISTVERSION= 1.2.13 > CATEGORIES= multimedia >-MASTER_SITES= SF/${PORTNAME}/${PORTNAME}-lib/${PORTVERSION} >+MASTER_SITES= SF/${PORTNAME}/${PORTNAME}-lib/${DISTVERSION} > PKGNAMEPREFIX= lib >-DISTNAME= ${PORTNAME}-lib-${PORTVERSION} >+DISTNAME= ${PORTNAME}-lib-${DISTVERSION} > > MAINTAINER= ports@FreeBSD.org > COMMENT= Libraries for xine multimedia player >@@ -50,7 +49,8 @@ USE_LDCONFIG= yes > CONFIGURE_ARGS= --with-libflac \ > --enable-musepack \ > --enable-real-codecs \ >- --without-esound >+ --without-esound \ >+ --disable-crypto > > MAKE_ENV= V=1 > MAKE_ARGS= pkgdatadir="${DATADIR}" \ >@@ -62,7 +62,7 @@ CFLAGS_i386= -fomit-frame-pointer > DOCSDIR= ${PREFIX}/share/doc/xine-lib > # Please sync with XINE_PLUGINSDIR in multimedia/xine > # and multimedia/vdr-plugin-xineliboutput >-PLUGINSDIR= lib/xine/plugins/2.10 >+PLUGINSDIR= lib/xine/plugins/2.11 > PLIST_SUB= PLUGINSDIR="${PLUGINSDIR}" > > OPTIONS_DEFINE= AALIB ALSA AOM CACA DAV1D DOCS DMX_IMAGE DVB \ >diff --git a/multimedia/libxine/distinfo b/multimedia/libxine/distinfo >index a072dcd0da74..15caf696f97f 100644 >--- a/multimedia/libxine/distinfo >+++ b/multimedia/libxine/distinfo >@@ -1,3 +1,3 @@ >-TIMESTAMP = 1646930905 >-SHA256 (xine-lib-1.2.12.tar.xz) = d606270468e1540c2a89c0d7f5fdf11e17ecc0c2698cc0bcb1065ff26abee098 >-SIZE (xine-lib-1.2.12.tar.xz) = 5341212 >+TIMESTAMP = 1679084820 >+SHA256 (xine-lib-1.2.13.tar.xz) = 5f10d6d718a4a51c17ed1b32b031d4f9b80b061e8276535b2be31e5ac4b75e6f >+SIZE (xine-lib-1.2.13.tar.xz) = 5004196 >diff --git a/multimedia/libxine/files/patch-dav1d-1.0 b/multimedia/libxine/files/patch-dav1d-1.0 >deleted file mode 100644 >index e18689712281..000000000000 >--- a/multimedia/libxine/files/patch-dav1d-1.0 >+++ /dev/null >@@ -1,47 +0,0 @@ >-https://sourceforge.net/p/xine/tickets/11/ >- >-dav1d.c:547:12: error: no member named 'n_frame_threads' in 'struct Dav1dSettings' >- settings.n_frame_threads = (ncpu > 8) ? 4 : (ncpu < 2) ? 1 : ncpu/2; >- ~~~~~~~~ ^ >-dav1d.c:548:12: error: no member named 'n_tile_threads' in 'struct Dav1dSettings' >- settings.n_tile_threads = MAX(1, ncpu - settings.n_frame_threads + 1); >- ~~~~~~~~ ^ >-dav1d.c:548:52: error: no member named 'n_frame_threads' in 'struct Dav1dSettings' >- settings.n_tile_threads = MAX(1, ncpu - settings.n_frame_threads + 1); >- ~~~~~~~~ ^ >-dav1d.c:548:52: error: no member named 'n_frame_threads' in 'struct Dav1dSettings' >- settings.n_tile_threads = MAX(1, ncpu - settings.n_frame_threads + 1); >- ~~~~~~~~ ^ >-/usr/include/sys/param.h:306:34: note: expanded from macro 'MAX' >-#define MAX(a,b) (((a)>(b))?(a):(b)) >- ^ >-dav1d.c:551:22: error: no member named 'n_frame_threads' in 'struct Dav1dSettings' >- settings.n_frame_threads, settings.n_tile_threads); >- ~~~~~~~~ ^ >-dav1d.c:551:48: error: no member named 'n_tile_threads' in 'struct Dav1dSettings' >- settings.n_frame_threads, settings.n_tile_threads); >- ~~~~~~~~ ^ >-../../include/xine/xineutils.h:687:40: note: expanded from macro 'xprintf' >- xine_log(xine, XINE_LOG_TRACE, __VA_ARGS__); \ >- ^~~~~~~~~~~ >- >---- src/video_dec/dav1d.c.orig 2022-03-06 16:31:24 UTC >-+++ src/video_dec/dav1d.c >-@@ -544,11 +544,17 @@ static video_decoder_t *_open_plugin(video_decoder_cla >- >- /* multithreading */ >- ncpu = xine_cpu_count(); >-+#if DAV1D_API_VERSION_MAJOR > 5 >-+ settings.n_threads = ncpu + 1; >-+ xprintf(stream->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": " >-+ "Using %d threads\n", settings.n_threads); >-+#else >- settings.n_frame_threads = (ncpu > 8) ? 4 : (ncpu < 2) ? 1 : ncpu/2; >- settings.n_tile_threads = MAX(1, ncpu - settings.n_frame_threads + 1); >- xprintf(stream->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": " >- "Using %d frame threads, %d tile threads\n", >- settings.n_frame_threads, settings.n_tile_threads); >-+#endif >- >- /* dri frame allocator */ >- settings.allocator.cookie = this; >diff --git a/multimedia/libxine/files/patch-include-xine-xineutils.h b/multimedia/libxine/files/patch-include-xine-xineutils.h >deleted file mode 100644 >index 93609a722522..000000000000 >--- a/multimedia/libxine/files/patch-include-xine-xineutils.h >+++ /dev/null >@@ -1,22 +0,0 @@ >-Unbreak build of phonon-xine >- >-In file included from xine/plugins.c:23: >-In file included from /usr/local/include/xine/input_plugin.h:27: >-/usr/local/include/xine/xineutils.h:197:8: error: unknown type name 'inline' >-static inline void _x_freep(void *ptr) { >- ^ >-/usr/local/include/xine/xineutils.h:197:15: error: expected identifier or '(' >-static inline void _x_freep(void *ptr) { >- ^ >- >---- include/xine/xineutils.h.orig >-+++ include/xine/xineutils.h >-@@ -146,7 +146,7 @@ void *xine_xcalloc(size_t nmemb, size_t >- * Free allocated memory and set pointer to NULL >- * @param ptr Pointer to the pointer to the memory block which should be freed. >- */ >--static inline void _x_freep(void *ptr) { >-+static void _x_freep(void *ptr) { >- void **p = (void **)ptr; >- free (*p); >- *p = NULL; >diff --git a/multimedia/libxine/files/patch-src_combined_ffmpeg_demux__avformat.c b/multimedia/libxine/files/patch-src_combined_ffmpeg_demux__avformat.c >new file mode 100644 >index 000000000000..954c65f363e8 >--- /dev/null >+++ b/multimedia/libxine/files/patch-src_combined_ffmpeg_demux__avformat.c >@@ -0,0 +1,35 @@ >+--- src/combined/ffmpeg/demux_avformat.c.orig 2022-09-08 21:43:29 UTC >++++ src/combined/ffmpeg/demux_avformat.c >+@@ -1,5 +1,5 @@ >+ /* >+- * Copyright (C) 2013-2022 the xine project >++ * Copyright (C) 2013-2023 the xine project >+ * Copyright (C) 2013-2020 Petri Hintukainen <phintuka@users.sourceforge.net> >+ * >+ * This file is part of xine, a free video player. >+@@ -423,8 +423,13 @@ static int find_avformat_streams(avformat_demux_plugin >+ } >+ >+ #ifdef XFF_CODECPAR >++# if XFF_AUDIO_CHANNEL_LAYOUT < 2 >+ if (st->codecpar && st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && >+ st->codecpar->sample_rate != 0 && st->codecpar->channels != 0) >++# else >++ if (st->codecpar && st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && >++ st->codecpar->sample_rate != 0 && st->codecpar->ch_layout.nb_channels != 0) >++# endif >+ #else >+ if (st->codec && st->codec->codec_type == AVMEDIA_TYPE_AUDIO && >+ st->codec->sample_rate != 0 && st->codec->channels != 0) >+@@ -501,7 +506,11 @@ static void send_headers_audio(avformat_demux_plugin_t >+ buf->size = extradata_size + sizeof(xine_waveformatex); >+ buf->decoder_info[1] = ctx->sample_rate; >+ buf->decoder_info[2] = ctx->bits_per_coded_sample; >++#if XFF_AUDIO_CHANNEL_LAYOUT < 2 >+ buf->decoder_info[3] = ctx->channels; >++#else >++ buf->decoder_info[3] = ctx->ch_layout.nb_channels; >++#endif >+ buf->decoder_flags = BUF_FLAG_HEADER | BUF_FLAG_STDHEADER | BUF_FLAG_FRAME_END; >+ >+ this->stream->audio_fifo->put (this->stream->audio_fifo, buf); >diff --git a/multimedia/libxine/files/patch-src_combined_ffmpeg_ff__audio__decoder.c b/multimedia/libxine/files/patch-src_combined_ffmpeg_ff__audio__decoder.c >new file mode 100644 >index 000000000000..2108a84e9540 >--- /dev/null >+++ b/multimedia/libxine/files/patch-src_combined_ffmpeg_ff__audio__decoder.c >@@ -0,0 +1,152 @@ >+--- src/combined/ffmpeg/ff_audio_decoder.c.orig 2022-09-08 21:43:29 UTC >++++ src/combined/ffmpeg/ff_audio_decoder.c >+@@ -1,5 +1,5 @@ >+ /* >+- * Copyright (C) 2001-2022 the xine project >++ * Copyright (C) 2001-2023 the xine project >+ * >+ * This file is part of xine, a free video player. >+ * >+@@ -303,7 +303,11 @@ static void ff_audio_init_codec(ff_audio_decoder_t *th >+ >+ this->context->bits_per_sample = this->ff_bits; >+ this->context->sample_rate = this->ff_sample_rate; >++#if XFF_AUDIO_CHANNEL_LAYOUT < 2 >+ this->context->channels = this->ff_channels; >++#else >++ this->context->ch_layout.nb_channels = this->ff_channels; >++#endif >+ this->context->codec_id = this->codec->id; >+ this->context->codec_type = this->codec->type; >+ this->context->codec_tag = _x_stream_info_get(this->stream, XINE_STREAM_INFO_AUDIO_FOURCC); >+@@ -527,17 +531,76 @@ static void ff_audio_output_close(ff_audio_decoder_t * >+ this->ao_mode = 0; >+ } >+ >++static unsigned int ff_list_channels (uint8_t *list, uint64_t map) { >++ unsigned int n, bit; >++ >++ for (n = bit = 0; map; map >>= 1, bit++) { >++ uint32_t b = map & 1; >++ >++ list[n] = bit; >++ n += b; >++ } >++ return n; >++} >++ >+ static void ff_map_channels (ff_audio_decoder_t *this) { >+ uint64_t ff_map; >++ uint8_t ff_list[64]; >++ unsigned int ff_num; >++ const char *type = "native"; >+ int caps = this->stream->audio_out->get_capabilities (this->stream->audio_out); >+ >++#if XFF_AUDIO_CHANNEL_LAYOUT < 2 >++ >+ /* safety kludge for very old libavcodec */ >+-#ifdef AV_CH_FRONT_LEFT >++# ifdef AV_CH_FRONT_LEFT >+ ff_map = this->context->channel_layout; >+ if (!ff_map) /* wma2 bug */ >+-#endif >++# endif >+ ff_map = ((uint64_t)1 << this->context->channels) - 1; >++ ff_num = ff_list_channels (ff_list, ff_map); >+ >++#else /* XFF_AUDIO_CHANNEL_LAYOUT == 2 */ >++ >++ ff_num = this->context->ch_layout.nb_channels; >++ if (ff_num > (int)(sizeof (ff_list) / sizeof (ff_list[0]))) >++ ff_num = sizeof (ff_list) / sizeof (ff_list[0]); >++ switch (this->context->ch_layout.order) { >++ const AVChannelCustom *cmap; >++ unsigned int i; >++ >++ case AV_CHANNEL_ORDER_UNSPEC: >++ type = "unknown"; >++ goto _fallback; >++ >++ case AV_CHANNEL_ORDER_NATIVE: >++ ff_map = this->context->ch_layout.u.mask; >++ if (!ff_map) /* wma2 bug */ >++ ff_map = ((uint64_t)1 << ff_num) - 1; >++ ff_num = ff_list_channels (ff_list, ff_map); >++ break; >++ >++ case AV_CHANNEL_ORDER_CUSTOM: >++ type = "custom"; >++ if (!(cmap = this->context->ch_layout.u.map)) >++ goto _fallback; >++ ff_map = 0; >++ for (i = 0; i < ff_num; i++) { >++ ff_list[i] = cmap[i].id; >++ ff_map |= (uint64_t)1 << ff_list[i]; >++ } >++ break; >++ >++ default: >++ type = "unsupported"; >++ /* fall through */ >++ _fallback: >++ ff_map = ((uint64_t)1 << ff_num) - 1; >++ ff_num = ff_list_channels (ff_list, ff_map); >++ } >++ >++#endif >++ >+ if ((caps != this->ao_caps) || (ff_map != this->ff_map)) { >+ unsigned int i, j; >+ /* ff: see names[] below; xine: L R RL RR C LFE */ >+@@ -562,7 +625,7 @@ static void ff_map_channels (ff_audio_decoder_t *this) >+ >+ this->ao_caps = caps; >+ this->ff_map = ff_map; >+- this->ff_channels = this->context->channels; >++ this->ff_channels = ff_num; >+ >+ /* silence out */ >+ for (i = 0; i < MAX_CHANNELS; i++) >+@@ -576,20 +639,23 @@ static void ff_map_channels (ff_audio_decoder_t *this) >+ this->left[0] = this->right[0] = 0; >+ tries = wishlist + 0 * num_modes; >+ } else if (this->ff_channels == 2) { /* stereo */ >++ /* FIXME: libxine does not yet support audio selection _after_ decoding. >++ * For now, treat the most common "dual mono" case as stereo. */ >+ name_map[0] = 0; >+ name_map[1] = 1; >+ this->left[0] = 0; >+ this->right[0] = 1; >+ tries = wishlist + 1 * num_modes; >+ } else { >+- for (i = j = 0; i < sizeof (base_map) / sizeof (base_map[0]); i++) { >+- if ((ff_map >> i) & 1) { >+- int8_t target = base_map[i]; >+- if ((target >= 0) && (this->map[target] < 0)) >+- this->map[target] = j; >+- name_map[j] = i; /* for debug output below */ >+- j++; >+- } >++ for (i = 0; i < ff_num; i++) { >++ int8_t target; >++ uint32_t num = ff_list[i]; >++ if (num >= sizeof (base_map) / sizeof (base_map[0])) >++ continue; >++ target = base_map[num]; >++ if ((target >= 0) && (this->map[target] < 0)) >++ this->map[target] = i; >++ name_map[i] = num; /* for debug output below */ >+ } >+ this->left[0] = this->map[0] < 0 ? 0 : this->map[0]; >+ this->map[0] = -1; >+@@ -641,8 +707,8 @@ static void ff_map_channels (ff_audio_decoder_t *this) >+ "rear center", >+ "side left", "side right" >+ }; >+- int8_t buf[200]; >+- int p = sprintf (buf, "ff_audio_dec: channel layout: "); >++ int8_t buf[256]; >++ int p = sprintf (buf, "ff_audio_dec: %s channel layout: ", type); >+ int8_t *indx = this->left; >+ for (i = 0; i < 2; i++) { >+ buf[p++] = '['; >diff --git a/multimedia/libxine/pkg-plist b/multimedia/libxine/pkg-plist >index ef0cd825e3f3..f38f9f3d9003 100644 >--- a/multimedia/libxine/pkg-plist >+++ b/multimedia/libxine/pkg-plist >@@ -49,7 +49,7 @@ lib/libxine.la > lib/libxine-interface.la > lib/libxine.so > lib/libxine.so.2 >-lib/libxine.so.2.10.0 >+lib/libxine.so.2.11.0 > %%PLUGINSDIR%%/mime.types > %%PLUGINSDIR%%/post/xineplug_post_audio_filters.so > %%PLUGINSDIR%%/post/xineplug_post_goom.so >diff --git a/multimedia/vdr-plugin-xineliboutput/Makefile b/multimedia/vdr-plugin-xineliboutput/Makefile >index 160712827b7e..46d46675c442 100644 >--- a/multimedia/vdr-plugin-xineliboutput/Makefile >+++ b/multimedia/vdr-plugin-xineliboutput/Makefile >@@ -30,7 +30,7 @@ CONFIGURE_ARGS= --add-cflags=-I${VDRDIR} \ > PATCH_STRIP= -p1 > > WRKSRC= ${WRKDIR}/vdr-${PLUGIN} >-XINE_PLUGINSDIR= lib/xine/plugins/2.10 >+XINE_PLUGINSDIR= lib/xine/plugins/2.11 > > PLIST_SUB= XINE_PLUGINSDIR=${XINE_PLUGINSDIR} > PORTDOCS= HISTORY README >diff --git a/multimedia/vlc/Makefile b/multimedia/vlc/Makefile >index 54138b27e3c4..479e1aba18ed 100644 >--- a/multimedia/vlc/Makefile >+++ b/multimedia/vlc/Makefile >@@ -85,6 +85,7 @@ OPTIONS_DEFAULT=ASS AVAHI DAV1D DBUS DVDREAD DVDNAV GNUTLS HARFBUZZ JPEG \ > OPTIONS_DEFAULT_powerpc= ALTIVEC > OPTIONS_DEFAULT_powerpc64= ALTIVEC > OPTIONS_EXCLUDE=LIBPLACEBO # https://code.videolan.org/videolan/vlc/-/commit/8e22c39ea3c3 >+OPTIONS_EXCLUDE+= VAAPI # Not compatible until VLC 4 > OPTIONS_SUB= yes > > AOM_DESC= AV1 video encoding/decoding via libaom >diff --git a/multimedia/xine/Makefile b/multimedia/xine/Makefile >index b26f874899a7..b11932b1ce31 100644 >--- a/multimedia/xine/Makefile >+++ b/multimedia/xine/Makefile >@@ -1,6 +1,6 @@ > PORTNAME= xine > PORTVERSION= 0.99.14 >-PORTREVISION= 1 >+PORTREVISION= 2 > CATEGORIES= multimedia > MASTER_SITES= SF/${PORTNAME}/${PORTNAME}-ui/${PORTVERSION} > DISTNAME= ${PORTNAME}-ui-${PORTVERSION} >@@ -48,7 +48,7 @@ NLS_CONFIGURE_ENABLE= nls > XFT_USE= XORG=xft > XFT_CONFIGURE_ENABLE= xft > >-XINE_PLUGINSDIR= lib/xine/plugins/2.10 >+XINE_PLUGINSDIR= lib/xine/plugins/2.11 > > post-patch: > @${REINPLACE_CMD} -e \ >diff --git a/www/qt5-webengine/files/patch-add-support-for-ffmpeg5-and-later b/www/qt5-webengine/files/patch-add-support-for-ffmpeg5-and-later >new file mode 100644 >index 000000000000..de6185aba53d >--- /dev/null >+++ b/www/qt5-webengine/files/patch-add-support-for-ffmpeg5-and-later >@@ -0,0 +1,140 @@ >+Adds support for FFmpeg and later >+ >+Obtained from: >+ >+https://github.com/archlinux/svntogit-packages/blob/packages/qt5-webengine/trunk/qt5-webengine-ffmpeg5.patch >+ >+--- src/3rdparty/chromium/media/ffmpeg/ffmpeg_common.h.orig 2021-12-15 16:12:54 UTC >++++ src/3rdparty/chromium/media/ffmpeg/ffmpeg_common.h >+@@ -29,6 +29,7 @@ extern "C" { >+ #include <libavformat/avformat.h> >+ #include <libavformat/avio.h> >+ #include <libavutil/avutil.h> >++#include <libavutil/channel_layout.h> >+ #include <libavutil/imgutils.h> >+ #include <libavutil/log.h> >+ #include <libavutil/mastering_display_metadata.h> >+--- src/3rdparty/chromium/media/filters/audio_file_reader.cc.orig 2021-12-15 16:12:54 UTC >++++ src/3rdparty/chromium/media/filters/audio_file_reader.cc >+@@ -85,7 +85,7 @@ bool AudioFileReader::OpenDecoder() { >+ } >+ >+ bool AudioFileReader::OpenDecoder() { >+- AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id); >++ const AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id); >+ if (codec) { >+ // MP3 decodes to S16P which we don't support, tell it to use S16 instead. >+ if (codec_context_->sample_fmt == AV_SAMPLE_FMT_S16P) >+--- src/3rdparty/chromium/media/filters/ffmpeg_audio_decoder.cc.orig 2021-12-15 16:12:54 UTC >++++ src/3rdparty/chromium/media/filters/ffmpeg_audio_decoder.cc >+@@ -329,7 +329,7 @@ bool FFmpegAudioDecoder::ConfigureDecoder(const AudioD >+ } >+ } >+ >+- AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id); >++ const AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id); >+ if (!codec || >+ avcodec_open2(codec_context_.get(), codec, &codec_options) < 0) { >+ DLOG(ERROR) << "Could not initialize audio decoder: " >+--- src/3rdparty/chromium/media/filters/ffmpeg_demuxer.cc.orig 2021-12-15 16:12:54 UTC >++++ src/3rdparty/chromium/media/filters/ffmpeg_demuxer.cc >+@@ -98,12 +98,12 @@ static base::TimeDelta ExtractStartTime(AVStream* stre >+ >+ // Next try to use the first DTS value, for codecs where we know PTS == DTS >+ // (excludes all H26x codecs). The start time must be returned in PTS. >+- if (stream->first_dts != kNoFFmpegTimestamp && >++ if (av_stream_get_first_dts(stream) != kNoFFmpegTimestamp && >+ stream->codecpar->codec_id != AV_CODEC_ID_HEVC && >+ stream->codecpar->codec_id != AV_CODEC_ID_H264 && >+ stream->codecpar->codec_id != AV_CODEC_ID_MPEG4) { >+ const base::TimeDelta first_pts = >+- ConvertFromTimeBase(stream->time_base, stream->first_dts); >++ ConvertFromTimeBase(stream->time_base, av_stream_get_first_dts(stream)); >+ if (first_pts < start_time) >+ start_time = first_pts; >+ } >+@@ -408,11 +408,11 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket >+ scoped_refptr<DecoderBuffer> buffer; >+ >+ if (type() == DemuxerStream::TEXT) { >+- int id_size = 0; >++ size_t id_size = 0; >+ uint8_t* id_data = av_packet_get_side_data( >+ packet.get(), AV_PKT_DATA_WEBVTT_IDENTIFIER, &id_size); >+ >+- int settings_size = 0; >++ size_t settings_size = 0; >+ uint8_t* settings_data = av_packet_get_side_data( >+ packet.get(), AV_PKT_DATA_WEBVTT_SETTINGS, &settings_size); >+ >+@@ -424,7 +424,7 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket >+ buffer = DecoderBuffer::CopyFrom(packet->data, packet->size, >+ side_data.data(), side_data.size()); >+ } else { >+- int side_data_size = 0; >++ size_t side_data_size = 0; >+ uint8_t* side_data = av_packet_get_side_data( >+ packet.get(), AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL, &side_data_size); >+ >+@@ -485,7 +485,7 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket >+ packet->size - data_offset); >+ } >+ >+- int skip_samples_size = 0; >++ size_t skip_samples_size = 0; >+ const uint32_t* skip_samples_ptr = >+ reinterpret_cast<const uint32_t*>(av_packet_get_side_data( >+ packet.get(), AV_PKT_DATA_SKIP_SAMPLES, &skip_samples_size)); >+--- src/3rdparty/chromium/media/filters/ffmpeg_glue.cc.orig 2021-12-15 16:12:54 UTC >++++ src/3rdparty/chromium/media/filters/ffmpeg_glue.cc >+@@ -59,7 +59,6 @@ void FFmpegGlue::InitializeFFmpeg() { >+ } >+ >+ void FFmpegGlue::InitializeFFmpeg() { >+- av_register_all(); >+ } >+ >+ static void LogContainer(bool is_local_file, >+@@ -94,9 +93,6 @@ FFmpegGlue::FFmpegGlue(FFmpegURLProtocol* protocol) { >+ >+ // Enable fast, but inaccurate seeks for MP3. >+ format_context_->flags |= AVFMT_FLAG_FAST_SEEK; >+- >+- // Ensures we can read out various metadata bits like vp8 alpha. >+- format_context_->flags |= AVFMT_FLAG_KEEP_SIDE_DATA; >+ >+ // Ensures format parsing errors will bail out. From an audit on 11/2017, all >+ // instances were real failures. Solves bugs like http://crbug.com/710791. >+--- src/3rdparty/chromium/media/filters/ffmpeg_video_decoder.cc.orig 2021-12-15 16:12:54 UTC >++++ src/3rdparty/chromium/media/filters/ffmpeg_video_decoder.cc >+@@ -391,7 +391,7 @@ bool FFmpegVideoDecoder::ConfigureDecoder(const VideoD >+ if (decode_nalus_) >+ codec_context_->flags2 |= AV_CODEC_FLAG2_CHUNKS; >+ >+- AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id); >++ const AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id); >+ if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { >+ ReleaseFFmpegResources(); >+ return false; >+--- src/3rdparty/chromium/media/filters/media_file_checker.cc.orig 2021-12-15 16:12:54 UTC >++++ src/3rdparty/chromium/media/filters/media_file_checker.cc >+@@ -68,7 +68,7 @@ bool MediaFileChecker::Start(base::TimeDelta check_tim >+ auto context = AVStreamToAVCodecContext(format_context->streams[i]); >+ if (!context) >+ continue; >+- AVCodec* codec = avcodec_find_decoder(cp->codec_id); >++ const AVCodec* codec = avcodec_find_decoder(cp->codec_id); >+ if (codec && avcodec_open2(context.get(), codec, nullptr) >= 0) { >+ auto loop = std::make_unique<FFmpegDecodingLoop>(context.get()); >+ stream_contexts[i] = {std::move(context), std::move(loop)}; >+--- src/3rdparty/chromium/third_party/webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.cc.orig 2021-12-15 16:12:54 UTC >++++ src/3rdparty/chromium/third_party/webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.cc >+@@ -203,7 +203,7 @@ int32_t H264DecoderImpl::InitDecode(const VideoCodec* >+ // a pointer |this|. >+ av_context_->opaque = this; >+ >+- AVCodec* codec = avcodec_find_decoder(av_context_->codec_id); >++ const AVCodec* codec = avcodec_find_decoder(av_context_->codec_id); >+ if (!codec) { >+ // This is an indication that FFmpeg has not been initialized or it has not >+ // been compiled/initialized with the correct set of codecs. >-- >2.40.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 261302
:
231123
|
232276
|
232765
|
233207
|
233428
|
234023
|
235680
|
235729
|
235731
|
235805
|
236550
|
237100
|
237192
|
237463
|
239307
|
239460
|
239461
|
239469
|
240656
|
240658
|
241448
| 241531 |
241793