Diff ffmpeg-3.4.6-r1 with a ffmpeg-4.1.3

/usr/portage/media-video/ffmpeg/ffmpeg-4.1.3.ebuild 2020-02-11 20:51:00.000000000 +0300
12 12
# changes its ABI then this package will be rebuilt needlessly. Hence, such a
13 13
# package is free _not_ to := depend on FFmpeg but I would strongly encourage
14 14
# doing so since such a case is unlikely.
15
FFMPEG_SUBSLOT=55.57.57
15
FFMPEG_SUBSLOT=56.58.58
16 16

  
17 17
SCM=""
18 18
if [ "${PV#9999}" != "${PV}" ] ; then
19 19
	SCM="git-r3"
20
	EGIT_REPO_URI="git://source.ffmpeg.org/ffmpeg.git"
20
	EGIT_MIN_CLONE_TYPE="single"
21
	EGIT_REPO_URI="https://git.ffmpeg.org/ffmpeg.git"
21 22
fi
22 23

  
23 24
inherit eutils flag-o-matic multilib multilib-minimal toolchain-funcs ${SCM}
24 25

  
25 26
DESCRIPTION="Complete solution to record, convert and stream audio and video. Includes libavcodec"
26
HOMEPAGE="http://ffmpeg.org/"
27
HOMEPAGE="https://ffmpeg.org/"
27 28
if [ "${PV#9999}" != "${PV}" ] ; then
28 29
	SRC_URI=""
29 30
elif [ "${PV%_p*}" != "${PV}" ] ; then # Snapshot
30 31
	SRC_URI="mirror://gentoo/${P}.tar.bz2"
31 32
else # Release
32
	SRC_URI="http://ffmpeg.org/releases/${P/_/-}.tar.bz2"
33
	SRC_URI="https://ffmpeg.org/releases/${P/_/-}.tar.bz2"
33 34
fi
34 35
FFMPEG_REVISION="${PV#*_p}"
35 36

  
......
54 55
	samba? ( GPL-3 )
55 56
"
56 57
if [ "${PV#9999}" = "${PV}" ] ; then
57
	KEYWORDS="~alpha amd64 arm arm64 hppa ia64 ~mips ppc ppc64 x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
58
	KEYWORDS="~alpha amd64 arm arm64 ~hppa ia64 ~mips ppc ppc64 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
58 59
fi
59 60

  
60 61
# Options to use as use_enable in the foo[:bar] form.
......
63 64
# foo is added to IUSE.
64 65
FFMPEG_FLAG_MAP=(
65 66
		+bzip2:bzlib cpudetection:runtime-cpudetect debug gcrypt gnutls gmp
66
		+gpl +hardcoded-tables +iconv lzma +network opencl openssl +postproc
67
		samba:libsmbclient sdl:ffplay sdl:sdl2 vaapi vdpau X:xlib xcb:libxcb
68
		xcb:libxcb-shm xcb:libxcb-xfixes +zlib
67
		+gpl +hardcoded-tables +iconv libressl:libtls libxml2 lzma +network opencl
68
		openssl +postproc samba:libsmbclient sdl:ffplay sdl:sdl2 vaapi vdpau
69
		X:xlib xcb:libxcb xcb:libxcb-shm xcb:libxcb-xfixes +zlib
69 70
		# libavdevice options
70 71
		cdio:libcdio iec61883:libiec61883 ieee1394:libdc1394 libcaca openal
71 72
		opengl
72 73
		# indevs
73
		libv4l:libv4l2 pulseaudio:libpulse libdrm
74
		libv4l:libv4l2 pulseaudio:libpulse libdrm jack:libjack
74 75
		# decoders
75
		amr:libopencore-amrwb amr:libopencore-amrnb fdk:libfdk-aac
76
		amr:libopencore-amrwb amr:libopencore-amrnb codec2:libcodec2 fdk:libfdk-aac
76 77
		jpeg2k:libopenjpeg bluray:libbluray gme:libgme gsm:libgsm
77 78
		mmal modplug:libmodplug opus:libopus libilbc librtmp ssh:libssh
78
		speex:libspeex svg:librsvg vorbis:libvorbis
79
		vpx:libvpx zvbi:libzvbi
79
		speex:libspeex srt:libsrt svg:librsvg video_cards_nvidia:ffnvcodec
80
		vorbis:libvorbis vpx:libvpx zvbi:libzvbi
80 81
		# libavfilter options
81 82
		appkit
82 83
		bs2b:libbs2b chromaprint flite:libflite frei0r
83
		fribidi:libfribidi fontconfig ladspa libass truetype:libfreetype
84
		fribidi:libfribidi fontconfig ladspa libass lv2 truetype:libfreetype
84 85
		rubberband:librubberband zeromq:libzmq zimg:libzimg
85 86
		# libswresample options
86 87
		libsoxr
......
91 92
# Same as above but for encoders, i.e. they do something only with USE=encode.
92 93
FFMPEG_ENCODER_FLAG_MAP=(
93 94
	amrenc:libvo-amrwbenc mp3:libmp3lame
94
	kvazaar:libkvazaar nvenc:nvenc
95
	kvazaar:libkvazaar libaom
95 96
	openh264:libopenh264 snappy:libsnappy theora:libtheora twolame:libtwolame
96 97
	wavpack:libwavpack webp:libwebp x264:libx264 x265:libx265 xvid:libxvid
97 98
)
98 99

  
99 100
IUSE="
100
	alsa chromium doc +encode jack oss pic static-libs test v4l
101
	alsa chromium doc +encode oss pic static-libs test v4l
101 102
	${FFMPEG_FLAG_MAP[@]%:*}
102 103
	${FFMPEG_ENCODER_FLAG_MAP[@]%:*}
103 104
"
......
168 169
	bzip2? ( >=app-arch/bzip2-1.0.6-r4[${MULTILIB_USEDEP}] )
169 170
	cdio? ( >=dev-libs/libcdio-paranoia-0.90_p1-r1[${MULTILIB_USEDEP}] )
170 171
	chromaprint? ( >=media-libs/chromaprint-1.2-r1[${MULTILIB_USEDEP}] )
172
	codec2? ( media-libs/codec2[${MULTILIB_USEDEP}] )
171 173
	encode? (
172 174
		amrenc? ( >=media-libs/vo-amrwbenc-0.1.2-r1[${MULTILIB_USEDEP}] )
173
		kvazaar? ( media-libs/kvazaar[${MULTILIB_USEDEP}] )
175
		kvazaar? ( >=media-libs/kvazaar-1.2.0[${MULTILIB_USEDEP}] )
174 176
		mp3? ( >=media-sound/lame-3.99.5-r1[${MULTILIB_USEDEP}] )
175
		nvenc? ( media-video/nvidia_video_sdk )
176 177
		openh264? ( >=media-libs/openh264-1.4.0-r1[${MULTILIB_USEDEP}] )
177 178
		snappy? ( >=app-arch/snappy-1.1.2-r1:=[${MULTILIB_USEDEP}] )
178 179
		theora? (
......
194 195
	gcrypt? ( >=dev-libs/libgcrypt-1.6:0=[${MULTILIB_USEDEP}] )
195 196
	gme? ( >=media-libs/game-music-emu-0.6.0[${MULTILIB_USEDEP}] )
196 197
	gmp? ( >=dev-libs/gmp-6:0=[${MULTILIB_USEDEP}] )
197
	gnutls? ( >=net-libs/gnutls-2.12.23-r6:=[${MULTILIB_USEDEP}] )
198 198
	gsm? ( >=media-sound/gsm-1.0.13-r1[${MULTILIB_USEDEP}] )
199 199
	iconv? ( >=virtual/libiconv-0-r1[${MULTILIB_USEDEP}] )
200 200
	iec61883? (
......
208 208
	)
209 209
	jack? ( virtual/jack[${MULTILIB_USEDEP}] )
210 210
	jpeg2k? ( >=media-libs/openjpeg-2:2[${MULTILIB_USEDEP}] )
211
	libaom? ( >=media-libs/libaom-1.0.0-r1[${MULTILIB_USEDEP}] )
211 212
	libass? ( >=media-libs/libass-0.10.2:=[${MULTILIB_USEDEP}] )
212 213
	libcaca? ( >=media-libs/libcaca-0.99_beta18-r1[${MULTILIB_USEDEP}] )
213 214
	libdrm? ( x11-libs/libdrm[${MULTILIB_USEDEP}] )
214 215
	libilbc? ( >=media-libs/libilbc-2[${MULTILIB_USEDEP}] )
215 216
	libsoxr? ( >=media-libs/soxr-0.1.0[${MULTILIB_USEDEP}] )
216 217
	libv4l? ( >=media-libs/libv4l-0.9.5[${MULTILIB_USEDEP}] )
218
	libxml2? ( dev-libs/libxml2:=[${MULTILIB_USEDEP}] )
219
	lv2? ( media-libs/lv2[${MULTILIB_USEDEP}] media-libs/lilv[${MULTILIB_USEDEP}] )
217 220
	lzma? ( >=app-arch/xz-utils-5.0.5-r1[${MULTILIB_USEDEP}] )
218 221
	mmal? ( media-libs/raspberrypi-userland )
219 222
	modplug? ( >=media-libs/libmodplug-0.8.8.4-r1[${MULTILIB_USEDEP}] )
220 223
	openal? ( >=media-libs/openal-1.15.1[${MULTILIB_USEDEP}] )
221 224
	opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
222 225
	opengl? ( >=virtual/opengl-7.0-r1[${MULTILIB_USEDEP}] )
223
	openssl? ( >=dev-libs/openssl-1.0.1h-r2:0=[${MULTILIB_USEDEP}] )
224 226
	opus? ( >=media-libs/opus-1.0.2-r2[${MULTILIB_USEDEP}] )
225 227
	pulseaudio? ( >=media-sound/pulseaudio-2.1-r1[${MULTILIB_USEDEP}] )
226 228
	librtmp? ( >=media-video/rtmpdump-2.4_p20131018[${MULTILIB_USEDEP}] )
......
228 230
	samba? ( >=net-fs/samba-3.6.23-r1[client,${MULTILIB_USEDEP}] )
229 231
	sdl? ( media-libs/libsdl2[sound,video,${MULTILIB_USEDEP}] )
230 232
	speex? ( >=media-libs/speex-1.2_rc1-r1[${MULTILIB_USEDEP}] )
233
	srt? ( >=net-libs/srt-1.3.0[${MULTILIB_USEDEP}] )
231 234
	ssh? ( >=net-libs/libssh-0.5.5[${MULTILIB_USEDEP}] )
232 235
	svg? ( gnome-base/librsvg:2=[${MULTILIB_USEDEP}] )
233 236
	truetype? ( >=media-libs/freetype-2.5.0.1:2[${MULTILIB_USEDEP}] )
234 237
	vaapi? ( >=x11-libs/libva-1.2.1-r1[${MULTILIB_USEDEP}] )
238
	video_cards_nvidia? ( >=media-libs/nv-codec-headers-8.1.24.2[${MULTILIB_USEDEP}] )
235 239
	vdpau? ( >=x11-libs/libvdpau-0.7[${MULTILIB_USEDEP}] )
236 240
	vorbis? (
237 241
		>=media-libs/libvorbis-1.3.3-r1[${MULTILIB_USEDEP}]
......
245 249
	)
246 250
	xcb? ( >=x11-libs/libxcb-1.4[${MULTILIB_USEDEP}] )
247 251
	zeromq? ( >=net-libs/zeromq-4.1.6 )
248
	zimg? ( >=media-libs/zimg-2.4:=[${MULTILIB_USEDEP}] )
252
	zimg? ( >=media-libs/zimg-2.7.4:=[${MULTILIB_USEDEP}] )
249 253
	zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )
250 254
	zvbi? ( >=media-libs/zvbi-0.2.35[${MULTILIB_USEDEP}] )
251 255
	!media-video/qt-faststart
252 256
	postproc? ( !media-libs/libpostproc )
253 257
"
254 258

  
259
# Crypto & co provider magic
260
# - libressl is a useflag meaning it should always favor libressl over openssl
261
# - libressl and openssl provide more features to ffmpeg than gnutls
262
#
263
# The ordering is thus: libressl > openssl > gnutls
264
RDEPEND="${RDEPEND}
265
	libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP}] )
266
	!libressl? (
267
		openssl? ( >=dev-libs/openssl-1.0.1h-r2:0=[${MULTILIB_USEDEP}] )
268
		!openssl? ( gnutls? ( >=net-libs/gnutls-2.12.23-r6:=[${MULTILIB_USEDEP}] ) )
269
	)
270
"
271

  
255 272
DEPEND="${RDEPEND}
256 273
	>=sys-devel/make-3.81
257 274
	doc? ( sys-apps/texinfo )
......
267 284
	postproc? ( gpl )
268 285
	frei0r? ( gpl )
269 286
	cdio? ( gpl )
287
	rubberband? ( gpl )
270 288
	samba? ( gpl )
271 289
	encode? (
272 290
		x264? ( gpl )
......
283 301
	${CPU_REQUIRED_USE}"
284 302
RESTRICT="
285 303
	!test? ( test )
286
	gpl? ( openssl? ( bindist ) fdk? ( bindist ) )
304
	gpl? ( openssl? ( bindist ) fdk? ( bindist ) libressl? ( bindist ) )
287 305
"
288 306

  
289 307
S=${WORKDIR}/${P/_/-}
290 308

  
291 309
PATCHES=(
292
	"${FILESDIR}"/chromium.patch
293
	"${FILESDIR}"/${PN}-3.4.6-fix-building-against-fdk-aac-2.patch #682890
310
	"${FILESDIR}"/chromium-r1.patch
294 311
)
295 312

  
296 313
MULTILIB_WRAPPED_HEADERS=(
297 314
	/usr/include/libavutil/avconfig.h
298 315
)
299 316

  
317
build_separate_libffmpeg() {
318
	use opencl
319
}
320

  
300 321
src_prepare() {
301 322
	if [[ "${PV%_p*}" != "${PV}" ]] ; then # Snapshot
302 323
		export revision=git-N-${FFMPEG_REVISION}
......
309 330
	local myconf=( ${EXTRA_FFMPEG_CONF} )
310 331

  
311 332
	local ffuse=( "${FFMPEG_FLAG_MAP[@]}" )
312
	use openssl && use gpl && myconf+=( --enable-nonfree )
333
	use openssl || use libressl && use gpl && myconf+=( --enable-nonfree )
313 334
	use samba && myconf+=( --enable-version3 )
314 335

  
315 336
	# Encoders
......
331 352
	done
332 353

  
333 354
	# Outdevs
334
	for i in alsa oss sdl ; do
355
	for i in alsa oss ; do
335 356
		use ${i} || myconf+=( --disable-outdev=${i} )
336 357
	done
337 358

  
......
344 365
		myconf+=( $(use_enable ${i%:*} ${i#*:}) )
345 366
	done
346 367

  
368
	# Incompatible features: openssl or libressl and gnutls
369
	if use libressl ; then
370
		myconf+=( --disable-gnutls --disable-openssl )
371
	elif use openssl ; then
372
		myconf+=( --disable-gnutls )
373
	fi
374

  
347 375
	# (temporarily) disable non-multilib deps
348 376
	if ! multilib_is_native_abi; then
349 377
		for i in frei0r libzmq ; do
......
383 411
		--enable-avfilter
384 412
		--enable-avresample
385 413
		--disable-stripping
414
		# This is only for hardcoded cflags; those are used in configure checks that may
415
		# interfere with proper detections, bug #671746 and bug #645778
416
		# We use optflags, so that overrides them anyway.
417
		--disable-optimizations
386 418
		--disable-libcelt # bug #664158
387 419
		"${myconf[@]}"
388 420
	)
......
426 458
	echo "${@}"
427 459
	"${@}" || die
428 460

  
429
	if multilib_is_native_abi && use chromium; then
461
	if multilib_is_native_abi && use chromium && build_separate_libffmpeg; then
430 462
		einfo "Configuring for Chromium"
431 463
		mkdir -p ../chromium || die
432 464
		pushd ../chromium >/dev/null || die
......
434 466
			--disable-shared \
435 467
			--enable-static \
436 468
			--enable-pic \
437
			--extra-cflags="-DFF_API_CONVERGENCE_DURATION=0"
469
			--disable-opencl
438 470
		echo "${@}"
439 471
		"${@}" || die
440 472
		popd >/dev/null || die
......
452 484
		done
453 485

  
454 486
		if use chromium; then
455
			einfo "Compiling for Chromium"
456
			pushd ../chromium >/dev/null || die
457
			emake V=1 libffmpeg
458
			popd >/dev/null || die
487
			if build_separate_libffmpeg; then
488
				einfo "Compiling for Chromium"
489
				pushd ../chromium >/dev/null || die
490
				emake V=1 libffmpeg
491
				popd >/dev/null || die
492
			else
493
				emake V=1 libffmpeg
494
			fi
459 495
		fi
460 496
	fi
461 497
}
......
471 507
		done
472 508

  
473 509
		if use chromium; then
474
			einfo "Installing for Chromium"
475
			pushd ../chromium >/dev/null || die
476
			emake V=1 DESTDIR="${D}" install-libffmpeg
477
			popd >/dev/null || die
510
			if build_separate_libffmpeg; then
511
				einfo "Installing for Chromium"
512
				pushd ../chromium >/dev/null || die
513
				emake V=1 DESTDIR="${D}" install-libffmpeg
514
				popd >/dev/null || die
515
			else
516
				emake V=1 DESTDIR="${D}" install-libffmpeg
517
			fi
478 518
		fi
479 519
	fi
480 520
}
Thank you!