commit 488834fc62ba18e5bf7b9befef854b8fef6fe55b
Author: Dominik 'Rathann' Mierzejewski <dominik(a)greysector.net>
Date: Tue Oct 8 16:49:04 2024 +0200
bump FFmpeg requirement to 7.0
- sync patches from Debian
- fix DVD subtitle PTS handling
HandBrake-no-contribs.patch | 55 ++++-----
HandBrake-save-pts-of-incomplete-subtitle.patch | 57 ++++++++++
HandBrake-syslibs-link.patch | 144 ++++++++++++++++++++----
HandBrake.spec | 24 ++--
4 files changed, 214 insertions(+), 66 deletions(-)
---
diff --git a/HandBrake-no-contribs.patch b/HandBrake-no-contribs.patch
index f07952b..fb2712b 100644
--- a/HandBrake-no-contribs.patch
+++ b/HandBrake-no-contribs.patch
@@ -1,6 +1,15 @@
-diff -up HandBrake-1.8.0/gtk/meson.build.orig HandBrake-1.8.0/gtk/meson.build
---- HandBrake-1.8.0/gtk/meson.build.orig 2024-06-08 23:25:36.847621713 +0200
-+++ HandBrake-1.8.0/gtk/meson.build 2024-06-09 10:47:41.354428601 +0200
+From: Sebastian Ramacher <sramacher(a)debian.org>
+Date: Fri, 1 Dec 2023 23:22:16 +0100
+Subject: Do not use contribs
+
+---
+ gtk/meson.build | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/gtk/meson.build b/gtk/meson.build
+index 96ba523..6b82ced 100644
+--- a/gtk/meson.build
++++ b/gtk/meson.build
@@ -20,7 +20,7 @@ if hb_dir == ''
hb_dir = meson.current_build_dir() / '..'
endif
@@ -10,37 +19,11 @@ diff -up HandBrake-1.8.0/gtk/meson.build.orig
HandBrake-1.8.0/gtk/meson.build
# External dependencies (required)
ghb_deps = [
-diff -up HandBrake-1.8.0/libhb/module.defs.orig HandBrake-1.8.0/libhb/module.defs
---- HandBrake-1.8.0/libhb/module.defs.orig 2024-05-19 16:06:45.000000000 +0200
-+++ HandBrake-1.8.0/libhb/module.defs 2024-06-09 10:51:03.886266133 +0200
-@@ -1,7 +1,7 @@
- __deps__ := BZIP2 LIBVPX SVT-AV1 FFMPEG FREETYPE LAME LIBASS \
- LIBDVDREAD LIBDVDNAV LIBICONV LIBTHEORA LIBVORBIS LIBOGG \
- X264 X265 ZLIB LIBBLURAY FDKAAC LIBVPL LIBGNURX JANSSON \
-- HARFBUZZ LIBOPUS LIBSPEEX LIBDAV1D LIBJPEGTURBO LIBDOVI
-+ HARFBUZZ LIBOPUS LIBSPEEX LIBJPEGTURBO LIBDOVI
+@@ -51,6 +51,7 @@ ghb_deps = [
+ dependency('vorbis'),
+ dependency('vorbisenc'),
+ dependency('x264'),
++ dependency('zlib'),
+ ]
- ifeq (,$(filter $(HOST.system),darwin cygwin mingw))
- __deps__ += FONTCONFIG
-@@ -118,7 +118,7 @@ LIBHB.lib = $(LIBHB.build/)hb.lib
- LIBHB.dll.libs = $(foreach n, \
- ass avformat avfilter avcodec avutil swresample dvdnav dvdread \
- freetype mp3lame swscale vpx theora vorbis vorbisenc ogg x264 \
-- bluray jansson harfbuzz opus speex dav1d turbojpeg zimg SvtAv1Enc, \
-+ bluray jansson harfbuzz opus speex turbojpeg SvtAv1Enc, \
- $(CONTRIB.build/)lib/lib$(n).a )
-
- ifeq (1,$(FEATURE.fdk_aac))
-diff -up HandBrake-1.8.0/make/include/main.defs.orig
HandBrake-1.8.0/make/include/main.defs
---- HandBrake-1.8.0/make/include/main.defs.orig 2024-05-19 16:06:45.000000000 +0200
-+++ HandBrake-1.8.0/make/include/main.defs 2024-06-09 10:50:34.026098608 +0200
-@@ -48,9 +48,7 @@ ifeq (1,$(FEATURE.x265))
- MODULES += contrib/x265_12bit
- endif
-
--MODULES += contrib/libdav1d
- MODULES += contrib/svt-av1
--MODULES += contrib/zimg
- MODULES += contrib/ffmpeg
- MODULES += contrib/libdvdread
- MODULES += contrib/libdvdnav
+ if get_option('libdovi').enabled()
diff --git a/HandBrake-save-pts-of-incomplete-subtitle.patch
b/HandBrake-save-pts-of-incomplete-subtitle.patch
new file mode 100644
index 0000000..94e7d7d
--- /dev/null
+++ b/HandBrake-save-pts-of-incomplete-subtitle.patch
@@ -0,0 +1,57 @@
+diff -up HandBrake-1.8.2/libhb/decavsub.c.orig HandBrake-1.8.2/libhb/decavsub.c
+--- HandBrake-1.8.2/libhb/decavsub.c.orig 2024-08-07 19:31:52.000000000 +0200
++++ HandBrake-1.8.2/libhb/decavsub.c 2024-09-02 12:01:18.949484625 +0200
+@@ -29,6 +29,12 @@ struct hb_avsub_context_s
+ // while this should really get fixed elsewhere,
+ // dropping subtitles should be avoided as much as possible
+ int64_t last_pts;
++ // large subtitles (dvd sub, image based for example) can be split
++ // across several packets. avcodec_decode_subtitle2 can return the
++ // pts in a non complete packet (got_sub_ptr == 0). In that case
++ // save the pts and reuse it once all packets were processed and
++ // the subtitle is complete
++ int64_t unused_pts;
+ // For PGS subs, we need to pass 'empty' subtitles through (they clear the
+ // display) - when doing forced-only extraction, only pass empty subtitles
+ // through if we've seen a forced sub since the last empty sub
+@@ -50,6 +56,7 @@ hb_avsub_context_t * decavsubInit( hb_wo
+ }
+ ctx->seen_forced_sub = 0;
+ ctx->last_pts = AV_NOPTS_VALUE;
++ ctx->unused_pts = AV_NOPTS_VALUE;
+ ctx->job = job;
+ ctx->subtitle = w->subtitle;
+
+@@ -370,6 +377,11 @@ int decavsubWork( hb_avsub_context_t * c
+
+ if (!has_subtitle)
+ {
++ if (subtitle.pts != AV_NOPTS_VALUE)
++ {
++ ctx->unused_pts = av_rescale(subtitle.pts, 90000, AV_TIME_BASE) +
++ av_rescale(subtitle.start_display_time, 90000, 1000);
++ }
+ continue;
+ }
+
+@@ -446,7 +458,11 @@ int decavsubWork( hb_avsub_context_t * c
+ }
+ else
+ {
+- if (in_s.start >= 0)
++ if (ctx->unused_pts != AV_NOPTS_VALUE)
++ {
++ pts = ctx->unused_pts;
++ }
++ else if (in_s.start >= 0)
+ {
+ pts = in_s.start;
+ }
+@@ -485,6 +501,7 @@ int decavsubWork( hb_avsub_context_t * c
+ pts = ctx->last_pts + 1 * 90000LL;
+ }
+ ctx->last_pts = pts;
++ ctx->unused_pts = AV_NOPTS_VALUE;
+
+ if (ctx->subtitle->format == TEXTSUB)
+ {
diff --git a/HandBrake-syslibs-link.patch b/HandBrake-syslibs-link.patch
index cc36264..a3b83ca 100644
--- a/HandBrake-syslibs-link.patch
+++ b/HandBrake-syslibs-link.patch
@@ -1,30 +1,128 @@
-diff -up HandBrake-1.8.0/test/module.defs.orig HandBrake-1.8.0/test/module.defs
---- HandBrake-1.8.0/test/module.defs.orig 2024-05-19 16:06:45.000000000 +0200
-+++ HandBrake-1.8.0/test/module.defs 2024-06-09 12:44:44.012169393 +0200
-@@ -22,6 +22,14 @@ TEST.pkgconfig_libs = libass libavformat
+From: Christian Marillat <marillat(a)debian.org>
+Date: Tue, 17 Apr 2018 21:11:53 +0200
+Subject: Remove embedded/downloaded copies of various libraries
+
+Once this is acceptable, this should be forwarded upstream so that the
+use of system libraries is an option, instead of downloading libraries
+and programs at build time.
+---
+ gtk/meson.build | 2 ++
+ libhb/module.defs | 8 ++------
+ make/include/main.defs | 29 -----------------------------
+ test/module.defs | 6 ++++++
+ 4 files changed, 10 insertions(+), 35 deletions(-)
+
+diff --git a/gtk/meson.build b/gtk/meson.build
+index 83233ce..96ba523 100644
+--- a/gtk/meson.build
++++ b/gtk/meson.build
+@@ -63,6 +63,8 @@ endif
- TEST.pkgconfig_libs += $(foreach m,$(MODULES.NAMES),$($m.OSL.libs))
+ if get_option('qsv').enabled()
+ ghb_deps += dependency('vpl')
++ ghb_deps += dependency('libva')
++ ghb_deps += dependency('libva-drm')
+ endif
-+ifeq (1,$(FEATURE.qsv))
-+ TEST.pkgconfig_libs += libva libva-drm vpl
-+endif
-+
-+ifeq (1,$(FEATURE.x265))
-+ TEST.pkgconfig_libs += x265
-+endif
-+
- ifeq (1,$(FEATURE.flatpak))
- TEST.pkgconfig_libs += glib-2.0
+ if get_option('x265').enabled()
+diff --git a/libhb/module.defs b/libhb/module.defs
+index 177ddef..9362b40 100644
+--- a/libhb/module.defs
++++ b/libhb/module.defs
+@@ -1,7 +1,7 @@
+ __deps__ := BZIP2 LIBVPX SVT-AV1 FFMPEG FREETYPE LAME LIBASS \
+ LIBDVDREAD LIBDVDNAV LIBICONV LIBTHEORA LIBVORBIS LIBOGG \
+ X264 X265 ZLIB LIBBLURAY FDKAAC LIBVPL LIBGNURX JANSSON \
+- HARFBUZZ LIBOPUS LIBSPEEX LIBDAV1D LIBJPEGTURBO LIBDOVI
++ HARFBUZZ LIBOPUS LIBSPEEX LIBDOVI
+
+ ifeq (,$(filter $(HOST.system),darwin cygwin mingw))
+ __deps__ += FONTCONFIG
+@@ -118,7 +118,7 @@ LIBHB.lib = $(LIBHB.build/)hb.lib
+ LIBHB.dll.libs = $(foreach n, \
+ ass avformat avfilter avcodec avutil swresample dvdnav dvdread \
+ freetype mp3lame swscale vpx theora vorbis vorbisenc ogg x264 \
+- bluray jansson harfbuzz opus speex dav1d turbojpeg zimg SvtAv1Enc, \
++ bluray jansson harfbuzz opus speex SvtAv1Enc, \
+ $(CONTRIB.build/)lib/lib$(n).a )
+
+ ifeq (1,$(FEATURE.fdk_aac))
+@@ -130,10 +130,6 @@ LIBHB.GCC.D += ONEVPL_EXPERIMENTAL
+ LIBHB.dll.libs += $(CONTRIB.build/)lib/libvpl.a
+ endif
+
+-ifeq (1,$(FEATURE.x265))
+-LIBHB.dll.libs += $(CONTRIB.build/)lib/libx265.a
+-endif
+-
+ ifeq (1,$(FEATURE.libdovi))
+ LIBHB.dll.libs += $(CONTRIB.build/)lib/libdovi.a
endif
-diff -up HandBrake-1.8.0/gtk/meson.build.orig HandBrake-1.8.0/gtk/meson.build
---- HandBrake-1.8.0/gtk/meson.build.orig 2024-06-09 12:48:47.938685823 +0200
-+++ HandBrake-1.8.0/gtk/meson.build 2024-06-09 12:52:51.685218843 +0200
-@@ -58,6 +58,8 @@ if get_option('libdovi').enabled()
+diff --git a/make/include/main.defs b/make/include/main.defs
+index e073a22..5b53474 100644
+--- a/make/include/main.defs
++++ b/make/include/main.defs
+@@ -41,35 +41,10 @@ ifeq (1,$(FEATURE.fdk_aac))
+ MODULES += contrib/fdk-aac
endif
- if get_option('qsv').enabled()
-+ ghb_deps += dependency('libva')
-+ ghb_deps += dependency('libva-drm')
- ghb_deps += dependency('vpl')
+-ifeq (1,$(FEATURE.x265))
+- MODULES += contrib/x265
+- MODULES += contrib/x265_8bit
+- MODULES += contrib/x265_10bit
+- MODULES += contrib/x265_12bit
+-endif
+-
+-MODULES += contrib/libdav1d
+-MODULES += contrib/svt-av1
+-MODULES += contrib/zimg
+-MODULES += contrib/ffmpeg
+-MODULES += contrib/libdvdread
+-MODULES += contrib/libdvdnav
+-MODULES += contrib/libbluray
+-
+-ifeq (1,$(FEATURE.qsv))
+-ifeq (,$(filter $(HOST.system),freebsd))
+- MODULES += contrib/libvpl
+-endif
+-endif
+-
+ ifeq (1,$(FEATURE.vce))
+ MODULES += contrib/amf
+ endif
+
+-ifeq (1,$(FEATURE.nvenc))
+- MODULES += contrib/nvenc
+-endif
+-
+ ifeq (1,$(FEATURE.libdovi))
+ MODULES += contrib/libdovi
+ endif
+@@ -79,10 +54,6 @@ ifneq (,$(filter $(HOST.system),darwin))
+ MODULES += contrib/bin2c
+ endif
+
+-ifneq (,$(filter $(HOST.machine),arm64 aarch64))
+- MODULES += contrib/sse2neon
+-endif
+-
+ ifneq (,$(filter $(HOST.system),cygwin mingw))
+ ifneq ($(HAS.iconv),1)
+ MODULES += contrib/libiconv
+diff --git a/test/module.defs b/test/module.defs
+index 9f803c4..97ac6c0 100644
+--- a/test/module.defs
++++ b/test/module.defs
+@@ -25,6 +25,12 @@ TEST.pkgconfig_libs += $(foreach m,$(MODULES.NAMES),$($m.OSL.libs))
+ ifeq (1,$(FEATURE.flatpak))
+ TEST.pkgconfig_libs += glib-2.0
endif
++ifeq (1,$(FEATURE.x265))
++ TEST.pkgconfig_libs += x265
++endif
++ifeq (1,$(FEATURE.qsv))
++ TEST.pkgconfig_libs += libva libva-drm vpl
++endif
+
+ TEST.GCC.pkgconfig = $(shell $(TEST.PKGCONFIG.exe) --libs $(TEST.pkgconfig_libs))
diff --git a/HandBrake.spec b/HandBrake.spec
index 7b6ab5d..d598a7b 100644
--- a/HandBrake.spec
+++ b/HandBrake.spec
@@ -12,7 +12,7 @@
Name: HandBrake
Version: 1.8.2
-Release: 1%{!?tag:.%{date}git%{shortcommit}}%{?dist}
+Release: 2%{!?tag:.%{date}git%{shortcommit}}%{?dist}
Summary: An open-source multiplatform video transcoder
License: GPLv2+
URL:
https://handbrake.fr/
@@ -33,13 +33,16 @@ Patch1: %{name}-no-libva.patch
Patch2: %{name}-no-fdk_aac.patch
# Fix build on non-x86 (without nasm) and drop libtool requirement
Patch3: %{name}-no-libtool-nasm.patch
-# Fix linking with system libraries
-Patch4: %{name}-syslibs-link.patch
# Patches from Debian
-#
https://salsa.debian.org/multimedia-team/handbrake/-/raw/master/debian/pa...
-Patch5: %{name}-no-contribs.patch
+#
https://salsa.debian.org/multimedia-team/handbrake/-/raw/master/debian/pa...
+Patch4: %{name}-syslibs-link.patch
#
https://salsa.debian.org/multimedia-team/handbrake/-/raw/master/debian/pa...
-Patch6: %{name}-remove-ambient-viewing-support.patch
+Patch5: %{name}-remove-ambient-viewing-support.patch
+#
https://salsa.debian.org/multimedia-team/handbrake/-/raw/master/debian/pa...
+Patch6: %{name}-no-contribs.patch
+#
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1032972#25
+# Fix
https://github.com/HandBrake/HandBrake/issues/4029 with unpatched FFmpeg
+Patch7: %{name}-save-pts-of-incomplete-subtitle.patch
BuildRequires: cmake
BuildRequires: desktop-file-utils
@@ -47,7 +50,8 @@ BuildRequires: desktop-file-utils
BuildRequires: gnupg2
%endif
BuildRequires: libappstream-glib
-BuildRequires: ffmpeg-devel
+# Preview is broken with <7.0
https://github.com/HandBrake/HandBrake/issues/6178
+BuildRequires: ffmpeg-devel >= 7.0
# Should be >= 2.6:
BuildRequires: freetype-devel >= 2.4.11
# Should be >= 0.19.7:
@@ -125,6 +129,7 @@ gpgv2 --keyring %{S:2} %{S:1} %{S:0}
%patch -P4 -p1
%patch -P5 -p1
%patch -P6 -p1
+%patch -P7 -p1
# Use system libraries in place of bundled ones
for module in fdk-aac ffmpeg libdvdnav libdvdread libbluray %{?_with_vpl:libvpl} nvdec
nvenc svt-av1 x265; do
@@ -191,6 +196,11 @@ appstream-util validate-relax --nonet
%{buildroot}%{_metainfodir}/%{desktop_id}.
%{_bindir}/HandBrakeCLI
%changelog
+* Sun Sep 01 2024 Dominik 'Rathann' Mierzejewski <dominik(a)greysector.net> -
1.8.2-2
+- bump FFmpeg requirement to 7.0
+- sync patches from Debian
+- fix DVD subtitle PTS handling
+
* Sun Aug 18 2024 Dominik 'Rathann' Mierzejewski <dominik(a)greysector.net> -
1.8.2-1
- Update to 1.8.2