Skip to content

Commit

Permalink
Merge pull request #944 from complexlogic/modernize_ffmpeg
Browse files Browse the repository at this point in the history
Modernize FFmpeg Codebase
  • Loading branch information
barbeque-squared authored Jan 12, 2025
2 parents 225398a + aa779e9 commit fc15e33
Show file tree
Hide file tree
Showing 443 changed files with 84 additions and 287,683 deletions.
4 changes: 2 additions & 2 deletions COMPILING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
If you want to help the project by coding patches, we suggest you to use the [Lazarus 1.6](http://www.lazarus-ide.org/) or newer integrated development environment.
For linking and running the game, the following libraries are also required:
- SDL2, SDL2_image
- FFmpeg 7.0 or older
- FFmpeg 4.0-7.1
- SQLite 3
- [BASS](http://www.un4seen.com/bass.html)
- some fonts like DejaVu
Expand All @@ -27,7 +27,7 @@ Prebuilt DLLs for SDL2, SDL2_image, FFmpeg, SQLite, PortAudio, and Lua can be fo
### Install prequisites
#### Linux/BSD
Required libraries:
- Debian/Ubuntu: `git automake make gcc fpc libsdl2-image-dev libavformat-dev libswscale-dev libsqlite3-dev libfreetype6-dev portaudio19-dev libportmidi-dev liblua5.3-dev libopencv-videoio-dev fonts-dejavu`
- Debian/Ubuntu: `git automake make gcc fpc libsdl2-image-dev libavformat-dev libavcodec-dev libavutil-dev libswresample-dev libswscale-dev libsqlite3-dev libfreetype6-dev portaudio19-dev libportmidi-dev liblua5.3-dev libopencv-videoio-dev fonts-dejavu`
- Fedora: `git automake make gcc fpc SDL2_image-devel ffmpeg-devel sqlite-devel freetype-devel portaudio-devel portmidi-devel lua-devel opencv-devel`
- Archlinux: see the dependencies in the [ultrastardx-git](https://aur.archlinux.org/packages/ultrastardx-git) AUR package

Expand Down
63 changes: 7 additions & 56 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -272,29 +272,22 @@ if [[ x$libavcodec_HAVE = xno -a x$FPC_PLATFORM = xdarwin ]]; then
PKG_HAVE([libavcodec], [libavcodec], yes)
fi
PKG_VERSION([libavcodec], [libavcodec])
AC_CHECK_LIB([avcodec], [avcodec_decode_audio], [HAVE_AVCODEC_DECODE_AUDIO="yes"])
AC_CHECK_LIB([avcodec], [avcodec_decode_audio2], [HAVE_AVCODEC_DECODE_AUDIO2="yes"])
AC_CHECK_LIB([avcodec], [img_convert], [HAVE_IMG_CONVERT="yes"])
PKG_HAVE([libavformat], [libavformat], yes)
PKG_VERSION([libavformat], [libavformat])
PKG_HAVE([libavutil], [libavutil], yes)
PKG_VERSION([libavutil], [libavutil])
if [[ x$libavcodec_HAVE = xyes -a x$libavformat_HAVE = xyes -a x$libavutil_HAVE = xyes ]]; then
PKG_HAVE([libswscale], [libswscale], yes)
PKG_VERSION([libswscale], [libswscale])
PKG_HAVE([libswresample], [libswresample], yes)
PKG_VERSION([libswresample], [libswresample])

if [[ x$libavcodec_HAVE = xyes -a x$libavformat_HAVE = xyes -a x$libavutil_HAVE = xyes -a x$libswscale_HAVE = xyes -a x$libswresample_HAVE = xyes ]]; then
ffmpeg_HAVE=yes
else
ffmpeg_HAVE=no
fi
AC_SUBST_DEFINE(HAVE_FFMPEG, $ffmpeg_HAVE)

# find FFMpeg's swscale lib (just if FFMpeg is compiled in GPL mode)
PKG_HAVE([libswscale], [libswscale], no)
PKG_VERSION([libswscale], [libswscale])
AC_SUBST_DEFINE(HAVE_SWSCALE, $libswscale_HAVE)

PKG_HAVE([libswresample], [libswresample], no)
PKG_VERSION([libswresample], [libswresample])
AC_SUBST_DEFINE(HAVE_SWRESAMPLE, $libswresample_HAVE)

# map avutil library version to ffmpeg version
AC_MSG_CHECKING([version of ffmpeg])
# the order is ([avutil], [avcodec], [avformat], [swscale], [swresample])
Expand All @@ -306,52 +299,10 @@ elif FFMPEG_LIBS_COMPATIBLE([57017100], [59018100], [59016100], [6004100], [4003
FFMPEG_VERSION="5.0"
elif FFMPEG_LIBS_COMPATIBLE([56014100], [58018100], [58012100], [5001100], [3001100]); then
FFMPEG_VERSION="4.0"
elif FFMPEG_LIBS_COMPATIBLE([55078100], [57107100], [57083100], [4008100], [2009100]); then
FFMPEG_VERSION="3.4"
elif FFMPEG_LIBS_COMPATIBLE([55034100], [57064100,57093100], [57056100], [4002100], [2003100]); then
FFMPEG_VERSION="3.2" # and 3.3
elif FFMPEG_LIBS_COMPATIBLE([55027100,55028100], [57048101], [57040101], [4001100], [2001100]); then
FFMPEG_VERSION="3.1"
elif FFMPEG_LIBS_COMPATIBLE([55017103,55018100], [57024102,57037100], [57025100], [4000100], [2000101]); then
FFMPEG_VERSION="3.0"
elif FFMPEG_LIBS_COMPATIBLE([54030100], [56060100], [56040101], [3001101], [1002101]); then
FFMPEG_VERSION="2.8"
elif test $libavutil_VERSION_INT -le 54030100 -a $libavutil_VERSION_INT -ge 54027100; then
FFMPEG_VERSION="2.7"
elif test $libavutil_VERSION_INT -eq 54020100; then
FFMPEG_VERSION="2.6"
elif test $libavutil_VERSION_INT -eq 54015100; then
FFMPEG_VERSION="2.5"
elif test $libavutil_VERSION_INT -eq 54007100; then
FFMPEG_VERSION="2.4"
elif test $libavutil_VERSION_INT -eq 52066100; then
FFMPEG_VERSION="2.2"
elif test $libavutil_VERSION_INT -le 52048101 -a $libavutil_VERSION_INT -ge 52048100; then
FFMPEG_VERSION="2.1"
elif test $libavutil_VERSION_INT -le 52038100 -a $libavutil_VERSION_INT -ge 52038000; then
FFMPEG_VERSION="2.0"
elif test $libavutil_VERSION_INT -le 52018100 -a $libavutil_VERSION_INT -ge 52018000; then
FFMPEG_VERSION="1.2"
elif test $libavutil_VERSION_INT -le 52013100 -a $libavutil_VERSION_INT -ge 52013000; then
FFMPEG_VERSION="1.1"
elif test $libavutil_VERSION_INT -le 51073101 -a $libavutil_VERSION_INT -ge 51073000; then
FFMPEG_VERSION="1.0"
elif test $libavutil_VERSION_INT -le 51054100 -a $libavutil_VERSION_INT -ge 51054000; then
FFMPEG_VERSION="0.11"
elif test $libavutil_VERSION_INT -le 51035100 -a $libavutil_VERSION_INT -ge 51034101; then
FFMPEG_VERSION="0.10"
elif test $libavutil_VERSION_INT -eq 51032000; then
FFMPEG_VERSION="0.9"
elif test $libavutil_VERSION_INT -le 51022002 -a $libavutil_VERSION_INT -ge 51009001; then
FFMPEG_VERSION="0.8"
elif test $libavutil_VERSION_INT -eq 50043000; then
FFMPEG_VERSION="0.7"
elif test $libavutil_VERSION_INT -le 50024000 -a $libavutil_VERSION_INT -ge 49000001; then
FFMPEG_VERSION="0"
else
AC_MSG_ERROR([
Unsupported ffmpeg version, most recent version supported is 7.0.
Unsupported ffmpeg version, most recent version supported is 7.0, oldest version supported is 4.0.
])
fi
AX_EXTRACT_VERSION(FFMPEG, $FFMPEG_VERSION)
Expand Down
4 changes: 0 additions & 4 deletions src/base/UConfig.pas
Original file line number Diff line number Diff line change
Expand Up @@ -172,17 +172,13 @@ interface
(LIBAVUTIL_VERSION_MINOR * VERSION_MINOR) +
(LIBAVUTIL_VERSION_RELEASE * VERSION_RELEASE);

{$IFDEF HaveSWScale}
LIBSWSCALE_VERSION = (LIBSWSCALE_VERSION_MAJOR * VERSION_MAJOR) +
(LIBSWSCALE_VERSION_MINOR * VERSION_MINOR) +
(LIBSWSCALE_VERSION_RELEASE * VERSION_RELEASE);
{$ENDIF}

{$IFDEF HaveSWResample}
LIBSWRESAMPLE_VERSION = (LIBSWRESAMPLE_VERSION_MAJOR * VERSION_MAJOR) +
(LIBSWRESAMPLE_VERSION_MINOR * VERSION_MINOR) +
(LIBSWRESAMPLE_VERSION_RELEASE * VERSION_RELEASE);
{$ENDIF}

{$ENDIF}

Expand Down
7 changes: 1 addition & 6 deletions src/config-win.inc
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,7 @@
{$IF Defined(HaveFFmpeg)}
{$MACRO ON}
{$IFNDEF FFMPEG_DIR}
{$IF (0 > 0) or (7 > 0)}
{$DEFINE FFMPEG_DIR := 'ffmpeg-7.0'}
{$ELSE}
{$DEFINE FFMPEG_DIR := 'ffmpeg'}
{$DEFINE useOLD_FFMPEG}
{$IFEND}
{$DEFINE FFMPEG_DIR := 'ffmpeg-7.0'}
{$ENDIF}
{$IF Defined(IncludeConstants)}
FFMPEG_VERSION_INT = 7000000;
Expand Down
61 changes: 22 additions & 39 deletions src/config.inc.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,55 +19,38 @@
{$IF Defined(HaveFFmpeg)}
{$MACRO ON}
{$IFNDEF FFMPEG_DIR}
{$IF (@FFMPEG_VERSION_MINOR@ > 0) or (@FFMPEG_VERSION_MAJOR@ > 0)}
{$DEFINE FFMPEG_DIR := 'ffmpeg-@FFMPEG_VERSION_MAJOR@.@FFMPEG_VERSION_MINOR@'}
{$DEFINE FF_API_OLD_DECODE_AUDIO}
{$ELSE}
{$DEFINE FFMPEG_DIR := 'ffmpeg'}
{$DEFINE useOLD_FFMPEG}
{$IFEND}
{$DEFINE FFMPEG_DIR := 'ffmpeg-@FFMPEG_VERSION_MAJOR@.@FFMPEG_VERSION_MINOR@'}
{$ENDIF}
{$IF Defined(IncludeConstants)}
FFMPEG_VERSION_INT = @FFMPEG_VERSION_INT@;

av__codec = 'libavcodec';
LIBAVCODEC_VERSION_MAJOR = @libavcodec_VERSION_MAJOR@;
LIBAVCODEC_VERSION_MINOR = @libavcodec_VERSION_MINOR@;
LIBAVCODEC_VERSION_RELEASE = @libavcodec_VERSION_RELEASE@;
av__codec = 'libavcodec';
LIBAVCODEC_VERSION_MAJOR = @libavcodec_VERSION_MAJOR@;
LIBAVCODEC_VERSION_MINOR = @libavcodec_VERSION_MINOR@;
LIBAVCODEC_VERSION_RELEASE = @libavcodec_VERSION_RELEASE@;

av__format = 'libavformat';
LIBAVFORMAT_VERSION_MAJOR = @libavformat_VERSION_MAJOR@;
LIBAVFORMAT_VERSION_MINOR = @libavformat_VERSION_MINOR@;
LIBAVFORMAT_VERSION_RELEASE = @libavformat_VERSION_RELEASE@;
av__format = 'libavformat';
LIBAVFORMAT_VERSION_MAJOR = @libavformat_VERSION_MAJOR@;
LIBAVFORMAT_VERSION_MINOR = @libavformat_VERSION_MINOR@;
LIBAVFORMAT_VERSION_RELEASE = @libavformat_VERSION_RELEASE@;

av__util = 'libavutil';
LIBAVUTIL_VERSION_MAJOR = @libavutil_VERSION_MAJOR@;
LIBAVUTIL_VERSION_MINOR = @libavutil_VERSION_MINOR@;
LIBAVUTIL_VERSION_RELEASE = @libavutil_VERSION_RELEASE@;
{$IFEND}

{$IF (@FFMPEG_VERSION_MAJOR@ < 4)}
{$DEFINE UseFFmpegResample}
{$IFEND}
av__util = 'libavutil';
LIBAVUTIL_VERSION_MAJOR = @libavutil_VERSION_MAJOR@;
LIBAVUTIL_VERSION_MINOR = @libavutil_VERSION_MINOR@;
LIBAVUTIL_VERSION_RELEASE = @libavutil_VERSION_RELEASE@;

{$IFEND}
sw__scale = 'libswscale';
LIBSWSCALE_VERSION_MAJOR = @libswscale_VERSION_MAJOR@;
LIBSWSCALE_VERSION_MINOR = @libswscale_VERSION_MINOR@;
LIBSWSCALE_VERSION_RELEASE = @libswscale_VERSION_RELEASE@;

{$@DEFINE_HAVE_SWSCALE@ HaveSWScale}
{$IF Defined(HaveSWScale) and Defined(IncludeConstants)}
sw__scale = 'libswscale';
LIBSWSCALE_VERSION_MAJOR = @libswscale_VERSION_MAJOR@;
LIBSWSCALE_VERSION_MINOR = @libswscale_VERSION_MINOR@;
LIBSWSCALE_VERSION_RELEASE = @libswscale_VERSION_RELEASE@;
sw__resample = 'libswresample';
LIBSWRESAMPLE_VERSION_MAJOR = @libswresample_VERSION_MAJOR@;
LIBSWRESAMPLE_VERSION_MINOR = @libswresample_VERSION_MINOR@;
LIBSWRESAMPLE_VERSION_RELEASE = @libswresample_VERSION_RELEASE@;
{$IFEND}
{$IFEND}

{* libswresample was introduced with FFmpeg 0.9 *}
{$@DEFINE_HAVE_SWRESAMPLE@ HaveSWResample}
{$IF Defined(HaveSWResample) and Defined(IncludeConstants)}
sw__resample = 'libswresample';
LIBSWRESAMPLE_VERSION_MAJOR = @libswresample_VERSION_MAJOR@;
LIBSWRESAMPLE_VERSION_MINOR = @libswresample_VERSION_MINOR@;
LIBSWRESAMPLE_VERSION_RELEASE = @libswresample_VERSION_RELEASE@;
{$IFEND}

{$@DEFINE_HAVE_PROJECTM@ HaveProjectM}
{$@DEFINE_USE_LOCAL_PROJECTM_PRESETS@ UseLocalProjectMPresets}
Expand Down
12 changes: 0 additions & 12 deletions src/lib/ffmpeg-0.10/How to update the ffmpeg files.txt

This file was deleted.

6 changes: 0 additions & 6 deletions src/lib/ffmpeg-0.10/ToDo.txt

This file was deleted.

Loading

0 comments on commit fc15e33

Please sign in to comment.