From 7c1b9be0d3462a15c9b37a1388e8d9910a8f6f96 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sat, 14 Jul 2012 12:17:43 +0000 Subject: fix size_t for Delphi. fix duplicate packet procedures in avformat and avcodec. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2919 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/lib/ffmpeg-0.10/avcodec.pas | 6 ++++++ src/lib/ffmpeg-0.10/avformat.pas | 43 +++++++++++++--------------------------- src/lib/ffmpeg-0.10/avutil.pas | 10 +++++++--- src/lib/ffmpeg-0.7/avcodec.pas | 6 ++++++ src/lib/ffmpeg-0.7/avformat.pas | 43 +++++++++++++--------------------------- src/lib/ffmpeg-0.7/avutil.pas | 6 ++++++ src/lib/ffmpeg-0.8/avcodec.pas | 6 ++++++ src/lib/ffmpeg-0.8/avformat.pas | 43 +++++++++++++--------------------------- src/lib/ffmpeg-0.8/avutil.pas | 6 ++++++ src/lib/ffmpeg-0.9/avcodec.pas | 6 ++++++ src/lib/ffmpeg-0.9/avformat.pas | 43 +++++++++++++--------------------------- src/lib/ffmpeg-0.9/avutil.pas | 10 +++++++--- src/lib/ffmpeg/avcodec.pas | 6 ++++++ 13 files changed, 112 insertions(+), 122 deletions(-) (limited to 'src') diff --git a/src/lib/ffmpeg-0.10/avcodec.pas b/src/lib/ffmpeg-0.10/avcodec.pas index 0b735fc7..bfc2c3ba 100644 --- a/src/lib/ffmpeg-0.10/avcodec.pas +++ b/src/lib/ffmpeg-0.10/avcodec.pas @@ -199,6 +199,12 @@ const FF_API_OLD_ENCODE_AUDIO = (LIBAVCODEC_VERSION_MAJOR < 55); {$endif} +{$IFNDEF FPC} +type + // defines for Delphi + size_t = cardinal; +{$ENDIF} + type FF_INTERNALC_MEM_TYPE = cuint; diff --git a/src/lib/ffmpeg-0.10/avformat.pas b/src/lib/ffmpeg-0.10/avformat.pas index eab33a63..e2b464d3 100644 --- a/src/lib/ffmpeg-0.10/avformat.pas +++ b/src/lib/ffmpeg-0.10/avformat.pas @@ -441,46 +441,31 @@ procedure av_metadata_free(var m: PAVDictionary); (* packet functions *) -const - PKT_FLAG_KEY = $0001; - -procedure av_destruct_packet_nofree(var pkt: TAVPacket); - cdecl; external av__format; - -(** - * Default packet destructor. - *) -procedure av_destruct_packet(var pkt: TAVPacket); - cdecl; external av__format; - -(** - * Initialize optional fields of a packet with default values. - * - * @param pkt packet - *) -procedure av_init_packet(var pkt: TAVPacket); - cdecl; external av__format; - (** - * Allocate the payload of a packet and initialize its fields with + * Allocate and read the payload of a packet and initialize its fields with * default values. * * @param pkt packet - * @param size wanted payload size - * @return 0 if OK, AVERROR_xxx otherwise + * @param size desired payload size + * @return >0 (read size) if OK, AVERROR_xxx otherwise *) -function av_new_packet(var pkt: TAVPacket; size: cint): cint; +function av_get_packet(s: PAVIOContext; var pkt: TAVPacket; size: cint): cint; cdecl; external av__format; (** - * Allocate and read the payload of a packet and initialize its fields with - * default values. + * Read data and append it to the current content of the AVPacket. + * If pkt->size is 0 this is identical to av_get_packet. + * Note that this uses av_grow_packet and thus involves a realloc + * which is inefficient. Thus this function should only be used + * when there is no reasonable way to know (an upper bound of) + * the final size. * * @param pkt packet - * @param size desired payload size - * @return >0 (read size) if OK, AVERROR_xxx otherwise + * @param size amount of data to read + * @return >0 (read size) if OK, AVERROR_xxx otherwise, previous data + * will not be lost even if an error occurs. *) -function av_get_packet(s: PByteIOContext; var pkt: TAVPacket; size: cint): cint; +function av_append_packet(s: PAVIOContext; var pkt: TAVPacket; size: cint): cint; cdecl; external av__format; (*************************************************) diff --git a/src/lib/ffmpeg-0.10/avutil.pas b/src/lib/ffmpeg-0.10/avutil.pas index 3ee956b0..23899794 100644 --- a/src/lib/ffmpeg-0.10/avutil.pas +++ b/src/lib/ffmpeg-0.10/avutil.pas @@ -78,6 +78,13 @@ const {$MESSAGE Error 'Linked version of libavutil is not yet supported!'} {$IFEND} +type +{$IFNDEF FPC} + // defines for Delphi + size_t = cardinal; +{$ENDIF} + Psize_t = ^size_t; + (** * Return the LIBAVUTIL_VERSION_INT constant. *) @@ -235,9 +242,6 @@ begin Result := (ord(d) or (ord(c) shl 8) or (ord(b) shl 16) or (ord(a) shl 24)); end; -type - Psize_t = ^size_t; - function av_size_mult(a: size_t; b: size_t; r: Psize_t): size_t; cdecl; external av__util; (* To Be Implemented, March 2012 KMS *) diff --git a/src/lib/ffmpeg-0.7/avcodec.pas b/src/lib/ffmpeg-0.7/avcodec.pas index 159c9b58..a402f0c3 100644 --- a/src/lib/ffmpeg-0.7/avcodec.pas +++ b/src/lib/ffmpeg-0.7/avcodec.pas @@ -173,6 +173,12 @@ const FF_API_GET_PIX_FMT_NAME = LIBAVCODEC_VERSION_MAJOR < 54; {$endif} +{$IFNDEF FPC} +type + // defines for Delphi + size_t = cardinal; +{$ENDIF} + {$IF FF_API_OLD_AUDIOCONVERT} {$I libavcodec/audioconvert.pas} {$IFEND} diff --git a/src/lib/ffmpeg-0.7/avformat.pas b/src/lib/ffmpeg-0.7/avformat.pas index 848f1672..7153bfb0 100644 --- a/src/lib/ffmpeg-0.7/avformat.pas +++ b/src/lib/ffmpeg-0.7/avformat.pas @@ -259,46 +259,31 @@ procedure av_metadata_free(var m: PAVDictionary); (* packet functions *) -const - PKT_FLAG_KEY = $0001; - -procedure av_destruct_packet_nofree(var pkt: TAVPacket); - cdecl; external av__format; - -(** - * Default packet destructor. - *) -procedure av_destruct_packet(var pkt: TAVPacket); - cdecl; external av__format; - -(** - * Initialize optional fields of a packet with default values. - * - * @param pkt packet - *) -procedure av_init_packet(var pkt: TAVPacket); - cdecl; external av__format; - (** - * Allocate the payload of a packet and initialize its fields with + * Allocate and read the payload of a packet and initialize its fields with * default values. * * @param pkt packet - * @param size wanted payload size - * @return 0 if OK, AVERROR_xxx otherwise + * @param size desired payload size + * @return >0 (read size) if OK, AVERROR_xxx otherwise *) -function av_new_packet(var pkt: TAVPacket; size: cint): cint; +function av_get_packet(s: PByteIOContext; var pkt: TAVPacket; size: cint): cint; cdecl; external av__format; (** - * Allocate and read the payload of a packet and initialize its fields with - * default values. + * Read data and append it to the current content of the AVPacket. + * If pkt->size is 0 this is identical to av_get_packet. + * Note that this uses av_grow_packet and thus involves a realloc + * which is inefficient. Thus this function should only be used + * when there is no reasonable way to know (an upper bound of) + * the final size. * * @param pkt packet - * @param size desired payload size - * @return >0 (read size) if OK, AVERROR_xxx otherwise + * @param size amount of data to read + * @return >0 (read size) if OK, AVERROR_xxx otherwise, previous data + * will not be lost even if an error occurs. *) -function av_get_packet(s: PByteIOContext; var pkt: TAVPacket; size: cint): cint; +function av_append_packet(s: PAVIOContext; var pkt: TAVPacket; size: cint): cint; cdecl; external av__format; (*************************************************) diff --git a/src/lib/ffmpeg-0.7/avutil.pas b/src/lib/ffmpeg-0.7/avutil.pas index 7d8ce826..8746d545 100644 --- a/src/lib/ffmpeg-0.7/avutil.pas +++ b/src/lib/ffmpeg-0.7/avutil.pas @@ -78,6 +78,12 @@ const {$MESSAGE Error 'Linked version of libavutil is not yet supported!'} {$IFEND} +{$IFNDEF FPC} +type + // defines for Delphi + size_t = cardinal; +{$ENDIF} + {$INCLUDE libavutil/cpu.pas} {$INCLUDE libavutil/dict.pas} diff --git a/src/lib/ffmpeg-0.8/avcodec.pas b/src/lib/ffmpeg-0.8/avcodec.pas index 6a3d568f..9805bfd3 100644 --- a/src/lib/ffmpeg-0.8/avcodec.pas +++ b/src/lib/ffmpeg-0.8/avcodec.pas @@ -173,6 +173,12 @@ const FF_API_GET_PIX_FMT_NAME = LIBAVCODEC_VERSION_MAJOR < 54; {$endif} +{$IFNDEF FPC} +type + // defines for Delphi + size_t = cardinal; +{$ENDIF} + {$IF FF_API_OLD_AUDIOCONVERT} {$I libavcodec/audioconvert.pas} {$IFEND} diff --git a/src/lib/ffmpeg-0.8/avformat.pas b/src/lib/ffmpeg-0.8/avformat.pas index bc87e551..fdbc2d0c 100644 --- a/src/lib/ffmpeg-0.8/avformat.pas +++ b/src/lib/ffmpeg-0.8/avformat.pas @@ -244,46 +244,31 @@ procedure av_metadata_free(var m: PAVDictionary); (* packet functions *) -const - PKT_FLAG_KEY = $0001; - -procedure av_destruct_packet_nofree(var pkt: TAVPacket); - cdecl; external av__format; - -(** - * Default packet destructor. - *) -procedure av_destruct_packet(var pkt: TAVPacket); - cdecl; external av__format; - -(** - * Initialize optional fields of a packet with default values. - * - * @param pkt packet - *) -procedure av_init_packet(var pkt: TAVPacket); - cdecl; external av__format; - (** - * Allocate the payload of a packet and initialize its fields with + * Allocate and read the payload of a packet and initialize its fields with * default values. * * @param pkt packet - * @param size wanted payload size - * @return 0 if OK, AVERROR_xxx otherwise + * @param size desired payload size + * @return >0 (read size) if OK, AVERROR_xxx otherwise *) -function av_new_packet(var pkt: TAVPacket; size: cint): cint; +function av_get_packet(s: PByteIOContext; var pkt: TAVPacket; size: cint): cint; cdecl; external av__format; (** - * Allocate and read the payload of a packet and initialize its fields with - * default values. + * Read data and append it to the current content of the AVPacket. + * If pkt->size is 0 this is identical to av_get_packet. + * Note that this uses av_grow_packet and thus involves a realloc + * which is inefficient. Thus this function should only be used + * when there is no reasonable way to know (an upper bound of) + * the final size. * * @param pkt packet - * @param size desired payload size - * @return >0 (read size) if OK, AVERROR_xxx otherwise + * @param size amount of data to read + * @return >0 (read size) if OK, AVERROR_xxx otherwise, previous data + * will not be lost even if an error occurs. *) -function av_get_packet(s: PByteIOContext; var pkt: TAVPacket; size: cint): cint; +function av_append_packet(s: PAVIOContext; var pkt: TAVPacket; size: cint): cint; cdecl; external av__format; (*************************************************) diff --git a/src/lib/ffmpeg-0.8/avutil.pas b/src/lib/ffmpeg-0.8/avutil.pas index aca94cc0..ee66bd47 100644 --- a/src/lib/ffmpeg-0.8/avutil.pas +++ b/src/lib/ffmpeg-0.8/avutil.pas @@ -78,6 +78,12 @@ const {$MESSAGE Error 'Linked version of libavutil is not yet supported!'} {$IFEND} +{$IFNDEF FPC} +type + // defines for Delphi + size_t = cardinal; +{$ENDIF} + {$INCLUDE libavutil/cpu.pas} {$INCLUDE libavutil/dict.pas} diff --git a/src/lib/ffmpeg-0.9/avcodec.pas b/src/lib/ffmpeg-0.9/avcodec.pas index 35ea05f8..6a42c474 100644 --- a/src/lib/ffmpeg-0.9/avcodec.pas +++ b/src/lib/ffmpeg-0.9/avcodec.pas @@ -173,6 +173,12 @@ const FF_API_GET_PIX_FMT_NAME = LIBAVCODEC_VERSION_MAJOR < 54; {$endif} +{$IFNDEF FPC} +type + // defines for Delphi + size_t = cardinal; +{$ENDIF} + {$IF FF_API_OLD_AUDIOCONVERT} {$I libavcodec/audioconvert.pas} {$IFEND} diff --git a/src/lib/ffmpeg-0.9/avformat.pas b/src/lib/ffmpeg-0.9/avformat.pas index 7d8b4f15..f5951934 100644 --- a/src/lib/ffmpeg-0.9/avformat.pas +++ b/src/lib/ffmpeg-0.9/avformat.pas @@ -244,46 +244,31 @@ procedure av_metadata_free(var m: PAVDictionary); (* packet functions *) -const - PKT_FLAG_KEY = $0001; - -procedure av_destruct_packet_nofree(var pkt: TAVPacket); - cdecl; external av__format; - -(** - * Default packet destructor. - *) -procedure av_destruct_packet(var pkt: TAVPacket); - cdecl; external av__format; - -(** - * Initialize optional fields of a packet with default values. - * - * @param pkt packet - *) -procedure av_init_packet(var pkt: TAVPacket); - cdecl; external av__format; - (** - * Allocate the payload of a packet and initialize its fields with + * Allocate and read the payload of a packet and initialize its fields with * default values. * * @param pkt packet - * @param size wanted payload size - * @return 0 if OK, AVERROR_xxx otherwise + * @param size desired payload size + * @return >0 (read size) if OK, AVERROR_xxx otherwise *) -function av_new_packet(var pkt: TAVPacket; size: cint): cint; +function av_get_packet(s: PByteIOContext; var pkt: TAVPacket; size: cint): cint; cdecl; external av__format; (** - * Allocate and read the payload of a packet and initialize its fields with - * default values. + * Read data and append it to the current content of the AVPacket. + * If pkt->size is 0 this is identical to av_get_packet. + * Note that this uses av_grow_packet and thus involves a realloc + * which is inefficient. Thus this function should only be used + * when there is no reasonable way to know (an upper bound of) + * the final size. * * @param pkt packet - * @param size desired payload size - * @return >0 (read size) if OK, AVERROR_xxx otherwise + * @param size amount of data to read + * @return >0 (read size) if OK, AVERROR_xxx otherwise, previous data + * will not be lost even if an error occurs. *) -function av_get_packet(s: PByteIOContext; var pkt: TAVPacket; size: cint): cint; +function av_append_packet(s: PAVIOContext; var pkt: TAVPacket; size: cint): cint; cdecl; external av__format; (*************************************************) diff --git a/src/lib/ffmpeg-0.9/avutil.pas b/src/lib/ffmpeg-0.9/avutil.pas index 9a2ef4ed..acb06237 100644 --- a/src/lib/ffmpeg-0.9/avutil.pas +++ b/src/lib/ffmpeg-0.9/avutil.pas @@ -78,6 +78,13 @@ const {$MESSAGE Error 'Linked version of libavutil is not yet supported!'} {$IFEND} +type +{$IFNDEF FPC} + // defines for Delphi + size_t = cardinal; +{$ENDIF} + Psize_t = ^size_t; + (** * Return the LIBAVUTIL_VERSION_INT constant. *) @@ -235,9 +242,6 @@ begin Result := (ord(d) or (ord(c) shl 8) or (ord(b) shl 16) or (ord(a) shl 24)); end; -type - Psize_t = ^size_t; - function av_size_mult(a: size_t; b: size_t; r: Psize_t): size_t; cdecl; external av__util; (* To Be Implemented, March 2012 KMS *) diff --git a/src/lib/ffmpeg/avcodec.pas b/src/lib/ffmpeg/avcodec.pas index 139e4bc8..63ffa012 100644 --- a/src/lib/ffmpeg/avcodec.pas +++ b/src/lib/ffmpeg/avcodec.pas @@ -106,6 +106,12 @@ const {$MESSAGE Error 'Linked version of libavcodec is not yet supported!'} {$IFEND} +{$IFNDEF FPC} +type + // defines for Delphi + size_t = cardinal; +{$ENDIF} + const AV_NOPTS_VALUE: cint64 = $8000000000000000; AV_TIME_BASE = 1000000; -- cgit v1.2.3