aboutsummaryrefslogtreecommitdiffstats
path: root/us_maker_edition/src/media/UMediaCore_FFmpeg.pas
diff options
context:
space:
mode:
authorwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-06-15 21:28:52 +0000
committerwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-06-15 21:28:52 +0000
commit115255f6a3c2be422680710b5d6ba4226c3383a6 (patch)
tree3bbe81786e12808220efa589adb799e0412d20a2 /us_maker_edition/src/media/UMediaCore_FFmpeg.pas
parentcf141f470e4cb45b8c886e1536846a8254cdd302 (diff)
downloadusdx-115255f6a3c2be422680710b5d6ba4226c3383a6.tar.gz
usdx-115255f6a3c2be422680710b5d6ba4226c3383a6.tar.xz
usdx-115255f6a3c2be422680710b5d6ba4226c3383a6.zip
merged trunk r2528 into us_maker branch
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@2530 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--us_maker_edition/src/media/UMediaCore_FFmpeg.pas75
1 files changed, 75 insertions, 0 deletions
diff --git a/us_maker_edition/src/media/UMediaCore_FFmpeg.pas b/us_maker_edition/src/media/UMediaCore_FFmpeg.pas
index 2d572ff2..eb136995 100644
--- a/us_maker_edition/src/media/UMediaCore_FFmpeg.pas
+++ b/us_maker_edition/src/media/UMediaCore_FFmpeg.pas
@@ -41,6 +41,7 @@ uses
avformat,
avutil,
avio,
+ swscale,
UMusic,
ULog,
UPath;
@@ -121,9 +122,83 @@ const
var
Instance: TMediaCore_FFmpeg;
+function AV_VERSION_INT(a, b, c: cardinal): cuint;
+begin
+ Result := (a shl 16) or (b shl 8) or c;
+end;
+
+procedure CheckVersions();
+var
+ libVersion: cuint;
+ headerVersion: cuint;
+
+ function hexVerToStr(Version: cuint): string;
+ var
+ Major, Minor, Release: cardinal;
+ begin
+ Major := (Version shr 16) and $FF;;
+ Minor := (Version shr 8) and $FF;
+ Release := Version and $FF;
+ Result := Format('%d.%d.%d', [Major, Minor, Release]);
+ end;
+
+begin
+ libVersion := avcodec_version();
+ headerVersion := AV_VERSION_INT(
+ LIBAVCODEC_VERSION_MAJOR,
+ LIBAVCODEC_VERSION_MINOR,
+ LIBAVCODEC_VERSION_RELEASE);
+ if (libVersion <> headerVersion) then
+ begin
+ Log.LogError(Format('%s header (%s) and DLL (%s) versions do not match.',
+ ['libavcodec', hexVerToStr(headerVersion), hexVerToStr(libVersion)]));
+ end;
+
+ {$IF LIBAVFORMAT_VERSION >= 52020000} // 52.20.0
+ libVersion := avformat_version();
+ headerVersion := AV_VERSION_INT(
+ LIBAVFORMAT_VERSION_MAJOR,
+ LIBAVFORMAT_VERSION_MINOR,
+ LIBAVFORMAT_VERSION_RELEASE);
+ if (libVersion <> headerVersion) then
+ begin
+ Log.LogError(Format('%s header (%s) and DLL (%s) versions do not match.',
+ ['libavformat', hexVerToStr(headerVersion), hexVerToStr(libVersion)]));
+ end;
+ {$IFEND}
+
+ {$IF LIBAVUTIL_VERSION >= 49008000} // 49.8.0
+ libVersion := avutil_version();
+ headerVersion := AV_VERSION_INT(
+ LIBAVUTIL_VERSION_MAJOR,
+ LIBAVUTIL_VERSION_MINOR,
+ LIBAVUTIL_VERSION_RELEASE);
+ if (libVersion <> headerVersion) then
+ begin
+ Log.LogError(Format('%s header (%s) and DLL (%s) versions do not match.',
+ ['libavutil', hexVerToStr(headerVersion), hexVerToStr(libVersion)]));
+ end;
+ {$IFEND}
+
+ {$IF LIBSWSCALE_VERSION >= 000006001} // 0.6.1
+ libVersion := swscale_version();
+ headerVersion := AV_VERSION_INT(
+ LIBSWSCALE_VERSION_MAJOR,
+ LIBSWSCALE_VERSION_MINOR,
+ LIBSWSCALE_VERSION_RELEASE);
+ if (libVersion <> headerVersion) then
+ begin
+ Log.LogError(Format('%s header (%s) and DLL (%s) versions do not match.',
+ ['libswscale', hexVerToStr(headerVersion), hexVerToStr(libVersion)]));
+ end;
+ {$IFEND}
+end;
+
constructor TMediaCore_FFmpeg.Create();
begin
inherited;
+
+ CheckVersions();
av_register_protocol(@UTF8FileProtocol);
AVCodecLock := SDL_CreateMutex();
end;