From a420e0f40a864db0897f5c5c47e46ec1446086a3 Mon Sep 17 00:00:00 2001 From: brian-ch Date: Sat, 21 Jun 2014 23:39:30 +0000 Subject: Update swresample and rational.pas for ffmpeg 2.2 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@3075 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/lib/ffmpeg-2.2/rational.pas | 26 +++++++++++++++ src/lib/ffmpeg-2.2/swresample.pas | 68 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 90 insertions(+), 4 deletions(-) (limited to 'src/lib') diff --git a/src/lib/ffmpeg-2.2/rational.pas b/src/lib/ffmpeg-2.2/rational.pas index 54319362..5795b81f 100644 --- a/src/lib/ffmpeg-2.2/rational.pas +++ b/src/lib/ffmpeg-2.2/rational.pas @@ -63,6 +63,26 @@ type TAVRationalArray = array[0 .. (MaxInt div SizeOf(TAVRational))-1] of TAVRational; PAVRationalArray = ^TAVRationalArray; +(** + * Create a rational. + * Useful for compilers that do not support compound literals. + * @note The return value is not reduced. + */ +static inline AVRational av_make_q(int num, int den) +{ + AVRational r = { num, den }; + return r; +} + +/**) + +(** + * Create a rational. + * Useful for compilers that do not support compound literals. + * @note The return value is not reduced. + *) +function av_make_q(num, den: cint): TAVRational; {$IFDEF HasInline}inline;{$ENDIF} + (** * Compare two rationals. * @param a first rational @@ -204,4 +224,10 @@ begin Result.den := q.num; end; +function av_make_q(num, den: cint): TAVRational; {$IFDEF HasInline}inline;{$ENDIF} +begin + Result.num := q.num; + Result.den := q.den; +end; + end. diff --git a/src/lib/ffmpeg-2.2/swresample.pas b/src/lib/ffmpeg-2.2/swresample.pas index e9efe6c2..8e138d4b 100644 --- a/src/lib/ffmpeg-2.2/swresample.pas +++ b/src/lib/ffmpeg-2.2/swresample.pas @@ -21,10 +21,10 @@ * in the source codes. * - Changes and updates by the UltraStar Deluxe Team * - * Conversions of + * Conversion of * * libswresample/swresample.h: - * version: 0.17.104 + * version: 0.18.100 * *) @@ -54,9 +54,61 @@ uses UConfig; const - {$IF LIBRESAMPLE_VERSION_MAJOR < 1} + (* + * IMPORTANT: The official FFmpeg C headers change very quickly. Often some + * of the data structures are changed so that they become incompatible with + * older header files. The Pascal headers have to be adjusted to those changes, + * otherwise the application might crash randomly or strange bugs (not + * necessarily related to video or audio due to buffer overflows etc.) might + * occur. + * + * In the past users reported problems with USDX that took hours to fix and + * the problem was an unsupported version of FFmpeg. So we decided to disable + * support for future versions of FFmpeg until the headers are revised by us + * for that version as they otherwise most probably will break USDX. + * + * If the headers do not yet support your FFmpeg version you may want to + * adjust the max. version numbers manually but please note: it may work but + * in many cases it does not. The USDX team does NOT PROVIDE ANY SUPPORT + * for the game if the MAX. VERSION WAS CHANGED. + * + * The only safe way to support new versions of FFmpeg is to add the changes + * of the FFmpeg git repository C headers to the Pascal headers. + * You can accelerate this process by posting a patch with the git changes + * translated to Pascal to our bug tracker (please join our IRC chat before + * you start working on it). Simply adjusting the max. versions is NOT a valid + * fix. + *) + + (* Supported version by this header *) + LIBSWRESAMPLE_MAX_VERSION_MAJOR = 0; + LIBSWRESAMPLE_MAX_VERSION_MINOR = 18; + 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); + + (* Min. supported version by this header *) + LIBSWRESAMPLE_MIN_VERSION_MAJOR = 0; + LIBSWRESAMPLE_MIN_VERSION_MINOR = 18; + LIBSWRESAMPLE_MIN_VERSION_RELEASE = 100; + LIBSWRESAMPLE_MIN_VERSION = (LIBSWRESAMPLE_MIN_VERSION_MAJOR * VERSION_MAJOR) + + (LIBSWRESAMPLE_MIN_VERSION_MINOR * VERSION_MINOR) + + (LIBSWRESAMPLE_MIN_VERSION_RELEASE * VERSION_RELEASE); + +(* Check if linked versions are supported *) +{$IF (LIBSWRESAMPLE_VERSION < LIBSWRESAMPLE_MIN_VERSION)} + {$MESSAGE Error 'Linked version of libswresample is too old!'} +{$IFEND} + +(* Check if linked version is supported *) +{$IF (LIBSWRESAMPLE_VERSION > LIBSWRESAMPLE_MAX_VERSION)} + {$MESSAGE Error 'Linked version of libswresample is not yet supported!'} +{$IFEND} + +{$IF LIBRESAMPLE_VERSION_MAJOR < 1} SWR_CH_MAX = 32; (* < Maximum number of channels *) - {$ENDIF} +{$ENDIF} SWR_FLAG_RESAMPLE = 1; (* < Force resampling even if equal sample rate *) type @@ -123,6 +175,14 @@ function swr_alloc(): PSwrContext; function swr_init(s: PSwrContext): cint; cdecl; external swresample; +(** + * Check whether an swr context has been initialized or not. + * + * @return positive if it has been initialized, 0 if not initialized + *) +function swr_is_initialized(s: PSwrContext): cint; + cdecl; external swresample; + (** * Allocate SwrContext if needed and set/reset common parameters. * -- cgit v1.2.3