aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/config-darwin.inc18
-rw-r--r--src/lib/ffmpeg-0.10/libavutil/dict.pas68
-rw-r--r--src/lib/ffmpeg-0.10/libavutil/mathematics.pas25
-rw-r--r--src/lib/ffmpeg-0.10/libavutil/mem.pas48
-rw-r--r--src/lib/ffmpeg-0.10/libavutil/opt.pas26
-rw-r--r--src/lib/ffmpeg-0.8/libavutil/dict.pas20
-rw-r--r--src/lib/ffmpeg-0.8/libavutil/mathematics.pas21
-rw-r--r--src/lib/ffmpeg-0.8/libavutil/mem.pas4
-rw-r--r--src/lib/ffmpeg-0.8/libavutil/opt.pas22
-rw-r--r--src/media/UAudioConverter.pas12
-rw-r--r--src/media/UAudioDecoder_FFmpeg.pas5
-rw-r--r--src/media/UMediaCore_FFmpeg.pas12
-rw-r--r--src/media/UVideo.pas5
13 files changed, 89 insertions, 197 deletions
diff --git a/src/config-darwin.inc b/src/config-darwin.inc
index 395a375f..888464f5 100644
--- a/src/config-darwin.inc
+++ b/src/config-darwin.inc
@@ -13,27 +13,27 @@
{$IF Defined(HaveFFmpeg)}
{$MACRO ON}
{$IFNDEF FFMPEG_DIR}
- {$IF 7 > 0}
- {$DEFINE FFMPEG_DIR := 'ffmpeg-0.7'}
+ {$IF 8 > 0}
+ {$DEFINE FFMPEG_DIR := 'ffmpeg-0.8'}
{$ELSE}
{$DEFINE FFMPEG_DIR := 'ffmpeg'}
{$IFEND}
{$IFEND}
{$IF Defined(IncludeConstants)}
av__codec = 'libavcodec';
- LIBAVCODEC_VERSION_MAJOR = 52;
- LIBAVCODEC_VERSION_MINOR = 123;
+ LIBAVCODEC_VERSION_MAJOR = 53;
+ LIBAVCODEC_VERSION_MINOR = 8;
LIBAVCODEC_VERSION_RELEASE = 0;
av__format = 'libavformat';
- LIBAVFORMAT_VERSION_MAJOR = 52;
- LIBAVFORMAT_VERSION_MINOR = 111;
+ LIBAVFORMAT_VERSION_MAJOR = 53;
+ LIBAVFORMAT_VERSION_MINOR = 5;
LIBAVFORMAT_VERSION_RELEASE = 0;
av__util = 'libavutil';
- LIBAVUTIL_VERSION_MAJOR = 50;
- LIBAVUTIL_VERSION_MINOR = 43;
- LIBAVUTIL_VERSION_RELEASE = 0;
+ LIBAVUTIL_VERSION_MAJOR = 51;
+ LIBAVUTIL_VERSION_MINOR = 9;
+ LIBAVUTIL_VERSION_RELEASE = 1;
{$IFEND}
{$IFEND}
diff --git a/src/lib/ffmpeg-0.10/libavutil/dict.pas b/src/lib/ffmpeg-0.10/libavutil/dict.pas
index b5608576..e2626e50 100644
--- a/src/lib/ffmpeg-0.10/libavutil/dict.pas
+++ b/src/lib/ffmpeg-0.10/libavutil/dict.pas
@@ -23,66 +23,6 @@
*
*)
-unit dict;
-
-{$IFDEF FPC}
- {$MODE DELPHI}
- {$PACKENUM 4} (* use 4-byte enums *)
- {$PACKRECORDS C} (* C/C++-compatible record packing *)
-{$ELSE}
- {$MINENUMSIZE 4} (* use 4-byte enums *)
-{$ENDIF}
-
-interface
-
-uses
- ctypes,
- UConfig;
-
-(**
- * @file
- * Public dictionary API.
- * @deprecated
- * AVDictionary is provided for compatibility with libav. It is both in
- * implementation as well as API inefficient. It does not scale and is
- * extremely slow with large dictionaries.
- * It is recommended that new code uses our tree container from tree.c/h
- * where applicable, which uses AVL trees to achieve O(log n) performance.
- *)
-
-(**
- * @addtogroup lavu_dict AVDictionary
- * @ingroup lavu_data
- *
- * @brief Simple key:value store
- *
- * @{
- * Dictionaries are used for storing key:value pairs. To create
- * an AVDictionary, simply pass an address of a NULL pointer to
- * av_dict_set(). NULL can be used as an empty dictionary wherever
- * a pointer to an AVDictionary is required.
- * Use av_dict_get() to retrieve an entry or iterate over all
- * entries and finally av_dict_free() to free the dictionary
- * and all its contents.
- *
- * @code
- * AVDictionary *d = NULL; // "create" an empty dictionary
- * av_dict_set(&d, "foo", "bar", 0); // add an entry
- *
- * char *k = av_strdup("key"); // if your strings are already allocated,
- * char *v = av_strdup("value"); // you can avoid copying them like this
- * av_dict_set(&d, k, v, AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL);
- *
- * AVDictionaryEntry *t = NULL;
- * while (t = av_dict_get(d, "", t, AV_DICT_IGNORE_SUFFIX)) {
- * <....> // iterate over all entries in d
- * }
- *
- * av_dict_free(&d);
- * @endcode
- *
- *)
-
const
AV_DICT_MATCH_CASE = 1;
AV_DICT_IGNORE_SUFFIX = 2;
@@ -151,11 +91,3 @@ procedure av_dict_copy(var dst: PAVDictionary; src: PAVDictionary; flags: cint);
*)
procedure av_dict_free(var m: PAVDictionary);
cdecl; external av__util;
-
-(**
- * @}
- *)
-
-implementation
-
-end.
diff --git a/src/lib/ffmpeg-0.10/libavutil/mathematics.pas b/src/lib/ffmpeg-0.10/libavutil/mathematics.pas
index 0ebdf262..3859311b 100644
--- a/src/lib/ffmpeg-0.10/libavutil/mathematics.pas
+++ b/src/lib/ffmpeg-0.10/libavutil/mathematics.pas
@@ -26,23 +26,6 @@
*
*)
-unit mathematics;
-
-{$IFDEF FPC}
- {$MODE DELPHI }
- {$PACKENUM 4} (* use 4-byte enums *)
- {$PACKRECORDS C} (* C/C++-compatible record packing *)
-{$ELSE}
- {$MINENUMSIZE 4} (* use 4-byte enums *)
-{$ENDIF}
-
-interface
-
-uses
- ctypes,
- rational,
- UConfig;
-
const
M_E = 2.7182818284590452354; // e
M_LN2 = 0.69314718055994530942; // log_e 2
@@ -118,11 +101,3 @@ function av_compare_ts(ts_a: cint64; tb_a: TAVRational; ts_b: cint64; tb_b: TAVR
*)
function av_compare_mod(a: cuint64; b: cuint64; modVar: cuint64): cint64;
cdecl; external av__util;
-
-(**
- * @}
- *)
-
-implementation
-
-end.
diff --git a/src/lib/ffmpeg-0.10/libavutil/mem.pas b/src/lib/ffmpeg-0.10/libavutil/mem.pas
index 5cc1dc1b..d71dd3d3 100644
--- a/src/lib/ffmpeg-0.10/libavutil/mem.pas
+++ b/src/lib/ffmpeg-0.10/libavutil/mem.pas
@@ -30,9 +30,6 @@
(* memory handling functions *)
-type
- FF_INTERNAL_MEM_TYPE = cuint;
-
(**
* Allocate a block of size bytes with alignment suitable for all
* memory accesses (including vectors if available on the CPU).
@@ -60,6 +57,19 @@ function av_realloc(ptr: pointer; size: FF_INTERNAL_MEM_TYPE): pointer;
cdecl; external av__util; {av_alloc_size(2)}
(**
+ * Allocate or reallocate a block of memory.
+ * This function does the same thing as av_realloc, except:
+ * - It takes two arguments and checks the result of the multiplication for
+ * integer overflow.
+ * - It frees the input block in case of failure, thus avoiding the memory
+ * leak with the classic "buf = realloc(buf); if (!buf) return -1;".
+ *)
+{ available only in 0.8.5 - 0.8.10
+function av_realloc_f(ptr: pointer; nelem: size_t; size: size_t): pointer;
+ cdecl; external av__util;
+}
+
+(**
* Free a memory block which has been allocated with av_malloc(z)() or
* av_realloc().
* @param ptr Pointer to the memory block which should be freed.
@@ -82,6 +92,21 @@ function av_mallocz(size: FF_INTERNAL_MEM_TYPE): pointer;
cdecl; external av__util; {av_malloc_attrib av_alloc_size(1)}
(**
+ * Allocate a block of nmemb * size bytes with alignment suitable for all
+ * memory accesses (including vectors if available on the CPU) and
+ * zero all the bytes of the block.
+ * The allocation will fail if nmemb * size is greater than or equal
+ * to INT_MAX.
+ * @param nmemb
+ * @param size
+ * @return Pointer to the allocated block, NULL if it cannot be allocated.
+ *)
+(* available only in 0.8.5 - 0.8.10
+function av_calloc(nmemb: size_t; size: size_t): pointer;
+ cdecl; external av__util; {av_malloc_attrib}
+*)
+
+(**
* Duplicate the string s.
* @param s string to be duplicated.
* @return Pointer to a newly allocated string containing a
@@ -109,3 +134,20 @@ procedure av_freep (ptr: pointer);
*)
procedure av_dynarray_add(tab_ptr: pointer; nb_ptr: PCint; elem: pointer);
cdecl; external av__util;
+
+(**
+ * Multiply two size_t values checking for overflow.
+ * @return 0 if success, AVERROR(EINVAL) if overflow.
+ *)
+{ available only in 0.8.5 - 0.8.10
+//static inline int av_size_mult(size_t a, size_t b, size_t *r)
+}
+{
+ size_t t = a * b;
+ /* Hack inspired from glibc: only try the division if nelem and elsize
+ * are both greater than sqrt(SIZE_MAX). */
+ if ((a | b) >= ((size_t)1 << (sizeof(size_t) * 4)) && a && t / a != b)
+ return AVERROR(EINVAL);
+ *r = t;
+ return 0;
+}
diff --git a/src/lib/ffmpeg-0.10/libavutil/opt.pas b/src/lib/ffmpeg-0.10/libavutil/opt.pas
index 6d5b3c89..61af0754 100644
--- a/src/lib/ffmpeg-0.10/libavutil/opt.pas
+++ b/src/lib/ffmpeg-0.10/libavutil/opt.pas
@@ -27,24 +27,6 @@
*
*)
-unit opt;
-
-{$IFDEF FPC}
- {$MODE DELPHI}
- {$PACKENUM 4} (* use 4-byte enums *)
- {$PACKRECORDS C} (* C/C++-compatible record packing *)
-{$ELSE}
- {$MINENUMSIZE 4} (* use 4-byte enums *)
-{$ENDIF}
-
-interface
-
-uses
- ctypes,
- dict,
- rational,
- UConfig;
-
(**
* @defgroup avoptions AVOptions
* @ingroup lavu_data
@@ -649,11 +631,3 @@ function av_opt_get_q (obj: pointer; name: {const} PAnsiChar; search_flags:
procedure av_opt_ptr(avclass: {const} PAVClass; obj: pointer; name: {const} PAnsiChar);
cdecl; external av__util;
*)
-
-(**
- * @}
- *)
-
-implementation
-
-end. \ No newline at end of file
diff --git a/src/lib/ffmpeg-0.8/libavutil/dict.pas b/src/lib/ffmpeg-0.8/libavutil/dict.pas
index b07ce6e8..d50d3b0b 100644
--- a/src/lib/ffmpeg-0.8/libavutil/dict.pas
+++ b/src/lib/ffmpeg-0.8/libavutil/dict.pas
@@ -23,22 +23,6 @@
*
*)
-unit dict;
-
-{$IFDEF FPC}
- {$MODE DELPHI}
- {$PACKENUM 4} (* use 4-byte enums *)
- {$PACKRECORDS C} (* C/C++-compatible record packing *)
-{$ELSE}
- {$MINENUMSIZE 4} (* use 4-byte enums *)
-{$ENDIF}
-
-interface
-
-uses
- ctypes,
- UConfig;
-
const
AV_DICT_MATCH_CASE = 1;
AV_DICT_IGNORE_SUFFIX = 2;
@@ -103,7 +87,3 @@ procedure av_dict_copy(var dst: PAVDictionary; src: PAVDictionary; flags: cint);
*)
procedure av_dict_free(var m: PAVDictionary);
cdecl; external av__util;
-
-implementation
-
-end.
diff --git a/src/lib/ffmpeg-0.8/libavutil/mathematics.pas b/src/lib/ffmpeg-0.8/libavutil/mathematics.pas
index 2f8eaab2..36768a55 100644
--- a/src/lib/ffmpeg-0.8/libavutil/mathematics.pas
+++ b/src/lib/ffmpeg-0.8/libavutil/mathematics.pas
@@ -26,23 +26,6 @@
*
*)
-unit mathematics;
-
-{$IFDEF FPC}
- {$MODE DELPHI }
- {$PACKENUM 4} (* use 4-byte enums *)
- {$PACKRECORDS C} (* C/C++-compatible record packing *)
-{$ELSE}
- {$MINENUMSIZE 4} (* use 4-byte enums *)
-{$ENDIF}
-
-interface
-
-uses
- ctypes,
- rational,
- UConfig;
-
const
M_E = 2.7182818284590452354; // e
M_LN2 = 0.69314718055994530942; // log_e 2
@@ -113,7 +96,3 @@ function av_compare_ts(ts_a: cint64; tb_a: TAVRational; ts_b: cint64; tb_b: TAVR
*)
function av_compare_mod(a: cuint64; b: cuint64; modVar: cuint64): cint64;
cdecl; external av__util;
-
-implementation
-
-end.
diff --git a/src/lib/ffmpeg-0.8/libavutil/mem.pas b/src/lib/ffmpeg-0.8/libavutil/mem.pas
index 322a8657..c438bbfc 100644
--- a/src/lib/ffmpeg-0.8/libavutil/mem.pas
+++ b/src/lib/ffmpeg-0.8/libavutil/mem.pas
@@ -101,10 +101,10 @@ function av_mallocz(size: size_t): pointer;
* @param size
* @return Pointer to the allocated block, NULL if it cannot be allocated.
*)
-{ available only in 0.8.5 - 0.8.10
+(* available only in 0.8.5 - 0.8.10
function av_calloc(nmemb: size_t; size: size_t): pointer;
cdecl; external av__util; {av_malloc_attrib}
-}
+*)
(**
* Duplicate the string s.
diff --git a/src/lib/ffmpeg-0.8/libavutil/opt.pas b/src/lib/ffmpeg-0.8/libavutil/opt.pas
index c7b0d914..16bf0f26 100644
--- a/src/lib/ffmpeg-0.8/libavutil/opt.pas
+++ b/src/lib/ffmpeg-0.8/libavutil/opt.pas
@@ -27,24 +27,6 @@
*
*)
-unit opt;
-
-{$IFDEF FPC}
- {$MODE DELPHI}
- {$PACKENUM 4} (* use 4-byte enums *)
- {$PACKRECORDS C} (* C/C++-compatible record packing *)
-{$ELSE}
- {$MINENUMSIZE 4} (* use 4-byte enums *)
-{$ENDIF}
-
-interface
-
-uses
- ctypes,
- dict,
- rational,
- UConfig;
-
type
TAVOptionType = (
FF_OPT_TYPE_FLAGS,
@@ -275,7 +257,3 @@ const
function av_opt_find(obj: pointer; name: {const} PAnsiChar; unit_: {const} PAnsiChar;
opt_flags: cint; search_flags: cint): PAVOption;
cdecl; external av__util;
-
-implementation
-
-end.
diff --git a/src/media/UAudioConverter.pas b/src/media/UAudioConverter.pas
index 657b80dd..696a01f6 100644
--- a/src/media/UAudioConverter.pas
+++ b/src/media/UAudioConverter.pas
@@ -42,6 +42,7 @@ uses
{$ENDIF}
{$IFDEF UseFFmpegResample}
avcodec,
+ avutil,
{$ENDIF}
UMediaCore_SDL,
sdl,
@@ -124,6 +125,9 @@ type
implementation
+uses
+ UConfig;
+
function TAudioConverter_SDL.Init(srcFormatInfo: TAudioFormatInfo; dstFormatInfo: TAudioFormatInfo): boolean;
var
srcFormat: UInt16;
@@ -219,9 +223,17 @@ begin
Exit;
end;
+ {$IF LIBAVCODEC_VERSION < 52122000} // 52.122.0
ResampleContext := audio_resample_init(
dstFormatInfo.Channels, srcFormatInfo.Channels,
Round(dstFormatInfo.SampleRate), Round(srcFormatInfo.SampleRate));
+ {$ELSE}
+ ResampleContext := av_audio_resample_init(
+ dstFormatInfo.Channels, srcFormatInfo.Channels,
+ Round(dstFormatInfo.SampleRate), Round(srcFormatInfo.SampleRate),
+ AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16,
+ 16, 10, 0, 0.8);
+ {$IFEND}
if (ResampleContext = nil) then
begin
Log.LogError('audio_resample_init() failed', 'TAudioConverter_FFmpeg.Init');
diff --git a/src/media/UAudioDecoder_FFmpeg.pas b/src/media/UAudioDecoder_FFmpeg.pas
index d5295135..a6749173 100644
--- a/src/media/UAudioDecoder_FFmpeg.pas
+++ b/src/media/UAudioDecoder_FFmpeg.pas
@@ -915,7 +915,10 @@ begin
begin
DataSize := BufferSize;
- {$IF LIBAVCODEC_VERSION >= 51030000} // 51.30.0
+ {$IF LIBAVCODEC_VERSION >= 52122000} // 52.122.0
+ PaketDecodedSize := avcodec_decode_audio3(fCodecCtx, PSmallint(Buffer),
+ DataSize, @fAudioPaket);
+ {$ELSEIF LIBAVCODEC_VERSION >= 51030000} // 51.30.0
PaketDecodedSize := avcodec_decode_audio2(fCodecCtx, PSmallint(Buffer),
DataSize, fAudioPaketData, fAudioPaketSize);
{$ELSE}
diff --git a/src/media/UMediaCore_FFmpeg.pas b/src/media/UMediaCore_FFmpeg.pas
index f04ee7eb..ffc7b1c5 100644
--- a/src/media/UMediaCore_FFmpeg.pas
+++ b/src/media/UMediaCore_FFmpeg.pas
@@ -199,7 +199,12 @@ begin
inherited;
CheckVersions();
+
+ {$IF LIBAVFORMAT_VERSION < 52110000} // 52.110.0
av_register_protocol(@UTF8FileProtocol);
+ {$ELSE}
+ av_register_protocol2(@UTF8FileProtocol, sizeof(UTF8FileProtocol));
+ {$IFEND}
AVCodecLock := SDL_CreateMutex();
end;
@@ -228,6 +233,7 @@ end;
function TMediaCore_FFmpeg.GetErrorString(ErrorNum: integer): string;
begin
+{$IF LIBAVUTIL_VERSION < 50043000} // < 50.43.0
case ErrorNum of
AVERROR_IO: Result := 'AVERROR_IO';
AVERROR_NUMEXPECTED: Result := 'AVERROR_NUMEXPECTED';
@@ -239,6 +245,8 @@ begin
AVERROR_PATCHWELCOME: Result := 'AVERROR_PATCHWELCOME';
else Result := 'AVERROR_#'+inttostr(ErrorNum);
end;
+{$ELSE}
+{$IFEND}
end;
{
@@ -371,7 +379,11 @@ begin
Stream := TBinaryFileStream.Create(FilePath, Mode);
h.priv_data := Stream;
except
+{$IF LIBAVUTIL_VERSION < 50043000} // < 50.43.0
Result := AVERROR_NOENT;
+{$ELSE}
+ Result := -1;
+{$IFEND}
end;
end;
diff --git a/src/media/UVideo.pas b/src/media/UVideo.pas
index add7bdc8..b3030b0c 100644
--- a/src/media/UVideo.pas
+++ b/src/media/UVideo.pas
@@ -669,8 +669,13 @@ begin
fCodecContext^.opaque := @VideoPktPts;
// decode packet
+ {$IF LIBAVFORMAT_VERSION < 5212200)}
avcodec_decode_video(fCodecContext, fAVFrame,
frameFinished, AVPacket.data, AVPacket.size);
+ {$ELSE}
+ avcodec_decode_video2(fCodecContext, fAVFrame,
+ frameFinished, @AVPacket);
+ {$IFEND}
// reset opaque data
fCodecContext^.opaque := nil;