PKGNAME=ffmpeg
PKGSEC=sound
PKGDEP="alsa-lib bzip2 dav1d fontconfig freetype fribidi glibc gnutls gsm \
        harfbuzz lame libass libbluray libdrm libmodplug libssh libtheora \
        libva libvdpau libvorbis libvpx libwebp libxcb libxml2 opencore-amr \
        opus pulseaudio samba sdl2 soxr speex svt-av1 v4l-utils vulkan x11-lib \
        x264 x265 xvidcore xz zlib"
PKGDEP__AMD64="${PKGDEP} libvpl"
PKGRECOM="avisynthplus"
BUILDDEP="avisynthplus nasm"
BUILDDEP__AMD64="${BUILDDEP} ffnvcodec llvm"
BUILDDEP__ARM64="${BUILDDEP} ffnvcodec llvm"
PKGDEP__RETRO="alsa-lib bzip2 fontconfig freetype fribidi gnutls lame libass \
              libmodplug libtheora libvdpau libvorbis libxcb x264 xvidcore \
              zlib soxr libva libcue libao libmpcdec wavpack libdiscid harfbuzz
              x265"
BUILDDEP__I486="nasm"
PKGDES="Application and runtime suite for handling multimedia files and streams"

PKGBREAK="akode<=14.1.5 alsa-plugins<=1.2.12-2 aubio<=0.4.9-7 \
          audacious<=4.5.1-2 blender<=5.1.0-1 calibre<=9.7.0 \
          citra<=2041 chromaprint<=1.5.1-1 cmus<=2.11.0-3 \
          corsixth<=1:0.68.0 cyanrip<=0.9.3.1 ddnet<=19.0-1 \
          deadbeef<=1.10.0-1 digikam<=8.8.0-3 dolphin-emu<=1:2509-3 \
          dragon<=23.08.5 fceux<=2.6.6+git20251111 ffmpegthumbnailer<=2.2.2-1 \
          ffmpegthumbs<=23.08.5-1 ffms2<=5.0 freerdp<=2:3.24.2 \
          gegl-0.4<=0.4.68-1 goldendict<=1:1.5.0-2 gpac<=2.2.1 \
          gstreamer<=1.28.1-5 gtk-4<=4.14.2 guvcview<=2.1.0-1 \
          haruna<=0.12.3-3 harvid<=0.9.1-1 k3b<=23.08.5-5 \
          k3b-trinity<=14.1.5-1 k9copy-trinity<=14.1.5-1 kdenlive<=23.08.5 \
          kfilemetadata<=5.115.0-4 kid3<=3.9.5-2 kodi<=21.3-3 \
          kodi-inputstream-ffmpegdirect<=21.3.7 kpipewire<=5.27.12 \
          libde265<=1.0.18-1 libplacebo<=7.351.0 localsearch<=3.10.2-2 \
          makemkv<=1.16.4-3 mgba<=0.10.5 mixxx<=2.5.2-1 mlt<=7.38.0-2 \
          mlt-6<=6.26.1-4 mocp<=2.6.0~svn.r3005-2 moonlight-embedded<=2.5.3-2 \
          moonlight-qt<=6.1.0-4 mpd<=0.24.12 mplayer<=1.5-4 mpv<=0.41.0-2 \
          neatvnc<=0.9.5 obs-studio<=32.1.0-2 openjfx<=21.0.5+0 \
          openjfx-11<=11.0.20+1-1 openjfx-8<=8u202+ga-12 openboard<=1.7.7 \
          openmw<=0.50.0-2 openscenegraph<=3:3.6.5-3 osu-lazer<=2024.817.0 \
          owntone<=29.0-2 pcsx2<=2.7.181+patches20260312 pipewire<=1.6.5 \
          ppsspp<=1.20.1-3 qmmp<=1.7.6-1 qt-5<=1:5.15.18+webengine5.15.19+webkit5.212.0+kde20251209-2 \
          qt-6<=6.11.0-3 qtscrcpy<=3.3.3-1 readymedia<=1.3.3-1 \
          qtav<=1.13.0-4 qtox<=1.17.6-1 replaysorcery<=0.6.0 \
          renpy<=8.5.2.26010301 scrcpy<=3.3.4 simplescreenrecorder<=0.4.4 \
          spek-x<=0.9.4-1 sunshine<=2025.924.154138 synfig<=1.5.3 \
          stepmania<=1:5.0.12+git20221114 telegram-desktop<=6.8.2-3 \
          tigervnc<=1.16.2+xserver21.1.21 unpaper<=1:7.0.0 \
          vba-m<=2.2.3-1 vlc<=3.0.21-1 wine<=11.8+gecko2.47.4+mono11.1.0 \
          xine-lib<=1.2.13-10 xjadeo<=0.8.13-1 xpra<=5.0.8-1"

ABTYPE=self
AB_FLAGS_O3=1

# We enabled -Os in the build system.
AB_FLAGS_O3__RETRO=0
# LTO is disabled for Afterglow in the build system.
# LTO breaks certain __asm__ blocks that uses "too many registers":
# libavcodec/x86/vc1dsp_mmx.c: In function ‘put_vc1_shift1_mmx’:
# libavcodec/x86/vc1dsp_mmx.c:310:1: error: ‘asm’ operand has impossible constraints or there are not enough registers
#   310 | MSPEL_FILTER13_8B     (shift1, "0(%1,%4  )", "0(%1,%3,2)", "0(%1,%3  )", "0(%1     )", OP_PUT, put_)
#       | ^
# make[1]: *** [/tmp/ccEYVOC0.mk:254: /tmp/cc9hrJe4.ltrans126.ltrans.o] Error 1
NOLTO__RETRO=1
NOSTATIC=0
PKGEPOCH_SPIRAL=7

# Needed by Afterglow, whereas FAIL_ARCH defaults to mainline-only.
FAIL_ARCH="!(mainline|retro)"
