diff options
author | k-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2013-07-27 23:22:10 +0000 |
---|---|---|
committer | k-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2013-07-27 23:22:10 +0000 |
commit | 046dc6d2805e75c755b65f64cc492bdc11ea0ce8 (patch) | |
tree | f3f0620425acbbe6d950b7341f2f9b94965d6dc0 | |
parent | eacbe2e3f59745c59679635394aef83279f4ba4f (diff) | |
download | usdx-046dc6d2805e75c755b65f64cc492bdc11ea0ce8.tar.gz usdx-046dc6d2805e75c755b65f64cc492bdc11ea0ce8.tar.xz usdx-046dc6d2805e75c755b65f64cc492bdc11ea0ce8.zip |
first chunk of ffmpeg updates. libavutil parts. version still to be done.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@3003 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r-- | src/lib/ffmpeg-1.2/libavutil/cpu.pas | 112 | ||||
-rw-r--r-- | src/lib/ffmpeg-1.2/libavutil/dict.pas | 120 | ||||
-rw-r--r-- | src/lib/ffmpeg-1.2/libavutil/error.pas | 157 | ||||
-rw-r--r-- | src/lib/ffmpeg-1.2/libavutil/log.pas | 244 | ||||
-rw-r--r-- | src/lib/ffmpeg-1.2/libavutil/mathematics.pas | 130 | ||||
-rw-r--r-- | src/lib/ffmpeg-1.2/libavutil/mem.pas | 191 | ||||
-rw-r--r-- | src/lib/ffmpeg-1.2/libavutil/opt.pas | 589 | ||||
-rw-r--r-- | src/lib/ffmpeg-1.2/libavutil/pixfmt.pas | 412 | ||||
-rw-r--r-- | src/lib/ffmpeg-1.2/libavutil/samplefmt.pas | 260 | ||||
-rw-r--r-- | src/lib/ffmpeg-2.0/libavutil/cpu.pas | 118 | ||||
-rw-r--r-- | src/lib/ffmpeg-2.0/libavutil/dict.pas | 120 | ||||
-rw-r--r-- | src/lib/ffmpeg-2.0/libavutil/error.pas | 157 | ||||
-rw-r--r-- | src/lib/ffmpeg-2.0/libavutil/log.pas | 244 | ||||
-rw-r--r-- | src/lib/ffmpeg-2.0/libavutil/mathematics.pas | 130 | ||||
-rw-r--r-- | src/lib/ffmpeg-2.0/libavutil/mem.pas | 267 | ||||
-rw-r--r-- | src/lib/ffmpeg-2.0/libavutil/opt.pas | 614 | ||||
-rw-r--r-- | src/lib/ffmpeg-2.0/libavutil/pixfmt.pas | 382 | ||||
-rw-r--r-- | src/lib/ffmpeg-2.0/libavutil/samplefmt.pas | 275 |
18 files changed, 4522 insertions, 0 deletions
diff --git a/src/lib/ffmpeg-1.2/libavutil/cpu.pas b/src/lib/ffmpeg-1.2/libavutil/cpu.pas new file mode 100644 index 00000000..3cee5fbb --- /dev/null +++ b/src/lib/ffmpeg-1.2/libavutil/cpu.pas @@ -0,0 +1,112 @@ +(* + * 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 + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * This is a part of the Pascal port of ffmpeg. + * - Changes and updates by the UltraStar Deluxe Team + * + * Conversion of libavutil/cpu.h + * avutil version 52.13.100 + * + *) + +const + + AV_CPU_FLAG_FORCE = $80000000; (* force usage of selected flags (OR) *) + + (* lower 16 bits - CPU features *) + AV_CPU_FLAG_MMX = $0001; ///< standard MMX + AV_CPU_FLAG_MMXEXT = $0002; ///< SSE integer functions or AMD MMX ext + AV_CPU_FLAG_MMX2 = $0002; ///< SSE integer functions or AMD MMX ext + AV_CPU_FLAG_3DNOW = $0004; ///< AMD 3DNOW + AV_CPU_FLAG_SSE = $0008; ///< SSE functions + AV_CPU_FLAG_SSE2 = $0010; ///< PIV SSE2 functions + AV_CPU_FLAG_SSE2SLOW = $40000000; ///< SSE2 supported, but usually not faster + AV_CPU_FLAG_3DNOWEXT = $0020; ///< AMD 3DNowExt + AV_CPU_FLAG_SSE3 = $0040; ///< Prescott SSE3 functions + AV_CPU_FLAG_SSE3SLOW = $20000000; ///< SSE3 supported, but usually not faster + AV_CPU_FLAG_SSSE3 = $0080; ///< Conroe SSSE3 functions + AV_CPU_FLAG_ATOM = $10000000; ///< Atom processor, some SSSE3 instructions are slower + AV_CPU_FLAG_SSE4 = $0100; ///< Penryn SSE4.1 functions + AV_CPU_FLAG_SSE42 = $0200; ///< Nehalem SSE4.2 functions + AV_CPU_FLAG_AVX = $4000; ///< AVX functions: requires OS support even if YMM registers aren't used + AV_CPU_FLAG_XOP = $0400; ///< Bulldozer XOP functions + AV_CPU_FLAG_FMA4 = $0800; ///< Bulldozer FMA4 functions + + AV_CPU_FLAG_CMOV = $1001000; ///< supports cmov instruction + + AV_CPU_FLAG_ALTIVEC = $0001; ///< standard + + AV_CPU_FLAG_ARMV5TE = (1 << 0); + AV_CPU_FLAG_ARMV6 = (1 << 1); + AV_CPU_FLAG_ARMV6T2 = (1 << 2); + AV_CPU_FLAG_VFP = (1 << 3); + AV_CPU_FLAG_VFPV3 = (1 << 4); + AV_CPU_FLAG_NEON = (1 << 5); + +(** + * Return the flags which specify extensions supported by the CPU. + * The returned value is affected by av_force_cpu_flags() if that was used + * before. So av_get_cpu_flags() can easily be used in a application to + * detect the enabled cpu flags. + *) +function av_get_cpu_flags(): cint; + cdecl; external av__util; + +(** + * Disables cpu detection and forces the specified flags. + * -1 is a special case that disables forcing of specific flags. + *) +procedure av_force_cpu_flags(flags: cint); + cdecl; external av__util; + +(** + * Set a mask on flags returned by av_get_cpu_flags(). + * This function is mainly useful for testing. + * Please use av_force_cpu_flags() and av_get_cpu_flags() instead which are more flexible + * + * @warning this function is not thread safe. + *) +procedure av_set_cpu_flags_mask(mask: cint); + cdecl; external av__util; deprecated; + +(** + * Parse CPU flags from a string. + * + * The returned flags contain the specified flags as well as related unspecified flags. + * + * This function exists only for compatibility with libav. + * Please use av_parse_cpu_caps() when possible. + * @return a combination of AV_CPU_* flags, negative on error. + *) +function av_parse_cpu_flags(s: {const} PAnsiChar): cint; + cdecl; external av__util; deprecated; + +(** + * Parse CPU caps from a string and update the given AV_CPU_* flags based on that. + * + * @return negative on error. + *) +function av_parse_cpu_caps(flags: Pcuint; s: {const} PAnsiChar): cint; + cdecl; external av__util; + +(* The following CPU-specific functions shall not be called directly. *) +function ff_get_cpu_flags_arm(): cint; + cdecl; external av__util; +function ff_get_cpu_flags_ppc(): cint; + cdecl; external av__util; +function ff_get_cpu_flags_x86(): cint; + cdecl; external av__util; diff --git a/src/lib/ffmpeg-1.2/libavutil/dict.pas b/src/lib/ffmpeg-1.2/libavutil/dict.pas new file mode 100644 index 00000000..5d827e29 --- /dev/null +++ b/src/lib/ffmpeg-1.2/libavutil/dict.pas @@ -0,0 +1,120 @@ +(* + * AVDictionary + * copyright (c) 2011 Karl-Michael Schindler <karl-michael.schindler@web.de> + * + * This library 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 + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * This is a part of the Pascal port of ffmpeg. + * + * Conversion of libavutil/dict.h + * avutil version 52.13.100 + * + *) + +const + AV_DICT_MATCH_CASE = 1; + AV_DICT_IGNORE_SUFFIX = 2; + AV_DICT_DONT_STRDUP_KEY = 4; (**< Take ownership of a key that's been + allocated with av_malloc() and children. *) + AV_DICT_DONT_STRDUP_VAL = 8; (**< Take ownership of a value that's been + allocated with av_malloc() and chilren. *) + AV_DICT_DONT_OVERWRITE = 16; (**< Don't overwrite existing entries. *) + AV_DICT_APPEND = 32; (**< If the entry already exists, append to it. Note that no + delimiter is added, the strings are simply concatenated. *) + +type + PAVDictionaryEntry = ^TAVDictionaryEntry; + TAVDictionaryEntry = record + key: PAnsiChar; + value: PAnsiChar; + end; + +(* with the "help" of libavutil/dict.c: *) + + PPAVDictionary = ^PAVDictionary; + PAVDictionary = ^TAVDictionary; + TAVDictionary = record + count: cint; + elems: PAVDictionaryEntry; + end; + +(** + * Get a dictionary entry with matching key. + * + * @param prev Set to the previous matching element to find the next. + * If set to NULL the first matching element is returned. + * @param flags Allows case as well as suffix-insensitive comparisons. + * @return Found entry or NULL, changing key or value leads to undefined behavior. + *) +function av_dict_get(m: PAVDictionary; {const} key: PAnsiChar; {const} prev: PAVDictionaryEntry; flags: cint): PAVDictionaryEntry; + cdecl; external av__util; + +(** + * Get number of entries in dictionary. + * + * @param m dictionary + * @return number of entries in dictionary + *) +function av_dict_count({const} m: PAVDictionary): cint; + cdecl; external av__util; + +(** + * Set the given entry in *pm, overwriting an existing entry. + * + * @param pm pointer to a pointer to a dictionary struct. If *pm is NULL + * a dictionary struct is allocated and put in *pm. + * @param key entry key to add to *pm (will be av_strduped depending on flags) + * @param value entry value to add to *pm (will be av_strduped depending on flags). + * Passing a NULL value will cause an existing entry to be deleted. + * @return >= 0 on success otherwise an error code <0 + *) +function av_dict_set(var pm: PAVDictionary; {const} key: PAnsiChar; {const} value: PAnsiChar; flags: cint): cint; + cdecl; external av__util; + +(** + * Parse the key/value pairs list and add to a dictionary. + * + * @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 + * @param flags flags to use when adding to dictionary. + * AV_DICT_DONT_STRDUP_KEY and AV_DICT_DONT_STRDUP_VAL + * are ignored since the key/value tokens will always + * be duplicated. + * @return 0 on success, negative AVERROR code on failure + *) +function av_dict_parse_string(var pm: PAVDictionary; {const} str: PAnsiChar; + {const} key_val_sep: PAnsiChar; {const} pairs_sep: PAnsiChar; + flags: cint): cint; + cdecl; external av__util; + +(** + * Copy entries 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 entries in *dst + * @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag + *) +procedure av_dict_copy(var dst: PAVDictionary; src: PAVDictionary; flags: cint); + cdecl; external av__util; + +(** + * Free all the memory allocated for an AVDictionary struct + * and all keys and values. + *) +procedure av_dict_free(var m: PAVDictionary); + cdecl; external av__util; diff --git a/src/lib/ffmpeg-1.2/libavutil/error.pas b/src/lib/ffmpeg-1.2/libavutil/error.pas new file mode 100644 index 00000000..46dbe51a --- /dev/null +++ b/src/lib/ffmpeg-1.2/libavutil/error.pas @@ -0,0 +1,157 @@ +(* + * 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 + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * This is a part of the Pascal port of ffmpeg. + * - Changes and updates by the UltraStar Deluxe Team + * + * Conversion of libavutil/error.h + * avutil version 52.13.100 + * + *) + +(** + * @file + * error code definitions + *) + +(** + * @addtogroup lavu_error + * + * @{ + *) + +{* error handling *} + +const +{$IFDEF UNIX} + ENOENT = ESysENOENT; + EIO = ESysEIO; + ENOMEM = ESysENOMEM; + EINVAL = ESysEINVAL; + EDOM = ESysEDOM; + ENOSYS = ESysENOSYS; + EILSEQ = ESysEILSEQ; + EPIPE = ESysEPIPE; +{$ELSE} + ENOENT = 2; + EIO = 5; + ENOMEM = 12; + EINVAL = 22; + EPIPE = 32; // just an assumption. needs to be checked. + EDOM = 33; + {$IFDEF MSWINDOWS} + // Note: we assume that ffmpeg was compiled with MinGW. + // This must be changed if DLLs were compiled with cygwin. + ENOSYS = 40; // MSVC/MINGW: 40, CYGWIN: 88, LINUX/FPC: 38 + EILSEQ = 42; // MSVC/MINGW: 42, CYGWIN: 138, LINUX/FPC: 84 + {$ENDIF} +{$ENDIF} + +(** + * We need the sign of the error, because some platforms have + * E* and errno already negated. The previous version failed + * with Delphi, because it needed EINVAL defined. + * Warning: This code is platform dependent and assumes constants + * to be 32 bit. + * This version does the following steps: + * 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) - 1: positive EINVAL gives -1, negative 1 + *) +const + AVERROR_SIGN = (EINVAL shr 30) and $00000002 - 1; + +(* +#if EDOM > 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 +{* Some platforms have E* and errno already negated. *} +#define AVERROR(e) (e) +#define AVUNERROR(e) (e) +#endif +*) + +const + + // Note: function calls as constant-initializers are invalid + 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_BUG = -(ord('B') or (ord('U') shl 8) or (ord('G') shl 16) or (ord('!') shl 24)); ///< Internal bug, also see AVERROR_BUG2 + AVERROR_BUFFER_TOO_SMALL = -(ord('B') or (ord('U') shl 8) or (ord('F') shl 16) or (ord('S') shl 24)); ///< Buffer too small + 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_EOF = -(ord('E') or (ord('O') shl 8) or (ord('F') shl 16) or (ord(' ') shl 24)); ///< End of file + 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_EXTERNAL = -(ord('E') or (ord('X') shl 8) or (ord('T') shl 16) or (ord(' ') shl 24)); ///< Generic error in an external library + 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_INVALIDDATA = -(ord('I') or (ord('N') shl 8) or (ord('D') shl 16) or (ord('A') shl 24)); ///< Invalid data found when processing input + 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_PATCHWELCOME = -(ord('P') or (ord('A') shl 8) or (ord('W') shl 16) or (ord('E') shl 24)); ///< Not yet implemented in FFmpeg, patches welcome + 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 + +(** + * This is semantically identical to AVERROR_BUG + * it has been introduced in Libav after our AVERROR_BUG and with a modified value. + *) + AVERROR_BUG2 = -(ord('B') or (ord('U') shl 8) or (ord('G') shl 16) or (ord(' ') shl 24)); + AVERROR_UNKNOWN = -(ord('U') or (ord('N') shl 8) or (ord('K') shl 16) or (ord('N') shl 24)); ///< Unknown error, typically from an external library + AVERROR_EXPERIMENTAL = -($2bb2afa8); ///< Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it. + + AV_ERROR_MAX_STRING_SIZE = 64; + +(* + * Put a description of the AVERROR code errnum in errbuf. + * In case of failure the global variable errno is set to indicate the + * error. Even in case of failure av_strerror() will print a generic + * error message indicating the errnum provided to errbuf. + * + * @param errnum error code to describe + * @param errbuf buffer to which description is written + * @param errbuf_size the size in bytes of errbuf + * @return 0 on success, a negative value if a description for errnum + * cannot be found + *) +function av_strerror(errnum: cint; errbuf: PAnsiChar; errbuf_size: size_t): cint; + cdecl; external av__util; + +(** + * Fill the provided buffer with a string containing an error string + * corresponding to the AVERROR code errnum. + * + * @param errbuf a buffer + * @param errbuf_size size in bytes of errbuf + * @param errnum error code to describe + * @return the buffer in input, filled with the error description + * @see av_strerror() + *) +function av_make_error_string(errbuf: Pchar; errbuf_size: size_t; errnum: cint): Pchar; {$IFDEF HasInline}inline;{$ENDIF} +// Note: defined in avutil.pas + +(** + * Convenience macro, the return value should be used only directly in + * function arguments but never stand-alone. + *) +function av_err2str(errnum: cint): pchar; {$IFDEF HasInline}inline;{$ENDIF} +// Note: defined in avutil.pas + +(** + * @} + *) diff --git a/src/lib/ffmpeg-1.2/libavutil/log.pas b/src/lib/ffmpeg-1.2/libavutil/log.pas new file mode 100644 index 00000000..9cd709f8 --- /dev/null +++ b/src/lib/ffmpeg-1.2/libavutil/log.pas @@ -0,0 +1,244 @@ +(* + * 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 + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * This is a part of the Pascal port of ffmpeg. + * - Changes and updates by the UltraStar Deluxe Team + * + * Conversion of libavutil/log.h + * avutil version 52.13.100 + * + *) + +(** + * @file + * log + *) + +type + PAVClassCategory = ^TAVClassCategory; + TAVClassCategory = ( + AV_CLASS_CATEGORY_NA = 0, + AV_CLASS_CATEGORY_INPUT, + AV_CLASS_CATEGORY_OUTPUT, + AV_CLASS_CATEGORY_MUXER, + AV_CLASS_CATEGORY_DEMUXER, + AV_CLASS_CATEGORY_ENCODER, + AV_CLASS_CATEGORY_DECODER, + AV_CLASS_CATEGORY_FILTER, + AV_CLASS_CATEGORY_BITSTREAM_FILTER, + AV_CLASS_CATEGORY_SWSCALER, + AV_CLASS_CATEGORY_SWRESAMPLER, + AV_CLASS_CATEGORY_NB ///< not part of ABI/API + ); + +// struct AVOptionRanges; + +(** + * 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(ctx: pointer): 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 + * logging is stored. For example a decoder could pass its AVCodecContext + * to eval as such a parent context, which an av_log() implementation + * could then leverage to display the parent context. + * The offset can be NULL. + *) + parent_log_context_offset: cint; + + (** + * Return next AVOptions-enabled child or NULL + *) + child_next: function (obj: pointer; prev: pointer): pointer; cdecl; + + (** + * Return an AVClass corresponding to the next potential + * AVOptions-enabled child. + * + * The difference between child_next and this is that + * child_next iterates over _already existing_ objects, while + * child_class_next iterates over _all possible_ children. + *) + child_class_next: function (prev: {const} PAVClass): {const} PAVClass; cdecl; + + (** + * Category used for visualization (like color) + * This is only set if the category is equal for all objects using this class. + * available since version (51 << 16 | 56 << 8 | 100) + *) + category: TAVClassCategory; + + (** + * Callback to return the category. + * available since version (51 << 16 | 59 << 8 | 100) + *) + get_category: function (ctx: pointer): PAVClassCategory; cdecl; + + (** + * Callback to return the supported/allowed ranges. + * available since version (52.12) + *) + query_ranges: function (P: PPAVOptionRanges; obj: pointer; key: {const} PAnsiChar; flags: cint): cint; cdecl; +end; + +const + AV_LOG_QUIET = -8; + +(** + * Something went really wrong and we will crash now. + *) + AV_LOG_PANIC = 0; + +(** + * Something went wrong and recovery is not possible. + * For example, no header was found for a format which depends + * on headers or an illegal combination of parameters is used. + *) + AV_LOG_FATAL = 8; + +(** + * Something went wrong and cannot losslessly be recovered. + * However, not all future data is affected. + *) + AV_LOG_ERROR = 16; + +(** + * Something somehow does not look correct. This may or may not + * lead to problems. An example would be the use of '-vstrict -2'. + *) + AV_LOG_WARNING = 24; + + AV_LOG_INFO = 32; + AV_LOG_VERBOSE = 40; + +(** + * Stuff which is only useful for libav* developers. + *) + AV_LOG_DEBUG = 48; + + AV_LOG_MAX_OFFSET = (AV_LOG_DEBUG - AV_LOG_QUIET); + +(** + * Send the specified message to the log if the level is less than or equal + * to the current av_log_level. By default, all logging messages are sent to + * stderr. This behavior can be altered by setting a different av_vlog callback + * function. + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message, lower values signifying + * higher importance. + * @param fmt The format string (printf-compatible) that specifies how + * subsequent arguments are converted to output. + * @see av_vlog + *) + +{** to be translated if needed +void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4); +**} + +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); + cdecl; external av__util; + +{** to be translated if needed +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; +function av_default_get_category(ptr: pointer): TAVClassCategory; + cdecl; external av__util; + +(** + * Format a line of log the same way as the default callback. + * @param line buffer to receive the formated line + * @param line_size size of the buffer + * @param print_prefix used to store whether the prefix must be printed; + * must point to a persistent integer initially set to 1 + *) +procedure av_log_format_line(ptr: pointer; level: cint; fmt: {const} PAnsiChar; vl: va_list; + line: PAnsiChar; line_size: cint; print_prefix: Pcint); + cdecl; external av__util; + +(** + * av_dlog macros + * Useful to print debug messages that shouldn't get compiled in normally. + *) +(** to be translated if needed +#ifdef DEBUG +# define av_dlog(pctx, ...) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__) +#else +# define av_dlog(pctx, ...) do { if (0) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0) +#endif +**) + +(** + * Skip repeated messages, this requires the user app to use av_log() instead of + * (f)printf as the 2 would otherwise interfere and lead to + * "Last message repeated x times" messages below (f)printf messages with some + * bad luck. + * Also to receive the last, "last repeated" line if any, the user app must + * call av_log(NULL, AV_LOG_QUIET, "%s", ""); at the end + *) +const + AV_LOG_SKIP_REPEATED = 1; + +procedure av_log_set_flags(arg: cint); + cdecl; external av__util; diff --git a/src/lib/ffmpeg-1.2/libavutil/mathematics.pas b/src/lib/ffmpeg-1.2/libavutil/mathematics.pas new file mode 100644 index 00000000..7dcb5e1e --- /dev/null +++ b/src/lib/ffmpeg-1.2/libavutil/mathematics.pas @@ -0,0 +1,130 @@ +(* + * copyright (c) 2005-2012 Michael Niedermayer <michaelni@gmx.at> + * + * This library 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 + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * This is a part of Pascal porting of ffmpeg. + * - Originally by Victor Zinetz for Delphi and Free Pascal on Windows. + * - For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT + * in the source codes. + * - Changes and updates by the UltraStar Deluxe Team + * + * Conversion of libavutil/mathematics.h + * avutil version 52.13.100 + * + *) + +const + M_E = 2.7182818284590452354; // e + M_LN2 = 0.69314718055994530942; // log_e 2 + M_LN10 = 2.30258509299404568402; // log_e 10 + M_LOG2_10 = 3.32192809488736234787; // log_2 10 + M_PHI = 1.61803398874989484820; // phi / golden ratio + M_PI = 3.14159265358979323846; // pi + M_SQRT1_2 = 0.70710678118654752440; // 1/sqrt(2) + M_SQRT2 = 1.41421356237309504880; // sqrt(2) + NAN = $7fc00000; + INFINITY = $7f800000; + +(** + * @addtogroup lavu_math + * @{ + *) + +type + TAVRounding = ( + AV_ROUND_ZERO = 0, ///< Round toward zero. + AV_ROUND_INF = 1, ///< Round away from zero. + AV_ROUND_DOWN = 2, ///< Round toward -infinity. + AV_ROUND_UP = 3, ///< Round toward +infinity. + AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero. + AV_ROUND_PASS_MINMAX = 8192 ///< Flag to pass INT64_MIN/MAX through instead of rescaling, this avoids special cases for AV_NOPTS_VALUE + ); + +(** + * 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 + * undefined. + *) +function av_gcd(a: cint64; b: cint64): cint64; + cdecl; external av__util; {av_const} + +(** + * Rescale a 64-bit integer with rounding to nearest. + * A simple a*b/c isn't possible as it can overflow. + *) +function av_rescale (a, b, c: cint64): cint64; + cdecl; external av__util; {av_const} + +(** + * Rescale a 64-bit integer with specified rounding. + * A simple a*b/c isn't possible as it can overflow. + * + * @return rescaled value a, or if AV_ROUND_PASS_MINMAX is set and a is + * INT64_MIN or INT64_MAX then a is passed through unchanged. + *) +function av_rescale_rnd (a, b, c: cint64; enum: TAVRounding): cint64; + cdecl; external av__util; {av_const} + +(** + * Rescale a 64-bit integer by 2 rational numbers. + *) +function av_rescale_q (a: cint64; bq, cq: TAVRational): cint64; + cdecl; external av__util; {av_const} + +(** + * Rescale a 64-bit integer by 2 rational numbers with specified rounding. + * + * @return rescaled value a, or if AV_ROUND_PASS_MINMAX is set and a is + * INT64_MIN or INT64_MAX then a is passed through unchanged. + *) +function av_rescale_q_rnd(a: cint64; bq, cq: TAVRational; + enum: TAVRounding): cint64; + cdecl; external av__util; {av_const} + +(** + * Compare 2 timestamps each in its own timebases. + * The result of the function is undefined if one of the timestamps + * is outside the int64_t range when represented in the others timebase. + * @return -1 if ts_a is before ts_b, 1 if ts_a is after ts_b or 0 if they represent the same position + *) +function av_compare_ts(ts_a: cint64; tb_a: TAVRational; ts_b: cint64; tb_b: TAVRational): cint; + cdecl; external av__util; + +(** + * Compare 2 integers modulo mod. + * That is we compare integers a and b for which only the least + * significant log2(mod) bits are known. + * + * @param mod must be a power of 2 + * @return a negative value if a is smaller than b + * a positiv value if a is greater than b + * 0 if a equals b + *) +function av_compare_mod(a: cuint64; b: cuint64; modVar: cuint64): cint64; + cdecl; external av__util; + +(** + * Rescale a timestamp while preserving known durations. + * + * @param in_ts Input timestamp + * @param in_tb Input timesbase + * @param fs_tb Duration and *last timebase + * @param duration duration till the next call + * @param out_tb Output timesbase + *) +function av_rescale_delta(in_tb: TAVRational; in_ts: cint64; fs_tb: TAVRational; duration: cint; last: Pcint64; out_tb: TAVRational): cint64; + cdecl; external av__util; + diff --git a/src/lib/ffmpeg-1.2/libavutil/mem.pas b/src/lib/ffmpeg-1.2/libavutil/mem.pas new file mode 100644 index 00000000..db22c82f --- /dev/null +++ b/src/lib/ffmpeg-1.2/libavutil/mem.pas @@ -0,0 +1,191 @@ +(* + * 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 + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * This is a part of the Pascal port of ffmpeg. + * - Changes and updates by the UltraStar Deluxe Team + * + * Conversion of libavutil/mem.h + * avutil version 52.13.100 + * + *) + +(** + * @file + * error code definitions + *) + +(* memory handling functions *) + +(** + * Allocate a block of size bytes with alignment suitable for all + * memory accesses (including vectors if available on the CPU). + * @param size Size in bytes for the memory block to be allocated. + * @return Pointer to the allocated block, NULL if the block cannot + * be allocated. + * @see av_mallocz() + *) +function av_malloc(size: size_t): pointer; + cdecl; external av__util; {av_malloc_attrib av_alloc_size(1)} + +(** + * Helper function to allocate a block of size * nmemb bytes with + * using av_malloc() + * @param nmemb Number of elements + * @param size Size of the single element + * @return Pointer to the allocated block, NULL if the block cannot + * be allocated. + * @see av_malloc() + *) +function av_malloc_array(nmemb: size_t; size: size_t): pointer; {$IFDEF HasInline}inline;{$ENDIF} {av_alloc_size(1, 2)} +// Note: defined in avutil.pas + +(** + * Allocate or reallocate a block of memory. + * If ptr is NULL and size > 0, allocate a new block. If + * size is zero, free the memory block pointed to by ptr. + * @param ptr Pointer to a memory block already allocated with + * av_malloc(z)() or av_realloc() or NULL. + * @param size Size in bytes for the memory block to be allocated or + * reallocated. + * @return Pointer to a newly reallocated block or NULL if the block + * cannot be allocated or the function is used to free the memory block. + * @see av_fast_realloc() + *) +function av_realloc(ptr: pointer; size: size_t): pointer; + cdecl; external av__util; {av_alloc_size(2)} + +(** + * Allocate or reallocate a block of memory. + * This function does the same thing as av_realloc, except: + * - It takes two arguments and checks the result of the multiplication for + * integer overflow. + * - It frees the input block in case of failure, thus avoiding the memory + * leak with the classic "buf = realloc(buf); if (!buf) return -1;". + *) +function av_realloc_f(ptr: pointer; nelem: size_t; elsize: size_t): pointer; + cdecl; external av__util; + +(** + * Free a memory block which has been allocated with av_malloc(z)() or + * av_realloc(). + * @param ptr Pointer to the memory block which should be freed. + * @note ptr = NULL is explicitly allowed. + * @note It is recommended that you use av_freep() instead. + * @see av_freep() + *) +procedure av_free(ptr: pointer); + cdecl; external av__util; + +(** + * Allocate a block of size bytes with alignment suitable for all + * memory accesses (including vectors if available on the CPU) and + * zeroes all the bytes of the block. + * @param size Size in bytes for the memory block to be allocated. + * @return Pointer to the allocated block, NULL if it cannot be allocated. + * @see av_malloc() + *) +function av_mallocz(size: size_t): pointer; + cdecl; external av__util; {av_malloc_attrib av_alloc_size(1)} + +(** + * Allocate a block of nmemb * size bytes with alignment suitable for all + * memory accesses (including vectors if available on the CPU) and + * zero all the bytes of the block. + * The allocation will fail if nmemb * size is greater than or equal + * to INT_MAX. + * @param nmemb + * @param size + * @return Pointer to the allocated block, NULL if it cannot be allocated. + *) +function av_calloc(nmemb: size_t; size: size_t): pointer; + cdecl; external av__util; {av_malloc_attrib} + +(** + * Helper function to allocate a block of size * nmemb bytes with + * using av_mallocz() + * @param nmemb Number of elements + * @param size Size of the single element + * @return Pointer to the allocated block, NULL if the block cannot + * be allocated. + * @see av_mallocz() + * @see av_malloc_array() + *) +function av_mallocz_array(nmemb: size_t; size: size_t): pointer; {$IFDEF HasInline}inline;{$ENDIF} {av_alloc_size(1, 2)} +// Note: defined in avutil.pas + +(** + * Duplicate the string s. + * @param s string to be duplicated. + * @return Pointer to a newly allocated string containing a + * copy of s or NULL if the string cannot be allocated. + *) +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 + * 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. + * @see av_free() + *) +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; + +(** + * Multiply two size_t values checking for overflow. + * @return 0 if success, AVERROR(EINVAL) if overflow. + *) +//static inline int av_size_mult(size_t a, size_t b, size_t *r) +{ + size_t t = a * b; + /* Hack inspired from glibc: only try the division if nelem and elsize + * are both greater than sqrt(SIZE_MAX). */ + if ((a | b) >= ((size_t)1 << (sizeof(size_t) * 4)) && a && t / a != b) + return AVERROR(EINVAL); + *r = t; + return 0; +} + +(** + * Set the maximum size that may me allocated in one block. + *) +procedure av_max_alloc(max: size_t); + cdecl; external av__util; + +(** + * @brief deliberately overlapping memcpy implementation + * @param dst destination buffer + * @param back how many bytes back we start (the initial size of the overlapping window), must be > 0 + * @param cnt number of bytes to copy, must be >= 0 + * + * cnt > back is valid, this will copy the bytes we just copied, + * thus creating a repeating pattern with a period length of back. + *) +procedure av_memcpy_backptr(dst: Pcuint8; back: cint; cnt: cint); + cdecl; external av__util; + diff --git a/src/lib/ffmpeg-1.2/libavutil/opt.pas b/src/lib/ffmpeg-1.2/libavutil/opt.pas new file mode 100644 index 00000000..c4beee95 --- /dev/null +++ b/src/lib/ffmpeg-1.2/libavutil/opt.pas @@ -0,0 +1,589 @@ +(* + * AVOptions + * copyright (c) 2005 Michael Niedermayer <michaelni@gmx.at> + * + * This library 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 + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * This is a part of Pascal porting of ffmpeg. + * - Originally by Victor Zinetz for Delphi and Free Pascal on Windows. + * - For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT + * in the source codes. + * - Changes and updates by the UltraStar Deluxe Team + * + * Conversion of libavutil/opt.h + * avutil version 52.13.100 + * + *) + +type + TAVOptionType = ( +{$IFDEF FF_API_OLD_AVOPTIONS} + FF_OPT_TYPE_FLAGS = 0, + FF_OPT_TYPE_INT, + FF_OPT_TYPE_INT64, + FF_OPT_TYPE_DOUBLE, + FF_OPT_TYPE_FLOAT, + FF_OPT_TYPE_STRING, + FF_OPT_TYPE_RATIONAL, + FF_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length + FF_OPT_TYPE_CONST = 128 +{$ELSE} + AV_OPT_TYPE_FLAGS, + AV_OPT_TYPE_INT, + AV_OPT_TYPE_INT64, + AV_OPT_TYPE_DOUBLE, + AV_OPT_TYPE_FLOAT, + AV_OPT_TYPE_STRING, + AV_OPT_TYPE_RATIONAL, + AV_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length + AV_OPT_TYPE_CONST = 128, + AV_OPT_TYPE_PIXEL_FMT = $50464D54, ///< MKBETAG('P','F','M','T') + AV_OPT_TYPE_SAMPLE_FMT = $53464D54, ///< MKBETAG('S','F','M','T') + AV_OPT_TYPE_IMAGE_SIZE = $53495A45 ///< MKBETAG('S','I','Z','E'), offset must point to two consecutive integers +{$ENDIF} + ); + +const + AV_OPT_FLAG_ENCODING_PARAM = 1; ///< a generic parameter which can be set by the user for muxing or encoding + AV_OPT_FLAG_DECODING_PARAM = 2; ///< a generic parameter which can be set by the user for demuxing or decoding + AV_OPT_FLAG_METADATA = 4; ///< some data extracted or inserted into the file like title, comment, ... + AV_OPT_FLAG_AUDIO_PARAM = 8; + AV_OPT_FLAG_VIDEO_PARAM = 16; + AV_OPT_FLAG_SUBTITLE_PARAM = 32; + AV_OPT_FLAG_FILTERING_PARAM = 1 shl 16; ///< a generic parameter which can be set by the user for filtering + +type + (** + * AVOption + *) + PAVOption = ^TAVOption; + TAVOption = 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: (i64: cint64); + 1: (dbl: cdouble); + 2: (str: PAnsiChar); + (* TODO those are unused now *) + 3: (q: TAVRational); + end; + min: cdouble; ///< minimum valid value for the option + max: cdouble; ///< maximum valid value for the option + + 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; + + (** + * A single allowed range of values, or a single allowed value. + *) + PAVOptionRange = ^TAVOptionRange; + PPAVOptionRange = ^PAVOptionRange; + TAVOptionRange = record + str: {const} PAnsiChar; + value_min, value_max: cdouble; ///< For string ranges this represents the min/max length, for dimensions this represents the min/max pixel count + component_min, component_max: cdouble; ///< For string this represents the unicode range for chars, 0-127 limits to ASCII + is_range: cint; ///< if set to 1 the struct encodes a range, if set to 0 a single value + end; + + (** + * List of AVOptionRange structs + *) + PAVOptionRanges = ^TAVOptionRanges; + PPAVOptionRanges = ^PAVOptionRanges; + TAVOptionRanges = record + range: PPAVOptionRange; + nb_ranges: cint; + end; + +{$IFDEF FF_API_FIND_OPT} +(** + * Look for an option in obj. Look only for the options which + * have the flags set as specified in mask and flags (that is, + * for which it is the case that opt->flags & mask == flags). + * + * @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 the unit of the option to look for, or any if NULL + * @return a pointer to the option found, or NULL if no option + * 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} + +{$IFDEF FF_API_OLD_AVOPTIONS} +(** + * Set the field of obj with the given name to value. + * + * @param[in] obj A struct whose first element is a pointer to an + * AVClass. + * @param[in] name the name of the field to set + * @param[in] val The value to set. If the field is not of a string + * type, then the given string is parsed. + * SI postfixes and some named scalars are supported. + * If the field is of a numeric type, it has to be a numeric or named + * scalar. Behavior with more than one scalar and +- infix operators + * is undefined. + * If the field is of a flags type, it has to be a sequence of numeric + * scalars or named flags separated by '+' or '-'. Prefixing a flag + * with '+' causes it to be set without affecting the other flags; + * similarly, '-' unsets a flag. + * @param[out] o_out if non-NULL put here a pointer to the AVOption + * found + * @param alloc when 1 then the old value will be av_freed() and the + * new av_strduped() + * when 0 then no av_free() nor av_strdup() will be used + * @return 0 if the value has been set, or an AVERROR code in case of + * error: + * AVERROR_OPTION_NOT_FOUND if no matching option exists + * AVERROR(ERANGE) if the value is out of range + * AVERROR(EINVAL) if the value is not valid + * @deprecated use av_opt_set() + *) +function av_set_string3(obj: Pointer; name: {const} PAnsiChar; val: {const} PAnsiChar; alloc: cint; out o_out: {const} PAVOption): cint; + cdecl; external av__util; deprecated; + +function av_set_double(obj: pointer; name: {const} PAnsiChar; n: cdouble): PAVOption; + cdecl; external av__util; deprecated; +function av_set_q (obj: pointer; name: {const} PAnsiChar; n: TAVRational): PAVOption; + cdecl; external av__util; deprecated; +function av_set_int (obj: pointer; name: {const} PAnsiChar; n: cint64): PAVOption; + cdecl; external av__util; deprecated; + +function av_get_double(obj: pointer; name: {const} PAnsiChar; out o_out: {const} PAVOption): cdouble; + cdecl; external av__util; +function av_get_q (obj: pointer; name: {const} PAnsiChar; out o_out: {const} PAVOption): TAVRational; + cdecl; external av__util; +function av_get_int (obj: pointer; name: {const} PAnsiChar; out o_out: {const} PAVOption): cint64; + cdecl; external av__util; +function av_get_string(obj: pointer; name: {const} PAnsiChar; out o_out: {const} PAVOption; buf: PAnsiChar; buf_len: cint): PAnsiChar; + cdecl; external av__util; deprecated; +function av_next_option(obj: pointer; last: {const} PAVOption): PAVOption; + cdecl; external av__util; deprecated; +{$ENDIF} + +(** + * 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; + +(** + * Set the values of all AVOption fields to their default values. + * + * @param s an AVOption-enabled struct (its first member must be a pointer to AVClass) + *) +procedure av_opt_set_defaults(s: pointer); + cdecl; external av__util; + +{$IFDEF FF_API_OLD_AVOPTIONS} +procedure av_opt_set_defaults2(s: Pointer; mask: cint; flags: cint); + cdecl; external av__util; deprecated; +{$ENDIF} + +(** + * 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; + +(** + * Parse the key-value pairs list in opts. For each key=value pair found, + * set the value of the corresponding option in ctx. + * + * @param ctx the AVClass object to set options on + * @param opts the options string, key-value pairs separated by a + * delimiter + * @param shorthand a NULL-terminated array of options names for shorthand + * notation: if the first field in opts has no key part, + * the key is taken from the first element of shorthand; + * then again for the second, etc., until either opts is + * finished, shorthand is finished or a named option is + * found; after that, all options must be named + * @param key_val_sep a 0-terminated list of characters used to separate + * key from value, for example '=' + * @param pairs_sep a 0-terminated list of characters used to separate + * two pairs from each other, for example ':' or ',' + * @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 + * + * Options names must use only the following characters: a-z A-Z 0-9 - . / _ + * Separators must use characters distinct from option names and from each + * other. + *) +function av_opt_set_from_string(ctx: pointer; opts: {const} PAnsiChar; + shorthand: {const} PAnsiChar; + key_val_sep: {const} PAnsiChar; pairs_sep: {const} PAnsiChar): cint; + cdecl; external av__util; + +(** + * Free all string and binary options in obj. + *) +procedure av_opt_free(obj: pointer); + cdecl; external av__util; + +(** + * Check whether a particular flag is set in a flags field. + * + * @param field_name the name of the flag field option + * @param flag_name the name of the flag to check + * @return non-zero if the flag is set, zero if the flag isn't set, + * isn't of the right type, or the flags field doesn't exist. + *) +function av_opt_flag_is_set(obj: pointer; field_name: {const} PAnsiChar; flag_name: {const} PAnsiChar): cint; + cdecl; external av__util; + +(** + * Set all the options from a given dictionary on an object. + * + * @param obj a struct whose first element is a pointer to AVClass + * @param options options to process. This dictionary will be freed and replaced + * by a new one containing all options not found in obj. + * Of course this new dictionary needs to be freed by caller + * with av_dict_free(). + * + * @return 0 on success, a negative AVERROR if some option was found in obj, + * but could not be set. + * + * @see av_dict_copy() + *) +function av_opt_set_dict(obj: pointer; var options: PAVDictionary): cint; + cdecl; external av__util; + +(** + * Extract a key-value pair from the beginning of a string. + * + * @param ropts pointer to the options string, will be updated to + * point to the rest of the string (one of the pairs_sep + * or the final NUL) + * @param key_val_sep a 0-terminated list of characters used to separate + * key from value, for example '=' + * @param pairs_sep a 0-terminated list of characters used to separate + * two pairs from each other, for example ':' or ',' + * @param flags flags; see the AV_OPT_FLAG_* values below + * @param rkey parsed key; must be freed using av_free() + * @param rval parsed value; must be freed using av_free() + * + * @return >=0 for success, or a negative value corresponding to an + * AVERROR code in case of error; in particular: + * AVERROR(EINVAL) if no key is present + * + *) +av_opt_get_key_value(ropts: {const} PPAnsiChar; + key_val_sep: {const} PAnsiChar; pairs_sep: {const} PAnsiChar + flags: byte, + rkey, rval: PPAnsiChar): cint; + cdecl; external av__util; + +const + (** + * Accept to parse a value without a key; the key will then be returned + * as NULL. + *) + AV_OPT_FLAG_IMPLICIT_KEY = 1; + +(** + * @defgroup opt_eval_funcs Evaluating option strings + * @{ + * This group of functions can be used to evaluate option strings + * and get numbers out of them. They do the same thing as av_opt_set(), + * except the result is written into the caller-supplied pointer. + * + * @param obj a struct whose first element is a pointer to AVClass. + * @param o an option for which the string is to be evaluated. + * @param val string to be evaluated. + * @param *_out value of the string will be written here. + * + * @return 0 on success, a negative number on failure. + *) +function av_opt_eval_flags (obj: pointer; o: {const} PAVOption; val: {const} PAnsiChar; flags_out: Pcint): cint; +function av_opt_eval_int (obj: pointer; o: {const} PAVOption; val: {const} PAnsiChar; int_out: Pcint): cint; +function av_opt_eval_int64 (obj: pointer; o: {const} PAVOption; val: {const} PAnsiChar; int64_out: Pcint64): cint; +function av_opt_eval_float (obj: pointer; o: {const} PAVOption; val: {const} PAnsiChar; float_out: Pcfloat): cint; +function av_opt_eval_double(obj: pointer; o: {const} PAVOption; val: {const} PAnsiChar; double_out: Pcdouble): cint; +function av_opt_eval_q (obj: pointer; o: {const} PAVOption; val: {const} PAnsiChar; q_out: PAVRational): cint; +(** + * @} + *) + + const + AV_OPT_SEARCH_CHILDREN = 0001; (**< Search in possible children of the + given object first.*) +(** + * The obj passed to av_opt_find() is fake -- only a double pointer to AVClass + * instead of a required pointer to a struct containing AVClass. This is + * useful for searching for options without needing to allocate the corresponding + * object. + *) + AV_OPT_SEARCH_FAKE_OBJ = 0002; + +(** + * 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; + +(** + * 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. + * Alternatively a double pointer to an AVClass, if + * AV_OPT_SEARCH_FAKE_OBJ search flag is set. + * @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_*. + * @param[out] target_obj if non-NULL, an object to which the option belongs will be + * written here. It may be different from obj if AV_OPT_SEARCH_CHILDREN is present + * in search_flags. This parameter is ignored if search_flags contain + * AV_OPT_SEARCH_FAKE_OBJ. + * + * @return A pointer to the option found, or NULL if no option + * was found. + *) +function av_opt_find2(obj: pointer; name: {const} PAnsiChar; unit_: {const} PAnsiChar; + opt_flags: cint; search_flags: cint; out target_obj: pointer): {const} PAVOption; + cdecl; external av__util; + +(** + * Iterate over all AVOptions belonging to obj. + * + * @param obj an AVOptions-enabled struct or a double pointer to an + * AVClass describing it. + * @param prev result of the previous call to av_opt_next() on this object + * or NULL + * @return next AVOption or NULL + *) +function av_opt_next(obj: pointer; prev: {const} PAVOption): {const} PAVOption; + cdecl; external av__util; + +(** + * Iterate over AVOptions-enabled children of obj. + * + * @param prev result of a previous call to this function or NULL + * @return next AVOptions-enabled child or NULL + *) +function av_opt_child_next(obj: pointer; prev: pointer): pointer; + cdecl; external av__util; + +(** + * Iterate over potential AVOptions-enabled children of parent. + * + * @param prev result of a previous call to this function or NULL + * @return AVClass corresponding to next potential child or NULL + *) +function av_opt_child_class_next(parent: {const} PAVClass; prev: {const} PAVClass): {const} PAVClass; + cdecl; external av__util; + +(** + * @defgroup opt_set_funcs Option setting functions + * @{ + * Those functions set the field of obj with the given name to value. + * + * @param[in] obj A struct whose first element is a pointer to an AVClass. + * @param[in] name the name of the field to set + * @param[in] val The value to set. In case of av_opt_set() if the field is not + * of a string type, then the given string is parsed. + * SI postfixes and some named scalars are supported. + * If the field is of a numeric type, it has to be a numeric or named + * scalar. Behavior with more than one scalar and +- infix operators + * is undefined. + * If the field is of a flags type, it has to be a sequence of numeric + * scalars or named flags separated by '+' or '-'. Prefixing a flag + * with '+' causes it to be set without affecting the other flags; + * similarly, '-' unsets a flag. + * @param search_flags flags passed to av_opt_find2. I.e. if AV_OPT_SEARCH_CHILDREN + * is passed here, then the option may be set on a child of obj. + * + * @return 0 if the value has been set, or an AVERROR code in case of + * error: + * AVERROR_OPTION_NOT_FOUND if no matching option exists + * AVERROR(ERANGE) if the value is out of range + * AVERROR(EINVAL) if the value is not valid + *) +function av_opt_set (obj: pointer; name: {const} PAnsiChar; val: {const} PAnsiChar; search_flags: cint): cint; + cdecl; external av__util; +function av_opt_set_int (obj: pointer; name: {const} PAnsiChar; val: cint64; search_flags: cint): cint; + cdecl; external av__util; +function av_opt_set_double (obj: pointer; name: {const} PAnsiChar; val: cdouble; search_flags: cint): cint; + cdecl; external av__util; +function av_opt_set_q (obj: pointer; name: {const} PAnsiChar; val: TAVRational; search_flags: cint): cint; + cdecl; external av__util; +function av_opt_set_bin (obj: pointer; name: {const} PAnsiChar; val: {const} cuint8; search_flags: cint): cint; + cdecl; external av__util; +function av_opt_set_image_size(obj: pointer; name: {const} PAnsiChar; w, h, search_flags: cint): cint; + cdecl; external av__util; +function av_opt_set_pixel_fmt (obj: pointer; name: {const} PAnsiChar; fmt: TAVPixelFormat; search_flags: cint): cint; + cdecl; external av__util; +function av_opt_set_sample_fmt(obj: pointer; name: {const} PAnsiChar; fmt: TAVPixelFormat; search_flags: cint): cint; + cdecl; external av__util; +(** + * @} + *) + +(** + * @defgroup opt_get_funcs Option getting functions + * @{ + * Those functions get a value of the option with the given name from an object. + * + * @param[in] obj a struct whose first element is a pointer to an AVClass. + * @param[in] name name of the option to get. + * @param[in] search_flags flags passed to av_opt_find2. I.e. if AV_OPT_SEARCH_CHILDREN + * is passed here, then the option may be found in a child of obj. + * @param[out] out_val value of the option will be written here + * @return 0 on success, a negative error code otherwise + *) +(** + * @note the returned string will av_malloc()ed and must be av_free()ed by the caller + *) +function av_opt_get (obj: pointer; name: {const} PAnsiChar; search_flags: cint; out out_val: Pcuint8): cint; + cdecl; external av__util; +function av_opt_get_int (obj: pointer; name: {const} PAnsiChar; search_flags: cint; out_val: Pcint64): cint; + cdecl; external av__util; +function av_opt_get_double (obj: pointer; name: {const} PAnsiChar; search_flags: cint; out_val: Pcdouble): cint; + cdecl; external av__util; +function av_opt_get_q (obj: pointer; name: {const} PAnsiChar; search_flags: cint; out_val: PAVRational): cint; + cdecl; external av__util; +function av_opt_get_image_size(obj: pointer; name: {const} PAnsiChar; search_flags: cint; w_out, h_out: Pcint): cint; + cdecl; external av__util; +function av_opt_get_pixel_fmt (obj: pointer; name: {const} PAnsiChar; search_flags: cint; out_fmt: PAVPixelFormat): cint; + cdecl; external av__util; +function av_opt_get_sample_fmt(obj: pointer; name: {const} PAnsiChar; search_flags: cint; out_fmt: PAVPixelFormat): cint; + cdecl; external av__util; +(** + * @} + *) +(** + * Gets a pointer to the requested field in a struct. + * This function allows accessing a struct even when its fields are moved or + * renamed since the application making the access has been compiled, + * + * @returns a pointer to the field, it can be cast to the correct type and read + * or written to. + *) +function av_opt_ptr(avclass: {const} PAVClass; obj: pointer; name: {const} PAnsiChar): pointer; + cdecl; external av__util; + +(** + * Free an AVOptionRanges struct and set it to NULL. + *) +procedure av_opt_freep_ranges(ranges: PPAVOptionRanges); + cdecl; external av__util; + +(** + * Get a list of allowed ranges for the given option. + * + * The returned list may depend on other fields in obj like for example profile. + * + * @param flags is a bitmask of flags, undefined flags should not be set and should be ignored + * AV_OPT_SEARCH_FAKE_OBJ indicates that the obj is a double pointer to a AVClass instead of a full instance + * + * The result must be freed with av_opt_freep_ranges. + * + * @return >= 0 on success, a negative errro code otherwise + *) +function av_opt_query_ranges(P: PPAVOptionRanges; obj: pointer; key: {const} PAnsiChar; flags: cint): cint; + cdecl; external av__util; + +(** + * Get a default list of allowed ranges for the given option. + * + * This list is constructed without using the AVClass.query_ranges() callback + * and can be used as fallback from within the callback. + * + * @param flags is a bitmask of flags, undefined flags should not be set and should be ignored + * AV_OPT_SEARCH_FAKE_OBJ indicates that the obj is a double pointer to a AVClass instead of a full instance + * + * The result must be freed with av_opt_free_ranges. + * + * @return >= 0 on success, a negative errro code otherwise + *) +function av_opt_query_ranges_default(P: PPAVOptionRanges; obj: pointer; key: {const} PAnsiChar; flags: cint): cint; + cdecl; external av__util; + +(** + * @} + *) diff --git a/src/lib/ffmpeg-1.2/libavutil/pixfmt.pas b/src/lib/ffmpeg-1.2/libavutil/pixfmt.pas new file mode 100644 index 00000000..6c57e707 --- /dev/null +++ b/src/lib/ffmpeg-1.2/libavutil/pixfmt.pas @@ -0,0 +1,412 @@ +(* + * 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 + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * This is a part of the Pascal port of ffmpeg. + * - Changes and updates by the UltraStar Deluxe Team + * + * Conversion of libavutil/pixfmt.h + * avutil version 52.13.100 + * + *) + +(** + * @file + * Pixel format + *) + +const + AVPALETTE_SIZE = 1024; + AVPALETTE_COUNT = 256; + +type +(** + * Pixel format. Notes: + * + * @note + * PIX_FMT_RGB32 is handled in an endian-specific manner. An RGBA + * color is put together as: + * (A << 24) | (R << 16) | (G << 8) | B + * This is stored as BGRA on little-endian CPU architectures and ARGB on + * big-endian CPUs. + * + * @par + * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized + * image data is stored in AVFrame.data[0]. The palette is transported in + * AVFrame.data[1], is 1024 bytes long (256 4-byte entries) and is + * formatted the same as in PIX_FMT_RGB32 described above (i.e., it is + * also endian-specific). Note also that the individual RGB palette + * components stored in AVFrame.data[1] should be in the range 0..255. + * This is important as many custom PAL8 video codecs that were designed + * to run on the IBM VGA graphics adapter use 6-bit palette components. + * + * @par + * For all the 8bit per pixel formats, an RGB32 palette is in data[1] like + * for pal8. This palette is filled in automatically by the function + * 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. + *) + + PAVPixelFormat = ^TAVPixelFormat; + TAVPixelFormat = ( + AV_PIX_FMT_NONE = -1, + AV_PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) + AV_PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr + AV_PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB... + AV_PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR... + AV_PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) + AV_PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) + AV_PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) + AV_PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) + AV_PIX_FMT_GRAY8, ///< Y , 8bpp + AV_PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb + AV_PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb + AV_PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette + AV_PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_range + AV_PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_range + AV_PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_range + AV_PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing + AV_PIX_FMT_XVMC_MPEG2_IDCT, + AV_PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 + AV_PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 + AV_PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) + AV_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 + AV_PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) + AV_PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) + AV_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 + AV_PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb) + AV_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) + AV_PIX_FMT_NV21, ///< as above, but U and V bytes are swapped + + AV_PIX_FMT_ARGB, ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB... + AV_PIX_FMT_RGBA, ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA... + AV_PIX_FMT_ABGR, ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR... + AV_PIX_FMT_BGRA, ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA... + + AV_PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian + AV_PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian + AV_PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples) + AV_PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of PIX_FMT_YUV440P and setting color_range + AV_PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples) + AV_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 + AV_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 + AV_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 + AV_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 + AV_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 + AV_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 + AV_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 + + AV_PIX_FMT_RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian + AV_PIX_FMT_RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian + AV_PIX_FMT_RGB555BE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), big-endian, most significant bit to 0 + AV_PIX_FMT_RGB555LE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), little-endian, most significant bit to 0 + + AV_PIX_FMT_BGR565BE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian + AV_PIX_FMT_BGR565LE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian + AV_PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), big-endian, most significant bit to 1 + AV_PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), little-endian, most significant bit to 1 + + AV_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 + AV_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 + AV_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 + + AV_PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV422P16LE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_YUV422P16BE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_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 + AV_PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer + + AV_PIX_FMT_RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), little-endian, most significant bits to 0 + AV_PIX_FMT_RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), big-endian, most significant bits to 0 + AV_PIX_FMT_BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), little-endian, most significant bits to 1 + AV_PIX_FMT_BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), big-endian, most significant bits to 1 + AV_PIX_FMT_GRAY8A, ///< 8bit gray, 8bit alpha + AV_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 + AV_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 AV_PIX_FMT_YUV420P16* with the bpp stored separately + //is better + AV_PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_YUV422P9BE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_VDA_VLD, ///< hardware decoding through VDA + +{$IFDEF AV_PIX_FMT_ABI_GIT_MASTER} + AV_PIX_FMT_RGBA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian + AV_PIX_FMT_RGBA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian + AV_PIX_FMT_BGRA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian + AV_PIX_FMT_BGRA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian +{$ENDIF} + AV_PIX_FMT_GBRP, ///< planar GBR 4:4:4 24bpp + AV_PIX_FMT_GBRP9BE, ///< planar GBR 4:4:4 27bpp, big-endian + AV_PIX_FMT_GBRP9LE, ///< planar GBR 4:4:4 27bpp, little-endian + AV_PIX_FMT_GBRP10BE, ///< planar GBR 4:4:4 30bpp, big-endian + AV_PIX_FMT_GBRP10LE, ///< planar GBR 4:4:4 30bpp, little-endian + AV_PIX_FMT_GBRP16BE, ///< planar GBR 4:4:4 48bpp, big-endian + AV_PIX_FMT_GBRP16LE, ///< planar GBR 4:4:4 48bpp, little-endian + + /** + * duplicated pixel formats for compatibility with libav. + * FFmpeg supports these formats since May 8 2012 and Jan 28 2012 (commits f9ca1ac7 and 143a5c55) + * Libav added them Oct 12 2012 with incompatible values (commit 6d5600e85) + */ + AV_PIX_FMT_YUVA422P_LIBAV, ///< planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples) + AV_PIX_FMT_YUVA444P_LIBAV, ///< planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples) + + AV_PIX_FMT_YUVA420P9BE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), big-endian + AV_PIX_FMT_YUVA420P9LE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), little-endian + AV_PIX_FMT_YUVA422P9BE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian + AV_PIX_FMT_YUVA422P9LE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), little-endian + AV_PIX_FMT_YUVA444P9BE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big-endian + AV_PIX_FMT_YUVA444P9LE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), little-endian + AV_PIX_FMT_YUVA420P10BE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian) + AV_PIX_FMT_YUVA420P10LE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian) + AV_PIX_FMT_YUVA422P10BE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA422P10LE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian) + AV_PIX_FMT_YUVA444P10BE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA444P10LE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian) + AV_PIX_FMT_YUVA420P16BE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian) + AV_PIX_FMT_YUVA420P16LE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian) + AV_PIX_FMT_YUVA422P16BE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA422P16LE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian) + AV_PIX_FMT_YUVA444P16BE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA444P16LE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian) + + AV_PIX_FMT_VDPAU, ///< HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface + + AV_PIX_FMT_XYZ12LE, ///< packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb), the 2-byte value for each X/Y/Z is stored as little-endian, the 4 lower bits are set to 0 + AV_PIX_FMT_XYZ12BE, ///< packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb), the 2-byte value for each X/Y/Z is stored as big-endian, the 4 lower bits are set to 0 + +{$IFNDEF AV_PIX_FMT_ABI_GIT_MASTER} + AV_PIX_FMT_RGBA64BE = $123, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian + AV_PIX_FMT_RGBA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian + AV_PIX_FMT_BGRA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian + AV_PIX_FMT_BGRA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian +{$ENDIF} + AV_PIX_FMT_0RGB = $123 + 4, ///< packed RGB 8:8:8, 32bpp, 0RGB0RGB... + AV_PIX_FMT_RGB0, ///< packed RGB 8:8:8, 32bpp, RGB0RGB0... + AV_PIX_FMT_0BGR, ///< packed BGR 8:8:8, 32bpp, 0BGR0BGR... + AV_PIX_FMT_BGR0, ///< packed BGR 8:8:8, 32bpp, BGR0BGR0... + AV_PIX_FMT_YUVA444P, ///< planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples) + AV_PIX_FMT_YUVA422P, ///< planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples) + + AV_PIX_FMT_YUV420P12BE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV420P12LE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV420P14BE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV420P14LE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV422P12BE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV422P12LE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_YUV422P14BE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV422P14LE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_YUV444P12BE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_PIX_FMT_YUV444P12LE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_YUV444P14BE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_PIX_FMT_YUV444P14LE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_GBRP12BE, ///< planar GBR 4:4:4 36bpp, big-endian + AV_PIX_FMT_GBRP12LE, ///< planar GBR 4:4:4 36bpp, little-endian + AV_PIX_FMT_GBRP14BE, ///< planar GBR 4:4:4 42bpp, big-endian + AV_PIX_FMT_GBRP14LE, ///< planar GBR 4:4:4 42bpp, little-endian + AV_PIX_FMT_GBRAP, ///< planar GBRA 4:4:4:4 32bpp + AV_PIX_FMT_GBRAP16BE, ///< planar GBRA 4:4:4:4 64bpp, big-endian + AV_PIX_FMT_GBRAP16LE, ///< planar GBRA 4:4:4:4 64bpp, little-endian + AV_PIX_FMT_YUVJ411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor of PIX_FMT_YUV411P and setting color_range + AV_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 + ); + +{$IFDEF AV_HAVE_INCOMPATIBLE_LIBAV_ABI} +const + AV_PIX_FMT_YUVA422P = AV_PIX_FMT_YUVA422P_LIBAV; + AV_PIX_FMT_YUVA444P = AV_PIX_FMT_YUVA444P_LIBAV; +{$ENDIF} + +const + AV_PIX_FMT_Y400A = AV_PIX_FMT_GRAY8A; + AV_PIX_FMT_GBR24P = AV_PIX_FMT_GBRP; + +{$IFDEF WORDS_BIGENDIAN} + AV_PIX_FMT_RGB32 = AV_PIX_FMT_ARGB; + AV_PIX_FMT_RGB32_1 = AV_PIX_FMT_RGBA; + AV_PIX_FMT_BGR32 = AV_PIX_FMT_ABGR; + AV_PIX_FMT_BGR32_1 = AV_PIX_FMT_BGRA; + AV_PIX_FMT_0RGB32 = AV_PIX_FMT_0RGB; + AV_PIX_FMT_0BGR32 = AV_PIX_FMT_0BGR; + + AV_PIX_FMT_GRAY16 = AV_PIX_FMT_GRAY16BE; + AV_PIX_FMT_RGB48 = AV_PIX_FMT_RGB48BE; + AV_PIX_FMT_RGB565 = AV_PIX_FMT_RGB565BE; + AV_PIX_FMT_RGB555 = AV_PIX_FMT_RGB555BE; + AV_PIX_FMT_RGB444 = AV_PIX_FMT_RGB444BE; + AV_PIX_FMT_BGR48 = AV_PIX_FMT_BGR48BE; + AV_PIX_FMT_BGR565 = AV_PIX_FMT_BGR565BE; + AV_PIX_FMT_BGR555 = AV_PIX_FMT_BGR555BE; + AV_PIX_FMT_BGR444 = AV_PIX_FMT_BGR444BE; + + AV_PIX_FMT_YUV420P9 = AV_PIX_FMT_YUV420P9BE; + AV_PIX_FMT_YUV422P9 = AV_PIX_FMT_YUV422P9BE; + AV_PIX_FMT_YUV444P9 = AV_PIX_FMT_YUV444P9BE; + AV_PIX_FMT_YUV420P10 = AV_PIX_FMT_YUV420P10BE; + AV_PIX_FMT_YUV422P10 = AV_PIX_FMT_YUV422P10BE; + AV_PIX_FMT_YUV444P10 = AV_PIX_FMT_YUV444P10BE; + AV_PIX_FMT_YUV420P12 = AV_PIX_FMT_YUV420P12BE; + AV_PIX_FMT_YUV422P12 = AV_PIX_FMT_YUV422P12BE; + AV_PIX_FMT_YUV444P12 = AV_PIX_FMT_YUV444P12BE; + AV_PIX_FMT_YUV420P14 = AV_PIX_FMT_YUV420P14BE; + AV_PIX_FMT_YUV422P14 = AV_PIX_FMT_YUV422P14BE; + AV_PIX_FMT_YUV444P14= AV_PIX_FMT_YUV444P14BE; + AV_PIX_FMT_YUV420P16 = AV_PIX_FMT_YUV420P16BE; + AV_PIX_FMT_YUV422P16 = AV_PIX_FMT_YUV422P16BE; + AV_PIX_FMT_YUV444P16 = AV_PIX_FMT_YUV444P16BE; + + AV_PIX_FMT_RGBA64 = AV_PIX_FMT_RGBA64BE; + AV_PIX_FMT_BGRA64 = AV_PIX_FMT_BGRA64BE; + AV_PIX_FMT_GBRP9 = AV_PIX_FMT_GBRP9BE; + AV_PIX_FMT_GBRP10 = AV_PIX_FMT_GBRP10BE; + AV_PIX_FMT_GBRP12 = AV_PIX_FMT_GBRP12BE; + AV_PIX_FMT_GBRP14 = AV_PIX_FMT_GBRP14BE; + AV_PIX_FMT_GBRP16 = AV_PIX_FMT_GBRP16BE; + + AV_PIX_FMT_YUVA420P9 = AV_PIX_FMT_YUVA420P9BE; + AV_PIX_FMT_YUVA422P9 = AV_PIX_FMT_YUVA422P9BE; + AV_PIX_FMT_YUVA444P9 = AV_PIX_FMT_YUVA444P9BE; + AV_PIX_FMT_YUVA420P10 = AV_PIX_FMT_YUVA420P10BE; + AV_PIX_FMT_YUVA422P10 = AV_PIX_FMT_YUVA422P10BE; + AV_PIX_FMT_YUVA444P10 = AV_PIX_FMT_YUVA444P10BE; + AV_PIX_FMT_YUVA420P16 = AV_PIX_FMT_YUVA420P16BE; + AV_PIX_FMT_YUVA422P16 = AV_PIX_FMT_YUVA422P16BE; + AV_PIX_FMT_YUVA444P16 = AV_PIX_FMT_YUVA444P16BE; + + AV_PIX_FMT_XYZ12 = AV_PIX_FMT_XYZ12BE; +{$ELSE} + AV_PIX_FMT_RGB32 = AV_PIX_FMT_BGRA; + AV_PIX_FMT_RGB32_1 = AV_PIX_FMT_ABGR; + AV_PIX_FMT_BGR32 = AV_PIX_FMT_RGBA; + AV_PIX_FMT_BGR32_1 = AV_PIX_FMT_ARGB; + AV_PIX_FMT_0RGB32 = AV_PIX_FMT_BGR0; + AV_PIX_FMT_0BGR32 = AV_PIX_FMT_RGB0; + + AV_PIX_FMT_GRAY16 = AV_PIX_FMT_GRAY16LE; + AV_PIX_FMT_RGB48 = AV_PIX_FMT_RGB48LE; + AV_PIX_FMT_RGB565 = AV_PIX_FMT_RGB565LE; + AV_PIX_FMT_RGB555 = AV_PIX_FMT_RGB555LE; + AV_PIX_FMT_RGB444 = AV_PIX_FMT_RGB444LE; + AV_PIX_FMT_BGR48 = AV_PIX_FMT_BGR48LE; + AV_PIX_FMT_BGR565 = AV_PIX_FMT_BGR565LE; + AV_PIX_FMT_BGR555 = AV_PIX_FMT_BGR555LE; + AV_PIX_FMT_BGR444 = AV_PIX_FMT_BGR444LE; + + AV_PIX_FMT_YUV420P9 = AV_PIX_FMT_YUV420P9LE; + AV_PIX_FMT_YUV422P9 = AV_PIX_FMT_YUV422P9LE; + AV_PIX_FMT_YUV444P9 = AV_PIX_FMT_YUV444P9LE; + AV_PIX_FMT_YUV420P10 = AV_PIX_FMT_YUV420P10LE; + AV_PIX_FMT_YUV422P10 = AV_PIX_FMT_YUV422P10LE; + AV_PIX_FMT_YUV444P10 = AV_PIX_FMT_YUV444P10LE; + AV_PIX_FMT_YUV420P12 = AV_PIX_FMT_YUV420P12LE; + AV_PIX_FMT_YUV422P12 = AV_PIX_FMT_YUV422P12LE; + AV_PIX_FMT_YUV444P12 = AV_PIX_FMT_YUV444P12LE; + AV_PIX_FMT_YUV420P14 = AV_PIX_FMT_YUV420P14LE; + AV_PIX_FMT_YUV422P14 = AV_PIX_FMT_YUV422P14LE; + AV_PIX_FMT_YUV444P14= AV_PIX_FMT_YUV444P14LE; + AV_PIX_FMT_YUV420P16 = AV_PIX_FMT_YUV420P16LE; + AV_PIX_FMT_YUV422P16 = AV_PIX_FMT_YUV422P16LE; + AV_PIX_FMT_YUV444P16 = AV_PIX_FMT_YUV444P16LE; + + AV_PIX_FMT_RGBA64 = AV_PIX_FMT_RGBA64LE; + AV_PIX_FMT_BGRA64 = AV_PIX_FMT_BGRA64LE; + AV_PIX_FMT_GBRP9 = AV_PIX_FMT_GBRP9LE; + AV_PIX_FMT_GBRP10 = AV_PIX_FMT_GBRP10LE; + AV_PIX_FMT_GBRP12 = AV_PIX_FMT_GBRP12LE; + AV_PIX_FMT_GBRP14 = AV_PIX_FMT_GBRP14LE; + AV_PIX_FMT_GBRP16 = AV_PIX_FMT_GBRP16LE; + + AV_PIX_FMT_YUVA420P9 = AV_PIX_FMT_YUVA420P9LE; + AV_PIX_FMT_YUVA422P9 = AV_PIX_FMT_YUVA422P9LE; + AV_PIX_FMT_YUVA444P9 = AV_PIX_FMT_YUVA444P9LE; + AV_PIX_FMT_YUVA420P10 = AV_PIX_FMT_YUVA420P10LE; + AV_PIX_FMT_YUVA422P10 = AV_PIX_FMT_YUVA422P10LE; + AV_PIX_FMT_YUVA444P10 = AV_PIX_FMT_YUVA444P10LE; + AV_PIX_FMT_YUVA420P16 = AV_PIX_FMT_YUVA420P16LE; + AV_PIX_FMT_YUVA422P16 = AV_PIX_FMT_YUVA422P16LE; + AV_PIX_FMT_YUVA444P16 = AV_PIX_FMT_YUVA444P16LE; + + AV_PIX_FMT_XYZ12 = AV_PIX_FMT_XYZ12LE; +{$ENDIF} + +{$IFDEF FF_API_PIX_FMT} +type + PixelFormat = AVPixelFormat; + +const + PIX_FMT_Y400A = AV_PIX_FMT_Y400A; + PIX_FMT_GBR24P = AV_PIX_FMT_GBR24P; + + PIX_FMT_RGB32 = AV_PIX_FMT_RGB32; + PIX_FMT_RGB32_1 = AV_PIX_FMT_RGB32_1; + PIX_FMT_BGR32 = AV_PIX_FMT_BGR32; + PIX_FMT_BGR32_1 = AV_PIX_FMT_BGR32_1; + PIX_FMT_0RGB32 = AV_PIX_FMT_0RGB32; + PIX_FMT_0BGR32 = AV_PIX_FMT_0BGR32; + + PIX_FMT_GRAY16 = AV_PIX_FMT_GRAY16; + PIX_FMT_RGB48 = AV_PIX_FMT_RGB48; + PIX_FMT_RGB565 = AV_PIX_FMT_RGB565; + PIX_FMT_RGB555 = AV_PIX_FMT_RGB555; + PIX_FMT_RGB444 = AV_PIX_FMT_RGB444; + PIX_FMT_BGR48 = AV_PIX_FMT_BGR48; + PIX_FMT_BGR565 = AV_PIX_FMT_BGR565; + PIX_FMT_BGR555 = AV_PIX_FMT_BGR555; + PIX_FMT_BGR444 = AV_PIX_FMT_BGR444; + + PIX_FMT_YUV420P9 = AV_PIX_FMT_YUV420P9; + PIX_FMT_YUV422P9 = AV_PIX_FMT_YUV422P9; + PIX_FMT_YUV444P9 = AV_PIX_FMT_YUV444P9; + PIX_FMT_YUV420P10 = AV_PIX_FMT_YUV420P10; + PIX_FMT_YUV422P10 = AV_PIX_FMT_YUV422P10; + PIX_FMT_YUV444P10 = AV_PIX_FMT_YUV444P10; + PIX_FMT_YUV420P12 = AV_PIX_FMT_YUV420P12; + PIX_FMT_YUV422P12 = AV_PIX_FMT_YUV422P12; + PIX_FMT_YUV444P12 = AV_PIX_FMT_YUV444P12; + PIX_FMT_YUV420P14 = AV_PIX_FMT_YUV420P14; + PIX_FMT_YUV422P14 = AV_PIX_FMT_YUV422P14; + PIX_FMT_YUV444P14 = AV_PIX_FMT_YUV444P14; + PIX_FMT_YUV420P16 = AV_PIX_FMT_YUV420P16; + PIX_FMT_YUV422P16 = AV_PIX_FMT_YUV422P16; + PIX_FMT_YUV444P16 = AV_PIX_FMT_YUV444P16; + + PIX_FMT_RGBA64 = AV_PIX_FMT_RGBA64; + PIX_FMT_BGRA64 = AV_PIX_FMT_BGRA64; + PIX_FMT_GBRP9 = AV_PIX_FMT_GBRP9; + PIX_FMT_GBRP10 = AV_PIX_FMT_GBRP10; + PIX_FMT_GBRP12 = AV_PIX_FMT_GBRP12; + PIX_FMT_GBRP14 = AV_PIX_FMT_GBRP14; + PIX_FMT_GBRP16 = AV_PIX_FMT_GBRP16; +{$ENDIF} diff --git a/src/lib/ffmpeg-1.2/libavutil/samplefmt.pas b/src/lib/ffmpeg-1.2/libavutil/samplefmt.pas new file mode 100644 index 00000000..30661712 --- /dev/null +++ b/src/lib/ffmpeg-1.2/libavutil/samplefmt.pas @@ -0,0 +1,260 @@ +(* + * SampleFormat + * copyright (c) 2011 Karl-Michael Schindler <karl-michael.schindler@web.de> + * + * This library 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 + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * This is a part of the Pascal port of ffmpeg. + * + * Conversion of libavutil/samplefmt.h + * avutil version 52.13.100 + * + *) + +type +(** + * Audio Sample Formats + * + * @par + * The data described by the sample format is always in native-endian order. + * Sample values can be expressed by native C types, hence the lack of a signed + * 24-bit sample format even though it is a common raw audio data format. + * + * @par + * The floating-point formats are based on full volume being in the range + * [-1.0, 1.0]. Any values outside this range are beyond full volume level. + * + * @par + * The data layout as used in av_samples_fill_arrays() and elsewhere in FFmpeg + * (such as AVFrame in libavcodec) is as follows: + * + * For planar sample formats, each audio channel is in a separate data plane, + * and linesize is the buffer size, in bytes, for a single plane. All data + * planes must be the same size. For packed sample formats, only the first data + * plane is used, and samples for each channel are interleaved. In this case, + * linesize is the buffer size, in bytes, for the 1 plane. + *) + TAVSampleFormat = ( + AV_SAMPLE_FMT_NONE = -1, + AV_SAMPLE_FMT_U8, ///< unsigned 8 bits + AV_SAMPLE_FMT_S16, ///< signed 16 bits + AV_SAMPLE_FMT_S32, ///< signed 32 bits + AV_SAMPLE_FMT_FLT, ///< float + AV_SAMPLE_FMT_DBL, ///< double + + AV_SAMPLE_FMT_U8P, ///< unsigned 8 bits, planar + AV_SAMPLE_FMT_S16P, ///< signed 16 bits, planar + AV_SAMPLE_FMT_S32P, ///< signed 32 bits, planar + AV_SAMPLE_FMT_FLTP, ///< float, planar + AV_SAMPLE_FMT_DBLP, ///< double, planar + + AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if linking dynamically + ); + TAVSampleFormatArray = array [0 .. MaxInt div SizeOf(TAVSampleFormat) - 1] of TAVSampleFormat; + PAVSampleFormatArray = ^TAVSampleFormatArray; + +(** + * Return the name of sample_fmt, or NULL if sample_fmt is not + * recognized. + *) +function av_get_sample_fmt_name(sample_fmt: TAVSampleFormat): {const} PAnsiChar; + cdecl; external av__util; + +(** + * Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE + * on error. + *) +function av_get_sample_fmt(name: {const} PAnsiChar): TAVSampleFormat; + cdecl; external av__util; + +(** + * Return the planar<->packed alternative form of the given sample format, or + * AV_SAMPLE_FMT_NONE on error. If the passed sample_fmt is already in the + * requested planar/packed format, the format returned is the same as the + * input. + *) +function av_get_alt_sample_fmt(sample_fmt: TAVSampleFormat; planar: cint): TAVSampleFormat; + cdecl; external av__util; + +(** + * Get the packed alternative form of the given sample format. + * + * If the passed sample_fmt is already in packed format, the format returned is + * the same as the input. + * + * @return the packed alternative form of the given sample format or + AV_SAMPLE_FMT_NONE on error. + *) +function av_get_packed_sample_fmt(sample_fmt: TAVSampleFormat): TAVSampleFormat; + cdecl; external av__util; + +(** + * Get the planar alternative form of the given sample format. + * + * If the passed sample_fmt is already in planar format, the format returned is + * the same as the input. + * + * @return the planar alternative form of the given sample format or + AV_SAMPLE_FMT_NONE on error. + *) +function av_get_planar_sample_fmt(sample_fmt: TAVSampleFormat): TAVSampleFormat; + cdecl; external av__util; + +(** + * Generate a string corresponding to the sample format with + * sample_fmt, or a header if sample_fmt is negative. + * + * @param buf the buffer where to write the string + * @param buf_size the size of buf + * @param sample_fmt the number of the sample format to print the + * corresponding info string, or a negative value to print the + * corresponding header. + * @return the pointer to the filled buffer or NULL if sample_fmt is + * unknown or in case of other errors + *) +function av_get_sample_fmt_string(buf: PAnsiChar; buf_size: cint; sample_fmt: TAVSampleFormat): PAnsiChar; + cdecl; external av__util; + +{$IFDEF FF_API_GET_BITS_PER_SAMPLE_FMT} +(** + * @deprecated Use av_get_bytes_per_sample() instead. + *) +function av_get_bits_per_sample_fmt(sample_fmt: TAVSampleFormat): cint; + cdecl; external av__util; deprecated; +{$ENDIF} + +(** + * Return number of bytes per sample. + * + * @param sample_fmt the sample format + * @return number of bytes per sample or zero if unknown for the given + * sample format + *) +function av_get_bytes_per_sample(sample_fmt: TAVSampleFormat): cint; + cdecl; external av__util; + +type + OctArrayOfPcuint8 = array[0..7] of Pcuint8; + OctArrayOfcint = array[0..7] of cint; + +(** + * Check if the sample format is planar. + * + * @param sample_fmt the sample format to inspect + * @return 1 if the sample format is planar, 0 if it is interleaved + *) +function av_sample_fmt_is_planar(sample_fmt: TAVSampleFormat): cint; + cdecl; external av__util; + +(** + * Get the required buffer size for the given audio parameters. + * + * @param[out] linesize calculated linesize, may be NULL + * @param nb_channels the number of channels + * @param nb_samples the number of samples in a single channel + * @param sample_fmt the sample format + * @param align buffer size alignment (0 = default, 1 = no alignment) + * @return required buffer size, or negative error code on failure + *) +function av_samples_get_buffer_size(linesize: Pcint; nb_channels: cint; nb_samples: cint; + sample_fmt: TAVSampleFormat; align: cint): cint; + cdecl; external av__util; + +(** + * Fill plane data pointers and linesize for samples with sample + * format sample_fmt. + * + * The audio_data array is filled with the pointers to the samples data planes: + * for planar, set the start point of each channel's data within the buffer, + * for packed, set the start point of the entire buffer only. + * + * The value pointed to by linesize is set to the aligned size of each + * channel's data buffer for planar layout, or to the aligned size of the + * buffer for all channels for packed layout. + * + * The buffer in buf must be big enough to contain all the samples + * (use av_samples_get_buffer_size() to compute its minimum size), + * otherwise the audio_data pointers will point to invalid data. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param[out] audio_data array to be filled with the pointer for each channel + * @param[out] linesize calculated linesize, may be NULL + * @param buf the pointer to a buffer containing the samples + * @param nb_channels the number of channels + * @param nb_samples the number of samples in a single channel + * @param sample_fmt the sample format + * @param align buffer size alignment (0 = default, 1 = no alignment) + * @return >=0 on success or a negative error code on failure + * @todo return minimum size in bytes required for the buffer in case + * of success at the next bump + *) +function av_samples_fill_arrays(var audio_data: Pcuint8; linesize: Pcint; + buf: Pcuint8; + nb_channels: cint; nb_samples: cint; + sample_fmt: TAVSampleFormat; align: cint): cint; + cdecl; external av__util; + +(** + * Allocate a samples buffer for nb_samples samples, and fill data pointers and + * linesize accordingly. + * The allocated samples buffer can be freed by using av_freep(&audio_data[0]) + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param[out] audio_data array to be filled with the pointer for each channel + * @param[out] linesize aligned size for audio buffer(s), may be NULL + * @param nb_channels number of audio channels + * @param nb_samples number of samples per channel + * @param align buffer size alignment (0 = default, 1 = no alignment) + * @return >=0 on success or a negative error code on failure + * @todo return the size of the allocated buffer in case of success at the next bump + * @see av_samples_fill_arrays() + *) +function av_samples_alloc(var audio_data: Pcuint8; linesize: Pcint; + nb_channels: cint; nb_samples: cint; + sample_fmt: TAVSampleFormat; align: cint): cint; + cdecl; external av__util; + +(** + * Copy samples from src to dst. + * + * @param dst destination array of pointers to data planes + * @param src source array of pointers to data planes + * @param dst_offset offset in samples at which the data will be written to dst + * @param src_offset offset in samples at which the data will be read from src + * @param nb_samples number of samples to be copied + * @param nb_channels number of audio channels + * @param sample_fmt audio sample format + *) +function av_samples_copy(var dst: Pcuint8; src: {const} Pcuint8; dst_offset: cint; + src_offset: cint; nb_samples: cint; nb_channels: cint; + sample_fmt: TAVSampleFormat): cint; + cdecl; external av__util; + +(** + * Fill an audio buffer with silence. + * + * @param audio_data array of pointers to data planes + * @param offset offset in samples at which to start filling + * @param nb_samples number of samples to fill + * @param nb_channels number of audio channels + * @param sample_fmt audio sample format + *) +function av_samples_set_silence(var audio_data: Pcuint8; offset: cint; nb_samples: cint; + nb_channels: cint; sample_fmt: TAVSampleFormat): cint; + cdecl; external av__util; diff --git a/src/lib/ffmpeg-2.0/libavutil/cpu.pas b/src/lib/ffmpeg-2.0/libavutil/cpu.pas new file mode 100644 index 00000000..4977131f --- /dev/null +++ b/src/lib/ffmpeg-2.0/libavutil/cpu.pas @@ -0,0 +1,118 @@ +(* + * 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 + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * This is a part of the Pascal port of ffmpeg. + * - Changes and updates by the UltraStar Deluxe Team + * + * Conversion of libavutil/cpu.h + * avutil version 52.13.100 + * + *) + +const + + AV_CPU_FLAG_FORCE = $80000000; (* force usage of selected flags (OR) *) + + (* lower 16 bits - CPU features *) + AV_CPU_FLAG_MMX = $0001; ///< standard MMX + AV_CPU_FLAG_MMXEXT = $0002; ///< SSE integer functions or AMD MMX ext + AV_CPU_FLAG_MMX2 = $0002; ///< SSE integer functions or AMD MMX ext + AV_CPU_FLAG_3DNOW = $0004; ///< AMD 3DNOW + AV_CPU_FLAG_SSE = $0008; ///< SSE functions + AV_CPU_FLAG_SSE2 = $0010; ///< PIV SSE2 functions + AV_CPU_FLAG_SSE2SLOW = $40000000; ///< SSE2 supported, but usually not faster + AV_CPU_FLAG_3DNOWEXT = $0020; ///< AMD 3DNowExt + AV_CPU_FLAG_SSE3 = $0040; ///< Prescott SSE3 functions + AV_CPU_FLAG_SSE3SLOW = $20000000; ///< SSE3 supported, but usually not faster + AV_CPU_FLAG_SSSE3 = $0080; ///< Conroe SSSE3 functions + AV_CPU_FLAG_ATOM = $10000000; ///< Atom processor, some SSSE3 instructions are slower + AV_CPU_FLAG_SSE4 = $0100; ///< Penryn SSE4.1 functions + AV_CPU_FLAG_SSE42 = $0200; ///< Nehalem SSE4.2 functions + AV_CPU_FLAG_AVX = $4000; ///< AVX functions: requires OS support even if YMM registers aren't used + AV_CPU_FLAG_XOP = $0400; ///< Bulldozer XOP functions + AV_CPU_FLAG_FMA4 = $0800; ///< Bulldozer FMA4 functions + + AV_CPU_FLAG_CMOV = $1001000; ///< supports cmov instruction + + AV_CPU_FLAG_ALTIVEC = $0001; ///< standard + + AV_CPU_FLAG_ARMV5TE = (1 << 0); + AV_CPU_FLAG_ARMV6 = (1 << 1); + AV_CPU_FLAG_ARMV6T2 = (1 << 2); + AV_CPU_FLAG_VFP = (1 << 3); + AV_CPU_FLAG_VFPV3 = (1 << 4); + AV_CPU_FLAG_NEON = (1 << 5); + +(** + * Return the flags which specify extensions supported by the CPU. + * The returned value is affected by av_force_cpu_flags() if that was used + * before. So av_get_cpu_flags() can easily be used in a application to + * detect the enabled cpu flags. + *) +function av_get_cpu_flags(): cint; + cdecl; external av__util; + +(** + * Disables cpu detection and forces the specified flags. + * -1 is a special case that disables forcing of specific flags. + *) +procedure av_force_cpu_flags(flags: cint); + cdecl; external av__util; + +(** + * Set a mask on flags returned by av_get_cpu_flags(). + * This function is mainly useful for testing. + * Please use av_force_cpu_flags() and av_get_cpu_flags() instead which are more flexible + * + * @warning this function is not thread safe. + *) +procedure av_set_cpu_flags_mask(mask: cint); + cdecl; external av__util; deprecated; + +(** + * Parse CPU flags from a string. + * + * The returned flags contain the specified flags as well as related unspecified flags. + * + * This function exists only for compatibility with libav. + * Please use av_parse_cpu_caps() when possible. + * @return a combination of AV_CPU_* flags, negative on error. + *) +function av_parse_cpu_flags(s: {const} PAnsiChar): cint; + cdecl; external av__util; deprecated; + +(** + * Parse CPU caps from a string and update the given AV_CPU_* flags based on that. + * + * @return negative on error. + *) +function av_parse_cpu_caps(flags: Pcuint; s: {const} PAnsiChar): cint; + cdecl; external av__util; + +(** + * @return the number of logical CPU cores present. + *) +function av_cpu_count(): cint; + cdecl; external av__util; + +(* The following CPU-specific functions shall not be called directly. *) +function ff_get_cpu_flags_arm(): cint; + cdecl; external av__util; +function ff_get_cpu_flags_ppc(): cint; + cdecl; external av__util; +function ff_get_cpu_flags_x86(): cint; + cdecl; external av__util; diff --git a/src/lib/ffmpeg-2.0/libavutil/dict.pas b/src/lib/ffmpeg-2.0/libavutil/dict.pas new file mode 100644 index 00000000..9838c9b6 --- /dev/null +++ b/src/lib/ffmpeg-2.0/libavutil/dict.pas @@ -0,0 +1,120 @@ +(* + * AVDictionary + * copyright (c) 2011 Karl-Michael Schindler <karl-michael.schindler@web.de> + * + * This library 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 + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * This is a part of the Pascal port of ffmpeg. + * + * Conversion of libavutil/dict.h + * avutil version 52.13.100 + * + *) + +const + AV_DICT_MATCH_CASE = 1; + AV_DICT_IGNORE_SUFFIX = 2; + AV_DICT_DONT_STRDUP_KEY = 4; (**< Take ownership of a key that's been + allocated with av_malloc() and children. *) + AV_DICT_DONT_STRDUP_VAL = 8; (**< Take ownership of a value that's been + allocated with av_malloc() and chilren. *) + AV_DICT_DONT_OVERWRITE = 16; (**< Don't overwrite existing entries. *) + AV_DICT_APPEND = 32; (**< If the entry already exists, append to it. Note that no + delimiter is added, the strings are simply concatenated. *) + +type + PAVDictionaryEntry = ^TAVDictionaryEntry; + TAVDictionaryEntry = record + key: PAnsiChar; + value: PAnsiChar; + end; + +(* with the "help" of libavutil/internal.h: *) + + PPAVDictionary = ^PAVDictionary; + PAVDictionary = ^TAVDictionary; + TAVDictionary = record + count: cint; + elems: PAVDictionaryEntry; + end; + +(** + * Get a dictionary entry with matching key. + * + * @param prev Set to the previous matching element to find the next. + * If set to NULL the first matching element is returned. + * @param flags Allows case as well as suffix-insensitive comparisons. + * @return Found entry or NULL, changing key or value leads to undefined behavior. + *) +function av_dict_get(m: PAVDictionary; {const} key: PAnsiChar; {const} prev: PAVDictionaryEntry; flags: cint): PAVDictionaryEntry; + cdecl; external av__util; + +(** + * Get number of entries in dictionary. + * + * @param m dictionary + * @return number of entries in dictionary + *) +function av_dict_count({const} m: PAVDictionary): cint; + cdecl; external av__util; + +(** + * Set the given entry in *pm, overwriting an existing entry. + * + * @param pm pointer to a pointer to a dictionary struct. If *pm is NULL + * a dictionary struct is allocated and put in *pm. + * @param key entry key to add to *pm (will be av_strduped depending on flags) + * @param value entry value to add to *pm (will be av_strduped depending on flags). + * Passing a NULL value will cause an existing entry to be deleted. + * @return >= 0 on success otherwise an error code <0 + *) +function av_dict_set(var pm: PAVDictionary; {const} key: PAnsiChar; {const} value: PAnsiChar; flags: cint): cint; + cdecl; external av__util; + +(** + * Parse the key/value pairs list and add to a dictionary. + * + * @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 + * @param flags flags to use when adding to dictionary. + * AV_DICT_DONT_STRDUP_KEY and AV_DICT_DONT_STRDUP_VAL + * are ignored since the key/value tokens will always + * be duplicated. + * @return 0 on success, negative AVERROR code on failure + *) +function av_dict_parse_string(var pm: PAVDictionary; {const} str: PAnsiChar; + {const} key_val_sep: PAnsiChar; {const} pairs_sep: PAnsiChar; + flags: cint): cint; + cdecl; external av__util; + +(** + * Copy entries 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 entries in *dst + * @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag + *) +procedure av_dict_copy(var dst: PAVDictionary; src: PAVDictionary; flags: cint); + cdecl; external av__util; + +(** + * Free all the memory allocated for an AVDictionary struct + * and all keys and values. + *) +procedure av_dict_free(var m: PAVDictionary); + cdecl; external av__util; diff --git a/src/lib/ffmpeg-2.0/libavutil/error.pas b/src/lib/ffmpeg-2.0/libavutil/error.pas new file mode 100644 index 00000000..46dbe51a --- /dev/null +++ b/src/lib/ffmpeg-2.0/libavutil/error.pas @@ -0,0 +1,157 @@ +(* + * 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 + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * This is a part of the Pascal port of ffmpeg. + * - Changes and updates by the UltraStar Deluxe Team + * + * Conversion of libavutil/error.h + * avutil version 52.13.100 + * + *) + +(** + * @file + * error code definitions + *) + +(** + * @addtogroup lavu_error + * + * @{ + *) + +{* error handling *} + +const +{$IFDEF UNIX} + ENOENT = ESysENOENT; + EIO = ESysEIO; + ENOMEM = ESysENOMEM; + EINVAL = ESysEINVAL; + EDOM = ESysEDOM; + ENOSYS = ESysENOSYS; + EILSEQ = ESysEILSEQ; + EPIPE = ESysEPIPE; +{$ELSE} + ENOENT = 2; + EIO = 5; + ENOMEM = 12; + EINVAL = 22; + EPIPE = 32; // just an assumption. needs to be checked. + EDOM = 33; + {$IFDEF MSWINDOWS} + // Note: we assume that ffmpeg was compiled with MinGW. + // This must be changed if DLLs were compiled with cygwin. + ENOSYS = 40; // MSVC/MINGW: 40, CYGWIN: 88, LINUX/FPC: 38 + EILSEQ = 42; // MSVC/MINGW: 42, CYGWIN: 138, LINUX/FPC: 84 + {$ENDIF} +{$ENDIF} + +(** + * We need the sign of the error, because some platforms have + * E* and errno already negated. The previous version failed + * with Delphi, because it needed EINVAL defined. + * Warning: This code is platform dependent and assumes constants + * to be 32 bit. + * This version does the following steps: + * 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) - 1: positive EINVAL gives -1, negative 1 + *) +const + AVERROR_SIGN = (EINVAL shr 30) and $00000002 - 1; + +(* +#if EDOM > 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 +{* Some platforms have E* and errno already negated. *} +#define AVERROR(e) (e) +#define AVUNERROR(e) (e) +#endif +*) + +const + + // Note: function calls as constant-initializers are invalid + 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_BUG = -(ord('B') or (ord('U') shl 8) or (ord('G') shl 16) or (ord('!') shl 24)); ///< Internal bug, also see AVERROR_BUG2 + AVERROR_BUFFER_TOO_SMALL = -(ord('B') or (ord('U') shl 8) or (ord('F') shl 16) or (ord('S') shl 24)); ///< Buffer too small + 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_EOF = -(ord('E') or (ord('O') shl 8) or (ord('F') shl 16) or (ord(' ') shl 24)); ///< End of file + 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_EXTERNAL = -(ord('E') or (ord('X') shl 8) or (ord('T') shl 16) or (ord(' ') shl 24)); ///< Generic error in an external library + 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_INVALIDDATA = -(ord('I') or (ord('N') shl 8) or (ord('D') shl 16) or (ord('A') shl 24)); ///< Invalid data found when processing input + 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_PATCHWELCOME = -(ord('P') or (ord('A') shl 8) or (ord('W') shl 16) or (ord('E') shl 24)); ///< Not yet implemented in FFmpeg, patches welcome + 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 + +(** + * This is semantically identical to AVERROR_BUG + * it has been introduced in Libav after our AVERROR_BUG and with a modified value. + *) + AVERROR_BUG2 = -(ord('B') or (ord('U') shl 8) or (ord('G') shl 16) or (ord(' ') shl 24)); + AVERROR_UNKNOWN = -(ord('U') or (ord('N') shl 8) or (ord('K') shl 16) or (ord('N') shl 24)); ///< Unknown error, typically from an external library + AVERROR_EXPERIMENTAL = -($2bb2afa8); ///< Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it. + + AV_ERROR_MAX_STRING_SIZE = 64; + +(* + * Put a description of the AVERROR code errnum in errbuf. + * In case of failure the global variable errno is set to indicate the + * error. Even in case of failure av_strerror() will print a generic + * error message indicating the errnum provided to errbuf. + * + * @param errnum error code to describe + * @param errbuf buffer to which description is written + * @param errbuf_size the size in bytes of errbuf + * @return 0 on success, a negative value if a description for errnum + * cannot be found + *) +function av_strerror(errnum: cint; errbuf: PAnsiChar; errbuf_size: size_t): cint; + cdecl; external av__util; + +(** + * Fill the provided buffer with a string containing an error string + * corresponding to the AVERROR code errnum. + * + * @param errbuf a buffer + * @param errbuf_size size in bytes of errbuf + * @param errnum error code to describe + * @return the buffer in input, filled with the error description + * @see av_strerror() + *) +function av_make_error_string(errbuf: Pchar; errbuf_size: size_t; errnum: cint): Pchar; {$IFDEF HasInline}inline;{$ENDIF} +// Note: defined in avutil.pas + +(** + * Convenience macro, the return value should be used only directly in + * function arguments but never stand-alone. + *) +function av_err2str(errnum: cint): pchar; {$IFDEF HasInline}inline;{$ENDIF} +// Note: defined in avutil.pas + +(** + * @} + *) diff --git a/src/lib/ffmpeg-2.0/libavutil/log.pas b/src/lib/ffmpeg-2.0/libavutil/log.pas new file mode 100644 index 00000000..9cd709f8 --- /dev/null +++ b/src/lib/ffmpeg-2.0/libavutil/log.pas @@ -0,0 +1,244 @@ +(* + * 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 + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * This is a part of the Pascal port of ffmpeg. + * - Changes and updates by the UltraStar Deluxe Team + * + * Conversion of libavutil/log.h + * avutil version 52.13.100 + * + *) + +(** + * @file + * log + *) + +type + PAVClassCategory = ^TAVClassCategory; + TAVClassCategory = ( + AV_CLASS_CATEGORY_NA = 0, + AV_CLASS_CATEGORY_INPUT, + AV_CLASS_CATEGORY_OUTPUT, + AV_CLASS_CATEGORY_MUXER, + AV_CLASS_CATEGORY_DEMUXER, + AV_CLASS_CATEGORY_ENCODER, + AV_CLASS_CATEGORY_DECODER, + AV_CLASS_CATEGORY_FILTER, + AV_CLASS_CATEGORY_BITSTREAM_FILTER, + AV_CLASS_CATEGORY_SWSCALER, + AV_CLASS_CATEGORY_SWRESAMPLER, + AV_CLASS_CATEGORY_NB ///< not part of ABI/API + ); + +// struct AVOptionRanges; + +(** + * 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(ctx: pointer): 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 + * logging is stored. For example a decoder could pass its AVCodecContext + * to eval as such a parent context, which an av_log() implementation + * could then leverage to display the parent context. + * The offset can be NULL. + *) + parent_log_context_offset: cint; + + (** + * Return next AVOptions-enabled child or NULL + *) + child_next: function (obj: pointer; prev: pointer): pointer; cdecl; + + (** + * Return an AVClass corresponding to the next potential + * AVOptions-enabled child. + * + * The difference between child_next and this is that + * child_next iterates over _already existing_ objects, while + * child_class_next iterates over _all possible_ children. + *) + child_class_next: function (prev: {const} PAVClass): {const} PAVClass; cdecl; + + (** + * Category used for visualization (like color) + * This is only set if the category is equal for all objects using this class. + * available since version (51 << 16 | 56 << 8 | 100) + *) + category: TAVClassCategory; + + (** + * Callback to return the category. + * available since version (51 << 16 | 59 << 8 | 100) + *) + get_category: function (ctx: pointer): PAVClassCategory; cdecl; + + (** + * Callback to return the supported/allowed ranges. + * available since version (52.12) + *) + query_ranges: function (P: PPAVOptionRanges; obj: pointer; key: {const} PAnsiChar; flags: cint): cint; cdecl; +end; + +const + AV_LOG_QUIET = -8; + +(** + * Something went really wrong and we will crash now. + *) + AV_LOG_PANIC = 0; + +(** + * Something went wrong and recovery is not possible. + * For example, no header was found for a format which depends + * on headers or an illegal combination of parameters is used. + *) + AV_LOG_FATAL = 8; + +(** + * Something went wrong and cannot losslessly be recovered. + * However, not all future data is affected. + *) + AV_LOG_ERROR = 16; + +(** + * Something somehow does not look correct. This may or may not + * lead to problems. An example would be the use of '-vstrict -2'. + *) + AV_LOG_WARNING = 24; + + AV_LOG_INFO = 32; + AV_LOG_VERBOSE = 40; + +(** + * Stuff which is only useful for libav* developers. + *) + AV_LOG_DEBUG = 48; + + AV_LOG_MAX_OFFSET = (AV_LOG_DEBUG - AV_LOG_QUIET); + +(** + * Send the specified message to the log if the level is less than or equal + * to the current av_log_level. By default, all logging messages are sent to + * stderr. This behavior can be altered by setting a different av_vlog callback + * function. + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message, lower values signifying + * higher importance. + * @param fmt The format string (printf-compatible) that specifies how + * subsequent arguments are converted to output. + * @see av_vlog + *) + +{** to be translated if needed +void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4); +**} + +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); + cdecl; external av__util; + +{** to be translated if needed +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; +function av_default_get_category(ptr: pointer): TAVClassCategory; + cdecl; external av__util; + +(** + * Format a line of log the same way as the default callback. + * @param line buffer to receive the formated line + * @param line_size size of the buffer + * @param print_prefix used to store whether the prefix must be printed; + * must point to a persistent integer initially set to 1 + *) +procedure av_log_format_line(ptr: pointer; level: cint; fmt: {const} PAnsiChar; vl: va_list; + line: PAnsiChar; line_size: cint; print_prefix: Pcint); + cdecl; external av__util; + +(** + * av_dlog macros + * Useful to print debug messages that shouldn't get compiled in normally. + *) +(** to be translated if needed +#ifdef DEBUG +# define av_dlog(pctx, ...) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__) +#else +# define av_dlog(pctx, ...) do { if (0) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0) +#endif +**) + +(** + * Skip repeated messages, this requires the user app to use av_log() instead of + * (f)printf as the 2 would otherwise interfere and lead to + * "Last message repeated x times" messages below (f)printf messages with some + * bad luck. + * Also to receive the last, "last repeated" line if any, the user app must + * call av_log(NULL, AV_LOG_QUIET, "%s", ""); at the end + *) +const + AV_LOG_SKIP_REPEATED = 1; + +procedure av_log_set_flags(arg: cint); + cdecl; external av__util; diff --git a/src/lib/ffmpeg-2.0/libavutil/mathematics.pas b/src/lib/ffmpeg-2.0/libavutil/mathematics.pas new file mode 100644 index 00000000..7dcb5e1e --- /dev/null +++ b/src/lib/ffmpeg-2.0/libavutil/mathematics.pas @@ -0,0 +1,130 @@ +(* + * copyright (c) 2005-2012 Michael Niedermayer <michaelni@gmx.at> + * + * This library 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 + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * This is a part of Pascal porting of ffmpeg. + * - Originally by Victor Zinetz for Delphi and Free Pascal on Windows. + * - For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT + * in the source codes. + * - Changes and updates by the UltraStar Deluxe Team + * + * Conversion of libavutil/mathematics.h + * avutil version 52.13.100 + * + *) + +const + M_E = 2.7182818284590452354; // e + M_LN2 = 0.69314718055994530942; // log_e 2 + M_LN10 = 2.30258509299404568402; // log_e 10 + M_LOG2_10 = 3.32192809488736234787; // log_2 10 + M_PHI = 1.61803398874989484820; // phi / golden ratio + M_PI = 3.14159265358979323846; // pi + M_SQRT1_2 = 0.70710678118654752440; // 1/sqrt(2) + M_SQRT2 = 1.41421356237309504880; // sqrt(2) + NAN = $7fc00000; + INFINITY = $7f800000; + +(** + * @addtogroup lavu_math + * @{ + *) + +type + TAVRounding = ( + AV_ROUND_ZERO = 0, ///< Round toward zero. + AV_ROUND_INF = 1, ///< Round away from zero. + AV_ROUND_DOWN = 2, ///< Round toward -infinity. + AV_ROUND_UP = 3, ///< Round toward +infinity. + AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero. + AV_ROUND_PASS_MINMAX = 8192 ///< Flag to pass INT64_MIN/MAX through instead of rescaling, this avoids special cases for AV_NOPTS_VALUE + ); + +(** + * 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 + * undefined. + *) +function av_gcd(a: cint64; b: cint64): cint64; + cdecl; external av__util; {av_const} + +(** + * Rescale a 64-bit integer with rounding to nearest. + * A simple a*b/c isn't possible as it can overflow. + *) +function av_rescale (a, b, c: cint64): cint64; + cdecl; external av__util; {av_const} + +(** + * Rescale a 64-bit integer with specified rounding. + * A simple a*b/c isn't possible as it can overflow. + * + * @return rescaled value a, or if AV_ROUND_PASS_MINMAX is set and a is + * INT64_MIN or INT64_MAX then a is passed through unchanged. + *) +function av_rescale_rnd (a, b, c: cint64; enum: TAVRounding): cint64; + cdecl; external av__util; {av_const} + +(** + * Rescale a 64-bit integer by 2 rational numbers. + *) +function av_rescale_q (a: cint64; bq, cq: TAVRational): cint64; + cdecl; external av__util; {av_const} + +(** + * Rescale a 64-bit integer by 2 rational numbers with specified rounding. + * + * @return rescaled value a, or if AV_ROUND_PASS_MINMAX is set and a is + * INT64_MIN or INT64_MAX then a is passed through unchanged. + *) +function av_rescale_q_rnd(a: cint64; bq, cq: TAVRational; + enum: TAVRounding): cint64; + cdecl; external av__util; {av_const} + +(** + * Compare 2 timestamps each in its own timebases. + * The result of the function is undefined if one of the timestamps + * is outside the int64_t range when represented in the others timebase. + * @return -1 if ts_a is before ts_b, 1 if ts_a is after ts_b or 0 if they represent the same position + *) +function av_compare_ts(ts_a: cint64; tb_a: TAVRational; ts_b: cint64; tb_b: TAVRational): cint; + cdecl; external av__util; + +(** + * Compare 2 integers modulo mod. + * That is we compare integers a and b for which only the least + * significant log2(mod) bits are known. + * + * @param mod must be a power of 2 + * @return a negative value if a is smaller than b + * a positiv value if a is greater than b + * 0 if a equals b + *) +function av_compare_mod(a: cuint64; b: cuint64; modVar: cuint64): cint64; + cdecl; external av__util; + +(** + * Rescale a timestamp while preserving known durations. + * + * @param in_ts Input timestamp + * @param in_tb Input timesbase + * @param fs_tb Duration and *last timebase + * @param duration duration till the next call + * @param out_tb Output timesbase + *) +function av_rescale_delta(in_tb: TAVRational; in_ts: cint64; fs_tb: TAVRational; duration: cint; last: Pcint64; out_tb: TAVRational): cint64; + cdecl; external av__util; + diff --git a/src/lib/ffmpeg-2.0/libavutil/mem.pas b/src/lib/ffmpeg-2.0/libavutil/mem.pas new file mode 100644 index 00000000..ca1b8643 --- /dev/null +++ b/src/lib/ffmpeg-2.0/libavutil/mem.pas @@ -0,0 +1,267 @@ +(* + * 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 + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * This is a part of the Pascal port of ffmpeg. + * - Changes and updates by the UltraStar Deluxe Team + * + * Conversion of libavutil/mem.h + * avutil version 52.13.100 + * + *) + +(** + * @file + * error code definitions + *) + +(* memory handling functions *) + +(** + * Allocate a block of size bytes with alignment suitable for all + * memory accesses (including vectors if available on the CPU). + * @param size Size in bytes for the memory block to be allocated. + * @return Pointer to the allocated block, NULL if the block cannot + * be allocated. + * @see av_mallocz() + *) +function av_malloc(size: size_t): pointer; + cdecl; external av__util; {av_malloc_attrib av_alloc_size(1)} + +(** + * Helper function to allocate a block of size * nmemb bytes with + * using av_malloc() + * @param nmemb Number of elements + * @param size Size of the single element + * @return Pointer to the allocated block, NULL if the block cannot + * be allocated. + * @see av_malloc() + *) +function av_malloc_array(nmemb: size_t; size: size_t): pointer; {$IFDEF HasInline}inline;{$ENDIF} {av_alloc_size(1, 2)} +// Note: defined in avutil.pas + +(** + * Allocate or reallocate a block of memory. + * If ptr is NULL and size > 0, allocate a new block. If + * size is zero, free the memory block pointed to by ptr. + * @param ptr Pointer to a memory block already allocated with + * av_malloc(z)() or av_realloc() or NULL. + * @param size Size in bytes for the memory block to be allocated or + * reallocated. + * @return Pointer to a newly reallocated block or NULL if the block + * cannot be allocated or the function is used to free the memory block. + * @see av_fast_realloc() + *) +function av_realloc(ptr: pointer; size: size_t): pointer; + cdecl; external av__util; {av_alloc_size(2)} + +(** + * Allocate or reallocate a block of memory. + * This function does the same thing as av_realloc, except: + * - It takes two arguments and checks the result of the multiplication for + * integer overflow. + * - It frees the input block in case of failure, thus avoiding the memory + * leak with the classic "buf = realloc(buf); if (!buf) return -1;". + *) +function av_realloc_f(ptr: pointer; nelem: size_t; elsize: size_t): pointer; + cdecl; external av__util; + +(** + * Allocate or reallocate an array. + * If ptr is NULL and nmemb > 0, allocate a new block. If + * nmemb is zero, free the memory block pointed to by ptr. + * @param ptr Pointer to a memory block already allocated with + * av_malloc(z)() or av_realloc() or NULL. + * @param nmemb Number of elements + * @param size Size of the single element + * @return Pointer to a newly reallocated block or NULL if the block + * cannot be reallocated or the function is used to free the memory block. + *) +function av_realloc_array(ptr: pointer; nmemb, size: size_t): pointer; {av_alloc_size(2, 3)} + cdecl; external av__util; + +(** + * Allocate or reallocate an array. + * If *ptr is NULL and nmemb > 0, allocate a new block. If + * nmemb is zero, free the memory block pointed to by ptr. + * @param ptr Pointer to a pointer to a memory block already allocated + * with av_malloc(z)() or av_realloc(), or pointer to a pointer to NULL. + * The pointer is updated on success, or freed on failure. + * @param nmemb Number of elements + * @param size Size of the single element + * @return Zero on success, an AVERROR error code on failure. + *) +function av_reallocp_array(ptr: pointer; nmemb, size: size_t): cint; {av_alloc_size(2, 3)} + cdecl; external av__util; + +(** + * Free a memory block which has been allocated with av_malloc(z)() or + * av_realloc(). + * @param ptr Pointer to the memory block which should be freed. + * @note ptr = NULL is explicitly allowed. + * @note It is recommended that you use av_freep() instead. + * @see av_freep() + *) +procedure av_free(ptr: pointer); + cdecl; external av__util; + +(** + * Allocate a block of size bytes with alignment suitable for all + * memory accesses (including vectors if available on the CPU) and + * zeroes all the bytes of the block. + * @param size Size in bytes for the memory block to be allocated. + * @return Pointer to the allocated block, NULL if it cannot be allocated. + * @see av_malloc() + *) +function av_mallocz(size: size_t): pointer; + cdecl; external av__util; {av_malloc_attrib av_alloc_size(1)} + +(** + * Allocate a block of nmemb * size bytes with alignment suitable for all + * memory accesses (including vectors if available on the CPU) and + * zero all the bytes of the block. + * The allocation will fail if nmemb * size is greater than or equal + * to INT_MAX. + * @param nmemb + * @param size + * @return Pointer to the allocated block, NULL if it cannot be allocated. + *) +function av_calloc(nmemb: size_t; size: size_t): pointer; + cdecl; external av__util; {av_malloc_attrib} + +(** + * Helper function to allocate a block of size * nmemb bytes with + * using av_mallocz() + * @param nmemb Number of elements + * @param size Size of the single element + * @return Pointer to the allocated block, NULL if the block cannot + * be allocated. + * @see av_mallocz() + * @see av_malloc_array() + *) +function av_mallocz_array(nmemb: size_t; size: size_t): pointer; {$IFDEF HasInline}inline;{$ENDIF} {av_alloc_size(1, 2)} +// Note: defined in avutil.pas + +(** + * Duplicate the string s. + * @param s string to be duplicated. + * @return Pointer to a newly allocated string containing a + * copy of s or NULL if the string cannot be allocated. + *) +function av_strdup({const} s: PAnsiChar): PAnsiChar; + cdecl; external av__util; {av_malloc_attrib} + +(** + * Duplicate the buffer p. + * @param p buffer to be duplicated + * @return Pointer to a newly allocated buffer containing a + * copy of p or NULL if the buffer cannot be allocated. + *) +function av_memdup({const} p: pointer; size: size_t): pointer; + cdecl; external av__util; + +(** + * Free a memory block which has been allocated with av_malloc(z)() or + * av_realloc() and set the pointer pointing to it to NULL. + * @param ptr Pointer to the pointer to the memory block which should + * be freed. + * @see av_free() + *) +procedure av_freep (ptr: pointer); + cdecl; external av__util; + +(** + * Add an element to a dynamic array. + * + * The array to grow is supposed to be an array of pointers to + * structures, and the element to add must be a pointer to an already + * allocated structure. + * + * The array is reallocated when its size reaches powers of 2. + * Therefore, the amortized cost of adding an element is constant. + * + * In case of success, the pointer to the array is updated in order to + * point to the new grown array, and the number pointed to by nb_ptr + * is incremented. + * In case of failure, the array is freed, *tab_ptr is set to NULL and + * *nb_ptr is set to 0. + * + * @param tab_ptr pointer to the array to grow + * @param nb_ptr pointer to the number of elements in the array + * @param elem element to add + * @see av_dynarray2_add() + *) +procedure av_dynarray_add(tab_ptr: pointer; nb_ptr: Pcint; elem: pointer); + cdecl; external av__util; + +(** + * Add an element of size elem_size to a dynamic array. + * + * The array is reallocated when its number of elements reaches powers of 2. + * Therefore, the amortized cost of adding an element is constant. + * + * In case of success, the pointer to the array is updated in order to + * point to the new grown array, and the number pointed to by nb_ptr + * is incremented. + * In case of failure, the array is freed, *tab_ptr is set to NULL and + * *nb_ptr is set to 0. + * + * @param tab_ptr pointer to the array to grow + * @param nb_ptr pointer to the number of elements in the array + * @param elem_size size in bytes of the elements in the array + * @param elem_data pointer to the data of the element to add. If NULL, the space of + * the new added element is not filled. + * @return pointer to the data of the element to copy in the new allocated space. + * If NULL, the new allocated space is left uninitialized." + * @see av_dynarray_add() + *) +function av_dynarray2_add(tab_ptr: Pointer; nb_ptr: Pcint; elem_size: size_t; + {const} elem_data: Pcuint8): pointer; + cdecl; external av__util; + +(** + * Multiply two size_t values checking for overflow. + * @return 0 if success, AVERROR(EINVAL) if overflow. + *) +//static inline int av_size_mult(size_t a, size_t b, size_t *r) +{ + size_t t = a * b; + /* Hack inspired from glibc: only try the division if nelem and elsize + * are both greater than sqrt(SIZE_MAX). */ + if ((a | b) >= ((size_t)1 << (sizeof(size_t) * 4)) && a && t / a != b) + return AVERROR(EINVAL); + *r = t; + return 0; +} + +(** + * Set the maximum size that may me allocated in one block. + *) +procedure av_max_alloc(max: size_t); + cdecl; external av__util; + +(** + * @brief deliberately overlapping memcpy implementation + * @param dst destination buffer + * @param back how many bytes back we start (the initial size of the overlapping window), must be > 0 + * @param cnt number of bytes to copy, must be >= 0 + * + * cnt > back is valid, this will copy the bytes we just copied, + * thus creating a repeating pattern with a period length of back. + *) +procedure av_memcpy_backptr(dst: Pcuint8; back: cint; cnt: cint); + cdecl; external av__util; + diff --git a/src/lib/ffmpeg-2.0/libavutil/opt.pas b/src/lib/ffmpeg-2.0/libavutil/opt.pas new file mode 100644 index 00000000..fd865eea --- /dev/null +++ b/src/lib/ffmpeg-2.0/libavutil/opt.pas @@ -0,0 +1,614 @@ +(* + * AVOptions + * copyright (c) 2005 Michael Niedermayer <michaelni@gmx.at> + * + * This library 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 + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * This is a part of Pascal porting of ffmpeg. + * - Originally by Victor Zinetz for Delphi and Free Pascal on Windows. + * - For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT + * in the source codes. + * - Changes and updates by the UltraStar Deluxe Team + * + * Conversion of libavutil/opt.h + * avutil version 52.13.100 + * + *) + +type + TAVOptionType = ( +{$IFDEF FF_API_OLD_AVOPTIONS} + FF_OPT_TYPE_FLAGS = 0, + FF_OPT_TYPE_INT, + FF_OPT_TYPE_INT64, + FF_OPT_TYPE_DOUBLE, + FF_OPT_TYPE_FLOAT, + FF_OPT_TYPE_STRING, + FF_OPT_TYPE_RATIONAL, + FF_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length + FF_OPT_TYPE_CONST = 128 +{$ELSE} + AV_OPT_TYPE_FLAGS, + AV_OPT_TYPE_INT, + AV_OPT_TYPE_INT64, + AV_OPT_TYPE_DOUBLE, + AV_OPT_TYPE_FLOAT, + AV_OPT_TYPE_STRING, + AV_OPT_TYPE_RATIONAL, + AV_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length + AV_OPT_TYPE_CONST = 128, + AV_OPT_TYPE_COLOR = $434F4C52 ///< MKBETAG('C','O','L','R'), + AV_OPT_TYPE_DURATION = $44555220 ///< MKBETAG('D','U','R',' '), + AV_OPT_TYPE_PIXEL_FMT = $50464D54, ///< MKBETAG('P','F','M','T') + AV_OPT_TYPE_SAMPLE_FMT = $53464D54, ///< MKBETAG('S','F','M','T') + AV_OPT_TYPE_IMAGE_SIZE = $53495A45 ///< MKBETAG('S','I','Z','E'), offset must point to two consecutive integers + AV_OPT_TYPE_VIDEO_RATE = $56524154 ///< MKBETAG('V','R','A','T'), offset must point to AVRational +{$ENDIF} + ); + +const + AV_OPT_FLAG_ENCODING_PARAM = 1; ///< a generic parameter which can be set by the user for muxing or encoding + AV_OPT_FLAG_DECODING_PARAM = 2; ///< a generic parameter which can be set by the user for demuxing or decoding + AV_OPT_FLAG_METADATA = 4; ///< some data extracted or inserted into the file like title, comment, ... + AV_OPT_FLAG_AUDIO_PARAM = 8; + AV_OPT_FLAG_VIDEO_PARAM = 16; + AV_OPT_FLAG_SUBTITLE_PARAM = 32; + AV_OPT_FLAG_FILTERING_PARAM = 1 shl 16; ///< a generic parameter which can be set by the user for filtering + +type + (** + * AVOption + *) + PAVOption = ^TAVOption; + TAVOption = 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: (i64: cint64); + 1: (dbl: cdouble); + 2: (str: PAnsiChar); + (* TODO those are unused now *) + 3: (q: TAVRational); + end; + min: cdouble; ///< minimum valid value for the option + max: cdouble; ///< maximum valid value for the option + + 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; + + (** + * A single allowed range of values, or a single allowed value. + *) + PAVOptionRange = ^TAVOptionRange; + PPAVOptionRange = ^PAVOptionRange; + TAVOptionRange = record + str: {const} PAnsiChar; + value_min, value_max: cdouble; ///< For string ranges this represents the min/max length, for dimensions this represents the min/max pixel count + component_min, component_max: cdouble; ///< For string this represents the unicode range for chars, 0-127 limits to ASCII + is_range: cint; ///< if set to 1 the struct encodes a range, if set to 0 a single value + end; + + (** + * List of AVOptionRange structs + *) + PAVOptionRanges = ^TAVOptionRanges; + PPAVOptionRanges = ^PAVOptionRanges; + TAVOptionRanges = record + range: PPAVOptionRange; + nb_ranges: cint; + end; + +{$IFDEF FF_API_FIND_OPT} +(** + * Look for an option in obj. Look only for the options which + * have the flags set as specified in mask and flags (that is, + * for which it is the case that opt->flags & mask == flags). + * + * @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 the unit of the option to look for, or any if NULL + * @return a pointer to the option found, or NULL if no option + * 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} + +{$IFDEF FF_API_OLD_AVOPTIONS} +(** + * Set the field of obj with the given name to value. + * + * @param[in] obj A struct whose first element is a pointer to an + * AVClass. + * @param[in] name the name of the field to set + * @param[in] val The value to set. If the field is not of a string + * type, then the given string is parsed. + * SI postfixes and some named scalars are supported. + * If the field is of a numeric type, it has to be a numeric or named + * scalar. Behavior with more than one scalar and +- infix operators + * is undefined. + * If the field is of a flags type, it has to be a sequence of numeric + * scalars or named flags separated by '+' or '-'. Prefixing a flag + * with '+' causes it to be set without affecting the other flags; + * similarly, '-' unsets a flag. + * @param[out] o_out if non-NULL put here a pointer to the AVOption + * found + * @param alloc when 1 then the old value will be av_freed() and the + * new av_strduped() + * when 0 then no av_free() nor av_strdup() will be used + * @return 0 if the value has been set, or an AVERROR code in case of + * error: + * AVERROR_OPTION_NOT_FOUND if no matching option exists + * AVERROR(ERANGE) if the value is out of range + * AVERROR(EINVAL) if the value is not valid + * @deprecated use av_opt_set() + *) +function av_set_string3(obj: Pointer; name: {const} PAnsiChar; val: {const} PAnsiChar; alloc: cint; out o_out: {const} PAVOption): cint; + cdecl; external av__util; deprecated; + +function av_set_double(obj: pointer; name: {const} PAnsiChar; n: cdouble): PAVOption; + cdecl; external av__util; deprecated; +function av_set_q (obj: pointer; name: {const} PAnsiChar; n: TAVRational): PAVOption; + cdecl; external av__util; deprecated; +function av_set_int (obj: pointer; name: {const} PAnsiChar; n: cint64): PAVOption; + cdecl; external av__util; deprecated; + +function av_get_double(obj: pointer; name: {const} PAnsiChar; out o_out: {const} PAVOption): cdouble; + cdecl; external av__util; +function av_get_q (obj: pointer; name: {const} PAnsiChar; out o_out: {const} PAVOption): TAVRational; + cdecl; external av__util; +function av_get_int (obj: pointer; name: {const} PAnsiChar; out o_out: {const} PAVOption): cint64; + cdecl; external av__util; +function av_get_string(obj: pointer; name: {const} PAnsiChar; out o_out: {const} PAVOption; buf: PAnsiChar; buf_len: cint): PAnsiChar; + cdecl; external av__util; deprecated; +function av_next_option(obj: pointer; last: {const} PAVOption): PAVOption; + cdecl; external av__util; deprecated; +{$ENDIF} + +(** + * 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; + +(** + * Set the values of all AVOption fields to their default values. + * + * @param s an AVOption-enabled struct (its first member must be a pointer to AVClass) + *) +procedure av_opt_set_defaults(s: pointer); + cdecl; external av__util; + +{$IFDEF FF_API_OLD_AVOPTIONS} +procedure av_opt_set_defaults2(s: Pointer; mask: cint; flags: cint); + cdecl; external av__util; deprecated; +{$ENDIF} + +(** + * 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; + +(** + * Parse the key-value pairs list in opts. For each key=value pair found, + * set the value of the corresponding option in ctx. + * + * @param ctx the AVClass object to set options on + * @param opts the options string, key-value pairs separated by a + * delimiter + * @param shorthand a NULL-terminated array of options names for shorthand + * notation: if the first field in opts has no key part, + * the key is taken from the first element of shorthand; + * then again for the second, etc., until either opts is + * finished, shorthand is finished or a named option is + * found; after that, all options must be named + * @param key_val_sep a 0-terminated list of characters used to separate + * key from value, for example '=' + * @param pairs_sep a 0-terminated list of characters used to separate + * two pairs from each other, for example ':' or ',' + * @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 + * + * Options names must use only the following characters: a-z A-Z 0-9 - . / _ + * Separators must use characters distinct from option names and from each + * other. + *) +function av_opt_set_from_string(ctx: pointer; opts: {const} PAnsiChar; + shorthand: {const} PAnsiChar; + key_val_sep: {const} PAnsiChar; pairs_sep: {const} PAnsiChar): cint; + cdecl; external av__util; + +(** + * Free all string and binary options in obj. + *) +procedure av_opt_free(obj: pointer); + cdecl; external av__util; + +(** + * Check whether a particular flag is set in a flags field. + * + * @param field_name the name of the flag field option + * @param flag_name the name of the flag to check + * @return non-zero if the flag is set, zero if the flag isn't set, + * isn't of the right type, or the flags field doesn't exist. + *) +function av_opt_flag_is_set(obj: pointer; field_name: {const} PAnsiChar; flag_name: {const} PAnsiChar): cint; + cdecl; external av__util; + +(** + * Set all the options from a given dictionary on an object. + * + * @param obj a struct whose first element is a pointer to AVClass + * @param options options to process. This dictionary will be freed and replaced + * by a new one containing all options not found in obj. + * Of course this new dictionary needs to be freed by caller + * with av_dict_free(). + * + * @return 0 on success, a negative AVERROR if some option was found in obj, + * but could not be set. + * + * @see av_dict_copy() + *) +function av_opt_set_dict(obj: pointer; var options: PAVDictionary): cint; + cdecl; external av__util; + +(** + * Extract a key-value pair from the beginning of a string. + * + * @param ropts pointer to the options string, will be updated to + * point to the rest of the string (one of the pairs_sep + * or the final NUL) + * @param key_val_sep a 0-terminated list of characters used to separate + * key from value, for example '=' + * @param pairs_sep a 0-terminated list of characters used to separate + * two pairs from each other, for example ':' or ',' + * @param flags flags; see the AV_OPT_FLAG_* values below + * @param rkey parsed key; must be freed using av_free() + * @param rval parsed value; must be freed using av_free() + * + * @return >=0 for success, or a negative value corresponding to an + * AVERROR code in case of error; in particular: + * AVERROR(EINVAL) if no key is present + * + *) +av_opt_get_key_value(ropts: {const} PPAnsiChar; + key_val_sep: {const} PAnsiChar; pairs_sep: {const} PAnsiChar + flags: byte, + rkey, rval: PPAnsiChar): cint; + cdecl; external av__util; + +const + (** + * Accept to parse a value without a key; the key will then be returned + * as NULL. + *) + AV_OPT_FLAG_IMPLICIT_KEY = 1; + +(** + * @defgroup opt_eval_funcs Evaluating option strings + * @{ + * This group of functions can be used to evaluate option strings + * and get numbers out of them. They do the same thing as av_opt_set(), + * except the result is written into the caller-supplied pointer. + * + * @param obj a struct whose first element is a pointer to AVClass. + * @param o an option for which the string is to be evaluated. + * @param val string to be evaluated. + * @param *_out value of the string will be written here. + * + * @return 0 on success, a negative number on failure. + *) +function av_opt_eval_flags (obj: pointer; o: {const} PAVOption; val: {const} PAnsiChar; flags_out: Pcint): cint; +function av_opt_eval_int (obj: pointer; o: {const} PAVOption; val: {const} PAnsiChar; int_out: Pcint): cint; +function av_opt_eval_int64 (obj: pointer; o: {const} PAVOption; val: {const} PAnsiChar; int64_out: Pcint64): cint; +function av_opt_eval_float (obj: pointer; o: {const} PAVOption; val: {const} PAnsiChar; float_out: Pcfloat): cint; +function av_opt_eval_double(obj: pointer; o: {const} PAVOption; val: {const} PAnsiChar; double_out: Pcdouble): cint; +function av_opt_eval_q (obj: pointer; o: {const} PAVOption; val: {const} PAnsiChar; q_out: PAVRational): cint; +(** + * @} + *) + + const + AV_OPT_SEARCH_CHILDREN = 0001; (**< Search in possible children of the + given object first.*) +(** + * The obj passed to av_opt_find() is fake -- only a double pointer to AVClass + * instead of a required pointer to a struct containing AVClass. This is + * useful for searching for options without needing to allocate the corresponding + * object. + *) + AV_OPT_SEARCH_FAKE_OBJ = 0002; + +(** + * 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; + +(** + * 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. + * Alternatively a double pointer to an AVClass, if + * AV_OPT_SEARCH_FAKE_OBJ search flag is set. + * @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_*. + * @param[out] target_obj if non-NULL, an object to which the option belongs will be + * written here. It may be different from obj if AV_OPT_SEARCH_CHILDREN is present + * in search_flags. This parameter is ignored if search_flags contain + * AV_OPT_SEARCH_FAKE_OBJ. + * + * @return A pointer to the option found, or NULL if no option + * was found. + *) +function av_opt_find2(obj: pointer; name: {const} PAnsiChar; unit_: {const} PAnsiChar; + opt_flags: cint; search_flags: cint; out target_obj: pointer): {const} PAVOption; + cdecl; external av__util; + +(** + * Iterate over all AVOptions belonging to obj. + * + * @param obj an AVOptions-enabled struct or a double pointer to an + * AVClass describing it. + * @param prev result of the previous call to av_opt_next() on this object + * or NULL + * @return next AVOption or NULL + *) +function av_opt_next(obj: pointer; prev: {const} PAVOption): {const} PAVOption; + cdecl; external av__util; + +(** + * Iterate over AVOptions-enabled children of obj. + * + * @param prev result of a previous call to this function or NULL + * @return next AVOptions-enabled child or NULL + *) +function av_opt_child_next(obj: pointer; prev: pointer): pointer; + cdecl; external av__util; + +(** + * Iterate over potential AVOptions-enabled children of parent. + * + * @param prev result of a previous call to this function or NULL + * @return AVClass corresponding to next potential child or NULL + *) +function av_opt_child_class_next(parent: {const} PAVClass; prev: {const} PAVClass): {const} PAVClass; + cdecl; external av__util; + +(** + * @defgroup opt_set_funcs Option setting functions + * @{ + * Those functions set the field of obj with the given name to value. + * + * @param[in] obj A struct whose first element is a pointer to an AVClass. + * @param[in] name the name of the field to set + * @param[in] val The value to set. In case of av_opt_set() if the field is not + * of a string type, then the given string is parsed. + * SI postfixes and some named scalars are supported. + * If the field is of a numeric type, it has to be a numeric or named + * scalar. Behavior with more than one scalar and +- infix operators + * is undefined. + * If the field is of a flags type, it has to be a sequence of numeric + * scalars or named flags separated by '+' or '-'. Prefixing a flag + * with '+' causes it to be set without affecting the other flags; + * similarly, '-' unsets a flag. + * @param search_flags flags passed to av_opt_find2. I.e. if AV_OPT_SEARCH_CHILDREN + * is passed here, then the option may be set on a child of obj. + * + * @return 0 if the value has been set, or an AVERROR code in case of + * error: + * AVERROR_OPTION_NOT_FOUND if no matching option exists + * AVERROR(ERANGE) if the value is out of range + * AVERROR(EINVAL) if the value is not valid + *) +function av_opt_set (obj: pointer; name: {const} PAnsiChar; val: {const} PAnsiChar; search_flags: cint): cint; + cdecl; external av__util; +function av_opt_set_int (obj: pointer; name: {const} PAnsiChar; val: cint64; search_flags: cint): cint; + cdecl; external av__util; +function av_opt_set_double (obj: pointer; name: {const} PAnsiChar; val: cdouble; search_flags: cint): cint; + cdecl; external av__util; +function av_opt_set_q (obj: pointer; name: {const} PAnsiChar; val: TAVRational; search_flags: cint): cint; + cdecl; external av__util; +function av_opt_set_bin (obj: pointer; name: {const} PAnsiChar; val: {const} cuint8; search_flags: cint): cint; + cdecl; external av__util; +function av_opt_set_image_size(obj: pointer; name: {const} PAnsiChar; w, h, search_flags: cint): cint; + cdecl; external av__util; +function av_opt_set_pixel_fmt (obj: pointer; name: {const} PAnsiChar; fmt: TAVPixelFormat; search_flags: cint): cint; + cdecl; external av__util; +function av_opt_set_sample_fmt(obj: pointer; name: {const} PAnsiChar; fmt: TAVPixelFormat; search_flags: cint): cint; + cdecl; external av__util; +function av_opt_set_video_rate(obj: pointer; name: {const} PAnsiChar; val: TAVRational; search_flags: cint): cint; + cdecl; external av__util; + +(** + * Set a binary option to an integer list. + * + * @param obj AVClass object to set options on + * @param name name of the binary option + * @param val pointer to an integer list (must have the correct type with + * regard to the contents of the list) + * @param term list terminator (usually 0 or -1) + * @param flags search flags + *) +{to be translated +#define av_opt_set_int_list(obj, name, val, term, flags) \ + (av_int_list_length(val, term) > INT_MAX / sizeof(*(val)) ? \ + AVERROR(EINVAL) : \ + av_opt_set_bin(obj, name, (const uint8_t *)(val), \ + av_int_list_length(val, term) * sizeof(*(val)), flags)) +} +(** + * @} + *) + +(** + * @defgroup opt_get_funcs Option getting functions + * @{ + * Those functions get a value of the option with the given name from an object. + * + * @param[in] obj a struct whose first element is a pointer to an AVClass. + * @param[in] name name of the option to get. + * @param[in] search_flags flags passed to av_opt_find2. I.e. if AV_OPT_SEARCH_CHILDREN + * is passed here, then the option may be found in a child of obj. + * @param[out] out_val value of the option will be written here + * @return 0 on success, a negative error code otherwise + *) +(** + * @note the returned string will av_malloc()ed and must be av_free()ed by the caller + *) +function av_opt_get (obj: pointer; name: {const} PAnsiChar; search_flags: cint; out out_val: Pcuint8): cint; + cdecl; external av__util; +function av_opt_get_int (obj: pointer; name: {const} PAnsiChar; search_flags: cint; out_val: Pcint64): cint; + cdecl; external av__util; +function av_opt_get_double (obj: pointer; name: {const} PAnsiChar; search_flags: cint; out_val: Pcdouble): cint; + cdecl; external av__util; +function av_opt_get_q (obj: pointer; name: {const} PAnsiChar; search_flags: cint; out_val: PAVRational): cint; + cdecl; external av__util; +function av_opt_get_image_size(obj: pointer; name: {const} PAnsiChar; search_flags: cint; w_out, h_out: Pcint): cint; + cdecl; external av__util; +function av_opt_get_pixel_fmt (obj: pointer; name: {const} PAnsiChar; search_flags: cint; out_fmt: PAVPixelFormat): cint; + cdecl; external av__util; +function av_opt_get_sample_fmt(obj: pointer; name: {const} PAnsiChar; search_flags: cint; out_fmt: PAVPixelFormat): cint; + cdecl; external av__util; +function av_opt_get_video_rate(obj: pointer; name: {const} PAnsiChar; search_flags: cint; out_val: PAVRational): cint; + cdecl; external av__util; +(** + * @} + *) +(** + * Gets a pointer to the requested field in a struct. + * This function allows accessing a struct even when its fields are moved or + * renamed since the application making the access has been compiled, + * + * @returns a pointer to the field, it can be cast to the correct type and read + * or written to. + *) +function av_opt_ptr(avclass: {const} PAVClass; obj: pointer; name: {const} PAnsiChar): pointer; + cdecl; external av__util; + +(** + * Free an AVOptionRanges struct and set it to NULL. + *) +procedure av_opt_freep_ranges(ranges: PPAVOptionRanges); + cdecl; external av__util; + +(** + * Get a list of allowed ranges for the given option. + * + * The returned list may depend on other fields in obj like for example profile. + * + * @param flags is a bitmask of flags, undefined flags should not be set and should be ignored + * AV_OPT_SEARCH_FAKE_OBJ indicates that the obj is a double pointer to a AVClass instead of a full instance + * + * The result must be freed with av_opt_freep_ranges. + * + * @return >= 0 on success, a negative errro code otherwise + *) +function av_opt_query_ranges(P: PPAVOptionRanges; obj: pointer; key: {const} PAnsiChar; flags: cint): cint; + cdecl; external av__util; + +(** + * Get a default list of allowed ranges for the given option. + * + * This list is constructed without using the AVClass.query_ranges() callback + * and can be used as fallback from within the callback. + * + * @param flags is a bitmask of flags, undefined flags should not be set and should be ignored + * AV_OPT_SEARCH_FAKE_OBJ indicates that the obj is a double pointer to a AVClass instead of a full instance + * + * The result must be freed with av_opt_free_ranges. + * + * @return >= 0 on success, a negative errro code otherwise + *) +function av_opt_query_ranges_default(P: PPAVOptionRanges; obj: pointer; key: {const} PAnsiChar; flags: cint): cint; + cdecl; external av__util; + +(** + * @} + *) diff --git a/src/lib/ffmpeg-2.0/libavutil/pixfmt.pas b/src/lib/ffmpeg-2.0/libavutil/pixfmt.pas new file mode 100644 index 00000000..1128de1e --- /dev/null +++ b/src/lib/ffmpeg-2.0/libavutil/pixfmt.pas @@ -0,0 +1,382 @@ +(* + * 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 + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * This is a part of the Pascal port of ffmpeg. + * - Changes and updates by the UltraStar Deluxe Team + * + * Conversion of libavutil/pixfmt.h + * avutil version 52.13.100 + * + *) + +(** + * @file + * Pixel format + *) + +const + AVPALETTE_SIZE = 1024; + AVPALETTE_COUNT = 256; + +type +(** + * Pixel format. Notes: + * + * @note + * PIX_FMT_RGB32 is handled in an endian-specific manner. An RGBA + * color is put together as: + * (A << 24) | (R << 16) | (G << 8) | B + * This is stored as BGRA on little-endian CPU architectures and ARGB on + * big-endian CPUs. + * + * @par + * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized + * image data is stored in AVFrame.data[0]. The palette is transported in + * AVFrame.data[1], is 1024 bytes long (256 4-byte entries) and is + * formatted the same as in PIX_FMT_RGB32 described above (i.e., it is + * also endian-specific). Note also that the individual RGB palette + * components stored in AVFrame.data[1] should be in the range 0..255. + * This is important as many custom PAL8 video codecs that were designed + * to run on the IBM VGA graphics adapter use 6-bit palette components. + * + * @par + * For all the 8bit per pixel formats, an RGB32 palette is in data[1] like + * for pal8. This palette is filled in automatically by the function + * 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. + *) + + PAVPixelFormat = ^TAVPixelFormat; + TAVPixelFormat = ( + AV_PIX_FMT_NONE = -1, + AV_PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) + AV_PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr + AV_PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB... + AV_PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR... + AV_PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) + AV_PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) + AV_PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) + AV_PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) + AV_PIX_FMT_GRAY8, ///< Y , 8bpp + AV_PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb + AV_PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb + AV_PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette + AV_PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_range + AV_PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_range + AV_PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_range + AV_PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing + AV_PIX_FMT_XVMC_MPEG2_IDCT, + AV_PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 + AV_PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 + AV_PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) + AV_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 + AV_PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) + AV_PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) + AV_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 + AV_PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb) + AV_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) + AV_PIX_FMT_NV21, ///< as above, but U and V bytes are swapped + + AV_PIX_FMT_ARGB, ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB... + AV_PIX_FMT_RGBA, ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA... + AV_PIX_FMT_ABGR, ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR... + AV_PIX_FMT_BGRA, ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA... + + AV_PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian + AV_PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian + AV_PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples) + AV_PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of PIX_FMT_YUV440P and setting color_range + AV_PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples) + AV_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 + AV_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 + AV_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 + AV_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 + AV_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 + AV_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 + AV_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 + + AV_PIX_FMT_RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian + AV_PIX_FMT_RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian + AV_PIX_FMT_RGB555BE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), big-endian, most significant bit to 0 + AV_PIX_FMT_RGB555LE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), little-endian, most significant bit to 0 + + AV_PIX_FMT_BGR565BE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian + AV_PIX_FMT_BGR565LE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian + AV_PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), big-endian, most significant bit to 1 + AV_PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), little-endian, most significant bit to 1 + + AV_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 + AV_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 + AV_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 + + AV_PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV422P16LE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_YUV422P16BE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_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 + AV_PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer + + AV_PIX_FMT_RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), little-endian, most significant bits to 0 + AV_PIX_FMT_RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), big-endian, most significant bits to 0 + AV_PIX_FMT_BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), little-endian, most significant bits to 1 + AV_PIX_FMT_BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), big-endian, most significant bits to 1 + AV_PIX_FMT_GRAY8A, ///< 8bit gray, 8bit alpha + AV_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 + AV_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 AV_PIX_FMT_YUV420P16* with the bpp stored separately + //is better + AV_PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_YUV422P9BE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_VDA_VLD, ///< hardware decoding through VDA + +{$IFDEF AV_PIX_FMT_ABI_GIT_MASTER} + AV_PIX_FMT_RGBA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian + AV_PIX_FMT_RGBA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian + AV_PIX_FMT_BGRA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian + AV_PIX_FMT_BGRA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian +{$ENDIF} + AV_PIX_FMT_GBRP, ///< planar GBR 4:4:4 24bpp + AV_PIX_FMT_GBRP9BE, ///< planar GBR 4:4:4 27bpp, big-endian + AV_PIX_FMT_GBRP9LE, ///< planar GBR 4:4:4 27bpp, little-endian + AV_PIX_FMT_GBRP10BE, ///< planar GBR 4:4:4 30bpp, big-endian + AV_PIX_FMT_GBRP10LE, ///< planar GBR 4:4:4 30bpp, little-endian + AV_PIX_FMT_GBRP16BE, ///< planar GBR 4:4:4 48bpp, big-endian + AV_PIX_FMT_GBRP16LE, ///< planar GBR 4:4:4 48bpp, little-endian + + /** + * duplicated pixel formats for compatibility with libav. + * FFmpeg supports these formats since May 8 2012 and Jan 28 2012 (commits f9ca1ac7 and 143a5c55) + * Libav added them Oct 12 2012 with incompatible values (commit 6d5600e85) + */ + AV_PIX_FMT_YUVA422P_LIBAV, ///< planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples) + AV_PIX_FMT_YUVA444P_LIBAV, ///< planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples) + + AV_PIX_FMT_YUVA420P9BE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), big-endian + AV_PIX_FMT_YUVA420P9LE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), little-endian + AV_PIX_FMT_YUVA422P9BE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian + AV_PIX_FMT_YUVA422P9LE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), little-endian + AV_PIX_FMT_YUVA444P9BE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big-endian + AV_PIX_FMT_YUVA444P9LE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), little-endian + AV_PIX_FMT_YUVA420P10BE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian) + AV_PIX_FMT_YUVA420P10LE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian) + AV_PIX_FMT_YUVA422P10BE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA422P10LE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian) + AV_PIX_FMT_YUVA444P10BE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA444P10LE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian) + AV_PIX_FMT_YUVA420P16BE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian) + AV_PIX_FMT_YUVA420P16LE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian) + AV_PIX_FMT_YUVA422P16BE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA422P16LE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian) + AV_PIX_FMT_YUVA444P16BE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA444P16LE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian) + + AV_PIX_FMT_VDPAU, ///< HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface + +{$IFNDEF AV_PIX_FMT_ABI_GIT_MASTER} + AV_PIX_FMT_RGBA64BE = $123, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian + AV_PIX_FMT_RGBA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian + AV_PIX_FMT_BGRA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian + AV_PIX_FMT_BGRA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian +{$ENDIF} + AV_PIX_FMT_0RGB = $123 + 4, ///< packed RGB 8:8:8, 32bpp, 0RGB0RGB... + AV_PIX_FMT_RGB0, ///< packed RGB 8:8:8, 32bpp, RGB0RGB0... + AV_PIX_FMT_0BGR, ///< packed BGR 8:8:8, 32bpp, 0BGR0BGR... + AV_PIX_FMT_BGR0, ///< packed BGR 8:8:8, 32bpp, BGR0BGR0... + AV_PIX_FMT_YUVA444P, ///< planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples) + AV_PIX_FMT_YUVA422P, ///< planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples) + + AV_PIX_FMT_YUV420P12BE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV420P12LE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV420P14BE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV420P14LE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV422P12BE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV422P12LE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_YUV422P14BE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV422P14LE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_YUV444P12BE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_PIX_FMT_YUV444P12LE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_YUV444P14BE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_PIX_FMT_YUV444P14LE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_GBRP12BE, ///< planar GBR 4:4:4 36bpp, big-endian + AV_PIX_FMT_GBRP12LE, ///< planar GBR 4:4:4 36bpp, little-endian + AV_PIX_FMT_GBRP14BE, ///< planar GBR 4:4:4 42bpp, big-endian + AV_PIX_FMT_GBRP14LE, ///< planar GBR 4:4:4 42bpp, little-endian + + AV_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 + ); + +{$IFDEF AV_HAVE_INCOMPATIBLE_FORK_ABI} +const + AV_PIX_FMT_YUVA422P = AV_PIX_FMT_YUVA422P_LIBAV; + AV_PIX_FMT_YUVA444P = AV_PIX_FMT_YUVA444P_LIBAV; +{$ENDIF} + +const + AV_PIX_FMT_Y400A = AV_PIX_FMT_GRAY8A; + AV_PIX_FMT_GBR24P = AV_PIX_FMT_GBRP; + +{$IFDEF WORDS_BIGENDIAN} + AV_PIX_FMT_RGB32 = AV_PIX_FMT_ARGB; + AV_PIX_FMT_RGB32_1 = AV_PIX_FMT_RGBA; + AV_PIX_FMT_BGR32 = AV_PIX_FMT_ABGR; + AV_PIX_FMT_BGR32_1 = AV_PIX_FMT_BGRA; + AV_PIX_FMT_0RGB32 = AV_PIX_FMT_0RGB; + AV_PIX_FMT_0BGR32 = AV_PIX_FMT_0BGR; + + AV_PIX_FMT_GRAY16 = AV_PIX_FMT_GRAY16BE; + AV_PIX_FMT_RGB48 = AV_PIX_FMT_RGB48BE; + AV_PIX_FMT_RGB565 = AV_PIX_FMT_RGB565BE; + AV_PIX_FMT_RGB555 = AV_PIX_FMT_RGB555BE; + AV_PIX_FMT_RGB444 = AV_PIX_FMT_RGB444BE; + AV_PIX_FMT_BGR48 = AV_PIX_FMT_BGR48BE; + AV_PIX_FMT_BGR565 = AV_PIX_FMT_BGR565BE; + AV_PIX_FMT_BGR555 = AV_PIX_FMT_BGR555BE; + AV_PIX_FMT_BGR444 = AV_PIX_FMT_BGR444BE; + + AV_PIX_FMT_YUV420P9 = AV_PIX_FMT_YUV420P9BE; + AV_PIX_FMT_YUV422P9 = AV_PIX_FMT_YUV422P9BE; + AV_PIX_FMT_YUV444P9 = AV_PIX_FMT_YUV444P9BE; + AV_PIX_FMT_YUV420P10 = AV_PIX_FMT_YUV420P10BE; + AV_PIX_FMT_YUV422P10 = AV_PIX_FMT_YUV422P10BE; + AV_PIX_FMT_YUV444P10 = AV_PIX_FMT_YUV444P10BE; + AV_PIX_FMT_YUV420P12 = AV_PIX_FMT_YUV420P12BE; + AV_PIX_FMT_YUV422P12 = AV_PIX_FMT_YUV422P12BE; + AV_PIX_FMT_YUV444P12 = AV_PIX_FMT_YUV444P12BE; + AV_PIX_FMT_YUV420P14 = AV_PIX_FMT_YUV420P14BE; + AV_PIX_FMT_YUV422P14 = AV_PIX_FMT_YUV422P14BE; + AV_PIX_FMT_YUV444P14= AV_PIX_FMT_YUV444P14BE; + AV_PIX_FMT_YUV420P16 = AV_PIX_FMT_YUV420P16BE; + AV_PIX_FMT_YUV422P16 = AV_PIX_FMT_YUV422P16BE; + AV_PIX_FMT_YUV444P16 = AV_PIX_FMT_YUV444P16BE; + + AV_PIX_FMT_RGBA64 = AV_PIX_FMT_RGBA64BE; + AV_PIX_FMT_BGRA64 = AV_PIX_FMT_BGRA64BE; + AV_PIX_FMT_GBRP9 = AV_PIX_FMT_GBRP9BE; + AV_PIX_FMT_GBRP10 = AV_PIX_FMT_GBRP10BE; + AV_PIX_FMT_GBRP12 = AV_PIX_FMT_GBRP12BE; + AV_PIX_FMT_GBRP14 = AV_PIX_FMT_GBRP14BE; + AV_PIX_FMT_GBRP16 = AV_PIX_FMT_GBRP16BE; +{$ELSE} + AV_PIX_FMT_RGB32 = AV_PIX_FMT_BGRA; + AV_PIX_FMT_RGB32_1 = AV_PIX_FMT_ABGR; + AV_PIX_FMT_BGR32 = AV_PIX_FMT_RGBA; + AV_PIX_FMT_BGR32_1 = AV_PIX_FMT_ARGB; + AV_PIX_FMT_0RGB32 = AV_PIX_FMT_BGR0; + AV_PIX_FMT_0BGR32 = AV_PIX_FMT_RGB0; + + AV_PIX_FMT_GRAY16 = AV_PIX_FMT_GRAY16LE; + AV_PIX_FMT_RGB48 = AV_PIX_FMT_RGB48LE; + AV_PIX_FMT_RGB565 = AV_PIX_FMT_RGB565LE; + AV_PIX_FMT_RGB555 = AV_PIX_FMT_RGB555LE; + AV_PIX_FMT_RGB444 = AV_PIX_FMT_RGB444LE; + AV_PIX_FMT_BGR48 = AV_PIX_FMT_BGR48LE; + AV_PIX_FMT_BGR565 = AV_PIX_FMT_BGR565LE; + AV_PIX_FMT_BGR555 = AV_PIX_FMT_BGR555LE; + AV_PIX_FMT_BGR444 = AV_PIX_FMT_BGR444LE; + + AV_PIX_FMT_YUV420P9 = AV_PIX_FMT_YUV420P9LE; + AV_PIX_FMT_YUV422P9 = AV_PIX_FMT_YUV422P9LE; + AV_PIX_FMT_YUV444P9 = AV_PIX_FMT_YUV444P9LE; + AV_PIX_FMT_YUV420P10 = AV_PIX_FMT_YUV420P10LE; + AV_PIX_FMT_YUV422P10 = AV_PIX_FMT_YUV422P10LE; + AV_PIX_FMT_YUV444P10 = AV_PIX_FMT_YUV444P10LE; + AV_PIX_FMT_YUV420P12 = AV_PIX_FMT_YUV420P12LE; + AV_PIX_FMT_YUV422P12 = AV_PIX_FMT_YUV422P12LE; + AV_PIX_FMT_YUV444P12 = AV_PIX_FMT_YUV444P12LE; + AV_PIX_FMT_YUV420P14 = AV_PIX_FMT_YUV420P14LE; + AV_PIX_FMT_YUV422P14 = AV_PIX_FMT_YUV422P14LE; + AV_PIX_FMT_YUV444P14= AV_PIX_FMT_YUV444P14LE; + AV_PIX_FMT_YUV420P16 = AV_PIX_FMT_YUV420P16LE; + AV_PIX_FMT_YUV422P16 = AV_PIX_FMT_YUV422P16LE; + AV_PIX_FMT_YUV444P16 = AV_PIX_FMT_YUV444P16LE; + + AV_PIX_FMT_RGBA64 = AV_PIX_FMT_RGBA64LE; + AV_PIX_FMT_BGRA64 = AV_PIX_FMT_BGRA64LE; + AV_PIX_FMT_GBRP9 = AV_PIX_FMT_GBRP9LE; + AV_PIX_FMT_GBRP10 = AV_PIX_FMT_GBRP10LE; + AV_PIX_FMT_GBRP12 = AV_PIX_FMT_GBRP12LE; + AV_PIX_FMT_GBRP14 = AV_PIX_FMT_GBRP14LE; + AV_PIX_FMT_GBRP16 = AV_PIX_FMT_GBRP16LE; +{$ENDIF} + +{$IFDEF FF_API_PIX_FMT} +type + PixelFormat = AVPixelFormat; + +const + PIX_FMT_Y400A = AV_PIX_FMT_Y400A; + PIX_FMT_GBR24P = AV_PIX_FMT_GBR24P; + + PIX_FMT_RGB32 = AV_PIX_FMT_RGB32; + PIX_FMT_RGB32_1 = AV_PIX_FMT_RGB32_1; + PIX_FMT_BGR32 = AV_PIX_FMT_BGR32; + PIX_FMT_BGR32_1 = AV_PIX_FMT_BGR32_1; + PIX_FMT_0RGB32 = AV_PIX_FMT_0RGB32; + PIX_FMT_0BGR32 = AV_PIX_FMT_0BGR32; + + PIX_FMT_GRAY16 = AV_PIX_FMT_GRAY16; + PIX_FMT_RGB48 = AV_PIX_FMT_RGB48; + PIX_FMT_RGB565 = AV_PIX_FMT_RGB565; + PIX_FMT_RGB555 = AV_PIX_FMT_RGB555; + PIX_FMT_RGB444 = AV_PIX_FMT_RGB444; + PIX_FMT_BGR48 = AV_PIX_FMT_BGR48; + PIX_FMT_BGR565 = AV_PIX_FMT_BGR565; + PIX_FMT_BGR555 = AV_PIX_FMT_BGR555; + PIX_FMT_BGR444 = AV_PIX_FMT_BGR444; + + PIX_FMT_YUV420P9 = AV_PIX_FMT_YUV420P9; + PIX_FMT_YUV422P9 = AV_PIX_FMT_YUV422P9; + PIX_FMT_YUV444P9 = AV_PIX_FMT_YUV444P9; + PIX_FMT_YUV420P10 = AV_PIX_FMT_YUV420P10; + PIX_FMT_YUV422P10 = AV_PIX_FMT_YUV422P10; + PIX_FMT_YUV444P10 = AV_PIX_FMT_YUV444P10; + PIX_FMT_YUV420P12 = AV_PIX_FMT_YUV420P12; + PIX_FMT_YUV422P12 = AV_PIX_FMT_YUV422P12; + PIX_FMT_YUV444P12 = AV_PIX_FMT_YUV444P12; + PIX_FMT_YUV420P14 = AV_PIX_FMT_YUV420P14; + PIX_FMT_YUV422P14 = AV_PIX_FMT_YUV422P14; + PIX_FMT_YUV444P14 = AV_PIX_FMT_YUV444P14; + PIX_FMT_YUV420P16 = AV_PIX_FMT_YUV420P16; + PIX_FMT_YUV422P16 = AV_PIX_FMT_YUV422P16; + PIX_FMT_YUV444P16 = AV_PIX_FMT_YUV444P16; + + PIX_FMT_RGBA64 = AV_PIX_FMT_RGBA64; + PIX_FMT_BGRA64 = AV_PIX_FMT_BGRA64; + PIX_FMT_GBRP9 = AV_PIX_FMT_GBRP9; + PIX_FMT_GBRP10 = AV_PIX_FMT_GBRP10; + PIX_FMT_GBRP12 = AV_PIX_FMT_GBRP12; + PIX_FMT_GBRP14 = AV_PIX_FMT_GBRP14; + PIX_FMT_GBRP16 = AV_PIX_FMT_GBRP16; +{$ENDIF} diff --git a/src/lib/ffmpeg-2.0/libavutil/samplefmt.pas b/src/lib/ffmpeg-2.0/libavutil/samplefmt.pas new file mode 100644 index 00000000..62241bc4 --- /dev/null +++ b/src/lib/ffmpeg-2.0/libavutil/samplefmt.pas @@ -0,0 +1,275 @@ +(* + * SampleFormat + * copyright (c) 2011 Karl-Michael Schindler <karl-michael.schindler@web.de> + * + * This library 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 + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * This is a part of the Pascal port of ffmpeg. + * + * Conversion of libavutil/samplefmt.h + * avutil version 52.13.100 + * + *) + +type +(** + * Audio Sample Formats + * + * @par + * The data described by the sample format is always in native-endian order. + * Sample values can be expressed by native C types, hence the lack of a signed + * 24-bit sample format even though it is a common raw audio data format. + * + * @par + * The floating-point formats are based on full volume being in the range + * [-1.0, 1.0]. Any values outside this range are beyond full volume level. + * + * @par + * The data layout as used in av_samples_fill_arrays() and elsewhere in FFmpeg + * (such as AVFrame in libavcodec) is as follows: + * + * For planar sample formats, each audio channel is in a separate data plane, + * and linesize is the buffer size, in bytes, for a single plane. All data + * planes must be the same size. For packed sample formats, only the first data + * plane is used, and samples for each channel are interleaved. In this case, + * linesize is the buffer size, in bytes, for the 1 plane. + *) + TAVSampleFormat = ( + AV_SAMPLE_FMT_NONE = -1, + AV_SAMPLE_FMT_U8, ///< unsigned 8 bits + AV_SAMPLE_FMT_S16, ///< signed 16 bits + AV_SAMPLE_FMT_S32, ///< signed 32 bits + AV_SAMPLE_FMT_FLT, ///< float + AV_SAMPLE_FMT_DBL, ///< double + + AV_SAMPLE_FMT_U8P, ///< unsigned 8 bits, planar + AV_SAMPLE_FMT_S16P, ///< signed 16 bits, planar + AV_SAMPLE_FMT_S32P, ///< signed 32 bits, planar + AV_SAMPLE_FMT_FLTP, ///< float, planar + AV_SAMPLE_FMT_DBLP, ///< double, planar + + AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if linking dynamically + ); + TAVSampleFormatArray = array [0 .. MaxInt div SizeOf(TAVSampleFormat) - 1] of TAVSampleFormat; + PAVSampleFormatArray = ^TAVSampleFormatArray; + +(** + * Return the name of sample_fmt, or NULL if sample_fmt is not + * recognized. + *) +function av_get_sample_fmt_name(sample_fmt: TAVSampleFormat): {const} PAnsiChar; + cdecl; external av__util; + +(** + * Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE + * on error. + *) +function av_get_sample_fmt(name: {const} PAnsiChar): TAVSampleFormat; + cdecl; external av__util; + +(** + * Return the planar<->packed alternative form of the given sample format, or + * AV_SAMPLE_FMT_NONE on error. If the passed sample_fmt is already in the + * requested planar/packed format, the format returned is the same as the + * input. + *) +function av_get_alt_sample_fmt(sample_fmt: TAVSampleFormat; planar: cint): TAVSampleFormat; + cdecl; external av__util; + +(** + * Get the packed alternative form of the given sample format. + * + * If the passed sample_fmt is already in packed format, the format returned is + * the same as the input. + * + * @return the packed alternative form of the given sample format or + AV_SAMPLE_FMT_NONE on error. + *) +function av_get_packed_sample_fmt(sample_fmt: TAVSampleFormat): TAVSampleFormat; + cdecl; external av__util; + +(** + * Get the planar alternative form of the given sample format. + * + * If the passed sample_fmt is already in planar format, the format returned is + * the same as the input. + * + * @return the planar alternative form of the given sample format or + AV_SAMPLE_FMT_NONE on error. + *) +function av_get_planar_sample_fmt(sample_fmt: TAVSampleFormat): TAVSampleFormat; + cdecl; external av__util; + +(** + * Generate a string corresponding to the sample format with + * sample_fmt, or a header if sample_fmt is negative. + * + * @param buf the buffer where to write the string + * @param buf_size the size of buf + * @param sample_fmt the number of the sample format to print the + * corresponding info string, or a negative value to print the + * corresponding header. + * @return the pointer to the filled buffer or NULL if sample_fmt is + * unknown or in case of other errors + *) +function av_get_sample_fmt_string(buf: PAnsiChar; buf_size: cint; sample_fmt: TAVSampleFormat): PAnsiChar; + cdecl; external av__util; + +{$IFDEF FF_API_GET_BITS_PER_SAMPLE_FMT} +(** + * @deprecated Use av_get_bytes_per_sample() instead. + *) +function av_get_bits_per_sample_fmt(sample_fmt: TAVSampleFormat): cint; + cdecl; external av__util; deprecated; +{$ENDIF} + +(** + * Return number of bytes per sample. + * + * @param sample_fmt the sample format + * @return number of bytes per sample or zero if unknown for the given + * sample format + *) +function av_get_bytes_per_sample(sample_fmt: TAVSampleFormat): cint; + cdecl; external av__util; + +type + OctArrayOfPcuint8 = array[0..7] of Pcuint8; + OctArrayOfcint = array[0..7] of cint; + +(** + * Check if the sample format is planar. + * + * @param sample_fmt the sample format to inspect + * @return 1 if the sample format is planar, 0 if it is interleaved + *) +function av_sample_fmt_is_planar(sample_fmt: TAVSampleFormat): cint; + cdecl; external av__util; + +(** + * Get the required buffer size for the given audio parameters. + * + * @param[out] linesize calculated linesize, may be NULL + * @param nb_channels the number of channels + * @param nb_samples the number of samples in a single channel + * @param sample_fmt the sample format + * @param align buffer size alignment (0 = default, 1 = no alignment) + * @return required buffer size, or negative error code on failure + *) +function av_samples_get_buffer_size(linesize: Pcint; nb_channels: cint; nb_samples: cint; + sample_fmt: TAVSampleFormat; align: cint): cint; + cdecl; external av__util; + +(** + * Fill plane data pointers and linesize for samples with sample + * format sample_fmt. + * + * The audio_data array is filled with the pointers to the samples data planes: + * for planar, set the start point of each channel's data within the buffer, + * for packed, set the start point of the entire buffer only. + * + * The value pointed to by linesize is set to the aligned size of each + * channel's data buffer for planar layout, or to the aligned size of the + * buffer for all channels for packed layout. + * + * The buffer in buf must be big enough to contain all the samples + * (use av_samples_get_buffer_size() to compute its minimum size), + * otherwise the audio_data pointers will point to invalid data. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param[out] audio_data array to be filled with the pointer for each channel + * @param[out] linesize calculated linesize, may be NULL + * @param buf the pointer to a buffer containing the samples + * @param nb_channels the number of channels + * @param nb_samples the number of samples in a single channel + * @param sample_fmt the sample format + * @param align buffer size alignment (0 = default, 1 = no alignment) + * @return >=0 on success or a negative error code on failure + * @todo return minimum size in bytes required for the buffer in case + * of success at the next bump + *) +function av_samples_fill_arrays(var audio_data: Pcuint8; linesize: Pcint; + buf: Pcuint8; + nb_channels: cint; nb_samples: cint; + sample_fmt: TAVSampleFormat; align: cint): cint; + cdecl; external av__util; + +(** + * Allocate a samples buffer for nb_samples samples, and fill data pointers and + * linesize accordingly. + * The allocated samples buffer can be freed by using av_freep(&audio_data[0]) + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param[out] audio_data array to be filled with the pointer for each channel + * @param[out] linesize aligned size for audio buffer(s), may be NULL + * @param nb_channels number of audio channels + * @param nb_samples number of samples per channel + * @param align buffer size alignment (0 = default, 1 = no alignment) + * @return >=0 on success or a negative error code on failure + * @todo return the size of the allocated buffer in case of success at the next bump + * @see av_samples_fill_arrays() + * @see av_samples_alloc_array_and_samples() + *) +function av_samples_alloc(var audio_data: Pcuint8; linesize: Pcint; + nb_channels: cint; nb_samples: cint; + sample_fmt: TAVSampleFormat; align: cint): cint; + cdecl; external av__util; + +(** + * Allocate a data pointers array, samples buffer for nb_samples + * samples, and fill data pointers and linesize accordingly. + * + * This is the same as av_samples_alloc(), but also allocates the data + * pointers array. + * + * @see av_samples_alloc() + *) +function av_samples_alloc_array_and_samples(var audio_data: Pcuint8; linesize: Pcint; + nb_channels: cint; nb_samples: cint; + sample_fmt: TAVSampleFormat; align: cint): cint; + cdecl; external av__util; + +(** + * Copy samples from src to dst. + * + * @param dst destination array of pointers to data planes + * @param src source array of pointers to data planes + * @param dst_offset offset in samples at which the data will be written to dst + * @param src_offset offset in samples at which the data will be read from src + * @param nb_samples number of samples to be copied + * @param nb_channels number of audio channels + * @param sample_fmt audio sample format + *) +function av_samples_copy(var dst: Pcuint8; src: {const} Pcuint8; dst_offset: cint; + src_offset: cint; nb_samples: cint; nb_channels: cint; + sample_fmt: TAVSampleFormat): cint; + cdecl; external av__util; + +(** + * Fill an audio buffer with silence. + * + * @param audio_data array of pointers to data planes + * @param offset offset in samples at which to start filling + * @param nb_samples number of samples to fill + * @param nb_channels number of audio channels + * @param sample_fmt audio sample format + *) +function av_samples_set_silence(var audio_data: Pcuint8; offset: cint; nb_samples: cint; + nb_channels: cint; sample_fmt: TAVSampleFormat): cint; + cdecl; external av__util; |