Gentoo Archives: gentoo-commits

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-libs/mlt/, media-libs/mlt/files/
Date: Sat, 24 Apr 2021 21:40:29
Message-Id: 1619300412.b71ef8102b95d349d8f57c8cf392483deac449c5.asturm@gentoo
1 commit: b71ef8102b95d349d8f57c8cf392483deac449c5
2 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
3 AuthorDate: Sat Apr 24 21:39:33 2021 +0000
4 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
5 CommitDate: Sat Apr 24 21:40:12 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b71ef810
7
8 media-libs/mlt: Fix ogg crash, set min media-libs/opencv to 4.5.1
9
10 Closes: https://bugs.gentoo.org/783030
11 Package-Manager: Portage-3.0.18, Repoman-3.0.3
12 Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
13
14 .../mlt-6.26.1-fix-crash-w-ogg-album-art.patch | 50 +++++
15 media-libs/mlt/mlt-6.26.1-r1.ebuild | 232 +++++++++++++++++++++
16 2 files changed, 282 insertions(+)
17
18 diff --git a/media-libs/mlt/files/mlt-6.26.1-fix-crash-w-ogg-album-art.patch b/media-libs/mlt/files/mlt-6.26.1-fix-crash-w-ogg-album-art.patch
19 new file mode 100644
20 index 00000000000..4ad7ff5de41
21 --- /dev/null
22 +++ b/media-libs/mlt/files/mlt-6.26.1-fix-crash-w-ogg-album-art.patch
23 @@ -0,0 +1,50 @@
24 +From 7063e88e09977282470c4f2f93e56e05f21b7c2b Mon Sep 17 00:00:00 2001
25 +From: Dan Dennedy <dan@×××××××.org>
26 +Date: Fri, 16 Apr 2021 11:15:37 -0700
27 +Subject: [PATCH] fix #704 by properly identifying cover art
28 +
29 +(cherry picked from commit 6b0829df726aa9a840b8b34e923e9faf17a3a5ca)
30 +---
31 + src/modules/avformat/producer_avformat.c | 15 ++++-----------
32 + 1 file changed, 4 insertions(+), 11 deletions(-)
33 +
34 +diff --git a/src/modules/avformat/producer_avformat.c b/src/modules/avformat/producer_avformat.c
35 +index 049452f9d..e079e6f70 100644
36 +--- a/src/modules/avformat/producer_avformat.c
37 ++++ b/src/modules/avformat/producer_avformat.c
38 +@@ -398,10 +398,7 @@ static mlt_properties find_default_streams( producer_avformat self )
39 + if ( first_video_index < 0 )
40 + first_video_index = i;
41 + // Only set the video stream if not album art
42 +- if (self->video_index < 0 &&
43 +- (codec_params->codec_id != AV_CODEC_ID_MJPEG ||
44 +- codec_context->time_base.num != 1 ||
45 +- codec_context->time_base.den != 90000)) {
46 ++ if (self->video_index < 0 && !(context->streams[i]->disposition & AV_DISPOSITION_ATTACHED_PIC)) {
47 + self->video_index = i;
48 + }
49 + mlt_properties_set( meta_media, key, "video" );
50 +@@ -1682,11 +1679,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form
51 + codec_params = stream->codecpar;
52 +
53 + // Always use the image cache for album art.
54 +- int is_album_art = ((codec_context->codec_id == AV_CODEC_ID_MJPEG
55 +- || codec_context->codec_id == AV_CODEC_ID_GIF
56 +- || codec_context->codec_id == AV_CODEC_ID_PNG)
57 +- && mlt_properties_get_int(properties, "meta.media.frame_rate_num") == 90000
58 +- && mlt_properties_get_int(properties, "meta.media.frame_rate_den") == 1);
59 ++ int is_album_art = stream->disposition & AV_DISPOSITION_ATTACHED_PIC;
60 + if (is_album_art)
61 + position = 0;
62 +
63 +@@ -2296,8 +2289,8 @@ static int video_codec_init( producer_avformat self, int index, mlt_properties p
64 + mlt_properties_set_int( properties, "meta.media.frame_rate_num", frame_rate.num );
65 + mlt_properties_set_int( properties, "meta.media.frame_rate_den", frame_rate.den );
66 +
67 +- // MP3 album art is a single JPEG at 90000 fps, which is not seekable.
68 +- if ( codec->id == AV_CODEC_ID_MJPEG && frame_rate.num == 90000 && frame_rate.den == 1 )
69 ++ // Cover art is a single image at 90000 fps, which is not seekable.
70 ++ if (stream->disposition & AV_DISPOSITION_ATTACHED_PIC)
71 + self->video_seekable = 0;
72 +
73 + // Set the YUV colorspace from override or detect
74
75 diff --git a/media-libs/mlt/mlt-6.26.1-r1.ebuild b/media-libs/mlt/mlt-6.26.1-r1.ebuild
76 new file mode 100644
77 index 00000000000..b04aa302aa9
78 --- /dev/null
79 +++ b/media-libs/mlt/mlt-6.26.1-r1.ebuild
80 @@ -0,0 +1,232 @@
81 +# Copyright 1999-2021 Gentoo Authors
82 +# Distributed under the terms of the GNU General Public License v2
83 +
84 +EAPI=7
85 +
86 +LUA_COMPAT=( lua5-{1..4} luajit )
87 +PYTHON_COMPAT=( python3_{7,8,9} )
88 +inherit lua python-single-r1 qmake-utils toolchain-funcs
89 +
90 +DESCRIPTION="Open source multimedia framework for television broadcasting"
91 +HOMEPAGE="https://www.mltframework.org/"
92 +SRC_URI="https://github.com/mltframework/${PN}/releases/download/v${PV}/${P}.tar.gz"
93 +
94 +LICENSE="GPL-3"
95 +SLOT="0"
96 +KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86 ~amd64-linux ~x86-linux"
97 +IUSE="compressed-lumas cpu_flags_x86_mmx cpu_flags_x86_sse cpu_flags_x86_sse2 debug
98 +ffmpeg fftw frei0r gtk jack kernel_linux libsamplerate lua opencv opengl python
99 +qt5 rtaudio rubberband sdl vdpau vidstab xine xml"
100 +# java perl php tcl
101 +
102 +REQUIRED_USE="lua? ( ${LUA_REQUIRED_USE} )
103 + python? ( ${PYTHON_REQUIRED_USE} )"
104 +
105 +SWIG_DEPEND=">=dev-lang/swig-2.0"
106 +# java? ( ${SWIG_DEPEND} >=virtual/jdk-1.5 )
107 +# perl? ( ${SWIG_DEPEND} )
108 +# php? ( ${SWIG_DEPEND} )
109 +# tcl? ( ${SWIG_DEPEND} )
110 +# ruby? ( ${SWIG_DEPEND} )
111 +BDEPEND="
112 + virtual/pkgconfig
113 + compressed-lumas? ( virtual/imagemagick-tools[png] )
114 + lua? ( ${SWIG_DEPEND} virtual/pkgconfig )
115 + python? ( ${SWIG_DEPEND} )
116 +"
117 +#rtaudio will use OSS on non linux OSes
118 +DEPEND="
119 + >=media-libs/libebur128-1.2.2:=
120 + ffmpeg? ( media-video/ffmpeg:0=[vdpau?,-flite] )
121 + fftw? ( sci-libs/fftw:3.0= )
122 + frei0r? ( media-plugins/frei0r-plugins )
123 + gtk? (
124 + media-libs/libexif
125 + x11-libs/pango
126 + )
127 + jack? (
128 + >=dev-libs/libxml2-2.5
129 + media-libs/ladspa-sdk
130 + virtual/jack
131 + )
132 + libsamplerate? ( >=media-libs/libsamplerate-0.1.2 )
133 + lua? ( ${LUA_DEPS} )
134 + opencv? ( >=media-libs/opencv-4.5.1:= )
135 + opengl? ( media-video/movit )
136 + python? ( ${PYTHON_DEPS} )
137 + qt5? (
138 + dev-qt/qtcore:5
139 + dev-qt/qtgui:5
140 + dev-qt/qtsvg:5
141 + dev-qt/qtwidgets:5
142 + dev-qt/qtxml:5
143 + media-libs/libexif
144 + x11-libs/libX11
145 + )
146 + rtaudio? (
147 + >=media-libs/rtaudio-4.1.2
148 + kernel_linux? ( media-libs/alsa-lib )
149 + )
150 + rubberband? ( media-libs/rubberband )
151 + sdl? (
152 + media-libs/libsdl2[X,opengl,video]
153 + media-libs/sdl2-image
154 + )
155 + vidstab? ( media-libs/vidstab )
156 + xine? ( >=media-libs/xine-lib-1.1.2_pre20060328-r7 )
157 + xml? ( >=dev-libs/libxml2-2.5 )"
158 +# java? ( >=virtual/jre-1.5 )
159 +# perl? ( dev-lang/perl )
160 +# php? ( dev-lang/php )
161 +# ruby? ( ${RUBY_DEPS} )
162 +# sox? ( media-sound/sox )
163 +# tcl? ( dev-lang/tcl:0= )
164 +RDEPEND="${DEPEND}"
165 +
166 +DOCS=( AUTHORS NEWS README docs/{framework,melt,mlt{++,-xml}}.txt )
167 +
168 +PATCHES=(
169 + "${FILESDIR}"/${PN}-6.10.0-swig-underlinking.patch
170 + "${FILESDIR}"/${PN}-6.22.1-no_lua_bdepend.patch
171 + "${FILESDIR}"/${P}-fix-crash-w-ogg-album-art.patch # git master
172 +)
173 +
174 +pkg_setup() {
175 + use python && python-single-r1_pkg_setup
176 +}
177 +
178 +src_prepare() {
179 + default
180 +
181 + # respect CFLAGS LDFLAGS when building shared libraries. Bug #308873
182 + for x in python lua; do
183 + sed -i "/mlt.so/s/ -lmlt++ /& ${CFLAGS} ${LDFLAGS} /" src/swig/$x/build || die
184 + done
185 +
186 + use python && python_fix_shebang src/swig/python
187 +}
188 +
189 +src_configure() {
190 + tc-export CC CXX
191 +
192 + local myconf=(
193 + --enable-gpl
194 + --enable-gpl3
195 + --enable-kdenlive
196 + --enable-melt
197 + --enable-motion-est
198 + --target-arch=$(tc-arch)
199 + --disable-gtk2
200 + --disable-kde
201 + --disable-sdl
202 + --disable-swfdec
203 + $(use_enable debug)
204 + $(use_enable cpu_flags_x86_sse sse)
205 + $(use_enable cpu_flags_x86_sse2 sse2)
206 + $(use_enable ffmpeg avformat)
207 + $(use_enable fftw plus)
208 + $(use_enable frei0r)
209 + $(use_enable gtk gdk)
210 + $(use_enable jack jackrack)
211 + $(use_enable libsamplerate resample)
212 + $(use_enable opencv)
213 + $(use_enable opengl)
214 + $(use_enable qt5 qt)
215 + $(use_enable rtaudio)
216 + $(use_enable rubberband)
217 + $(use_enable sdl sdl2)
218 + $(use_enable vidstab vid.stab)
219 + $(use_enable xine)
220 + $(use_enable xml)
221 + --disable-sox
222 + )
223 + #$(use_enable sox) FIXME
224 +
225 + use compressed-lumas && myconf+=( --luma-compress )
226 + use ffmpeg && myconf+=( --avformat-swscale )
227 + use vdpau && myconf+=( --avformat-vdpau )
228 +
229 + if use qt5 ; then
230 + myconf+=(
231 + --qt-includedir=$(qt5_get_headerdir)
232 + --qt-libdir=$(qt5_get_libdir)
233 + )
234 + fi
235 +
236 + if use amd64 || use x86 ; then
237 + myconf+=( $(use_enable cpu_flags_x86_mmx mmx) )
238 + else
239 + myconf+=( --disable-mmx )
240 + fi
241 +
242 + # TODO: add swig language bindings
243 + # see also https://www.mltframework.org/twiki/bin/view/MLT/ExtremeMakeover
244 +
245 + local swig_lang=()
246 + # not done: java perl php ruby tcl
247 + # handled separately: lua
248 + for i in python; do
249 + use $i && swig_lang+=( $i )
250 + done
251 + [[ -z "${swig_lang}" ]] && swig_lang=( none )
252 +
253 + econf "${myconf[@]}" --swig-languages="${swig_lang[*]}"
254 +
255 + sed -i -e s/^OPT/#OPT/ config.mak || die
256 +}
257 +
258 +src_compile() {
259 + default
260 +
261 + if use lua; then
262 + # Only copy sources now to avoid unnecessary rebuilds
263 + lua_copy_sources
264 +
265 + lua_compile() {
266 + pushd "${BUILD_DIR}"/src/swig/lua > /dev/null || die
267 +
268 + sed -i -e "s| mlt_wrap.cxx| $(lua_get_CFLAGS) mlt_wrap.cxx|" build || die
269 + ./build
270 +
271 + popd > /dev/null || die
272 + }
273 + lua_foreach_impl lua_compile
274 + fi
275 +}
276 +
277 +src_install() {
278 + default
279 +
280 + insinto /usr/share/${PN}
281 + doins -r demo
282 +
283 + #
284 + # Install SWIG bindings
285 + #
286 +
287 + docinto swig
288 +
289 + if use lua; then
290 + lua_install() {
291 + pushd "${BUILD_DIR}"/src/swig/lua > /dev/null || die
292 +
293 + exeinto "$(lua_get_cmod_dir)"
294 + doexe mlt.so
295 +
296 + popd > /dev/null || die
297 + }
298 + lua_foreach_impl lua_install
299 +
300 + dodoc "${S}"/src/swig/lua/play.lua
301 + fi
302 +
303 + if use python; then
304 + cd "${S}"/src/swig/python || die
305 + python_domodule mlt.py _mlt.so
306 + chmod +x "${D}$(python_get_sitedir)/_mlt.so" || die
307 + dodoc play.py
308 + python_optimize
309 + fi
310 +
311 + # not done: java perl php ruby tcl
312 +}