From d99a89b60c91b7630ed47f9df67beae41ea65892 Mon Sep 17 00:00:00 2001
From: k-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>
Date: Sat, 14 Dec 2013 23:13:56 +0000
Subject: add FF_API_AVCODEC_RESAMPLE and FFMPEG_VERSION_INT

git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@3025 b956fd51-792f-4845-bead-9b4dfca2ff2c
---
 src/config.inc.in              |  2 ++
 src/lib/ffmpeg-1.2/avcodec.pas |  2 ++
 src/media/UVideo.pas           | 14 +++++++++++++-
 src/switches.inc               |  1 +
 4 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/config.inc.in b/src/config.inc.in
index aa336a1d..97b0f604 100644
--- a/src/config.inc.in
+++ b/src/config.inc.in
@@ -26,6 +26,8 @@
     {$IFEND}
   {$ENDIF}
   {$IF Defined(IncludeConstants)}
+    FFMPEG_VERSION_INT = @FFMPEG_VERSION_INT@;
+
     av__codec = 'libavcodec';
     LIBAVCODEC_VERSION_MAJOR   = @libavcodec_VERSION_MAJOR@;
     LIBAVCODEC_VERSION_MINOR   = @libavcodec_VERSION_MINOR@;
diff --git a/src/lib/ffmpeg-1.2/avcodec.pas b/src/lib/ffmpeg-1.2/avcodec.pas
index 0f4ac469..b1b266d2 100644
--- a/src/lib/ffmpeg-1.2/avcodec.pas
+++ b/src/lib/ffmpeg-1.2/avcodec.pas
@@ -36,6 +36,8 @@ unit avcodec;
   {$MINENUMSIZE 4} (* use 4-byte enums *)
 {$ENDIF}
 
+{$I switches.inc}  (* for ffmpeg defines *)
+
 {$IFDEF DARWIN}
   {$linklib libavcodec}
 {$ENDIF}
diff --git a/src/media/UVideo.pas b/src/media/UVideo.pas
index 1c4f065d..5e083b9a 100644
--- a/src/media/UVideo.pas
+++ b/src/media/UVideo.pas
@@ -81,7 +81,11 @@ uses
 const
 {$IFDEF PIXEL_FMT_BGR}
   PIXEL_FMT_OPENGL = GL_BGR;
+  {$IF FFMPEG_VERSION_INT < 1001000}
   PIXEL_FMT_FFMPEG = PIX_FMT_BGR24;
+  {$ELSE}
+  PIXEL_FMT_FFMPEG = AV_PIX_FMT_BGR24;
+  {$ENDIF}
   PIXEL_FMT_SIZE   = 3;
 
   // looks strange on linux:
@@ -91,7 +95,11 @@ const
 {$ELSE}
   // looks strange on linux:
   PIXEL_FMT_OPENGL = GL_RGB;
-  PIXEL_FMT_FFMPEG = PIX_FMT_RGB24;
+  {$IF FFMPEG_VERSION_INT < 1001000}
+  PIXEL_FMT_FFMPEG = PIX_FMT_BGR24;
+  {$ELSE}
+  PIXEL_FMT_FFMPEG = AV_PIX_FMT_BGR24;
+  {$ENDIF}
   PIXEL_FMT_SIZE   = 3;
 {$ENDIF}
 
@@ -634,7 +642,11 @@ function TVideo_FFmpeg.DecodeFrame(): boolean;
 var
   FrameFinished: Integer;
   VideoPktPts: int64;
+  {$IF FFMPEG_VERSION_INT < 1001000}
   pbIOCtx: PByteIOContext;
+  {$ELSE}
+  pbIOCtx: PAVIOContext;
+  {$ENDIF}
   errnum: integer;
   AVPacket: TAVPacket;
   pts: double;
diff --git a/src/switches.inc b/src/switches.inc
index 64ebb5c2..e54bbcfa 100644
--- a/src/switches.inc
+++ b/src/switches.inc
@@ -97,6 +97,7 @@
 {$IFDEF HaveFFmpeg}
   {$DEFINE UseFFmpegDecoder}
   {$DEFINE UseFFmpegResample}
+  {$DEFINE FF_API_AVCODEC_RESAMPLE}
   {$DEFINE UseFFmpegVideo}
   {$IFDEF HaveSWScale}
     {$DEFINE UseSWScale}
-- 
cgit v1.2.3