Gentoo Archives: gentoo-commits

From: Mart Raudsepp <leio@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-plugins/gst-plugins-libav/files/, media-plugins/gst-plugins-libav/
Date: Sat, 30 Mar 2019 14:23:55
Message-Id: 1553955803.336f5a5340f9244062adede3bd2e901b98ee6c3a.leio@gentoo
1 commit: 336f5a5340f9244062adede3bd2e901b98ee6c3a
2 Author: Mart Raudsepp <leio <AT> gentoo <DOT> org>
3 AuthorDate: Sat Mar 30 14:16:13 2019 +0000
4 Commit: Mart Raudsepp <leio <AT> gentoo <DOT> org>
5 CommitDate: Sat Mar 30 14:23:23 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=336f5a53
7
8 media-plugins/gst-plugins-libav: bump bundled ffmpeg for USE=libav, timestamp fixes
9
10 Closes: https://bugs.gentoo.org/681710
11 Package-Manager: Portage-2.3.52, Repoman-2.3.12
12 Signed-off-by: Mart Raudsepp <leio <AT> gentoo.org>
13
14 media-plugins/gst-plugins-libav/Manifest | 1 +
15 .../gst-plugins-libav/files/fix-negative-pts.patch | 40 ++++++++
16 ...gst-plugins-libav-1.14.4.4.1.2_p20190329.ebuild | 104 +++++++++++++++++++++
17 3 files changed, 145 insertions(+)
18
19 diff --git a/media-plugins/gst-plugins-libav/Manifest b/media-plugins/gst-plugins-libav/Manifest
20 index 4b36e56d740..818ea1de684 100644
21 --- a/media-plugins/gst-plugins-libav/Manifest
22 +++ b/media-plugins/gst-plugins-libav/Manifest
23 @@ -1,4 +1,5 @@
24 DIST ffmpeg-3.4.5.tar.bz2 10183082 BLAKE2B f72157baefcd6a0ca8f389309bbe947ad21996e0f2eb3c46c6bfc90f1ebbb14bfd007d001e46ea51efef5db5f9fcee24b1a90b6862136aeebecdc95bb61b23a5 SHA512 e12707d47404a9ce02790b77d2852fc1a1573c8108e980c7355fa48ba891d1649464d4fe4d08394ecd6d871f651ac4388486b7654cb54a7aaeedaf05c55513ec
25 DIST ffmpeg-4.1.1.tar.bz2 10686360 BLAKE2B 47f4716d7e184d7318eb1a99ab1cdc188009464e973162e583f7ca4ae79fa3b103f9d5329c8993b72d20667e42e5a749123709a4640f07762568300b5c3c897f SHA512 0241c44e1dffd0d890a3d30a1b2387ea167d578bb39ba0c804fb417e132d343a9e43da9247b205e18b893d8cf75d8528e9971569be67ac380b88618ef0a75ed4
26 +DIST ffmpeg-4.1.2.tar.bz2 10687366 BLAKE2B c69cc693078f40610c4414f01ed20f89a85db398b3177d8d79a6f58f2d48b6a8049a2bc622933e0ae0a2889f635c25ccf1c5856cb86a4d98bb0bc2308188ae86 SHA512 6c3bf20d46772a80299c9d385919a745e4022c0a9b3c438c0504d3c94bb8d472f2c9026105330fa7c50c2f23f511eb853f32e4387f73c0b7b0d0761c20cb8b31
27 DIST gst-libav-1.14.4-ffmpeg4-patchset.tar.xz 49428 BLAKE2B 74c3e0b25643bcfdf01d1d16514401fef4bb988ba3d1f306b647ba0cd6e89f0205cc33e6d144889d6b2f7fab9e4fae946e03821a85009fa95c68f3cedf25068a SHA512 1347424ed342f00c25ac4780670611a24eeaf708426b6efc6d9f6c6fa7bf91ef292302a5363afe9523c497265b8c0d7ad81374364cbecb2924b749e716819745
28 DIST gst-libav-1.14.4.tar.xz 9036732 BLAKE2B 1c2e257912f61dac71e1d890f4cb650e0cdbbf4472cbd8dc6b73e471d1914409b71699bd198c154069e15e68364530e91f76619afb52b91e373e58c9237ab7cb SHA512 4a0e9a91c23cba82e6a6b8eb65ff42b9d80389dd232b08c22b3431d3942fb93a6a7e64be97083d11cbceb2abe5d45dc5b37d230f7552e1a7fb193610d0530717
29
30 diff --git a/media-plugins/gst-plugins-libav/files/fix-negative-pts.patch b/media-plugins/gst-plugins-libav/files/fix-negative-pts.patch
31 new file mode 100644
32 index 00000000000..d5be422e781
33 --- /dev/null
34 +++ b/media-plugins/gst-plugins-libav/files/fix-negative-pts.patch
35 @@ -0,0 +1,40 @@
36 +From 1d293764e55fb9c3901c9dfa903fa5ae0021ab10 Mon Sep 17 00:00:00 2001
37 +From: Guillaume Desmottes <guillaume.desmottes@×××××××××.com>
38 +Date: Thu, 21 Feb 2019 08:48:31 +0100
39 +Subject: [PATCH] avdemux: fix negative pts if start_time is bigger than the ts
40 +
41 +The start time is supposed to be the ts of the first frame.
42 +FFmpeg uses fractions to represent timestamps and the start time may use a
43 +different base than the frame pts. So we may end up having the start
44 +time bigger than the pts because of rounding when converting to gst ts.
45 +
46 +See https://gitlab.freedesktop.org/gstreamer/gst-libav/issues/51
47 +for details.
48 +---
49 + ext/libav/gstavdemux.c | 10 ++++++++--
50 + 1 file changed, 8 insertions(+), 2 deletions(-)
51 +
52 +diff --git a/ext/libav/gstavdemux.c b/ext/libav/gstavdemux.c
53 +index 30e0360..3b74f92 100644
54 +--- a/ext/libav/gstavdemux.c
55 ++++ b/ext/libav/gstavdemux.c
56 +@@ -1473,8 +1473,14 @@ gst_ffmpegdemux_loop (GstFFMpegDemux * demux)
57 + goto drop;
58 + #endif
59 +
60 +- if (GST_CLOCK_TIME_IS_VALID (timestamp))
61 +- timestamp -= demux->start_time;
62 ++ if (GST_CLOCK_TIME_IS_VALID (timestamp)) {
63 ++ /* start_time should be the ts of the first frame but it may actually be
64 ++ * higher because of rounding when converting to gst ts. */
65 ++ if (demux->start_time >= timestamp)
66 ++ timestamp = 0;
67 ++ else
68 ++ timestamp -= demux->start_time;
69 ++ }
70 +
71 + /* check if we ran outside of the segment */
72 + if (demux->segment.stop != -1 && timestamp > demux->segment.stop)
73 +--
74 +2.17.0
75 +
76
77 diff --git a/media-plugins/gst-plugins-libav/gst-plugins-libav-1.14.4.4.1.2_p20190329.ebuild b/media-plugins/gst-plugins-libav/gst-plugins-libav-1.14.4.4.1.2_p20190329.ebuild
78 new file mode 100644
79 index 00000000000..e9c44dd1b7b
80 --- /dev/null
81 +++ b/media-plugins/gst-plugins-libav/gst-plugins-libav-1.14.4.4.1.2_p20190329.ebuild
82 @@ -0,0 +1,104 @@
83 +# Copyright 1999-2019 Gentoo Authors
84 +# Distributed under the terms of the GNU General Public License v2
85 +
86 +EAPI=6
87 +
88 +inherit autotools eapi7-ver multilib-minimal
89 +
90 +MY_PN="gst-libav"
91 +MY_PV="$(ver_cut 1-3)"
92 +MY_P="${MY_PN}-${MY_PV}"
93 +FFMPEG_PV="$(ver_cut 4- ${PV%_*})"
94 +
95 +DESCRIPTION="FFmpeg based gstreamer plugin"
96 +HOMEPAGE="https://gstreamer.freedesktop.org/modules/gst-libav.html"
97 +SRC_URI="https://gstreamer.freedesktop.org/src/${MY_PN}/${MY_P}.tar.xz
98 + https://dev.gentoo.org/~leio/distfiles/${MY_P}-ffmpeg4-patchset.tar.xz
99 + libav? ( https://ffmpeg.org/releases/ffmpeg-${FFMPEG_PV}.tar.bz2 )"
100 +
101 +LICENSE="LGPL-2+"
102 +SLOT="1.0"
103 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~x86 ~x86-fbsd"
104 +IUSE="libav +orc"
105 +
106 +RDEPEND="
107 + >=dev-libs/glib-2.40.0:2[${MULTILIB_USEDEP}]
108 + >=media-libs/gstreamer-${MY_PV}:1.0[${MULTILIB_USEDEP}]
109 + >=media-libs/gst-plugins-base-${MY_PV}:1.0[${MULTILIB_USEDEP}]
110 + !libav? ( >=media-video/ffmpeg-4:0=[${MULTILIB_USEDEP}] )
111 + libav? (
112 + app-arch/bzip2[${MULTILIB_USEDEP}]
113 + app-arch/xz-utils[${MULTILIB_USEDEP}]
114 + )
115 + orc? ( >=dev-lang/orc-0.4.17[${MULTILIB_USEDEP}] )
116 +"
117 +DEPEND="${RDEPEND}
118 + >=dev-util/gtk-doc-am-1.12
119 + >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]
120 +"
121 +
122 +S="${WORKDIR}/${MY_P}"
123 +
124 +PATCHES=(
125 + "${WORKDIR}"/patches # ffmpeg-4 compat and more from git up to 20181115; requires eautoreconf
126 + "${FILESDIR}"/AVOptionsRanges-leak-fix.patch # extra patch from Jan 2019 for a leak fix
127 + "${FILESDIR}"/fix-negative-pts.patch # extra patch from Feb 2019 to fix negative pts if start_time is bigger than the ts
128 + "${FILESDIR}"/external-ffmpeg4-dep.patch # Automatically rescan available elements for registry when system ffmpeg changes
129 +)
130 +
131 +RESTRICT="test" # FIXME: tests seem to get stuck at one point; investigate properly
132 +
133 +src_unpack() {
134 + default
135 +
136 + if use libav; then
137 + # Use newer version of bundled FFmpeg.
138 + rm -r "${S}/gst-libs/ext/libav" || die
139 + ln -s ../../../ffmpeg-${FFMPEG_PV} "${S}/gst-libs/ext/libav" || die
140 + fi
141 +}
142 +
143 +src_prepare() {
144 + default
145 + eautoreconf # remove with a proper release without build system touching patchset
146 +}
147 +
148 +multilib_src_configure() {
149 + GST_PLUGINS_BUILD=""
150 + # Upstream dropped support for system libav and won't work
151 + # for preserving its compat anymore, forcing us to rely on internal
152 + # ffmpeg copy if we don't want to cause unresolvable blockers for
153 + # libav setups.
154 + # https://bugzilla.gnome.org/show_bug.cgi?id=758183
155 + # Prefer system ffmpeg for -libav
156 + local myconf=()
157 +
158 + if use libav; then
159 + ewarn "Using bundled ffmpeg copy as upstream dropped"
160 + ewarn "the support for compiling against system libav"
161 + ewarn "https://bugzilla.gnome.org/show_bug.cgi?id=758183"
162 +
163 + myconf+=(--with-libav-extra-configure="--disable-debug --optflags=\\\"${CFLAGS}\\\"")
164 + else
165 + myconf+=("--with-system-libav")
166 + fi
167 +
168 + ECONF_SOURCE=${S} \
169 + econf \
170 + --disable-maintainer-mode \
171 + --with-package-name="Gentoo GStreamer ebuild" \
172 + --with-package-origin="https://www.gentoo.org" \
173 + --disable-fatal-warnings \
174 + $(use_enable orc) \
175 + "${myconf[@]}"
176 +}
177 +
178 +multilib_src_compile() {
179 + # Don't build with -Werror; verbose build
180 + emake ERROR_CFLAGS= V=1
181 +}
182 +
183 +multilib_src_install_all() {
184 + einstalldocs
185 + find "${ED}" -name '*.la' -delete || die
186 +}