import ffmpeg-5.1.4-1.el9

i9cr
MSVSphere Packaging Team 10 months ago
parent 5ce99ec589
commit 0d2e243a99

@ -1,2 +1,2 @@
678b051ad6388318c9981b98071962d45b424ed5 SOURCES/ffmpeg-free-5.1.3.tar.xz
81b8a0552dbd1c5e0c6e595f2174351397435d76 SOURCES/ffmpeg-dlopen-headers.tar.xz
ebcb9e2f6975b97e25314abdfd717d94b3078eff SOURCES/ffmpeg-5.1.4.tar.xz
5f36267deb62b43bc5971473b470e63856c65ed8 SOURCES/ffmpeg-5.1.4.tar.xz.asc

4
.gitignore vendored

@ -1,2 +1,2 @@
SOURCES/ffmpeg-free-5.1.3.tar.xz
SOURCES/ffmpeg-dlopen-headers.tar.xz
SOURCES/ffmpeg-5.1.4.tar.xz
SOURCES/ffmpeg-5.1.4.tar.xz.asc

@ -1,457 +0,0 @@
## module name # reason for enablement in ffmpeg (usually there is another package that already got legal review)
aac
aasc
libfdk_aac # fdk-aac-free
ac3
acelp_kelvin
adpcm_4xm
adpcm_adx
adpcm_afc
adpcm_agm
adpcm_aica
adpcm_argo
adpcm_ct
adpcm_dtk
adpcm_ea
adpcm_ea_maxis_xa
adpcm_ea_r1
adpcm_ea_r2
adpcm_ea_r3
adpcm_ea_xas
adpcm_g722
adpcm_g726
adpcm_g726le
adpcm_ima_acorn
adpcm_ima_alp
adpcm_ima_amv
adpcm_ima_apc
adpcm_ima_apm
adpcm_ima_cunning
adpcm_ima_dat4
adpcm_ima_dk3
adpcm_ima_dk4
adpcm_ima_ea_eacs
adpcm_ima_ea_sead
adpcm_ima_iss
adpcm_ima_moflex
adpcm_ima_mtf
adpcm_ima_oki
adpcm_ima_qt
adpcm_ima_qt_at
adpcm_ima_rad
adpcm_ima_smjpeg
adpcm_ima_ssi
adpcm_ima_wav
adpcm_ima_ws
adpcm_ms
adpcm_mtaf
adpcm_psx
adpcm_sbpro_2
adpcm_sbpro_3
adpcm_sbpro_4
adpcm_swf
adpcm_thp
adpcm_thp_le
adpcm_vima
adpcm_xa
adpcm_yamaha
adpcm_zork
alac
alias_pix
amrnb
amrwb
amv
anm
ansi # trivial
ape
apng # animated png
arbc
argo
ass # trivial
asv1
asv2
atrac1
atrac3
atrac3al
atrac3p
atrac3pal
aura
aura2
av1 # libaom
av1_qsv # libaom
ayuv # trivial
bethsoftvid # trivial
bfi # trivial
bink
binkaudio_dct
binkaudio_rdft
bintext
bitpacked # trivial
bmp # trivial
bmv_audio
bmv_video
brender_pix
c93
ccaption
cdgraphics
cdtoons
cdxl
cinepak
clearvideo
cljr
cook
cpia
cscd
cyuv
dca
dds
derf_dpcm
dfa
dfpwm
dirac # dirac
dnxhd
dolby_e
dpx
dsd_lsbf
dsd_msbf
dsicinaudio
dsicinvideo
dss_sp
dvaudio
dvbsub
dvdsub
dvvideo
dxa
dxtory
eacmv
eamad
eatgq
eatgv
eatqi
eightbps
eightsvx_exp
eightsvx_fib
escape124
escape130
evrc
exr # openEXR
ffv1 # ffmpeg
ffvhuff # ffmpeg
ffwavesynth # pseudo
fits
flac # libFLAC
flashsv
flashsv2
flic
flv
fmvc
fourxm
g723_1
g729
gdv
gem
gif # libpng
gremlin_dpcm
gsm # libgsm
gsm_ms
gsm_ms_at
h261
h263
h263_v4l2m2m
h263i
h263p
hap
hca
hcom
hnm4_video
hq_hqa
hqx
huffyuv # trivial+zlib
hymt # huffyuv-mt
iac
idcin
idf
iff_ilbm
ilbc # ilbc
imc
indeo2
indeo3
indeo4
indeo5
interplay_acm
interplay_dpcm
interplay_video
ipu
jacosub
jpeg2000 # openjpeg2
jpegls
jv
kgv1
kmvc
lagarith
libaom # libaom
libaom_av1 # libaom
libcodec2 # codec2
libdav1d # av1
libgsm # libgsm
libgsm_ms # libgsm
libilbc # ilbc
libjxl # libjxl
libopencore_amrnb # opencore-amr
libopencore_amrwb # opencore-amr
libopenh264 # openh264_dlopen
libopenjpeg # openjpeg
libopus # opus
librsvg # librsvg
libschroedinger # schroedinger
libspeex # speex
libvorbis # libvorbis
libvpx_vp8 # libvpx
libvpx_vp9 # libvpx
libzvbi_teletext # zvbi
loco
lscr
m101
mace3
mace6
mdec
metasound
microdvd
mimic
mjpeg # mjpegtools
mjpeg_qsv # mjpegtools
mjpegb
mlp
mmvideo
motionpixels
mp1 # twolame/lame
mp1float # twolame/lame
mp2 # twolame
mp2float # twolame
mp3 # lame
mp3adu
mp3adufloat
mp3float # lame
mp3on4
mp3on4float
mpc7
mpc8
mpeg1video
mpeg1_v4l2m2m
mpeg2video
mpeg2_qsv
mpeg2_v4l2m2m
mpeg4
mpeg4_v4l2m2m
mpegvideo
mpl2
msa1
mscc
msmpeg4v1
msmpeg4v2
msmpeg4v3
msnsiren
msp2
msrle
mss1
mss2
msvideo1
mszh
mts2
mv30
mvc1
mvc2
mvdv
mvha
mwsc
mxpeg
nellymoser
nuv
on2avc
opus # libopus
paf_audio
paf_video
pam # trivial
pbm # trivial
pcm_alaw # trivial
pcm_bluray
pcm_dvd
pcm_f16le # trivial
pcm_f24le # trivial
pcm_f32be # trivial
pcm_f32le # trivial
pcm_f64be # trivial
pcm_f64le # trivial
pcm_lxf # trivial
pcm_mulaw # trivial
pcm_s16be # trivial
pcm_s16be_planar # trivial
pcm_s16le # trivial
pcm_s16le_planar # trivial
pcm_s24be # trivial
pcm_s24daud # trivial
pcm_s24le # trivial
pcm_s24le_planar # trivial
pcm_s32be # trivial
pcm_s32le # trivial
pcm_s32le_planar # trivial
pcm_s64be # trivial
pcm_s64le # trivial
pcm_s8 # trivial
pcm_s8_planar # trivial
pcm_sga # trivial
pcm_u16be # trivial
pcm_u16le # trivial
pcm_u24be # trivial
pcm_u24le # trivial
pcm_u32be # trivial
pcm_u32le # trivial
pcm_u8 # trivial
pcm_vidc # trivial
pcx
pfm # trivial
pgm # trivial
pgmyuv # trivial
pgssub # mkvtoolnix
pgx
phm # trivial
photocd
pictor
pjs
png # libpng
ppm # trivial
prosumer
psd
ptx
qcelp
qdm2
qdmc
qdraw
qoi
qpeg
qtrle
r10k
r210
ra_144
ra_288
rasc
rawvideo # trivial
realtext
rl2
roq
roq_dpcm
rpza
rscc
rv10
rv20
s302m
sami
sanm
sbc
screenpresso
sdx2_dpcm
sgi # trivial
sgirle # trivial
shorten
simbiosis_imx
sipr
siren
smackaud
smacker
smc
smvjpeg
snow
sol_dpcm
sonic
sp5x
speedhq
speex
srgc
srt # trivial
ssa # trivial
stl
subrip
subviewer
subviewer1
sunrast # trivial
svq1
svq3
tak
targa # trivial
targa_y216
tdsc
text # trivial
theora # libtheora
thp
tiertexseqvideo
tiff # libtiff
tmv
truehd
truemotion1
truemotion2
truemotion2rt
truespeech
tscc
tscc2
tta
twinvq
txd
ulti
utvideo
v210 # trivial
v210x # trivial
v308 # trivial
v408 # trivial
v410 # trivial
vb
vble
vcr1
vmdaudio
vmdvideo
vmnc
vorbis # libvorbis
vp3 # libav
vp4 # libav
vp5 # libav
vp6 # libav
vp6a # libav
vp6f # libav
vp7 # libav
vp8 # libvpx
vp8_qsv # libvpx
vp8_v4l2m2m # libvpx
vp9 # libvpx
vp9_qsv # libvpx
vp9_v4l2m2m # libvpx
vplayer
vqa
wavpack
wcmv
webp # libwebp
webvtt # trivial
wmav1
wmav2
wmavoice
wmv1
wmv2
wnv1
wrapped_avframe # passthrough
ws_snd1
xan_dpcm
xan_wc3
xan_wc4
xbin
xbm # trivial
xface
xl
xpm
xsub
xwd # xwd
y41p # trivial
ylc
yop
yuv4 # trivial
zero12v
zerocodec
zlib # zlib
zmbv # dosbox

@ -1,202 +0,0 @@
## module name # reason for enablement in ffmpeg (usually there is another package that already got legal review)
a64multi
a64multi5
aac
libfdk_aac # fdk-aac-free
ac3
adpcm_adx
adpcm_argo
adpcm_g722
adpcm_g726
adpcm_g726le
adpcm_ima_alp
adpcm_ima_amv
adpcm_ima_apm
adpcm_ima_qt
adpcm_ima_ssi
adpcm_ima_wav
adpcm_ima_ws
adpcm_ms
adpcm_swf
adpcm_yamaha
alac
alias_pix
amv
apng # libpng
ass # trivial
asv1
asv2
ayuv # trival
bitpacked # trivial
bmp # trivial
cinepak
cljr
dca
dfpwm
dnxhd
dpx
dvbsub
dvdsub
dvvideo
exr
ffv1
ffvhuff # trivial+zlib
flac # libFLAC
flashsv
flashsv2
flv
g723_1
gif # libpng
h261
h263
h263_v4l2m2m # hardware
h263p
h264_amf # hardware
h264_nvenc # hardware
h264_qsv # hardware
h264_v4l2m2m # hardware
h264_vaapi # hardware
hap
hevc_amf # hardware
hevc_nvenc # hardware
hevc_qsv # hardware
hevc_v4l2m2m # hardware
hevc_vaapi # hardware
huffyuv # trivial+zlib
ilbc # ilbc
jpegls
jpeg2000
libaom # libaom
libaom_av1 # libaom
libcodec2 # codec2
libgsm # libgsm
libgsm_ms # libgsm
libilbc # ilbc
libjxl # libjxl
libmp3lame # lame
libopencore_amrnb
libopenh264 # openh264_dlopen
libopenjpeg # openjpeg
libopus # opus
librav1e # rav1e
libschroedinger # schroedinger
libspeex # speex
libsvtav1
libtheora # libtheora
libtwolame # twolame
libvo_amrwbenc
libvorbis # libvorbis
libvpx_vp8 # libvpx
libvpx_vp9 # libvpx
libwebp # libwebp
libwebp_anim # libwebp
libxvid # xvidcore
mjpeg # mjpegtools
mjpeg_qsv # mjpegtools
mjpeg_vaapi # mjpegtools
mlp
mp2 # twolame
mp2fixed # twolame
mpeg1video
mpeg2video
mpeg2_qsv
mpeg2_vaapi
mpeg4
mpeg4_v4l2m2m # hardware
msmpeg4v2
msmpeg4v3
msvideo1
nellymoser
opus # opus
pam
pbm # trivial
pcm_alaw # trivial
pcm_f32be # trivial
pcm_f32le # trivial
pcm_f64be # trivial
pcm_f64le # trivial
pcm_mulaw # trivial
pcm_s16be # trivial
pcm_s16be_planar # trivial
pcm_s16le # trivial
pcm_s16le_planar # trivial
pcm_s24be # trivial
pcm_s24le # trivial
pcm_s24le_planar # trivial
pcm_s32be # trivial
pcm_s32le # trivial
pcm_s32le_planar # trivial
pcm_s8 # trivial
pcm_s8_planar # trivial
pcm_u16be # trivial
pcm_u16le # trivial
pcm_u24be # trivial
pcm_u24le # trivial
pcm_u32be # trivial
pcm_u32le # trivial
pcm_u8 # trivial
pcx
pgm # trivial
pgmyuv # trivial
phm # trivial
png # libpng
ppm # trivial
qoi
qtrle
r10k # trivial
r210 # trivial
ra_144
rawvideo # trivial
roq
roq_dpcm
rpza
rv10
rv20
s302m
sbc
sgi # trivial
smc
snow
sonic
sonic_ls
speedhq
srt # trivial
ssa # trivial
subrip # trivial
sunrast # trivial
svq1
targa # trivial
text # trivial
tiff # libtiff
truehd
tta
ttml
utvideo
v210 # trivial
v308 # trivial
v408 # trivial
v410 # trivial
vc1_qsv # hardware
vc1_v4l2m2m # hardware
vc2 # dirac
vorbis # libvorbis
vp8_qsv # libvpx
vp8_v4l2m2m # libvpx
vp8_vaapi # libvpx
vp9_qsv # libvpx
vp9_vaapi # libvpx
wavpack
webvtt # trivial
wmav1
wmav2
wmv1
wmv2
wrapped_avframe # passthrough
xbm # (X11)
xface
xsub
xwd # xwd
y41p # trivial
yuv4 # trivial
zlib # zlib
zmbv # dosbox

@ -1,11 +0,0 @@
-----BEGIN PGP SIGNATURE-----
iQFMBAABCAA2FiEE/PmG6hXm4pOlZE8QtDIvBNZ2WNgFAmQgVfwYHGZmbXBlZy1k
ZXZlbEBmZm1wZWcub3JnAAoJELQyLwTWdljYntkH/1aN/nVkVPhbalrPdX14VIau
aW2OxXleh7AJe9FVjYduJPQZHS5+wm1GTTl5/IHje3sMG54RdkezRIfx/XCeZefd
c+P6OPvqpIXvhEHoKABB/hD7bI/+0bkAfUtDDp0Nfv05sag9PPC0XAJfLGlvWTPl
Ci8rLbO7VnsOo35+3dRVHgx6N6vNQuKRx5oZVgb3GEo18gjV1zsoDD91cQjR7GeF
64Jol7CPAikSnGwi3rxjARTk+V2YqaPM0KY/VR9QlVReIT2CdrRvQtUTvL1WB5mC
6nQ3tHDkRk5uEohAT+e9dxAUBxSTQhKHJn8V4pFS1QVBKH4slPqGvTPnKf5vg+8=
=Tdc7
-----END PGP SIGNATURE-----

@ -1,24 +0,0 @@
fdk-aac-free-devel is GPL compatible
See https://bugzilla.redhat.com/show_bug.cgi?id=1501522#c112
Index: ffmpeg-5.0/configure
===================================================================
--- ffmpeg-5.0.orig/configure 2022-02-09 20:07:49.490888877 +0100
+++ ffmpeg-5.0/configure 2022-02-09 20:08:30.102854308 +0100
@@ -1783,7 +1783,6 @@ EXTERNAL_LIBRARY_GPL_LIST="
EXTERNAL_LIBRARY_NONFREE_LIST="
decklink
- libfdk_aac
libtls
"
@@ -1822,6 +1821,7 @@ EXTERNAL_LIBRARY_LIST="
libdav1d
libdc1394
libdrm
+ libfdk_aac
libflite
libfontconfig
libfreetype

@ -0,0 +1,46 @@
From 4464ecf750bb9440e2571a8d810627cdec85ae02 Mon Sep 17 00:00:00 2001
From: Frank Liberato <liberato@chromium.org>
Date: Wed, 7 Jul 2021 19:01:22 -0700
Subject: [PATCH] Add av_stream_get_first_dts for Chromium
---
libavformat/avformat.h | 4 ++++
libavformat/utils.c | 7 +++++++
2 files changed, 11 insertions(+)
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index f12fa7d904..0b9fd1f061 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1128,6 +1128,10 @@ struct AVCodecParserContext *av_stream_get_parser(const AVStream *s);
*/
int64_t av_stream_get_end_pts(const AVStream *st);
+// 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
/**
diff --git a/libavformat/utils.c b/libavformat/utils.c
index cf4d68bff9..7d750abf88 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -55,6 +55,13 @@ int ff_unlock_avformat(void)
return ff_mutex_unlock(&avformat_mutex) ? -1 : 0;
}
+// 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 ^^^
+
/* an arbitrarily chosen "sane" max packet size -- 50M */
#define SANE_CHUNK_SIZE (50000000)
--
2.41.0

@ -1,56 +0,0 @@
From: Jan Engelhardt <jengelh@inai.de>
Edit the default codec selection such that
ffmpeg -i youtube.blah.webm foobar.mkv
without any further arguments can produce a result even on a
reduced codec selection list.
---
libavformat/matroskaenc.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
Index: ffmpeg-5.0/libavformat/matroskaenc.c
===================================================================
--- ffmpeg-5.0.orig/libavformat/matroskaenc.c 2022-01-14 19:45:40.000000000 +0100
+++ ffmpeg-5.0/libavformat/matroskaenc.c 2022-02-04 08:29:14.582130919 +0100
@@ -2887,16 +2887,24 @@ static int mkv_query_codec(enum AVCodecI
return 0;
}
+#define PREFAUDIO \
+ CONFIG_LIBOPUS_ENCODER ? AV_CODEC_ID_OPUS : \
+ CONFIG_AAC_ENCODER ? AV_CODEC_ID_AAC : \
+ CONFIG_VORBIS_ENCODER ? AV_CODEC_ID_VORBIS : \
+ AV_CODEC_ID_AC3
const AVOutputFormat ff_matroska_muxer = {
.name = "matroska",
.long_name = NULL_IF_CONFIG_SMALL("Matroska"),
.mime_type = "video/x-matroska",
.extensions = "mkv",
.priv_data_size = sizeof(MatroskaMuxContext),
- .audio_codec = CONFIG_LIBVORBIS_ENCODER ?
- AV_CODEC_ID_VORBIS : AV_CODEC_ID_AC3,
- .video_codec = CONFIG_LIBX264_ENCODER ?
- AV_CODEC_ID_H264 : AV_CODEC_ID_MPEG4,
+ .audio_codec = PREFAUDIO,
+ .video_codec =
+ CONFIG_LIBVPX_VP9_ENCODER ? AV_CODEC_ID_VP9 : \
+ CONFIG_LIBX264_ENCODER ? AV_CODEC_ID_H264 : \
+ CONFIG_LIBVPX_VP8_ENCODER ? AV_CODEC_ID_VP8 : \
+ CONFIG_MPEG4_ENCODER ? AV_CODEC_ID_MPEG4 : \
+ AV_CODEC_ID_THEORA,
.init = mkv_init,
.deinit = mkv_deinit,
.write_header = mkv_write_header,
@@ -2954,8 +2962,7 @@ const AVOutputFormat ff_matroska_audio_m
.mime_type = "audio/x-matroska",
.extensions = "mka",
.priv_data_size = sizeof(MatroskaMuxContext),
- .audio_codec = CONFIG_LIBVORBIS_ENCODER ?
- AV_CODEC_ID_VORBIS : AV_CODEC_ID_AC3,
+ .audio_codec = PREFAUDIO,
.video_codec = AV_CODEC_ID_NONE,
.init = mkv_init,
.deinit = mkv_deinit,

@ -0,0 +1,30 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQENBE22rV0BCAC3DzRmA2XlhrqYv9HKoEvNHHf+PzosmCTHmYhWHDqvBxPkSvCl
ipkbvJ4pBnVvcX6mW5QyKhspHm5j1X5ibe9Bt9/chS/obnIobmvF8shSUgjQ0qRW
9c1aWOjvT26SxYQ1y9TmYCFwixeydGFHYKjAim+evGUccni5KMlfPoT3VTPtim78
ufkr3E9Nco/Mobn/8APO0NmLEGWAM6ln/8J/c9h6a1QKnQyBqWfT0YnAaebafFaZ
YwOtRdDG54VbJ4xwcHbCj5cKhTABk/QtBzDvnW4bG+uSpqdHbFZEY2JpURDuj/T3
NudKQGzn0bYNpY1XY2l0pqs/btKHnBW0fVMjABEBAAG0NEZGbXBlZyByZWxlYXNl
IHNpZ25pbmcga2V5IDxmZm1wZWctZGV2ZWxAZmZtcGVnLm9yZz6JATgEEwECACIF
Ak22rV0CGwMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJELQyLwTWdljYKxUH
/1fqzl7SKie2g4t4PJbqUbkLuMsC+CP6gp0dcVZOHkuUYAoD3PM3iVxpLBVyKIXI
g7wMSTAtlIcYnzhWIpnoCBes6/O2Mrq6xHgGeTp6CDcm3LmmSYR1f5KdD8KUaA+l
c/M/1fEnwrSs/UGDk6R6iUmbqwxPsbozlOvmUHOLbDZBnKrk9XfAJdUhAuFACrSA
T+KF1jniz0OfNGd23SaHWRCphoRW9pXDc5FfkdaueBUvBvGv19ZNcDhcxT3/u6z2
DaUFC0rLWqk8obo951jVvi/zOhB94Pw6u1SLvcTq3V1q5URWJtgSbpih9VRqxUbQ
NbXduKGzbHz6Vwpkupz4JRe5AQ0ETbatXQEIANjYrygJi/fn1nlSg5Mz0l9KHDm4
yfWtaOrXUjJcyiGe4G0XXJLGh45qxJ0DOKzi9id+9W4jby+kKuzG9O6Vn0iDeODO
aOGnz4ua7Vu6d0AbYfNXZPWge/GCodo/ZD/qri1tPkLmRtT/sniahwy6LruPNHfF
SRoNIjwbcD/IL+EbY1pL1/IFSzEAA1ZZamgmHgB7o9pwDIkK6HuvHMR/Y5MsoMfV
fWV3ZGtA6v9z51CvnHsHPsADRSnUp7aYtR412SiAO4XodMLTA92L3LxgYhI4ma7D
XZ8jgKg4JkKO+DXmoU63HtRdq/HZjeXJKk1JGJF3zCvP3DyIzZ8LWIjN8t0AEQEA
AYkBHwQYAQIACQUCTbatXQIbDAAKCRC0Mi8E1nZY2LS8B/0bMoUAl4X9D0WQbL4l
U0czCIOKOsvbHpIxivjCnOQxU23+PV5WZdoCCpSuAHGv+2OHzhNrij++P9BNTJeQ
skxdS9FH4MZwy1IRSPrxegSxbCUpBI1rd0Zf7qb9BNPrHPTueWFV1uExOSB2Apsv
WrKo2D8mR0uZAPYfYl2ToFVoa5PR7/+ii9WiJr/flF6qm7hoLpI5Bm4VcZh2GPsJ
9Vo/8x/qOGwtdWHqBykYloKsrwD4U69rjn+d9feLoPBRgoVroXWQttt0sUnyoudz
+x8ETJgPoNK3kQoDagApj4qAt83Ayac3HzNIuEJ7LdvfINIOprujnJ9vH4n04XLg
I4EZ
=Rjbw
-----END PGP PUBLIC KEY BLOCK-----

@ -1,383 +0,0 @@
From 4739b0c97b3378bdaf737171777fe9a71a53eff1 Mon Sep 17 00:00:00 2001
From: Neal Gompa <ngompa@fedoraproject.org>
Date: Wed, 12 Oct 2022 09:41:27 -0400
Subject: [PATCH] avcodec/openh264: Add the ability to dlopen() OpenH264
We can't directly depend on OpenH264, but we can weakly link to it
and gracefully expose the capability.
Co-authored-by: Andreas Schneider <asn@cryptomilk.org>
Co-authored-by: Neal Gompa <ngompa@fedoraproject.org>
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Signed-off-by: Neal Gompa <ngompa@fedoraproject.org>
---
configure | 3 +
libavcodec/Makefile | 1 +
libavcodec/libopenh264.c | 18 +++-
libavcodec/libopenh264_dlopen.c | 147 ++++++++++++++++++++++++++++++++
libavcodec/libopenh264_dlopen.h | 58 +++++++++++++
libavcodec/libopenh264dec.c | 10 +++
libavcodec/libopenh264enc.c | 10 +++
7 files changed, 245 insertions(+), 2 deletions(-)
create mode 100644 libavcodec/libopenh264_dlopen.c
create mode 100644 libavcodec/libopenh264_dlopen.h
diff --git a/configure b/configure
index ba5793b2ff..8855c1a908 100755
--- a/configure
+++ b/configure
@@ -251,6 +251,7 @@ External library support:
--enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
--enable-libopencv enable video filtering via libopencv [no]
--enable-libopenh264 enable H.264 encoding via OpenH264 [no]
+ --enable-libopenh264-dlopen enable H.264 encoding via dlopen()'ed OpenH264 [no]
--enable-libopenjpeg enable JPEG 2000 de/encoding via OpenJPEG [no]
--enable-libopenmpt enable decoding tracked files via libopenmpt [no]
--enable-libopenvino enable OpenVINO as a DNN module backend
@@ -1844,6 +1845,7 @@ EXTERNAL_LIBRARY_LIST="
libmysofa
libopencv
libopenh264
+ libopenh264_dlopen
libopenjpeg
libopenmpt
libopenvino
@@ -6596,6 +6598,7 @@ enabled libopencv && { check_headers opencv2/core/core_c.h &&
require libopencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } ||
require_pkg_config libopencv opencv opencv/cxcore.h cvCreateImageHeader; }
enabled libopenh264 && require_pkg_config libopenh264 openh264 wels/codec_api.h WelsGetCodecVersion
+enabled libopenh264_dlopen && enable libopenh264 && add_cppflags "-I$(dirname `readlink -f $0`)/ffdlopenhdrs/include -DCONFIG_LIBOPENH264_DLOPEN=1"
enabled libopenjpeg && { check_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version ||
{ require_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } }
enabled libopenmpt && require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create -lstdc++ && append libopenmpt_extralibs "-lstdc++"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 457ec58377..08a26fba5f 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1075,6 +1075,7 @@ OBJS-$(CONFIG_LIBMP3LAME_ENCODER) += libmp3lame.o
OBJS-$(CONFIG_LIBOPENCORE_AMRNB_DECODER) += libopencore-amr.o
OBJS-$(CONFIG_LIBOPENCORE_AMRNB_ENCODER) += libopencore-amr.o
OBJS-$(CONFIG_LIBOPENCORE_AMRWB_DECODER) += libopencore-amr.o
+OBJS-$(CONFIG_LIBOPENH264_DLOPEN) += libopenh264_dlopen.o
OBJS-$(CONFIG_LIBOPENH264_DECODER) += libopenh264dec.o libopenh264.o
OBJS-$(CONFIG_LIBOPENH264_ENCODER) += libopenh264enc.o libopenh264.o
OBJS-$(CONFIG_LIBOPENJPEG_DECODER) += libopenjpegdec.o
diff --git a/libavcodec/libopenh264.c b/libavcodec/libopenh264.c
index 0f6d28ed88..a124c3fa1e 100644
--- a/libavcodec/libopenh264.c
+++ b/libavcodec/libopenh264.c
@@ -20,8 +20,13 @@
*/
#include <string.h>
+
+#ifdef CONFIG_LIBOPENH264_DLOPEN
+#include "libopenh264_dlopen.h"
+#else
#include <wels/codec_api.h>
#include <wels/codec_ver.h>
+#endif
#include "libavutil/error.h"
#include "libavutil/log.h"
@@ -52,8 +57,17 @@ int ff_libopenh264_check_version(void *logctx)
// Mingw GCC < 4.7 on x86_32 uses an incorrect/buggy ABI for the WelsGetCodecVersion
// function (for functions returning larger structs), thus skip the check in those
// configurations.
-#if !defined(_WIN32) || !defined(__GNUC__) || !ARCH_X86_32 || AV_GCC_VERSION_AT_LEAST(4, 7)
- OpenH264Version libver = WelsGetCodecVersion();
+ // Also, for dlopened OpenH264, we should not do the version check. It's too punitive.
+#if !defined(_WIN32) || !defined(__GNUC__) || !ARCH_X86_32 || AV_GCC_VERSION_AT_LEAST(4, 7) || !defined(CONFIG_LIBOPENH264_DLOPEN)
+ OpenH264Version libver;
+
+#ifdef CONFIG_LIBOPENH264_DLOPEN
+ if (loadLibOpenH264(logctx)) {
+ return AVERROR_EXTERNAL;
+ }
+#endif
+
+ libver = WelsGetCodecVersion();
if (memcmp(&libver, &g_stCodecVersion, sizeof(libver))) {
av_log(logctx, AV_LOG_ERROR, "Incorrect library version loaded\n");
return AVERROR(EINVAL);
diff --git a/libavcodec/libopenh264_dlopen.c b/libavcodec/libopenh264_dlopen.c
new file mode 100644
index 0000000000..49ea8ff44f
--- /dev/null
+++ b/libavcodec/libopenh264_dlopen.c
@@ -0,0 +1,147 @@
+/*
+ * OpenH264 dlopen code
+ *
+ * Copyright (C) 2022 Andreas Schneider <asn@cryptomilk.org>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <dlfcn.h>
+
+#include "libopenh264_dlopen.h"
+
+/*
+ * The symbol binding makes sure we do not run into strict aliasing issues which
+ * can lead into segfaults.
+ */
+typedef int (*__oh264_WelsCreateSVCEncoder)(ISVCEncoder **);
+typedef void (*__oh264_WelsDestroySVCEncoder)(ISVCEncoder *);
+typedef int (*__oh264_WelsGetDecoderCapability)(SDecoderCapability *);
+typedef long (*__oh264_WelsCreateDecoder)(ISVCDecoder **);
+typedef void (*__oh264_WelsDestroyDecoder)(ISVCDecoder *);
+typedef OpenH264Version (*__oh264_WelsGetCodecVersion)(void);
+typedef void (*__oh264_WelsGetCodecVersionEx)(OpenH264Version *);
+
+#define OH264_SYMBOL_ENTRY(i) \
+ union { \
+ __oh264_##i f; \
+ void *obj; \
+ } _oh264_##i
+
+struct oh264_symbols {
+ OH264_SYMBOL_ENTRY(WelsCreateSVCEncoder);
+ OH264_SYMBOL_ENTRY(WelsDestroySVCEncoder);
+ OH264_SYMBOL_ENTRY(WelsGetDecoderCapability);
+ OH264_SYMBOL_ENTRY(WelsCreateDecoder);
+ OH264_SYMBOL_ENTRY(WelsDestroyDecoder);
+ OH264_SYMBOL_ENTRY(WelsGetCodecVersion);
+ OH264_SYMBOL_ENTRY(WelsGetCodecVersionEx);
+};
+
+/* Symbols are bound by loadLibOpenH264() */
+static struct oh264_symbols openh264_symbols;
+
+int oh264_WelsCreateSVCEncoder(ISVCEncoder **ppEncoder) {
+ return openh264_symbols._oh264_WelsCreateSVCEncoder.f(ppEncoder);
+}
+
+void oh264_WelsDestroySVCEncoder(ISVCEncoder *pEncoder) {
+ return openh264_symbols._oh264_WelsDestroySVCEncoder.f(pEncoder);
+}
+
+int oh264_WelsGetDecoderCapability(SDecoderCapability *pDecCapability) {
+ return openh264_symbols._oh264_WelsGetDecoderCapability.f(pDecCapability);
+}
+
+long oh264_WelsCreateDecoder(ISVCDecoder **ppDecoder) {
+ return openh264_symbols._oh264_WelsCreateDecoder.f(ppDecoder);
+}
+
+void oh264_WelsDestroyDecoder(ISVCDecoder *pDecoder) {
+ return openh264_symbols._oh264_WelsDestroyDecoder.f(pDecoder);
+}
+
+OpenH264Version oh264_WelsGetCodecVersion(void) {
+ return openh264_symbols._oh264_WelsGetCodecVersion.f();
+}
+
+void oh264_WelsGetCodecVersionEx(OpenH264Version *pVersion) {
+ openh264_symbols._oh264_WelsGetCodecVersionEx.f(pVersion);
+}
+
+static void *_oh264_bind_symbol(AVCodecContext *avctx,
+ void *handle,
+ const char *sym_name) {
+ void *sym = NULL;
+
+ sym = dlsym(handle, sym_name);
+ if (sym == NULL) {
+ const char *err = dlerror();
+ av_log(avctx,
+ AV_LOG_WARNING,
+ "%s: Failed to bind %s\n",
+ err,
+ sym_name);
+ return NULL;
+ }
+
+ return sym;
+}
+
+#define oh264_bind_symbol(avctx, handle, sym_name) \
+ if (openh264_symbols._oh264_##sym_name.obj == NULL) { \
+ openh264_symbols._oh264_##sym_name.obj = _oh264_bind_symbol(avctx, handle, #sym_name); \
+ if (openh264_symbols._oh264_##sym_name.obj == NULL) { \
+ return 1; \
+ } \
+ }
+
+int loadLibOpenH264(AVCodecContext *avctx) {
+ static bool initialized = false;
+ void *libopenh264 = NULL;
+ const char *err = NULL;
+
+ if (initialized) {
+ return 0;
+ }
+
+#define OPENH264_LIB "libopenh264.so.7"
+ libopenh264 = dlopen(OPENH264_LIB, RTLD_LAZY);
+ err = dlerror();
+ if (err != NULL) {
+ av_log(avctx, AV_LOG_WARNING,
+ "%s: %s is missing, openh264 support will be disabled\n", err,
+ OPENH264_LIB);
+
+ if (libopenh264 != NULL) {
+ dlclose(libopenh264);
+ }
+ return 1;
+ }
+
+ oh264_bind_symbol(avctx, libopenh264, WelsCreateSVCEncoder);
+ oh264_bind_symbol(avctx, libopenh264, WelsDestroySVCEncoder);
+ oh264_bind_symbol(avctx, libopenh264, WelsGetDecoderCapability);
+ oh264_bind_symbol(avctx, libopenh264, WelsCreateDecoder);
+ oh264_bind_symbol(avctx, libopenh264, WelsDestroyDecoder);
+ oh264_bind_symbol(avctx, libopenh264, WelsGetCodecVersion);
+ oh264_bind_symbol(avctx, libopenh264, WelsGetCodecVersionEx);
+
+ initialized = true;
+
+ return 0;
+}
diff --git a/libavcodec/libopenh264_dlopen.h b/libavcodec/libopenh264_dlopen.h
new file mode 100644
index 0000000000..d7d8bb7cad
--- /dev/null
+++ b/libavcodec/libopenh264_dlopen.h
@@ -0,0 +1,58 @@
+/*
+ * OpenH264 dlopen code
+ *
+ * Copyright (C) 2022 Andreas Schneider <asn@cryptomilk.org>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef HAVE_LIBOPENH264_DLOPEN_H
+#define HAVE_LIBOPENH264_DLOPEN_H
+
+#ifdef CONFIG_LIBOPENH264_DLOPEN
+
+#include <wels/codec_api.h>
+#include <wels/codec_ver.h>
+
+#include "avcodec.h"
+
+int oh264_WelsCreateSVCEncoder(ISVCEncoder **ppEncoder);
+#define WelsCreateSVCEncoder oh264_WelsCreateSVCEncoder
+
+void oh264_WelsDestroySVCEncoder(ISVCEncoder *pEncoder);
+#define WelsDestroySVCEncoder oh264_WelsDestroySVCEncoder
+
+int oh264_WelsGetDecoderCapability(SDecoderCapability *pDecCapability);
+#define WelsGetDecoderCapability oh264_WelsGetDecoderCapability
+
+long oh264_WelsCreateDecoder(ISVCDecoder **ppDecoder);
+#define WelsCreateDecoder oh264_WelsCreateDecoder
+
+void oh264_WelsDestroyDecoder(ISVCDecoder *pDecoder);
+#define WelsDestroyDecoder oh264_WelsDestroyDecoder
+
+OpenH264Version oh264_WelsGetCodecVersion(void);
+#define WelsGetCodecVersion oh264_WelsGetCodecVersion
+
+void oh264_WelsGetCodecVersionEx(OpenH264Version *pVersion);
+#define WelsGetCodecVersionEx oh264_WelsGetCodecVersionEx
+
+int loadLibOpenH264(AVCodecContext *avctx);
+
+#endif /* CONFIG_LIBOPENH264_DLOPEN */
+
+#endif /* HAVE_LIBOPENH264_DLOPEN_H */
diff --git a/libavcodec/libopenh264dec.c b/libavcodec/libopenh264dec.c
index 007f86b619..57aa3bc1d1 100644
--- a/libavcodec/libopenh264dec.c
+++ b/libavcodec/libopenh264dec.c
@@ -19,8 +19,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifdef CONFIG_LIBOPENH264_DLOPEN
+#include "libopenh264_dlopen.h"
+#else
#include <wels/codec_api.h>
#include <wels/codec_ver.h>
+#endif
#include "libavutil/common.h"
#include "libavutil/fifo.h"
@@ -56,6 +60,12 @@ static av_cold int svc_decode_init(AVCodecContext *avctx)
int log_level;
WelsTraceCallback callback_function;
+#ifdef CONFIG_LIBOPENH264_DLOPEN
+ if (loadLibOpenH264(avctx)) {
+ return AVERROR_DECODER_NOT_FOUND;
+ }
+#endif
+
if ((err = ff_libopenh264_check_version(avctx)) < 0)
return AVERROR_DECODER_NOT_FOUND;
diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index db252aace1..75289678da 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -19,8 +19,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifdef CONFIG_LIBOPENH264_DLOPEN
+#include "libopenh264_dlopen.h"
+#else
#include <wels/codec_api.h>
#include <wels/codec_ver.h>
+#endif
#include "libavutil/attributes.h"
#include "libavutil/common.h"
@@ -137,6 +141,12 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
WelsTraceCallback callback_function;
AVCPBProperties *props;
+#ifdef CONFIG_LIBOPENH264_DLOPEN
+ if (loadLibOpenH264(avctx)) {
+ return AVERROR_ENCODER_NOT_FOUND;
+ }
+#endif
+
if ((err = ff_libopenh264_check_version(avctx)) < 0)
return AVERROR_ENCODER_NOT_FOUND;
--
2.36.1

@ -1,60 +0,0 @@
From: Jan Engelhardt <jengelh@inai.de>
Date: 2016-04-10 23:23:53.138440254 +0200
Improve the error messages a bit to say what's really going on
(in light of a reduced build).
---
fftools/ffmpeg.c | 2 +-
fftools/ffmpeg_filter.c | 4 ++--
fftools/ffmpeg_opt.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
Index: ffmpeg-5.0/fftools/ffmpeg.c
===================================================================
--- ffmpeg-5.0.orig/fftools/ffmpeg.c 2022-01-14 19:45:39.000000000 +0100
+++ ffmpeg-5.0/fftools/ffmpeg.c 2022-02-04 08:16:14.606621540 +0100
@@ -2871,7 +2871,7 @@ static int init_input_stream(int ist_ind
if (ist->decoding_needed) {
const AVCodec *codec = ist->dec;
if (!codec) {
- snprintf(error, error_len, "Decoder (codec %s) not found for input stream #%d:%d",
+ snprintf(error, error_len, "This build of ffmpeg does not include a \"%s\" decoder needed for input stream #%d:%d.",
avcodec_get_name(ist->dec_ctx->codec_id), ist->file_index, ist->st->index);
return AVERROR(EINVAL);
}
Index: ffmpeg-5.0/fftools/ffmpeg_filter.c
===================================================================
--- ffmpeg-5.0.orig/fftools/ffmpeg_filter.c 2022-01-14 19:45:39.000000000 +0100
+++ ffmpeg-5.0/fftools/ffmpeg_filter.c 2022-02-04 08:16:14.607621538 +0100
@@ -925,7 +925,7 @@ static int configure_input_filter(Filter
{
if (!ifilter->ist->dec) {
av_log(NULL, AV_LOG_ERROR,
- "No decoder for stream #%d:%d, filtering impossible\n",
+ "This build of ffmpeg does not have a suitable decoder for stream #%d:%d enabled, filtering impossible\n",
ifilter->ist->file_index, ifilter->ist->st->index);
return AVERROR_DECODER_NOT_FOUND;
}
@@ -1094,7 +1094,7 @@ int configure_filtergraph(FilterGraph *f
if (!ost->enc) {
/* identical to the same check in ffmpeg.c, needed because
complex filter graphs are initialized earlier */
- av_log(NULL, AV_LOG_ERROR, "Encoder (codec %s) not found for output stream #%d:%d\n",
+ av_log(NULL, AV_LOG_ERROR, "This build of ffmpeg does not include a \"%s\" encoder needed for output stream #%d:%d.\n",
avcodec_get_name(ost->st->codecpar->codec_id), ost->file_index, ost->index);
ret = AVERROR(EINVAL);
goto fail;
Index: ffmpeg-5.0/fftools/ffmpeg_opt.c
===================================================================
--- ffmpeg-5.0.orig/fftools/ffmpeg_opt.c 2022-01-14 19:45:39.000000000 +0100
+++ ffmpeg-5.0/fftools/ffmpeg_opt.c 2022-02-04 08:16:14.607621538 +0100
@@ -1406,7 +1406,7 @@ static int choose_encoder(OptionsContext
if (!ost->enc) {
av_log(NULL, AV_LOG_FATAL, "Automatic encoder selection failed for "
"output stream #%d:%d. Default encoder for format %s (codec %s) is "
- "probably disabled. Please choose an encoder manually.\n",
+ "probably disabled or this build of ffmpeg does not include that codec. Please choose an encoder manually.\n",
ost->file_index, ost->index, s->oformat->name,
avcodec_get_name(ost->st->codecpar->codec_id));
return AVERROR_ENCODER_NOT_FOUND;

@ -0,0 +1,21 @@
#!/bin/bash
set -e
tmp=$(mktemp -d)
trap cleanup EXIT
cleanup() {
set +e
[ -z "$tmp" -o ! -d "$tmp" ] || rm -rf "$tmp"
}
unset CDPATH
pwd=$(pwd)
date=$(date +%Y%m%d)
pushd "$tmp"
git clone git://git.videolan.org/ffmpeg.git -b oldabi
cd ffmpeg
git archive --prefix="ffmpeg-oldabi-${date}/" --format=tar oldabi | bzip2 > "$pwd"/ffmpeg-oldabi-${date}.tar.bz2
popd

@ -0,0 +1,23 @@
#!/bin/bash
set -e
tmp=$(mktemp -d)
trap cleanup EXIT
cleanup() {
set +e
[ -z "$tmp" -o ! -d "$tmp" ] || rm -rf "$tmp"
}
unset CDPATH
pwd=$(pwd)
date=$(date +%Y%m%d)
pushd "$tmp"
git clone git://git.ffmpeg.org/ffmpeg.git
cd ffmpeg
git checkout release/5.0
git rev-parse HEAD
git archive --prefix="ffmpeg-${date}/" --format=tar release/5.0 | bzip2 > "$pwd"/ffmpeg-${date}.tar.bz2
popd

Binary file not shown.

@ -1,72 +0,0 @@
#!/bin/bash
# Script to identify trivial new headers for new sources added
# Requires: bash, coreutils, tar, xz
# Author: Neal Gompa <ngompa@fedoraproject.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
FFMPEG_VERSION=$1
FF_SRC_DIFF=$2
if [ -z $1 -o -z $2 ]; then
echo "No arguments provided, quitting!"
exit 1
fi
echo "Setting up..."
# Get local directory
LOCALDIR=$(realpath $(dirname $0))
# Create working area
TMPDIR=$(mktemp -d /tmp/ffsrchdrsXXXXXX)
mkdir -pv $TMPDIR
# Extract ffmpeg sources
if [ ! -f "ffmpeg-${FFMPEG_VERSION}.tar.xz" ]; then
echo "No ffmpeg tarball, exiting!"
exit 2
fi
if [ ! -f "$FF_SRC_DIFF" ]; then
echo "No ffmpeg sources diff, exiting!"
exit 2
fi
echo "Extracting upstream ffmpeg sources..."
tar -C ${TMPDIR} -xf ffmpeg-${FFMPEG_VERSION}.tar.xz
echo "Generating header list from diff..."
# Read in ffmpeg_free_sources diff
while IFS= read -r line
do
if [[ $line = \+* ]]; then
ffmpeg_src_file="${line:1}"
if [ -f "${TMPDIR}/ffmpeg-${FFMPEG_VERSION}/${ffmpeg_src_file}" ]; then
ffmpeg_hdr_file="${ffmpeg_src_file%.c}.h"
[ -f "${TMPDIR}/ffmpeg-${FFMPEG_VERSION}/${ffmpeg_hdr_file}" ] && echo "${ffmpeg_hdr_file}" >> ${LOCALDIR}/ffmpeg_free_sources
ffmpeg_hdr_file="${ffmpeg_src_file%.c}_cb.h"
[ -f "${TMPDIR}/ffmpeg-${FFMPEG_VERSION}/${ffmpeg_hdr_file}" ] && echo "${ffmpeg_hdr_file}" >> ${LOCALDIR}/ffmpeg_free_sources
ffmpeg_hdr_file="${ffmpeg_src_file%.c}data.h"
[ -f "${TMPDIR}/ffmpeg-${FFMPEG_VERSION}/${ffmpeg_hdr_file}" ] && echo "${ffmpeg_hdr_file}" >> ${LOCALDIR}/ffmpeg_free_sources
ffmpeg_hdr_file="${ffmpeg_src_file%.c}_data.h"
[ -f "${TMPDIR}/ffmpeg-${FFMPEG_VERSION}/${ffmpeg_hdr_file}" ] && echo "${ffmpeg_hdr_file}" >> ${LOCALDIR}/ffmpeg_free_sources
ffmpeg_hdr_file="${ffmpeg_src_file%.c}_tablegen.h"
[ -f "${TMPDIR}/ffmpeg-${FFMPEG_VERSION}/${ffmpeg_hdr_file}" ] && echo "${ffmpeg_hdr_file}" >> ${LOCALDIR}/ffmpeg_free_sources
fi
fi
done < <(cat $FF_SRC_DIFF)
# Clean up
echo "Clean up workspace..."
rm -rf ${TMPDIR}

File diff suppressed because it is too large Load Diff

@ -1,130 +0,0 @@
#!/bin/bash
#
# Copyright (c) 2022 Andreas Schneider <asn@cryptomilk.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# shellcheck disable=2181
export LC_COLLATE="C.UTF-8"
FF_PKGNAME="ffmpeg"
FF_PKGNAME_SUFFIX="-free"
FF_VERSION="$(rpmspec -P ./*.spec | grep ^Version | sed -e 's/Version:[ ]*//g')"
FF_TARBALL_URL="https://ffmpeg.org/releases/${FF_PKGNAME}-${FF_VERSION}.tar.xz"
FF_TARBALL="$(basename "${FF_TARBALL_URL}")"
FF_GPG_ARMOR_FILE="${FF_TARBALL}.asc"
FF_PKG_DIR="$(pwd)"
FF_KEYRING="${FF_PKG_DIR}/ffmpeg.keyring"
FF_TMPDIR=$(mktemp --tmpdir -d ffmpeg-XXXXXXXX)
FF_PATH="${FF_TMPDIR}/${FF_PKGNAME}-${FF_VERSION}"
cleanup_tmpdir() {
# shellcheck disable=2164
popd 2>/dev/null
rm -rf "${FF_TMPDIR}"
}
trap cleanup_tmpdir SIGINT
cleanup_and_exit()
{
cleanup_tmpdir
if test "$1" = 0 -o -z "$1"; then
exit 0
else
# shellcheck disable=2086
exit ${1}
fi
}
if [[ ! -w "${FF_TARBALL}" ]]; then
echo ">>> Downloading tarball"
wget "${FF_TARBALL_URL}"
fi
if [[ ! -w "${FF_TARBALL}.asc" ]]; then
echo ">>> Downloading signature"
wget "${FF_TARBALL_URL}.asc"
fi
echo ">>> Verifying ${FF_TARBALL} GPG signature"
gpgv2 --quiet --keyring "${FF_KEYRING}" "${FF_GPG_ARMOR_FILE}" "${FF_TARBALL}"
if [ $? -ne 0 ]; then
echo "ERROR: GPG signature verification failed"
cleanup_and_exit 1
fi
echo
echo ">>> Unpacking ${FF_TARBALL}"
tar -xf "${FF_TARBALL}" -C "${FF_TMPDIR}"
if [ $? -ne 0 ]; then
echo "ERROR: Failed to unpack ${FF_TARBALL}"
cleanup_and_exit 1
fi
if [[ ! -r ffmpeg_free_sources ]]; then
echo "ERROR: ffmpeg_free_sources doesn't exist!"
cleanup_and_exit 1
fi
readarray -t keepfiles < ffmpeg_free_sources
pushd "${FF_PATH}" || cleanup_and_exit 1
echo
echo ">>> Cleaning up sources for new tarball ..."
# Get file list from ffmpeg
mapfile -d '' filelist < <(find ./ -type f -printf '%P\0')
# Sort arrays
readarray -t keepfiles_sorted < <(printf '%s\0' "${keepfiles[@]}" | sort -z | xargs -0n1)
readarray -t filelist_sorted < <(printf '%s\0' "${filelist[@]}" | sort -z | xargs -0n1)
# Compare arrays and remove files which are left over
comm -2 -3 -z <(printf '%s\0' "${filelist_sorted[@]}") <(printf '%s\0' "${keepfiles_sorted[@]}") | xargs -0 rm -f
readarray -t removed_files < <(comm -1 -3 -z <(printf '%s\0' "${filelist_sorted[@]}") <(printf '%s\0' "${keepfiles_sorted[@]}") | xargs -0n1)
if [[ "${#removed_files[@]}" -ge 1 ]]; then
if [[ "${#removed_files[@]}" -eq 1 ]] && [[ -z "${removed_files[0]}" ]]; then
echo "... done"
else
echo "File not in upstream tarball anymore (please cleanup 'ffmpeg_free_sources'):"
for f in "${removed_files[@]}"; do
if [[ -z "${f}" ]]; then
continue
fi
echo " * ${f}"
done
fi
fi
echo
popd || cleanup_and_exit 1 # /FF_PATH
pushd "${FF_TMPDIR}" || cleanup_and_exit 1
echo ">>> Create new tarball ${FF_PKGNAME}${FF_PKGNAME_SUFFIX}-${FF_VERSION}.tar.xz ..."
tar -cJf "${FF_PKG_DIR}/${FF_PKGNAME}${FF_PKGNAME_SUFFIX}-${FF_VERSION}.tar.xz" "${FF_PKGNAME}-${FF_VERSION}"
if [ $? -ne 0 ]; then
echo "ERROR: Creating tarball failed"
cleanup_and_exit 1
fi
popd || cleanup_and_exit 1 # /FF_TMPDIR
du -sh "${FF_PKGNAME}${FF_PKGNAME_SUFFIX}-${FF_VERSION}.tar.xz"
echo
cleanup_and_exit 0

@ -1,42 +0,0 @@
#!/bin/bash
# Script to grab headers from existing packages to support dlopen() codec libraries
# Requires: bash, coreutils, curl, bsdtar, dnf, dnf-plugins-core, tar, xz
# Author: Neal Gompa <ngompa@fedoraproject.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
echo "Setting up..."
# Get local directory
LOCALDIR=$(realpath $(dirname $0))
# Create working area
TMPDIR=$(mktemp -d /tmp/mmheadersXXXXXX)
mkdir -pv $TMPDIR
echo "Fetching headers..."
# Get OpenH264 headers
OPENH264_DEVEL=$(dnf -q download --url 'pkgconfig(openh264)')
curl -L $OPENH264_DEVEL | bsdtar -xvf - --include "./usr/include/*" -C $TMPDIR
echo "Generating tarball..."
# Prep tarball tree
mv -v ${TMPDIR}/usr ${TMPDIR}/ffdlopenhdrs
# Generate tarball
tar --transform "s|^${TMPDIR#?}/||" -cJvf ${LOCALDIR}/ffmpeg-dlopen-headers.tar.xz ${TMPDIR}/ffdlopenhdrs
# Clean up
echo "Cleaning up..."
rm -rfv ${TMPDIR}
echo "Tarball created: ${LOCALDIR}/ffmpeg-dlopen-headers.tar.xz"

@ -1,60 +0,0 @@
#!/bin/bash
#
# Copyright (c) 2022 Andreas Schneider <asn@cryptomilk.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# shellcheck disable=2181
export LC_COLLATE="C.UTF-8"
cleanup_and_exit()
{
if test "$1" = 0 -o -z "$1"; then
exit 0
else
# shellcheck disable=2086
exit ${1}
fi
}
echo ">>> Collect information from ${1}"
build_log="$(readlink -f "${1}")"
if [[ -z "${build_log}" ]] || [[ ! -r "${build_log}" ]]; then
echo "Build log doesn't exist: %{build_log}"
cleanup_and_exit 1
fi
asm_files="$(grep "^gcc.*\.c$" "${build_log}" | awk 'NF>1{print $NF}' | sort)"
c_files="$(grep "^nasm.*\.asm$" "${build_log}" | awk 'NF>1{print $NF}' | sort)"
# shellcheck disable=2206
new_sources=(${asm_files}
${c_files})
# Sort arrays
readarray -t new_sources_sorted < <(printf '%s\0' "${new_sources[@]}" | sort -z | xargs -0n1)
# Create a backup for a diff
cp -a ffmpeg_free_sources ffmpeg_free_sources.orig
cp -a ffmpeg_free_sources ffmpeg_free_sources.new
printf "%s\n" "${new_sources_sorted[@]}" >> ffmpeg_free_sources.new
# Update ffmpeg_free_sources
echo ">>> Updating ffmpeg_free_sources"
sort < ffmpeg_free_sources.new | uniq | sed '/^$/d' > ffmpeg_free_sources
echo ">>> Differences in file list"
diff -u ffmpeg_free_sources.orig ffmpeg_free_sources
rm -f ffmpeg_free_sources.new
cleanup_and_exit 0

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save