diff options
Diffstat (limited to '')
-rw-r--r-- | src/lib/ffmpeg/How to update the ffmpeg files.txt | 12 | ||||
-rw-r--r-- | src/lib/ffmpeg/avcodec.pas | 112 | ||||
-rw-r--r-- | src/lib/ffmpeg/avformat.pas | 594 | ||||
-rw-r--r-- | src/lib/ffmpeg/avio.pas | 1099 | ||||
-rw-r--r-- | src/lib/ffmpeg/avutil.pas | 352 | ||||
-rw-r--r-- | src/lib/ffmpeg/error.pas | 43 | ||||
-rw-r--r-- | src/lib/ffmpeg/mathematics.pas | 16 | ||||
-rw-r--r-- | src/lib/ffmpeg/opt.pas | 218 | ||||
-rw-r--r-- | src/lib/ffmpeg/rational.pas | 11 | ||||
-rw-r--r-- | src/lib/ffmpeg/swscale.pas | 17 |
10 files changed, 1315 insertions, 1159 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 deleted file mode 100644 index 976d0eff..00000000 --- a/src/lib/ffmpeg/How to update the ffmpeg files.txt +++ /dev/null @@ -1,12 +0,0 @@ -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 5edc9a7b..0a436a48 100644 --- a/src/lib/ffmpeg/avcodec.pas +++ b/src/lib/ffmpeg/avcodec.pas @@ -106,9 +106,6 @@ 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; @@ -193,7 +190,9 @@ 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, @@ -258,36 +257,65 @@ 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, - CODEC_ID_ANM, +{$IFEND} + CODEC_ID_ANM, +{$IF LIBAVCODEC_VERSION >= 52049000} // >= 52.49.0 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, - CODEC_ID_R10K, - CODEC_ID_MXPEG, - CODEC_ID_LAGARITH, - CODEC_ID_PRORES, - CODEC_ID_JV, - CODEC_ID_DFA, - CODEC_ID_8SVX_RAW, +{$IFEND} //* various PCM "codecs" */ CODEC_ID_PCM_S16LE= $10000, @@ -314,9 +342,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, - CODEC_ID_PCM_LXF, - CODEC_ID_S302M, +{$IFEND} //* various ADPCM codecs */ CODEC_ID_ADPCM_IMA_QT= $11000, @@ -347,7 +375,6 @@ 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, @@ -367,6 +394,9 @@ 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, @@ -410,27 +440,39 @@ 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, - CODEC_ID_AAC_LATM, - CODEC_ID_QDMC, - CODEC_ID_CELT, +{$IFEND} //* subtitle codecs */ - CODEC_ID_DVD_SUBTITLE= 0x17000, + CODEC_ID_DVD_SUBTITLE= $17000, 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, - CODEC_ID_MICRODVD, +{$IFEND} (* other specific kind of codecs (generally used for attachments) *) CODEC_ID_TTF= $18000, @@ -439,28 +481,35 @@ type CODEC_ID_MPEG2TS= $20000, {*< _FAKE_ codec to indicate a raw MPEG-2 TS * stream (only used by libavformat) *} - CODEC_ID_FFMETADATA= $21000 ///< Dummy codec for streams containing only metadata information. + __CODEC_ID_4BYTE = $FFFFF // ensure 4-byte enum ); -type - TCodecType = TAVMediaType; - +{$IF LIBAVCODEC_VERSION < 52000000} // < 52.0.0 +{* CODEC_ID_MP3LAME is obsolete *} 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; + 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 ); +{$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, @@ -471,6 +520,7 @@ 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 00bed0d8..bd13c70e 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 version 0.7 libavformat/avformat.h - * Min. version: 52.110.0 - * Max. version: 52.111.0 + * 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 *) unit avformat; @@ -55,22 +55,41 @@ uses const (* - * 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. + * 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 *) LIBAVFORMAT_MAX_VERSION_MAJOR = 52; - LIBAVFORMAT_MAX_VERSION_MINOR = 110; - LIBAVFORMAT_MAX_VERSION_RELEASE = 0; + LIBAVFORMAT_MAX_VERSION_MINOR = 78; + LIBAVFORMAT_MAX_VERSION_RELEASE = 3; 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 = 52; - LIBAVFORMAT_MIN_VERSION_MINOR = 111; + LIBAVFORMAT_MIN_VERSION_MAJOR = 50; + LIBAVFORMAT_MIN_VERSION_MINOR = 5; LIBAVFORMAT_MIN_VERSION_RELEASE = 0; LIBAVFORMAT_MIN_VERSION = (LIBAVFORMAT_MIN_VERSION_MAJOR * VERSION_MAJOR) + (LIBAVFORMAT_MIN_VERSION_MINOR * VERSION_MINOR) + @@ -86,50 +105,32 @@ const {$MESSAGE Error 'Linked version of libavformat is not yet supported!'} {$IFEND} -const -{ - LIBAVFORMAT_BUILD = LIBAVFORMAT_VERSION_INT; - LIBAVFORMAT_IDENT = 'Lavf' AV_STRINGIFY(LIBAVFORMAT_VERSION); -} +{$IF LIBAVFORMAT_VERSION >= 52078003} // >= 52.78.3 (** * Those FF_API_* defines are not part of public API. * They may change, break or disappear at any time. *) const - 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. + {$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? *) function avformat_version(): cuint; cdecl; external av__format; +{$IFEND} +{$IF LIBAVFORMAT_VERSION >= 52039002} // 52.39.2 (** * Return the libavformat build-time configuration. *) @@ -141,6 +142,7 @@ function avformat_configuration(): {const} PansiChar; *) function avformat_license(): {const} PansiChar; cdecl; external av__format; +{$IFEND} type PAVFile = Pointer; @@ -160,75 +162,23 @@ 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. 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. - * @ + * 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. *) - 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; -} - 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; +{$IFEND} -{ -typedef struct AVMetadataConv AVMetadataConv; -} type PAVMetadataTag = ^TAVMetadataTag; TAVMetadataTag = record @@ -237,9 +187,8 @@ type end; PAVMetadata = Pointer; - PAVDictionary = PAVMetadata; - PAVDictionaryEntry = PAVMetadata; +{$IF LIBAVFORMAT_VERSION > 52024001} // > 52.24.1 (** * Get a metadata element with matching key. * @@ -248,11 +197,28 @@ 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: PAVDictionary; key: {const} PAnsiChar; - prev: {const} PAVDictionaryEntry; flags: cint): PAVDictionaryEntry; +function av_metadata_get(m: PAVMetadata; key: {const} PAnsiChar; + prev: {const} PAVMetadataTag ; flags: cint): PAVMetadataTag; cdecl; external av__format; -{$IFDEF FF_API_OLD_METADATA} +{$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} (** * Set the given tag in *pm, overwriting an existing tag. * @@ -265,8 +231,10 @@ function av_metadata_get(m: PAVDictionary; key: {const} PAnsiChar; *) function av_metadata_set(var pm: PAVMetadata; key: {const} PAnsiChar; value: {const} PAnsiChar): cint; cdecl; external av__format; deprecated; -{$ENDIF} + {$ENDIF} +{$IFEND} +{$IF LIBAVFORMAT_VERSION >= 52043000} // >= 52.43.0 (** * Set the given tag in *pm, overwriting an existing tag. * @@ -277,37 +245,20 @@ 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: PAVDictionary; key: {const} PAnsiChar; value: {const} PAnsiChar; flags: cint): cint; - cdecl; external av__format; deprecated; - -(** - * This function is provided for compatibility reason and currently does nothing. - *) -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; +function av_metadata_set2(var pm: PAVMetadata; key: {const} PAnsiChar; value: {const} PAnsiChar; flags: cint): cint; + cdecl; external av__format; +{$IFEND} (** - * Free all the memory allocated for an AVDictionary struct. + * Free all the memory allocated for an AVMetadata struct. *) -procedure av_metadata_free(var m: PAVDictionary); - cdecl; external av__format; deprecated; - -{$ENDIF} +procedure av_metadata_free(var m: PAVMetadata); + cdecl; external av__format; +{$IFEND} (* packet functions *) +{$IF LIBAVFORMAT_VERSION < 52032000} // < 52.32.0 type PAVPacket = ^TAVPacket; TAVPacket = record @@ -340,6 +291,7 @@ 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 @@ -356,6 +308,7 @@ type * subtitles are correctly displayed after seeking. *) convergence_duration: cint64; + {$IFEND} end; const @@ -376,7 +329,9 @@ 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 @@ -388,6 +343,7 @@ 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 @@ -400,6 +356,22 @@ 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 *) @@ -440,8 +412,12 @@ 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; @@ -449,7 +425,19 @@ 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; @@ -457,10 +445,16 @@ 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; @@ -476,18 +470,33 @@ 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; @@ -510,6 +519,12 @@ 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. @@ -523,16 +538,23 @@ 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 -{$IFDEF FF_API_OLD_METADATA} + {$IF LIBAVFORMAT_VERSION < 52078003} // < 52.78.3 title: PAnsiChar; ///< chapter title -{$ENDIF} + {$ELSE} + {$IFDEF FF_API_OLD_METADATA} + title: PAnsiChar; ///< chapter title + {$ENDIF} + {$IFEND} + {$IF LIBAVFORMAT_VERSION >= 52024001} // 52.24.1 metadata: PAVMetadata; + {$IFEND} end; TAVChapterArray = array[0..(MaxInt div SizeOf(TAVChapter))-1] of TAVChapter; PAVChapterArray = ^TAVChapterArray; @@ -544,7 +566,13 @@ 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. *) @@ -556,8 +584,10 @@ 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 @@ -591,15 +621,21 @@ 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; @@ -655,6 +691,7 @@ 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. @@ -665,6 +702,7 @@ 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. @@ -702,8 +740,11 @@ 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 @@ -716,8 +757,11 @@ 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; @@ -727,8 +771,10 @@ 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 *) - AVSTREAM_PARSE_FULL_ONCE (**< full parsing and repack of the first frame only, only implemented for H.264 currently *) + 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} ); TAVIndexEntry = record @@ -766,6 +812,9 @@ 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 @@ -805,9 +854,13 @@ type *) duration: cint64; -{$IFDEF FF_API_OLD_METADATA} + {$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) *) -{$ENDIF} + {$ELSE} + {$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} (* av_read_frame() support *) need_parsing: TAVStreamParseType; @@ -824,13 +877,27 @@ 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; -{$IFDEF FF_API_OLD_METADATA} + {$IFEND} + + {$IF (LIBAVFORMAT_VERSION >= 52006000) and (LIBAVFORMAT_VERSION < 52078003)} // 52.6.0 - 52.78.2 filename: PAnsiChar; (**< source filename of the stream *) -{$ENDIF} + {$ELSE} + {$IFDEF FF_API_OLD_METADATA} + filename: PAnsiChar; (**< source filename of the stream *) + {$ENDIF} + {$IFEND} + {$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; (** @@ -839,15 +906,21 @@ 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. @@ -857,28 +930,33 @@ 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; (** @@ -895,14 +973,18 @@ 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; -{$IFDEF FF_API_OLD_METADATA} + {$IF LIBAVFORMAT_VERSION < 52078003} // < 52.78.3 title: array [0..511] of AnsiChar; author: array [0..511] of AnsiChar; copyright: array [0..511] of AnsiChar; @@ -911,7 +993,18 @@ type year: cint; (**< ID3 year, 0 if none *) track: cint; (**< track number, 0 if none *) genre: array [0..31] of AnsiChar; (**< ID3 genre *) -{$ENDIF} + {$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} ctx_flags: cint; (**< Format-specific flags, see AVFMTCTX_xx *) (* private data for pts handling (do not modify directly). *) @@ -948,16 +1041,22 @@ 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; - packet_size: cuint; ***** + {$IF LIBAVFORMAT_VERSION < 52034001} // < 52.34.1 + packet_size: cint; + {$ELSE} + packet_size: cuint; + {$IFEND} preload: cint; max_delay: cint; @@ -969,11 +1068,14 @@ 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(). @@ -982,10 +1084,14 @@ 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. @@ -1003,7 +1109,9 @@ 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 @@ -1015,20 +1123,29 @@ 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 @@ -1039,15 +1156,21 @@ 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 @@ -1056,7 +1179,8 @@ type * - decoding: Unused. *) start_time_realtime: cint64; - + {$IFEND} + end; (** @@ -1067,15 +1191,24 @@ type *) TAVProgram = record id : cint; -{$IFDEF FF_API_OLD_METADATA} + {$IF LIBAVFORMAT_VERSION < 52078003} // < 52.78.3 provider_name : PAnsiChar; ///< network name for DVB streams name : PAnsiChar; ///< service name for DVB streams -{$ENDIF} + {$ELSE} + {$IFDEF FF_API_OLD_METADATA} + provider_name : PAnsiChar; ///< network name for DVB streams + name : PAnsiChar; ///< service name for DVB streams + {$ENDIF} + {$IFEND} 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; - metadata : PAVMetadata; + {$IFEND} + {$IF LIBAVFORMAT_VERSION >= 52024001} // 52.24.1 + metadata: PAVMetadata; + {$IFEND} end; TAVPacketList = record @@ -1083,6 +1216,55 @@ 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 @@ -1094,13 +1276,17 @@ type 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 @@ -1115,6 +1301,7 @@ 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; @@ -1129,10 +1316,12 @@ 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 @@ -1152,12 +1341,14 @@ function guess_stream_format(short_name: PAnsiChar; function guess_format(short_name: PAnsiChar; filename: PAnsiChar; mime_type: PAnsiChar): PAVOutputFormat; - cdecl; external av__format; deprecated; - + cdecl; external av__format; +{$IF LIBAVFORMAT_VERSION >= 52045000} // >= 52.45.0 + 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. @@ -1179,6 +1370,7 @@ 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. * @@ -1193,6 +1385,7 @@ 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. @@ -1204,6 +1397,7 @@ 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. * @@ -1216,6 +1410,7 @@ 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 @@ -1229,6 +1424,7 @@ 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. @@ -1248,6 +1444,7 @@ 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 *) @@ -1266,6 +1463,7 @@ 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. * @@ -1279,6 +1477,7 @@ 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. @@ -1306,6 +1505,7 @@ 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 @@ -1313,12 +1513,15 @@ 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 @@ -1386,6 +1589,7 @@ 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 @@ -1419,6 +1623,7 @@ 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 @@ -1435,12 +1640,14 @@ 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). @@ -1462,10 +1669,12 @@ 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 @@ -1482,6 +1691,7 @@ 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. @@ -1493,14 +1703,20 @@ 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; - pts_num: cuint; pts_den: cuint); ******* +{$IF LIBAVFORMAT_VERSION < 52036000} // < 52.36.0 + pts_num: cint; pts_den: cint); +{$ELSE} + pts_num: cuint; pts_den: cuint); +{$IFEND} 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; @@ -1516,6 +1732,7 @@ 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 @@ -1525,6 +1742,7 @@ 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 @@ -1548,6 +1766,7 @@ 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. * @@ -1560,6 +1779,7 @@ 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; @@ -1578,6 +1798,7 @@ 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 @@ -1585,6 +1806,7 @@ 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. * @@ -1611,6 +1833,7 @@ 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 @@ -1674,6 +1897,7 @@ 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. @@ -1689,6 +1913,7 @@ 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 @@ -1714,6 +1939,7 @@ 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. @@ -1721,6 +1947,7 @@ 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. @@ -1765,7 +1992,11 @@ 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); @@ -1794,7 +2025,10 @@ 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; + cdecl; external av__format + {$IF LIBAVFORMAT_VERSION <= 50006000} // 50.6.0 + name 'get_frame_filename' + {$IFEND}; (** * Check whether filename actually is a numbered sequence generator. @@ -1803,8 +2037,12 @@ 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; + cdecl; external av__format + {$IF LIBAVFORMAT_VERSION <= 50006000} // 50.6.0 + name 'filename_number_test' + {$IFEND}; +{$IF LIBAVFORMAT_VERSION >= 51012002} // 51.12.2 (** * Generate an SDP for an RTP session. * @@ -1821,7 +2059,9 @@ 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. @@ -1830,7 +2070,31 @@ 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 a942e28f..adb59a44 100644 --- a/src/lib/ffmpeg/avio.pas +++ b/src/lib/ffmpeg/avio.pas @@ -1,8 +1,7 @@ (* + * 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 @@ -29,7 +28,7 @@ * header, so it should not be directly included in your projects. * * update to - * Max. avformat version: 52.111.0 + * Max. avformat version: 52.78.3, revision 24841, Thu Aug 26 02:00:00 2010 CET *) unit avio; @@ -48,720 +47,678 @@ interface uses ctypes, - {$IFDEF UNIX} - BaseUnix, // for SEEK_CUR - {$ENDIF} avutil, avcodec, SysUtils, UConfig; +(* unbuffered I/O *) + const - 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 *) + 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} type - TReadWriteFunc = function(opaque: Pointer; buf: PByteArray; buf_size: cint): cint; cdecl; - TSeekFunc = function(opaque: Pointer; offset: cint64; whence: cint): cint64; cdecl; + TURLInterruptCB = function (): cint; cdecl; type - PURLContext = ^TURLContext; PURLProtocol = ^TURLProtocol; -(** - * 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 - *) + (** + * 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; TURLContext = record -{$IFDEF FF_API_URL_CLASS} + {$IF LIBAVFORMAT_VERSION < 52078003} // < 52.78.3 av_class: {const} PAVClass; ///< information for av_log(). Set by url_open(). -{$ENDIF} + {$ELSE} + {$IFDEF FF_API_URL_CLASS} + av_class: {const} PAVClass; ///< information for av_log(). Set by url_open(). + {$ENDIF} + {$IFEND} 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 *) - is_connected: cint; +{$IF LIBAVFORMAT_VERSION >= 52070000} // 52.70.0 + is_connected: cint; +{$IFEND} end; PPURLContext = ^PURLContext; -(** - * @deprecated This struct is to be made private. Use the higher-level - * AVIOContext-based API instead. - *) + PURLPollEntry = ^TURLPollEntry; + TURLPollEntry = record + handle: PURLContext; + events: cint; + revents: cint; + end; + 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; - flags: cint; - url_check: function (h: PURLContext; mask: cint): cint; + {$IFEND} end; - PURLPollEntry = ^TURLPollEntry; - TURLPollEntry = record - handle: PURLContext; - events: cint; - revents: cint; + (** + * 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} end; -{$IFDEF FF_API_OLD_AVIO} - -(* not implemented *) -function url_poll(poll_table: PURLPollEntry; n: cint; timeout: cint): cint; - cdecl; external av__format; deprecated; - -const +{$IF LIBAVFORMAT_VERSION >= 52070000} // 52.70.0 (** - * @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 *) -(** - * @ + * 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 *) +function url_alloc(h: PPURLContext; {const} url: PAnsiChar; flags: cint): cint; + cdecl; external av__format; (** - * 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; + * Connect an URLContext that has been allocated by url_alloc + *) +function url_connect(h: PURLContext): cint; + cdecl; external av__format; +{$IFEND} +{$IF LIBAVFORMAT_VERSION >= 52021000} // 52.21.0 (** - * @defgroup old_url_funcs Old url_* functions - * The following functions are deprecated. Use the buffered API based on #AVIOContext instead. - * @ + * 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 *) 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; - 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; +{$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} function url_open(h: PPointer; url: {const} PAnsiChar; flags: cint): cint; - cdecl; external av__format; deprecated; +{$IFEND} + cdecl; external av__format; function url_read (h: PURLContext; buf: PByteArray; size: cint): cint; - cdecl; external av__format; deprecated; + cdecl; external av__format; +{$IF LIBAVFORMAT_VERSION >= 52034000} // 52.34.0 function url_read_complete (h: PURLContext; buf: PByteArray; size: cint): cint; cdecl; - cdecl; external av__format; deprecated; + cdecl; external av__format; +{$IFEND} function url_write (h: PURLContext; {const} buf: PByteArray; size: cint): cint; - cdecl; external av__format; deprecated; + cdecl; external av__format; function url_seek (h: PURLContext; pos: cint64; whence: cint): cint64; - 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; - -(** - * returns the next registered protocol after the given protocol (the first if - * NULL is given), or NULL if protocol is the last one. - *) -function av_protocol_next(p: PURLProtocol): PURLProtocol; cdecl; external av__format; (** - * Register the URLProtocol protocol. + * Close the resource accessed by the URLContext h, and free the + * memory used by it. * - * @param size the size of the URLProtocol struct referenced - *) -function av_register_protocol2(protocol: PURLProtocol; size: cint): cint; - cdecl; external av__format; deprecated; -(** - * @ + * @return a negative value if an error condition occurred, 0 + * otherwise *) +function url_close (h: PURLContext): cint; + 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; - -(** - * @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; (** - * @ + * Return a non-zero value if the resource indicated by url + * exists, 0 otherwise. *) +{$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 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; +function url_filesize (h: PURLContext): cint64; + cdecl; external av__format; (** - * @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; -(** - * @ + * 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. *) +(* not implemented *) +function url_get_file_handle(h: PURLContext): 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; -(** - * @deprecated use avio_get_str instead - *) -function get_strz(s: PAVIOContext; buf: PAnsiChar; maxlen: cint): PAnsiChar; - cdecl; external av__format; deprecated; (** - * @deprecated Use AVIOContext.seekable field directly. + * 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 *) -function url_is_streamed(s: PAVIOContext): cint; {$IFDEF HasInline}inline;{$ENDIF} deprecated; - -function url_fileno(s: PAVIOContext): PURLContext; - 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; (** - * @deprecated use AVIOContext.max_packet_size directly. + * 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. *) -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; +procedure url_set_interrupt_cb (interrupt_cb: TURLInterruptCB); + cdecl; external av__format; -(** return the written or read size *) -function url_close_buf(s: PAVIOContext): cint; - cdecl; external av__format; deprecated; +(* not implemented *) +function url_poll(poll_table: PURLPollEntry; n: cint; timeout: cint): cint; + cdecl; external av__format; +{$IF LIBAVFORMAT_VERSION >= 52004000} // 52.4.0 (** - * Return a non-zero value if the resource indicated by url - * exists, 0 otherwise. - * @deprecated Use avio_check instead. + * Pause and resume playing - only meaningful if using a network streaming + * protocol (e.g. MMS). + * @param pause 1 for pause, 0 for resume *) -function url_exist(url: {const} PAnsiChar): cint; - cdecl; external av__format; deprecated; +function av_url_read_pause(h: PURLContext; pause: cint): cint; + cdecl; external av__format; {$IFEND} +{$IF LIBAVFORMAT_VERSION >= 52001000} // 52.1.0 (** - * 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. + * 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_check(url: {const} PAnsiChar; flags: cint): cint; +function av_url_read_seek(h: PURLContext; stream_index: cint; + timestamp: cint64; flags: cint): cint64; cdecl; external av__format; +{$IFEND} (** - * 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. - *) -procedure avio_set_interrupt_cb(interrupt_cb: Pointer); - cdecl; external av__format; - -{$IFDEF FF_API_REGISTER_PROTOCOL} 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; +**) -{$IFDEF FF_API_REGISTER_PROTOCOL} +{$IF LIBAVFORMAT_VERSION >= 52002000} // 52.2.0 (** - * @deprecated Use av_register_protocol() instead. + * 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. *) -function register_protocol(protocol: PURLProtocol): cint; - cdecl; external av__format; deprecated; +function av_protocol_next(p: PURLProtocol): PURLProtocol; + cdecl; external av__format; +{$IFEND} +{$IF LIBAVFORMAT_VERSION <= 52028000} // 52.28.0 (** + * Register the URLProtocol protocol. + * + * + * @deprecated Use av_register_protocol() instead. + *) +function register_protocol(protocol: PURLProtocol): cint; + cdecl; external av__format; +(** Alias for register_protocol() + * * @deprecated Use av_register_protocol2() instead. *) function av_register_protocol(protocol: PURLProtocol): cint; - cdecl; external av__format; deprecated; -{$ENDIF} + 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} -(** - * 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; +type + TReadWriteFunc = function(opaque: Pointer; buf: PByteArray; buf_size: cint): cint; cdecl; + TSeekFunc = function(opaque: Pointer; offset: cint64; whence: cint): cint64; cdecl; + +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; buffer_size: cint; write_flag: cint; opaque: Pointer; read_packet: TReadWriteFunc; write_packet: TReadWriteFunc; - seek: TSeekFunc): PAVIOContext; + seek: TSeekFunc): PByteIOContext; cdecl; external av__format; - -procedure avio_w8(s: PAVIOContext; b: cint); +{$IFEND} + +procedure put_byte(s: PByteIOContext; b: cint); cdecl; external av__format; -procedure avio_write(s: PAVIOContext; buf: {const} PAnsiChar; size: cint); +procedure put_buffer (s: PByteIOContext; buf: {const} PByteArray; size: cint); cdecl; external av__format; -procedure avio_wl64(s: PAVIOContext; val: cuint64); +procedure put_le64(s: PByteIOContext; val: cuint64); cdecl; external av__format; -procedure avio_wb64(s: PAVIOContext; val: cuint64); +procedure put_be64(s: PByteIOContext; val: cuint64); cdecl; external av__format; -procedure avio_wl32(s: PAVIOContext; val: cuint); +procedure put_le32(s: PByteIOContext; val: cuint); cdecl; external av__format; -procedure avio_wb32(s: PAVIOContext; val: cuint); +procedure put_be32(s: PByteIOContext; val: cuint); cdecl; external av__format; -procedure avio_wl24(s: PAVIOContext; val: cuint); +procedure put_le24(s: PByteIOContext; val: cuint); cdecl; external av__format; -procedure avio_wb24(s: PAVIOContext; val: cuint); +procedure put_be24(s: PByteIOContext; val: cuint); cdecl; external av__format; -procedure avio_wl16(s: PAVIOContext; val: cuint); +procedure put_le16(s: PByteIOContext; val: cuint); cdecl; external av__format; -procedure avio_wb16(s: PAVIOContext; val: cuint); +procedure put_be16(s: PByteIOContext; val: cuint); cdecl; external av__format; - -(** - * Write a NULL-terminated string. - * @return number of bytes written. - *) -function avio_put_str(s: PAVIOContext; str: {const} PAnsiChar): cint; +procedure put_tag(s: PByteIOContext; tag: {const} PAnsiChar); cdecl; external av__format; -(** - * 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; +procedure put_strz(s: PByteIOContext; buf: {const} PAnsiChar); 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 AVIOContext. + * fseek() equivalent for ByteIOContext. * @return new position or AVERROR. *) -function avio_seek(s: PAVIOContext; offset: cint64; whence: cint): cint64; +function url_fseek(s: PByteIOContext; offset: cint64; whence: cint): cint64; cdecl; external av__format; (** - * Skip given number of bytes forward - * @return new position or AVERROR. + * Skip given number of bytes forward. + * @param offset number of bytes + * @return 0 on success, <0 on error *) -function avio_skip(s: PAVIOContext; offset: cint64): cint64; +{$IF LIBAVFORMAT_VERSION < 52074000} // 52.74.0 +procedure url_fskip(s: PByteIOContext; offset: cint64); cdecl; external av__format; +{$ELSE} +function url_fskip(s: PByteIOContext; offset: cint64): cint; + cdecl; external av__format; +{$IFEND} (** - * ftell() equivalent for AVIOContext. + * ftell() equivalent for ByteIOContext. * @return position or AVERROR. *) -function avio_tell(s: PAVIOContext): cint64; {$IFDEF HasInline}inline;{$ENDIF} +function url_ftell(s: PByteIOContext): cint64; + cdecl; external av__format; (** * Get the filesize. * @return filesize or AVERROR *) -function avio_size(s: PAVIOContext): cint64; +function url_fsize(s: PByteIOContext): cint64; cdecl; external av__format; (** - * feof() equivalent for AVIOContext. + * feof() equivalent for ByteIOContext. * @return non zero if and only if end of file *) -function url_feof(s: PAVIOContext): cint; +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; + cdecl; external av__format; + (** @warning currently size is limited *) -function avio_printf(s: PAVIOContext; fmt: {const} PAnsiChar; args: array of const): cint; +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; cdecl; external av__format; -procedure avio_flush(s: PAVIOContext); +procedure put_flush_packet (s: PByteIOContext); cdecl; external av__format; (** - * Read size bytes from AVIOContext into buf. + * Read size bytes from ByteIOContext into buf. * @return number of bytes read or AVERROR *) -function avio_read(s: PAVIOContext; buf: Pbyte; size: cint): cint; +function get_buffer(s: PByteIOContext; buf: PByteArray; size: cint): cint; cdecl; external av__format; (** - * @name Functions for reading from AVIOContext - * @ - * - * @note return 0 if EOF, so you cannot use it if EOF handling is - * necessary + * 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 *) -function avio_r8(s: PAVIOContext): cint; +function get_partial_buffer(s: PByteIOContext; buf: PByteArray; size: cint): cint; cdecl; external av__format; -function avio_rl16(s: PAVIOContext): cuint; +(** @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 avio_rl24(s: PAVIOContext): cuint; +function get_le24(s: PByteIOContext): cuint; cdecl; external av__format; - -function avio_rl32(s: PAVIOContext): cuint; +function get_le32(s: PByteIOContext): cuint; cdecl; external av__format; - -function avio_rl64(s: PAVIOContext): cuint64; +function get_le64(s: PByteIOContext): cuint64; cdecl; external av__format; - -function avio_rb16(s: PAVIOContext): cuint; +function get_le16(s: PByteIOContext): cuint; cdecl; external av__format; -function avio_rb24(s: PAVIOContext): cuint; +function get_strz(s: PByteIOContext; buf: PAnsiChar; maxlen: cint): PAnsiChar; cdecl; external av__format; - -function avio_rb32(s: PAVIOContext): cuint; +function get_be16(s: PByteIOContext): cuint; cdecl; external av__format; - -function avio_rb64(s: PAVIOContext): cuint64; +function get_be24(s: PByteIOContext): cuint; + cdecl; external av__format; +function get_be32(s: PByteIOContext): cuint; + cdecl; external av__format; +function get_be64(s: PByteIOContext): cuint64; cdecl; external av__format; -(** - * @ - *) -(** - * 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. - * - * @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. - *) -function avio_get_str(pb: PAVIOContext; maxlen: cint; buf: PAnsiChar; buflen: cint): cint; +{$IF LIBAVFORMAT_VERSION >= 51017001} // 51.17.1 + {$IF LIBAVFORMAT_VERSION < 52078003} // < 52.78.3 +function ff_get_v(bc: PByteIOContext): cuint64; + cdecl; external av__format; + {$ELSE} + {$IFDEF FF_API_URL_RESETBUF} +function ff_get_v(bc: PByteIOContext): cuint64; cdecl; external av__format; + {$ENDIF} + {$IFEND} +{$IFEND} + +function url_is_streamed(s: PByteIOContext): cint; {$IFDEF HasInline}inline;{$ENDIF} (** - * 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) + * 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. + * + * @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 *) -function avio_get_str16le(pb: PAVIOContext; maxlen: cint; buf: PAnsiChar; buflen: cint): cint; +{$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} cdecl; external av__format; -function avio_get_str16be(pb: PAVIOContext; maxlen: cint; buf: PAnsiChar; buflen: cint): cint; +(** @warning must be called before any I/O *) +function url_setbufsize (s: PByteIOContext; buf_size: cint): cint; cdecl; external av__format; -{$IFDEF FF_API_URL_RESETBUF} +{$IF LIBAVFORMAT_VERSION_MAJOR < 53} +{$IF LIBAVFORMAT_VERSION >= 51015000} // 51.15.0 (** 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: PAVIOContext; flags: cint): cint; +function url_resetbuf(s: PByteIOContext; flags: cint): cint; cdecl; external av__format; -{$ENDIF} - -(** - * @name URL open modes - * The flags argument to avio_open must be one of the following - * constants, optionally ORed with other flags. - * @ - *) - -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} -(** - * @ - *) +{$IFEND} +{$IFEND} +{$IF LIBAVFORMAT_VERSION >= 52061000} // 52.61.0 (** - * 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. + * 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 *) -const -{$IF LIBAVFORMAT_VERSION_MAJOR < 53} - AVIO_FLAG_NONBLOCK = 4; -{$ELSE} - AVIO_FLAG_NONBLOCK = 8; -{$ENDIF} +function ff_rewind_with_probe_data(s: PByteIOContext; buf: PAnsiChar; buf_size: cint): cint; + cdecl; external av__format; +{$IFEND} (** - * Create and initialize a AVIOContext for accessing the + * Create and initialize a ByteIOContext for accessing the * resource indicated by url. * @note When the resource indicated by url has been opened in - * read+write mode, the AVIOContext can be used only for writing. + * read+write mode, the ByteIOContext can be used only for writing. * - * @param s Used to return the pointer to the created AVIOContext. + * @param s Used to return the pointer to the created ByteIOContext. * 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 *) -function avio_open(var s: PAVIOContext; url: {const} PAnsiChar; flags: cint): cint; +{$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; cdecl; external av__format; (** - * Close the resource accessed by the AVIOContext s and free it. - * This function can only be used if s was opened by avio_open(). + * 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. * - * @return 0 on success, an AVERROR < 0 on error. + * @param s buffered file handle + * @return maximum packet size in bytes *) -function avio_close(s: PAVIOContext): cint; +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; cdecl; external av__format; (** @@ -770,82 +727,70 @@ function avio_close(s: PAVIOContext): cint; * @param s new IO context * @return zero if no error. *) -function avio_open_dyn_buf(var s: PAVIOContext): cint; +{$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; (** - * Return the written size and a pointer to the buffer. The buffer - * must be freed with av_free(). - * Padding of FF_INPUT_BUFFER_PADDING_SIZE is added to the buffer. + * 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} + 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. * @param s IO context * @param pbuffer pointer to a byte buffer * @return the length of the byte buffer *) -function avio_close_dyn_buf(s: PAVIOContext; var pbuffer: Pcuint8): cint; +function url_close_dyn_buf(s: PByteIOContext; pbuffer:PPointer): cint; cdecl; external av__format; -{$IFDEF FF_API_UDP_GET_FILE} -function udp_get_file_handle(h: PURLContext): cint; +{$IF LIBAVFORMAT_VERSION >= 51017001} // 51.17.1 +function ff_crc04C11DB7_update(checksum: culong; buf: {const} PByteArray; + len: cuint): culong; cdecl; external av__format; -{$ENDIF} +{$IFEND} -(** - * 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; +function get_checksum(s: PByteIOContext): culong; cdecl; external av__format; - -(** - * 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; +procedure init_gsum(s: PByteIOContext; + update_checksum: pointer; + checksum: culong); cdecl; external av__format; -(** - * 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; +(* 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; cdecl; external av__format; +{$IF LIBAVFORMAT_VERSION_MAJOR <= 52} +function udp_get_file_handle(h: PURLContext): cint; + cdecl; external av__format; +{$IFEND} + implementation -{$IFDEF FF_API_OLD_AVIO} -function url_is_streamed(s: PAVIOContext): cint; +function url_is_streamed(s: PByteIOContext): 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 e2cfd496..2f8c79f7 100644 --- a/src/lib/ffmpeg/avutil.pas +++ b/src/lib/ffmpeg/avutil.pas @@ -24,11 +24,14 @@ * Conversions of * * libavutil/avutil.h: - * version: 50.43.0 + * 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 * * 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. @@ -55,7 +58,6 @@ interface uses ctypes, mathematics, - opt, rational, {$IFDEF UNIX} BaseUnix, @@ -63,18 +65,43 @@ 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 = 43; + LIBAVUTIL_MAX_VERSION_MINOR = 24; 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 = 50; - LIBAVUTIL_MIN_VERSION_MINOR = 43; - LIBAVUTIL_MIN_VERSION_RELEASE = 0; + LIBAVUTIL_MIN_VERSION_MAJOR = 49; + LIBAVUTIL_MIN_VERSION_MINOR = 0; + LIBAVUTIL_MIN_VERSION_RELEASE = 1; LIBAVUTIL_MIN_VERSION = (LIBAVUTIL_MIN_VERSION_MAJOR * VERSION_MAJOR) + (LIBAVUTIL_MIN_VERSION_MINOR * VERSION_MINOR) + (LIBAVUTIL_MIN_VERSION_RELEASE * VERSION_RELEASE); @@ -88,12 +115,15 @@ 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. *) @@ -105,6 +135,12 @@ 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 = ( @@ -116,50 +152,11 @@ 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 version: 50.43.0 *) +(* libavutil/pixfmt.h up to revision 23144, May 16 2010 *) type (** @@ -185,8 +182,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; @@ -198,46 +195,65 @@ 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), 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_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_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), deprecated in favor of PIX_FMT_YUV440P and setting color_range + PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG) 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 @@ -251,106 +267,72 @@ 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 - - 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 - +{$IFEND} 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; - - PIX_FMT_GRAY16 = PIX_FMT_GRAY16BE; + {$IFEND} + PIX_FMT_GRAY16 = PIX_FMT_GRAY16BE; + {$IF LIBAVUTIL_VERSION >= 49015000} // 49.15.0 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; - 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; + PIX_FMT_BGR555 = PIX_FMT_BGR555BE + {$IFEND} {$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; - - PIX_FMT_GRAY16 = PIX_FMT_GRAY16LE; + {$IFEND} + PIX_FMT_GRAY16 = PIX_FMT_GRAY16LE; + {$IF LIBAVUTIL_VERSION >= 49015000} // 49.15.0 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; - 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; + {$IFEND} {$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). @@ -359,7 +341,7 @@ type * be allocated. * @see av_mallocz() *) -function av_malloc(size: FF_INTERNAL_MEM_TYPE): pointer; +function av_malloc(size: cuint): pointer; cdecl; external av__util; {av_malloc_attrib av_alloc_size(1)} (** @@ -374,7 +356,7 @@ function av_malloc(size: FF_INTERNAL_MEM_TYPE): pointer; * cannot be allocated or the function is used to free the memory block. * @see av_fast_realloc() *) -function av_realloc(ptr: pointer; size: FF_INTERNAL_MEM_TYPE): pointer; +function av_realloc(ptr: pointer; size: cuint): pointer; cdecl; external av__util; {av_alloc_size(2)} (** @@ -396,7 +378,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: FF_INTERNAL_MEM_TYPE): pointer; +function av_mallocz(size: cuint): pointer; cdecl; external av__util; {av_malloc_attrib av_alloc_size(1)} (** @@ -409,7 +391,7 @@ function av_strdup({const} s: PAnsiChar): PAnsiChar; cdecl; external av__util; {av_malloc_attrib} (** - * Free a memory block which has been allocated with av_malloc(z)() or + * Freesa 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. @@ -418,75 +400,18 @@ 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; (** @@ -520,6 +445,7 @@ 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 @@ -542,13 +468,10 @@ 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); @@ -559,33 +482,10 @@ 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); **} -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); +{$IF LIBAVUTIL_VERSION >= 50015003} // 50.15.3 +function av_default_item_name (ctx: pointer): Pchar; cdecl; external av__util; +{$IFEND} implementation diff --git a/src/lib/ffmpeg/error.pas b/src/lib/ffmpeg/error.pas index 382f40bf..720005b6 100644 --- a/src/lib/ffmpeg/error.pas +++ b/src/lib/ffmpeg/error.pas @@ -19,14 +19,11 @@ * - Changes and updates by the UltraStar Deluxe Team * * Conversion of libavutil/error.h - * avutil version 50.43.0 + * Max. avutil version: 50.21.0, revision 24190, Wed Jul 21 01:00:00 2010 CET * *) -(** - * @file - * error code definitions - *) +{$IF LIBAVUTIL_VERSION >= 50012000} // >= 50.12.0 {* error handling *} @@ -65,13 +62,14 @@ const * 1) shr 30: shifts the sign bit to bit position 2 * 2) and $00000002: sets all other bits to zero * positive EINVAL gives 0, negative gives 2 + * 3) not: inverts all bits. This gives -1 and -3 * 3) - 1: positive EINVAL gives -1, negative 1 *) const AVERROR_SIGN = (EINVAL shr 30) and $00000002 - 1; (* -#if EDOM > 0 +#if EINVAL > 0 #define AVERROR(e) (-(e)) {**< Returns a negative error code from a POSIX error code, to return from library functions. *} #define AVUNERROR(e) (-(e)) {**< Returns a POSIX error code from a library function error return value. *} #else @@ -82,31 +80,23 @@ const *) const - AVERROR_INVALIDDATA = AVERROR_SIGN * EINVAL; (**< Invalid data found when processing input *) + AVERROR_UNKNOWN = AVERROR_SIGN * EINVAL; (**< unknown error *) AVERROR_IO = AVERROR_SIGN * EIO; (**< I/O error *) - AVERROR_NOENT = AVERROR_SIGN * ENOENT; (**< No such file or directory. *) - AVERROR_NOFMT = AVERROR_SIGN * EILSEQ; (**< unknown format *) + AVERROR_NUMEXPECTED = AVERROR_SIGN * EDOM; (**< Number syntax expected in filename. *) + AVERROR_INVALIDDATA = AVERROR_SIGN * EINVAL; (**< invalid data found *) AVERROR_NOMEM = AVERROR_SIGN * ENOMEM; (**< not enough memory *) + AVERROR_NOFMT = AVERROR_SIGN * EILSEQ; (**< unknown format *) AVERROR_NOTSUPP = AVERROR_SIGN * ENOSYS; (**< Operation not supported. *) - AVERROR_NUMEXPECTED = AVERROR_SIGN * EDOM; (**< Number syntax expected in filename. *) - AVERROR_UNKNOWN = AVERROR_SIGN * EINVAL; (**< Unknown error *) - + AVERROR_NOENT = AVERROR_SIGN * ENOENT; (**< No such file or directory. *) +{$IF LIBAVCODEC_VERSION >= 52017000} // 52.17.0 AVERROR_EOF = AVERROR_SIGN * EPIPE; (**< End of file. *) - +{$IFEND} // Note: function calls as constant-initializers are invalid - AVERROR_PATCHWELCOME = -(ord('P') or (ord('A') shl 8) or (ord('W') shl 16) or (ord('E') shl 24)); ///< Not yet implemented in Libav, patches welcome - - AVERROR_BSF_NOT_FOUND = -(ord($F8) or (ord('B') shl 8) or (ord('S') shl 16) or (ord('F') shl 24)); ///< Bitstream filter not found - AVERROR_DECODER_NOT_FOUND = -(ord($F8) or (ord('D') shl 8) or (ord('E') shl 16) or (ord('C') shl 24)); ///< Decoder not found - AVERROR_DEMUXER_NOT_FOUND = -(ord($F8) or (ord('D') shl 8) or (ord('E') shl 16) or (ord('M') shl 24)); ///< Demuxer not found - AVERROR_ENCODER_NOT_FOUND = -(ord($F8) or (ord('E') shl 8) or (ord('N') shl 16) or (ord('C') shl 24)); ///< Encoder not found - AVERROR_EXIT = -(ord('E') or (ord('X') shl 8) or (ord('I') shl 16) or (ord('T') shl 24)); ///< Immediate exit was requested; the called function should not be restarted - AVERROR_FILTER_NOT_FOUND = -(ord($F8) or (ord('F') shl 8) or (ord('I') shl 16) or (ord('L') shl 24)); ///< Filter not found - AVERROR_MUXER_NOT_FOUND = -(ord($F8) or (ord('M') shl 8) or (ord('U') shl 16) or (ord('X') shl 24)); ///< Muxer not found - AVERROR_OPTION_NOT_FOUND = -(ord($F8) or (ord('O') shl 8) or (ord('P') shl 16) or (ord('T') shl 24)); ///< Option not found - AVERROR_PROTOCOL_NOT_FOUND = -(ord($F8) or (ord('P') shl 8) or (ord('R') shl 16) or (ord('O') shl 24)); ///< Protocol not found - AVERROR_STREAM_NOT_FOUND = -(ord($F8) or (ord('S') shl 8) or (ord('T') shl 16) or (ord('R') shl 24)); ///< Stream not found + //AVERROR_PATCHWELCOME = -MKTAG('P','A','W','E'); {**< Not yet implemented in FFmpeg. Patches welcome. *} + AVERROR_PATCHWELCOME = -(ord('P') or (ord('A') shl 8) or (ord('W') shl 16) or (ord('E') shl 24)); +{$IFEND} +{$IF LIBAVUTIL_VERSION >= 50013000} // >= 50.13.0 (* * Put a description of the AVERROR code errnum in errbuf. * In case of failure the global variable errno is set to indicate the @@ -120,5 +110,6 @@ const * cannot be found *) -function av_strerror(errnum: cint; errbuf: PAnsiChar; errbuf_size: size_t): cint; +function av_strerror(errnum: cint; errbuf: Pchar; errbuf_size: cint): cint; cdecl; external av__util; +{$IFEND} diff --git a/src/lib/ffmpeg/mathematics.pas b/src/lib/ffmpeg/mathematics.pas index 20ee21c2..98901c2a 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 version 50.43.0 + * avutil max. version 50.23.0, revision 24439, Wed Aug 25 05:00:00 2010 CET * *) @@ -47,13 +47,21 @@ 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 = ( @@ -64,6 +72,7 @@ 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 @@ -71,6 +80,7 @@ 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. @@ -92,6 +102,7 @@ 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 @@ -100,7 +111,9 @@ 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 @@ -113,6 +126,7 @@ 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 a779056e..8669eaf6 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 libavutil/opt.h - * avutil version 50.43.0 + * Conversion of libavcodec/opt.h + * Max. avcodec version: 52.86.1, 24882, Wed Aug 23 07:00:00 2010 CET * *) @@ -41,7 +41,6 @@ interface uses ctypes, - dict, rational, UConfig; @@ -90,14 +89,7 @@ type (** * the default value for scalar options *) - default_val: record - case cint of - 0: (dbl: cdouble); - 1: (str: PAnsiChar); - (* TODO those are unused now *) - 2: (i64: cint64); - 3: (q: TAVRational); - end; + default_val: cdouble; min: cdouble; ///< minimum valid value for the option max: cdouble; ///< maximum valid value for the option @@ -112,7 +104,54 @@ type unit_: {const} PAnsiChar; end; -{$IFDEF FF_API_FIND_OPT} +{$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 (** * Look for an option in obj. Look only for the options which * have the flags set as specified in mask and flags (that is, @@ -126,10 +165,32 @@ 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__util; deprecated; -{$ENDIF} + 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} + +{$IF LIBAVCODEC_VERSION >= 52007000} // 52.7.0 +(** * Set the field of obj with the given name to value. * * @param[in] obj A struct whose first element is a pointer to an @@ -157,124 +218,43 @@ function av_find_opt(obj: Pointer; {const} name: {const} PAnsiChar; {const} unit * 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__util; + cdecl; external av__codec; +{$IFEND} function av_set_double(obj: pointer; name: {const} PAnsiChar; n: cdouble): PAVOption; - cdecl; external av__util; + cdecl; external av__codec; + function av_set_q(obj: pointer; name: {const} PAnsiChar; n: TAVRational): PAVOption; - cdecl; external av__util; + cdecl; external av__codec; + function av_set_int(obj: pointer; name: {const} PAnsiChar; n: cint64): PAVOption; - cdecl; external av__util; + cdecl; external av__codec; + function av_get_double(obj: pointer; name: {const} PAnsiChar; var o_out: {const} PAVOption): cdouble; - cdecl; external av__util; + cdecl; external av__codec; + function av_get_q(obj: pointer; name: {const} PAnsiChar; var o_out: {const} PAVOption): TAVRational; - cdecl; external av__util; + cdecl; external av__codec; + function av_get_int(obj: pointer; name: {const} PAnsiChar; var o_out: {const} PAVOption): cint64; - cdecl; external av__util; + cdecl; external av__codec; + function av_get_string(obj: pointer; name: {const} PAnsiChar; var o_out: {const} PAVOption; buf: PAnsiChar; buf_len: cint): PAnsiChar; - cdecl; external av__util; + cdecl; external av__codec; + function av_next_option(obj: pointer; last: {const} PAVOption): PAVOption; - cdecl; external av__util; + 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; +function av_opt_show(obj: pointer; av_log_obj: pointer): cint; + cdecl; external av__codec; procedure av_opt_set_defaults(s: pointer); - cdecl; external av__util; -procedure av_opt_set_defaults2(s: Pointer; mask: cint; flags: cint); - 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; + cdecl; external av__codec; -(** - * 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; +{$IF LIBAVCODEC_VERSION >= 51039000} // 51.39.0 +procedure av_opt_set_defaults2(s: Pointer; mask: cint; flags: cint); + cdecl; external av__codec; +{$IFEND} implementation diff --git a/src/lib/ffmpeg/rational.pas b/src/lib/ffmpeg/rational.pas index 45ca8b87..892f2273 100644 --- a/src/lib/ffmpeg/rational.pas +++ b/src/lib/ffmpeg/rational.pas @@ -23,7 +23,7 @@ * - Changes and updates by the UltraStar Deluxe Team * * Conversion of libavutil/rational.h - * avutil version 50.43.0 + * avutil max. version 50.21.0, revision 24190, Wed Jul 21 01:00:00 2010 CET * *) @@ -62,7 +62,8 @@ type * Compare two rationals. * @param a first rational * @param b second rational - * @return 0 if a==b, 1 if a>b and -1 if a<b + * @return 0 if a==b, 1 if a>b, -1 if a<b, and INT_MIN if one of the + * values is of the form 0/0 *) function av_cmp_q(a: TAVRational; b: TAVRational): cint; {$IFDEF HasInline}inline;{$ENDIF} @@ -160,6 +161,12 @@ begin Result := (tmp shr 63) or 1 else Result := 0 +{ new version: + if(tmp) return ((tmp ^ a.den ^ b.den)>>63)|1; + else if(b.den && a.den) return 0; + else if(a.num && b.num) return (a.num>>31) - (b.num>>31); + else return INT_MIN; +} end; function av_q2d(a: TAVRational): cdouble; diff --git a/src/lib/ffmpeg/swscale.pas b/src/lib/ffmpeg/swscale.pas index 6fab095d..7289e902 100644 --- a/src/lib/ffmpeg/swscale.pas +++ b/src/lib/ffmpeg/swscale.pas @@ -91,12 +91,15 @@ 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. *) @@ -108,6 +111,7 @@ 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 *) @@ -155,6 +159,7 @@ 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(). @@ -164,6 +169,7 @@ const *) function sws_getCoefficients(colorspace: cint): Pcint; cdecl; external sw__scale; +{$IFEND} type @@ -189,6 +195,7 @@ 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. @@ -202,6 +209,7 @@ function sws_isSupportedInput(pix_fmt: TAVPixelFormat): cint; *) function sws_isSupportedOutput(pix_fmt: TAVPixelFormat): cint; cdecl; external sw__scale; +{$IFEND} (** * Frees the swscaler context swsContext. @@ -259,11 +267,13 @@ 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] @@ -335,10 +345,14 @@ 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. @@ -347,6 +361,7 @@ 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; @@ -380,6 +395,7 @@ 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. * @@ -411,6 +427,7 @@ procedure sws_convertPalette8ToPacked24({const} src: PPCuint8Array; num_pixels: clong; {const} palette: PPCuint8Array); cdecl; external sw__scale; +{$IFEND} implementation |