From 3a42880592166db97707282162b84c97a30cf51f Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sat, 22 Nov 2014 11:49:39 +0000 Subject: adding ffmpeg-2.4. compiles, but crashes on Mac OS X. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@3083 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/lib/ffmpeg-2.4/libavutil/buffer.pas | 290 ++++++++++ src/lib/ffmpeg-2.4/libavutil/cpu.pas | 119 ++++ src/lib/ffmpeg-2.4/libavutil/dict.pas | 143 +++++ src/lib/ffmpeg-2.4/libavutil/error.pas | 159 ++++++ src/lib/ffmpeg-2.4/libavutil/frame.pas | 822 +++++++++++++++++++++++++++ src/lib/ffmpeg-2.4/libavutil/log.pas | 530 +++++++++++++++++ src/lib/ffmpeg-2.4/libavutil/mathematics.pas | 144 +++++ src/lib/ffmpeg-2.4/libavutil/mem.pas | 353 ++++++++++++ src/lib/ffmpeg-2.4/libavutil/opt.pas | 559 ++++++++++++++++++ src/lib/ffmpeg-2.4/libavutil/pixfmt.pas | 575 +++++++++++++++++++ src/lib/ffmpeg-2.4/libavutil/samplefmt.pas | 294 ++++++++++ 11 files changed, 3988 insertions(+) create mode 100644 src/lib/ffmpeg-2.4/libavutil/buffer.pas create mode 100644 src/lib/ffmpeg-2.4/libavutil/cpu.pas create mode 100644 src/lib/ffmpeg-2.4/libavutil/dict.pas create mode 100644 src/lib/ffmpeg-2.4/libavutil/error.pas create mode 100644 src/lib/ffmpeg-2.4/libavutil/frame.pas create mode 100644 src/lib/ffmpeg-2.4/libavutil/log.pas create mode 100644 src/lib/ffmpeg-2.4/libavutil/mathematics.pas create mode 100644 src/lib/ffmpeg-2.4/libavutil/mem.pas create mode 100644 src/lib/ffmpeg-2.4/libavutil/opt.pas create mode 100644 src/lib/ffmpeg-2.4/libavutil/pixfmt.pas create mode 100644 src/lib/ffmpeg-2.4/libavutil/samplefmt.pas (limited to 'src/lib/ffmpeg-2.4/libavutil') diff --git a/src/lib/ffmpeg-2.4/libavutil/buffer.pas b/src/lib/ffmpeg-2.4/libavutil/buffer.pas new file mode 100644 index 00000000..c1502f51 --- /dev/null +++ b/src/lib/ffmpeg-2.4/libavutil/buffer.pas @@ -0,0 +1,290 @@ +(* + * AVOptions + * copyright (c) 2005 Michael Niedermayer + * + * 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/buffer.h + * avutil version 54.7.100 + * + *) + +const +(** + * Always treat the buffer as read-only, even when it has only one + * reference. + *) + AV_BUFFER_FLAG_READONLY = (1 << 0); + +type +(** + * @defgroup lavu_buffer AVBuffer + * @ingroup lavu_data + * + * @ + * AVBuffer is an API for reference-counted data buffers. + * + * There are two core objects in this API -- AVBuffer and AVBufferRef. AVBuffer + * represents the data buffer itself; it is opaque and not meant to be accessed + * by the caller directly, but only through AVBufferRef. However, the caller may + * e.g. compare two AVBuffer pointers to check whether two different references + * are describing the same data buffer. AVBufferRef represents a single + * reference to an AVBuffer and it is the object that may be manipulated by the + * caller directly. + * + * There are two functions provided for creating a new AVBuffer with a single + * reference -- av_buffer_alloc() to just allocate a new buffer, and + * av_buffer_create() to wrap an existing array in an AVBuffer. From an existing + * reference, additional references may be created with av_buffer_ref(). + * Use av_buffer_unref() to free a reference (this will automatically free the + * data once all the references are freed). + * + * The convention throughout this API and the rest of FFmpeg is such that the + * buffer is considered writable if there exists only one reference to it (and + * it has not been marked as read-only). The av_buffer_is_writable() function is + * provided to check whether this is true and av_buffer_make_writable() will + * automatically create a new writable buffer when necessary. + * Of course nothing prevents the calling code from violating this convention, + * however that is safe only when all the existing references are under its + * control. + * + * @note Referencing and unreferencing the buffers is thread-safe and thus + * may be done from multiple threads simultaneously without any need for + * additional locking. + * + * @note Two different references to the same buffer can point to different + * parts of the buffer (i.e. their AVBufferRef.data will not be equal). + *) + +(** + * A reference counted buffer type. It is opaque and is meant to be used through + * references (AVBufferRef). + *) + TAVBuffer = record + end; + +(** + * A reference to a data buffer. + * + * The size of this struct is not a part of the public ABI and it is not meant + * to be allocated directly. + *) + PPAVBufferRef = ^PAVBufferRef; + PAVBufferRef = ^TAVBufferRef; + TAVBufferRef = record + buffer: TAVBuffer; + (** + * The data buffer. It is considered writable if and only if + * this is the only reference to the buffer, in which case + * av_buffer_is_writable() returns 1. + *) + data: PByte; + (** + * Size of data in bytes. + *) + size: cint; + end; + + //callbacks used in the functions av_buffer_create and av_buffer_pool_init respectively + TFree = procedure(opaque: pointer; data: pbyte); + TAlloc = function(size: cint): PAVBufferRef; + +(** + * The buffer pool. This structure is opaque and not meant to be accessed + * directly. It is allocated with av_buffer_pool_init() and freed with + * av_buffer_pool_uninit(). + *) + PPAVBufferPool = ^PAVBufferPool; + PAVBufferPool = ^TAVBufferPool; + TAVBufferPool = record + end; + +(** + * Allocate an AVBuffer of the given size using av_malloc(). + * + * @return an AVBufferRef of given size or NULL when out of memory + *) +function av_buffer_alloc(size: cint): PAVBufferRef; + cdecl; external av__util; + +(** + * Same as av_buffer_alloc(), except the returned buffer will be initialized + * to zero. + *) +function av_buffer_allocz(size: cint): PAVBufferRef; + cdecl; external av__util; + +(** + * Create an AVBuffer from an existing array. + * + * If this function is successful, data is owned by the AVBuffer. The caller may + * only access data through the returned AVBufferRef and references derived from + * it. + * If this function fails, data is left untouched. + * @param data data array + * @param size size of data in bytes + * @param free a callback for freeing this buffer's data + * @param opaque parameter to be got for processing or passed to free + * @param flags a combination of AV_BUFFER_FLAG_* + * + * @return an AVBufferRef referring to data on success, NULL on failure. + *) + +function av_buffer_create(data: PByte; size: cint; + free: TFree; + opaque: pointer; flags: cint): PAVBufferRef; + cdecl; external av__util; + +(** + * Default free callback, which calls av_free() on the buffer data. + * This function is meant to be passed to av_buffer_create(), not called + * directly. + *) +procedure av_buffer_default_free(opaque: pointer; data: pbyte); + cdecl; external av__util; + +(** + * Create a new reference to an AVBuffer. + * + * @return a new AVBufferRef referring to the same AVBuffer as buf or NULL on + * failure. + *) +function av_buffer_ref(buf: PAVBufferRef): PAVBufferRef; + cdecl; external av__util; + +(** + * Free a given reference and automatically free the buffer if there are no more + * references to it. + * + * @param buf the reference to be freed. The pointer is set to NULL on return. + *) +procedure av_buffer_unref(buf: PPAVBufferRef); + cdecl; external av__util; + +(** + * @return 1 if the caller may write to the data referred to by buf (which is + * true if and only if buf is the only reference to the underlying AVBuffer). + * Return 0 otherwise. + * A positive answer is valid until av_buffer_ref() is called on buf. + *) +function av_buffer_is_writable(buf: {const} PAVBufferRef): cint; + cdecl; external av__util; + +(** + * @return the opaque parameter set by av_buffer_create. + *) +procedure av_buffer_get_opaque(buf: {const} PAVBufferRef); + cdecl; external av__util; + +function av_buffer_get_ref_count(buf: {const} PAVBufferRef): cint; + cdecl; external av__util; + +(** + * Create a writable reference from a given buffer reference, avoiding data copy + * if possible. + * + * @param buf buffer reference to make writable. On success, buf is either left + * untouched, or it is unreferenced and a new writable AVBufferRef is + * written in its place. On failure, buf is left untouched. + * @return 0 on success, a negative AVERROR on failure. + *) +function av_buffer_make_writable(buf: PPAVBufferRef): cint; + cdecl; external av__util; + +(** + * Reallocate a given buffer. + * + * @param buf a buffer reference to reallocate. On success, buf will be + * unreferenced and a new reference with the required size will be + * written in its place. On failure buf will be left untouched. *buf + * may be NULL, then a new buffer is allocated. + * @param size required new buffer size. + * @return 0 on success, a negative AVERROR on failure. + * + * @note the buffer is actually reallocated with av_realloc() only if it was + * initially allocated through av_buffer_realloc(NULL) and there is only one + * reference to it (i.e. the one passed to this function). In all other cases + * a new buffer is allocated and the data is copied. + *) +function av_buffer_realloc(buf: PPAVBufferRef; size: cint): cint; + cdecl; external av__util; + +(** + * @defgroup lavu_bufferpool AVBufferPool + * @ingroup lavu_data + * + * @ + * AVBufferPool is an API for a lock-free thread-safe pool of AVBuffers. + * + * Frequently allocating and freeing large buffers may be slow. AVBufferPool is + * meant to solve this in cases when the caller needs a set of buffers of the + * same size (the most obvious use case being buffers for raw video or audio + * frames). + * + * At the beginning, the user must call av_buffer_pool_init() to create the + * buffer pool. Then whenever a buffer is needed, call av_buffer_pool_get() to + * get a reference to a new buffer, similar to av_buffer_alloc(). This new + * reference works in all aspects the same way as the one created by + * av_buffer_alloc(). However, when the last reference to this buffer is + * unreferenced, it is returned to the pool instead of being freed and will be + * reused for subsequent av_buffer_pool_get() calls. + * + * When the caller is done with the pool and no longer needs to allocate any new + * buffers, av_buffer_pool_uninit() must be called to mark the pool as freeable. + * Once all the buffers are released, it will automatically be freed. + * + * Allocating and releasing buffers with this API is thread-safe as long as + * either the default alloc callback is used, or the user-supplied one is + * thread-safe. + *) + +(** + * Allocate and initialize a buffer pool. + * + * @param size size of each buffer in this pool + * @param alloc a function that will be used to allocate new buffers when the + * pool is empty. May be NULL, then the default allocator will be used + * (av_buffer_alloc()). + * @return newly created buffer pool on success, NULL on error. + *) +function av_buffer_pool_init(size: cint; alloc: TAlloc): PAVBufferRef; + cdecl; external av__util; + +(** + * Mark the pool as being available for freeing. It will actually be freed only + * once all the allocated buffers associated with the pool are released. Thus it + * is safe to call this function while some of the allocated buffers are still + * in use. + * + * @param pool pointer to the pool to be freed. It will be set to NULL. + * @see av_buffer_pool_can_uninit() + *) +procedure av_buffer_pool_uninit(pool: PPAVBufferPool); + cdecl; external av__util; + +(** + * Allocate a new AVBuffer, reusing an old buffer from the pool when available. + * This function may be called simultaneously from multiple threads. + * + * @return a reference to the new buffer on success, NULL on error. + *) +function av_buffer_pool_get(pool: PAVBufferPool): PAVBufferRef; + cdecl; external av__util; diff --git a/src/lib/ffmpeg-2.4/libavutil/cpu.pas b/src/lib/ffmpeg-2.4/libavutil/cpu.pas new file mode 100644 index 00000000..5d2e02da --- /dev/null +++ b/src/lib/ffmpeg-2.4/libavutil/cpu.pas @@ -0,0 +1,119 @@ +(* + * 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 54.7.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 + ///< than regular MMX/SSE (e.g. Core1) + 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 + ///< than regular MMX/SSE (e.g. Core1) + 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_AVX2 = $8000; ///< AVX2 functions: requires OS support even if YMM registers aren't used + AV_CPU_FLAG_FMA3 = $10000; ///< Haswell FMA3 functions + AV_CPU_FLAG_BMI1 = $20000; ///< Bit Manipulation Instruction Set 1 + AV_CPU_FLAG_BMI2 = $40000; ///< Bit Manipulation Instruction Set 2 + + 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); + AV_CPU_FLAG_ARMV8 = (1 << 6); + AV_CPU_FLAG_SETEND = (1 <<16); + +(** + * 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; diff --git a/src/lib/ffmpeg-2.4/libavutil/dict.pas b/src/lib/ffmpeg-2.4/libavutil/dict.pas new file mode 100644 index 00000000..ec3c2521 --- /dev/null +++ b/src/lib/ffmpeg-2.4/libavutil/dict.pas @@ -0,0 +1,143 @@ +(* + * AVDictionary + * copyright (c) 2011 Karl-Michael Schindler + * + * 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 54.7.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() or another memory allocation function. *) + AV_DICT_DONT_STRDUP_VAL = 8; (**< Take ownership of a value that's been + allocated with av_malloc() or another memory allocation function. *) + 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. + * + * The returned entry key or value must not be changed, or it will + * cause undefined behavior. + * + * To iterate through all the dictionary entries, you can set the matching key + * to the null string "" and set the AV_DICT_IGNORE_SUFFIX flag. + * + * @param key 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 a collection of AV_DICT_* flags controlling how the entry is retrieved + * @return found entry or NULL in case no matching entry was found in the dictionary + *) +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. + * + * Note: If AV_DICT_DONT_STRDUP_KEY or AV_DICT_DONT_STRDUP_VAL is set, + * these arguments will be freed on error. + * + * @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; + +(** + * Convenience wrapper for av_dict_set that converts the value to a string + * and stores it. + * + * Note: If AV_DICT_DONT_STRDUP_KEY is set, key will be freed on error. + *) +function av_dict_set_int(var pm: PAVDictionary; {const} key: PAnsiChar; + value: cint64; flags: cint): cint; + cdecl; external av__util; + +(** + * Parse the key/value pairs list and add the parsed entries to a dictionary. + * + * In case of failure, all the successfully set entries are stored in + * *pm. You may need to manually free the created 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.4/libavutil/error.pas b/src/lib/ffmpeg-2.4/libavutil/error.pas new file mode 100644 index 00000000..219f4dfd --- /dev/null +++ b/src/lib/ffmpeg-2.4/libavutil/error.pas @@ -0,0 +1,159 @@ +(* + * 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 54.7.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. + AVERROR_INPUT_CHANGED = -($636e6701); ///< Input changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_OUTPUT_CHANGED) + AVERROR_OUTPUT_CHANGED = -($636e6702); ///< Output changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_INPUT_CHANGED) + + 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.4/libavutil/frame.pas b/src/lib/ffmpeg-2.4/libavutil/frame.pas new file mode 100644 index 00000000..6edcad5d --- /dev/null +++ b/src/lib/ffmpeg-2.4/libavutil/frame.pas @@ -0,0 +1,822 @@ +(* + * AVOptions + * copyright (c) 2005 Michael Niedermayer + * + * 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/frame.h + * avutil version 54.7.100 + * +*) + +const + AV_NUM_DATA_POINTERS = 8; + + (** from the definitions of TAVFrame *) + + (** + * The frame data may be corrupted, e.g. due to decoding errors. + *) + AV_FRAME_FLAG_CORRUPT = (1 << 0); + + FF_DECODE_ERROR_INVALID_BITSTREAM = 1; + FF_DECODE_ERROR_MISSING_REFERENCE = 2; + + +type +(* is already in pixfmt.pas + TAVColorSpace = ( + AVCOL_SPC_RGB = 0, + AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B + AVCOL_SPC_UNSPECIFIED = 2, + AVCOL_SPC_FCC = 4, + AVCOL_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 + AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above + AVCOL_SPC_SMPTE240M_ = 7, + AVCOL_SPC_YCGCO = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16 + AVCOL_SPC_BT2020_NCL = 9, ///< ITU-R BT2020 non-constant luminance system + AVCOL_SPC_BT2020_CL = 10, ///< ITU-R BT2020 constant luminance system + AVCOL_SPC_NB ///< Not part of ABI + ); + + TAVColorRange = ( + AVCOL_RANGE_UNSPECIFIED = 0, + AVCOL_RANGE_MPEG = 1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges + AVCOL_RANGE_JPEG = 2, ///< the normal 2^n-1 "JPEG" YUV ranges + AVCOL_RANGE_NB ///< Not part of ABI + ); +*) + +(* Note: AVPanScan is defined in avcodec.h but is here to avoid reference problems - Brian-ch 28/09/2014 + * + * Pan Scan area. + * This specifies the area which should be displayed. + * Note there may be multiple such areas for one frame. + *) + PAVPanScan = ^TAVPanScan; + TAVPanScan = record {24} + (*** id. + * - encoding: set by user. + * - decoding: set by libavcodec. *) + id: cint; + + (*** width and height in 1/16 pel + * - encoding: set by user. + * - decoding: set by libavcodec. *) + width: cint; + height: cint; + + (*** position of the top left corner in 1/16 pel for up to 3 fields/frames. + * - encoding: set by user. + * - decoding: set by libavcodec. *) + position: array [0..2] of array [0..1] of cint16; + end; {TAVPanScan} + + (** + * @defgroup lavu_frame AVFrame + * @ingroup lavu_data + * + * @ + * AVFrame is an abstraction for reference-counted raw multimedia data. + *) + TAVFrameSideDataType = ( + (** + * The data is the AVPanScan struct defined in libavcodec. + *) + AV_FRAME_DATA_PANSCAN, + (** + * ATSC A53 Part 4 Closed Captions. + * A53 CC bitstream is stored as uint8_t in AVFrameSideData.data. + * The number of bytes of CC data is AVFrameSideData.size. + *) + AV_FRAME_DATA_A53_CC, + (** + * Stereoscopic 3d metadata. + * The data is the AVStereo3D struct defined in libavutil/stereo3d.h. + *) + AV_FRAME_DATA_STEREO3D, + (** + * The data is the AVMatrixEncoding enum defined in libavutil/channel_layout.h. + *) + AV_FRAME_DATA_MATRIXENCODING, + (** + * Metadata relevant to a downmix procedure. + * The data is the AVDownmixInfo struct defined in libavutil/downmix_info.h. + *) + AV_FRAME_DATA_DOWNMIX_INFO, + (** + * ReplayGain information in the form of the AVReplayGain struct. + *) + AV_FRAME_DATA_REPLAYGAIN, + (** + * This side data contains a 3x3 transformation matrix describing an affine + * transformation that needs to be applied to the frame for correct + * presentation. + * + * See libavutil/display.h for a detailed description of the data. + *) + AV_FRAME_DATA_DISPLAYMATRIX, + (** + * Active Format Description data consisting of a single byte as specified + * in ETSI TS 101 154 using AVActiveFormatDescription enum. + *) + AV_FRAME_DATA_AFD, + (** + * Motion vectors exported by some codecs (on demand through the export_mvs + * flag set in the libavcodec AVCodecContext flags2 option). + * The data is the AVMotionVector struct defined in + * libavutil/motion_vector.h. + *) + AV_FRAME_DATA_MOTION_VECTORS + ); + + TAVActiveFormatDescription = ( + AV_AFD_SAME = 8, + AV_AFD_4_3 = 9, + AV_AFD_16_9 = 10, + AV_AFD_14_9 = 11, + AV_AFD_4_3_SP_14_9 = 13, + AV_AFD_16_9_SP_14_9 = 14, + AV_AFD_SP_4_3 = 15 + ); {TAVActiveFormatDescription} + + PAVFrameSideData = ^TAVFrameSideData; + TAVFrameSideData = record + type_: TAVFrameSideDataType; + data: PByte; + size: cint; + metadata: TAVDictionary; + end; {TAVFrameSideData} + +(** + * This structure describes decoded (raw) audio or video data. + * + * AVFrame must be allocated using av_frame_alloc(). Note that this only + * allocates the AVFrame itself, the buffers for the data must be managed + * through other means (see below). + * AVFrame must be freed with av_frame_free(). + * + * AVFrame is typically allocated once and then reused multiple times to hold + * different data (e.g. a single AVFrame to hold frames received from a + * decoder). In such a case, av_frame_unref() will free any references held by + * the frame and reset it to its original clean state before it + * is reused again. + * + * The data described by an AVFrame is usually reference counted through the + * AVBuffer API. The underlying buffer references are stored in AVFrame.buf / + * AVFrame.extended_buf. An AVFrame is considered to be reference counted if at + * least one reference is set, i.e. if AVFrame.buf[0] != NULL. In such a case, + * every single data plane must be contained in one of the buffers in + * AVFrame.buf or AVFrame.extended_buf. + * There may be a single buffer for all the data, or one separate buffer for + * each plane, or anything in between. + * + * sizeof(AVFrame) is not a part of the public ABI, so new fields may be added + * to the end with a minor bump. + * Similarly fields that are marked as to be only accessed by + * av_opt_ptr() can be reordered. This allows 2 forks to add fields + * without breaking compatibility with each other. +*) + PPAVFrame = ^PAVFrame; + PAVFrame = ^TAVFrame; + TAVFrame = record + (** + * pointer to the picture/channel planes. + * This might be different from the first allocated byte + * + * Some decoders access areas outside 0,0 - width,height, please + * see avcodec_align_dimensions2(). Some filters and swscale can read + * up to 16 bytes beyond the planes, if these filters are to be used, + * then 16 extra bytes must be allocated. + *) + data: array [0..AV_NUM_DATA_POINTERS - 1] of pbyte; + + (** + * For video, size in bytes of each picture line. + * For audio, size in bytes of each plane. + * + * For audio, only linesize[0] may be set. For planar audio, each channel + * plane must be the same size. + * + * For video the linesizes should be multiples of the CPUs alignment + * preference, this is 16 or 32 for modern desktop CPUs. + * Some code requires such alignment other code can be slower without + * correct alignment, for yet other it makes no difference. + * + * @note The linesize may be larger than the size of usable data -- there + * may be extra padding present for performance reasons. + *) + linesize: array [0..AV_NUM_DATA_POINTERS - 1] of cint; + + (** + * pointers to the data planes/channels. + * + * For video, this should simply point to data[]. + * + * For planar audio, each channel has a separate data pointer, and + * linesize[0] contains the size of each channel buffer. + * For packed audio, there is just one data pointer, and linesize[0] + * contains the total size of the buffer for all channels. + * + * Note: Both data and extended_data will always be set by get_buffer(), + * but for planar audio with more channels that can fit in data, + * extended_data must be used in order to access all channels. + *) + extended_data: ^pbyte; + + (** + * width and height of the video frame + *) + width, height: cint; + (** + * number of audio samples (per channel) described by this frame + *) + nb_samples: cint; + + (** + * format of the frame, -1 if unknown or unset + * Values correspond to enum AVPixelFormat for video frames, + * enum AVSampleFormat for audio) + *) + format: cint; + + (** + * 1 -> keyframe, 0-> not + *) + key_frame: cint; + + (** + * Picture type of the frame + *) + pict_type: TAVPictureType; + +{$IFDEF FF_API_AVFRAME_LAVC} + base: array [0..AV_NUM_DATA_POINTERS - 1] of pbyte; {deprecated} +{$ENDIF} + + (** + * sample aspect ratio for the video frame, 0/1 if unknown/unspecified + *) + sample_aspect_ratio: TAVRational; + + (** + * presentation timestamp in time_base units (time when frame should be shown to user) + *) + pts: cint64; + + (** + * pts copied from the AVPacket that was decoded to produce this frame + *) + pkt_pts: cint64; + + (** + * DTS copied from the AVPacket that triggered returning this frame. (if frame threading isn't used) + * This is also the Presentation time of this AVFrame calculated from + * only AVPacket.dts values without pts values. + *) + pkt_dts: cint64; + + (** + * picture number in bitstream order + *) + coded_picture_number: cint; + + (** + * picture number in display order + *) + display_picture_number: cint; + + (** + * quality (between 1 (good) and FF_LAMBDA_MAX (bad)) + *) + quality: cint; + +{$IFDEF FF_API_AVFRAME_LAVC} + reference: cint; {deprecated} + + (** + * QP table + *) + qscale_table: pbyte; {deprecated} + + (** + * QP store stride + *) + qstride: cint; {deprecated} + qscale_type: cint; {deprecated} + + (** + * mbskip_table[mb]>=1 if MB didn't change + * stride= mb_width = (width+15)>>4 + *) + mbskip_table: pbyte; {deprecated} + + (** + * motion vector table + * @code + * example: + * int mv_sample_log2= 4 - motion_subsample_log2; + * int mb_width= (width+15)>>4; + * int mv_stride= (mb_width << mv_sample_log2) + 1; + * motion_val[direction][x + y*mv_stride][0->mv_x, 1->mv_y]; + * @endcode + *) + motion_val: array [0..1] of pointer; + + (** + * macroblock type table + * mb_type_base + mb_width + 2 + *) + mb_type: PCuint; {deprecated} + + (** + * DCT coefficients + *) + dct_coeff: PsmallInt; {deprecated} + + (** + * motion reference frame index + * the order in which these are stored can depend on the codec. + *) + ref_index: array [0..1] of pbyte; {deprecated} +{$ENDIF} + + (** + * for some private data of the user + *) + opaque: pointer; + + (** + * error + *) + error: array [0..AV_NUM_DATA_POINTERS - 1] of cuint64; + +{$IFDEF FF_API_AVFRAME_LAVC} + type_: cint; {deprecated} +{$ENDIF} + + (** + * When decoding, this signals how much the picture must be delayed. + * extra_delay = repeat_pict / (2*fps) + *) + repeat_pict: cint; + + (** + * The content of the picture is interlaced. + *) + interlaced_frame: cint; + + (** + * If the content is interlaced, is top field displayed first. + *) + top_field_first: cint; + + (** + * Tell user application that palette has changed from previous frame. + *) + palette_has_changed: cint; + +{$IFDEF FF_API_AVFRAME_LAVC} + buffer_hints: cint; {deprecated} + (** + * Pan scan. + *) + pan_scan: PAVPanScan; {deprecated} +{$ENDIF} + + (** + * reordered opaque 64bit (generally an integer or a double precision float + * PTS but can be anything). + * The user sets AVCodecContext.reordered_opaque to represent the input at + * that time, + * the decoder reorders values as needed and sets AVFrame.reordered_opaque + * to exactly one of the values provided by the user through AVCodecContext.reordered_opaque + * @deprecated in favor of pkt_pts + *) + reordered_opaque: cint64; + +{$IFDEF FF_API_AVFRAME_LAVC} + (** + * @deprecated this field is unused + *) + hwaccel_picture_private: pointer; {deprecated} + owner: pointer; {deprecated} (** Note: Should be a PAVCodecContext, but a type pointer is used to avoid a reference problem. *) + thread_opaque: pointer; {deprecated} + + (** + * log2 of the size of the block which a single vector in motion_val represents: + * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2) + *) + motion_subsample_log2: cuint8; {deprecated} +{$ENDIF} + + (** + * Sample rate of the audio data. + *) + sample_rate: cint; + + (** + * Channel layout of the audio data. + *) + channel_layout: cuint64; + + (** + * AVBuffer references backing the data for this frame. If all elements of + * this array are NULL, then this frame is not reference counted. + * + * There may be at most one AVBuffer per data plane, so for video this array + * always contains all the references. For planar audio with more than + * AV_NUM_DATA_POINTERS channels, there may be more buffers than can fit in + * this array. Then the extra AVBufferRef pointers are stored in the + * extended_buf array. + *) + buf: array [0..AV_NUM_DATA_POINTERS - 1] of PAVBufferRef; + + (** + * For planar audio which requires more than AV_NUM_DATA_POINTERS + * AVBufferRef pointers, this array will hold all the references which + * cannot fit into AVFrame.buf. + * + * Note that this is different from AVFrame.extended_data, which always + * contains all the pointers. This array only contains the extra pointers, + * which cannot fit into AVFrame.buf. + * + * This array is always allocated using av_malloc() by whoever constructs + * the frame. It is freed in av_frame_unref(). + *) + extended_buf: PPAVBufferRef; + + (** + * Number of elements in extended_buf. + *) + nb_extended_buf: cint; + + side_data: ^PAVFrameSideData; + nb_side_data: cint; + + (** + * @defgroup lavu_frame_flags AV_FRAME_FLAGS + * Flags describing additional frame properties. + * + * @ + *) + + (** + * Frame flags, a combination of @ref lavu_frame_flags + *) + flags: cint; + + (** + * MPEG vs JPEG YUV range. + * It must be accessed using av_frame_get_color_range() and + * av_frame_set_color_range(). + * - encoding: Set by user + * - decoding: Set by libavcodec + *) + color_range: TAVColorRange; + + color_primaries: TAVColorPrimaries; + + color_trc: TAVColorTransferCharacteristic; + + (** + * YUV colorspace type. + * It must be accessed using av_frame_get_colorspace() and + * av_frame_set_colorspace(). + * - encoding: Set by user + * - decoding: Set by libavcodec + *) + colorspace: TAVColorSpace; + + chroma_location: TAVChromaLocation; + + (** + * frame timestamp estimated using various heuristics, in stream time base + * Code outside libavcodec should access this field using: + * av_frame_get_best_effort_timestamp(frame) + * - encoding: unused + * - decoding: set by libavcodec, read by user. + *) + best_effort_timestamp: cint64; + + (** + * reordered pos from the last AVPacket that has been input into the decoder + * Code outside libavcodec should access this field using: + * av_frame_get_pkt_pos(frame) + * - encoding: unused + * - decoding: Read by user. + *) + pkt_pos: cint64; + + (** + * duration of the corresponding packet, expressed in + * AVStream->time_base units, 0 if unknown. + * Code outside libavcodec should access this field using: + * av_frame_get_pkt_duration(frame) + * - encoding: unused + * - decoding: Read by user. + *) + pkt_duration: cint64; + + (** + * metadata. + * Code outside libavcodec should access this field using: + * av_frame_get_metadata(frame) + * - encoding: Set by user. + * - decoding: Set by libavcodec. + *) + metadata: PAVDictionary; + + (** + * decode error flags of the frame, set to a combination of + * FF_DECODE_ERROR_xxx flags if the decoder produced a frame, but there + * were errors during the decoding. + * Code outside libavcodec should access this field using: + * av_frame_get_decode_error_flags(frame) + * - encoding: unused + * - decoding: set by libavcodec, read by user. + *) + decode_error_flags: cint; + + (** + * number of audio channels, only used for audio. + * Code outside libavcodec should access this field using: + * av_frame_get_channels(frame) + * - encoding: unused + * - decoding: Read by user. + *) + channels: cint; + + (** + * size of the corresponding packet containing the compressed + * frame. It must be accessed using av_frame_get_pkt_size() and + * av_frame_set_pkt_size(). + * It is set to a negative value if unknown. + * - encoding: unused + * - decoding: set by libavcodec, read by user. + *) + pkt_size: cint; + + (** + * Not to be accessed directly from outside libavutil + *) + qp_table_buf: PAVBufferRef; + end; {TAVFrame} + +(** + * Accessors for some AVFrame fields. + * The position of these field in the structure is not part of the ABI, + * they should not be accessed directly outside libavcodec. + *) +function av_frame_get_best_effort_timestamp(frame: {const} PAVFrame): cint64; + cdecl; external av__codec; overload; +procedure av_frame_set_best_effort_timestamp(frame: PAVFrame; val: cint64); + cdecl; external av__codec; overload; +function av_frame_get_pkt_duration (frame: {const} PAVFrame): cint64; + cdecl; external av__codec; overload; +procedure av_frame_get_pkt_duration (frame: PAVFrame; val: cint64); + cdecl; external av__codec; overload; +function av_frame_get_pkt_pos (frame: {const} PAVFrame): cint64; + cdecl; external av__codec; overload; +procedure av_frame_get_pkt_pos (frame: PAVFrame; val: cint64); + cdecl; external av__codec; overload; +function av_frame_get_channel_layout (frame: {const} PAVFrame): cint64; + cdecl; external av__codec; overload; +procedure av_frame_get_channel_layout (frame: PAVFrame; val: cint64); + cdecl; external av__codec; overload; +function av_frame_get_channels (frame: {const} PAVFrame): cint; + cdecl; external av__codec; +procedure av_frame_set_channels (frame: PAVFrame; val: cint); + cdecl; external av__codec; +function av_frame_get_sample_rate (frame: {const} PAVFrame): cint; + cdecl; external av__codec; +procedure av_frame_set_sample_rate (frame: PAVFrame; val: cint); + cdecl; external av__codec; +function av_frame_get_metadata (frame: {const} PAVFrame): PAVDictionary; + cdecl; external av__codec; +procedure av_frame_set_metadata (frame: PAVFrame; val: PAVDictionary); + cdecl; external av__codec; +function av_frame_get_decode_error_flags (frame: {const} PAVFrame): cint; + cdecl; external av__codec; +procedure av_frame_set_decode_error_flags (frame: PAVFrame; val: cint); + cdecl; external av__codec; +function av_frame_get_pkt_size (frame: {const} PAVFrame): cint; + cdecl; external av__codec; +procedure av_frame_set_pkt_size (frame: PAVFrame; val: cint); + cdecl; external av__codec; +function avpriv_frame_get_metadatap(frame: PAVFrame): PPAVDictionary; + cdecl; external av__codec; +function av_frame_get_qp_table(f: PAVFrame; stride: pcint; type_: pcint): PByte; + cdecl; external av__codec; +function av_frame_set_qp_table(f: PAVFrame; buf: PAVBufferRef; stride: cint; type_: cint): cint; + cdecl; external av__codec; +function av_frame_get_colorspace(frame: {const} PAVFrame): TAVColorSpace; + cdecl; external av__codec; +procedure av_frame_set_colorspace(frame: PAVFrame; val: TAVColorSpace); + cdecl; external av__codec; +procedure av_frame_set_color_range(frame: PAVFrame; val: TAVColorSpace); + cdecl; external av__codec; + +(** + * Get the name of a colorspace. + * @return a static string identifying the colorspace; can be NULL. + *) +function av_get_colorspace_name(val: TAVColorSpace): PAnsiChar; + cdecl; external av__codec; + +(** + * Allocate an AVFrame and set its fields to default values. The resulting + * struct must be freed using av_frame_free(). + * + * @return An AVFrame filled with default values or NULL on failure. + * + * @note this only allocates the AVFrame itself, not the data buffers. Those + * must be allocated through other means, e.g. with av_frame_get_buffer() or + * manually. + *) +function av_frame_alloc(): PAVFrame; + cdecl; external av__codec; + +(** + * Free the frame and any dynamically allocated objects in it, + * e.g. extended_data. If the frame is reference counted, it will be + * unreferenced first. + * + * @param frame frame to be freed. The pointer will be set to NULL. + *) +procedure av_frame_free(frame: PPAVFrame); + cdecl; external av__codec; + +(** + * Set up a new reference to the data described by the source frame. + * + * Copy frame properties from src to dst and create a new reference for each + * AVBufferRef from src. + * + * If src is not reference counted, new buffers are allocated and the data is + * copied. + * + * @return 0 on success, a negative AVERROR on error + *) +function av_frame_ref(dst: PAVFrame; src: {const} PAVFrame): cint; + cdecl; external av__codec; + +(** + * Create a new frame that references the same data as src. + * + * This is a shortcut for av_frame_alloc()+av_frame_ref(). + * + * @return newly created AVFrame on success, NULL on error. + *) +function av_frame_clone(src: {const} PAVFrame): PAVFrame; + cdecl; external av__codec; + +(** + * Unreference all the buffers referenced by frame and reset the frame fields. + *) +procedure av_frame_unref(frame: PAVFrame); + cdecl; external av__codec; + +(** + * Move everythnig contained in src to dst and reset src. + *) +procedure av_frame_move_ref(dst, src: PAVFrame); + cdecl; external av__codec; + +(** + * Allocate new buffer(s) for audio or video data. + * + * The following fields must be set on frame before calling this function: + * - format (pixel format for video, sample format for audio) + * - width and height for video + * - nb_samples and channel_layout for audio + * + * This function will fill AVFrame.data and AVFrame.buf arrays and, if + * necessary, allocate and fill AVFrame.extended_data and AVFrame.extended_buf. + * For planar formats, one buffer will be allocated for each plane. + * + * @param frame frame in which to store the new buffers. + * @param align required buffer size alignment + * + * @return 0 on success, a negative AVERROR on error. + *) +function av_frame_get_buffer(frame: PAVFrame; align: cint): cint; + cdecl; external av__codec; + +(** + * Check if the frame data is writable. + * + * @return A positive value if the frame data is writable (which is true if and + * only if each of the underlying buffers has only one reference, namely the one + * stored in this frame). Return 0 otherwise. + * + * If 1 is returned the answer is valid until av_buffer_ref() is called on any + * of the underlying AVBufferRefs (e.g. through av_frame_ref() or directly). + * + * @see av_frame_make_writable(), av_buffer_is_writable() + *) +function av_frame_is_writable(frame: PAVFrame): cint; + cdecl; external av__codec; + +(** + * Ensure that the frame data is writable, avoiding data copy if possible. + * + * Do nothing if the frame is writable, allocate new buffers and copy the data + * if it is not. + * + * @return 0 on success, a negative AVERROR on error. + * + * @see av_frame_is_writable(), av_buffer_is_writable(), + * av_buffer_make_writable() + *) +function av_frame_make_writable(frame: PAVFrame): cint; + cdecl; external av__codec; + +(** + * Copy the frame data from src to dst. + * + * This function does not allocate anything, dst must be already initialized and + * allocated with the same parameters as src. + * + * This function only copies the frame data (i.e. the contents of the data / + * extended data arrays), not any other properties. + * + * @return >= 0 on success, a negative AVERROR on error. + *) +function av_frame_copy(dst: PAVFrame; src: {const} PAVFrame): cint; + cdecl; external av__codec; + +(** + * Copy only "metadata" fields from src to dst. + * + * Metadata for the purpose of this function are those fields that do not affect + * the data layout in the buffers. E.g. pts, sample rate (for audio) or sample + * aspect ratio (for video), but not width/height or channel layout. + * Side data is also copied. + *) +function av_frame_copy_props(dst: PAVFrame; src: {const} PAVFrame): cint; + cdecl; external av__codec; + +(** + * Get the buffer reference a given data plane is stored in. + * + * @param plane index of the data plane of interest in frame->extended_data. + * + * @return the buffer reference that contains the plane or NULL if the input + * frame is not valid. + *) +function av_frame_get_plane_buffer(frame: PAVFrame; plane: cint): PAVBufferRef; + cdecl; external av__codec; + +(** + * Add a new side data to a frame. + * + * @param frame a frame to which the side data should be added + * @param type type of the added side data + * @param size size of the side data + * + * @return newly added side data on success, NULL on error + *) +function av_frame_new_side_data(frame: PAVFrame; + type_: TAVFrameSideDataType; + size: cint): PAVFrameSideData; + cdecl; external av__codec; + +(** + * @return a pointer to the side data of a given type on success, NULL if there + * is no side data with such type in this frame. + *) +function av_frame_get_side_data(frame: {const} PAVFrame; type_: TAVFrameSideDataType): PAVFrameSideData; + cdecl; external av__codec; + +(** + * If side data of the supplied type exists in the frame, free it and remove it + * from the frame. + *) +procedure av_frame_remove_side_data(frame: PAVFrame; type_: TAVFrameSideDataType); + cdecl; external av__codec; + +(** + * @return a string identifying the side data type + *) +function av_frame_side_data_name(type_: TAVFrameSideDataType): PAnsiChar; + cdecl; external av__codec; + diff --git a/src/lib/ffmpeg-2.4/libavutil/log.pas b/src/lib/ffmpeg-2.4/libavutil/log.pas new file mode 100644 index 00000000..d0854c31 --- /dev/null +++ b/src/lib/ffmpeg-2.4/libavutil/log.pas @@ -0,0 +1,530 @@ +(* + * 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 54.7.100 + * + *) + +(** + * @file + * log + *) + +type + (* from opt.h *) + 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_DICT, + AV_OPT_TYPE_CONST = 128, + AV_OPT_TYPE_IMAGE_SIZE = $53495A45, ///< MKBETAG('S','I','Z','E'), offset must point to two consecutive integers + 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_VIDEO_RATE = $56524154 ///< MKBETAG('V','R','A','T'), offset must point to TAVRational + AV_OPT_TYPE_DURATION = $44555220, ///< MKBETAG('D','U','R',' '), + AV_OPT_TYPE_COLOR = $434F4C52, ///< MKBETAG('C','O','L','R'), + AV_OPT_TYPE_CHANNEL_LAYOUT = $43484C41, ///< MKBETAG('C','H','L','A'), +{$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 +{$IFDEF FF_API_OPT_TYPE_METADATA} + AV_OPT_FLAG_METADATA = 4; ///< some data extracted or inserted into the file like title, comment, ... +{$ENDIF} + AV_OPT_FLAG_AUDIO_PARAM = 8; + AV_OPT_FLAG_VIDEO_PARAM = 16; + AV_OPT_FLAG_SUBTITLE_PARAM = 32; + (** + * The option is inteded for exporting values to the caller. + *) + AV_OPT_FLAG_EXPORT = 64; + (** + * The option may not be set through the AVOptions API, only read. + * This flag only makes sense when AV_OPT_FLAG_EXPORT is also set. + *) + AV_OPT_FLAG_READONLY = 128; + 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; + +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_DEVICE_VIDEO_OUTPUT = 40, + AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT, + AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT, + AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT, + AV_CLASS_CATEGORY_DEVICE_OUTPUT, + AV_CLASS_CATEGORY_DEVICE_INPUT, + AV_CLASS_CATEGORY_NB ///< not part of ABI/API + ); + +(* +#define AV_IS_INPUT_DEVICE(category) \ + (((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT) || \ + ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT) || \ + ((category) == AV_CLASS_CATEGORY_DEVICE_INPUT)) + +#define AV_IS_OUTPUT_DEVICE(category) \ + (((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT) || \ + ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT) || \ + ((category) == AV_CLASS_CATEGORY_DEVICE_OUTPUT)) +*) + +// struct AVOptionRanges; + + (** + * A single allowed range of values, or a single allowed value. + *) + PAVOptionRange = ^TAVOptionRange; + PPAVOptionRange = ^PAVOptionRange; + TAVOptionRange = record + str: {const} PAnsiChar; + (** + * Value range. + * For string ranges this represents the min/max length. + * For dimensions this represents the min/max pixel count or width/height in multi-component case. + *) + value_min, value_max: cdouble; + (** + * Value's component range. + * For string this represents the unicode range for chars, 0-127 limits to ASCII. + *) + component_min, component_max: cdouble; + (** + * Range flag. + * If set to 1 the struct encodes a range, if set to 0 a single value. + *) + is_range: cint; + end; + + (** + * List of AVOptionRange structs. + *) + PAVOptionRanges = ^TAVOptionRanges; + PPAVOptionRanges = ^PAVOptionRanges; + TAVOptionRanges = record + (** + * Array of option ranges. + * + * Most of option types use just one component. + * Following describes multi-component option types: + * + * AV_OPT_TYPE_IMAGE_SIZE: + * component index 0: range of pixel count (width * height). + * component index 1: range of width. + * component index 2: range of height. + * + * @note To obtain multi-component version of this structure, user must + * provide AV_OPT_MULTI_COMPONENT_RANGE to av_opt_query_ranges or + * av_opt_query_ranges_default function. + * + * Multi-component range can be read as in following example: + * + * @code + * int range_index, component_index; + * AVOptionRanges *ranges; + * AVOptionRange *range[3]; //may require more than 3 in the future. + * av_opt_query_ranges(&ranges, obj, key, AV_OPT_MULTI_COMPONENT_RANGE); + * for (range_index = 0; range_index < ranges->nb_ranges; range_index++) { + * for (component_index = 0; component_index < ranges->nb_components; component_index++) + * range[component_index] = ranges->range[ranges->nb_ranges * component_index + range_index]; + * //do something with range here. + * } + * av_opt_freep_ranges(&ranges); + * @endcode + *) + range: PPAVOptionRange; + (** + * Number of ranges per component. + *) + nb_ranges: cint; + (** + * Number of componentes. + *) + nb_components: cint; + end; + +(** + * 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 +(** + * Print no output. + *) + 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; + +(** + * Standard information. + *) + AV_LOG_INFO = 32; + +(** + * Detailed information. + *) + 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); + +(** + * Sets additional colors for extended debugging sessions. + * @code + av_log(ctx, AV_LOG_DEBUG|AV_LOG_C(134), "Message in purple\n"); + @endcode + * Requires 256color terminal support. Uses outside debugging is not + * recommended. + *) +{** to be translated if needed + AV_LOG_C(x) (x << 8) +**} + +(** + * 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 logging callback + * function. + * @see av_log_set_callback + * + * @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 expressed using a @ref + * lavu_log_constants "Logging Constant". + * @param fmt The format string (printf-compatible) that specifies how + * subsequent arguments are converted to output. + *) +{** to be translated if needed +void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4); +**} + +type + va_list = pointer; + +(** + * 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 logging callback + * function. + * @see av_log_set_callback + * + * @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 expressed using a @ref + * lavu_log_constants "Logging Constant". + * @param fmt The format string (printf-compatible) that specifies how + * subsequent arguments are converted to output. + * @param vl The arguments referenced by the format string. + *) +procedure av_vlog(avcl: pointer; level: cint; fmt: {const} PAnsiChar; vl: va_list); + cdecl; external av__util; + +(** + * Get the current log level + * + * @see lavu_log_constants + * + * @return Current log level + *) +function av_log_get_level(): cint; + cdecl; external av__util; + +(** + * Set the log level + * + * @see lavu_log_constants + * + * @param level Logging level + *) +procedure av_log_set_level(level: cint); + cdecl; external av__util; + +(** + * Set the logging callback + * + * @note The callback must be thread safe, even if the application does not use + * threads itself as some codecs are multithreaded. + * + * @see av_log_default_callback + * + * @param callback A logging function with a compatible signature. + *) +{** to be translated if needed +void av_log_set_callback(void (*callback)(void*, int, const char*, va_list)); +**} + +(** + * Default logging callback + * + * It prints the message to stderr, optionally colorizing it. + * + * @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 expressed using a @ref + * lavu_log_constants "Logging Constant". + * @param fmt The format string (printf-compatible) that specifies how + * subsequent arguments are converted to output. + * @param vl The arguments referenced by the format string. + *) +{** to be translated if needed +void av_log_default_callback(void* avcl, int level, const char *fmt, va_list vl); +**} + +(** + * Return the context name + * + * @param ctx The AVClass context + * + * @return The AVClass class_name + *) +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 +**) + +const +(** + * 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 + *) + AV_LOG_SKIP_REPEATED = 1; + +(** + * Include the log severity in messages originating from codecs. + * + * Results in messages such as: + * [rawvideo @ 0xDEADBEEF] [error] encode did not produce valid pts + *) + AV_LOG_PRINT_LEVEL = 2; + +procedure av_log_set_flags(arg: cint); + cdecl; external av__util; + +function av_log_get_flags: cint; + cdecl; external av__util; diff --git a/src/lib/ffmpeg-2.4/libavutil/mathematics.pas b/src/lib/ffmpeg-2.4/libavutil/mathematics.pas new file mode 100644 index 00000000..1025bbf3 --- /dev/null +++ b/src/lib/ffmpeg-2.4/libavutil/mathematics.pas @@ -0,0 +1,144 @@ +(* + * copyright (c) 2005-2012 Michael Niedermayer + * + * 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 54.7.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_PI_2 = 1.57079632679489661923; // pi/2 + 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, 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; d: 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; + d: 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, b, modVar: cuint64): cint64; + cdecl; external av__util; + +(** + * Rescale a timestamp while preserving known durations. + * + * @param in_ts Input timestamp + * @param in_tb Input timebase + * @param fs_tb Duration and *last timebase + * @param duration duration till the next call + * @param out_tb Output timebase + *) +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; + +(** + * Add a value to a timestamp. + * + * This function guarantees that when the same value is repeatly added that + * no accumulation of rounding errors occurs. + * + * @param ts Input timestamp + * @param ts_tb Input timestamp timebase + * @param inc value to add to ts + * @param inc_tb inc timebase + *) +function av_add_stable(ts_tb: TAVRational; ts: cint64; inc_tb: TAVRational; inc: cint64): cint64; + cdecl; external av__util; diff --git a/src/lib/ffmpeg-2.4/libavutil/mem.pas b/src/lib/ffmpeg-2.4/libavutil/mem.pas new file mode 100644 index 00000000..43a38e4d --- /dev/null +++ b/src/lib/ffmpeg-2.4/libavutil/mem.pas @@ -0,0 +1,353 @@ +(* + * 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.66.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)} + +(** + * Allocate a block of size * nmemb bytes with 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_realloc() or NULL. + * @param size Size in bytes of the memory block to be allocated or + * reallocated. + * @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. + * @warning Pointers originating from the av_malloc() family of functions must + * not be passed to av_realloc(). The former can be implemented using + * memalign() (or other functions), and there is no guarantee that + * pointers from such functions can be passed to realloc() at all. + * The situation is undefined according to POSIX and may crash with + * some libc implementations. + * @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 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 pointer to a memory block already allocated + * with av_realloc(), or pointer to a pointer to NULL. + * The pointer is updated on success, or freed on failure. + * @param size Size in bytes for the memory block to be allocated or + * reallocated + * @return Zero on success, an AVERROR error code on failure. + * @warning Pointers originating from the av_malloc() family of functions must + * not be passed to av_reallocp(). The former can be implemented using + * memalign() (or other functions), and there is no guarantee that + * pointers from such functions can be passed to realloc() at all. + * The situation is undefined according to POSIX and may crash with + * some libc implementations. + *) +function av_reallocp(ptr: pointer; elsize: size_t): cint; + 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_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. + * @warning Pointers originating from the av_malloc() family of functions must + * not be passed to av_realloc(). The former can be implemented using + * memalign() (or other functions), and there is no guarantee that + * pointers from such functions can be passed to realloc() at all. + * The situation is undefined according to POSIX and may crash with + * some libc implementations. + *) +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 through a pointer to a pointer. + * 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_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. + * @warning Pointers originating from the av_malloc() family of functions must + * not be passed to av_realloc(). The former can be implemented using + * memalign() (or other functions), and there is no guarantee that + * pointers from such functions can be passed to realloc() at all. + * The situation is undefined according to POSIX and may crash with + * some libc implementations. + *) +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} + +(** + * Allocate a block of size * nmemb bytes with 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 a substring of the string s. + * @param s string to be duplicated + * @param len the maximum length of the resulting string (not counting the + * terminating byte). + * @return Pointer to a newly-allocated string containing a + * copy of s or NULL if the string cannot be allocated. + *) +function av_strndup({const} s: PAnsiChar; len: size_t): 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. + * @note passing a pointer to a NULL pointer is safe and leads to no action. + * @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_dynarray_add_nofree(), av_dynarray2_add() + *) +procedure av_dynarray_add(tab_ptr: pointer; nb_ptr: Pcint; elem: pointer); + cdecl; external av__util; + +(** + * Add an element to a dynamic array. + * + * Function has the same functionality as av_dynarray_add(), + * but it doesn't free memory on fails. It returns error code + * instead and leave current buffer untouched. + * + * @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 + * @return >=0 on success, negative otherwise. + * @see av_dynarray_add(), av_dynarray2_add() + *) +function av_dynarray_add_nofree(tab_ptr: pointer; nb_ptr: Pcint; elem: pointer): cint; + 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(), av_dynarray_add_nofree() + *) +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; + +(** + * 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; + +(** + * Reallocate the given block if it is not large enough, otherwise do nothing. + * + * @see av_realloc + *) +procedure av_fast_realloc(ptr: pointer; size: Pcuint; min_size: size_t); + cdecl; external av__util; + +(** + * Allocate a buffer, reusing the given one if large enough. + * + * Contrary to av_fast_realloc the current buffer contents might not be + * preserved and on error the old buffer is freed, thus no special + * handling to avoid memleaks is necessary. + * + * @param ptr pointer to pointer to already allocated buffer, overwritten with pointer to new buffer + * @param size size of the buffer *ptr points to + * @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and + * *size 0 if an error occurred. + *) +procedure av_fast_malloc(ptr: pointer; size: Pcuint; min_size: size_t); + cdecl; external av__util; diff --git a/src/lib/ffmpeg-2.4/libavutil/opt.pas b/src/lib/ffmpeg-2.4/libavutil/opt.pas new file mode 100644 index 00000000..b88674a3 --- /dev/null +++ b/src/lib/ffmpeg-2.4/libavutil/opt.pas @@ -0,0 +1,559 @@ +(* + * AVOptions + * copyright (c) 2005 Michael Niedermayer + * + * 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 54.7.100 + * + *) + +{$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 allocated objects 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; + +(** + * 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(). + * @param search_flags A combination of AV_OPT_SEARCH_*. + * + * @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_dict2(obj: pointer; var options: PAVDictionary; search_flags: cint): 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 + * + *) +function 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; + cdecl; external av__util; +function av_opt_eval_int (obj: pointer; o: {const} PAVOption; val: {const} PAnsiChar; int_out: Pcint): cint; + cdecl; external av__util; +function av_opt_eval_int64 (obj: pointer; o: {const} PAVOption; val: {const} PAnsiChar; int64_out: Pcint64): cint; + cdecl; external av__util; +function av_opt_eval_float (obj: pointer; o: {const} PAVOption; val: {const} PAnsiChar; float_out: Pcfloat): cint; + cdecl; external av__util; +function av_opt_eval_double(obj: pointer; o: {const} PAVOption; val: {const} PAnsiChar; double_out: Pcdouble): cint; + cdecl; external av__util; +function av_opt_eval_q (obj: pointer; o: {const} PAVOption; val: {const} PAnsiChar; q_out: PAVRational): cint; + cdecl; external av__util; +(** + * @ + *) + +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; + +(** + * Allows av_opt_query_ranges and av_opt_query_ranges_default to return more than + * one component for certain option types. + * @see AVOptionRanges for details. + *) + AV_OPT_MULTI_COMPONENT_RANGE = 1000; + +(** + * 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: TAVSampleFormat; 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; +function av_opt_set_channel_layout(obj: pointer; name: {const} PAnsiChar; ch_layout: cint64; search_flags: cint): cint; + cdecl; external av__util; + +(** + * @note Any old dictionary present is discarded and replaced with a copy of the new one. The + * caller still owns val is and responsible for freeing it. + *) +function av_opt_set_dict_val(obj: pointer; name: {const} PAnsiChar; val: {const} PAVDictionary; 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 be 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; +function av_opt_get_channel_layout(obj: pointer; name: {const} PAnsiChar; search_flags: cint; ch_layout: Pcint64): cint; + cdecl; external av__util; +(** + * @param[out] out_val The returned dictionary is a copy of the actual value and must + * be freed with av_dict_free() by the caller + *) +function av_opt_get_dict_val (obj: pointer; name: {const} PAnsiChar; search_flags: cint; out out_val: PAVDictionary): 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 + * AV_OPT_MULTI_COMPONENT_RANGE indicates that function may return more than one component, @see AVOptionRanges + * + * The result must be freed with av_opt_freep_ranges. + * + * @return number of compontents returned 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; + +function av_opt_copy(dest: pointer;src: pointer): 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 + * AV_OPT_MULTI_COMPONENT_RANGE indicates that function may return more than one component, @see AVOptionRanges + * + * The result must be freed with av_opt_free_ranges. + * + * @return number of compontents returned 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.4/libavutil/pixfmt.pas b/src/lib/ffmpeg-2.4/libavutil/pixfmt.pas new file mode 100644 index 00000000..264653a9 --- /dev/null +++ b/src/lib/ffmpeg-2.4/libavutil/pixfmt.pas @@ -0,0 +1,575 @@ +(* + * 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 54.7.100 + * + *) + +(** + * @file + * Pixel format + *) + +const + AVPALETTE_SIZE = 1024; + AVPALETTE_COUNT = 256; + +type +(** + * Pixel format. Notes: + * + * @note + * AV_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 (AV_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 AV_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 +{$IFDEF FF_API_XVMC} + AV_PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing + AV_PIX_FMT_XVMC_MPEG2_IDCT, + {$define AV_PIX_FMT_XVMC := (AV_PIX_FMT_XVMC_MPEG2_IDCT)} +{$ENDIF} + 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) +{$IFDEF FF_API_VDPAU} + 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 +{$ENDIF} + 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 +{$IFDEF FF_API_VDPAU} + 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 +{$ENDIF} + 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_YA8, ///< 8bit gray, 8bit alpha +(* see const declaration way down + AV_PIX_FMT_Y400A = AV_PIX_FMT_YA8, ///< alias for AV_PIX_FMT_YA8 + AV_PIX_FMT_GRAY8A= AV_PIX_FMT_YA8, ///< alias for AV_PIX_FMT_YA8 +*) + 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 12 formats have the disadvantage of needing 1 format for each bit depth. + * Notice that each 9/10 bits sample is stored in 16 bits with extra padding. + * 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 + AV_PIX_FMT_NV16, ///< interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) + AV_PIX_FMT_NV20LE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_NV20BE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + + (** + * duplicated pixel formats for compatibility with libav. + * FFmpeg supports these formats since Sat Sep 24 06:01:45 2011 +0200 (commits 9569a3c9f41387a8c7d1ce97d8693520477a66c3) + * also see Fri Nov 25 01:38:21 2011 +0100 92afb431621c79155fcb7171d26f137eb1bee028 + * Libav added them Sun Mar 16 23:05:47 2014 +0100 with incompatible values (commit 1481d24c3a0abf81e1d7a514547bd5305232be30) + *) + AV_PIX_FMT_RGBA64BE_LIBAV, ///< 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_LIBAV, ///< 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_LIBAV, ///< 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_LIBAV, ///< 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 + + AV_PIX_FMT_YVYU422, ///< packed YUV 4:2:2, 16bpp, Y0 Cr Y1 Cb + + AV_PIX_FMT_VDA, ///< HW acceleration through VDA, data[3] contains a CVPixelBufferRef + + AV_PIX_FMT_YA16BE, ///< 16bit gray, 16bit alpha (big-endian) + AV_PIX_FMT_YA16LE, ///< 16bit gray, 16bit alpha (little-endian) + + +{$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_BAYER_BGGR8, ///< bayer, BGBG..(odd line), GRGR..(even line), 8-bit samples */ + AV_PIX_FMT_BAYER_RGGB8, ///< bayer, RGRG..(odd line), GBGB..(even line), 8-bit samples */ + AV_PIX_FMT_BAYER_GBRG8, ///< bayer, GBGB..(odd line), RGRG..(even line), 8-bit samples */ + AV_PIX_FMT_BAYER_GRBG8, ///< bayer, GRGR..(odd line), BGBG..(even line), 8-bit samples */ + AV_PIX_FMT_BAYER_BGGR16LE, ///< bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, little-endian */ + AV_PIX_FMT_BAYER_BGGR16BE, ///< bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, big-endian */ + AV_PIX_FMT_BAYER_RGGB16LE, ///< bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, little-endian */ + AV_PIX_FMT_BAYER_RGGB16BE, ///< bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, big-endian */ + AV_PIX_FMT_BAYER_GBRG16LE, ///< bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, little-endian */ + AV_PIX_FMT_BAYER_GBRG16BE, ///< bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, big-endian */ + AV_PIX_FMT_BAYER_GRBG16LE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, little-endian */ + AV_PIX_FMT_BAYER_GRBG16BE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, big-endian */ +{$ifndef FF_API_XVMC} + AV_PIX_FMT_XVMC, ///< XVideo Motion Acceleration via common packet passing +{$endif} + 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; + AV_PIX_FMT_RGBA64BE = AV_PIX_FMT_RGBA64BE_LIBAV; + AV_PIX_FMT_RGBA64LE = AV_PIX_FMT_RGBA64LE_LIBAV; + AV_PIX_FMT_BGRA64BE = AV_PIX_FMT_BGRA64BE_LIBAV; + AV_PIX_FMT_BGRA64LE = AV_PIX_FMT_BGRA64LE_LIBAV; +{$ENDIF} + +const + AV_PIX_FMT_Y400A = AV_PIX_FMT_YA8; ///< alias for AV_PIX_FMT_YA8 + AV_PIX_FMT_GRAY8A= AV_PIX_FMT_YA8; ///< alias for AV_PIX_FMT_YA8 + 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_YA16 = AV_PIX_FMT_YA16BE; + 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_RGBA64 = AV_PIX_FMT_RGBA64BE; + 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_BGRA64 = AV_PIX_FMT_BGRA64BE; + + 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_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_GBRAP16 = AV_PIX_FMT_GBRAP16BE; + + AV_PIX_FMT_BAYER_BGGR16 = AV_PIX_FMT_BAYER_BGGR16BE; + AV_PIX_FMT_BAYER_RGGB16 = AV_PIX_FMT_BAYER_RGGB16BE; + AV_PIX_FMT_BAYER_GBRG16 = AV_PIX_FMT_BAYER_GBRG16BE; + AV_PIX_FMT_BAYER_GRBG16 = AV_PIX_FMT_BAYER_GRBG16BE; + + 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; + AV_PIX_FMT_NV20 = AV_PIX_FMT_NV20BE; + +{$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_YA16 = AV_PIX_FMT_YA16LE; + 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_RGBA64 = AV_PIX_FMT_RGBA64LE; + 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_BGRA64 = AV_PIX_FMT_BGRA64LE; + + 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_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_GBRAP16 = AV_PIX_FMT_GBRAP16LE; + + AV_PIX_FMT_BAYER_BGGR16 = AV_PIX_FMT_BAYER_BGGR16LE; + AV_PIX_FMT_BAYER_RGGB16 = AV_PIX_FMT_BAYER_RGGB16LE; + AV_PIX_FMT_BAYER_GBRG16 = AV_PIX_FMT_BAYER_GBRG16LE; + AV_PIX_FMT_BAYER_GRBG16 = AV_PIX_FMT_BAYER_GRBG16LE; + + 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; + AV_PIX_FMT_NV20 = AV_PIX_FMT_NV20LE; + +{$ENDIF} + +{$IFDEF FF_API_PIX_FMT} +type + TPixelFormat = TAVPixelFormat; + +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} + +type +(** + * Chromaticity coordinates of the source primaries. + *) + TAVColorPrimaries = ( + AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B + AVCOL_PRI_UNSPECIFIED = 2, + AVCOL_PRI_RESERVED = 3, + AVCOL_PRI_BT470M = 4, + AVCOL_PRI_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM + AVCOL_PRI_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC + AVCOL_PRI_SMPTE240M = 7, ///< functionally identical to above + AVCOL_PRI_FILM = 8, + AVCOL_PRI_BT2020 = 9, ///< ITU-R BT2020 + AVCOL_PRI_NB ///< Not part of ABI + ); + +(** + * Color Transfer Characteristic. + *) + TAVColorTransferCharacteristic = ( + AVCOL_TRC_BT709 = 1, ///< also ITU-R BT1361 + AVCOL_TRC_UNSPECIFIED = 2, + AVCOL_TRC_RESERVED = 3, + AVCOL_TRC_GAMMA22 = 4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM + AVCOL_TRC_GAMMA28 = 5, ///< also ITU-R BT470BG + AVCOL_TRC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC + AVCOL_TRC_SMPTE240M = 7, + AVCOL_TRC_LINEAR = 8, ///< "Linear transfer characteristics" + AVCOL_TRC_LOG = 9, ///< "Logarithmic transfer characteristic (100:1 range)" + AVCOL_TRC_LOG_SQRT = 10, ///< "Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range)" + AVCOL_TRC_IEC61966_2_4 = 11, ///< IEC 61966-2-4 + AVCOL_TRC_BT1361_ECG = 12, ///< ITU-R BT1361 Extended Colour Gamut + AVCOL_TRC_IEC61966_2_1 = 13, ///< IEC 61966-2-1 (sRGB or sYCC) + AVCOL_TRC_BT2020_10 = 14, ///< ITU-R BT2020 for 10 bit system + AVCOL_TRC_BT2020_12 = 15, ///< ITU-R BT2020 for 12 bit system + AVCOL_TRC_NB ///< Not part of ABI + ); + +(** + * YUV colorspace type. + *) + TAVColorSpace = ( + AVCOL_SPC_RGB = 0, + AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B + AVCOL_SPC_UNSPECIFIED = 2, + AVCOL_SPC_RESERVED = 3, + AVCOL_SPC_FCC = 4, + AVCOL_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 + AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above + AVCOL_SPC_SMPTE240M = 7, + AVCOL_SPC_YCOCG = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16 + AVCOL_SPC_BT2020_NCL = 9, ///< ITU-R BT2020 non-constant luminance system + AVCOL_SPC_BT2020_CL = 10, ///< ITU-R BT2020 constant luminance system + AVCOL_SPC_NB ///< Not part of ABI + ); + +const + AVCOL_SPC_YCGCO = AVCOL_SPC_YCOCG; + +type +(** + * MPEG vs JPEG YUV range. + *) + TAVColorRange = ( + AVCOL_RANGE_UNSPECIFIED = 0, + AVCOL_RANGE_MPEG = 1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges + AVCOL_RANGE_JPEG = 2, ///< the normal 2^n-1 "JPEG" YUV ranges + AVCOL_RANGE_NB ///< Not part of ABI + ); + +(** + * Location of chroma samples. + * + * X X 3 4 X X are luma samples, + * 1 2 1-6 are possible chroma positions + * X X 5 6 X 0 is undefined/unknown position + *) + TAVChromaLocation = ( + AVCHROMA_LOC_UNSPECIFIED = 0, + AVCHROMA_LOC_LEFT = 1, ///< mpeg2/4, h264 default + AVCHROMA_LOC_CENTER = 2, ///< mpeg1, jpeg, h263 + AVCHROMA_LOC_TOPLEFT = 3, ///< DV + AVCHROMA_LOC_TOP = 4, + AVCHROMA_LOC_BOTTOMLEFT = 5, + AVCHROMA_LOC_BOTTOM = 6, + AVCHROMA_LOC_NB ///< Not part of ABI + ); diff --git a/src/lib/ffmpeg-2.4/libavutil/samplefmt.pas b/src/lib/ffmpeg-2.4/libavutil/samplefmt.pas new file mode 100644 index 00000000..60024330 --- /dev/null +++ b/src/lib/ffmpeg-2.4/libavutil/samplefmt.pas @@ -0,0 +1,294 @@ +(* + * SampleFormat + * copyright (c) 2011 Karl-Michael Schindler + * + * 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 54.7.100 + * + *) + +type +(** + * @addtogroup lavu_audio + * @ + * + * @defgroup lavu_sampfmts Audio sample formats + * + * Audio sample format enumeration and related convenience functions. + * @ + * + *) + +(** + * Audio sample formats + * + * - 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. + * + * - 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. + * + * - The data layout as used in av_samples_fill_arrays() and elsewhere in FFmpeg + * (such as AVFrame in libavcodec) is as follows: + * + * @par + * 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; + +(** + * @ + * + * @defgroup lavu_sampmanip Samples manipulation + * + * Functions that manipulate audio samples + * @ + *) + +(** + * 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; -- cgit v1.2.3