From 4dea02ed19873fbd8ee454a1b1147ad10436ab91 Mon Sep 17 00:00:00 2001 From: brian-ch Date: Sun, 14 Feb 2016 18:13:57 +0000 Subject: Only try to include libswresample if it is installed and we have pascal headers for that specific version git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@3194 b956fd51-792f-4845-bead-9b4dfca2ff2c --- configure | 6 +++++- configure.ac | 12 ++++++++---- src/base/UConfig.pas | 7 +++++-- src/config-win.inc | 8 ++++++++ src/switches.inc | 5 ++++- src/ultrastardx.dpr | 8 ++++++-- 6 files changed, 36 insertions(+), 10 deletions(-) diff --git a/configure b/configure index 7e0f2274..7687b36c 100755 --- a/configure +++ b/configure @@ -7128,7 +7128,9 @@ $as_echo "[$FFMPEG_VERSION]" >&6; } -# find FFMpeg's swresample lib (just if FFMpeg is compiled in GPL mode) +# the first swresample header translation was in ffmpeg 2.1 (avutil 52.48.100) +if [ "$libavutil_VERSION_MAJOR" -gt 80 ] || ([ "$libavutil_VERSION_MAJOR" -eq 52 ] && [ "$libavutil_VERSION_MINOR" -ge 48 ]); then + # find FFMpeg's swresample lib (just if FFMpeg is compiled in GPL mode) have_lib="no" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libswresample" >&5 @@ -7362,6 +7364,8 @@ $as_echo "[$FFMPEG_VERSION]" >&6; } +fi + # find projectM version libprojectM_PKG="libprojectM >= 0.98" diff --git a/configure.ac b/configure.ac index 6a814555..346f0488 100644 --- a/configure.ac +++ b/configure.ac @@ -242,10 +242,14 @@ PKG_HAVE([libswscale], [libswscale], no) PKG_VERSION([libswscale], [libswscale]) AC_SUBST_DEFINE(HAVE_SWSCALE, $libswscale_HAVE) -# find FFMpeg's swresample lib (just if FFMpeg is compiled in GPL mode) -PKG_HAVE([libswresample], [libswresample], no) -PKG_VERSION([libswresample], [libswresample]) -AC_SUBST_DEFINE(HAVE_SWRESAMPLE, $libswresample_HAVE) +# the first swresample header translation was in ffmpeg 2.1 (avutil 52.48.100) +if [[ "$libavutil_VERSION_MAJOR" -gt 52 ]] || ([[ "$libavutil_VERSION_MAJOR" -eq 52 ]] && [[ "$libavutil_VERSION_MINOR" -ge 48 ]]); then + # find FFMpeg's swresample lib (just if FFMpeg is compiled in GPL mode) + PKG_HAVE([libswresample], [libswresample], no) + PKG_VERSION([libswresample], [libswresample]) + AC_SUBST_DEFINE(HAVE_SWRESAMPLE, $libswresample_HAVE) + +fi # find projectM version libprojectM_PKG="libprojectM >= 0.98" diff --git a/src/base/UConfig.pas b/src/base/UConfig.pas index 79964451..d54ca439 100644 --- a/src/base/UConfig.pas +++ b/src/base/UConfig.pas @@ -181,9 +181,12 @@ const 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); + (LIBSWRESAMPLE_VERSION_MINOR * VERSION_MINOR) + + (LIBSWRESAMPLE_VERSION_RELEASE * VERSION_RELEASE); {$ENDIF} {$ENDIF} diff --git a/src/config-win.inc b/src/config-win.inc index 6d32043b..8e0bf5cd 100644 --- a/src/config-win.inc +++ b/src/config-win.inc @@ -53,6 +53,14 @@ LIBSWSCALE_VERSION_RELEASE = 101; {$IFEND} +{$DEFINE HaveSWResample} +{$IF Defined(HaveSWScale) and Defined(IncludeConstants)} + sw__resample = 'libswresample'; + LIBSWRESAMPLE_VERSION_MAJOR = 1; + LIBSWRESAMPLE_VERSION_MINOR = 2; + LIBSWRESAMPLE_VERSION_RELEASE = 101; +{$IFEND} + {$DEFINE HaveProjectM} {$IF Defined(HaveProjectM) and Defined(IncludeConstants)} ProjectM_DataDir = 'Visuals\projectM'; diff --git a/src/switches.inc b/src/switches.inc index e54bbcfa..59f72049 100644 --- a/src/switches.inc +++ b/src/switches.inc @@ -102,6 +102,9 @@ {$IFDEF HaveSWScale} {$DEFINE UseSWScale} {$ENDIF} + {$IFDEF HaveSWResample} + {$DEFINE UseSWResample} + {$ENDIF} {$ENDIF} {$IFDEF HaveLibsamplerate} @@ -127,4 +130,4 @@ {$DEFINE UsePortaudio} {$IFEND} -{$ENDIF PASDOC} \ No newline at end of file +{$ENDIF PASDOC} diff --git a/src/ultrastardx.dpr b/src/ultrastardx.dpr index d5f675a5..89777968 100644 --- a/src/ultrastardx.dpr +++ b/src/ultrastardx.dpr @@ -99,7 +99,9 @@ uses {$ENDIF} {$IFDEF UseSWScale} swscale in 'lib\' + FFMPEG_DIR + '\swscale.pas', - swresample in 'lib\' + FFMPEG_DIR + '\swresample.pas', + {$ENDIF} + {$IFDEF UseSWResample} + swresample in 'lib\' + FFMPEG_DIR + '\swresample.pas', {$ENDIF} {$ELSE} // speak: This is for Delphi. Change version as needed! avcodec in 'lib\ffmpeg-0.10\avcodec.pas', @@ -109,7 +111,9 @@ uses avio in 'lib\ffmpeg-0.10\avio.pas', {$IFDEF UseSWScale} swscale in 'lib\ffmpeg-0.10\swscale.pas', - swresample in 'lib\ffmpeg-0.10\swresample.pas', + {$ENDIF} + {$IFDEF UseSWResample} + swresample in 'lib\ffmpeg-0.10\swresample.pas', {$ENDIF} {$ENDIF} UMediaCore_FFmpeg in 'media\UMediaCore_FFmpeg.pas', -- cgit v1.2.3