diff options
author | k-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2015-12-28 15:34:04 +0000 |
---|---|---|
committer | k-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2015-12-28 15:34:04 +0000 |
commit | c2642efc13ede8debbf6993e8edc588a1ebbf984 (patch) | |
tree | 3358b0cb055ecfa89ffdebe4d507120acaebdb75 | |
parent | fdaaa5578955cdbe10d1f3f41feac4a9c05d24ce (diff) | |
download | usdx-c2642efc13ede8debbf6993e8edc588a1ebbf984.tar.gz usdx-c2642efc13ede8debbf6993e8edc588a1ebbf984.tar.xz usdx-c2642efc13ede8debbf6993e8edc588a1ebbf984.zip |
add configure for swresample
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@3154 b956fd51-792f-4845-bead-9b4dfca2ff2c
-rw-r--r-- | Makefile.in | 5 | ||||
-rwxr-xr-x | configure | 243 | ||||
-rw-r--r-- | configure.ac | 5 | ||||
-rw-r--r-- | src/base/UConfig.pas | 3 | ||||
-rw-r--r-- | src/config-darwin.inc | 33 | ||||
-rw-r--r-- | src/config.inc.in | 8 | ||||
-rw-r--r-- | src/lib/ffmpeg-2.7/swresample.pas | 58 | ||||
-rw-r--r-- | src/lib/ffmpeg-2.8/swresample.pas | 60 | ||||
-rw-r--r-- | src/ultrastardx.dpr | 3 |
9 files changed, 347 insertions, 71 deletions
diff --git a/Makefile.in b/Makefile.in index 5bfd09b1..08066cd0 100644 --- a/Makefile.in +++ b/Makefile.in @@ -416,7 +416,8 @@ macosx-app: all @echo "Have fun." @echo "" -AVCODECLIB := $(shell $(OTOOL) -L $(macosx_bundle_path)/MacOS/ultrastardx | grep avcodec | cut -f 1 -d ' ' | cut -f 2 -d '/') +AVCODECLIB := $(shell $(OTOOL) -L $(macosx_bundle_path)/MacOS/ultrastardx | grep avcodec | cut -f 1 -d ' ' | cut -f 4-6 -d '/') +SWRESAMPLELIB := $(shell $(OTOOL) -L $(macosx_bundle_path)/MacOS/libavcodec*.dylib | grep swresample | cut -f 1 -d ' ' | cut -f 4-6 -d '/') .PHONY: macosx-standalone-app macosx-standalone-app: macosx-app # Create double clickable standalone (does not need fink) Mac OS X @@ -443,7 +444,7 @@ macosx-standalone-app: macosx-app $(foreach dylib,$(shell $(OTOOL) -L $(finkLibDir)/libtiff.dylib | grep version | cut -f 1 -d ' ' | grep -v \/System\/Library | grep -v \/usr\/lib),$(install_osx_libraries)) # X11 libs as well, because users may not have installed it on 10.4 - $(foreach dylib,$(shell $(OTOOL) -L /usr/X11R6/lib/libX11.dylib | grep version | cut -f 1 -d ' ' | grep -v \/System\/Library | grep -v \/usr\/lib),$(install_osx_libraries)) + $(foreach dylib,$(shell $(OTOOL) -L /opt/X11/lib/libX11.dylib | grep version | cut -f 1 -d ' ' | grep -v \/System\/Library | grep -v \/usr\/lib),$(install_osx_libraries)) # libpcre.dylib must be installed extra, since it is not linked to the executable but opened using dlopen $(shell $(INSTALL) -m 755 $(finkLibDir)/libpcre.dylib $(macosx_bundle_path)/MacOS) @@ -613,6 +613,12 @@ libprojectM_VERSION_RELEASE libprojectM_VERSION_MINOR libprojectM_VERSION_MAJOR libprojectM_VERSION +DEFINE_HAVE_SWRESAMPLE +libswresample_VERSION_INT +libswresample_VERSION_RELEASE +libswresample_VERSION_MINOR +libswresample_VERSION_MAJOR +libswresample_VERSION DEFINE_HAVE_SWSCALE libswscale_VERSION_INT libswscale_VERSION_RELEASE @@ -792,6 +798,7 @@ libavcodec_VERSION libavformat_VERSION libavutil_VERSION libswscale_VERSION +libswresample_VERSION libprojectM_VERSION libprojectM_INCLUDEDIR libprojectM_DATADIR @@ -1467,6 +1474,8 @@ Some influential environment variables: version of libavutil, overriding pkg-config libswscale_VERSION version of libswscale, overriding pkg-config + libswresample_VERSION + version of libswresample, overriding pkg-config libprojectM_VERSION version of libprojectM, overriding pkg-config libprojectM_INCLUDEDIR @@ -7119,6 +7128,240 @@ $as_echo "[$FFMPEG_VERSION]" >&6; } +# 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 +$as_echo_n "checking for libswresample... " >&6; } + if test x"$with_libswresample" = xnocheck; then + # do not call pkg-config, use user settings + have_lib="yes" + elif test x"$with_libswresample" != xno; then + # check if package exists + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libswresample\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libswresample") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + + have_lib="yes" + libswresample_LIBS=`$PKG_CONFIG --libs --silence-errors "libswresample"` + libswresample_LIBDIRS=`$PKG_CONFIG --libs-only-L --silence-errors "libswresample"` + libswresample_LIBDIRS=` + echo "$libswresample_LIBDIRS" | $SED 's/^[ \t]*//' | $SED 's/[ \t]*$//' +` + # add library directories to LIBS (ignore *_LIBS for now) + if test -n "$libswresample_LIBDIRS"; then + LIBS="$LIBS $libswresample_LIBDIRS" + fi + +fi + fi + if test x$have_lib = xyes; then + libswresample_HAVE="yes" + if test -n "$libswresample_LIBDIRS"; then + # show additional lib-dirs + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes ($libswresample_LIBDIRS)" >&5 +$as_echo "yes ($libswresample_LIBDIRS)" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + fi + else + libswresample_HAVE="no" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + # check if package is required + if test xno = xyes -o x"$with_libswresample" = xyes ; then + # print error message and quit + err_msg=`$PKG_CONFIG --errors-to-stdout --print-errors "libswresample"` + as_fn_error $? " + +$err_msg + +Alternatively, you may set --with-libswresample=nocheck and the environment +variables libswresample_[...] (see configure --help) +to appropriate values to avoid the need to call pkg-config. + +See the pkg-config man page for more details. +" "$LINENO" 5 + fi + fi + + + if test x$libswresample_HAVE = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking version of libswresample" >&5 +$as_echo_n "checking version of libswresample... " >&6; } + + + # check if variable was defined by the user + if test -z "$libswresample_VERSION"; then + # if not, get it from pkg-config + if test x$libswresample_HAVE = xyes; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libswresample\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libswresample") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + libswresample_VERSION=`$PKG_CONFIG --modversion --silence-errors "libswresample"` +else + # print error message and quit + err_msg=`$PKG_CONFIG --errors-to-stdout --print-errors "libswresample"` + as_fn_error $? " + +$err_msg + +If --with-libswresample=nocheck is defined the environment variable +libswresample_VERSION +must be set to avoid the need to call pkg-config. + +See the pkg-config man page for more details. +" "$LINENO" 5 + + +fi + fi + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: [$libswresample_VERSION]" >&5 +$as_echo "[$libswresample_VERSION]" >&6; } + else + libswresample_VERSION="0.0.0" + fi + + version=$libswresample_VERSION + + # strip leading non-numeric tokens + # (necessary for some ffmpeg-packages in ubuntu) + # example: 0d.51.1.0 -> 51.1.0 + version=`echo $version | sed 's/^[^.]*[^0-9.][^.]*\.//'` + + # replace "." and "-" with " " and ignore trailing tokens. + # 1.23.4-r2 will be splitted to [maj=1, min=23, rel=4]. + # In addition we delete everything after the first character + # which is not 0-9. + # 1.3a4-r32 will be [maj=1, min=3, rel=0]. + read major minor release ignore <<eof + `echo $version | tr '.-' ' ' | sed 's/[^0-9\ ].*//'` +eof + # Note: Do NOT indent the eof-delimiter + # We use a here-document (<<< here-strings not POSIX compatible) + + test -z $major && major=0 + test -z $minor && minor=0 + test -z $release && release=0 + + # strip preceding 0s and set unset version-parts to 0 + libswresample_VERSION_MAJOR=$(($major)) + libswresample_VERSION_MINOR=$(($minor)) + libswresample_VERSION_RELEASE=$(($release)) + # integer representation: MMMmmmrrr (M:major,m:minor,r:release) + # can be used if pkg-config's comparison fails + libswresample_VERSION_INT=$(($libswresample_VERSION_MAJOR*1000000+$libswresample_VERSION_MINOR*1000+$libswresample_VERSION_RELEASE)) + + + + + + + + # for avutil: map library version to ffmpeg version + if test libswresample = "libavutil"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking version of ffmpeg" >&5 +$as_echo_n "checking version of ffmpeg... " >&6; } + if test $libswresample_VERSION_INT -le 60000000; then + if test $libswresample_VERSION_INT -ge 54031100; then + FFMPEG_VERSION="2.8" + elif test $libswresample_VERSION_INT -ge 54027100; then + FFMPEG_VERSION="2.7" + elif test $libswresample_VERSION_INT -ge 54020100; then + FFMPEG_VERSION="2.6" + elif test $libswresample_VERSION_INT -ge 54015100; then + FFMPEG_VERSION="2.5" + elif test $libswresample_VERSION_INT -ge 54007001; then + FFMPEG_VERSION="2.4" + elif test $libswresample_VERSION_INT -ge 52066100; then + FFMPEG_VERSION="2.2" + elif test $libswresample_VERSION_INT -ge 52048100; then + FFMPEG_VERSION="2.1" + elif test $libswresample_VERSION_INT -ge 52038100; then + FFMPEG_VERSION="2.0" + elif test $libswresample_VERSION_INT -ge 52018100; then + FFMPEG_VERSION="1.2" + elif test $libswresample_VERSION_INT -ge 52013100; then + FFMPEG_VERSION="1.1" + elif test $libswresample_VERSION_INT -ge 51073101; then + FFMPEG_VERSION="1.0" + elif test $libswresample_VERSION_INT -ge 51054100; then + FFMPEG_VERSION="0.11" + elif test $libswresample_VERSION_INT -ge 51034101; then + FFMPEG_VERSION="0.10" + elif test $libswresample_VERSION_INT -ge 51032000; then + FFMPEG_VERSION="0.9" + elif test $libswresample_VERSION_INT -ge 51009001; then + FFMPEG_VERSION="0.8" + elif test $libswresample_VERSION_INT -ge 50043000; then + FFMPEG_VERSION="0.7" + else + FFMPEG_VERSION="0" + fi + else + FFMPEG_VERSION="0" + fi + + version=$FFMPEG_VERSION + + # strip leading non-numeric tokens + # (necessary for some ffmpeg-packages in ubuntu) + # example: 0d.51.1.0 -> 51.1.0 + version=`echo $version | sed 's/^[^.]*[^0-9.][^.]*\.//'` + + # replace "." and "-" with " " and ignore trailing tokens. + # 1.23.4-r2 will be splitted to [maj=1, min=23, rel=4]. + # In addition we delete everything after the first character + # which is not 0-9. + # 1.3a4-r32 will be [maj=1, min=3, rel=0]. + read major minor release ignore <<eof + `echo $version | tr '.-' ' ' | sed 's/[^0-9\ ].*//'` +eof + # Note: Do NOT indent the eof-delimiter + # We use a here-document (<<< here-strings not POSIX compatible) + + test -z $major && major=0 + test -z $minor && minor=0 + test -z $release && release=0 + + # strip preceding 0s and set unset version-parts to 0 + FFMPEG_VERSION_MAJOR=$(($major)) + FFMPEG_VERSION_MINOR=$(($minor)) + FFMPEG_VERSION_RELEASE=$(($release)) + # integer representation: MMMmmmrrr (M:major,m:minor,r:release) + # can be used if pkg-config's comparison fails + FFMPEG_VERSION_INT=$(($FFMPEG_VERSION_MAJOR*1000000+$FFMPEG_VERSION_MINOR*1000+$FFMPEG_VERSION_RELEASE)) + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: [$FFMPEG_VERSION]" >&5 +$as_echo "[$FFMPEG_VERSION]" >&6; } + fi + + + if [ x$libswresample_HAVE = xyes ]; then + DEFINE_HAVE_SWRESAMPLE=DEFINE + else + DEFINE_HAVE_SWRESAMPLE=UNDEF + fi + + + # find projectM version libprojectM_PKG="libprojectM >= 0.98" diff --git a/configure.ac b/configure.ac index aa3b7a7d..6a814555 100644 --- a/configure.ac +++ b/configure.ac @@ -242,6 +242,11 @@ 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) + # find projectM version libprojectM_PKG="libprojectM >= 0.98" PKG_HAVE([libprojectM], [$libprojectM_PKG], no) diff --git a/src/base/UConfig.pas b/src/base/UConfig.pas index 2e1c59f0..79964451 100644 --- a/src/base/UConfig.pas +++ b/src/base/UConfig.pas @@ -181,6 +181,9 @@ const LIBSWSCALE_VERSION = (LIBSWSCALE_VERSION_MAJOR * VERSION_MAJOR) + (LIBSWSCALE_VERSION_MINOR * VERSION_MINOR) + (LIBSWSCALE_VERSION_RELEASE * VERSION_RELEASE); + LIBSWRESAMPLE_VERSION = (LIBSWRESAMPLE_VERSION_MAJOR * VERSION_MAJOR) + + (LIBSWRESAMPLE_VERSION_MINOR * VERSION_MINOR) + + (LIBSWRESAMPLE_VERSION_RELEASE * VERSION_RELEASE); {$ENDIF} {$ENDIF} diff --git a/src/config-darwin.inc b/src/config-darwin.inc index 8bde009d..37ce2334 100644 --- a/src/config-darwin.inc +++ b/src/config-darwin.inc @@ -7,19 +7,19 @@ {$IF Defined(IncludeConstants)} LUA_LIB_NAME = 'lua'; - LUA_VERSION_INT = 5001005; - LUA_VERSION_RELEASE = '5'; - LUA_VERSION_MINOR = '1'; + LUA_VERSION_INT = 5002004; + LUA_VERSION_RELEASE = '4'; + LUA_VERSION_MINOR = '2'; LUA_VERSION_MAJOR = '5'; - LUA_VERSION = '5.1.5'; + LUA_VERSION = '5.2.4'; {$IFEND} {$DEFINE HaveFFmpeg} {$IF Defined(HaveFFmpeg)} {$MACRO ON} {$IFNDEF FFMPEG_DIR} - {$IF (4 > 0) or (2 > 0)} - {$DEFINE FFMPEG_DIR := 'ffmpeg-2.4'} + {$IF (8 > 0) or (2 > 0)} + {$DEFINE FFMPEG_DIR := 'ffmpeg-2.8'} {$DEFINE FF_API_OLD_DECODE_AUDIO} {$ELSE} {$DEFINE FFMPEG_DIR := 'ffmpeg'} @@ -27,21 +27,21 @@ {$IFEND} {$ENDIF} {$IF Defined(IncludeConstants)} - FFMPEG_VERSION_INT = 2004000; + FFMPEG_VERSION_INT = 2008000; av__codec = 'libavcodec'; LIBAVCODEC_VERSION_MAJOR = 56; - LIBAVCODEC_VERSION_MINOR = 1; + LIBAVCODEC_VERSION_MINOR = 60; LIBAVCODEC_VERSION_RELEASE = 100; av__format = 'libavformat'; LIBAVFORMAT_VERSION_MAJOR = 56; - LIBAVFORMAT_VERSION_MINOR = 4; + LIBAVFORMAT_VERSION_MINOR = 40; LIBAVFORMAT_VERSION_RELEASE = 101; av__util = 'libavutil'; LIBAVUTIL_VERSION_MAJOR = 54; - LIBAVUTIL_VERSION_MINOR = 7; + LIBAVUTIL_VERSION_MINOR = 31; LIBAVUTIL_VERSION_RELEASE = 100; {$IFEND} {$IFEND} @@ -50,8 +50,16 @@ {$IF Defined(HaveSWScale) and Defined(IncludeConstants)} sw__scale = 'libswscale'; LIBSWSCALE_VERSION_MAJOR = 3; - LIBSWSCALE_VERSION_MINOR = 0; - LIBSWSCALE_VERSION_RELEASE = 100; + LIBSWSCALE_VERSION_MINOR = 1; + 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} {$UNDEF HaveProjectM} @@ -71,6 +79,7 @@ {$DEFINE HaveLibPcre} {$IF Defined(HaveLibPcre) and Defined(IncludeConstants)} + LIBPCRE_LIBNAME = ''; LIBPCRE_LIBDIR = '/sw/lib/libpcre1'; {$IFEND} diff --git a/src/config.inc.in b/src/config.inc.in index 232ba615..94dc5a2c 100644 --- a/src/config.inc.in +++ b/src/config.inc.in @@ -54,6 +54,14 @@ LIBSWSCALE_VERSION_RELEASE = @libswscale_VERSION_RELEASE@; {$IFEND} +{$@DEFINE_HAVE_SWRESAMPLE@ HaveSWResample} +{$IF Defined(HaveSWScale) 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} {$IF Defined(HaveProjectM) and Defined(IncludeConstants)} ProjectM_DataDir = '@libprojectM_DATADIR@'; diff --git a/src/lib/ffmpeg-2.7/swresample.pas b/src/lib/ffmpeg-2.7/swresample.pas index 9bb4568c..f4a4e468 100644 --- a/src/lib/ffmpeg-2.7/swresample.pas +++ b/src/lib/ffmpeg-2.7/swresample.pas @@ -48,6 +48,8 @@ interface uses ctypes, rational, + avcodec, + avutil, {$IFDEF UNIX} BaseUnix, {$ENDIF} @@ -86,7 +88,7 @@ const LIBSWRESAMPLE_MAX_VERSION_RELEASE = 100; LIBSWRESAMPLE_MAX_VERSION = (LIBSWRESAMPLE_MAX_VERSION_MAJOR * VERSION_MAJOR) + (LIBSWRESAMPLE_MAX_VERSION_MINOR * VERSION_MINOR) + - (LIBSWRESAMPLE_VERSION_RELEASE * VERSION_RELEASE); + (LIBSWRESAMPLE_MAX_VERSION_RELEASE * VERSION_RELEASE); (* Min. supported version by this header *) LIBSWRESAMPLE_MIN_VERSION_MAJOR = 1; @@ -106,7 +108,7 @@ const {$MESSAGE Error 'Linked version of libswresample is not yet supported!'} {$IFEND} -{$IF LIBRESAMPLE_VERSION_MAJOR < 1} +{$IF LIBSWRESAMPLE_VERSION_MAJOR < 1} SWR_CH_MAX = 32; (* < Maximum number of channels *) {$ENDIF} SWR_FLAG_RESAMPLE = 1; (* < Force resampling even if equal sample rate *) @@ -162,7 +164,7 @@ type * @see av_opt_find(). *) function swr_get_class(): PAVClass; - cdecl; external swresample; + cdecl; external sw__resample; (** * Allocate SwrContext. @@ -174,7 +176,7 @@ function swr_get_class(): PAVClass; * @return NULL on error, allocated context otherwise *) function swr_alloc(): PSwrContext; - cdecl; external swresample; + cdecl; external sw__resample; (** * Initialize context after user parameters have been set. @@ -186,7 +188,7 @@ function swr_alloc(): PSwrContext; * @return AVERROR error code in case of failure. *) function swr_init(s: PSwrContext): cint; - cdecl; external swresample; + cdecl; external sw__resample; (** * Check whether an swr context has been initialized or not. @@ -196,7 +198,7 @@ function swr_init(s: PSwrContext): cint; * @return positive if it has been initialized, 0 if not initialized *) function swr_is_initialized(s: PSwrContext): cint; - cdecl; external swresample; + cdecl; external sw__resample; (** * Allocate SwrContext if needed and set/reset common parameters. @@ -206,12 +208,12 @@ function swr_is_initialized(s: PSwrContext): cint; * on the allocated context. * * @param s existing Swr context if available, or NULL if not - * @param out_ch_layout output channel layout (AV_CH_LAYOUT_*) - * @param out_sample_fmt output sample format (AV_SAMPLE_FMT_*). - * @param out_sample_rate output sample rate (frequency in Hz) - * @param in_ch_layout input channel layout (AV_CH_LAYOUT_*) - * @param in_sample_fmt input sample format (AV_SAMPLE_FMT_*). - * @param in_sample_rate input sample rate (frequency in Hz) + * @param out_ch_layout output channel layout (AV_CH_LAYOUT_* ) + * @param out_sample_fmt output sample format (AV_SAMPLE_FMT_* ). + * @param out_sample_rate output sample rate (frequency in Hz ) + * @param in_ch_layout input channel layout (AV_CH_LAYOUT_* ) + * @param in_sample_fmt input sample format (AV_SAMPLE_FMT_* ). + * @param in_sample_rate input sample rate (frequency in Hz ) * @param log_offset logging level offset * @param log_ctx parent logging context, can be NULL * @@ -222,7 +224,7 @@ function swr_alloc_set_opts(s: PSwrContext; out_ch_layout: cint64; out_sample_fmt: TAVSampleFormat; out_sample_rate: cint; in_ch_layout: cint64; in_sample_fmt: TAVSampleFormat; in_sample_rate: cint; log_offset: cint; log_ctx: pointer): PSwrContext; - cdecl; external swresample; + cdecl; external sw__resample; (** * Free the given SwrContext and set the pointer to NULL. @@ -230,7 +232,7 @@ function swr_alloc_set_opts(s: PSwrContext; * @param[in] s a pointer to a pointer to Swr context *) procedure swr_free(s: PPSwrContext); - cdecl; external swresample; + cdecl; external sw__resample; (** * Closes the context so that swr_is_initialized() returns 0. @@ -243,7 +245,7 @@ procedure swr_free(s: PPSwrContext); * @param[in,out] s Swr context to be closed *) procedure swr_close(s: PSwrContext); - cdecl; external swresample; + cdecl; external sw__resample; (** * Convert audio. @@ -266,7 +268,7 @@ procedure swr_close(s: PSwrContext); *) function swr_convert(s: PSwrContext; var out_: PByte; out_count: cint; var in_: {const} PByte; in_count: cint): cint; - cdecl; external swresample; + cdecl; external sw__resample; (** * Convert the next timestamp from input to output @@ -282,7 +284,7 @@ function swr_convert(s: PSwrContext; var out_: PByte; out_count: cint; * @return the output timestamp for the next output sample *) function swr_next_pts(s: PSwrContext; pts: cint64): cint64; - cdecl; external swresample; + cdecl; external sw__resample; (** * Activate resampling compensation ("soft" compensation). This function is @@ -301,7 +303,7 @@ function swr_next_pts(s: PSwrContext; pts: cint64): cint64; * @li swr_init() fails when called. *) function swr_set_compensation(s: PSwrContext; sample_delta: cint; compensation_distance: cint): cint; - cdecl; external swresample; + cdecl; external sw__resample; (** * Set a customized input channel mapping. @@ -312,7 +314,7 @@ function swr_set_compensation(s: PSwrContext; sample_delta: cint; compensation_d * @return >= 0 on success, or AVERROR error code in case of failure. *) function swr_set_channel_mapping(s: PSwrContext; {const} channel_map: pcint): cint; - cdecl; external swresample; + cdecl; external sw__resample; (** * Set a customized remix matrix. @@ -324,7 +326,7 @@ function swr_set_channel_mapping(s: PSwrContext; {const} channel_map: pcint): ci * @return >= 0 on success, or AVERROR error code in case of failure. *) function swr_set_matrix(s: PSwrContext; {const} matrix: pcdouble; stride: cint): cint; - cdecl; external swresample; + cdecl; external sw__resample; (** * Drops the specified number of output samples. @@ -338,7 +340,7 @@ function swr_set_matrix(s: PSwrContext; {const} matrix: pcdouble; stride: cint): * @return >= 0 on success, or a negative AVERROR code on failure *) function swr_drop_output(s: PSwrContext; count: cint): cint; - cdecl; external swresample; + cdecl; external sw__resample; (** * Injects the specified number of silence samples. @@ -352,7 +354,7 @@ function swr_drop_output(s: PSwrContext; count: cint): cint; * @return >= 0 on success, or a negative AVERROR code on failure *) function swr_inject_silence(s: PSwrContext; count: cint): cint; - cdecl; external swresample; + cdecl; external sw__resample; (** * Gets the delay the next input sample will experience relative to the next output sample. @@ -379,7 +381,7 @@ function swr_inject_silence(s: PSwrContext; count: cint): cint; * @returns the delay in 1 / @c base units. *) function swr_get_delay(s: PSwrContext; base: cint64): cint64; - cdecl; external swresample; + cdecl; external sw__resample; (** * Find an upper bound on the number of samples that the next swr_convert @@ -397,8 +399,8 @@ function swr_get_delay(s: PSwrContext; base: cint64): cint64; * @returns an upper bound on the number of samples that the next swr_convert * will output or a negative value to indicate an error *) -function swr_get_out_samples(s: PSwrContext; in_samples: cint); - cdecl; external swresample; +procedure swr_get_out_samples(s: PSwrContext; in_samples: cint); + cdecl; external sw__resample; (** * Return the @ref LIBSWRESAMPLE_VERSION_INT constant. @@ -409,7 +411,7 @@ function swr_get_out_samples(s: PSwrContext; in_samples: cint); * @returns the unsigned int-typed version *) function swresample_version(): cuint; - cdecl; external swresample; + cdecl; external sw__resample; (** * Return the swr build-time configuration. @@ -417,7 +419,7 @@ function swresample_version(): cuint; * @returns the build-time @c ./configure flags *) function swresample_configuration(): PAnsiChar; - cdecl; external swresample; + cdecl; external sw__resample; (** * Return the swr license. @@ -425,7 +427,7 @@ function swresample_configuration(): PAnsiChar; * @returns the license of libswresample, determined at build-time *) function swresample_license(): PAnsiChar; - cdecl; external swresample; + cdecl; external sw__resample; implementation diff --git a/src/lib/ffmpeg-2.8/swresample.pas b/src/lib/ffmpeg-2.8/swresample.pas index 9bb4568c..277e10b1 100644 --- a/src/lib/ffmpeg-2.8/swresample.pas +++ b/src/lib/ffmpeg-2.8/swresample.pas @@ -48,6 +48,8 @@ interface uses ctypes, rational, + avcodec, + avutil, {$IFDEF UNIX} BaseUnix, {$ENDIF} @@ -86,7 +88,7 @@ const LIBSWRESAMPLE_MAX_VERSION_RELEASE = 100; LIBSWRESAMPLE_MAX_VERSION = (LIBSWRESAMPLE_MAX_VERSION_MAJOR * VERSION_MAJOR) + (LIBSWRESAMPLE_MAX_VERSION_MINOR * VERSION_MINOR) + - (LIBSWRESAMPLE_VERSION_RELEASE * VERSION_RELEASE); + (LIBSWRESAMPLE_MAX_VERSION_RELEASE * VERSION_RELEASE); (* Min. supported version by this header *) LIBSWRESAMPLE_MIN_VERSION_MAJOR = 1; @@ -103,10 +105,10 @@ const (* Check if linked version is supported *) {$IF (LIBSWRESAMPLE_VERSION > LIBSWRESAMPLE_MAX_VERSION)} - {$MESSAGE Error 'Linked version of libswresample is not yet supported!'} +// {$MESSAGE Error 'Linked version of libswresample is not yet supported!'} {$IFEND} -{$IF LIBRESAMPLE_VERSION_MAJOR < 1} +{$IF LIBSWRESAMPLE_VERSION_MAJOR < 1} SWR_CH_MAX = 32; (* < Maximum number of channels *) {$ENDIF} SWR_FLAG_RESAMPLE = 1; (* < Force resampling even if equal sample rate *) @@ -162,7 +164,7 @@ type * @see av_opt_find(). *) function swr_get_class(): PAVClass; - cdecl; external swresample; + cdecl; external sw__resample; (** * Allocate SwrContext. @@ -174,7 +176,7 @@ function swr_get_class(): PAVClass; * @return NULL on error, allocated context otherwise *) function swr_alloc(): PSwrContext; - cdecl; external swresample; + cdecl; external sw__resample; (** * Initialize context after user parameters have been set. @@ -186,7 +188,7 @@ function swr_alloc(): PSwrContext; * @return AVERROR error code in case of failure. *) function swr_init(s: PSwrContext): cint; - cdecl; external swresample; + cdecl; external sw__resample; (** * Check whether an swr context has been initialized or not. @@ -196,7 +198,7 @@ function swr_init(s: PSwrContext): cint; * @return positive if it has been initialized, 0 if not initialized *) function swr_is_initialized(s: PSwrContext): cint; - cdecl; external swresample; + cdecl; external sw__resample; (** * Allocate SwrContext if needed and set/reset common parameters. @@ -206,12 +208,12 @@ function swr_is_initialized(s: PSwrContext): cint; * on the allocated context. * * @param s existing Swr context if available, or NULL if not - * @param out_ch_layout output channel layout (AV_CH_LAYOUT_*) - * @param out_sample_fmt output sample format (AV_SAMPLE_FMT_*). - * @param out_sample_rate output sample rate (frequency in Hz) - * @param in_ch_layout input channel layout (AV_CH_LAYOUT_*) - * @param in_sample_fmt input sample format (AV_SAMPLE_FMT_*). - * @param in_sample_rate input sample rate (frequency in Hz) + * @param out_ch_layout output channel layout (AV_CH_LAYOUT_* ) + * @param out_sample_fmt output sample format (AV_SAMPLE_FMT_* ). + * @param out_sample_rate output sample rate (frequency in Hz ) + * @param in_ch_layout input channel layout (AV_CH_LAYOUT_* ) + * @param in_sample_fmt input sample format (AV_SAMPLE_FMT_* ). + * @param in_sample_rate input sample rate (frequency in Hz ) * @param log_offset logging level offset * @param log_ctx parent logging context, can be NULL * @@ -222,7 +224,7 @@ function swr_alloc_set_opts(s: PSwrContext; out_ch_layout: cint64; out_sample_fmt: TAVSampleFormat; out_sample_rate: cint; in_ch_layout: cint64; in_sample_fmt: TAVSampleFormat; in_sample_rate: cint; log_offset: cint; log_ctx: pointer): PSwrContext; - cdecl; external swresample; + cdecl; external sw__resample; (** * Free the given SwrContext and set the pointer to NULL. @@ -230,7 +232,7 @@ function swr_alloc_set_opts(s: PSwrContext; * @param[in] s a pointer to a pointer to Swr context *) procedure swr_free(s: PPSwrContext); - cdecl; external swresample; + cdecl; external sw__resample; (** * Closes the context so that swr_is_initialized() returns 0. @@ -243,7 +245,7 @@ procedure swr_free(s: PPSwrContext); * @param[in,out] s Swr context to be closed *) procedure swr_close(s: PSwrContext); - cdecl; external swresample; + cdecl; external sw__resample; (** * Convert audio. @@ -266,7 +268,7 @@ procedure swr_close(s: PSwrContext); *) function swr_convert(s: PSwrContext; var out_: PByte; out_count: cint; var in_: {const} PByte; in_count: cint): cint; - cdecl; external swresample; + cdecl; external sw__resample; (** * Convert the next timestamp from input to output @@ -282,7 +284,7 @@ function swr_convert(s: PSwrContext; var out_: PByte; out_count: cint; * @return the output timestamp for the next output sample *) function swr_next_pts(s: PSwrContext; pts: cint64): cint64; - cdecl; external swresample; + cdecl; external sw__resample; (** * Activate resampling compensation ("soft" compensation). This function is @@ -301,7 +303,7 @@ function swr_next_pts(s: PSwrContext; pts: cint64): cint64; * @li swr_init() fails when called. *) function swr_set_compensation(s: PSwrContext; sample_delta: cint; compensation_distance: cint): cint; - cdecl; external swresample; + cdecl; external sw__resample; (** * Set a customized input channel mapping. @@ -312,7 +314,7 @@ function swr_set_compensation(s: PSwrContext; sample_delta: cint; compensation_d * @return >= 0 on success, or AVERROR error code in case of failure. *) function swr_set_channel_mapping(s: PSwrContext; {const} channel_map: pcint): cint; - cdecl; external swresample; + cdecl; external sw__resample; (** * Set a customized remix matrix. @@ -324,7 +326,7 @@ function swr_set_channel_mapping(s: PSwrContext; {const} channel_map: pcint): ci * @return >= 0 on success, or AVERROR error code in case of failure. *) function swr_set_matrix(s: PSwrContext; {const} matrix: pcdouble; stride: cint): cint; - cdecl; external swresample; + cdecl; external sw__resample; (** * Drops the specified number of output samples. @@ -338,7 +340,7 @@ function swr_set_matrix(s: PSwrContext; {const} matrix: pcdouble; stride: cint): * @return >= 0 on success, or a negative AVERROR code on failure *) function swr_drop_output(s: PSwrContext; count: cint): cint; - cdecl; external swresample; + cdecl; external sw__resample; (** * Injects the specified number of silence samples. @@ -352,7 +354,7 @@ function swr_drop_output(s: PSwrContext; count: cint): cint; * @return >= 0 on success, or a negative AVERROR code on failure *) function swr_inject_silence(s: PSwrContext; count: cint): cint; - cdecl; external swresample; + cdecl; external sw__resample; (** * Gets the delay the next input sample will experience relative to the next output sample. @@ -379,7 +381,7 @@ function swr_inject_silence(s: PSwrContext; count: cint): cint; * @returns the delay in 1 / @c base units. *) function swr_get_delay(s: PSwrContext; base: cint64): cint64; - cdecl; external swresample; + cdecl; external sw__resample; (** * Find an upper bound on the number of samples that the next swr_convert @@ -397,8 +399,8 @@ function swr_get_delay(s: PSwrContext; base: cint64): cint64; * @returns an upper bound on the number of samples that the next swr_convert * will output or a negative value to indicate an error *) -function swr_get_out_samples(s: PSwrContext; in_samples: cint); - cdecl; external swresample; +procedure swr_get_out_samples(s: PSwrContext; in_samples: cint); + cdecl; external sw__resample; (** * Return the @ref LIBSWRESAMPLE_VERSION_INT constant. @@ -409,7 +411,7 @@ function swr_get_out_samples(s: PSwrContext; in_samples: cint); * @returns the unsigned int-typed version *) function swresample_version(): cuint; - cdecl; external swresample; + cdecl; external sw__resample; (** * Return the swr build-time configuration. @@ -417,7 +419,7 @@ function swresample_version(): cuint; * @returns the build-time @c ./configure flags *) function swresample_configuration(): PAnsiChar; - cdecl; external swresample; + cdecl; external sw__resample; (** * Return the swr license. @@ -425,7 +427,7 @@ function swresample_configuration(): PAnsiChar; * @returns the license of libswresample, determined at build-time *) function swresample_license(): PAnsiChar; - cdecl; external swresample; + cdecl; external sw__resample; implementation diff --git a/src/ultrastardx.dpr b/src/ultrastardx.dpr index d5cf85e6..0e02bdc4 100644 --- a/src/ultrastardx.dpr +++ b/src/ultrastardx.dpr @@ -99,6 +99,7 @@ uses {$ENDIF} {$IFDEF UseSWScale} swscale in 'lib\' + FFMPEG_DIR + '\swscale.pas', + 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', @@ -108,6 +109,7 @@ 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} {$ENDIF} UMediaCore_FFmpeg in 'media\UMediaCore_FFmpeg.pas', @@ -353,6 +355,7 @@ uses const sLineBreak = {$IFDEF LINUX} AnsiChar(#10) {$ENDIF} + {$IFDEF DARWIN} AnsiChar(#10) {$ENDIF} {$IFDEF MSWINDOWS} AnsiString(#13#10) {$ENDIF}; var I: Integer; |