aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/ffmpeg/How to update the ffmpeg files.txt12
-rw-r--r--src/lib/ffmpeg/avcodec.pas112
-rw-r--r--src/lib/ffmpeg/avformat.pas594
-rw-r--r--src/lib/ffmpeg/avio.pas1099
-rw-r--r--src/lib/ffmpeg/avutil.pas352
-rw-r--r--src/lib/ffmpeg/mathematics.pas16
-rw-r--r--src/lib/ffmpeg/opt.pas218
-rw-r--r--src/lib/ffmpeg/swscale.pas17
8 files changed, 1131 insertions, 1289 deletions
diff --git a/src/lib/ffmpeg/How to update the ffmpeg files.txt b/src/lib/ffmpeg/How to update the ffmpeg files.txt
new file mode 100644
index 00000000..976d0eff
--- /dev/null
+++ b/src/lib/ffmpeg/How to update the ffmpeg files.txt
@@ -0,0 +1,12 @@
+how to update the ffmpeg files:
+
+1) rational.pas
+ error.pas
+2) mathematics.pas
+ dict.pas
+ opt.pas
+3) avutil.pas
+4) avcodec.pas
+5) avio.pas
+ swscale.pas
+6) avformat.pas \ No newline at end of file
diff --git a/src/lib/ffmpeg/avcodec.pas b/src/lib/ffmpeg/avcodec.pas
index 0a436a48..5edc9a7b 100644
--- a/src/lib/ffmpeg/avcodec.pas
+++ b/src/lib/ffmpeg/avcodec.pas
@@ -106,6 +106,9 @@ const
{$MESSAGE Error 'Linked version of libavcodec is not yet supported!'}
{$IFEND}
+type
+ FF_INTERNALC_MEM_TYPE = cuint;
+
const
AV_NOPTS_VALUE: cint64 = $8000000000000000;
AV_TIME_BASE = 1000000;
@@ -190,9 +193,7 @@ type
CODEC_ID_QDRAW,
CODEC_ID_VIXL,
CODEC_ID_QPEG,
-{$IF LIBAVCODEC_VERSION_MAJOR < 53}
CODEC_ID_XVID,
-{$IFEND}
CODEC_ID_PNG,
CODEC_ID_PPM,
CODEC_ID_PBM,
@@ -257,65 +258,36 @@ type
CODEC_ID_MOTIONPIXELS,
CODEC_ID_TGV,
CODEC_ID_TGQ,
-{$IF LIBAVCODEC_VERSION >= 52012000} // >= 52.12.0
CODEC_ID_TQI,
-{$IFEND}
-{$IF LIBAVCODEC_VERSION >= 52022002} // >= 52.22.2
CODEC_ID_AURA,
CODEC_ID_AURA2,
-{$IFEND}
-{$IF LIBAVCODEC_VERSION >= 52027000} // >= 52.27.0
CODEC_ID_V210X,
-{$IFEND}
-{$IF LIBAVCODEC_VERSION >= 52028000} // >= 52.28.0
CODEC_ID_TMV,
-{$IFEND}
-{$IF LIBAVCODEC_VERSION >= 52029000} // >= 52.29.0
CODEC_ID_V210,
-{$IFEND}
-{$IF LIBAVCODEC_VERSION >= 52030002} // >= 52.30.2
CODEC_ID_DPX,
-{$IFEND}
-{$IF LIBAVCODEC_VERSION >= 52031002} // >= 52.31.2
CODEC_ID_MAD,
-{$IFEND}
-{$IF LIBAVCODEC_VERSION >= 52037000} // >= 52.37.0
CODEC_ID_FRWU,
-{$IFEND}
-{$IF LIBAVCODEC_VERSION >= 52041000} // >= 52.41.0
CODEC_ID_FLASHSV2,
-{$IFEND}
-{$IF LIBAVCODEC_VERSION >= 52043000} // >= 52.43.0
CODEC_ID_CDGRAPHICS,
CODEC_ID_R210,
-{$IFEND}
- CODEC_ID_ANM,
-{$IF LIBAVCODEC_VERSION >= 52049000} // >= 52.49.0
+ CODEC_ID_ANM,
CODEC_ID_BINKVIDEO,
-{$IFEND}
-{$IF LIBAVCODEC_VERSION >= 52052000} // >= 52.52.0
CODEC_ID_IFF_ILBM,
CODEC_ID_IFF_BYTERUN1,
-{$IFEND}
-{$IF LIBAVCODEC_VERSION >= 52058000} // >= 52.58.0
CODEC_ID_KGV1,
-{$IFEND}
-{$IF LIBAVCODEC_VERSION >= 52062000} // >= 52.62.0
CODEC_ID_YOP,
-{$IFEND}
-{$IF LIBAVCODEC_VERSION >= 52067002} // >= 52.67.2
CODEC_ID_VP8,
-{$IFEND}
-{$IF LIBAVCODEC_VERSION >= 52075001} // >= 52.75.1
CODEC_ID_PICTOR,
-{$IFEND}
-{$IF LIBAVCODEC_VERSION >= 52084000} // >= 52.84.0
CODEC_ID_ANSI,
-{$IFEND}
-{$IF LIBAVCODEC_VERSION >= 52086001} // >= 52.86.1
CODEC_ID_A64_MULTI,
CODEC_ID_A64_MULTI5,
-{$IFEND}
+ CODEC_ID_R10K,
+ CODEC_ID_MXPEG,
+ CODEC_ID_LAGARITH,
+ CODEC_ID_PRORES,
+ CODEC_ID_JV,
+ CODEC_ID_DFA,
+ CODEC_ID_8SVX_RAW,
//* various PCM "codecs" */
CODEC_ID_PCM_S16LE= $10000,
@@ -342,9 +314,9 @@ type
CODEC_ID_PCM_F32LE,
CODEC_ID_PCM_F64BE,
CODEC_ID_PCM_F64LE,
-{$IF LIBAVCODEC_VERSION >= 52034000} // >= 52.34.0
CODEC_ID_PCM_BLURAY,
-{$IFEND}
+ CODEC_ID_PCM_LXF,
+ CODEC_ID_S302M,
//* various ADPCM codecs */
CODEC_ID_ADPCM_IMA_QT= $11000,
@@ -375,6 +347,7 @@ type
CODEC_ID_ADPCM_EA_XAS,
CODEC_ID_ADPCM_EA_MAXIS_XA,
CODEC_ID_ADPCM_IMA_ISS,
+ CODEC_ID_ADPCM_G722,
//* AMR */
CODEC_ID_AMR_NB= $12000,
@@ -394,9 +367,6 @@ type
CODEC_ID_MP2= $15000,
CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
CODEC_ID_AAC,
- {$IF LIBAVCODEC_VERSION < 52000000} // < 52.0.0
- _CODEC_ID_MPEG4AAC, // will be redefined to CODEC_ID_AAC below
- {$IFEND}
CODEC_ID_AC3,
CODEC_ID_DTS,
CODEC_ID_VORBIS,
@@ -440,39 +410,27 @@ type
CODEC_ID_EAC3,
CODEC_ID_SIPR,
CODEC_ID_MP1,
-{$IF LIBAVCODEC_VERSION >= 52020000} // >= 52.20.0
CODEC_ID_TWINVQ,
-{$IFEND}
-{$IF LIBAVCODEC_VERSION >= 52022000} // >= 52.22.0
CODEC_ID_TRUEHD,
-{$IFEND}
-{$IF LIBAVCODEC_VERSION >= 52026000} // >= 52.26.0
CODEC_ID_MP4ALS,
-{$IFEND}
-{$IF LIBAVCODEC_VERSION >= 52035000} // >= 52.35.0
CODEC_ID_ATRAC1,
-{$IFEND}
-{$IF LIBAVCODEC_VERSION >= 52049000} // >= 52.49.0
CODEC_ID_BINKAUDIO_RDFT,
CODEC_ID_BINKAUDIO_DCT,
-{$IFEND}
+ CODEC_ID_AAC_LATM,
+ CODEC_ID_QDMC,
+ CODEC_ID_CELT,
//* subtitle codecs */
- CODEC_ID_DVD_SUBTITLE= $17000,
+ CODEC_ID_DVD_SUBTITLE= 0x17000,
CODEC_ID_DVB_SUBTITLE,
CODEC_ID_TEXT, ///< raw UTF-8 text
CODEC_ID_XSUB,
CODEC_ID_SSA,
CODEC_ID_MOV_TEXT,
-{$IF LIBAVCODEC_VERSION >= 52033000} // >= 52.33.0
CODEC_ID_HDMV_PGS_SUBTITLE,
-{$IFEND}
-{$IF LIBAVCODEC_VERSION >= 52037001} // >= 52.37.1
CODEC_ID_DVB_TELETEXT,
-{$IFEND}
-{$IF LIBAVCODEC_VERSION >= 52084001} // >= 52.84.1
CODEC_ID_SRT,
-{$IFEND}
+ CODEC_ID_MICRODVD,
(* other specific kind of codecs (generally used for attachments) *)
CODEC_ID_TTF= $18000,
@@ -481,35 +439,28 @@ type
CODEC_ID_MPEG2TS= $20000, {*< _FAKE_ codec to indicate a raw MPEG-2 TS
* stream (only used by libavformat) *}
- __CODEC_ID_4BYTE = $FFFFF // ensure 4-byte enum
+ CODEC_ID_FFMETADATA= $21000 ///< Dummy codec for streams containing only metadata information.
);
-{$IF LIBAVCODEC_VERSION < 52000000} // < 52.0.0
-{* CODEC_ID_MP3LAME is obsolete *}
-const
- CODEC_ID_MP3LAME = CODEC_ID_MP3;
- CODEC_ID_MPEG4AAC = CODEC_ID_AAC;
-{$IFEND}
-
-{$IF LIBAVCODEC_VERSION_MAJOR < 53} // < 53.0.0
type
- TCodecType = (
- CODEC_TYPE_UNKNOWN = -1,
- CODEC_TYPE_VIDEO,
- CODEC_TYPE_AUDIO,
- CODEC_TYPE_DATA,
- CODEC_TYPE_SUBTITLE,
- CODEC_TYPE_ATTACHMENT,
- CODEC_TYPE_NB
+ TCodecType = TAVMediaType;
+
+const
+ CODEC_TYPE_UNKNOWN = AVMEDIA_TYPE_UNKNOWN;
+ CODEC_TYPE_VIDEO = AVMEDIA_TYPE_VIDEO;
+ CODEC_TYPE_AUDIO = AVMEDIA_TYPE_AUDIO;
+ CODEC_TYPE_DATA = AVMEDIA_TYPE_DATA;
+ CODEC_TYPE_SUBTITLE = AVMEDIA_TYPE_SUBTITLE;
+ CODEC_TYPE_ATTACHMENT = AVMEDIA_TYPE_ATTACHMENT;
+ CODEC_TYPE_NB = AVMEDIA_TYPE_NB;
);
-{$IFEND}
{
TAVMediaType moved to avutil in LIBAVUTIL_VERSION 50.14.0
but moving it in the pascal headers was not really necessary
but caused problems. So, I (KMS) left it here.
}
-{$IF LIBAVCODEC_VERSION >= 52064000} // >= 52.64.0
+
type
TAVMediaType = (
AVMEDIA_TYPE_UNKNOWN = -1,
@@ -520,7 +471,6 @@ type
AVMEDIA_TYPE_ATTACHMENT,
AVMEDIA_TYPE_NB
);
-{$IFEND}
{**
* all in native endian
diff --git a/src/lib/ffmpeg/avformat.pas b/src/lib/ffmpeg/avformat.pas
index bd13c70e..00bed0d8 100644
--- a/src/lib/ffmpeg/avformat.pas
+++ b/src/lib/ffmpeg/avformat.pas
@@ -21,9 +21,9 @@
* in the source codes.
* - Changes and updates by the UltraStar Deluxe Team
*
- * Conversion of libavformat/avformat.h
- * Min. version: 50.5.0 , revision 6577, Sat Oct 7 15:30:46 2006 UTC
- * Max. version: 52.78.3, revision 24841, Thu Aug 26 02:00:00 2010 CET
+ * Conversion of version 0.7 libavformat/avformat.h
+ * Min. version: 52.110.0
+ * Max. version: 52.111.0
*)
unit avformat;
@@ -55,41 +55,22 @@ uses
const
(*
- * IMPORTANT: The official FFmpeg C headers change very quickly. Often some
- * of the data structures are changed so that they become incompatible with
- * older header files. The Pascal headers have to be adjusted to those changes,
- * otherwise the application might crash randomly or strange bugs (not
- * necessarily related to video or audio due to buffer overflows etc.) might
- * occur.
- *
- * In the past users reported problems with USDX that took hours to fix and
- * the problem was an unsupported version of FFmpeg. So we decided to disable
- * support for future versions of FFmpeg until the headers are revised by us
- * for that version as they otherwise most probably will break USDX.
- *
- * If the headers do not yet support your FFmpeg version you may want to
- * adjust the max. version numbers manually but please note: it may work but
- * in many cases it does not. The USDX team does NOT PROVIDE ANY SUPPORT
- * for the game if the MAX. VERSION WAS CHANGED.
- *
- * The only safe way to support new versions of FFmpeg is to add the changes
- * of the FFmpeg git repository C headers to the Pascal headers.
- * You can accelerate this process by posting a patch with the git changes
- * translated to Pascal to our bug tracker (please join our IRC chat before
- * you start working on it). Simply adjusting the max. versions is NOT a valid
- * fix.
+ * IMPORTANT: This headers are valid for all minor revisions of ffmpeg
+ * version 0.7x
+ * This file has been created with the previous ffmpeg headers as a basis
+ * by removing all unneeded conditionals.
*)
(* Max. supported version by this header *)
LIBAVFORMAT_MAX_VERSION_MAJOR = 52;
- LIBAVFORMAT_MAX_VERSION_MINOR = 78;
- LIBAVFORMAT_MAX_VERSION_RELEASE = 3;
+ LIBAVFORMAT_MAX_VERSION_MINOR = 110;
+ LIBAVFORMAT_MAX_VERSION_RELEASE = 0;
LIBAVFORMAT_MAX_VERSION = (LIBAVFORMAT_MAX_VERSION_MAJOR * VERSION_MAJOR) +
(LIBAVFORMAT_MAX_VERSION_MINOR * VERSION_MINOR) +
(LIBAVFORMAT_MAX_VERSION_RELEASE * VERSION_RELEASE);
(* Min. supported version by this header *)
- LIBAVFORMAT_MIN_VERSION_MAJOR = 50;
- LIBAVFORMAT_MIN_VERSION_MINOR = 5;
+ LIBAVFORMAT_MIN_VERSION_MAJOR = 52;
+ LIBAVFORMAT_MIN_VERSION_MINOR = 111;
LIBAVFORMAT_MIN_VERSION_RELEASE = 0;
LIBAVFORMAT_MIN_VERSION = (LIBAVFORMAT_MIN_VERSION_MAJOR * VERSION_MAJOR) +
(LIBAVFORMAT_MIN_VERSION_MINOR * VERSION_MINOR) +
@@ -105,32 +86,50 @@ const
{$MESSAGE Error 'Linked version of libavformat is not yet supported!'}
{$IFEND}
-{$IF LIBAVFORMAT_VERSION >= 52078003} // >= 52.78.3
+const
+{
+ LIBAVFORMAT_BUILD = LIBAVFORMAT_VERSION_INT;
+ LIBAVFORMAT_IDENT = 'Lavf' AV_STRINGIFY(LIBAVFORMAT_VERSION);
+}
(**
* Those FF_API_* defines are not part of public API.
* They may change, break or disappear at any time.
*)
const
- {$IF LIBAVFORMAT_VERSION_MAJOR < 53}
- FF_API_MAX_STREAMS = (LIBAVFORMAT_VERSION_MAJOR < 53);
- FF_API_OLD_METADATA = (LIBAVFORMAT_VERSION_MAJOR < 53);
- FF_API_REGISTER_PROTOCOL = (LIBAVFORMAT_VERSION_MAJOR < 53);
- FF_API_URL_RESETBUF = (LIBAVFORMAT_VERSION_MAJOR < 53);
- {$ELSE}
- FF_API_URL_CLASS = (LIBAVFORMAT_VERSION_MAJOR >= 53);
- {$IFEND}
-{$IFEND}
-
-{$IF LIBAVFORMAT_VERSION >= 52020000} // 52.20.0
-(**
- * I return the LIBAVFORMAT_VERSION_INT constant. You got
- * a fucking problem with that, douchebag?
+ FF_API_MAX_STREAMS = (LIBAVFORMAT_VERSION_MAJOR < 53);
+ FF_API_OLD_METADATA = (LIBAVFORMAT_VERSION_MAJOR < 53);
+ FF_API_OLD_METADATA2 = (LIBAVFORMAT_VERSION_MAJOR < 54);
+ FF_API_URL_CLASS = (LIBAVFORMAT_VERSION_MAJOR >= 53);
+ FF_API_URL_RESETBUF = (LIBAVFORMAT_VERSION_MAJOR < 53);
+ FF_API_REGISTER_PROTOCOL = (LIBAVFORMAT_VERSION_MAJOR < 53);
+ FF_API_GUESS_FORMAT = (LIBAVFORMAT_VERSION_MAJOR < 53);
+ FF_API_UDP_GET_FILE = (LIBAVFORMAT_VERSION_MAJOR < 53);
+ FF_API_URL_SPLIT = (LIBAVFORMAT_VERSION_MAJOR < 53);
+ FF_API_ALLOC_FORMAT_CONTEXT = (LIBAVFORMAT_VERSION_MAJOR < 53);
+ FF_API_PARSE_FRAME_PARAM = (LIBAVFORMAT_VERSION_MAJOR < 53);
+ FF_API_READ_SEEK = (LIBAVFORMAT_VERSION_MAJOR < 54);
+ FF_API_LAVF_UNUSED = (LIBAVFORMAT_VERSION_MAJOR < 53);
+ FF_API_PARAMETERS_CODEC_ID = (LIBAVFORMAT_VERSION_MAJOR < 53);
+ FF_API_FIRST_FORMAT = (LIBAVFORMAT_VERSION_MAJOR < 53);
+ FF_API_SYMVER = (LIBAVFORMAT_VERSION_MAJOR < 53);
+ FF_API_OLD_AVIO = (LIBAVFORMAT_VERSION_MAJOR < 54);
+ FF_API_INDEX_BUILT = (LIBAVFORMAT_VERSION_MAJOR < 53);
+ FF_API_DUMP_FORMAT = (LIBAVFORMAT_VERSION_MAJOR < 54);
+ FF_API_PARSE_DATE = (LIBAVFORMAT_VERSION_MAJOR < 54);
+ FF_API_FIND_INFO_TAG = (LIBAVFORMAT_VERSION_MAJOR < 54);
+ FF_API_PKT_DUMP = (LIBAVFORMAT_VERSION_MAJOR < 54);
+ FF_API_GUESS_IMG2_CODEC = (LIBAVFORMAT_VERSION_MAJOR < 54);
+ FF_API_SDP_CREATE = (LIBAVFORMAT_VERSION_MAJOR < 54);
+ FF_API_ALLOC_OUTPUT_CONTEXT = (LIBAVFORMAT_VERSION_MAJOR < 54);
+ FF_API_FORMAT_PARAMETERS = (LIBAVFORMAT_VERSION_MAJOR < 54);
+ FF_API_FLAG_RTP_HINT = (LIBAVFORMAT_VERSION_MAJOR < 54);
+
+(**
+ * Return the LIBAVFORMAT_VERSION_INT constant.
*)
function avformat_version(): cuint;
cdecl; external av__format;
-{$IFEND}
-{$IF LIBAVFORMAT_VERSION >= 52039002} // 52.39.2
(**
* Return the libavformat build-time configuration.
*)
@@ -142,7 +141,6 @@ function avformat_configuration(): {const} PansiChar;
*)
function avformat_license(): {const} PansiChar;
cdecl; external av__format;
-{$IFEND}
type
PAVFile = Pointer;
@@ -162,23 +160,75 @@ type
* 2. Metadata is flat, not hierarchical; there are no subtags. If you
* want to store, e.g., the email address of the child of producer Alice
* and actor Bob, that could have key=alice_and_bobs_childs_email_address.
- * 3. A tag whose value is localized for a particular language is appended
- * with a dash character ('-') and the ISO 639-2/B 3-letter language code.
- * For example: Author-ger=Michael, Author-eng=Mike
- * The original/default language is in the unqualified "Author" tag.
- * A demuxer should set a default if it sets any translated tag.
+ * 3. Several modifiers can be applied to the tag name. This is done by
+ * appending a dash character ('-') and the modifier name in the order
+ * they appear in the list below -- e.g. foo-eng-sort, not foo-sort-eng.
+ * a) language -- a tag whose value is localized for a particular language
+ * is appended with the ISO 639-2/B 3-letter language code.
+ * For example: Author-ger=Michael, Author-eng=Mike
+ * The original/default language is in the unqualified "Author" tag.
+ * A demuxer should set a default if it sets any translated tag.
+ * b) sorting -- a modified version of a tag that should be used for
+ * sorting will have '-sort' appended. E.g. artist="The Beatles",
+ * artist-sort="Beatles, The".
+ *
+ * 4. Demuxers attempt to export metadata in a generic format, however tags
+ * with no generic equivalents are left as they are stored in the container.
+ * Follows a list of generic tag names:
+ *
+ * album -- name of the set this work belongs to
+ * album_artist -- main creator of the set/album, if different from artist.
+ * e.g. "Various Artists" for compilation albums.
+ * artist -- main creator of the work
+ * comment -- any additional description of the file.
+ * composer -- who composed the work, if different from artist.
+ * copyright -- name of copyright holder.
+ * creation_time-- date when the file was created, preferably in ISO 8601.
+ * date -- date when the work was created, preferably in ISO 8601.
+ * disc -- number of a subset, e.g. disc in a multi-disc collection.
+ * encoder -- name/settings of the software/hardware that produced the file.
+ * encoded_by -- person/group who created the file.
+ * filename -- original name of the file.
+ * genre -- <self-evident>.
+ * language -- main language in which the work is performed, preferably
+ * in ISO 639-2 format. Multiple languages can be specified by
+ * separating them with commas.
+ * performer -- artist who performed the work, if different from artist.
+ * E.g for "Also sprach Zarathustra", artist would be "Richard
+ * Strauss" and performer "London Philharmonic Orchestra".
+ * publisher -- name of the label/publisher.
+ * service_name -- name of the service in broadcasting (channel name).
+ * service_provider -- name of the service provider in broadcasting.
+ * title -- name of the work.
+ * track -- number of this work in the set, can be in form current/total.
+ * variant_bitrate -- the total bitrate of the bitrate variant that the current stream is part of
+ *)
+
+{$IFDEF FF_API_OLD_METADATA2}
+(**
+ * @defgroup old_metadata Old metadata API
+ * The following functions are deprecated, use
+ * their equivalents from libavutil/dict.h instead.
+ * @
*)
+
const
+{
AV_METADATA_MATCH_CASE = 1;
AV_METADATA_IGNORE_SUFFIX = 2;
-{$IF LIBAVFORMAT_VERSION >= 52043000} // >= 52.43.0
AV_METADATA_DONT_STRDUP_KEY = 4;
AV_METADATA_DONT_STRDUP_VAL = 8;
-{$IFEND}
-{$IF LIBAVFORMAT_VERSION >= 52061000} // >= 52.61.0
AV_METADATA_DONT_OVERWRITE = 16;
-{$IFEND}
+}
+ AV_METADATA_MATCH_CASE = AV_DICT_MATCH_CASE;
+ AV_METADATA_IGNORE_SUFFIX = AV_DICT_IGNORE_SUFFIX;
+ AV_METADATA_DONT_STRDUP_KEY = AV_DICT_DONT_STRDUP_KEY;
+ AV_METADATA_DONT_STRDUP_VAL = AV_DICT_DONT_STRDUP_VAL;
+ AV_METADATA_DONT_OVERWRITE = AV_DICT_DONT_OVERWRITE;
+{
+typedef struct AVMetadataConv AVMetadataConv;
+}
type
PAVMetadataTag = ^TAVMetadataTag;
TAVMetadataTag = record
@@ -187,8 +237,9 @@ type
end;
PAVMetadata = Pointer;
+ PAVDictionary = PAVMetadata;
+ PAVDictionaryEntry = PAVMetadata;
-{$IF LIBAVFORMAT_VERSION > 52024001} // > 52.24.1
(**
* Get a metadata element with matching key.
*
@@ -197,28 +248,11 @@ type
* @param flags Allows case as well as suffix-insensitive comparisons.
* @return Found tag or NULL, changing key or value leads to undefined behavior.
*)
-function av_metadata_get(m: PAVMetadata; key: {const} PAnsiChar;
- prev: {const} PAVMetadataTag ; flags: cint): PAVMetadataTag;
+function av_metadata_get(m: PAVDictionary; key: {const} PAnsiChar;
+ prev: {const} PAVDictionaryEntry; flags: cint): PAVDictionaryEntry;
cdecl; external av__format;
-{$IF LIBAVFORMAT_VERSION < 52078003} // < 52.78.3
-(**
- * Set the given tag in *pm, overwriting an existing tag.
- *
- * @param pm pointer to a pointer to a metadata struct. If *pm is NULL
- * a metadata struct is allocated and put in *pm.
- * @param key tag key to add to *pm (will be av_strduped)
- * @param value tag value to add to *pm (will be av_strduped)
- * @return >= 0 on success otherwise an error code <0
- * @deprecated Use av_metadata_set2() instead.
- *)
-function av_metadata_set(var pm: PAVMetadata; key: {const} PAnsiChar; value: {const} PAnsiChar): cint;
- cdecl; external av__format;
- {$IF LIBAVFORMAT_VERSION >= 52061000} // >= 52.61.0
- deprecated;
- {$IFEND}
-{$ELSE}
- {$IFDEF FF_API_OLD_METADATA}
+{$IFDEF FF_API_OLD_METADATA}
(**
* Set the given tag in *pm, overwriting an existing tag.
*
@@ -231,10 +265,8 @@ function av_metadata_set(var pm: PAVMetadata; key: {const} PAnsiChar; value: {co
*)
function av_metadata_set(var pm: PAVMetadata; key: {const} PAnsiChar; value: {const} PAnsiChar): cint;
cdecl; external av__format; deprecated;
- {$ENDIF}
-{$IFEND}
+{$ENDIF}
-{$IF LIBAVFORMAT_VERSION >= 52043000} // >= 52.43.0
(**
* Set the given tag in *pm, overwriting an existing tag.
*
@@ -245,20 +277,37 @@ function av_metadata_set(var pm: PAVMetadata; key: {const} PAnsiChar; value: {co
* Passing a NULL value will cause an existing tag to be deleted.
* @return >= 0 on success otherwise an error code <0
*)
-function av_metadata_set2(var pm: PAVMetadata; key: {const} PAnsiChar; value: {const} PAnsiChar; flags: cint): cint;
- cdecl; external av__format;
-{$IFEND}
+function av_metadata_set2(var pm: PAVDictionary; key: {const} PAnsiChar; value: {const} PAnsiChar; flags: cint): cint;
+ cdecl; external av__format; deprecated;
(**
- * Free all the memory allocated for an AVMetadata struct.
+ * This function is provided for compatibility reason and currently does nothing.
*)
-procedure av_metadata_free(var m: PAVMetadata);
- cdecl; external av__format;
-{$IFEND}
+function av_metadata_conv(ctx: PAVFormatContext; d_conv: {const} PAVMetadataConv;
+ s_conv: {const} PAVMetadataConv);
+ cdecl; external av__format; deprecated;
+
+(**
+ * Copy metadata from one AVDictionary struct into another.
+ * @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL,
+ * this function will allocate a struct for you and put it in *dst
+ * @param src pointer to source AVDictionary struct
+ * @param flags flags to use when setting metadata in *dst
+ * @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag
+ *)
+function av_metadata_copy(var dst: PAVDictionary; src: PAVDictionary; flags: cint);
+ cdecl; external av__format; deprecated;
+
+(**
+ * Free all the memory allocated for an AVDictionary struct.
+ *)
+procedure av_metadata_free(var m: PAVDictionary);
+ cdecl; external av__format; deprecated;
+
+{$ENDIF}
(* packet functions *)
-{$IF LIBAVFORMAT_VERSION < 52032000} // < 52.32.0
type
PAVPacket = ^TAVPacket;
TAVPacket = record
@@ -291,7 +340,6 @@ type
priv: pointer;
pos: cint64; ///< byte position in stream, -1 if unknown
- {$IF LIBAVFORMAT_VERSION >= 52022000} // 52.22.0
(**
* Time difference in stream time base units from the pts of this
* packet to the point at which the output from the decoder has converged
@@ -308,7 +356,6 @@ type
* subtitles are correctly displayed after seeking.
*)
convergence_duration: cint64;
- {$IFEND}
end;
const
@@ -329,9 +376,7 @@ procedure av_destruct_packet(var pkt: TAVPacket);
* @param pkt packet
*)
procedure av_init_packet(var pkt: TAVPacket);
-{$IF LIBAVFORMAT_VERSION >= 51012002} // 51.12.2
cdecl; external av__format;
-{$IFEND}
(**
* Allocate the payload of a packet and initialize its fields with
@@ -343,7 +388,6 @@ procedure av_init_packet(var pkt: TAVPacket);
*)
function av_new_packet(var pkt: TAVPacket; size: cint): cint;
cdecl; external av__format;
-{$IFEND}
(**
* Allocate and read the payload of a packet and initialize its fields with
@@ -356,22 +400,6 @@ 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;
-{$IF LIBAVFORMAT_VERSION < 52032000} // < 52.32.0
-(**
- * @warning This is a hack - the packet memory allocation stuff is broken. The
- * packet is allocated if it was not really allocated.
- *)
-function av_dup_packet(pkt: PAVPacket): cint;
- cdecl; external av__format;
-
-(**
- * Free a packet.
- *
- * @param pkt packet to free
- *)
-procedure av_free_packet(pkt: PAVPacket); {$IFDEF HasInline}inline;{$ENDIF}
-{$IFEND}
-
(*************************************************)
(* fractional numbers for exact pts handling *)
@@ -412,12 +440,8 @@ const
AVFMT_NOTIMESTAMPS = $0080; (**< Format does not need / have any timestamps. *)
AVFMT_GENERIC_INDEX = $0100; (**< Use generic index building code. *)
AVFMT_TS_DISCONT = $0200; (**< Format allows timestamp discontinuities. *)
- {$IF LIBAVFORMAT_VERSION >= 52029002} // 52.29.2
AVFMT_VARIABLE_FPS = $0400; (**< Format allows variable fps. *)
- {$IFEND}
- {$IF LIBAVFORMAT_VERSION >= 52052000} // 52.52.0
AVFMT_NODIMENSIONS = $0800; (**< Format does not need width/height *)
- {$IFEND}
// used by AVIndexEntry
AVINDEX_KEYFRAME = $0001;
@@ -425,19 +449,7 @@ const
AVFMTCTX_NOHEADER = $0001; (**< signal that no header is present
(streams are added dynamically) *)
-{$IF LIBAVFORMAT_VERSION < 52078003} // < 52.78.3
- {$IF LIBAVFORMAT_VERSION_MAJOR < 53}
MAX_STREAMS = 20;
- {$ELSE}
- {$IF LIBAVFORMAT_VERSION < 52068000} // < 52.68.0
- MAX_STREAMS = 100;
- {$IFEND}
- {$IFEND}
-{$ELSE}
- {$IFDEF FF_API_MAX_STREAMS}
- MAX_STREAMS = 20;
- {$ENDIF}
-{$IFEND}
AVFMT_NOOUTPUTLOOP = -1;
@@ -445,16 +457,10 @@ const
AVFMT_FLAG_GENPTS = $0001; ///< Generate missing pts even if it requires parsing future frames.
AVFMT_FLAG_IGNIDX = $0002; ///< Ignore index.
AVFMT_FLAG_NONBLOCK = $0004; ///< Do not block when reading packets from input.
-{$IF LIBAVFORMAT_VERSION >= 52048000} // >= 52.48.0
AVFMT_FLAG_IGNDTS = $0008; ///< Ignore DTS on frames that contain both DTS & PTS
-{$IFEND}
-{$IF LIBAVFORMAT_VERSION >= 52060000} // >= 52.60.0
AVFMT_FLAG_NOFILLIN = $0010; ///< Do not infer any values from other values, just return what is stored in the container
AVFMT_FLAG_NOPARSE = $0020; ///< Do not use AVParsers, you also must set AVFMT_FLAG_NOFILLIN as the fillin code works on frames and no parsing -> no frames. Also seeking to frames can not work if parsing to find frame boundaries has been disabled
-{$IFEND}
-{$IF LIBAVFORMAT_VERSION >= 52063000} // >= 52.63.0
AVFMT_FLAG_RTP_HINT = $0040; ///< Add RTP hinting to the output file
-{$IFEND}
// used by AVStream
MAX_REORDER_DELAY = 16;
@@ -470,33 +476,18 @@ const
AV_DISPOSITION_LYRICS = $0010;
AV_DISPOSITION_KARAOKE = $0020;
- {$IF LIBAVFORMAT_VERSION >= 52073000} // >= 52.73.0
(**
* Track should be used during playback by default.
* Useful for subtitle track that should be displayed
* even when user did not explicitly ask for subtitles.
*)
AV_DISPOSITION_FORCED = $0040;
- {$IFEND}
// used by TAVFormatContext.debug
FF_FDEBUG_TS = 0001;
- {$IF LIBAVFORMAT_VERSION >= 52034000} // >= 52.34.0
- {$IF LIBAVFORMAT_VERSION < 52039000} // < 52.39.0
- MAX_PROBE_PACKETS = 100;
- {$ELSE}
MAX_PROBE_PACKETS = 2500;
- {$IFEND}
- {$IFEND}
-
- {$IF LIBAVFORMAT_VERSION >= 52035000} // >= 52.35.0
- {$IF LIBAVFORMAT_VERSION < 52039000} // < 52.39.0
- RAW_PACKET_BUFFER_SIZE = 32000;
- {$ELSE}
RAW_PACKET_BUFFER_SIZE = 2500000;
- {$IFEND}
- {$IFEND}
type
PPAVCodecTag = ^PAVCodecTag;
@@ -519,12 +510,6 @@ type
PPAVProgram = ^PAVProgram;
PAVProgram = ^TAVProgram;
- {$IF LIBAVFORMAT_VERSION < 51006000} // 51.6.0
- PAVImageFormat = ^TAVImageFormat;
- PAVImageInfo = ^TAVImageInfo;
- {$IFEND}
-
-{$IF LIBAVFORMAT_VERSION >= 52030001} // >= 52.30.1
(**
* Convert all the metadata sets from ctx according to the source and
* destination conversion tables.
@@ -538,23 +523,16 @@ type
d_conv: {const} PAVMetadataConv;
s_conv: {const} PAVMetadataConv;
end;
-{$IFEND}
PAVChapter = ^TAVChapter;
TAVChapter = record
id: cint; ///< unique ID to identify the chapter
time_base: TAVRational; ///< time base in which the start/end timestamps are specified
start, end_: cint64; ///< chapter start/end time in time_base units
- {$IF LIBAVFORMAT_VERSION < 52078003} // < 52.78.3
+{$IFDEF FF_API_OLD_METADATA}
title: PAnsiChar; ///< chapter title
- {$ELSE}
- {$IFDEF FF_API_OLD_METADATA}
- title: PAnsiChar; ///< chapter title
- {$ENDIF}
- {$IFEND}
- {$IF LIBAVFORMAT_VERSION >= 52024001} // 52.24.1
+{$ENDIF}
metadata: PAVMetadata;
- {$IFEND}
end;
TAVChapterArray = array[0..(MaxInt div SizeOf(TAVChapter))-1] of TAVChapter;
PAVChapterArray = ^TAVChapterArray;
@@ -566,13 +544,7 @@ type
width: cint;
height: cint;
pix_fmt: TAVPixelFormat;
- {$IF LIBAVFORMAT_VERSION < 51006000} // 51.6.0
- image_format: PAVImageFormat;
- {$IFEND}
channel: cint; (**< Used to select DV channel. *)
- {$IF LIBAVFORMAT_VERSION_MAJOR < 52}
- device: PAnsiChar; (* video, audio or DV device, if LIBAVFORMAT_VERSION_INT < (52<<16) *)
- {$IFEND}
standard: PAnsiChar; (**< TV standard, NTSC, PAL, SECAM *)
{ Delphi does not support bit fields -> use bf_flags instead
unsigned int mpeg2ts_raw:1; (**< Force raw MPEG-2 transport stream output, if possible. *)
@@ -584,10 +556,8 @@ type
unsigned int prealloced_context:1;
}
bf_flags: byte; // 0:mpeg2ts_raw/1:mpeg2ts_compute_pcr/2:initial_pause/3:prealloced_context
- {$IF LIBAVFORMAT_VERSION_MAJOR < 53}
video_codec_id: TCodecID;
audio_codec_id: TCodecID;
- {$IFEND}
end;
TAVOutputFormat = record
@@ -621,21 +591,15 @@ type
interleave_packet: function (s: PAVFormatContext; out_: PAVPacket;
in_: PAVPacket; flush: cint): cint; cdecl;
- {$IF LIBAVFORMAT_VERSION >= 51008000} // 51.8.0
(**
* List of supported codec_id-codec_tag pairs, ordered by "better
* choice first". The arrays are all terminated by CODEC_ID_NONE.
*)
codec_tag: {const} PPAVCodecTag;
- {$IFEND}
- {$IF LIBAVFORMAT_VERSION >= 51012002} // 51.12.2
subtitle_codec: TCodecID; (**< default subtitle codec *)
- {$IFEND}
- {$IF LIBAVFORMAT_VERSION >= 52030001} // 52.30.1
{const} metadata_conv: PAVMetadataConv;
- {$IFEND}
(* private fields *)
next: PAVOutputFormat;
@@ -691,7 +655,6 @@ type
*)
read_close: function (c: PAVFormatContext): cint; cdecl;
-{$IF LIBAVFORMAT_VERSION_MAJOR < 53}
(**
* Seek to a given timestamp relative to the frames in
* stream component stream_index.
@@ -702,7 +665,6 @@ type
*)
read_seek: function (c: PAVFormatContext; stream_index: cint;
timestamp: cint64; flags: cint): cint; cdecl;
-{$IFEND}
(**
* Gets the next timestamp in stream[stream_index].time_base units.
@@ -740,11 +702,8 @@ type
*)
read_pause: function (c: PAVFormatContext): cint; cdecl;
- {$IF LIBAVFORMAT_VERSION >= 51008000} // 51.8.0
codec_tag: {const} PPAVCodecTag;
- {$IFEND}
- {$IF LIBAVFORMAT_VERSION >= 52030000} // 52.30.0
(**
* Seek to timestamp ts.
* Seeking will be done so that the point from which all active streams
@@ -757,11 +716,8 @@ type
ts: cint64;
max_ts: cint64;
flags: cint): cint; cdecl;
- {$IFEND}
- {$IF LIBAVFORMAT_VERSION >= 52030001} // 52.30.1
{const} metadata_conv: PAVMetadataConv;
- {$IFEND}
(* private fields *)
next: PAVInputFormat;
@@ -771,10 +727,8 @@ type
AVSTREAM_PARSE_NONE,
AVSTREAM_PARSE_FULL, (**< full parsing and repack *)
AVSTREAM_PARSE_HEADERS, (**< Only parse headers, do not repack. *)
- AVSTREAM_PARSE_TIMESTAMPS (**< full parsing and interpolation of timestamps for frames not starting on a packet boundary *)
- {$IF LIBAVFORMAT_VERSION >= 52066000} // 52.66.0
- , AVSTREAM_PARSE_FULL_ONCE (**< full parsing and repack of the first frame only, only implemented for H.264 currently *)
- {$IFEND}
+ AVSTREAM_PARSE_TIMESTAMPS, (**< full parsing and interpolation of timestamps for frames not starting on a packet boundary *)
+ AVSTREAM_PARSE_FULL_ONCE (**< full parsing and repack of the first frame only, only implemented for H.264 currently *)
);
TAVIndexEntry = record
@@ -812,9 +766,6 @@ type
(* internal data used in av_find_stream_info() *)
first_dts: cint64;
- {$IF LIBAVFORMAT_VERSION_MAJOR < 52}
- codec_info_nb_frames: cint;
- {$IFEND}
(**
* encoding: pts generation when outputting stream
@@ -854,13 +805,9 @@ type
*)
duration: cint64;
- {$IF LIBAVFORMAT_VERSION < 52078003} // < 52.78.3
- language: array [0..3] of PAnsiChar; (**< ISO 639-2/B 3-letter language code (empty string if undefined) *)
- {$ELSE}
- {$IFDEF FF_API_OLD_METADATA}
+{$IFDEF FF_API_OLD_METADATA}
language: array [0..3] of PAnsiChar; (**< ISO 639-2/B 3-letter language code (empty string if undefined) *)
- {$ENDIF}
- {$IFEND}
+{$ENDIF}
(* av_read_frame() support *)
need_parsing: TAVStreamParseType;
@@ -877,27 +824,13 @@ type
nb_frames: cint64; ///< number of frames in this stream if known or 0
- {$IF (LIBAVFORMAT_VERSION >= 50006000) and (LIBAVFORMAT_VERSION_MAJOR < 53)} // 50.6.0 - 53.0.0
unused: array [0..4] of cint64;
- {$IFEND}
-
- {$IF (LIBAVFORMAT_VERSION >= 52006000) and (LIBAVFORMAT_VERSION < 52078003)} // 52.6.0 - 52.78.2
+{$IFDEF FF_API_OLD_METADATA}
filename: PAnsiChar; (**< source filename of the stream *)
- {$ELSE}
- {$IFDEF FF_API_OLD_METADATA}
- filename: PAnsiChar; (**< source filename of the stream *)
- {$ENDIF}
- {$IFEND}
+{$ENDIF}
- {$IF LIBAVFORMAT_VERSION >= 52008000} // 52.8.0
disposition: cint; (**< AV_DISPOSITION_* bitfield *)
- {$IFEND}
-
- {$IF LIBAVFORMAT_VERSION >= 52019000} // 52.19.0
probe_data: TAVProbeData;
- {$IFEND}
-
- {$IF LIBAVFORMAT_VERSION >= 52021000} // 52.21.0
pts_buffer: array [0..MAX_REORDER_DELAY] of cint64;
(**
@@ -906,21 +839,15 @@ type
* - decoding: Set by libavformat.
*)
sample_aspect_ratio: TAVRational;
- {$IFEND}
- {$IF LIBAVFORMAT_VERSION >= 52024001} // 52.24.1
metadata: PAVMetadata;
- {$IFEND}
- {$IF LIBAVFORMAT_VERSION > 52024001} // > 52.24.1
{* Intended mostly for av_read_frame() support. Not supposed to be used by *}
{* external applications; try to use something else if at all possible. *}
cur_ptr: {const} PCuint8;
cur_len: cint;
cur_pkt: TAVPacket;
- {$IFEND}
- {$IF LIBAVFORMAT_VERSION >= 52030000} // > 52.30.0
// Timestamp generation support:
(**
* Timestamp corresponding to the last dts sync point.
@@ -930,33 +857,28 @@ type
* AV_NOPTS_VALUE by default.
*)
reference_dts: cint64;
- {$IFEND}
- {$IF LIBAVFORMAT_VERSION >= 52034000} // >= 52.34.0
+
(**
* Number of packets to buffer for codec probing
* NOT PART OF PUBLIC API
*)
probe_packets: cint;
- {$IFEND}
- {$IF LIBAVFORMAT_VERSION >= 52038000} // >= 52.38.0
+
(**
* last packet in packet_buffer for this stream when muxing.
* used internally, NOT PART OF PUBLIC API, dont read or write from outside of libav*
*)
last_in_packet_buffer: PAVPacketList;
- {$IFEND}
- {$IF LIBAVFORMAT_VERSION >= 52041000} // >= 52.41.0
+
(**
* Average framerate
*)
avg_frame_rate: TAVRational;
- {$IFEND}
- {$IF LIBAVFORMAT_VERSION >= 52054000} // >= 52.54.0
+
(**
* Number of frames that have been demuxed during av_find_stream_info()
*)
codec_info_nb_frames: cint;
- {$IFEND}
end;
(**
@@ -973,18 +895,14 @@ type
oformat: PAVOutputFormat;
priv_data: pointer;
- {$IF LIBAVFORMAT_VERSION_MAJOR >= 52}
pb: PByteIOContext;
- {$ELSE}
- pb: TByteIOContext;
- {$IFEND}
nb_streams: cuint;
streams: array [0..MAX_STREAMS - 1] of PAVStream;
filename: array [0..1023] of AnsiChar; (* input or output filename *)
(* stream info *)
timestamp: cint64;
- {$IF LIBAVFORMAT_VERSION < 52078003} // < 52.78.3
+{$IFDEF FF_API_OLD_METADATA}
title: array [0..511] of AnsiChar;
author: array [0..511] of AnsiChar;
copyright: array [0..511] of AnsiChar;
@@ -993,18 +911,7 @@ type
year: cint; (**< ID3 year, 0 if none *)
track: cint; (**< track number, 0 if none *)
genre: array [0..31] of AnsiChar; (**< ID3 genre *)
- {$ELSE}
- {$IFDEF FF_API_OLD_METADATA}
- title: array [0..511] of AnsiChar;
- author: array [0..511] of AnsiChar;
- copyright: array [0..511] of AnsiChar;
- comment: array [0..511] of AnsiChar;
- album: array [0..511] of AnsiChar;
- year: cint; (**< ID3 year, 0 if none *)
- track: cint; (**< track number, 0 if none *)
- genre: array [0..31] of AnsiChar; (**< ID3 genre *)
- {$ENDIF}
- {$IFEND}
+{$ENDIF}
ctx_flags: cint; (**< Format-specific flags, see AVFMTCTX_xx *)
(* private data for pts handling (do not modify directly). *)
@@ -1041,22 +948,16 @@ type
(* av_read_frame() support *)
cur_st: PAVStream;
- {$IF LIBAVFORMAT_VERSION_MAJOR < 53}
cur_ptr_deprecated: pbyte;
cur_len_deprecated: cint;
cur_pkt_deprecated: TAVPacket;
- {$IFEND}
(* av_seek_frame() support *)
data_offset: cint64; (**< offset of the first packet *)
index_built: cint;
mux_rate: cint;
- {$IF LIBAVFORMAT_VERSION < 52034001} // < 52.34.1
- packet_size: cint;
- {$ELSE}
- packet_size: cuint;
- {$IFEND}
+ packet_size: cuint; *****
preload: cint;
max_delay: cint;
@@ -1068,14 +969,11 @@ type
flags: cint;
loop_input: cint;
- {$IF LIBAVFORMAT_VERSION >= 50006000} // 50.6.0
(**
* decoding: size of data to probe; encoding: unused.
*)
probesize: cuint;
- {$IFEND}
- {$IF LIBAVFORMAT_VERSION >= 51009000} // 51.9.0
(**
* Maximum time (in AV_TIME_BASE units) during which the input should
* be analyzed in av_find_stream_info().
@@ -1084,14 +982,10 @@ type
key: pbyte;
keylen : cint;
- {$IFEND}
- {$IF LIBAVFORMAT_VERSION >= 51014000} // 51.14.0
nb_programs: cuint;
programs: PPAVProgram;
- {$IFEND}
- {$IF LIBAVFORMAT_VERSION >= 52003000} // 52.3.0
(**
* Forced video codec_id.
* Demuxing: Set by user.
@@ -1109,9 +1003,7 @@ type
* Demuxing: Set by user.
*)
subtitle_codec_id: TCodecID;
- {$IFEND}
- {$IF LIBAVFORMAT_VERSION >= 52004000} // 52.4.0
(**
* Maximum amount of memory in bytes to use for the index of each stream.
* If the index exceeds this size, entries will be discarded as
@@ -1123,29 +1015,20 @@ type
* demuxing: set by user
*)
max_index_size: cuint;
- {$IFEND}
- {$IF LIBAVFORMAT_VERSION >= 52009000} // 52.9.0
(**
* Maximum amount of memory in bytes to use for buffering frames
* obtained from realtime capture devices.
*)
max_picture_buffer: cuint;
- {$IFEND}
-
- {$IF LIBAVFORMAT_VERSION >= 52014000} // 52.14.0
nb_chapters: cuint;
chapters: PAVChapterArray;
- {$IFEND}
- {$IF LIBAVFORMAT_VERSION >= 52016000} // 52.16.0
(**
* Flags to enable debugging.
*)
debug: cint;
- {$IFEND}
- {$IF LIBAVFORMAT_VERSION >= 52019000} // 52.19.0
(**
* Raw packets from the demuxer, prior to parsing and decoding.
* This buffer is used for buffering packets until the codec can
@@ -1156,21 +1039,15 @@ type
raw_packet_buffer_end: PAVPacketList;
packet_buffer_end: PAVPacketList;
- {$IFEND}
- {$IF LIBAVFORMAT_VERSION >= 52024001} // 52.24.1
metadata: PAVMetadata;
- {$IFEND}
- {$IF LIBAVFORMAT_VERSION >= 52035000} // 52.35.0
(**
* Remaining size available for raw_packet_buffer, in bytes.
* NOT PART OF PUBLIC API
*)
raw_packet_buffer_remaining_size: cint;
- {$IFEND}
-
- {$IF LIBAVFORMAT_VERSION >= 52056000} // 52.56.0
+
(**
* Start time of the stream in real world time, in microseconds
* since the unix epoch (00:00 1st January 1970). That is, pts=0
@@ -1179,8 +1056,7 @@ type
* - decoding: Unused.
*)
start_time_realtime: cint64;
- {$IFEND}
-
+
end;
(**
@@ -1191,24 +1067,15 @@ type
*)
TAVProgram = record
id : cint;
- {$IF LIBAVFORMAT_VERSION < 52078003} // < 52.78.3
+{$IFDEF FF_API_OLD_METADATA}
provider_name : PAnsiChar; ///< network name for DVB streams
name : PAnsiChar; ///< service name for DVB streams
- {$ELSE}
- {$IFDEF FF_API_OLD_METADATA}
- provider_name : PAnsiChar; ///< network name for DVB streams
- name : PAnsiChar; ///< service name for DVB streams
- {$ENDIF}
- {$IFEND}
+{$ENDIF}
flags : cint;
discard : TAVDiscard; ///< selects which program to discard and which to feed to the caller
- {$IF LIBAVFORMAT_VERSION >= 51016000} // 51.16.0
stream_index : PCardinal;
nb_stream_indexes : PCardinal;
- {$IFEND}
- {$IF LIBAVFORMAT_VERSION >= 52024001} // 52.24.1
- metadata: PAVMetadata;
- {$IFEND}
+ metadata : PAVMetadata;
end;
TAVPacketList = record
@@ -1216,55 +1083,6 @@ type
next: PAVPacketList;
end;
-{$IF LIBAVFORMAT_VERSION < 51006000} // 51.6.0
- (* still image support *)
- PAVInputImageContext = pointer; {deprecated}
-
- (* still image support *)
- TAVImageInfo = record
- pix_fmt: TAVPixelFormat; (* requested pixel format *)
- width: cint; (* requested width *)
- height: cint; (* requested height *)
- interleaved: cint; (* image is interleaved (e.g. interleaved GIF) *)
- pict: TAVPicture; (* returned allocated image *)
- end; {deprecated}
-
- TAVImageFormat = record
- name: PAnsiChar;
- extensions: PAnsiChar;
- (* tell if a given file has a chance of being parsing by this format *)
- img_probe: function (d: PAVProbeData): cint; cdecl;
- (* read a whole image. 'alloc_cb' is called when the image size is
- known so that the caller can allocate the image. If 'allo_cb'
- returns non zero, then the parsing is aborted. Return '0' if
- OK. *)
- img_read: function (b: PByteIOContext; alloc_cb: pointer; ptr: pointer): cint; cdecl;
- (* write the image *)
- supported_pixel_formats: cint; (* mask of supported formats for output *)
- img_write: function (b: PByteIOContext; i: PAVImageInfo): cint; cdecl;
- flags: cint;
- next: PAVImageFormat;
- end; {deprecated}
-
-procedure av_register_image_format(img_fmt: PAVImageFormat);
- cdecl; external av__format; deprecated;
-
-function av_probe_image_format(pd: PAVProbeData): PAVImageFormat;
- cdecl; external av__format; deprecated;
-
-function guess_image_format(filename: PAnsiChar): PAVImageFormat;
- cdecl; external av__format; deprecated;
-
-function av_read_image(pb: PByteIOContext; filename: PAnsiChar;
- fmt: PAVImageFormat;
- alloc_cb: pointer; opaque: pointer): cint;
- cdecl; external av__format; deprecated;
-
-function av_write_image(pb: PByteIOContext; fmt: PAVImageFormat; img: PAVImageInfo): cint;
- cdecl; external av__format; deprecated;
-{$IFEND}
-
-{$IF LIBAVFORMAT_VERSION >= 52030001} // >= 52.30.1
(**
* Convert all the metadata sets from ctx according to the source and
* destination conversion tables. If one of the tables is NULL, then
@@ -1276,17 +1094,13 @@ function av_write_image(pb: PByteIOContext; fmt: PAVImageFormat; img: PAVImageIn
procedure av_metadata_conv(ctx: PAVFormatContext; {const} d_conv: PAVMetadataConv;
{const} s_conv: PAVMetadataConv);
cdecl; external av__format;
-{$IFEND}
-{$IF LIBAVFORMAT_VERSION_MAJOR < 53}
{
var
first_iformat: PAVInputFormat; external av__format;
first_oformat: PAVOutputFormat; external av__format;
}
-{$IFEND}
-{$IF LIBAVFORMAT_VERSION >= 52003000} // 52.3.0
(**
* If f is NULL, returns the first registered input format,
* if f is non-NULL, returns the next registered input format after f
@@ -1301,7 +1115,6 @@ function av_iformat_next(f: PAVInputFormat): PAVInputFormat;
*)
function av_oformat_next(f: PAVOutputFormat): PAVOutputFormat;
cdecl; external av__format;
-{$IFEND}
function av_guess_image2_codec(filename: {const} PAnsiChar): TCodecID;
cdecl; external av__format;
@@ -1316,12 +1129,10 @@ procedure av_register_input_format(format: PAVInputFormat);
procedure av_register_output_format(format: PAVOutputFormat);
cdecl; external av__format;
-{$IF LIBAVFORMAT_VERSION_MAJOR < 53} // < 53
function guess_stream_format(short_name: PAnsiChar;
filename: PAnsiChar;
mime_type: PAnsiChar): PAVOutputFormat;
cdecl; external av__format; deprecated;
-{$IFEND}
(**
* Return the output format in the list of registered output formats
@@ -1341,14 +1152,12 @@ function guess_stream_format(short_name: PAnsiChar;
function guess_format(short_name: PAnsiChar;
filename: PAnsiChar;
mime_type: PAnsiChar): PAVOutputFormat;
- cdecl; external av__format;
-{$IF LIBAVFORMAT_VERSION >= 52045000} // >= 52.45.0
- deprecated;
+ cdecl; external av__format; deprecated;
+
function av_guess_format(short_name: PAnsiChar;
filename: PAnsiChar;
mime_type: PAnsiChar): PAVOutputFormat;
cdecl; external av__format;
-{$IFEND}
(**
* Guess the codec ID based upon muxer and filename.
@@ -1370,7 +1179,6 @@ function av_guess_codec(fmt: PAVOutputFormat; short_name: PAnsiChar;
procedure av_hex_dump(f: PAVFile; buf: PByteArray; size: cint);
cdecl; external av__format;
-{$IF LIBAVFORMAT_VERSION >= 51011000} // 51.11.0
(**
* Send a nice hexadecimal dump of a buffer to the log.
*
@@ -1385,7 +1193,6 @@ procedure av_hex_dump(f: PAVFile; buf: PByteArray; size: cint);
*)
procedure av_hex_dump_log(avcl: Pointer; level: cint; buf: PByteArray; size: cint);
cdecl; external av__format;
-{$IFEND}
(**
* Send a nice dump of a packet to the specified file stream.
@@ -1397,7 +1204,6 @@ procedure av_hex_dump_log(avcl: Pointer; level: cint; buf: PByteArray; size: cin
procedure av_pkt_dump(f: PAVFile; pkt: PAVPacket; dump_payload: cint);
cdecl; external av__format;
-{$IF LIBAVFORMAT_VERSION >= 51011000} // 51.11.0
(**
* Send a nice dump of a packet to the log.
*
@@ -1410,7 +1216,6 @@ procedure av_pkt_dump(f: PAVFile; pkt: PAVPacket; dump_payload: cint);
*)
procedure av_pkt_dump_log(avcl: Pointer; level: cint; pkt: PAVPacket; dump_payload: cint);
cdecl; external av__format;
-{$IFEND}
(**
* Initialize libavformat and register all the muxers, demuxers and
@@ -1424,7 +1229,6 @@ procedure av_pkt_dump_log(avcl: Pointer; level: cint; pkt: PAVPacket; dump_paylo
procedure av_register_all();
cdecl; external av__format;
-{$IF LIBAVFORMAT_VERSION >= 51008000} // 51.8.0
(**
* Get the CodecID for the given codec tag tag.
* If no codec id is found returns CODEC_ID_NONE.
@@ -1444,7 +1248,6 @@ function av_codec_get_id(var tags: PAVCodecTag; tag: cuint): TCodecID;
*)
function av_codec_get_tag(var tags: PAVCodecTag; id: TCodecID): cuint;
cdecl; external av__format;
-{$IFEND}
(* media file input *)
@@ -1463,7 +1266,6 @@ function av_find_input_format(short_name: PAnsiChar): PAVInputFormat;
function av_probe_input_format(pd: PAVProbeData; is_opened: cint): PAVInputFormat;
cdecl; external av__format;
-{$IF LIBAVFORMAT_VERSION >= 52062000} // 52.62.0
(**
* Guess the file format.
*
@@ -1477,7 +1279,6 @@ function av_probe_input_format(pd: PAVProbeData; is_opened: cint): PAVInputForma
*)
function av_probe_input_format2(pd: PAVProbeData; is_opened: cint; score_max: PCint): PAVInputFormat;
cdecl; external av__format;
-{$IFEND}
(**
* Allocate all the structures needed to read an input stream.
@@ -1505,7 +1306,6 @@ function av_open_input_file(var ic_ptr: PAVFormatContext; filename: PAnsiChar;
ap: PAVFormatParameters): cint;
cdecl; external av__format;
-{$IF LIBAVFORMAT_VERSION >= 52026000} // 52.26.0
(**
* Allocate an AVFormatContext.
* Can be freed with av_free() but do not forget to free everything you
@@ -1513,15 +1313,12 @@ function av_open_input_file(var ic_ptr: PAVFormatContext; filename: PAnsiChar;
*)
function avformat_alloc_context(): PAVFormatContext;
cdecl; external av__format;
-{$ELSE}
- {$IF LIBAVFORMAT_VERSION_MAJOR < 53}
+
(**
* @deprecated Use avformat_alloc_context() instead.
*)
function av_alloc_format_context(): PAVFormatContext;
cdecl; external av__format;
- {$IFEND}
-{$IFEND}
(**
* Read packets of a media file to get stream information. This
@@ -1589,7 +1386,6 @@ function av_seek_frame(s: PAVFormatContext; stream_index: cint; timestamp: cint6
flags: cint): cint;
cdecl; external av__format;
-{$IF LIBAVFORMAT_VERSION >= 52026000} // 52.26.0
(**
* Seek to timestamp ts.
* Seeking will be done so that the point from which all active streams
@@ -1623,7 +1419,6 @@ function avformat_seek_file(s: PAVFormatContext;
max_ts: cint64;
flags: cint): cint;
cdecl; external av__format;
-{$IFEND}
(**
* Start playing a network-based stream (e.g. RTSP stream) at the
@@ -1640,14 +1435,12 @@ function av_read_play(s: PAVFormatContext): cint;
function av_read_pause(s: PAVFormatContext): cint;
cdecl; external av__format;
-{$IF LIBAVFORMAT_VERSION >= 52003000} // 52.3.0
(**
* Free a AVFormatContext allocated by av_open_input_stream.
* @param s context to free
*)
procedure av_close_input_stream(s: PAVFormatContext);
cdecl; external av__format;
-{$IFEND}
(**
* Close a media file (but not its codecs).
@@ -1669,12 +1462,10 @@ procedure av_close_input_file(s: PAVFormatContext);
*)
function av_new_stream(s: PAVFormatContext; id: cint): PAVStream;
cdecl; external av__format;
-{$IF LIBAVFORMAT_VERSION >= 51014000} // 51.14.0
+
function av_new_program(s: PAVFormatContext; id: cint): PAVProgram;
cdecl; external av__format;
-{$IFEND}
-{$IF LIBAVFORMAT_VERSION >= 52014000} // 52.14.0
(**
* Add a new chapter.
* This function is NOT part of the public API
@@ -1691,7 +1482,6 @@ function av_new_program(s: PAVFormatContext; id: cint): PAVProgram;
function ff_new_chapter(s: PAVFormatContext; id: cint; time_base: TAVRational;
start, end_: cint64; title: {const} PAnsiChar): PAVChapter;
cdecl; external av__format;
-{$IFEND}
(**
* Set the pts for a given stream.
@@ -1703,20 +1493,14 @@ function ff_new_chapter(s: PAVFormatContext; id: cint; time_base: TAVRational;
* @param pts_den denominator to convert to seconds (MPEG: 90000)
*)
procedure av_set_pts_info(s: PAVStream; pts_wrap_bits: cint;
-{$IF LIBAVFORMAT_VERSION < 52036000} // < 52.36.0
- pts_num: cint; pts_den: cint);
-{$ELSE}
- pts_num: cuint; pts_den: cuint);
-{$IFEND}
+ pts_num: cuint; pts_den: cuint); *******
cdecl; external av__format;
const
AVSEEK_FLAG_BACKWARD = 1; ///< seek backward
AVSEEK_FLAG_BYTE = 2; ///< seeking based on position in bytes
AVSEEK_FLAG_ANY = 4; ///< seek to any frame, even non-keyframes
-{$IF LIBAVFORMAT_VERSION >= 52037000} // >= 52.37.0
AVSEEK_FLAG_FRAME = 8;
-{$IFEND}
function av_find_default_stream_index(s: PAVFormatContext): cint;
cdecl; external av__format;
@@ -1732,7 +1516,6 @@ function av_find_default_stream_index(s: PAVFormatContext): cint;
function av_index_search_timestamp(st: PAVStream; timestamp: cint64; flags: cint): cint;
cdecl; external av__format;
-{$IF LIBAVFORMAT_VERSION >= 52004000} // 52.4.0
(**
* Ensure the index uses less memory than the maximum specified in
* AVFormatContext.max_index_size by discarding entries if it grows
@@ -1742,7 +1525,6 @@ function av_index_search_timestamp(st: PAVStream; timestamp: cint64; flags: cint
*)
procedure ff_reduce_index(s: PAVFormatContext; stream_index: cint);
cdecl; external av__format;
-{$IFEND}
(**
* Add an index entry into a sorted list. Update the entry if the list
@@ -1766,7 +1548,6 @@ function av_seek_frame_binary(s: PAVFormatContext; stream_index: cint;
target_ts: cint64; flags: cint): cint;
cdecl; external av__format;
-
(**
* Update cur_dts of all streams based on the given timestamp and AVStream.
*
@@ -1779,7 +1560,6 @@ procedure av_update_cur_dts(s: PAVFormatContext; ref_st: PAVStream;
timestamp: cint64);
cdecl; external av__format;
-{$IF LIBAVFORMAT_VERSION >= 51007000} // 51.7.0
type
TReadTimestampFunc = function (pavfc: PAVFormatContext;
arg2: cint; arg3: Pint64; arg4: cint64): cint64; cdecl;
@@ -1798,7 +1578,6 @@ function av_gen_search(s: PAVFormatContext; stream_index: cint;
flags: cint; ts_ret: Pint64;
read_timestamp: TReadTimestampFunc): cint64;
cdecl; external av__format;
-{$IFEND}
(**
* media file output
@@ -1806,7 +1585,6 @@ function av_gen_search(s: PAVFormatContext; stream_index: cint;
function av_set_parameters(s: PAVFormatContext; ap: PAVFormatParameters): cint;
cdecl; external av__format;
-{$IF LIBAVFORMAT_VERSION >= 52072000} // 52.72.0
(**
* Split a URL string into components.
*
@@ -1833,7 +1611,6 @@ procedure av_url_split(proto: PAnsiChar; proto_size: cint;
path: PAnsiChar; path_size: cint;
{const} url: PAnsiChar);
cdecl; external av__format;
-{$IFEND}
(**
* Allocate the stream private data and write the stream header to an
@@ -1897,7 +1674,6 @@ function av_interleave_packet_per_dts(s: PAVFormatContext; _out: PAVPacket;
pkt: PAVPacket; flush: cint): cint;
cdecl; external av__format;
-{$IF LIBAVFORMAT_VERSION >= 52025000} // 52.25.0
(**
* Add packet to AVFormatContext->packet_buffer list, determining its
* interleaved position using compare() function argument.
@@ -1913,7 +1689,6 @@ procedure ff_interleave_add_packet(s: PAVFormatContext;
para3: PAVPacket): cint);
cdecl; external av__format;
}
-{$IFEND}
(**
* Write the stream trailer to an output media file and free the
@@ -1939,7 +1714,6 @@ function parse_image_size(width_ptr: PCint; height_ptr: PCint;
str: PAnsiChar): cint;
cdecl; external av__format; deprecated;
-{$IF LIBAVFORMAT_VERSION_MAJOR < 53}
(**
* Convert framerate from a string to a fraction.
* @deprecated Use av_parse_video_frame_rate instead.
@@ -1947,7 +1721,6 @@ function parse_image_size(width_ptr: PCint; height_ptr: PCint;
function parse_frame_rate(frame_rate: PCint; frame_rate_base: PCint;
arg: PByteArray): cint;
cdecl; external av__format; deprecated;
-{$IFEND}
(**
* Parse datestr and return a corresponding number of microseconds.
@@ -1992,11 +1765,7 @@ const
function ffm_read_write_index(fd: cint): cint64;
cdecl; external av__format;
-{$IF LIBAVFORMAT_VERSION < 52027000} // 52.27.0
-procedure ffm_write_write_index(fd: cint; pos: cint64);
-{$ELSE}
function ffm_write_write_index(fd: cint; pos: cint64): cint;
-{$IFEND}
cdecl; external av__format;
procedure ffm_set_write_index(s: PAVFormatContext; pos: cint64; file_size: cint64);
@@ -2025,10 +1794,7 @@ function find_info_tag(arg: PAnsiChar; arg_size: cint; tag1: PAnsiChar; info: PA
*)
function av_get_frame_filename(buf: PAnsiChar; buf_size: cint;
path: PAnsiChar; number: cint): cint;
- cdecl; external av__format
- {$IF LIBAVFORMAT_VERSION <= 50006000} // 50.6.0
- name 'get_frame_filename'
- {$IFEND};
+ cdecl; external av__format;
(**
* Check whether filename actually is a numbered sequence generator.
@@ -2037,12 +1803,8 @@ function av_get_frame_filename(buf: PAnsiChar; buf_size: cint;
* @return 1 if a valid numbered sequence string, 0 otherwise
*)
function av_filename_number_test(filename: PAnsiChar): cint;
- cdecl; external av__format
- {$IF LIBAVFORMAT_VERSION <= 50006000} // 50.6.0
- name 'filename_number_test'
- {$IFEND};
+ cdecl; external av__format;
-{$IF LIBAVFORMAT_VERSION >= 51012002} // 51.12.2
(**
* Generate an SDP for an RTP session.
*
@@ -2059,9 +1821,7 @@ function av_filename_number_test(filename: PAnsiChar): cint;
*)
function avf_sdp_create(ac: PPAVFormatContext; n_files: cint; buff: PByteArray; size: cint): cint;
cdecl; external av__format;
-{$IFEND}
-{$IF LIBAVFORMAT_VERSION >= 52060000} // 52.60.0
(**
* Return a positive value if the given filename has one of the given
* extensions, 0 otherwise.
@@ -2070,31 +1830,7 @@ function avf_sdp_create(ac: PPAVFormatContext; n_files: cint; buff: PByteArray;
*)
function av_match_ext(filename: {const} Pchar; extensions: {const} Pchar): cint;
cdecl; external av__format;
-{$IFEND}
implementation
-{$IF LIBAVFORMAT_VERSION < 51012002} // 51.12.2
-procedure av_init_packet(var pkt: TAVPacket);
-begin
- with pkt do begin
- pts := AV_NOPTS_VALUE;
- dts := AV_NOPTS_VALUE;
- pos := -1;
- duration := 0;
- flags := 0;
- stream_index := 0;
- destruct := @av_destruct_packet_nofree
- end
-end;
-{$IFEND}
-
-{$IF LIBAVFORMAT_VERSION < 52032000} // < 52.32.0
-procedure av_free_packet(pkt: PAVPacket);
-begin
- if ((pkt <> nil) and (@pkt^.destruct <> nil)) then
- pkt^.destruct(pkt);
-end;
-{$IFEND}
-
end.
diff --git a/src/lib/ffmpeg/avio.pas b/src/lib/ffmpeg/avio.pas
index adb59a44..a942e28f 100644
--- a/src/lib/ffmpeg/avio.pas
+++ b/src/lib/ffmpeg/avio.pas
@@ -1,7 +1,8 @@
(*
- * unbuffered io for ffmpeg system
* copyright (c) 2001 Fabrice Bellard
*
+ * This file is part of FFmpeg.
+ *
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -28,7 +29,7 @@
* header, so it should not be directly included in your projects.
*
* update to
- * Max. avformat version: 52.78.3, revision 24841, Thu Aug 26 02:00:00 2010 CET
+ * Max. avformat version: 52.111.0
*)
unit avio;
@@ -47,678 +48,720 @@ interface
uses
ctypes,
+ {$IFDEF UNIX}
+ BaseUnix, // for SEEK_CUR
+ {$ENDIF}
avutil,
avcodec,
SysUtils,
UConfig;
-(* unbuffered I/O *)
-
const
- URL_RDONLY = 0;
- URL_WRONLY = 1;
- URL_RDWR = 2;
-
- (**
- * Passing this as the "whence" parameter to a seek function causes it to
- * return the filesize without seeking anywhere. Supporting this is optional.
- * If it is not supported then the seek function will return <0.
- *)
- AVSEEK_SIZE = $10000;
-
-{$IF LIBAVFORMAT_VERSION >= 52056000} // 52.56.0
- (**
- * Oring this flag as into the "whence" parameter to a seek function causes it to
- * seek by any means (like reopening and linear reading) or other normally unreasonble
- * means that can be extreemly slow.
- * This may be ignored by the seek code.
- *)
- AVSEEK_FORCE = $20000;
-{$IFEND}
+ AVIO_SEEKABLE_NORMAL = 0001; (**< Seeking works like for a local file *)
+ URL_PROTOCOL_FLAG_NESTED_SCHEME = 1; (*< The protocol name can be the first part of a nested protocol scheme *)
type
- TURLInterruptCB = function (): cint; cdecl;
+ TReadWriteFunc = function(opaque: Pointer; buf: PByteArray; buf_size: cint): cint; cdecl;
+ TSeekFunc = function(opaque: Pointer; offset: cint64; whence: cint): cint64; cdecl;
type
+ PURLContext = ^TURLContext;
PURLProtocol = ^TURLProtocol;
- (**
- * URL Context.
- * New fields can be added to the end with minor version bumps.
- * Removal, reordering and changes to existing fields require a major
- * version bump.
- * sizeof(URLContext) must not be used outside libav*.
- *)
- PURLContext = ^TURLContext;
+(**
+ * Bytestream IO Context.
+ * New fields can be added to the end with minor version bumps.
+ * Removal, reordering and changes to existing fields require a major
+ * version bump.
+ * sizeof(AVIOContext) must not be used outside libav*.
+ *
+ * @note None of the function pointers in AVIOContext should be called
+ * directly, they should only be set by the client application
+ * when implementing custom I/O. Normally these are set to the
+ * function pointers specified in avio_alloc_context()
+ *)
+ PAVIOContext = ^TAVIOContext;
+ TAVIOContext = record
+ buffer: PByteArray; (**< Start of the buffer. *)
+ buffer_size: cint; (**< Maximum buffer size *)
+ buf_ptr: PByteArray; (**< Current position in the buffer *)
+ buf_end: PByteArray; (**< End of the data, may be less than
+ buffer+buffer_size if the read function returned
+ less data than requested, e.g. for streams where
+ no more data has been received yet. *)
+ opaque: pointer; (**< A private pointer, passed to the read/write/seek/...
+ functions. *)
+ read_packet: TReadWriteFunc;
+ write_packet: TReadWriteFunc;
+ seek: TSeekFunc;
+ pos: cint64; (**< position in the file of the current buffer *)
+ must_flush: cint; (**< true if the next seek should flush *)
+ eof_reached: cint; (**< true if eof reached *)
+ write_flag: cint; (**< true if open for writing *)
+{$IFDEF FF_API_OLD_AVIO}
+ is_streamed: cint; { deprecated }
+{$ENDIF}
+ max_packet_size: cint;
+ checksum: culong;
+ checksum_ptr: PByteArray;
+ update_checksum: function (checksum: culong; buf: {const} PByteArray; size: cuint): culong; cdecl;
+ error: cint; (**< contains the error code or 0 if no error happened *)
+ (**
+ * Pause or resume playback for network streaming protocols - e.g. MMS.
+ *)
+ read_pause: function(opaque: Pointer; pause: cint): cint; cdecl;
+ (**
+ * Seek to a given timestamp in stream with the specified stream_index.
+ * Needed for some network streaming protocols which don't support seeking
+ * to byte position.
+ *)
+ read_seek: function(opaque: Pointer; stream_index: cint;
+ timestamp: cint64; flags: cint): cint64; cdecl;
+ (**
+ * A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
+ *)
+ seekable: cint;
+ end;
+
+(* unbuffered I/O *)
+
+(**
+ * URL Context.
+ * New fields can be added to the end with minor version bumps.
+ * Removal, reordering and changes to existing fields require a major
+ * version bump.
+ * sizeof(URLContext) must not be used outside libav*.
+ * @deprecated This struct will be made private
+ *)
TURLContext = record
- {$IF LIBAVFORMAT_VERSION < 52078003} // < 52.78.3
+{$IFDEF FF_API_URL_CLASS}
av_class: {const} PAVClass; ///< information for av_log(). Set by url_open().
- {$ELSE}
- {$IFDEF FF_API_URL_CLASS}
- av_class: {const} PAVClass; ///< information for av_log(). Set by url_open().
- {$ENDIF}
- {$IFEND}
+{$ENDIF}
prot: PURLProtocol;
flags: cint;
is_streamed: cint; (**< true if streamed (no seek possible), default = false *)
max_packet_size: cint; (**< if non zero, the stream is packetized with this max packet size *)
priv_data: pointer;
filename: PAnsiChar; (**< specified URL *)
-{$IF LIBAVFORMAT_VERSION >= 52070000} // 52.70.0
- is_connected: cint;
-{$IFEND}
+ is_connected: cint;
end;
PPURLContext = ^PURLContext;
- PURLPollEntry = ^TURLPollEntry;
- TURLPollEntry = record
- handle: PURLContext;
- events: cint;
- revents: cint;
- end;
-
+(**
+ * @deprecated This struct is to be made private. Use the higher-level
+ * AVIOContext-based API instead.
+ *)
TURLProtocol = record
name: PAnsiChar;
-{$IF LIBAVFORMAT_VERSION < 52047000} // 52.47.0
- url_open: function (h: PURLContext; filename: {const} PAnsiChar; flags: cint): cint; cdecl;
-{$ELSE}
url_open: function (h: PURLContext; url: {const} PAnsiChar; flags: cint): cint; cdecl;
-{$IFEND}
-
-(**
- * Read up to size bytes from the resource accessed by h, and store
- * the read bytes in buf.
- *
- * @return The number of bytes actually read, or a negative value
- * corresponding to an AVERROR code in case of error. A value of zero
- * indicates that it is not possible to read more from the accessed
- * resource (except if the value of the size argument is also zero).
- *)
url_read: function (h: PURLContext; buf: PByteArray; size: cint): cint; cdecl;
-
-(**
- * Read as many bytes as possible (up to size), calling the
- * read function multiple times if necessary.
- * Will also retry if the read function returns AVERROR(EAGAIN).
- * This makes special short-read handling in applications
- * unnecessary, if the return value is < size then it is
- * certain there was either an error or the end of file was reached.
- *)
url_write: function (h: PURLContext; {const} buf: PByteArray; size: cint): cint; cdecl;
-
-(**
- * Change the position that will be used by the next read/write
- * operation on the resource accessed by h.
- *
- * @param pos specifies the new position to set
- * @param whence specifies how pos should be interpreted, it must be
- * one of SEEK_SET (seek from the beginning), SEEK_CUR (seek from the
- * current position), SEEK_END (seek from the end), or AVSEEK_SIZE
- * (return the filesize of the requested resource, pos is ignored).
- * @return a negative value corresponding to an AVERROR code in case
- * of failure, or the resulting file position, measured in bytes from
- * the beginning of the file. You can use this feature together with
- * SEEK_CUR to read the current file position.
- *)
url_seek: function (h: PURLContext; pos: cint64; whence: cint): cint64; cdecl;
-
url_close: function (h: PURLContext): cint; cdecl;
next: PURLProtocol;
- {$IF (LIBAVFORMAT_VERSION >= 52001000) and (LIBAVFORMAT_VERSION < 52004000)} // 52.1.0 .. 52.4.0
- url_read_play: function (h: PURLContext): cint; cdecl;
- url_read_pause: function (h: PURLContext): cint; cdecl;
- {$IFEND}
- {$IF LIBAVFORMAT_VERSION >= 52004000} // 52.4.0
url_read_pause: function (h: PURLContext; pause: cint): cint; cdecl;
- {$IFEND}
- {$IF LIBAVFORMAT_VERSION >= 52001000} // 52.1.0
url_read_seek: function (h: PURLContext; stream_index: cint;
timestamp: cint64; flags: cint): cint64; cdecl;
- {$IFEND}
- {$IF LIBAVFORMAT_VERSION >= 52031000} // 52.31.0
url_get_file_handle: function (h: PURLContext): cint; cdecl;
- {$IFEND}
-
- {$IF LIBAVFORMAT_VERSION >= 52071000} // 52.71.0
priv_data_size: cint;
{const} priv_data_class: PAVClass;
- {$IFEND}
+ flags: cint;
+ url_check: function (h: PURLContext; mask: cint): cint;
end;
- (**
- * Bytestream IO Context.
- * New fields can be added to the end with minor version bumps.
- * Removal, reordering and changes to existing fields require a major
- * version bump.
- * sizeof(ByteIOContext) must not be used outside libav*.
- *)
- PByteIOContext = ^TByteIOContext;
- TByteIOContext = record
- buffer: PByteArray;
- buffer_size: cint;
- buf_ptr: PByteArray;
- buf_end: PByteArray;
- opaque: pointer;
- read_packet: function (opaque: pointer; buf: PByteArray; buf_size: cint): cint; cdecl;
- write_packet: function (opaque: pointer; buf: PByteArray; buf_size: cint): cint; cdecl;
- seek: function (opaque: pointer; offset: cint64; whence: cint): cint64; cdecl;
- pos: cint64; (* position in the file of the current buffer *)
- must_flush: cint; (* true if the next seek should flush *)
- eof_reached: cint; (* true if eof reached *)
- write_flag: cint; (* true if open for writing *)
- is_streamed: cint;
- max_packet_size: cint;
- checksum: culong;
- checksum_ptr: PByteArray;
- update_checksum: function (checksum: culong; buf: {const} PByteArray; size: cuint): culong; cdecl;
- error: cint; ///< contains the error code or 0 if no error happened
- {$IF (LIBAVFORMAT_VERSION >= 52001000) and (LIBAVFORMAT_VERSION < 52004000)} // 52.1.0 .. 52.4.0
- read_play: function(opaque: Pointer): cint; cdecl;
- read_pause: function(opaque: Pointer): cint; cdecl;
- {$IFEND}
- {$IF LIBAVFORMAT_VERSION >= 52004000} // 52.4.0
- read_pause: function(opaque: Pointer; pause: cint): cint; cdecl;
- {$IFEND}
- {$IF LIBAVFORMAT_VERSION >= 52001000} // 52.1.0
- read_seek: function(opaque: Pointer; stream_index: cint;
- timestamp: cint64; flags: cint): cint64; cdecl;
- {$IFEND}
+ PURLPollEntry = ^TURLPollEntry;
+ TURLPollEntry = record
+ handle: PURLContext;
+ events: cint;
+ revents: cint;
end;
-{$IF LIBAVFORMAT_VERSION >= 52070000} // 52.70.0
+{$IFDEF FF_API_OLD_AVIO}
+
+(* not implemented *)
+function url_poll(poll_table: PURLPollEntry; n: cint; timeout: cint): cint;
+ cdecl; external av__format; deprecated;
+
+const
(**
- * Create a URLContext for accessing to the resource indicated by
- * url, but do not initiate the connection yet.
- *
- * @param puc pointer to the location where, in case of success, the
- * function puts the pointer to the created URLContext
- * @param flags flags which control how the resource indicated by url
- * is to be opened
- * @return 0 in case of success, a negative value corresponding to an
- * AVERROR code in case of failure
+ * @name URL open modes
+ * The flags argument to url_open and cosins must be one of the following
+ * constants, optionally ORed with other flags.
+ * @
+ *)
+ URL_RDONLY = 0; (**< read-only *)
+ URL_WRONLY = 1; (**< write-only *)
+ URL_RDWR = 2; (**< read-write *)
+(**
+ * @
*)
-function url_alloc(h: PPURLContext; {const} url: PAnsiChar; flags: cint): cint;
- cdecl; external av__format;
(**
- * Connect an URLContext that has been allocated by url_alloc
- *)
-function url_connect(h: PURLContext): cint;
- cdecl; external av__format;
-{$IFEND}
+ * Use non-blocking mode.
+ * If this flag is set, operations on the context will return
+ * AVERROR(EAGAIN) if they can not be performed immediately.
+ * If this flag is not set, operations on the context will never return
+ * AVERROR(EAGAIN).
+ * Note that this flag does not affect the opening/connecting of the
+ * context. Connecting a protocol will always block if necessary (e.g. on
+ * network protocols) but never hang (e.g. on busy devices).
+ * Warning: non-blocking protocols is work-in-progress; this flag may be
+ * silently ignored.
+ *)
+ URL_FLAG_NONBLOCK = 4;
+
+type
+ TURLInterruptCB = function (): cint; cdecl;
+
+var
+ url_interrupt_cb: PURLInterruptCB; external av__format;
-{$IF LIBAVFORMAT_VERSION >= 52021000} // 52.21.0
(**
- * Create a URLContext for accessing to the resource indicated by
- * URL, and open it using the URLProtocol up.
- *
- * @param puc pointer to the location where, in case of success, the
- * function puts the pointer to the created URLContext
- * @param flags flags which control how the resource indicated by URL
- * is to be opened
- * @return 0 in case of success, a negative value corresponding to an
- * AVERROR code in case of failure
+ * @defgroup old_url_funcs Old url_* functions
+ * The following functions are deprecated. Use the buffered API based on #AVIOContext instead.
+ * @
*)
function url_open_protocol(puc: PPURLContext; up: PURLProtocol;
-{$IF LIBAVFORMAT_VERSION < 52047000} // 52.47.0
- filename: {const} PAnsiChar; flags: cint): cint;
-{$ELSE}
url: {const} PAnsiChar; flags: cint): cint;
-{$IFEND}
- cdecl; external av__format;
-{$IFEND}
-
-(**
- * Create a URLContext for accessing to the resource indicated by
- * url, and open it.
- *
- * @param puc pointer to the location where, in case of success, the
- * function puts the pointer to the created URLContext
- * @param flags flags which control how the resource indicated by url
- * is to be opened
- * @return 0 in case of success, a negative value corresponding to an
- * AVERROR code in case of failure
- *)
-{$IF LIBAVFORMAT_VERSION < 52047000} // 52.47.0
-function url_open(h: PPointer; filename: {const} PAnsiChar; flags: cint): cint;
-{$ELSE}
+ cdecl; external av__format; deprecated;
+function url_alloc(h: PPURLContext; {const} url: PAnsiChar; flags: cint): cint;
+ cdecl; external av__format; deprecated;
+function url_connect(h: PURLContext): cint;
+ cdecl; external av__format; deprecated;
function url_open(h: PPointer; url: {const} PAnsiChar; flags: cint): cint;
-{$IFEND}
- cdecl; external av__format;
+ cdecl; external av__format; deprecated;
function url_read (h: PURLContext; buf: PByteArray; size: cint): cint;
- cdecl; external av__format;
-{$IF LIBAVFORMAT_VERSION >= 52034000} // 52.34.0
+ cdecl; external av__format; deprecated;
function url_read_complete (h: PURLContext; buf: PByteArray; size: cint): cint; cdecl;
- cdecl; external av__format;
-{$IFEND}
+ cdecl; external av__format; deprecated;
function url_write (h: PURLContext; {const} buf: PByteArray; size: cint): cint;
- cdecl; external av__format;
+ cdecl; external av__format; deprecated;
function url_seek (h: PURLContext; pos: cint64; whence: cint): cint64;
- cdecl; external av__format;
+ cdecl; external av__format; deprecated;
+function url_close (h: PURLContext): cint;
+ cdecl; external av__format; deprecated;
+function url_filesize (h: PURLContext): cint64;
+ cdecl; external av__format; deprecated;
+function url_get_file_handle(h: PURLContext): cint;
+ cdecl; external av__format; deprecated;
+function url_get_max_packet_size(h: PURLContext): cint;
+ cdecl; external av__format; deprecated;
+procedure url_get_filename(h: PURLContext; buf: PAnsiChar; buf_size: cint);
+ cdecl; external av__format; deprecated;
+function av_url_read_pause(h: PURLContext; pause: cint): cint;
+ cdecl; external av__format; deprecated;
+function av_url_read_seek(h: PURLContext; stream_index: cint;
+ timestamp: cint64; flags: cint): cint64;
+ cdecl; external av__format; deprecated;
+procedure url_set_interrupt_cb (interrupt_cb: TURLInterruptCB);
+ cdecl; external av__format; deprecated;
(**
- * Close the resource accessed by the URLContext h, and free the
- * memory used by it.
- *
- * @return a negative value if an error condition occurred, 0
- * otherwise
+ * returns the next registered protocol after the given protocol (the first if
+ * NULL is given), or NULL if protocol is the last one.
*)
-function url_close (h: PURLContext): cint;
+function av_protocol_next(p: PURLProtocol): PURLProtocol;
cdecl; external av__format;
(**
- * Return a non-zero value if the resource indicated by url
- * exists, 0 otherwise.
+ * Register the URLProtocol protocol.
+ *
+ * @param size the size of the URLProtocol struct referenced
+ *)
+function av_register_protocol2(protocol: PURLProtocol; size: cint): cint;
+ cdecl; external av__format; deprecated;
+(**
+ * @
*)
-{$IF LIBAVFORMAT_VERSION < 52047000} // 52.47.0
-function url_exist(filename: {const} PAnsiChar): cint;
-{$ELSE}
-function url_exist(url: {const} PAnsiChar): cint;
-{$IFEND}
- cdecl; external av__format;
-function url_filesize (h: PURLContext): cint64;
- cdecl; external av__format;
+type
+ ByteIOContext = AVIOContext; { deprecated }
+
+function init_put_byte(s: PAVIOContext;
+ buffer: PByteArray;
+ buffer_size: cint; write_flag: cint;
+ opaque: pointer;
+ read_packet: TReadWriteFunc;
+ write_packet: TReadWriteFunc;
+ seek: TSeekFunc): cint;
+ cdecl; external av__format; deprecated;
+function av_alloc_put_byte(
+ buffer: PByteArray;
+ buffer_size: cint;
+ write_flag: cint;
+ opaque: Pointer;
+ read_packet: TReadWriteFunc;
+ write_packet: TReadWriteFunc;
+ seek: TSeekFunc): PAVIOContext;
+ cdecl; external av__format; deprecated;
(**
- * Return the file descriptor associated with this URL. For RTP, this
- * will return only the RTP file descriptor, not the RTCP file descriptor.
- * To get both, use rtp_get_file_handles().
- *
- * @return the file descriptor associated with this URL, or <0 on error.
+ * @defgroup old_avio_funcs Old put_/get_*() functions
+ * The following functions are deprecated. Use the "avio_"-prefixed functions instead.
+ * @
+ *)
+function get_buffer(s: PAVIOContext; buf: PByteArray; size: cint): cint;
+ cdecl; external av__format; deprecated;
+function get_partial_buffer(s: PAVIOContext; buf: PByteArray; size: cint): cint;
+ cdecl; external av__format; deprecated;
+function get_byte(s: PAVIOContext): cint;
+ cdecl; external av__format; deprecated;
+function get_le16(s: PAVIOContext): cuint;
+ cdecl; external av__format; deprecated;
+function get_le24(s: PAVIOContext): cuint;
+ cdecl; external av__format; deprecated;
+function get_le32(s: PAVIOContext): cuint;
+ cdecl; external av__format; deprecated;
+function get_le64(s: PAVIOContext): cuint64;
+ cdecl; external av__format; deprecated;
+function get_be16(s: PAVIOContext): cuint;
+ cdecl; external av__format; deprecated;
+function get_be24(s: PAVIOContext): cuint;
+ cdecl; external av__format; deprecated;
+function get_be32(s: PAVIOContext): cuint;
+ cdecl; external av__format; deprecated;
+function get_be64(s: PAVIOContext): cuint64;
+ cdecl; external av__format; deprecated;
+
+procedure put_byte(s: PAVIOContext; b: cint);
+ cdecl; external av__format; deprecated;
+procedure put_nbyte(s: PAVIOContext; b: cint; count: cint);
+ cdecl; external av__format; deprecated;
+procedure put_buffer (s: PAVIOContext; buf: {const} PByteArray; size: cint);
+ cdecl; external av__format; deprecated;
+procedure put_le64(s: PAVIOContext; val: cuint64);
+ cdecl; external av__format; deprecated;
+procedure put_be64(s: PAVIOContext; val: cuint64);
+ cdecl; external av__format; deprecated;
+procedure put_le32(s: PAVIOContext; val: cuint);
+ cdecl; external av__format; deprecated;
+procedure put_be32(s: PAVIOContext; val: cuint);
+ cdecl; external av__format; deprecated;
+procedure put_le24(s: PAVIOContext; val: cuint);
+ cdecl; external av__format; deprecated;
+procedure put_be24(s: PAVIOContext; val: cuint);
+ cdecl; external av__format; deprecated;
+procedure put_le16(s: PAVIOContext; val: cuint);
+ cdecl; external av__format; deprecated;
+procedure put_be16(s: PAVIOContext; val: cuint);
+ cdecl; external av__format; deprecated;
+procedure put_tag(s: PAVIOContext; tag: {const} PAnsiChar);
+ cdecl; external av__format; deprecated;
+(**
+ * @
*)
-(* not implemented *)
-function url_get_file_handle(h: PURLContext): cint;
- cdecl; external av__format;
+
+function av_url_read_fpause(h: PAVIOContext; pause: cint): cint;
+ cdecl; external av__format; deprecated;
+function av_url_read_fseek(h: PAVIOContext; stream_index: cint;
+ timestamp: cint64; flags: cint): cint64;
+ cdecl; external av__format; deprecated;
(**
- * Return the maximum packet size associated to packetized file
- * handle. If the file is not packetized (stream like HTTP or file on
- * disk), then 0 is returned.
- *
- * @param h file handle
- * @return maximum packet size in bytes
+ * @defgroup old_url_f_funcs Old url_f* functions
+ * The following functions are deprecated, use the "avio_"-prefixed functions instead.
+ * @
+ *)
+function url_fopen(var s: PAVIOContext; url: {const} PAnsiChar; flags: cint): cint;
+ cdecl; external av__format; deprecated;
+function url_fclose(s: PAVIOContext): cint;
+ cdecl; external av__format; deprecated;
+function url_fseek(s: PAVIOContext; offset: cint64; whence: cint): cint64;
+ cdecl; external av__format; deprecated;
+function url_fskip(s: PAVIOContext; offset: cint64): cint;
+ cdecl; external av__format; deprecated;
+function url_ftell(s: PAVIOContext): cint64;
+ cdecl; external av__format; deprecated;
+function url_fsize(s: PAVIOContext): cint64;
+ cdecl; external av__format; deprecated;
+const
+ URL_EOF = -1;
+(** @note return URL_EOF (-1) if EOF *)
+function url_fgetc(s: PAVIOContext): cint;
+ cdecl; external av__format; deprecated;
+function url_setbufsize (s: PAVIOContext; buf_size: cint): cint;
+ cdecl; external av__format; deprecated;
+function url_fprintf(s: PAVIOContext; fmt: {const} PAnsiChar; args: array of const): cint;
+ cdecl; external av__format; deprecated;
+procedure put_flush_packet (s: PAVIOContext);
+ cdecl; external av__format; deprecated;
+function url_open_dyn_buf(var s: PAVIOContext): cint;
+ cdecl; external av__format; deprecated;
+function url_open_dyn_packet_buf(var s: PAVIOContext; max_packet_size: cint): cint;
+ cdecl; external av__format; deprecated;
+function url_close_dyn_buf(s: PAVIOContext; pbuffer:PPointer): cint;
+ cdecl; external av__format; deprecated;
+function url_fdopen (var s: PAVIOContext; h: PURLContext): cint;
+ cdecl; external av__format; deprecated;
+(**
+ * @
*)
-function url_get_max_packet_size(h: PURLContext): cint;
- cdecl; external av__format;
-procedure url_get_filename(h: PURLContext; buf: PAnsiChar; buf_size: cint);
- cdecl; external av__format;
+function url_ferror(s: PAVIOContext): cint;
+ cdecl; external av__format; deprecated;
+
+function udp_set_remote_url(h: PURLContext; uri: {const} PAnsiChar): cint;
+ cdecl; external av__format; deprecated;
+function udp_get_local_port(h: PURLContext): cint;
+ cdecl; external av__format; deprecated;
+
+type
+ Tupdate_checksum = function (c: culong; p: Pcuint8; len: cuint): culong; cdecl;
+procedure init_checksum(s: PAVIOContext;
+ update_checksum: Tupdate_checksum;
+ checksum: culong);
+ cdecl; external av__format; deprecated;
+function get_checksum(s: PAVIOContext): culong;
+ cdecl; external av__format; deprecated;
+procedure put_strz(s: PAVIOContext; buf: {const} PAnsiChar);
+ cdecl; external av__format; deprecated;
+(** @note unlike fgets, the EOL character is not returned and a whole
+ line is parsed. return NULL if first char read was EOF *)
+function url_fgets(s: PAVIOContext; buf: PAnsiChar; buf_size: cint): PAnsiChar;
+ cdecl; external av__format; deprecated;
(**
- * The callback is called in blocking functions to test regulary if
- * asynchronous interruption is needed. AVERROR(EINTR) is returned
- * in this case by the interrupted function. 'NULL' means no interrupt
- * callback is given.
+ * @deprecated use avio_get_str instead
*)
-procedure url_set_interrupt_cb (interrupt_cb: TURLInterruptCB);
- cdecl; external av__format;
+function get_strz(s: PAVIOContext; buf: PAnsiChar; maxlen: cint): PAnsiChar;
+ cdecl; external av__format; deprecated;
+(**
+ * @deprecated Use AVIOContext.seekable field directly.
+ *)
+function url_is_streamed(s: PAVIOContext): cint; {$IFDEF HasInline}inline;{$ENDIF} deprecated;
-(* not implemented *)
-function url_poll(poll_table: PURLPollEntry; n: cint; timeout: cint): cint;
- cdecl; external av__format;
+function url_fileno(s: PAVIOContext): PURLContext;
+ cdecl; external av__format; deprecated;
-{$IF LIBAVFORMAT_VERSION >= 52004000} // 52.4.0
(**
- * Pause and resume playing - only meaningful if using a network streaming
- * protocol (e.g. MMS).
- * @param pause 1 for pause, 0 for resume
+ * @deprecated use AVIOContext.max_packet_size directly.
*)
-function av_url_read_pause(h: PURLContext; pause: cint): cint;
- cdecl; external av__format;
-{$IFEND}
+function url_fget_max_packet_size (s: PAVIOContext): cint;
+ cdecl; external av__format; deprecated;
+
+function url_open_buf(var s: PAVIOContext; buf: PAnsiChar; buf_size: cint; flags: cint): cint;
+ cdecl; external av__format; deprecated;
+
+(** return the written or read size *)
+function url_close_buf(s: PAVIOContext): cint;
+ cdecl; external av__format; deprecated;
-{$IF LIBAVFORMAT_VERSION >= 52001000} // 52.1.0
(**
- * Seek to a given timestamp relative to some component stream.
- * Only meaningful if using a network streaming protocol (e.g. MMS.).
- * @param stream_index The stream index that the timestamp is relative to.
- * If stream_index is (-1) the timestamp should be in AV_TIME_BASE
- * units from the beginning of the presentation.
- * If a stream_index >= 0 is used and the protocol does not support
- * seeking based on component streams, the call will fail with ENOTSUP.
- * @param timestamp timestamp in AVStream.time_base units
- * or if there is no stream specified then in AV_TIME_BASE units.
- * @param flags Optional combination of AVSEEK_FLAG_BACKWARD, AVSEEK_FLAG_BYTE
- * and AVSEEK_FLAG_ANY. The protocol may silently ignore
- * AVSEEK_FLAG_BACKWARD and AVSEEK_FLAG_ANY, but AVSEEK_FLAG_BYTE will
- * fail with ENOTSUP if used and not supported.
- * @return >= 0 on success
- * @see AVInputFormat::read_seek
+ * Return a non-zero value if the resource indicated by url
+ * exists, 0 otherwise.
+ * @deprecated Use avio_check instead.
*)
-function av_url_read_seek(h: PURLContext; stream_index: cint;
- timestamp: cint64; flags: cint): cint64;
- cdecl; external av__format;
+function url_exist(url: {const} PAnsiChar): cint;
+ cdecl; external av__format; deprecated;
{$IFEND}
(**
-var
-{$IF LIBAVFORMAT_VERSION < 52078003} // < 52.78.3
- first_protocol: PURLProtocol; external av__format;
-{$ELSE}
- {$IFDEF FF_API_REGISTER_PROTOCOL}
- first_protocol: PURLProtocol; external av__format;
- {$IFEND}
-{$IFEND}
- url_interrupt_cb: PURLInterruptCB; external av__format;
-**)
+ * Return AVIO_* access flags corresponding to the access permissions
+ * of the resource in url, or a negative value corresponding to an
+ * AVERROR code in case of failure. The returned access flags are
+ * masked by the value in flags.
+ *
+ * @note This function is intrinsically unsafe, in the sense that the
+ * checked resource may change its existence or permission status from
+ * one call to another. Thus you should not trust the returned value,
+ * unless you are sure that no other processes are accessing the
+ * checked resource.
+ *
+ * @note This function is slightly broken until next major bump
+ * because of AVIO_RDONLY == 0. Don't use it until then.
+ *)
+function avio_check(url: {const} PAnsiChar; flags: cint): cint;
+ cdecl; external av__format;
-{$IF LIBAVFORMAT_VERSION >= 52002000} // 52.2.0
(**
- * If protocol is NULL, returns the first registered protocol,
- * if protocol is non-NULL, returns the next registered protocol after protocol,
- * or NULL if protocol is the last one.
+ * The callback is called in blocking functions to test regulary if
+ * asynchronous interruption is needed. AVERROR_EXIT is returned
+ * in this case by the interrupted function. 'NULL' means no interrupt
+ * callback is given.
*)
-function av_protocol_next(p: PURLProtocol): PURLProtocol;
+procedure avio_set_interrupt_cb(interrupt_cb: Pointer);
cdecl; external av__format;
+
+{$IFDEF FF_API_REGISTER_PROTOCOL}
+var
+ first_protocol: PURLProtocol; external av__format;
{$IFEND}
-{$IF LIBAVFORMAT_VERSION <= 52028000} // 52.28.0
+{$IFDEF FF_API_REGISTER_PROTOCOL}
(**
- * Register the URLProtocol protocol.
- *
- *
* @deprecated Use av_register_protocol() instead.
*)
function register_protocol(protocol: PURLProtocol): cint;
- cdecl; external av__format;
-(** Alias for register_protocol()
- *
+ cdecl; external av__format; deprecated;
+
+(**
* @deprecated Use av_register_protocol2() instead.
*)
function av_register_protocol(protocol: PURLProtocol): cint;
- cdecl; external av__format name 'register_protocol';
-{$ELSE}
-{$IF LIBAVFORMAT_VERSION < 52078003} // < 52.78.3
-function av_register_protocol(protocol: PURLProtocol): cint;
- cdecl; external av__format;
-{$ELSE}
- {$IFDEF FF_API_REGISTER_PROTOCOL}
-function av_register_protocol(protocol: PURLProtocol): cint;
- cdecl; external av__format;
- {$ENDIF}
-{$IFEND}
-{$IFEND}
-{$IF LIBAVFORMAT_VERSION >= 52069000} // 52.69.0
-function av_register_protocol2(protocol: PURLProtocol; size: cint): cint;
- cdecl; external av__format;
-{$IFEND}
-
-type
- TReadWriteFunc = function(opaque: Pointer; buf: PByteArray; buf_size: cint): cint; cdecl;
- TSeekFunc = function(opaque: Pointer; offset: cint64; whence: cint): cint64; cdecl;
+ cdecl; external av__format; deprecated;
+{$ENDIF}
-function init_put_byte(s: PByteIOContext;
- buffer: PByteArray;
- buffer_size: cint; write_flag: cint;
- opaque: pointer;
- read_packet: TReadWriteFunc;
- write_packet: TReadWriteFunc;
- seek: TSeekFunc): cint;
- cdecl; external av__format;
-{$IF LIBAVFORMAT_VERSION >= 52004000} // 52.4.0
-function av_alloc_put_byte(
- buffer: PByteArray;
+(**
+ * Allocate and initialize an AVIOContext for buffered I/O. It must be later
+ * freed with av_free().
+ *
+ * @param buffer Memory block for input/output operations via AVIOContext.
+ * The buffer must be allocated with av_malloc() and friends.
+ * @param buffer_size The buffer size is very important for performance.
+ * For protocols with fixed blocksize it should be set to this blocksize.
+ * For others a typical size is a cache page, e.g. 4kb.
+ * @param write_flag Set to 1 if the buffer should be writable, 0 otherwise.
+ * @param opaque An opaque pointer to user-specific data.
+ * @param read_packet A function for refilling the buffer, may be NULL.
+ * @param write_packet A function for writing the buffer contents, may be NULL.
+ * @param seek A function for seeking to specified byte position, may be NULL.
+ *
+ * @return Allocated AVIOContext or NULL on failure.
+ *)
+function avio_alloc_context(
+ buffer: PAnsiChar;
buffer_size: cint;
write_flag: cint;
opaque: Pointer;
read_packet: TReadWriteFunc;
write_packet: TReadWriteFunc;
- seek: TSeekFunc): PByteIOContext;
+ seek: TSeekFunc): PAVIOContext;
cdecl; external av__format;
-{$IFEND}
-
-procedure put_byte(s: PByteIOContext; b: cint);
+
+procedure avio_w8(s: PAVIOContext; b: cint);
cdecl; external av__format;
-procedure put_buffer (s: PByteIOContext; buf: {const} PByteArray; size: cint);
+procedure avio_write(s: PAVIOContext; buf: {const} PAnsiChar; size: cint);
cdecl; external av__format;
-procedure put_le64(s: PByteIOContext; val: cuint64);
+procedure avio_wl64(s: PAVIOContext; val: cuint64);
cdecl; external av__format;
-procedure put_be64(s: PByteIOContext; val: cuint64);
+procedure avio_wb64(s: PAVIOContext; val: cuint64);
cdecl; external av__format;
-procedure put_le32(s: PByteIOContext; val: cuint);
+procedure avio_wl32(s: PAVIOContext; val: cuint);
cdecl; external av__format;
-procedure put_be32(s: PByteIOContext; val: cuint);
+procedure avio_wb32(s: PAVIOContext; val: cuint);
cdecl; external av__format;
-procedure put_le24(s: PByteIOContext; val: cuint);
+procedure avio_wl24(s: PAVIOContext; val: cuint);
cdecl; external av__format;
-procedure put_be24(s: PByteIOContext; val: cuint);
+procedure avio_wb24(s: PAVIOContext; val: cuint);
cdecl; external av__format;
-procedure put_le16(s: PByteIOContext; val: cuint);
+procedure avio_wl16(s: PAVIOContext; val: cuint);
cdecl; external av__format;
-procedure put_be16(s: PByteIOContext; val: cuint);
+procedure avio_wb16(s: PAVIOContext; val: cuint);
cdecl; external av__format;
-procedure put_tag(s: PByteIOContext; tag: {const} PAnsiChar);
+
+(**
+ * Write a NULL-terminated string.
+ * @return number of bytes written.
+ *)
+function avio_put_str(s: PAVIOContext; str: {const} PAnsiChar): cint;
cdecl; external av__format;
-procedure put_strz(s: PByteIOContext; buf: {const} PAnsiChar);
+(**
+ * Convert an UTF-8 string to UTF-16LE and write it.
+ * @return number of bytes written.
+ *)
+function avio_put_str16le(s: PAVIOContext; str: {const} PAnsiChar): cint;
cdecl; external av__format;
+const
+ (**
+ * Passing this as the "whence" parameter to a seek function causes it to
+ * return the filesize without seeking anywhere. Supporting this is optional.
+ * If it is not supported then the seek function will return <0.
+ *)
+ AVSEEK_SIZE = $10000;
+
+ (**
+ * Oring this flag as into the "whence" parameter to a seek function causes it to
+ * seek by any means (like reopening and linear reading) or other normally unreasonble
+ * means that can be extreemly slow.
+ * This may be ignored by the seek code.
+ *)
+ AVSEEK_FORCE = $20000;
+
(**
- * fseek() equivalent for ByteIOContext.
+ * fseek() equivalent for AVIOContext.
* @return new position or AVERROR.
*)
-function url_fseek(s: PByteIOContext; offset: cint64; whence: cint): cint64;
+function avio_seek(s: PAVIOContext; offset: cint64; whence: cint): cint64;
cdecl; external av__format;
(**
- * Skip given number of bytes forward.
- * @param offset number of bytes
- * @return 0 on success, <0 on error
+ * Skip given number of bytes forward
+ * @return new position or AVERROR.
*)
-{$IF LIBAVFORMAT_VERSION < 52074000} // 52.74.0
-procedure url_fskip(s: PByteIOContext; offset: cint64);
+function avio_skip(s: PAVIOContext; offset: cint64): cint64;
cdecl; external av__format;
-{$ELSE}
-function url_fskip(s: PByteIOContext; offset: cint64): cint;
- cdecl; external av__format;
-{$IFEND}
(**
- * ftell() equivalent for ByteIOContext.
+ * ftell() equivalent for AVIOContext.
* @return position or AVERROR.
*)
-function url_ftell(s: PByteIOContext): cint64;
- cdecl; external av__format;
+function avio_tell(s: PAVIOContext): cint64; {$IFDEF HasInline}inline;{$ENDIF}
(**
* Get the filesize.
* @return filesize or AVERROR
*)
-function url_fsize(s: PByteIOContext): cint64;
+function avio_size(s: PAVIOContext): cint64;
cdecl; external av__format;
(**
- * feof() equivalent for ByteIOContext.
+ * feof() equivalent for AVIOContext.
* @return non zero if and only if end of file
*)
-function url_feof(s: PByteIOContext): cint;
- cdecl; external av__format;
-
-function url_ferror(s: PByteIOContext): cint;
- cdecl; external av__format;
-
-{$IF LIBAVFORMAT_VERSION >= 52004000} // 52.4.0
-function av_url_read_fpause(h: PByteIOContext; pause: cint): cint;
- cdecl; external av__format;
-{$IFEND}
-
-{$IF LIBAVFORMAT_VERSION >= 52001000} // 52.1.0
-function av_url_read_fseek(h: PByteIOContext; stream_index: cint;
- timestamp: cint64; flags: cint): cint64;
- cdecl; external av__format;
-{$IFEND}
-
-const
- URL_EOF = -1;
-(** @note return URL_EOF (-1) if EOF *)
-function url_fgetc(s: PByteIOContext): cint;
+function url_feof(s: PAVIOContext): cint;
cdecl; external av__format;
-
+
(** @warning currently size is limited *)
-function url_fprintf(s: PByteIOContext; fmt: {const} PAnsiChar; args: array of const): cint;
- cdecl; external av__format;
-
-(** @note unlike fgets, the EOL character is not returned and a whole
- line is parsed. return NULL if first char read was EOF *)
-function url_fgets(s: PByteIOContext; buf: PAnsiChar; buf_size: cint): PAnsiChar;
+function avio_printf(s: PAVIOContext; fmt: {const} PAnsiChar; args: array of const): cint;
cdecl; external av__format;
-procedure put_flush_packet (s: PByteIOContext);
+procedure avio_flush(s: PAVIOContext);
cdecl; external av__format;
(**
- * Read size bytes from ByteIOContext into buf.
+ * Read size bytes from AVIOContext into buf.
* @return number of bytes read or AVERROR
*)
-function get_buffer(s: PByteIOContext; buf: PByteArray; size: cint): cint;
+function avio_read(s: PAVIOContext; buf: Pbyte; size: cint): cint;
cdecl; external av__format;
(**
- * Read size bytes from ByteIOContext into buf.
- * This reads at most 1 packet. If that is not enough fewer bytes will be
- * returned.
- * @return number of bytes read or AVERROR
+ * @name Functions for reading from AVIOContext
+ * @
+ *
+ * @note return 0 if EOF, so you cannot use it if EOF handling is
+ * necessary
*)
-function get_partial_buffer(s: PByteIOContext; buf: PByteArray; size: cint): cint;
+function avio_r8(s: PAVIOContext): cint;
cdecl; external av__format;
-(** @note return 0 if EOF, so you cannot use it if EOF handling is
- necessary *)
-function get_byte(s: PByteIOContext): cint;
- cdecl; external av__format;
-function get_le24(s: PByteIOContext): cuint;
- cdecl; external av__format;
-function get_le32(s: PByteIOContext): cuint;
- cdecl; external av__format;
-function get_le64(s: PByteIOContext): cuint64;
- cdecl; external av__format;
-function get_le16(s: PByteIOContext): cuint;
+function avio_rl16(s: PAVIOContext): cuint;
cdecl; external av__format;
-function get_strz(s: PByteIOContext; buf: PAnsiChar; maxlen: cint): PAnsiChar;
- cdecl; external av__format;
-function get_be16(s: PByteIOContext): cuint;
+function avio_rl24(s: PAVIOContext): cuint;
cdecl; external av__format;
-function get_be24(s: PByteIOContext): cuint;
+
+function avio_rl32(s: PAVIOContext): cuint;
cdecl; external av__format;
-function get_be32(s: PByteIOContext): cuint;
+
+function avio_rl64(s: PAVIOContext): cuint64;
cdecl; external av__format;
-function get_be64(s: PByteIOContext): cuint64;
+
+function avio_rb16(s: PAVIOContext): cuint;
cdecl; external av__format;
-{$IF LIBAVFORMAT_VERSION >= 51017001} // 51.17.1
- {$IF LIBAVFORMAT_VERSION < 52078003} // < 52.78.3
-function ff_get_v(bc: PByteIOContext): cuint64;
+function avio_rb24(s: PAVIOContext): cuint;
cdecl; external av__format;
- {$ELSE}
- {$IFDEF FF_API_URL_RESETBUF}
-function ff_get_v(bc: PByteIOContext): cuint64;
+
+function avio_rb32(s: PAVIOContext): cuint;
cdecl; external av__format;
- {$ENDIF}
- {$IFEND}
-{$IFEND}
-function url_is_streamed(s: PByteIOContext): cint; {$IFDEF HasInline}inline;{$ENDIF}
+function avio_rb64(s: PAVIOContext): cuint64;
+ cdecl; external av__format;
(**
- * Create and initialize a ByteIOContext for accessing the
- * resource referenced by the URLContext h.
- * @note When the URLContext h has been opened in read+write mode, the
- * ByteIOContext can be used only for writing.
+ * @
+ *)
+(**
+ * Read a string from pb into buf. The reading will terminate when either
+ * a NULL character was encountered, maxlen bytes have been read, or nothing
+ * more can be read from pb. The result is guaranteed to be NULL-terminated, it
+ * will be truncated if buf is too small.
+ * Note that the string is not interpreted or validated in any way, it
+ * might get truncated in the middle of a sequence for multi-byte encodings.
*
- * @param s Used to return the pointer to the created ByteIOContext.
- * In case of failure the pointed to value is set to NULL.
- * @return 0 in case of success, a negative value corresponding to an
- * AVERROR code in case of failure
+ * @return number of bytes read (is always <= maxlen).
+ * If reading ends on EOF or error, the return value will be one more than
+ * bytes actually read.
*)
-{$IF LIBAVFORMAT_VERSION >= 52000000} // 52.0.0
-function url_fdopen (var s: PByteIOContext; h: PURLContext): cint;
-{$ELSE}
-function url_fdopen (s: PByteIOContext; h: PURLContext): cint;
-{$IFEND}
+function avio_get_str(pb: PAVIOContext; maxlen: cint; buf: PAnsiChar; buflen: cint): cint;
+ cdecl; external av__format;
+
+(**
+ * Read a UTF-16 string from pb and convert it to UTF-8.
+ * The reading will terminate when either a null or invalid character was
+ * encountered or maxlen bytes have been read.
+ * @return number of bytes read (is always <= maxlen)
+ *)
+function avio_get_str16le(pb: PAVIOContext; maxlen: cint; buf: PAnsiChar; buflen: cint): cint;
cdecl; external av__format;
-(** @warning must be called before any I/O *)
-function url_setbufsize (s: PByteIOContext; buf_size: cint): cint;
+function avio_get_str16be(pb: PAVIOContext; maxlen: cint; buf: PAnsiChar; buflen: cint): cint;
cdecl; external av__format;
-{$IF LIBAVFORMAT_VERSION_MAJOR < 53}
-{$IF LIBAVFORMAT_VERSION >= 51015000} // 51.15.0
+{$IFDEF FF_API_URL_RESETBUF}
(** Reset the buffer for reading or writing.
* @note Will drop any data currently in the buffer without transmitting it.
* @param flags URL_RDONLY to set up the buffer for reading, or URL_WRONLY
* to set up the buffer for writing. *)
-function url_resetbuf(s: PByteIOContext; flags: cint): cint;
+function url_resetbuf(s: PAVIOContext; flags: cint): cint;
cdecl; external av__format;
-{$IFEND}
-{$IFEND}
+{$ENDIF}
-{$IF LIBAVFORMAT_VERSION >= 52061000} // 52.61.0
(**
- * Rewind the ByteIOContext using the specified buffer containing the first buf_size bytes of the file.
- * Used after probing to avoid seeking.
- * Joins buf and s->buffer, taking any overlap into consideration.
- * @note s->buffer must overlap with buf or they can't be joined and the function fails
- * @note This function is NOT part of the public API
- *
- * @param s The read-only ByteIOContext to rewind
- * @param buf The probe buffer containing the first buf_size bytes of the file
- * @param buf_size The size of buf
- * @return 0 in case of success, a negative value corresponding to an
- * AVERROR code in case of failure
+ * @name URL open modes
+ * The flags argument to avio_open must be one of the following
+ * constants, optionally ORed with other flags.
+ * @
*)
-function ff_rewind_with_probe_data(s: PByteIOContext; buf: PAnsiChar; buf_size: cint): cint;
- cdecl; external av__format;
-{$IFEND}
+
+const
+{$IF LIBAVFORMAT_VERSION_MAJOR < 53}
+ AVIO_RDONLY = 0; (**< read-only *)
+ AVIO_WRONLY = 1; (**< write-only *)
+ AVIO_RDWR = 2; (**< read-write *)
+{$ELSE}
+ AVIO_RDONLY = 1; (**< read-only *)
+ AVIO_WRONLY = 2; (**< write-only *)
+ AVIO_RDWR = 4; (**< read-write *)
+{$ENDIF}
+(**
+ * @
+ *)
+
+(**
+ * Use non-blocking mode.
+ * If this flag is set, operations on the context will return
+ * AVERROR(EAGAIN) if they can not be performed immediately.
+ * If this flag is not set, operations on the context will never return
+ * AVERROR(EAGAIN).
+ * Note that this flag does not affect the opening/connecting of the
+ * context. Connecting a protocol will always block if necessary (e.g. on
+ * network protocols) but never hang (e.g. on busy devices).
+ * Warning: non-blocking protocols is work-in-progress; this flag may be
+ * silently ignored.
+ *)
+const
+{$IF LIBAVFORMAT_VERSION_MAJOR < 53}
+ AVIO_FLAG_NONBLOCK = 4;
+{$ELSE}
+ AVIO_FLAG_NONBLOCK = 8;
+{$ENDIF}
(**
- * Create and initialize a ByteIOContext for accessing the
+ * Create and initialize a AVIOContext for accessing the
* resource indicated by url.
* @note When the resource indicated by url has been opened in
- * read+write mode, the ByteIOContext can be used only for writing.
+ * read+write mode, the AVIOContext can be used only for writing.
*
- * @param s Used to return the pointer to the created ByteIOContext.
+ * @param s Used to return the pointer to the created AVIOContext.
* In case of failure the pointed to value is set to NULL.
* @param flags flags which control how the resource indicated by url
* is to be opened
* @return 0 in case of success, a negative value corresponding to an
* AVERROR code in case of failure
*)
-{$IF LIBAVFORMAT_VERSION < 52047000} // 52.47.0
-{$IF LIBAVFORMAT_VERSION >= 52000000} // 52.0.0
-function url_fopen(var s: PByteIOContext; filename: {const} PAnsiChar; flags: cint): cint;
-{$ELSE}
-function url_fopen(s: PByteIOContext; filename: {const} PAnsiChar; flags: cint): cint;
-{$IFEND}
-{$ELSE}
-function url_fopen(var s: PByteIOContext; url: {const} PAnsiChar; flags: cint): cint;
-{$IFEND}
- cdecl; external av__format;
-function url_fclose(s: PByteIOContext): cint;
- cdecl; external av__format;
-function url_fileno(s: PByteIOContext): PURLContext;
+function avio_open(var s: PAVIOContext; url: {const} PAnsiChar; flags: cint): cint;
cdecl; external av__format;
(**
- * Return the maximum packet size associated to packetized buffered file
- * handle. If the file is not packetized (stream like http or file on
- * disk), then 0 is returned.
+ * Close the resource accessed by the AVIOContext s and free it.
+ * This function can only be used if s was opened by avio_open().
*
- * @param s buffered file handle
- * @return maximum packet size in bytes
+ * @return 0 on success, an AVERROR < 0 on error.
*)
-function url_fget_max_packet_size (s: PByteIOContext): cint;
- cdecl; external av__format;
-
-{$IF LIBAVFORMAT_VERSION >= 52000000} // 52.0.0
-function url_open_buf(var s: PByteIOContext; buf: PAnsiChar; buf_size: cint; flags: cint): cint;
-{$ELSE}
-function url_open_buf(s: PByteIOContext; buf: PAnsiChar; buf_size: cint; flags: cint): cint;
-{$IFEND}
- cdecl; external av__format;
-
-(** return the written or read size *)
-function url_close_buf(s: PByteIOContext): cint;
+function avio_close(s: PAVIOContext): cint;
cdecl; external av__format;
(**
@@ -727,70 +770,82 @@ function url_close_buf(s: PByteIOContext): cint;
* @param s new IO context
* @return zero if no error.
*)
-{$IF LIBAVFORMAT_VERSION >= 52000000} // 52.0.0
-function url_open_dyn_buf(var s: PByteIOContext): cint;
-{$ELSE}
-function url_open_dyn_buf(s: PByteIOContext): cint;
-{$IFEND}
- cdecl; external av__format;
-
-(**
- * Open a write only packetized memory stream with a maximum packet
- * size of 'max_packet_size'. The stream is stored in a memory buffer
- * with a big endian 4 byte header giving the packet size in bytes.
- *
- * @param s new IO context
- * @param max_packet_size maximum packet size (must be > 0)
- * @return zero if no error.
- *)
-{$IF LIBAVFORMAT_VERSION >= 52000000} // 52.0.0
-function url_open_dyn_packet_buf(var s: PByteIOContext; max_packet_size: cint): cint;
-{$ELSE}
-function url_open_dyn_packet_buf(s: PByteIOContext; max_packet_size: cint): cint;
-{$IFEND}
+function avio_open_dyn_buf(var s: PAVIOContext): cint;
cdecl; external av__format;
(**
* Return the written size and a pointer to the buffer. The buffer
- * must be freed with av_free(). If the buffer is opened with
- * url_open_dyn_buf, then padding of FF_INPUT_BUFFER_PADDING_SIZE is
- * added; if opened with url_open_dyn_packet_buf, no padding is added.
+ * must be freed with av_free().
+ * Padding of FF_INPUT_BUFFER_PADDING_SIZE is added to the buffer.
+ *
* @param s IO context
* @param pbuffer pointer to a byte buffer
* @return the length of the byte buffer
*)
-function url_close_dyn_buf(s: PByteIOContext; pbuffer:PPointer): cint;
+function avio_close_dyn_buf(s: PAVIOContext; var pbuffer: Pcuint8): cint;
cdecl; external av__format;
-{$IF LIBAVFORMAT_VERSION >= 51017001} // 51.17.1
-function ff_crc04C11DB7_update(checksum: culong; buf: {const} PByteArray;
- len: cuint): culong;
+{$IFDEF FF_API_UDP_GET_FILE}
+function udp_get_file_handle(h: PURLContext): cint;
cdecl; external av__format;
-{$IFEND}
+{$ENDIF}
-function get_checksum(s: PByteIOContext): culong;
- cdecl; external av__format;
-procedure init_gsum(s: PByteIOContext;
- update_checksum: pointer;
- checksum: culong);
+(**
+ * Iterate through names of available protocols.
+ * @note it is recommanded to use av_protocol_next() instead of this
+ *
+ * @param opaque A private pointer representing current protocol.
+ * It must be a pointer to NULL on first iteration and will
+ * be updated by successive calls to avio_enum_protocols.
+ * @param output If set to 1, iterate over output protocols,
+ * otherwise over input protocols.
+ *
+ * @return A static string containing the name of current protocol or NULL
+ *)
+function avio_enum_protocols(var opaque: Pointer; output: cint): PAnsiChar;
cdecl; external av__format;
-(* udp.c *)
-function udp_set_remote_url(h: PURLContext; uri: {const} PAnsiChar): cint;
- cdecl; external av__format;
-function udp_get_local_port(h: PURLContext): cint;
+(**
+ * Pause and resume playing - only meaningful if using a network streaming
+ * protocol (e.g. MMS).
+ * @param pause 1 for pause, 0 for resume
+ *)
+function avio_pause(h: PAVIOContext; pause: cint): cint;
cdecl; external av__format;
-{$IF LIBAVFORMAT_VERSION_MAJOR <= 52}
-function udp_get_file_handle(h: PURLContext): cint;
+(**
+ * Seek to a given timestamp relative to some component stream.
+ * Only meaningful if using a network streaming protocol (e.g. MMS.).
+ * @param stream_index The stream index that the timestamp is relative to.
+ * If stream_index is (-1) the timestamp should be in AV_TIME_BASE
+ * units from the beginning of the presentation.
+ * If a stream_index >= 0 is used and the protocol does not support
+ * seeking based on component streams, the call will fail with ENOTSUP.
+ * @param timestamp timestamp in AVStream.time_base units
+ * or if there is no stream specified then in AV_TIME_BASE units.
+ * @param flags Optional combination of AVSEEK_FLAG_BACKWARD, AVSEEK_FLAG_BYTE
+ * and AVSEEK_FLAG_ANY. The protocol may silently ignore
+ * AVSEEK_FLAG_BACKWARD and AVSEEK_FLAG_ANY, but AVSEEK_FLAG_BYTE will
+ * fail with ENOTSUP if used and not supported.
+ * @return >= 0 on success
+ * @see AVInputFormat: : read_seek
+ *)
+function avio_seek_time(h: PAVIOContext; stream_index: cint;
+ timestamp: cint64; flags: cint): cint64;
cdecl; external av__format;
-{$IFEND}
-
+
implementation
-function url_is_streamed(s: PByteIOContext): cint;
+{$IFDEF FF_API_OLD_AVIO}
+function url_is_streamed(s: PAVIOContext): cint;
begin
Result := s^.is_streamed;
end;
+{$ENDIF}
+
+function avio_tell(s: PAVIOContext): cint64;
+begin
+ Result := avio_seek(s, 0, SEEK_CUR);
+end;
end.
diff --git a/src/lib/ffmpeg/avutil.pas b/src/lib/ffmpeg/avutil.pas
index 2f8c79f7..e2cfd496 100644
--- a/src/lib/ffmpeg/avutil.pas
+++ b/src/lib/ffmpeg/avutil.pas
@@ -24,14 +24,11 @@
* Conversions of
*
* libavutil/avutil.h:
- * Min. version: 49.0.1, revision 6577, Sat Oct 7 15:30:46 2006 UTC
- * Max. version: 50.24.0, revision 24814, Wed Aug 25 05:00:00 2010 CET
+ * version: 50.43.0
*
* libavutil/mem.h:
- * revision 23904, Wed Jul 21 01:00:00 2010 CET
*
* libavutil/log.h:
- * revision 23972, Wed Jul 21 01:00:00 2010 CET
*
* include/keep pixfmt.h (change in revision 50.01.0)
* Maybe, the pixelformats are not needed, but it has not been checked.
@@ -58,6 +55,7 @@ interface
uses
ctypes,
mathematics,
+ opt,
rational,
{$IFDEF UNIX}
BaseUnix,
@@ -65,43 +63,18 @@ uses
UConfig;
const
- (*
- * IMPORTANT: The official FFmpeg C headers change very quickly. Often some
- * of the data structures are changed so that they become incompatible with
- * older header files. The Pascal headers have to be adjusted to those changes,
- * otherwise the application might crash randomly or strange bugs (not
- * necessarily related to video or audio due to buffer overflows etc.) might
- * occur.
- *
- * In the past users reported problems with USDX that took hours to fix and
- * the problem was an unsupported version of FFmpeg. So we decided to disable
- * support for future versions of FFmpeg until the headers are revised by us
- * for that version as they otherwise most probably will break USDX.
- *
- * If the headers do not yet support your FFmpeg version you may want to
- * adjust the max. version numbers manually but please note: it may work but
- * in many cases it does not. The USDX team does NOT PROVIDE ANY SUPPORT
- * for the game if the MAX. VERSION WAS CHANGED.
- *
- * The only safe way to support new versions of FFmpeg is to add the changes
- * of the FFmpeg git repository C headers to the Pascal headers.
- * You can accelerate this process by posting a patch with the git changes
- * translated to Pascal to our bug tracker (please join our IRC chat before
- * you start working on it). Simply adjusting the max. versions is NOT a valid
- * fix.
- *)
(* Max. supported version by this header *)
LIBAVUTIL_MAX_VERSION_MAJOR = 50;
- LIBAVUTIL_MAX_VERSION_MINOR = 24;
+ LIBAVUTIL_MAX_VERSION_MINOR = 43;
LIBAVUTIL_MAX_VERSION_RELEASE = 0;
LIBAVUTIL_MAX_VERSION = (LIBAVUTIL_MAX_VERSION_MAJOR * VERSION_MAJOR) +
(LIBAVUTIL_MAX_VERSION_MINOR * VERSION_MINOR) +
(LIBAVUTIL_MAX_VERSION_RELEASE * VERSION_RELEASE);
(* Min. supported version by this header *)
- LIBAVUTIL_MIN_VERSION_MAJOR = 49;
- LIBAVUTIL_MIN_VERSION_MINOR = 0;
- LIBAVUTIL_MIN_VERSION_RELEASE = 1;
+ LIBAVUTIL_MIN_VERSION_MAJOR = 50;
+ LIBAVUTIL_MIN_VERSION_MINOR = 43;
+ LIBAVUTIL_MIN_VERSION_RELEASE = 0;
LIBAVUTIL_MIN_VERSION = (LIBAVUTIL_MIN_VERSION_MAJOR * VERSION_MAJOR) +
(LIBAVUTIL_MIN_VERSION_MINOR * VERSION_MINOR) +
(LIBAVUTIL_MIN_VERSION_RELEASE * VERSION_RELEASE);
@@ -115,15 +88,12 @@ const
{$MESSAGE Error 'Linked version of libavutil is not yet supported!'}
{$IFEND}
-{$IF LIBAVUTIL_VERSION >= 49008000} // 49.8.0
(**
* Return the LIBAVUTIL_VERSION_INT constant.
*)
function avutil_version(): cuint;
cdecl; external av__util;
-{$IFEND}
-{$IF LIBAVUTIL_VERSION >= 50004000} // >= 50.4.0
(**
* Return the libavutil build-time configuration.
*)
@@ -135,12 +105,6 @@ function avutil_configuration(): PAnsiChar;
*)
function avutil_license(): PAnsiChar;
cdecl; external av__util;
-{$IFEND}
-
-{
- TAVMediaType moved to avutil in LIBAVUTIL_VERSION 50.14.0
- but moving it in the pascal headers was not really necessary
- but caused problems. So, I (KMS) left it there.
type
TAVMediaType = (
@@ -152,11 +116,50 @@ type
AVMEDIA_TYPE_ATTACHMENT,
AVMEDIA_TYPE_NB
);
-}
+
+const
+ FF_LAMBDA_SHIFT = 7;
+ FF_LAMBDA_SCALE = (1<<FF_LAMBDA_SHIFT);
+ FF_QP2LAMBDA = 118; ///< factor to convert from H.263 QP to lambda
+ FF_LAMBDA_MAX = (256*128-1);
+
+ FF_QUALITY_SCALE = FF_LAMBDA_SCALE; //FIXME maybe remove
+
+ AV_NOPTS_VALUE = $8000000000000000;
+ AV_TIME_BASE = 1000000;
+ AV_TIME_BASE_Q : TAVRational = (num: 1; den: AV_TIME_BASE);
+
+(**
+ * Those FF_API_* defines are not part of public API.
+ * They may change, break or disappear at any time.
+ *)
+{$IFNDEF FF_API_OLD_IMAGE_NAMES}
+ {$DEFINE FF_API_OLD_IMAGE_NAMES = (LIBAVUTIL_VERSION_MAJOR < 51)}
+{$ENDIF}
+type
+ TAVPictureType = (
+ AV_PICTURE_TYPE_I = 1, ///< Intra
+ AV_PICTURE_TYPE_P, ///< Predicted
+ AV_PICTURE_TYPE_B, ///< Bi-dir predicted
+ AV_PICTURE_TYPE_S, ///< S(GMC)-VOP MPEG4
+ AV_PICTURE_TYPE_SI, ///< Switching Intra
+ AV_PICTURE_TYPE_SP, ///< Switching Predicted
+ AV_PICTURE_TYPE_BI ///< BI type
+ );
+
+(**
+ * Return a single letter to describe the given picture type
+ * pict_type.
+ *
+ * @param[in] pict_type the picture type @return a single character
+ * representing the picture type, '?' if pict_type is unknown
+ *)
+function av_get_picture_type_char(pict_type: TAVPictureType): Pchar;
+ cdecl; external av__util;
{$INCLUDE error.pas}
-(* libavutil/pixfmt.h up to revision 23144, May 16 2010 *)
+(* libavutil/pixfmt.h version: 50.43.0 *)
type
(**
@@ -182,8 +185,8 @@ type
* allocating the picture.
*
* Note, make sure that all newly added big endian formats have pix_fmt&1==1
- * and that all newly added little endian formats have pix_fmt&1==0
- * this allows simpler detection of big vs little endian.
+ * and that all newly added little endian formats have pix_fmt&1==0
+ * this allows simpler detection of big vs little endian.
*)
PAVPixelFormat = ^TAVPixelFormat;
@@ -195,65 +198,46 @@ type
PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR...
PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
-{$IF LIBAVUTIL_VERSION <= 50001000} // 50.01.0
- PIX_FMT_RGB32, ///< packed RGB 8:8:8, 32bpp, (msb)8A 8R 8G 8B(lsb), in CPU endianness
-{$IFEND}
PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
-{$IF LIBAVUTIL_VERSION <= 50000000} // 50.00.0
- PIX_FMT_RGB565, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), in CPU endianness
- PIX_FMT_RGB555, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), in CPU endianness, most significant bit to 0
-{$IFEND}
PIX_FMT_GRAY8, ///< Y , 8bpp
PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb
PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb
PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette
- PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG)
- PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG)
- PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG)
+ PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_range
+ PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_range
+ PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_range
PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing
PIX_FMT_XVMC_MPEG2_IDCT,
PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
-{$IF LIBAVUTIL_VERSION <= 50001000} // 50.01.0
- PIX_FMT_BGR32, ///< packed RGB 8:8:8, 32bpp, (msb)8A 8B 8G 8R(lsb), in CPU endianness
-{$IFEND}
-{$IF LIBAVUTIL_VERSION <= 50000000} // 50.00.0
- PIX_FMT_BGR565, ///< packed RGB 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), in CPU endianness
- PIX_FMT_BGR555, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), in CPU endianness, most significant bit to 1
-{$IFEND}
PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
- PIX_FMT_BGR4, ///< packed RGB 1:2:1, bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
+ PIX_FMT_BGR4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
- PIX_FMT_RGB4, ///< packed RGB 1:2:1, bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
+ PIX_FMT_RGB4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V)
PIX_FMT_NV21, ///< as above, but U and V bytes are swapped
-{$IF LIBAVUTIL_VERSION <= 50001000} // 50.01.0
- PIX_FMT_RGB32_1, ///< packed RGB 8:8:8, 32bpp, (msb)8R 8G 8B 8A(lsb), in CPU endianness
- PIX_FMT_BGR32_1, ///< packed RGB 8:8:8, 32bpp, (msb)8B 8G 8R 8A(lsb), in CPU endianness
-{$ELSE} // 50.02.0
+
PIX_FMT_ARGB, ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
PIX_FMT_RGBA, ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
PIX_FMT_ABGR, ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
PIX_FMT_BGRA, ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
-{$IFEND}
+
PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian
PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian
PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
- PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG)
+ PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of PIX_FMT_YUV440P and setting color_range
PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
PIX_FMT_VDPAU_H264,///< H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
PIX_FMT_VDPAU_MPEG1,///< MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
PIX_FMT_VDPAU_MPEG2,///< MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
PIX_FMT_VDPAU_WMV3,///< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
PIX_FMT_VDPAU_VC1, ///< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
-{$IF LIBAVUTIL_VERSION >= 49015000} // 49.15.0
PIX_FMT_RGB48BE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big-endian
PIX_FMT_RGB48LE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as little-endian
-{$IFEND}
-{$IF LIBAVUTIL_VERSION >= 50001000} // 50.01.0
+
PIX_FMT_RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
PIX_FMT_RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
PIX_FMT_RGB555BE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), big-endian, most significant bit to 0
@@ -267,72 +251,106 @@ type
PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers
PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers
PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
-{$IFEND}
+
+ PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
+ PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
+ PIX_FMT_YUV422P16LE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
+ PIX_FMT_YUV422P16BE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
+ PIX_FMT_YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
+ PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
+ PIX_FMT_VDPAU_MPEG4, ///< MPEG4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
+ PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer
+
+ PIX_FMT_RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), little-endian, most significant bits to 0
+ PIX_FMT_RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), big-endian, most significant bits to 0
+ PIX_FMT_BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), little-endian, most significant bits to 1
+ PIX_FMT_BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), big-endian, most significant bits to 1
+ PIX_FMT_GRAY8A, ///< 8bit gray, 8bit alpha
+ PIX_FMT_BGR48BE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big-endian
+ PIX_FMT_BGR48LE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as little-endian
+
+ //the following 10 formats have the disadvantage of needing 1 format for each bit depth, thus
+ //If you want to support multiple bit depths, then using PIX_FMT_YUV420P16* with the bpp stored seperately
+ //is better
+ PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
+ PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
+ PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
+ PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
+ PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
+ PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
+ PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
+ PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
+ PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
+ PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
+
PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
);
const
+ PIX_FMT_Y400A = PIX_FMT_GRAY8A;
+
{$ifdef WORDS_BIGENDIAN}
- {$IF LIBAVUTIL_VERSION <= 50001000} // 50.01.0
- PIX_FMT_RGBA = PIX_FMT_RGB32_1;
- PIX_FMT_BGRA = PIX_FMT_BGR32_1;
- PIX_FMT_ARGB = PIX_FMT_RGB32;
- PIX_FMT_ABGR = PIX_FMT_BGR32;
- {$ELSE} // 50.02.0
PIX_FMT_RGB32 = PIX_FMT_ARGB;
PIX_FMT_RGB32_1 = PIX_FMT_RGBA;
PIX_FMT_BGR32 = PIX_FMT_ABGR;
PIX_FMT_BGR32_1 = PIX_FMT_BGRA;
- {$IFEND}
- PIX_FMT_GRAY16 = PIX_FMT_GRAY16BE;
- {$IF LIBAVUTIL_VERSION >= 49015000} // 49.15.0
+
+ PIX_FMT_GRAY16 = PIX_FMT_GRAY16BE;
PIX_FMT_RGB48 = PIX_FMT_RGB48BE;
- {$IFEND}
- {$IF LIBAVUTIL_VERSION >= 50001000} // 50.01.0
PIX_FMT_RGB565 = PIX_FMT_RGB565BE;
PIX_FMT_RGB555 = PIX_FMT_RGB555BE;
+ PIX_FMT_RGB444 = PIX_FMT_RGB444BE;
+ PIX_FMT_BGR48 = PIX_FMT_BGR48BE;
PIX_FMT_BGR565 = PIX_FMT_BGR565BE;
- PIX_FMT_BGR555 = PIX_FMT_BGR555BE
- {$IFEND}
+ PIX_FMT_BGR555 = PIX_FMT_BGR555BE;
+ PIX_FMT_BGR444 = PIX_FMT_BGR444BE;
+
+ PIX_FMT_YUV420P9 = PIX_FMT_YUV420P9BE;
+ PIX_FMT_YUV444P9 = PIX_FMT_YUV444P9BE;
+ PIX_FMT_YUV420P10 = PIX_FMT_YUV420P10BE;
+ PIX_FMT_YUV422P10 = PIX_FMT_YUV422P10BE;
+ PIX_FMT_YUV444P10 = PIX_FMT_YUV444P10BE;
+ PIX_FMT_YUV420P16 = PIX_FMT_YUV420P16BE;
+ PIX_FMT_YUV422P16 = PIX_FMT_YUV422P16BE;
+ PIX_FMT_YUV444P16 = PIX_FMT_YUV444P16BE;
{$else}
- {$IF LIBAVUTIL_VERSION <= 50001000} // 50.01.0
- PIX_FMT_RGBA = PIX_FMT_BGR32;
- PIX_FMT_BGRA = PIX_FMT_RGB32;
- PIX_FMT_ARGB = PIX_FMT_BGR32_1;
- PIX_FMT_ABGR = PIX_FMT_RGB32_1;
- {$ELSE} // 50.02.0
PIX_FMT_RGB32 = PIX_FMT_BGRA;
PIX_FMT_RGB32_1 = PIX_FMT_ABGR;
PIX_FMT_BGR32 = PIX_FMT_RGBA;
PIX_FMT_BGR32_1 = PIX_FMT_ARGB;
- {$IFEND}
- PIX_FMT_GRAY16 = PIX_FMT_GRAY16LE;
- {$IF LIBAVUTIL_VERSION >= 49015000} // 49.15.0
+
+ PIX_FMT_GRAY16 = PIX_FMT_GRAY16LE;
PIX_FMT_RGB48 = PIX_FMT_RGB48LE;
- {$IFEND}
- {$IF LIBAVUTIL_VERSION >= 50001000} // 50.01.0
PIX_FMT_RGB565 = PIX_FMT_RGB565LE;
PIX_FMT_RGB555 = PIX_FMT_RGB555LE;
+ PIX_FMT_RGB444 = PIX_FMT_RGB444LE;
+ PIX_FMT_BGR48 = PIX_FMT_BGR48LE;
PIX_FMT_BGR565 = PIX_FMT_BGR565LE;
PIX_FMT_BGR555 = PIX_FMT_BGR555LE;
- {$IFEND}
+ PIX_FMT_BGR444 = PIX_FMT_BGR444LE;
+
+ PIX_FMT_YUV420P9 = PIX_FMT_YUV420P9LE;
+ PIX_FMT_YUV444P9 = PIX_FMT_YUV444P9LE;
+ PIX_FMT_YUV420P10 = PIX_FMT_YUV420P10LE;
+ PIX_FMT_YUV422P10 = PIX_FMT_YUV422P10LE;
+ PIX_FMT_YUV444P10 = PIX_FMT_YUV444P10LE;
+ PIX_FMT_YUV420P16 = PIX_FMT_YUV420P16LE;
+ PIX_FMT_YUV422P16 = PIX_FMT_YUV422P16LE;
+ PIX_FMT_YUV444P16 = PIX_FMT_YUV444P16LE;
{$ENDIF}
-{$IF LIBAVUTIL_VERSION_MAJOR < 50} // 50.0.0
- PIX_FMT_UYVY411 = PIX_FMT_UYYVYY411;
- PIX_FMT_RGBA32 = PIX_FMT_RGB32;
- PIX_FMT_YUV422 = PIX_FMT_YUYV422;
-{$IFEND}
-
(* libavutil/common.h *) // until now MKTAG and MKBETAG is all from common.h KMS 19/5/2010
-function MKTAG(a, b, c, d: AnsiChar): integer;
+function MKTAG (a, b, c, d: AnsiChar): integer;
function MKBETAG(a, b, c, d: AnsiChar): integer;
(* libavutil/mem.h *)
(* 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).
@@ -341,7 +359,7 @@ function MKBETAG(a, b, c, d: AnsiChar): integer;
* be allocated.
* @see av_mallocz()
*)
-function av_malloc(size: cuint): pointer;
+function av_malloc(size: FF_INTERNAL_MEM_TYPE): pointer;
cdecl; external av__util; {av_malloc_attrib av_alloc_size(1)}
(**
@@ -356,7 +374,7 @@ function av_malloc(size: cuint): pointer;
* cannot be allocated or the function is used to free the memory block.
* @see av_fast_realloc()
*)
-function av_realloc(ptr: pointer; size: cuint): pointer;
+function av_realloc(ptr: pointer; size: FF_INTERNAL_MEM_TYPE): pointer;
cdecl; external av__util; {av_alloc_size(2)}
(**
@@ -378,7 +396,7 @@ procedure av_free(ptr: pointer);
* @return Pointer to the allocated block, NULL if it cannot be allocated.
* @see av_malloc()
*)
-function av_mallocz(size: cuint): pointer;
+function av_mallocz(size: FF_INTERNAL_MEM_TYPE): pointer;
cdecl; external av__util; {av_malloc_attrib av_alloc_size(1)}
(**
@@ -391,7 +409,7 @@ function av_strdup({const} s: PAnsiChar): PAnsiChar;
cdecl; external av__util; {av_malloc_attrib}
(**
- * Freesa memory block which has been allocated with av_malloc(z)() or
+ * Free a memory block which has been allocated with av_malloc(z)() or
* av_realloc() and set the pointer pointing to it to NULL.
* @param ptr Pointer to the pointer to the memory block which should
* be freed.
@@ -400,18 +418,75 @@ function av_strdup({const} s: PAnsiChar): PAnsiChar;
procedure av_freep (ptr: pointer);
cdecl; external av__util;
+(**
+ * Add an element to a dynamic array.
+ *
+ * @param tab_ptr Pointer to the array.
+ * @param nb_ptr Pointer to the number of elements in the array.
+ * @param elem Element to be added.
+ *)
+procedure av_dynarray_add(tab_ptr: pointer; nb_ptr: PCint; elem: pointer);
+ cdecl; external av__util;
+
(* libavutil/log.h *)
+type
+(**
+ * Describe the class of an AVClass context structure. That is an
+ * arbitrary struct of which the first field is a pointer to an
+ * AVClass struct (e.g. AVCodecContext, AVFormatContext etc.).
+ *)
+ PAVClass = ^TAVClass;
+ TAVClass = record
+ (**
+ * The name of the class; usually it is the same name as the
+ * context structure type to which the AVClass is associated.
+ *)
+ class_name: PAnsiChar;
+
+ (**
+ * A pointer to a function which returns the name of a context
+ * instance ctx associated with the class.
+ *)
+ item_name: function(): PAnsiChar; cdecl;
+
+ (**
+ * a pointer to the first option specified in the class if any or NULL
+ *
+ * @see av_set_default_options()
+ *)
+ option: PAVOption;
+
+ (**
+ * LIBAVUTIL_VERSION with which this structure was created.
+ * This is used to allow fields to be added without requiring major
+ * version bumps everywhere.
+ *)
+ version: cint;
+
+ (**
+ * Offset in the structure where log_level_offset is stored.
+ * 0 means there is no such variable
+ *)
+ log_level_offset_offset: cint;
+
+ (**
+ * Offset in the structure where a pointer to the parent context for loging is stored.
+ * for example a decoder that uses eval.c could pass its AVCodecContext to eval as such
+ * parent context. And a av_log() implementation could then display the parent context
+ * can be NULL of course
+ *)
+ parent_log_context_offset: cint;
+
+ (**
+ * A function for extended searching, e.g. in possible
+ * children objects.
+ *)
+ opt_find: function(): PAVOption; cdecl;
+ end;
+
+
const
-{$IF LIBAVUTIL_VERSION_MAJOR < 50}
- AV_LOG_QUIET = -1;
- AV_LOG_FATAL = 0;
- AV_LOG_ERROR = 0;
- AV_LOG_WARNING = 1;
- AV_LOG_INFO = 1;
- AV_LOG_VERBOSE = 1;
- AV_LOG_DEBUG = 2;
-{$ELSE}
AV_LOG_QUIET = -8;
(**
@@ -445,7 +520,6 @@ const
* Stuff which is only useful for libav* developers.
*)
AV_LOG_DEBUG = 48;
-{$IFEND}
(**
* Send the specified message to the log if the level is less than or equal
@@ -468,10 +542,13 @@ void av_log(void*, int level, const char *fmt, ...) __attribute__ ((__format__ (
#else
void av_log(void*, int level, const char *fmt, ...);
#endif
-
-void av_vlog(void*, int level, const char *fmt, va_list);
**}
+type
+ va_list = pointer;
+
+procedure av_vlog(avcl: pointer; level: cint; fmt: {const} PAnsiChar; dummy: va_list);
+ cdecl; external av__util;
function av_log_get_level(): cint;
cdecl; external av__util;
procedure av_log_set_level(level: cint);
@@ -482,10 +559,33 @@ void av_log_set_callback(void (*)(void*, int, const char*, va_list));
void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl);
**}
-{$IF LIBAVUTIL_VERSION >= 50015003} // 50.15.3
-function av_default_item_name (ctx: pointer): Pchar;
+function av_default_item_name (ctx: pointer): PAnsiChar;
+ cdecl; external av__util;
+
+(**
+ * av_dlog macros
+ * Useful to print debug messages that shouldn't get compiled in normally.
+ *)
+(** to be translated if needed
+#ifdef DEBUG
+# define av_dlog(pctx, ...) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__)
+#else
+# define av_dlog(pctx, ...) do { if (0) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0)
+#endif
+**)
+
+(**
+ * Skip repeated messages, this requires the user app to use av_log() instead of
+ * (f)printf as the 2 would otherwise interfere and lead to
+ * "Last message repeated x times" messages below (f)printf messages with some
+ * bad luck.
+ * Also to receive the last, "last repeated" line if any, the user app must
+ * call av_log(NULL, AV_LOG_QUIET, "%s", ""); at the end
+ *)
+const
+ AV_LOG_SKIP_REPEATED = 1;
+procedure av_log_set_flags(arg: cint);
cdecl; external av__util;
-{$IFEND}
implementation
diff --git a/src/lib/ffmpeg/mathematics.pas b/src/lib/ffmpeg/mathematics.pas
index 98901c2a..20ee21c2 100644
--- a/src/lib/ffmpeg/mathematics.pas
+++ b/src/lib/ffmpeg/mathematics.pas
@@ -22,7 +22,7 @@
* - Changes and updates by the UltraStar Deluxe Team
*
* Conversion of libavutil/mathematics.h
- * avutil max. version 50.23.0, revision 24439, Wed Aug 25 05:00:00 2010 CET
+ * avutil version 50.43.0
*
*)
@@ -47,21 +47,13 @@ const
M_E = 2.7182818284590452354; // e
M_LN2 = 0.69314718055994530942; // log_e 2
M_LN10 = 2.30258509299404568402; // log_e 10
-{$IF LIBAVUTIL_VERSION >= 50009000} // >= 50.9.0
M_LOG2_10 = 3.32192809488736234787; // log_2 10
-{$IFEND}
-{$IF LIBAVUTIL_VERSION >= 50023000} // >= 50.23.0
M_PHI = 1.61803398874989484820; // phi / golden ratio
-{$IFEND}
M_PI = 3.14159265358979323846; // pi
M_SQRT1_2 = 0.70710678118654752440; // 1/sqrt(2)
-{$IF LIBAVUTIL_VERSION >= 50014000} // >= 50.14.0
M_SQRT2 = 1.41421356237309504880; // sqrt(2)
-{$IFEND}
-{$IF LIBAVUTIL_VERSION >= 50005001} // >= 50.5.1
NAN = 0.0/0.0;
INFINITY = 1.0/0.0;
-{$IFEND}
type
TAVRounding = (
@@ -72,7 +64,6 @@ type
AV_ROUND_NEAR_INF = 5 ///< Round to nearest and halfway cases away from zero.
);
-{$IF LIBAVUTIL_VERSION >= 49013000} // 49.13.0
(**
* Return the greatest common divisor of a and b.
* If both a or b are 0 or either or both are <0 then behavior is
@@ -80,7 +71,6 @@ type
*)
function av_gcd(a: cint64; b: cint64): cint64;
cdecl; external av__util; {av_const}
-{$IFEND}
(**
* Rescale a 64-bit integer with rounding to nearest.
@@ -102,7 +92,6 @@ function av_rescale_rnd (a, b, c: cint64; enum: TAVRounding): cint64;
function av_rescale_q (a: cint64; bq, cq: TAVRational): cint64;
cdecl; external av__util; {av_const}
-{$IF LIBAVUTIL_VERSION >= 50008000} // 50.8.0
(**
* Compare 2 timestamps each in its own timebases.
* The result of the function is undefined if one of the timestamps
@@ -111,9 +100,7 @@ function av_rescale_q (a: cint64; bq, cq: TAVRational): cint64;
*)
function av_compare_ts(ts_a: cint64; tb_a: TAVRational; ts_b: cint64; tb_b: TAVRational): cint;
cdecl; external av__util;
-{$IFEND}
-{$IF LIBAVUTIL_VERSION >= 50018000} // 50.18.0
(**
* Compare 2 integers modulo mod.
* That is we compare integers a and b for which only the least
@@ -126,7 +113,6 @@ 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;
-{$IFEND}
implementation
diff --git a/src/lib/ffmpeg/opt.pas b/src/lib/ffmpeg/opt.pas
index 8669eaf6..a779056e 100644
--- a/src/lib/ffmpeg/opt.pas
+++ b/src/lib/ffmpeg/opt.pas
@@ -22,8 +22,8 @@
* in the source codes.
* - Changes and updates by the UltraStar Deluxe Team
*
- * Conversion of libavcodec/opt.h
- * Max. avcodec version: 52.86.1, 24882, Wed Aug 23 07:00:00 2010 CET
+ * Conversion of libavutil/opt.h
+ * avutil version 50.43.0
*
*)
@@ -41,6 +41,7 @@ interface
uses
ctypes,
+ dict,
rational,
UConfig;
@@ -89,7 +90,14 @@ type
(**
* the default value for scalar options
*)
- default_val: cdouble;
+ default_val: record
+ case cint of
+ 0: (dbl: cdouble);
+ 1: (str: PAnsiChar);
+ (* TODO those are unused now *)
+ 2: (i64: cint64);
+ 3: (q: TAVRational);
+ end;
min: cdouble; ///< minimum valid value for the option
max: cdouble; ///< maximum valid value for the option
@@ -104,54 +112,7 @@ type
unit_: {const} PAnsiChar;
end;
-{$IF LIBAVCODEC_VERSION >= 52042000} // >= 52.42.0
-(**
- * AVOption2.
- * THIS IS NOT PART OF THE API/ABI YET!
- * This is identical to AVOption except that default_val was replaced by
- * an union, it should be compatible with AVOption on normal platforms.
- *)
-type
- PAVOption2 = ^TAVOption2;
- TAVOption2 = record
- name : {const} PAnsiChar;
-
- (**
- * short English help text
- * @todo What about other languages?
- *)
- help : {const} PAnsiChar;
-
- (**
- * The offset relative to the context structure where the option
- * value is stored. It should be 0 for named constants.
- *)
- offset : cint;
- type_ : TAVOptionType;
-
- (**
- * the default value for scalar options
- *)
- default_val : record
- case cint of
- 0 : (dbl: cdouble);
- 1 : (str: PAnsiChar);
- end;
- min : cdouble;
- max : cdouble;
- flags : cint;
-//FIXME think about enc-audio, ... style flags
-
- (**
- * The logical unit to which the option belongs. Non-constant
- * options and corresponding named constants share the same
- * unit. May be NULL.
- *)
- unit_: {const} PAnsiChar;
- end;
-{$IFEND}
-
-{$IF LIBAVCODEC_VERSION >= 51039000} // 51.39.0
+{$IFDEF FF_API_FIND_OPT}
(**
* Look for an option in obj. Look only for the options which
* have the flags set as specified in mask and flags (that is,
@@ -165,31 +126,9 @@ type
* has been found
*)
function av_find_opt(obj: Pointer; {const} name: {const} PAnsiChar; {const} unit_: PAnsiChar; mask: cint; flags: cint): {const} PAVOption;
- cdecl; external av__codec;
-{$IFEND}
-
-{$IF LIBAVCODEC_VERSION_MAJOR < 53}
-
-(**
- * @see av_set_string2()
- *)
-function av_set_string(obj: pointer; name: {const} PAnsiChar; val: {const} PAnsiChar): {const} PAVOption;
- cdecl; external av__codec; deprecated;
-
-{$IF LIBAVCODEC_VERSION >= 51059000} // 51.59.0
-(**
- * @return a pointer to the AVOption corresponding to the field set or
- * NULL if no matching AVOption exists, or if the value val is not
- * valid
- * @see av_set_string3()
- *)
-function av_set_string2(obj: Pointer; name: {const} PAnsiChar; val: {const} PAnsiChar; alloc: cint): {const} PAVOption;
- cdecl; external av__codec; deprecated;
-{$IFEND}
-
-{$IFEND}
+ cdecl; external av__util; deprecated;
+{$ENDIF}
-{$IF LIBAVCODEC_VERSION >= 52007000} // 52.7.0
(**
* Set the field of obj with the given name to value.
*
@@ -218,43 +157,124 @@ function av_set_string2(obj: Pointer; name: {const} PAnsiChar; val: {const} PAns
* AVERROR(EINVAL) if the value is not valid
*)
function av_set_string3(obj: Pointer; name: {const} PAnsiChar; val: {const} PAnsiChar; alloc: cint; out o_out: {const} PAVOption): cint;
- cdecl; external av__codec;
-{$IFEND}
+ cdecl; external av__util;
function av_set_double(obj: pointer; name: {const} PAnsiChar; n: cdouble): PAVOption;
- cdecl; external av__codec;
-
+ cdecl; external av__util;
function av_set_q(obj: pointer; name: {const} PAnsiChar; n: TAVRational): PAVOption;
- cdecl; external av__codec;
-
+ cdecl; external av__util;
function av_set_int(obj: pointer; name: {const} PAnsiChar; n: cint64): PAVOption;
- cdecl; external av__codec;
-
+ cdecl; external av__util;
function av_get_double(obj: pointer; name: {const} PAnsiChar; var o_out: {const} PAVOption): cdouble;
- cdecl; external av__codec;
-
+ cdecl; external av__util;
function av_get_q(obj: pointer; name: {const} PAnsiChar; var o_out: {const} PAVOption): TAVRational;
- cdecl; external av__codec;
-
+ cdecl; external av__util;
function av_get_int(obj: pointer; name: {const} PAnsiChar; var o_out: {const} PAVOption): cint64;
- cdecl; external av__codec;
-
+ cdecl; external av__util;
function av_get_string(obj: pointer; name: {const} PAnsiChar; var o_out: {const} PAVOption; buf: PAnsiChar; buf_len: cint): PAnsiChar;
- cdecl; external av__codec;
-
+ cdecl; external av__util;
function av_next_option(obj: pointer; last: {const} PAVOption): PAVOption;
- cdecl; external av__codec;
+ cdecl; external av__util;
-function av_opt_show(obj: pointer; av_log_obj: pointer): cint;
- cdecl; external av__codec;
+(**
+ * Show the obj options.
+ *
+ * @param req_flags requested flags for the options to show. Show only the
+ * options for which it is opt->flags & req_flags.
+ * @param rej_flags rejected flags for the options to show. Show only the
+ * options for which it is !(opt->flags & req_flags).
+ * @param av_log_obj log context to use for showing the options
+ *)
+function av_opt_show2(obj: pointer; av_log_obj: pointer; req_flags: cint; rej_flags: cint): cint;
+ cdecl; external av__util;
procedure av_opt_set_defaults(s: pointer);
- cdecl; external av__codec;
-
-{$IF LIBAVCODEC_VERSION >= 51039000} // 51.39.0
+ cdecl; external av__util;
procedure av_opt_set_defaults2(s: Pointer; mask: cint; flags: cint);
- cdecl; external av__codec;
-{$IFEND}
+ cdecl; external av__util;
+
+(**
+ * Parse the key/value pairs list in opts. For each key/value pair
+ * found, stores the value in the field in ctx that is named like the
+ * key. ctx must be an AVClass context, storing is done using
+ * AVOptions.
+ *
+ * @param opts options string to parse, may be NULL
+ * @param key_val_sep a 0-terminated list of characters used to
+ * separate key from value
+ * @param pairs_sep a 0-terminated list of characters used to separate
+ * two pairs from each other
+ * @return the number of successfully set key/value pairs, or a negative
+ * value corresponding to an AVERROR code in case of error:
+ * AVERROR(EINVAL) if opts cannot be parsed,
+ * the error code issued by av_set_string3() if a key/value pair
+ * cannot be set
+*)
+function av_set_options_string(ctx: pointer; opts: {const} PAnsiChar;
+ key_val_sep: {const} PAnsiChar; pairs_sep: {const} PAnsiChar): cint;
+ cdecl; external av__util;
+
+(**
+ * Free all string and binary options in obj.
+ *)
+procedure av_opt_free(obj: pointer);
+ cdecl; external av__util;
+
+(**
+ * Check whether a particular flag is set in a flags field.
+ *
+ * @param field_name the name of the flag field option
+ * @param flag_name the name of the flag to check
+ * @return non-zero if the flag is set, zero if the flag isn't set,
+ * isn't of the right type, or the flags field doesn't exist.
+ *)
+function av_opt_flag_is_set(obj: pointer; field_name: {const} PAnsiChar; flag_name: {const} PAnsiChar): cint;
+ cdecl; external av__util;
+
+(**
+ * Set all the options from a given dictionary on an object.
+ *
+ * @param obj a struct whose first element is a pointer to AVClass
+ * @param options options to process. This dictionary will be freed and replaced
+ * by a new one containing all options not found in obj.
+ * Of course this new dictionary needs to be freed by caller
+ * with av_dict_free().
+ *
+ * @return 0 on success, a negative AVERROR if some option was found in obj,
+ * but could not be set.
+ *
+ * @see av_dict_copy()
+ *)
+function av_opt_set_dict(obj: pointer; var options: PAVDictionary): cint;
+ cdecl; external av__util;
+
+const
+ AV_OPT_SEARCH_CHILDREN = 0001; (**< Search in possible children of the
+ given object first.*)
+
+(**
+ * Look for an option in an object. Consider only options which
+ * have all the specified flags set.
+ *
+ * @param[in] obj A pointer to a struct whose first element is a
+ * pointer to an AVClass.
+ * @param[in] name The name of the option to look for.
+ * @param[in] unit When searching for named constants, name of the unit
+ * it belongs to.
+ * @param opt_flags Find only options with all the specified flags set (AV_OPT_FLAG).
+ * @param search_flags A combination of AV_OPT_SEARCH_*.
+ *
+ * @return A pointer to the option found, or NULL if no option
+ * was found.
+ *
+ * @note Options found with AV_OPT_SEARCH_CHILDREN flag may not be settable
+ * directly with av_set_string3(). Use special calls which take an options
+ * AVDictionary (e.g. avformat_open_input()) to set options found with this
+ * flag.
+ *)
+function av_opt_find(obj: pointer; name: {const} PAnsiChar; unit_: {const} PAnsiChar;
+ opt_flags: cint; search_flags: cint): PAVOption;
+ cdecl; external av__util;
implementation
diff --git a/src/lib/ffmpeg/swscale.pas b/src/lib/ffmpeg/swscale.pas
index 7289e902..6fab095d 100644
--- a/src/lib/ffmpeg/swscale.pas
+++ b/src/lib/ffmpeg/swscale.pas
@@ -91,15 +91,12 @@ type
TPCuint8Array = array[0..0] of PCuint8;
PPCuint8Array = ^TPCuint8Array;
-{$IF LIBSWSCALE_VERSION >= 000006001} // 0.6.1
(**
* Returns the LIBSWSCALE_VERSION_INT constant.
*)
function swscale_version(): cuint;
cdecl; external sw__scale;
-{$IFEND}
-{$IF LIBSWSCALE_VERSION >= 000007002} // 0.7.2
(**
* Returns the libswscale build-time configuration.
*)
@@ -111,7 +108,6 @@ function swscale_configuration(): PAnsiChar;
*)
function swscale_license(): PAnsiChar;
cdecl; external sw__scale;
-{$IFEND}
const
(* values for the flags, the stuff on the command line is different *)
@@ -159,7 +155,6 @@ const
SWS_CS_SMPTE240M = 7;
SWS_CS_DEFAULT = 5;
-{$IF LIBSWSCALE_VERSION >= 000010000} // 0.10.0
(**
* Returns a pointer to yuv<->rgb coefficients for the given colorspace
* suitable for sws_setColorspaceDetails().
@@ -169,7 +164,6 @@ const
*)
function sws_getCoefficients(colorspace: cint): Pcint;
cdecl; external sw__scale;
-{$IFEND}
type
@@ -195,7 +189,6 @@ type
{internal structure}
end;
-{$IF LIBSWSCALE_VERSION >= 000008000} // 0.8.0
(**
* Returns a positive value if pix_fmt is a supported input format, 0
* otherwise.
@@ -209,7 +202,6 @@ function sws_isSupportedInput(pix_fmt: TAVPixelFormat): cint;
*)
function sws_isSupportedOutput(pix_fmt: TAVPixelFormat): cint;
cdecl; external sw__scale;
-{$IFEND}
(**
* Frees the swscaler context swsContext.
@@ -267,13 +259,11 @@ function sws_scale(context: PSwsContext; {const} srcSlice: PPCuint8Array; {const
srcSliceY: cint; srcSliceH: cint; {const} dst: PPCuint8Array; {const} dstStride: PCintArray): cint;
cdecl; external sw__scale;
-{$IF LIBSWSCALE_VERSION_MAJOR < 1}
// deprecated. Use sws_scale() instead.
function sws_scale_ordered(context: PSwsContext; {const} src: PPCuint8Array;
srcStride: PCintArray; srcSliceY: cint; srcSliceH: cint;
dst: PPCuint8Array; dstStride: PCintArray): cint;
cdecl; external sw__scale; deprecated;
-{$IFEND}
(**
* @param inv_table the yuv2rgb coefficients, normally ff_yuv2rgb_coeffs[x]
@@ -345,14 +335,10 @@ procedure sws_shiftVec(a: PSwsVector; shift: cint);
function sws_cloneVec(a: PSwsVector): PSwsVector;
cdecl; external sw__scale;
-{$IF LIBSWSCALE_VERSION_MAJOR < 1}
// deprecated Use sws_printVec2() instead.
-
procedure sws_printVec(a: PSwsVector);
cdecl; external sw__scale; deprecated;
-{$IFEND}
-{$IF LIBSWSCALE_VERSION >= 000007000} // >= 0.7.0
(**
* Prints with av_log() a textual representation of the vector a
* if log_level <= av_log_level.
@@ -361,7 +347,6 @@ procedure sws_printVec2(a: PSwsVector;
log_ctx: PAVClass; // PAVClass is declared in avcodec.pas
log_level: cint);
cdecl; external sw__scale;
-{$IFEND}
procedure sws_freeVec(a: PSwsVector);
cdecl; external sw__scale;
@@ -395,7 +380,6 @@ function sws_getCachedContext(context: PSwsContext;
dstFilter: PSwsFilter; param: PCdouble): PSwsContext;
cdecl; external sw__scale;
-{$IF LIBSWSCALE_VERSION >= 000011000} // >= 0.11.0
(**
* Converts an 8bit paletted frame into a frame with a color depth of 32-bits.
*
@@ -427,7 +411,6 @@ procedure sws_convertPalette8ToPacked24({const} src: PPCuint8Array;
num_pixels: clong;
{const} palette: PPCuint8Array);
cdecl; external sw__scale;
-{$IFEND}
implementation