aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authork-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2012-04-20 19:54:15 +0000
committerk-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2012-04-20 19:54:15 +0000
commit170917432bdc4e1c52d0fe7ac9bf539cacc2f5f8 (patch)
treea3777f7cc3680b76d298a520a407170ef8143285 /src
parent9bc840d97697bc6445aab17368bad58d02018a2a (diff)
downloadusdx-170917432bdc4e1c52d0fe7ac9bf539cacc2f5f8.tar.gz
usdx-170917432bdc4e1c52d0fe7ac9bf539cacc2f5f8.tar.xz
usdx-170917432bdc4e1c52d0fe7ac9bf539cacc2f5f8.zip
new detection of ffmpeg version. API changes: SampleFormat -> AVSampleFormat. Configure still needs update. Special thanks to lotan.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2856 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'src')
-rw-r--r--src/config-darwin.inc29
-rw-r--r--src/config.inc.in13
-rw-r--r--src/lib/ffmpeg/avcodec.pas26
-rw-r--r--src/media/UAudioDecoder_FFmpeg.pas1
-rw-r--r--src/media/UMediaCore_FFmpeg.pas14
-rw-r--r--src/ultrastardx.dpr21
6 files changed, 61 insertions, 43 deletions
diff --git a/src/config-darwin.inc b/src/config-darwin.inc
index 5eb38d76..395a375f 100644
--- a/src/config-darwin.inc
+++ b/src/config-darwin.inc
@@ -10,28 +10,39 @@
{$IFEND}
{$DEFINE HaveFFmpeg}
-{$IF Defined(HaveFFmpeg) and Defined(IncludeConstants)}
+{$IF Defined(HaveFFmpeg)}
+ {$MACRO ON}
+ {$IFNDEF FFMPEG_DIR}
+ {$IF 7 > 0}
+ {$DEFINE FFMPEG_DIR := 'ffmpeg-0.7'}
+ {$ELSE}
+ {$DEFINE FFMPEG_DIR := 'ffmpeg'}
+ {$IFEND}
+ {$IFEND}
+ {$IF Defined(IncludeConstants)}
av__codec = 'libavcodec';
- LIBAVCODEC_VERSION_MAJOR = 51;
- LIBAVCODEC_VERSION_MINOR = 49;
+ LIBAVCODEC_VERSION_MAJOR = 52;
+ LIBAVCODEC_VERSION_MINOR = 123;
LIBAVCODEC_VERSION_RELEASE = 0;
av__format = 'libavformat';
LIBAVFORMAT_VERSION_MAJOR = 52;
- LIBAVFORMAT_VERSION_MINOR = 2;
+ LIBAVFORMAT_VERSION_MINOR = 111;
LIBAVFORMAT_VERSION_RELEASE = 0;
av__util = 'libavutil';
- LIBAVUTIL_VERSION_MAJOR = 49;
- LIBAVUTIL_VERSION_MINOR = 6;
+ LIBAVUTIL_VERSION_MAJOR = 50;
+ LIBAVUTIL_VERSION_MINOR = 43;
LIBAVUTIL_VERSION_RELEASE = 0;
+
+ {$IFEND}
{$IFEND}
{$DEFINE HaveSWScale}
{$IF Defined(HaveSWScale) and Defined(IncludeConstants)}
sw__scale = 'libswscale';
- LIBSWSCALE_VERSION_MAJOR = 0;
- LIBSWSCALE_VERSION_MINOR = 5;
+ LIBSWSCALE_VERSION_MAJOR = 2;
+ LIBSWSCALE_VERSION_MINOR = 0;
LIBSWSCALE_VERSION_RELEASE = 0;
{$IFEND}
@@ -52,7 +63,7 @@
{$DEFINE HaveLibPcre}
{$IF Defined(HaveLibPcre) and Defined(IncludeConstants)}
- LIBPCRE_LIBDIR = '/sw/lib';
+ LIBPCRE_LIBDIR = '/sw/lib/libpcre1';
{$IFEND}
{$UNDEF HavePortmixer}
diff --git a/src/config.inc.in b/src/config.inc.in
index d57c7ab4..9fdac067 100644
--- a/src/config.inc.in
+++ b/src/config.inc.in
@@ -10,7 +10,16 @@
{$IFEND}
{$@DEFINE_HAVE_FFMPEG@ HaveFFmpeg}
-{$IF Defined(HaveFFmpeg) and Defined(IncludeConstants)}
+{$IF Defined(HaveFFmpeg)}
+ {$MACRO ON}
+ {$IFNDEF FFMPEG_DIR}
+ {$IF @FFMPEG_VERSION_MINOR@ > 0}
+ {$DEFINE FFMPEG_DIR := 'ffmpeg-@FFMPEG_VERSION_MAJOR@.@FFMPEG_VERSION_MINOR@'}
+ {$ELSE}
+ {$DEFINE FFMPEG_DIR := 'ffmpeg'}
+ {$IFEND}
+ {$IFEND}
+ {$IF Defined(IncludeConstants)}
av__codec = 'libavcodec';
LIBAVCODEC_VERSION_MAJOR = @libavcodec_VERSION_MAJOR@;
LIBAVCODEC_VERSION_MINOR = @libavcodec_VERSION_MINOR@;
@@ -25,6 +34,8 @@
LIBAVUTIL_VERSION_MAJOR = @libavutil_VERSION_MAJOR@;
LIBAVUTIL_VERSION_MINOR = @libavutil_VERSION_MINOR@;
LIBAVUTIL_VERSION_RELEASE = @libavutil_VERSION_RELEASE@;
+
+ {$IFEND}
{$IFEND}
{$@DEFINE_HAVE_SWSCALE@ HaveSWScale}
diff --git a/src/lib/ffmpeg/avcodec.pas b/src/lib/ffmpeg/avcodec.pas
index 0a436a48..c390a187 100644
--- a/src/lib/ffmpeg/avcodec.pas
+++ b/src/lib/ffmpeg/avcodec.pas
@@ -526,17 +526,17 @@ type
* all in native endian
*}
type
- TSampleFormat = (
- SAMPLE_FMT_NONE = -1,
- SAMPLE_FMT_U8, ///< unsigned 8 bits
- SAMPLE_FMT_S16, ///< signed 16 bits
- SAMPLE_FMT_S32, ///< signed 32 bits
- SAMPLE_FMT_FLT, ///< float
- SAMPLE_FMT_DBL, ///< double
- SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if dynamically linking to libavcodec
+ TAVSampleFormat = (
+ AV_SAMPLE_FMT_NONE = -1,
+ AV_SAMPLE_FMT_U8, ///< unsigned 8 bits
+ AV_SAMPLE_FMT_S16, ///< signed 16 bits
+ AV_SAMPLE_FMT_S32, ///< signed 32 bits
+ AV_SAMPLE_FMT_FLT, ///< float
+ AV_SAMPLE_FMT_DBL, ///< double
+ AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if dynamically linking to libavcodec
);
- _TSampleFormatArray = array [0 .. MaxInt div SizeOf(TSampleFormat)-1] of TSampleFormat;
- PSampleFormatArray = ^_TSampleFormatArray;
+ TAVSampleFormatArray = array [0 .. MaxInt div SizeOf(TAVSampleFormat)-1] of TAVSampleFormat;
+ PAVSampleFormatArray = ^TAVSampleFormatArray;
const
{* Audio channel masks *}
@@ -1686,7 +1686,7 @@ type
* - encoding: Set by user.
* - decoding: Set by libavcodec.
*)
- sample_fmt: TSampleFormat; ///< sample format
+ sample_fmt: TAVSampleFormat; ///< sample format
(* The following data should not be initialized. *)
(**
@@ -3143,7 +3143,7 @@ type
supported_samplerates: {const} PCint; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
{$IFEND}
{$IF LIBAVCODEC_VERSION >= 51062000} // 51.62.0
- sample_fmts: {const} PSampleFormatArray; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
+ sample_fmts: {const} PAVSampleFormatArray; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
{$IFEND}
{$IF LIBAVCODEC_VERSION >= 52002000} // 52.2.0
channel_layouts: {const} PCint64; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0
@@ -4343,7 +4343,7 @@ function av_get_bits_per_sample(codec_id: TCodecID): cint;
* @param[in] sample_fmt the sample format
* @return Number of bits per sample or zero if unknown for the given sample format.
*)
-function av_get_bits_per_sample_format(sample_fmt: TSampleFormat): cint;
+function av_get_bits_per_sample_format(sample_fmt: TAVSampleFormat): cint;
cdecl; external av__codec;
{$IFEND}
diff --git a/src/media/UAudioDecoder_FFmpeg.pas b/src/media/UAudioDecoder_FFmpeg.pas
index b44c7b11..d5295135 100644
--- a/src/media/UAudioDecoder_FFmpeg.pas
+++ b/src/media/UAudioDecoder_FFmpeg.pas
@@ -64,7 +64,6 @@ uses
avformat,
avutil,
avio,
- mathematics, // used for av_rescale_q
rational,
UMusic,
UIni,
diff --git a/src/media/UMediaCore_FFmpeg.pas b/src/media/UMediaCore_FFmpeg.pas
index eb136995..f04ee7eb 100644
--- a/src/media/UMediaCore_FFmpeg.pas
+++ b/src/media/UMediaCore_FFmpeg.pas
@@ -92,7 +92,7 @@ type
function GetErrorString(ErrorNum: integer): string;
function FindStreamIDs(FormatCtx: PAVFormatContext; out FirstVideoStream, FirstAudioStream: integer ): boolean;
function FindAudioStreamIndex(FormatCtx: PAVFormatContext): integer;
- function ConvertFFmpegToAudioFormat(FFmpegFormat: TSampleFormat; out Format: TAudioSampleFormat): boolean;
+ function ConvertFFmpegToAudioFormat(FFmpegFormat: TAVSampleFormat; out Format: TAudioSampleFormat): boolean;
procedure LockAVCodec();
procedure UnlockAVCodec();
end;
@@ -320,14 +320,14 @@ begin
Result := StreamIndex;
end;
-function TMediaCore_FFmpeg.ConvertFFmpegToAudioFormat(FFmpegFormat: TSampleFormat; out Format: TAudioSampleFormat): boolean;
+function TMediaCore_FFmpeg.ConvertFFmpegToAudioFormat(FFmpegFormat: TAVSampleFormat; out Format: TAudioSampleFormat): boolean;
begin
case FFmpegFormat of
- SAMPLE_FMT_U8: Format := asfU8;
- SAMPLE_FMT_S16: Format := asfS16;
- SAMPLE_FMT_S32: Format := asfS32;
- SAMPLE_FMT_FLT: Format := asfFloat;
- SAMPLE_FMT_DBL: Format := asfDouble;
+ AV_SAMPLE_FMT_U8: Format := asfU8;
+ AV_SAMPLE_FMT_S16: Format := asfS16;
+ AV_SAMPLE_FMT_S32: Format := asfS32;
+ AV_SAMPLE_FMT_FLT: Format := asfFloat;
+ AV_SAMPLE_FMT_DBL: Format := asfDouble;
else begin
Result := false;
Exit;
diff --git a/src/ultrastardx.dpr b/src/ultrastardx.dpr
index f6c9558c..21e89e2d 100644
--- a/src/ultrastardx.dpr
+++ b/src/ultrastardx.dpr
@@ -85,19 +85,16 @@ uses
{$IFDEF UsePortmixer}
portmixer in 'lib\portmixer\portmixer.pas',
{$ENDIF}
-
{$IFDEF UseFFmpeg}
- avcodec in 'lib\ffmpeg\avcodec.pas',
- avformat in 'lib\ffmpeg\avformat.pas',
- avutil in 'lib\ffmpeg\avutil.pas',
- rational in 'lib\ffmpeg\rational.pas',
- opt in 'lib\ffmpeg\opt.pas',
- avio in 'lib\ffmpeg\avio.pas',
- mathematics in 'lib\ffmpeg\mathematics.pas',
+ avcodec in 'lib\' + FFMPEG_DIR + '\avcodec.pas',
+ avformat in 'lib\' + FFMPEG_DIR + '\avformat.pas',
+ avutil in 'lib\' + FFMPEG_DIR + '\avutil.pas',
+ rational in 'lib\' + FFMPEG_DIR + '\rational.pas',
+ avio in 'lib\' + FFMPEG_DIR + '\avio.pas',
+ {$IFDEF UseSWScale}
+ swscale in 'lib\' + FFMPEG_DIR + '\swscale.pas',
+ {$ENDIF}
UMediaCore_FFmpeg in 'media\UMediaCore_FFmpeg.pas',
- {$IFDEF UseSWScale}
- swscale in 'lib\ffmpeg\swscale.pas',
- {$ENDIF}
{$ENDIF}
{$IFDEF UseSRCResample}
@@ -242,7 +239,7 @@ uses
{$IF Defined(MSWINDOWS)}
UPlatformWindows in 'base\UPlatformWindows.pas',
{$ELSEIF Defined(DARWIN)}
- UPlatformMacOSX in 'base/UPlatformMacOSX.pas',
+ UPlatformMacOSX in 'base\UPlatformMacOSX.pas',
{$ELSEIF Defined(UNIX)}
UPlatformLinux in 'base\UPlatformLinux.pas',
{$IFEND}