├── universal ├── lib │ ├── libavutil.a │ ├── libavcodec.a │ ├── libavformat.a │ └── libswscale.a └── include │ ├── libavutil │ ├── audioconvert.h │ ├── ffversion.h │ ├── avconfig.h │ ├── murmur3.h │ ├── macros.h │ ├── time.h │ ├── random_seed.h │ ├── intfloat_readwrite.h │ ├── adler32.h │ ├── intfloat.h │ ├── aes.h │ ├── xtea.h │ ├── lfg.h │ ├── sha.h │ ├── md5.h │ ├── ripemd.h │ ├── sha512.h │ ├── base64.h │ ├── avassert.h │ ├── blowfish.h │ ├── file.h │ ├── timestamp.h │ ├── crc.h │ ├── hmac.h │ ├── bswap.h │ ├── downmix_info.h │ ├── stereo3d.h │ ├── rational.h │ ├── attributes.h │ ├── audio_fifo.h │ ├── version.h │ ├── cpu.h │ ├── error.h │ ├── fifo.h │ ├── eval.h │ ├── timecode.h │ ├── mathematics.h │ ├── dict.h │ ├── parseutils.h │ ├── bprint.h │ ├── imgutils.h │ ├── avutil.h │ ├── channel_layout.h │ └── log.h │ ├── libswscale │ └── version.h │ ├── libavcodec │ ├── dxva2.h │ ├── avfft.h │ ├── vaapi.h │ ├── vda.h │ ├── version.h │ ├── xvmc.h │ └── vdpau.h │ └── libavformat │ └── version.h ├── CocoaFFmpeg.podspec ├── README.md └── LICENSE /universal/lib/libavutil.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jold/CocoaFFmpeg/HEAD/universal/lib/libavutil.a -------------------------------------------------------------------------------- /universal/lib/libavcodec.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jold/CocoaFFmpeg/HEAD/universal/lib/libavcodec.a -------------------------------------------------------------------------------- /universal/lib/libavformat.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jold/CocoaFFmpeg/HEAD/universal/lib/libavformat.a -------------------------------------------------------------------------------- /universal/lib/libswscale.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jold/CocoaFFmpeg/HEAD/universal/lib/libswscale.a -------------------------------------------------------------------------------- /universal/include/libavutil/audioconvert.h: -------------------------------------------------------------------------------- 1 | 2 | #include "version.h" 3 | 4 | #if FF_API_AUDIOCONVERT 5 | #include "channel_layout.h" 6 | #endif 7 | -------------------------------------------------------------------------------- /universal/include/libavutil/ffversion.h: -------------------------------------------------------------------------------- 1 | #ifndef AVUTIL_FFVERSION_H 2 | #define AVUTIL_FFVERSION_H 3 | #define FFMPEG_VERSION "2.2" 4 | #endif /* AVUTIL_FFVERSION_H */ 5 | -------------------------------------------------------------------------------- /universal/include/libavutil/avconfig.h: -------------------------------------------------------------------------------- 1 | /* Generated by ffconf */ 2 | #ifndef AVUTIL_AVCONFIG_H 3 | #define AVUTIL_AVCONFIG_H 4 | #define AV_HAVE_BIGENDIAN 0 5 | #define AV_HAVE_FAST_UNALIGNED 0 6 | #define AV_HAVE_INCOMPATIBLE_LIBAV_ABI 0 7 | #define AV_HAVE_INCOMPATIBLE_FORK_ABI 0 8 | #endif /* AVUTIL_AVCONFIG_H */ 9 | -------------------------------------------------------------------------------- /universal/include/libavutil/murmur3.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Reimar Döffinger 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_MURMUR3_H 22 | #define AVUTIL_MURMUR3_H 23 | 24 | #include 25 | 26 | struct AVMurMur3 *av_murmur3_alloc(void); 27 | void av_murmur3_init_seeded(struct AVMurMur3 *c, uint64_t seed); 28 | void av_murmur3_init(struct AVMurMur3 *c); 29 | void av_murmur3_update(struct AVMurMur3 *c, const uint8_t *src, int len); 30 | void av_murmur3_final(struct AVMurMur3 *c, uint8_t dst[16]); 31 | 32 | #endif /* AVUTIL_MURMUR3_H */ 33 | -------------------------------------------------------------------------------- /CocoaFFmpeg.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "CocoaFFmpeg" 3 | s.version = "2.2.0" 4 | s.license = { :type => 'LGPLv2.1+', :file => 'COPYING.LGPLv2.1' } 5 | 6 | s.summary = "Pre-compiled light-weight FFmpeg libraries for iOS. Build your own with attached build script." 7 | s.description = <<-DESC 8 | Optimized to decrease the size by compiling the necessary formats only 9 | video codecs: h264 (enable h263) 10 | audio codecs: AAC (enable mp3) 11 | FFmpeg - A complete, cross-platform solution to record, convert and stream audio and video. 12 | https://www.ffmpeg.org/ 13 | DESC 14 | 15 | s.homepage = "https://github.com/jold/CocoaFFmpeg" 16 | s.author = { "Daniel Jankovic" => "dj@digital-life.cz" } 17 | s.source = { :git => "https://github.com/jold/CocoaFFmpeg.git", :tag => "2.2.0" } 18 | 19 | s.ios.deployment_target = '6.0' 20 | s.requires_arc = false 21 | s.platform = :ios 22 | s.default_subspec = 'precompiled' 23 | 24 | s.subspec 'precompiled' do |ss| 25 | ss.source_files = 'universal/include/**/*.h' 26 | ss.public_header_files = 'universal/include/**/*.h' 27 | ss.header_mappings_dir = 'universal/include' 28 | ss.vendored_libraries = 'universal/lib/*.a' 29 | ss.libraries = 'avcodec', 'avformat', 'avutil', 'swscale', 'z', 'bz2' 30 | end 31 | 32 | end 33 | -------------------------------------------------------------------------------- /universal/include/libavutil/macros.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | /** 20 | * @file 21 | * @ingroup lavu 22 | * Utility Preprocessor macros 23 | */ 24 | 25 | #ifndef AVUTIL_MACROS_H 26 | #define AVUTIL_MACROS_H 27 | 28 | /** 29 | * @addtogroup preproc_misc Preprocessor String Macros 30 | * 31 | * String manipulation macros 32 | * 33 | * @{ 34 | */ 35 | 36 | #define AV_STRINGIFY(s) AV_TOSTRING(s) 37 | #define AV_TOSTRING(s) #s 38 | 39 | #define AV_GLUE(a, b) a ## b 40 | #define AV_JOIN(a, b) AV_GLUE(a, b) 41 | 42 | /** 43 | * @} 44 | */ 45 | 46 | #define AV_PRAGMA(s) _Pragma(#s) 47 | 48 | #endif /* AVUTIL_MACROS_H */ 49 | -------------------------------------------------------------------------------- /universal/include/libavutil/time.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2003 Fabrice Bellard 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_TIME_H 22 | #define AVUTIL_TIME_H 23 | 24 | #include 25 | 26 | /** 27 | * Get the current time in microseconds. 28 | */ 29 | int64_t av_gettime(void); 30 | 31 | /** 32 | * Sleep for a period of time. Although the duration is expressed in 33 | * microseconds, the actual delay may be rounded to the precision of the 34 | * system timer. 35 | * 36 | * @param usec Number of microseconds to sleep. 37 | * @return zero on success or (negative) error code. 38 | */ 39 | int av_usleep(unsigned usec); 40 | 41 | #endif /* AVUTIL_TIME_H */ 42 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # pre-compiled light-weight FFmpeg libraries for iOS 2 | 3 | Size optimized FFmpeg libraries for iOS. Build your own with attached build script. 4 | * video codecs: h264 (enable h263) 5 | * audio codecs: AAC (enable mp3) 6 | 7 | Tested with: 8 | 9 | * FFmpeg 2.2 release 10 | * Xcode 5.1 11 | * https://github.com/libav/gas-preprocessor (for arm64) 12 | * yasm 1.2.0 13 | 14 | ## Usage 15 | 16 | build-ffmpeg.sh [minimal|entire] [arm64|armv7s|armv7|x86_64|i386] [lipo] 17 | 18 | #### common: 19 | 20 | build optimized libraries with all necessary stuff and h264 codec 21 | ``` 22 | ./build-ffmpeg.sh minimal 23 | ``` 24 | build minimal configuration for device architectures only 25 | ``` 26 | ./build-ffmpeg.sh minimal arm64 armv7s armv7 27 | ``` 28 | 29 | #### miscellaneous: 30 | build configuration with all codecs 31 | ``` 32 | ./build-ffmpeg.sh universal 33 | ``` 34 | join created libraries only for architectures into one fat library 35 | ``` 36 | ./build-ffmpeg.sh lipo 37 | ``` 38 | 39 | ## Download 40 | 41 | You can download a binary for FFmpeg 2.2 release at https://downloads.sourceforge.net/project/ffmpeg-ios/ffmpeg-ios-sf.tar.bz2 42 | 43 | ## External libraries 44 | 45 | You should link with 46 | 47 | * libz.dylib 48 | * libbz2.dylib 49 | * libiconv.dylib 50 | 51 | ## Influences 52 | 53 | * https://github.com/jold/CocoaRTMP 54 | * https://github.com/bbcallen/ijkplayer/blob/fc70895c64cbbd20f32f1d81d2d48609ed13f597/ios/tools/do-compile-ffmpeg.sh#L7 55 | * https://github.com/chrisballinger/FFmpeg-iOS -------------------------------------------------------------------------------- /universal/include/libavutil/random_seed.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Baptiste Coudurier 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_RANDOM_SEED_H 22 | #define AVUTIL_RANDOM_SEED_H 23 | 24 | #include 25 | /** 26 | * @addtogroup lavu_crypto 27 | * @{ 28 | */ 29 | 30 | /** 31 | * Get a seed to use in conjunction with random functions. 32 | * This function tries to provide a good seed at a best effort bases. 33 | * Its possible to call this function multiple times if more bits are needed. 34 | * It can be quite slow, which is why it should only be used as seed for a faster 35 | * PRNG. The quality of the seed depends on the platform. 36 | */ 37 | uint32_t av_get_random_seed(void); 38 | 39 | /** 40 | * @} 41 | */ 42 | 43 | #endif /* AVUTIL_RANDOM_SEED_H */ 44 | -------------------------------------------------------------------------------- /universal/include/libavutil/intfloat_readwrite.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2005 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_INTFLOAT_READWRITE_H 22 | #define AVUTIL_INTFLOAT_READWRITE_H 23 | 24 | #include 25 | 26 | #include "attributes.h" 27 | #include "version.h" 28 | 29 | #if FF_API_INTFLOAT 30 | /* IEEE 80 bits extended float */ 31 | typedef struct AVExtFloat { 32 | uint8_t exponent[2]; 33 | uint8_t mantissa[8]; 34 | } AVExtFloat; 35 | 36 | attribute_deprecated double av_int2dbl(int64_t v) av_const; 37 | attribute_deprecated float av_int2flt(int32_t v) av_const; 38 | attribute_deprecated double av_ext2dbl(const AVExtFloat ext) av_const; 39 | attribute_deprecated int64_t av_dbl2int(double d) av_const; 40 | attribute_deprecated int32_t av_flt2int(float d) av_const; 41 | attribute_deprecated AVExtFloat av_dbl2ext(double d) av_const; 42 | #endif /* FF_API_INTFLOAT */ 43 | 44 | #endif /* AVUTIL_INTFLOAT_READWRITE_H */ 45 | -------------------------------------------------------------------------------- /universal/include/libavutil/adler32.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Mans Rullgard 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_ADLER32_H 22 | #define AVUTIL_ADLER32_H 23 | 24 | #include 25 | #include "attributes.h" 26 | 27 | /** 28 | * @file 29 | * Public header for libavutil Adler32 hasher 30 | * 31 | * @defgroup lavu_adler32 Adler32 32 | * @ingroup lavu_crypto 33 | * @{ 34 | */ 35 | 36 | /** 37 | * Calculate the Adler32 checksum of a buffer. 38 | * 39 | * Passing the return value to a subsequent av_adler32_update() call 40 | * allows the checksum of multiple buffers to be calculated as though 41 | * they were concatenated. 42 | * 43 | * @param adler initial checksum value 44 | * @param buf pointer to input buffer 45 | * @param len size of input buffer 46 | * @return updated checksum 47 | */ 48 | unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf, 49 | unsigned int len) av_pure; 50 | 51 | /** 52 | * @} 53 | */ 54 | 55 | #endif /* AVUTIL_ADLER32_H */ 56 | -------------------------------------------------------------------------------- /universal/include/libavutil/intfloat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Mans Rullgard 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_INTFLOAT_H 22 | #define AVUTIL_INTFLOAT_H 23 | 24 | #include 25 | #include "attributes.h" 26 | 27 | union av_intfloat32 { 28 | uint32_t i; 29 | float f; 30 | }; 31 | 32 | union av_intfloat64 { 33 | uint64_t i; 34 | double f; 35 | }; 36 | 37 | /** 38 | * Reinterpret a 32-bit integer as a float. 39 | */ 40 | static av_always_inline float av_int2float(uint32_t i) 41 | { 42 | union av_intfloat32 v; 43 | v.i = i; 44 | return v.f; 45 | } 46 | 47 | /** 48 | * Reinterpret a float as a 32-bit integer. 49 | */ 50 | static av_always_inline uint32_t av_float2int(float f) 51 | { 52 | union av_intfloat32 v; 53 | v.f = f; 54 | return v.i; 55 | } 56 | 57 | /** 58 | * Reinterpret a 64-bit integer as a double. 59 | */ 60 | static av_always_inline double av_int2double(uint64_t i) 61 | { 62 | union av_intfloat64 v; 63 | v.i = i; 64 | return v.f; 65 | } 66 | 67 | /** 68 | * Reinterpret a double as a 64-bit integer. 69 | */ 70 | static av_always_inline uint64_t av_double2int(double f) 71 | { 72 | union av_intfloat64 v; 73 | v.f = f; 74 | return v.i; 75 | } 76 | 77 | #endif /* AVUTIL_INTFLOAT_H */ 78 | -------------------------------------------------------------------------------- /universal/include/libavutil/aes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2007 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_AES_H 22 | #define AVUTIL_AES_H 23 | 24 | #include 25 | 26 | #include "attributes.h" 27 | #include "version.h" 28 | 29 | /** 30 | * @defgroup lavu_aes AES 31 | * @ingroup lavu_crypto 32 | * @{ 33 | */ 34 | 35 | extern const int av_aes_size; 36 | 37 | struct AVAES; 38 | 39 | /** 40 | * Allocate an AVAES context. 41 | */ 42 | struct AVAES *av_aes_alloc(void); 43 | 44 | /** 45 | * Initialize an AVAES context. 46 | * @param key_bits 128, 192 or 256 47 | * @param decrypt 0 for encryption, 1 for decryption 48 | */ 49 | int av_aes_init(struct AVAES *a, const uint8_t *key, int key_bits, int decrypt); 50 | 51 | /** 52 | * Encrypt or decrypt a buffer using a previously initialized context. 53 | * @param count number of 16 byte blocks 54 | * @param dst destination array, can be equal to src 55 | * @param src source array, can be equal to dst 56 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used 57 | * @param decrypt 0 for encryption, 1 for decryption 58 | */ 59 | void av_aes_crypt(struct AVAES *a, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); 60 | 61 | /** 62 | * @} 63 | */ 64 | 65 | #endif /* AVUTIL_AES_H */ 66 | -------------------------------------------------------------------------------- /universal/include/libavutil/xtea.h: -------------------------------------------------------------------------------- 1 | /* 2 | * A 32-bit implementation of the XTEA algorithm 3 | * Copyright (c) 2012 Samuel Pitoiset 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_XTEA_H 23 | #define AVUTIL_XTEA_H 24 | 25 | #include 26 | 27 | /** 28 | * @file 29 | * @brief Public header for libavutil XTEA algorithm 30 | * @defgroup lavu_xtea XTEA 31 | * @ingroup lavu_crypto 32 | * @{ 33 | */ 34 | 35 | typedef struct AVXTEA { 36 | uint32_t key[16]; 37 | } AVXTEA; 38 | 39 | /** 40 | * Initialize an AVXTEA context. 41 | * 42 | * @param ctx an AVXTEA context 43 | * @param key a key of 16 bytes used for encryption/decryption 44 | */ 45 | void av_xtea_init(struct AVXTEA *ctx, const uint8_t key[16]); 46 | 47 | /** 48 | * Encrypt or decrypt a buffer using a previously initialized context. 49 | * 50 | * @param ctx an AVXTEA context 51 | * @param dst destination array, can be equal to src 52 | * @param src source array, can be equal to dst 53 | * @param count number of 8 byte blocks 54 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used 55 | * @param decrypt 0 for encryption, 1 for decryption 56 | */ 57 | void av_xtea_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src, 58 | int count, uint8_t *iv, int decrypt); 59 | 60 | /** 61 | * @} 62 | */ 63 | 64 | #endif /* AVUTIL_XTEA_H */ 65 | -------------------------------------------------------------------------------- /universal/include/libavutil/lfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Lagged Fibonacci PRNG 3 | * Copyright (c) 2008 Michael Niedermayer 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_LFG_H 23 | #define AVUTIL_LFG_H 24 | 25 | typedef struct AVLFG { 26 | unsigned int state[64]; 27 | int index; 28 | } AVLFG; 29 | 30 | void av_lfg_init(AVLFG *c, unsigned int seed); 31 | 32 | /** 33 | * Get the next random unsigned 32-bit number using an ALFG. 34 | * 35 | * Please also consider a simple LCG like state= state*1664525+1013904223, 36 | * it may be good enough and faster for your specific use case. 37 | */ 38 | static inline unsigned int av_lfg_get(AVLFG *c){ 39 | c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63]; 40 | return c->state[c->index++ & 63]; 41 | } 42 | 43 | /** 44 | * Get the next random unsigned 32-bit number using a MLFG. 45 | * 46 | * Please also consider av_lfg_get() above, it is faster. 47 | */ 48 | static inline unsigned int av_mlfg_get(AVLFG *c){ 49 | unsigned int a= c->state[(c->index-55) & 63]; 50 | unsigned int b= c->state[(c->index-24) & 63]; 51 | return c->state[c->index++ & 63] = 2*a*b+a+b; 52 | } 53 | 54 | /** 55 | * Get the next two numbers generated by a Box-Muller Gaussian 56 | * generator using the random numbers issued by lfg. 57 | * 58 | * @param out array where the two generated numbers are placed 59 | */ 60 | void av_bmg_get(AVLFG *lfg, double out[2]); 61 | 62 | #endif /* AVUTIL_LFG_H */ 63 | -------------------------------------------------------------------------------- /universal/include/libavutil/sha.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_SHA_H 22 | #define AVUTIL_SHA_H 23 | 24 | #include 25 | 26 | #include "attributes.h" 27 | #include "version.h" 28 | 29 | /** 30 | * @defgroup lavu_sha SHA 31 | * @ingroup lavu_crypto 32 | * @{ 33 | */ 34 | 35 | extern const int av_sha_size; 36 | 37 | struct AVSHA; 38 | 39 | /** 40 | * Allocate an AVSHA context. 41 | */ 42 | struct AVSHA *av_sha_alloc(void); 43 | 44 | /** 45 | * Initialize SHA-1 or SHA-2 hashing. 46 | * 47 | * @param context pointer to the function context (of size av_sha_size) 48 | * @param bits number of bits in digest (SHA-1 - 160 bits, SHA-2 224 or 256 bits) 49 | * @return zero if initialization succeeded, -1 otherwise 50 | */ 51 | int av_sha_init(struct AVSHA* context, int bits); 52 | 53 | /** 54 | * Update hash value. 55 | * 56 | * @param context hash function context 57 | * @param data input data to update hash with 58 | * @param len input data length 59 | */ 60 | void av_sha_update(struct AVSHA* context, const uint8_t* data, unsigned int len); 61 | 62 | /** 63 | * Finish hashing and output digest value. 64 | * 65 | * @param context hash function context 66 | * @param digest buffer where output digest value is stored 67 | */ 68 | void av_sha_final(struct AVSHA* context, uint8_t *digest); 69 | 70 | /** 71 | * @} 72 | */ 73 | 74 | #endif /* AVUTIL_SHA_H */ 75 | -------------------------------------------------------------------------------- /universal/include/libavutil/md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_MD5_H 22 | #define AVUTIL_MD5_H 23 | 24 | #include 25 | 26 | #include "attributes.h" 27 | #include "version.h" 28 | 29 | /** 30 | * @defgroup lavu_md5 MD5 31 | * @ingroup lavu_crypto 32 | * @{ 33 | */ 34 | 35 | extern const int av_md5_size; 36 | 37 | struct AVMD5; 38 | 39 | /** 40 | * Allocate an AVMD5 context. 41 | */ 42 | struct AVMD5 *av_md5_alloc(void); 43 | 44 | /** 45 | * Initialize MD5 hashing. 46 | * 47 | * @param ctx pointer to the function context (of size av_md5_size) 48 | */ 49 | void av_md5_init(struct AVMD5 *ctx); 50 | 51 | /** 52 | * Update hash value. 53 | * 54 | * @param ctx hash function context 55 | * @param src input data to update hash with 56 | * @param len input data length 57 | */ 58 | void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, int len); 59 | 60 | /** 61 | * Finish hashing and output digest value. 62 | * 63 | * @param ctx hash function context 64 | * @param dst buffer where output digest value is stored 65 | */ 66 | void av_md5_final(struct AVMD5 *ctx, uint8_t *dst); 67 | 68 | /** 69 | * Hash an array of data. 70 | * 71 | * @param dst The output buffer to write the digest into 72 | * @param src The data to hash 73 | * @param len The length of the data, in bytes 74 | */ 75 | void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len); 76 | 77 | /** 78 | * @} 79 | */ 80 | 81 | #endif /* AVUTIL_MD5_H */ 82 | -------------------------------------------------------------------------------- /universal/include/libavutil/ripemd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Michael Niedermayer 3 | * Copyright (C) 2013 James Almer 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_RIPEMD_H 23 | #define AVUTIL_RIPEMD_H 24 | 25 | #include 26 | 27 | #include "attributes.h" 28 | #include "version.h" 29 | 30 | /** 31 | * @defgroup lavu_ripemd RIPEMD 32 | * @ingroup lavu_crypto 33 | * @{ 34 | */ 35 | 36 | extern const int av_ripemd_size; 37 | 38 | struct AVRIPEMD; 39 | 40 | /** 41 | * Allocate an AVRIPEMD context. 42 | */ 43 | struct AVRIPEMD *av_ripemd_alloc(void); 44 | 45 | /** 46 | * Initialize RIPEMD hashing. 47 | * 48 | * @param context pointer to the function context (of size av_ripemd_size) 49 | * @param bits number of bits in digest (128, 160, 256 or 320 bits) 50 | * @return zero if initialization succeeded, -1 otherwise 51 | */ 52 | int av_ripemd_init(struct AVRIPEMD* context, int bits); 53 | 54 | /** 55 | * Update hash value. 56 | * 57 | * @param context hash function context 58 | * @param data input data to update hash with 59 | * @param len input data length 60 | */ 61 | void av_ripemd_update(struct AVRIPEMD* context, const uint8_t* data, unsigned int len); 62 | 63 | /** 64 | * Finish hashing and output digest value. 65 | * 66 | * @param context hash function context 67 | * @param digest buffer where output digest value is stored 68 | */ 69 | void av_ripemd_final(struct AVRIPEMD* context, uint8_t *digest); 70 | 71 | /** 72 | * @} 73 | */ 74 | 75 | #endif /* AVUTIL_RIPEMD_H */ 76 | -------------------------------------------------------------------------------- /universal/include/libavutil/sha512.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Michael Niedermayer 3 | * Copyright (C) 2013 James Almer 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_SHA512_H 23 | #define AVUTIL_SHA512_H 24 | 25 | #include 26 | 27 | #include "attributes.h" 28 | #include "version.h" 29 | 30 | /** 31 | * @defgroup lavu_sha512 SHA512 32 | * @ingroup lavu_crypto 33 | * @{ 34 | */ 35 | 36 | extern const int av_sha512_size; 37 | 38 | struct AVSHA512; 39 | 40 | /** 41 | * Allocate an AVSHA512 context. 42 | */ 43 | struct AVSHA512 *av_sha512_alloc(void); 44 | 45 | /** 46 | * Initialize SHA-2 512 hashing. 47 | * 48 | * @param context pointer to the function context (of size av_sha512_size) 49 | * @param bits number of bits in digest (224, 256, 384 or 512 bits) 50 | * @return zero if initialization succeeded, -1 otherwise 51 | */ 52 | int av_sha512_init(struct AVSHA512* context, int bits); 53 | 54 | /** 55 | * Update hash value. 56 | * 57 | * @param context hash function context 58 | * @param data input data to update hash with 59 | * @param len input data length 60 | */ 61 | void av_sha512_update(struct AVSHA512* context, const uint8_t* data, unsigned int len); 62 | 63 | /** 64 | * Finish hashing and output digest value. 65 | * 66 | * @param context hash function context 67 | * @param digest buffer where output digest value is stored 68 | */ 69 | void av_sha512_final(struct AVSHA512* context, uint8_t *digest); 70 | 71 | /** 72 | * @} 73 | */ 74 | 75 | #endif /* AVUTIL_SHA512_H */ 76 | -------------------------------------------------------------------------------- /universal/include/libavutil/base64.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006 Ryan Martell. (rdm4@martellventures.com) 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_BASE64_H 22 | #define AVUTIL_BASE64_H 23 | 24 | #include 25 | 26 | /** 27 | * @defgroup lavu_base64 Base64 28 | * @ingroup lavu_crypto 29 | * @{ 30 | */ 31 | 32 | 33 | /** 34 | * Decode a base64-encoded string. 35 | * 36 | * @param out buffer for decoded data 37 | * @param in null-terminated input string 38 | * @param out_size size in bytes of the out buffer, must be at 39 | * least 3/4 of the length of in 40 | * @return number of bytes written, or a negative value in case of 41 | * invalid input 42 | */ 43 | int av_base64_decode(uint8_t *out, const char *in, int out_size); 44 | 45 | /** 46 | * Encode data to base64 and null-terminate. 47 | * 48 | * @param out buffer for encoded data 49 | * @param out_size size in bytes of the out buffer (including the 50 | * null terminator), must be at least AV_BASE64_SIZE(in_size) 51 | * @param in input buffer containing the data to encode 52 | * @param in_size size in bytes of the in buffer 53 | * @return out or NULL in case of error 54 | */ 55 | char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size); 56 | 57 | /** 58 | * Calculate the output size needed to base64-encode x bytes to a 59 | * null-terminated string. 60 | */ 61 | #define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1) 62 | 63 | /** 64 | * @} 65 | */ 66 | 67 | #endif /* AVUTIL_BASE64_H */ 68 | -------------------------------------------------------------------------------- /universal/include/libswscale/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef SWSCALE_VERSION_H 20 | #define SWSCALE_VERSION_H 21 | 22 | /** 23 | * @file 24 | * swscale version macros 25 | */ 26 | 27 | #include "libavutil/version.h" 28 | 29 | #define LIBSWSCALE_VERSION_MAJOR 2 30 | #define LIBSWSCALE_VERSION_MINOR 5 31 | #define LIBSWSCALE_VERSION_MICRO 102 32 | 33 | #define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \ 34 | LIBSWSCALE_VERSION_MINOR, \ 35 | LIBSWSCALE_VERSION_MICRO) 36 | #define LIBSWSCALE_VERSION AV_VERSION(LIBSWSCALE_VERSION_MAJOR, \ 37 | LIBSWSCALE_VERSION_MINOR, \ 38 | LIBSWSCALE_VERSION_MICRO) 39 | #define LIBSWSCALE_BUILD LIBSWSCALE_VERSION_INT 40 | 41 | #define LIBSWSCALE_IDENT "SwS" AV_STRINGIFY(LIBSWSCALE_VERSION) 42 | 43 | /** 44 | * FF_API_* defines may be placed below to indicate public API that will be 45 | * dropped at a future version bump. The defines themselves are not part of 46 | * the public API and may change, break or disappear at any time. 47 | */ 48 | 49 | #ifndef FF_API_SWS_GETCONTEXT 50 | #define FF_API_SWS_GETCONTEXT (LIBSWSCALE_VERSION_MAJOR < 3) 51 | #endif 52 | #ifndef FF_API_SWS_CPU_CAPS 53 | #define FF_API_SWS_CPU_CAPS (LIBSWSCALE_VERSION_MAJOR < 3) 54 | #endif 55 | #ifndef FF_API_SWS_FORMAT_NAME 56 | #define FF_API_SWS_FORMAT_NAME (LIBSWSCALE_VERSION_MAJOR < 3) 57 | #endif 58 | 59 | #endif /* SWSCALE_VERSION_H */ 60 | -------------------------------------------------------------------------------- /universal/include/libavutil/avassert.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2010 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * simple assert() macros that are a bit more flexible than ISO C assert(). 24 | * @author Michael Niedermayer 25 | */ 26 | 27 | #ifndef AVUTIL_AVASSERT_H 28 | #define AVUTIL_AVASSERT_H 29 | 30 | #include 31 | #include "avutil.h" 32 | #include "log.h" 33 | 34 | /** 35 | * assert() equivalent, that is always enabled. 36 | */ 37 | #define av_assert0(cond) do { \ 38 | if (!(cond)) { \ 39 | av_log(NULL, AV_LOG_PANIC, "Assertion %s failed at %s:%d\n", \ 40 | AV_STRINGIFY(cond), __FILE__, __LINE__); \ 41 | abort(); \ 42 | } \ 43 | } while (0) 44 | 45 | 46 | /** 47 | * assert() equivalent, that does not lie in speed critical code. 48 | * These asserts() thus can be enabled without fearing speedloss. 49 | */ 50 | #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 0 51 | #define av_assert1(cond) av_assert0(cond) 52 | #else 53 | #define av_assert1(cond) ((void)0) 54 | #endif 55 | 56 | 57 | /** 58 | * assert() equivalent, that does lie in speed critical code. 59 | */ 60 | #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1 61 | #define av_assert2(cond) av_assert0(cond) 62 | #else 63 | #define av_assert2(cond) ((void)0) 64 | #endif 65 | 66 | #endif /* AVUTIL_AVASSERT_H */ 67 | -------------------------------------------------------------------------------- /universal/include/libavutil/blowfish.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Blowfish algorithm 3 | * Copyright (c) 2012 Samuel Pitoiset 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_BLOWFISH_H 23 | #define AVUTIL_BLOWFISH_H 24 | 25 | #include 26 | 27 | /** 28 | * @defgroup lavu_blowfish Blowfish 29 | * @ingroup lavu_crypto 30 | * @{ 31 | */ 32 | 33 | #define AV_BF_ROUNDS 16 34 | 35 | typedef struct AVBlowfish { 36 | uint32_t p[AV_BF_ROUNDS + 2]; 37 | uint32_t s[4][256]; 38 | } AVBlowfish; 39 | 40 | /** 41 | * Initialize an AVBlowfish context. 42 | * 43 | * @param ctx an AVBlowfish context 44 | * @param key a key 45 | * @param key_len length of the key 46 | */ 47 | void av_blowfish_init(struct AVBlowfish *ctx, const uint8_t *key, int key_len); 48 | 49 | /** 50 | * Encrypt or decrypt a buffer using a previously initialized context. 51 | * 52 | * @param ctx an AVBlowfish context 53 | * @param xl left four bytes halves of input to be encrypted 54 | * @param xr right four bytes halves of input to be encrypted 55 | * @param decrypt 0 for encryption, 1 for decryption 56 | */ 57 | void av_blowfish_crypt_ecb(struct AVBlowfish *ctx, uint32_t *xl, uint32_t *xr, 58 | int decrypt); 59 | 60 | /** 61 | * Encrypt or decrypt a buffer using a previously initialized context. 62 | * 63 | * @param ctx an AVBlowfish context 64 | * @param dst destination array, can be equal to src 65 | * @param src source array, can be equal to dst 66 | * @param count number of 8 byte blocks 67 | * @param iv initialization vector for CBC mode, if NULL ECB will be used 68 | * @param decrypt 0 for encryption, 1 for decryption 69 | */ 70 | void av_blowfish_crypt(struct AVBlowfish *ctx, uint8_t *dst, const uint8_t *src, 71 | int count, uint8_t *iv, int decrypt); 72 | 73 | /** 74 | * @} 75 | */ 76 | 77 | #endif /* AVUTIL_BLOWFISH_H */ 78 | -------------------------------------------------------------------------------- /universal/include/libavutil/file.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_FILE_H 20 | #define AVUTIL_FILE_H 21 | 22 | #include 23 | 24 | #include "avutil.h" 25 | 26 | /** 27 | * @file 28 | * Misc file utilities. 29 | */ 30 | 31 | /** 32 | * Read the file with name filename, and put its content in a newly 33 | * allocated buffer or map it with mmap() when available. 34 | * In case of success set *bufptr to the read or mmapped buffer, and 35 | * *size to the size in bytes of the buffer in *bufptr. 36 | * The returned buffer must be released with av_file_unmap(). 37 | * 38 | * @param log_offset loglevel offset used for logging 39 | * @param log_ctx context used for logging 40 | * @return a non negative number in case of success, a negative value 41 | * corresponding to an AVERROR error code in case of failure 42 | */ 43 | int av_file_map(const char *filename, uint8_t **bufptr, size_t *size, 44 | int log_offset, void *log_ctx); 45 | 46 | /** 47 | * Unmap or free the buffer bufptr created by av_file_map(). 48 | * 49 | * @param size size in bytes of bufptr, must be the same as returned 50 | * by av_file_map() 51 | */ 52 | void av_file_unmap(uint8_t *bufptr, size_t size); 53 | 54 | /** 55 | * Wrapper to work around the lack of mkstemp() on mingw. 56 | * Also, tries to create file in /tmp first, if possible. 57 | * *prefix can be a character constant; *filename will be allocated internally. 58 | * @return file descriptor of opened file (or -1 on error) 59 | * and opened file name in **filename. 60 | * @note On very old libcs it is necessary to set a secure umask before 61 | * calling this, av_tempfile() can't call umask itself as it is used in 62 | * libraries and could interfere with the calling application. 63 | */ 64 | int av_tempfile(const char *prefix, char **filename, int log_offset, void *log_ctx); 65 | 66 | #endif /* AVUTIL_FILE_H */ 67 | -------------------------------------------------------------------------------- /universal/include/libavcodec/dxva2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * DXVA2 HW acceleration 3 | * 4 | * copyright (c) 2009 Laurent Aimar 5 | * 6 | * This file is part of FFmpeg. 7 | * 8 | * FFmpeg is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2.1 of the License, or (at your option) any later version. 12 | * 13 | * FFmpeg is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public 19 | * License along with FFmpeg; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | */ 22 | 23 | #ifndef AVCODEC_DXVA_H 24 | #define AVCODEC_DXVA_H 25 | 26 | /** 27 | * @file 28 | * @ingroup lavc_codec_hwaccel_dxva2 29 | * Public libavcodec DXVA2 header. 30 | */ 31 | 32 | #if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0600 33 | #undef _WIN32_WINNT 34 | #endif 35 | 36 | #if !defined(_WIN32_WINNT) 37 | #define _WIN32_WINNT 0x0600 38 | #endif 39 | 40 | #include 41 | #include 42 | #include 43 | 44 | /** 45 | * @defgroup lavc_codec_hwaccel_dxva2 DXVA2 46 | * @ingroup lavc_codec_hwaccel 47 | * 48 | * @{ 49 | */ 50 | 51 | #define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for DXVA2 and old UVD/UVD+ ATI video cards 52 | 53 | /** 54 | * This structure is used to provides the necessary configurations and data 55 | * to the DXVA2 FFmpeg HWAccel implementation. 56 | * 57 | * The application must make it available as AVCodecContext.hwaccel_context. 58 | */ 59 | struct dxva_context { 60 | /** 61 | * DXVA2 decoder object 62 | */ 63 | IDirectXVideoDecoder *decoder; 64 | 65 | /** 66 | * DXVA2 configuration used to create the decoder 67 | */ 68 | const DXVA2_ConfigPictureDecode *cfg; 69 | 70 | /** 71 | * The number of surface in the surface array 72 | */ 73 | unsigned surface_count; 74 | 75 | /** 76 | * The array of Direct3D surfaces used to create the decoder 77 | */ 78 | LPDIRECT3DSURFACE9 *surface; 79 | 80 | /** 81 | * A bit field configuring the workarounds needed for using the decoder 82 | */ 83 | uint64_t workaround; 84 | 85 | /** 86 | * Private to the FFmpeg AVHWAccel implementation 87 | */ 88 | unsigned report_id; 89 | }; 90 | 91 | /** 92 | * @} 93 | */ 94 | 95 | #endif /* AVCODEC_DXVA_H */ 96 | -------------------------------------------------------------------------------- /universal/include/libavutil/timestamp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | /** 20 | * @file 21 | * timestamp utils, mostly useful for debugging/logging purposes 22 | */ 23 | 24 | #ifndef AVUTIL_TIMESTAMP_H 25 | #define AVUTIL_TIMESTAMP_H 26 | 27 | #include "common.h" 28 | 29 | #if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) && !defined(PRId64) 30 | #error missing -D__STDC_FORMAT_MACROS / #define __STDC_FORMAT_MACROS 31 | #endif 32 | 33 | #define AV_TS_MAX_STRING_SIZE 32 34 | 35 | /** 36 | * Fill the provided buffer with a string containing a timestamp 37 | * representation. 38 | * 39 | * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE 40 | * @param ts the timestamp to represent 41 | * @return the buffer in input 42 | */ 43 | static inline char *av_ts_make_string(char *buf, int64_t ts) 44 | { 45 | if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS"); 46 | else snprintf(buf, AV_TS_MAX_STRING_SIZE, "%"PRId64, ts); 47 | return buf; 48 | } 49 | 50 | /** 51 | * Convenience macro, the return value should be used only directly in 52 | * function arguments but never stand-alone. 53 | */ 54 | #define av_ts2str(ts) av_ts_make_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts) 55 | 56 | /** 57 | * Fill the provided buffer with a string containing a timestamp time 58 | * representation. 59 | * 60 | * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE 61 | * @param ts the timestamp to represent 62 | * @param tb the timebase of the timestamp 63 | * @return the buffer in input 64 | */ 65 | static inline char *av_ts_make_time_string(char *buf, int64_t ts, AVRational *tb) 66 | { 67 | if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS"); 68 | else snprintf(buf, AV_TS_MAX_STRING_SIZE, "%.6g", av_q2d(*tb) * ts); 69 | return buf; 70 | } 71 | 72 | /** 73 | * Convenience macro, the return value should be used only directly in 74 | * function arguments but never stand-alone. 75 | */ 76 | #define av_ts2timestr(ts, tb) av_ts_make_time_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts, tb) 77 | 78 | #endif /* AVUTIL_TIMESTAMP_H */ 79 | -------------------------------------------------------------------------------- /universal/include/libavutil/crc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_CRC_H 22 | #define AVUTIL_CRC_H 23 | 24 | #include 25 | #include 26 | #include "attributes.h" 27 | 28 | /** 29 | * @defgroup lavu_crc32 CRC32 30 | * @ingroup lavu_crypto 31 | * @{ 32 | */ 33 | 34 | typedef uint32_t AVCRC; 35 | 36 | typedef enum { 37 | AV_CRC_8_ATM, 38 | AV_CRC_16_ANSI, 39 | AV_CRC_16_CCITT, 40 | AV_CRC_32_IEEE, 41 | AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */ 42 | AV_CRC_24_IEEE = 12, 43 | AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */ 44 | }AVCRCId; 45 | 46 | /** 47 | * Initialize a CRC table. 48 | * @param ctx must be an array of size sizeof(AVCRC)*257 or sizeof(AVCRC)*1024 49 | * @param le If 1, the lowest bit represents the coefficient for the highest 50 | * exponent of the corresponding polynomial (both for poly and 51 | * actual CRC). 52 | * If 0, you must swap the CRC parameter and the result of av_crc 53 | * if you need the standard representation (can be simplified in 54 | * most cases to e.g. bswap16): 55 | * av_bswap32(crc << (32-bits)) 56 | * @param bits number of bits for the CRC 57 | * @param poly generator polynomial without the x**bits coefficient, in the 58 | * representation as specified by le 59 | * @param ctx_size size of ctx in bytes 60 | * @return <0 on failure 61 | */ 62 | int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size); 63 | 64 | /** 65 | * Get an initialized standard CRC table. 66 | * @param crc_id ID of a standard CRC 67 | * @return a pointer to the CRC table or NULL on failure 68 | */ 69 | const AVCRC *av_crc_get_table(AVCRCId crc_id); 70 | 71 | /** 72 | * Calculate the CRC of a block. 73 | * @param crc CRC of previous blocks if any or initial value for CRC 74 | * @return CRC updated with the data from the given block 75 | * 76 | * @see av_crc_init() "le" parameter 77 | */ 78 | uint32_t av_crc(const AVCRC *ctx, uint32_t crc, 79 | const uint8_t *buffer, size_t length) av_pure; 80 | 81 | /** 82 | * @} 83 | */ 84 | 85 | #endif /* AVUTIL_CRC_H */ 86 | -------------------------------------------------------------------------------- /universal/include/libavformat/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Version macros. 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVFORMAT_VERSION_H 22 | #define AVFORMAT_VERSION_H 23 | 24 | /** 25 | * @file 26 | * @ingroup libavf 27 | * Libavformat version macros 28 | */ 29 | 30 | #include "libavutil/version.h" 31 | 32 | #define LIBAVFORMAT_VERSION_MAJOR 55 33 | #define LIBAVFORMAT_VERSION_MINOR 33 34 | #define LIBAVFORMAT_VERSION_MICRO 100 35 | 36 | #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ 37 | LIBAVFORMAT_VERSION_MINOR, \ 38 | LIBAVFORMAT_VERSION_MICRO) 39 | #define LIBAVFORMAT_VERSION AV_VERSION(LIBAVFORMAT_VERSION_MAJOR, \ 40 | LIBAVFORMAT_VERSION_MINOR, \ 41 | LIBAVFORMAT_VERSION_MICRO) 42 | #define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT 43 | 44 | #define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION) 45 | 46 | /** 47 | * FF_API_* defines may be placed below to indicate public API that will be 48 | * dropped at a future version bump. The defines themselves are not part of 49 | * the public API and may change, break or disappear at any time. 50 | */ 51 | #ifndef FF_API_REFERENCE_DTS 52 | #define FF_API_REFERENCE_DTS (LIBAVFORMAT_VERSION_MAJOR < 56) 53 | #endif 54 | 55 | #ifndef FF_API_ALLOC_OUTPUT_CONTEXT 56 | #define FF_API_ALLOC_OUTPUT_CONTEXT (LIBAVFORMAT_VERSION_MAJOR < 56) 57 | #endif 58 | #ifndef FF_API_FORMAT_PARAMETERS 59 | #define FF_API_FORMAT_PARAMETERS (LIBAVFORMAT_VERSION_MAJOR < 56) 60 | #endif 61 | #ifndef FF_API_NEW_STREAM 62 | #define FF_API_NEW_STREAM (LIBAVFORMAT_VERSION_MAJOR < 56) 63 | #endif 64 | #ifndef FF_API_SET_PTS_INFO 65 | #define FF_API_SET_PTS_INFO (LIBAVFORMAT_VERSION_MAJOR < 56) 66 | #endif 67 | #ifndef FF_API_CLOSE_INPUT_FILE 68 | #define FF_API_CLOSE_INPUT_FILE (LIBAVFORMAT_VERSION_MAJOR < 56) 69 | #endif 70 | #ifndef FF_API_READ_PACKET 71 | #define FF_API_READ_PACKET (LIBAVFORMAT_VERSION_MAJOR < 56) 72 | #endif 73 | #ifndef FF_API_ASS_SSA 74 | #define FF_API_ASS_SSA (LIBAVFORMAT_VERSION_MAJOR < 56) 75 | #endif 76 | #ifndef FF_API_R_FRAME_RATE 77 | #define FF_API_R_FRAME_RATE 1 78 | #endif 79 | #endif /* AVFORMAT_VERSION_H */ 80 | -------------------------------------------------------------------------------- /universal/include/libavutil/hmac.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Martin Storsjo 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_HMAC_H 22 | #define AVUTIL_HMAC_H 23 | 24 | #include 25 | 26 | /** 27 | * @defgroup lavu_hmac HMAC 28 | * @ingroup lavu_crypto 29 | * @{ 30 | */ 31 | 32 | enum AVHMACType { 33 | AV_HMAC_MD5, 34 | AV_HMAC_SHA1, 35 | AV_HMAC_SHA224 = 10, 36 | AV_HMAC_SHA256, 37 | AV_HMAC_SHA384, 38 | AV_HMAC_SHA512, 39 | }; 40 | 41 | typedef struct AVHMAC AVHMAC; 42 | 43 | /** 44 | * Allocate an AVHMAC context. 45 | * @param type The hash function used for the HMAC. 46 | */ 47 | AVHMAC *av_hmac_alloc(enum AVHMACType type); 48 | 49 | /** 50 | * Free an AVHMAC context. 51 | * @param ctx The context to free, may be NULL 52 | */ 53 | void av_hmac_free(AVHMAC *ctx); 54 | 55 | /** 56 | * Initialize an AVHMAC context with an authentication key. 57 | * @param ctx The HMAC context 58 | * @param key The authentication key 59 | * @param keylen The length of the key, in bytes 60 | */ 61 | void av_hmac_init(AVHMAC *ctx, const uint8_t *key, unsigned int keylen); 62 | 63 | /** 64 | * Hash data with the HMAC. 65 | * @param ctx The HMAC context 66 | * @param data The data to hash 67 | * @param len The length of the data, in bytes 68 | */ 69 | void av_hmac_update(AVHMAC *ctx, const uint8_t *data, unsigned int len); 70 | 71 | /** 72 | * Finish hashing and output the HMAC digest. 73 | * @param ctx The HMAC context 74 | * @param out The output buffer to write the digest into 75 | * @param outlen The length of the out buffer, in bytes 76 | * @return The number of bytes written to out, or a negative error code. 77 | */ 78 | int av_hmac_final(AVHMAC *ctx, uint8_t *out, unsigned int outlen); 79 | 80 | /** 81 | * Hash an array of data with a key. 82 | * @param ctx The HMAC context 83 | * @param data The data to hash 84 | * @param len The length of the data, in bytes 85 | * @param key The authentication key 86 | * @param keylen The length of the key, in bytes 87 | * @param out The output buffer to write the digest into 88 | * @param outlen The length of the out buffer, in bytes 89 | * @return The number of bytes written to out, or a negative error code. 90 | */ 91 | int av_hmac_calc(AVHMAC *ctx, const uint8_t *data, unsigned int len, 92 | const uint8_t *key, unsigned int keylen, 93 | uint8_t *out, unsigned int outlen); 94 | 95 | /** 96 | * @} 97 | */ 98 | 99 | #endif /* AVUTIL_HMAC_H */ 100 | -------------------------------------------------------------------------------- /universal/include/libavutil/bswap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * byte swapping routines 24 | */ 25 | 26 | #ifndef AVUTIL_BSWAP_H 27 | #define AVUTIL_BSWAP_H 28 | 29 | #include 30 | #include "libavutil/avconfig.h" 31 | #include "attributes.h" 32 | 33 | #ifdef HAVE_AV_CONFIG_H 34 | 35 | #include "config.h" 36 | 37 | #if ARCH_AARCH64 38 | # include "aarch64/bswap.h" 39 | #elif ARCH_ARM 40 | # include "arm/bswap.h" 41 | #elif ARCH_AVR32 42 | # include "avr32/bswap.h" 43 | #elif ARCH_BFIN 44 | # include "bfin/bswap.h" 45 | #elif ARCH_SH4 46 | # include "sh4/bswap.h" 47 | #elif ARCH_X86 48 | # include "x86/bswap.h" 49 | #endif 50 | 51 | #endif /* HAVE_AV_CONFIG_H */ 52 | 53 | #define AV_BSWAP16C(x) (((x) << 8 & 0xff00) | ((x) >> 8 & 0x00ff)) 54 | #define AV_BSWAP32C(x) (AV_BSWAP16C(x) << 16 | AV_BSWAP16C((x) >> 16)) 55 | #define AV_BSWAP64C(x) (AV_BSWAP32C(x) << 32 | AV_BSWAP32C((x) >> 32)) 56 | 57 | #define AV_BSWAPC(s, x) AV_BSWAP##s##C(x) 58 | 59 | #ifndef av_bswap16 60 | static av_always_inline av_const uint16_t av_bswap16(uint16_t x) 61 | { 62 | x= (x>>8) | (x<<8); 63 | return x; 64 | } 65 | #endif 66 | 67 | #ifndef av_bswap32 68 | static av_always_inline av_const uint32_t av_bswap32(uint32_t x) 69 | { 70 | return AV_BSWAP32C(x); 71 | } 72 | #endif 73 | 74 | #ifndef av_bswap64 75 | static inline uint64_t av_const av_bswap64(uint64_t x) 76 | { 77 | return (uint64_t)av_bswap32(x) << 32 | av_bswap32(x >> 32); 78 | } 79 | #endif 80 | 81 | // be2ne ... big-endian to native-endian 82 | // le2ne ... little-endian to native-endian 83 | 84 | #if AV_HAVE_BIGENDIAN 85 | #define av_be2ne16(x) (x) 86 | #define av_be2ne32(x) (x) 87 | #define av_be2ne64(x) (x) 88 | #define av_le2ne16(x) av_bswap16(x) 89 | #define av_le2ne32(x) av_bswap32(x) 90 | #define av_le2ne64(x) av_bswap64(x) 91 | #define AV_BE2NEC(s, x) (x) 92 | #define AV_LE2NEC(s, x) AV_BSWAPC(s, x) 93 | #else 94 | #define av_be2ne16(x) av_bswap16(x) 95 | #define av_be2ne32(x) av_bswap32(x) 96 | #define av_be2ne64(x) av_bswap64(x) 97 | #define av_le2ne16(x) (x) 98 | #define av_le2ne32(x) (x) 99 | #define av_le2ne64(x) (x) 100 | #define AV_BE2NEC(s, x) AV_BSWAPC(s, x) 101 | #define AV_LE2NEC(s, x) (x) 102 | #endif 103 | 104 | #define AV_BE2NE16C(x) AV_BE2NEC(16, x) 105 | #define AV_BE2NE32C(x) AV_BE2NEC(32, x) 106 | #define AV_BE2NE64C(x) AV_BE2NEC(64, x) 107 | #define AV_LE2NE16C(x) AV_LE2NEC(16, x) 108 | #define AV_LE2NE32C(x) AV_LE2NEC(32, x) 109 | #define AV_LE2NE64C(x) AV_LE2NEC(64, x) 110 | 111 | #endif /* AVUTIL_BSWAP_H */ 112 | -------------------------------------------------------------------------------- /universal/include/libavcodec/avfft.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVCODEC_AVFFT_H 20 | #define AVCODEC_AVFFT_H 21 | 22 | /** 23 | * @file 24 | * @ingroup lavc_fft 25 | * FFT functions 26 | */ 27 | 28 | /** 29 | * @defgroup lavc_fft FFT functions 30 | * @ingroup lavc_misc 31 | * 32 | * @{ 33 | */ 34 | 35 | typedef float FFTSample; 36 | 37 | typedef struct FFTComplex { 38 | FFTSample re, im; 39 | } FFTComplex; 40 | 41 | typedef struct FFTContext FFTContext; 42 | 43 | /** 44 | * Set up a complex FFT. 45 | * @param nbits log2 of the length of the input array 46 | * @param inverse if 0 perform the forward transform, if 1 perform the inverse 47 | */ 48 | FFTContext *av_fft_init(int nbits, int inverse); 49 | 50 | /** 51 | * Do the permutation needed BEFORE calling ff_fft_calc(). 52 | */ 53 | void av_fft_permute(FFTContext *s, FFTComplex *z); 54 | 55 | /** 56 | * Do a complex FFT with the parameters defined in av_fft_init(). The 57 | * input data must be permuted before. No 1.0/sqrt(n) normalization is done. 58 | */ 59 | void av_fft_calc(FFTContext *s, FFTComplex *z); 60 | 61 | void av_fft_end(FFTContext *s); 62 | 63 | FFTContext *av_mdct_init(int nbits, int inverse, double scale); 64 | void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input); 65 | void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input); 66 | void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input); 67 | void av_mdct_end(FFTContext *s); 68 | 69 | /* Real Discrete Fourier Transform */ 70 | 71 | enum RDFTransformType { 72 | DFT_R2C, 73 | IDFT_C2R, 74 | IDFT_R2C, 75 | DFT_C2R, 76 | }; 77 | 78 | typedef struct RDFTContext RDFTContext; 79 | 80 | /** 81 | * Set up a real FFT. 82 | * @param nbits log2 of the length of the input array 83 | * @param trans the type of transform 84 | */ 85 | RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans); 86 | void av_rdft_calc(RDFTContext *s, FFTSample *data); 87 | void av_rdft_end(RDFTContext *s); 88 | 89 | /* Discrete Cosine Transform */ 90 | 91 | typedef struct DCTContext DCTContext; 92 | 93 | enum DCTTransformType { 94 | DCT_II = 0, 95 | DCT_III, 96 | DCT_I, 97 | DST_I, 98 | }; 99 | 100 | /** 101 | * Set up DCT. 102 | * 103 | * @param nbits size of the input array: 104 | * (1 << nbits) for DCT-II, DCT-III and DST-I 105 | * (1 << nbits) + 1 for DCT-I 106 | * @param type the type of transform 107 | * 108 | * @note the first element of the input of DST-I is ignored 109 | */ 110 | DCTContext *av_dct_init(int nbits, enum DCTTransformType type); 111 | void av_dct_calc(DCTContext *s, FFTSample *data); 112 | void av_dct_end (DCTContext *s); 113 | 114 | /** 115 | * @} 116 | */ 117 | 118 | #endif /* AVCODEC_AVFFT_H */ 119 | -------------------------------------------------------------------------------- /universal/include/libavutil/downmix_info.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Tim Walker 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_DOWNMIX_INFO_H 22 | #define AVUTIL_DOWNMIX_INFO_H 23 | 24 | #include "frame.h" 25 | 26 | /** 27 | * @file 28 | * audio downmix medatata 29 | */ 30 | 31 | /** 32 | * @addtogroup lavu_audio 33 | * @{ 34 | */ 35 | 36 | /** 37 | * @defgroup downmix_info Audio downmix metadata 38 | * @{ 39 | */ 40 | 41 | /** 42 | * Possible downmix types. 43 | */ 44 | enum AVDownmixType { 45 | AV_DOWNMIX_TYPE_UNKNOWN, /**< Not indicated. */ 46 | AV_DOWNMIX_TYPE_LORO, /**< Lo/Ro 2-channel downmix (Stereo). */ 47 | AV_DOWNMIX_TYPE_LTRT, /**< Lt/Rt 2-channel downmix, Dolby Surround compatible. */ 48 | AV_DOWNMIX_TYPE_DPLII, /**< Lt/Rt 2-channel downmix, Dolby Pro Logic II compatible. */ 49 | AV_DOWNMIX_TYPE_NB /**< Number of downmix types. Not part of ABI. */ 50 | }; 51 | 52 | /** 53 | * This structure describes optional metadata relevant to a downmix procedure. 54 | * 55 | * All fields are set by the decoder to the value indicated in the audio 56 | * bitstream (if present), or to a "sane" default otherwise. 57 | */ 58 | typedef struct AVDownmixInfo { 59 | /** 60 | * Type of downmix preferred by the mastering engineer. 61 | */ 62 | enum AVDownmixType preferred_downmix_type; 63 | 64 | /** 65 | * Absolute scale factor representing the nominal level of the center 66 | * channel during a regular downmix. 67 | */ 68 | double center_mix_level; 69 | 70 | /** 71 | * Absolute scale factor representing the nominal level of the center 72 | * channel during an Lt/Rt compatible downmix. 73 | */ 74 | double center_mix_level_ltrt; 75 | 76 | /** 77 | * Absolute scale factor representing the nominal level of the surround 78 | * channels during a regular downmix. 79 | */ 80 | double surround_mix_level; 81 | 82 | /** 83 | * Absolute scale factor representing the nominal level of the surround 84 | * channels during an Lt/Rt compatible downmix. 85 | */ 86 | double surround_mix_level_ltrt; 87 | 88 | /** 89 | * Absolute scale factor representing the level at which the LFE data is 90 | * mixed into L/R channels during downmixing. 91 | */ 92 | double lfe_mix_level; 93 | } AVDownmixInfo; 94 | 95 | /** 96 | * Get a frame's AV_FRAME_DATA_DOWNMIX_INFO side data for editing. 97 | * 98 | * The side data is created and added to the frame if it's absent. 99 | * 100 | * @param frame the frame for which the side data is to be obtained. 101 | * 102 | * @return the AVDownmixInfo structure to be edited by the caller. 103 | */ 104 | AVDownmixInfo *av_downmix_info_update_side_data(AVFrame *frame); 105 | 106 | /** 107 | * @} 108 | */ 109 | 110 | /** 111 | * @} 112 | */ 113 | 114 | #endif /* AVUTIL_DOWNMIX_INFO_H */ 115 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | FFmpeg: 2 | 3 | Most files in FFmpeg are under the GNU Lesser General Public License version 2.1 4 | or later (LGPL v2.1+). Read the file COPYING.LGPLv2.1 for details. Some other 5 | files have MIT/X11/BSD-style licenses. In combination the LGPL v2.1+ applies to 6 | FFmpeg. 7 | 8 | Some optional parts of FFmpeg are licensed under the GNU General Public License 9 | version 2 or later (GPL v2+). See the file COPYING.GPLv2 for details. None of 10 | these parts are used by default, you have to explicitly pass --enable-gpl to 11 | configure to activate them. In this case, FFmpeg's license changes to GPL v2+. 12 | 13 | Specifically, the GPL parts of FFmpeg are 14 | 15 | - libpostproc 16 | - libmpcodecs 17 | - optional x86 optimizations in the files 18 | libavcodec/x86/idct_mmx.c 19 | - libutvideo encoding/decoding wrappers in 20 | libavcodec/libutvideo*.cpp 21 | - the X11 grabber in libavdevice/x11grab.c 22 | - the swresample test app in 23 | libswresample/swresample-test.c 24 | - the texi2pod.pl tool 25 | - the following filters in libavfilter: 26 | - f_ebur128.c 27 | - vf_blackframe.c 28 | - vf_boxblur.c 29 | - vf_colormatrix.c 30 | - vf_cropdetect.c 31 | - vf_decimate.c 32 | - vf_delogo.c 33 | - vf_geq.c 34 | - vf_histeq.c 35 | - vf_hqdn3d.c 36 | - vf_kerndeint.c 37 | - vf_mcdeint.c 38 | - vf_mp.c 39 | - vf_owdenoise.c 40 | - vf_perspective.c 41 | - vf_phase.c 42 | - vf_pp.c 43 | - vf_pullup.c 44 | - vf_sab.c 45 | - vf_smartblur.c 46 | - vf_spp.c 47 | - vf_stereo3d.c 48 | - vf_super2xsai.c 49 | - vf_tinterlace.c 50 | - vsrc_mptestsrc.c 51 | 52 | Should you, for whatever reason, prefer to use version 3 of the (L)GPL, then 53 | the configure parameter --enable-version3 will activate this licensing option 54 | for you. Read the file COPYING.LGPLv3 or, if you have enabled GPL parts, 55 | COPYING.GPLv3 to learn the exact legal terms that apply in this case. 56 | 57 | There are a handful of files under other licensing terms, namely: 58 | 59 | * The files libavcodec/jfdctfst.c, libavcodec/jfdctint_template.c and 60 | libavcodec/jrevdct.c are taken from libjpeg, see the top of the files for 61 | licensing details. Specifically note that you must credit the IJG in the 62 | documentation accompanying your program if you only distribute executables. 63 | You must also indicate any changes including additions and deletions to 64 | those three files in the documentation. 65 | 66 | 67 | external libraries 68 | ================== 69 | 70 | FFmpeg can be combined with a number of external libraries, which sometimes 71 | affect the licensing of binaries resulting from the combination. 72 | 73 | compatible libraries 74 | -------------------- 75 | 76 | The following libraries are under GPL: 77 | - frei0r 78 | - libcdio 79 | - libutvideo 80 | - libvidstab 81 | - libx264 82 | - libx265 83 | - libxavs 84 | - libxvid 85 | When combining them with FFmpeg, FFmpeg needs to be licensed as GPL as well by 86 | passing --enable-gpl to configure. 87 | 88 | The OpenCORE and VisualOn libraries are under the Apache License 2.0. That 89 | license is incompatible with the LGPL v2.1 and the GPL v2, but not with 90 | version 3 of those licenses. So to combine these libraries with FFmpeg, the 91 | license version needs to be upgraded by passing --enable-version3 to configure. 92 | 93 | incompatible libraries 94 | ---------------------- 95 | 96 | The Fraunhofer AAC library, FAAC and aacplus are under licenses which 97 | are incompatible with the GPLv2 and v3. We do not know for certain if their 98 | licenses are compatible with the LGPL. 99 | If you wish to enable these libraries, pass --enable-nonfree to configure. 100 | But note that if you enable any of these libraries the resulting binary will 101 | be under a complex license mix that is more restrictive than the LGPL and that 102 | may result in additional obligations. It is possible that these 103 | restrictions cause the resulting binary to be unredistributeable. -------------------------------------------------------------------------------- /universal/include/libavutil/stereo3d.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Vittorio Giovara 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include 22 | 23 | #include "frame.h" 24 | 25 | /** 26 | * List of possible 3D Types 27 | */ 28 | enum AVStereo3DType { 29 | /** 30 | * Video is not stereoscopic (and metadata has to be there). 31 | */ 32 | AV_STEREO3D_2D, 33 | 34 | /** 35 | * Views are next to each other. 36 | * 37 | * LLLLRRRR 38 | * LLLLRRRR 39 | * LLLLRRRR 40 | * ... 41 | */ 42 | AV_STEREO3D_SIDEBYSIDE, 43 | 44 | /** 45 | * Views are on top of each other. 46 | * 47 | * LLLLLLLL 48 | * LLLLLLLL 49 | * RRRRRRRR 50 | * RRRRRRRR 51 | */ 52 | AV_STEREO3D_TOPBOTTOM, 53 | 54 | /** 55 | * Views are alternated temporally. 56 | * 57 | * frame0 frame1 frame2 ... 58 | * LLLLLLLL RRRRRRRR LLLLLLLL 59 | * LLLLLLLL RRRRRRRR LLLLLLLL 60 | * LLLLLLLL RRRRRRRR LLLLLLLL 61 | * ... ... ... 62 | */ 63 | AV_STEREO3D_FRAMESEQUENCE, 64 | 65 | /** 66 | * Views are packed in a checkerboard-like structure per pixel. 67 | * 68 | * LRLRLRLR 69 | * RLRLRLRL 70 | * LRLRLRLR 71 | * ... 72 | */ 73 | AV_STEREO3D_CHECKERBOARD, 74 | 75 | /** 76 | * Views are next to each other, but when upscaling 77 | * apply a checkerboard pattern. 78 | * 79 | * LLLLRRRR L L L L R R R R 80 | * LLLLRRRR => L L L L R R R R 81 | * LLLLRRRR L L L L R R R R 82 | * LLLLRRRR L L L L R R R R 83 | */ 84 | AV_STEREO3D_SIDEBYSIDE_QUINCUNX, 85 | 86 | /** 87 | * Views are packed per line, as if interlaced. 88 | * 89 | * LLLLLLLL 90 | * RRRRRRRR 91 | * LLLLLLLL 92 | * ... 93 | */ 94 | AV_STEREO3D_LINES, 95 | 96 | /** 97 | * Views are packed per column. 98 | * 99 | * LRLRLRLR 100 | * LRLRLRLR 101 | * LRLRLRLR 102 | * ... 103 | */ 104 | AV_STEREO3D_COLUMNS, 105 | }; 106 | 107 | 108 | /** 109 | * Inverted views, Right/Bottom represents the left view. 110 | */ 111 | #define AV_STEREO3D_FLAG_INVERT (1 << 0) 112 | 113 | /** 114 | * Stereo 3D type: this structure describes how two videos are packed 115 | * within a single video surface, with additional information as needed. 116 | * 117 | * @note The struct must be allocated with av_stereo3d_alloc() and 118 | * its size is not a part of the public ABI. 119 | */ 120 | typedef struct AVStereo3D { 121 | /** 122 | * How views are packed within the video. 123 | */ 124 | enum AVStereo3DType type; 125 | 126 | /** 127 | * Additional information about the frame packing. 128 | */ 129 | int flags; 130 | } AVStereo3D; 131 | 132 | /** 133 | * Allocate an AVStereo3D structure and set its fields to default values. 134 | * The resulting struct can be freed using av_freep(). 135 | * 136 | * @return An AVStereo3D filled with default values or NULL on failure. 137 | */ 138 | AVStereo3D *av_stereo3d_alloc(void); 139 | 140 | /** 141 | * Allocate a complete AVFrameSideData and add it to the frame. 142 | * 143 | * @param frame The frame which side data is added to. 144 | * 145 | * @return The AVStereo3D structure to be filled by caller. 146 | */ 147 | AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame); 148 | -------------------------------------------------------------------------------- /universal/include/libavcodec/vaapi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Video Acceleration API (shared data between FFmpeg and the video player) 3 | * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1 4 | * 5 | * Copyright (C) 2008-2009 Splitted-Desktop Systems 6 | * 7 | * This file is part of FFmpeg. 8 | * 9 | * FFmpeg is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * FFmpeg is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public 20 | * License along with FFmpeg; if not, write to the Free Software 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 22 | */ 23 | 24 | #ifndef AVCODEC_VAAPI_H 25 | #define AVCODEC_VAAPI_H 26 | 27 | /** 28 | * @file 29 | * @ingroup lavc_codec_hwaccel_vaapi 30 | * Public libavcodec VA API header. 31 | */ 32 | 33 | #include 34 | 35 | /** 36 | * @defgroup lavc_codec_hwaccel_vaapi VA API Decoding 37 | * @ingroup lavc_codec_hwaccel 38 | * @{ 39 | */ 40 | 41 | /** 42 | * This structure is used to share data between the FFmpeg library and 43 | * the client video application. 44 | * This shall be zero-allocated and available as 45 | * AVCodecContext.hwaccel_context. All user members can be set once 46 | * during initialization or through each AVCodecContext.get_buffer() 47 | * function call. In any case, they must be valid prior to calling 48 | * decoding functions. 49 | */ 50 | struct vaapi_context { 51 | /** 52 | * Window system dependent data 53 | * 54 | * - encoding: unused 55 | * - decoding: Set by user 56 | */ 57 | void *display; 58 | 59 | /** 60 | * Configuration ID 61 | * 62 | * - encoding: unused 63 | * - decoding: Set by user 64 | */ 65 | uint32_t config_id; 66 | 67 | /** 68 | * Context ID (video decode pipeline) 69 | * 70 | * - encoding: unused 71 | * - decoding: Set by user 72 | */ 73 | uint32_t context_id; 74 | 75 | /** 76 | * VAPictureParameterBuffer ID 77 | * 78 | * - encoding: unused 79 | * - decoding: Set by libavcodec 80 | */ 81 | uint32_t pic_param_buf_id; 82 | 83 | /** 84 | * VAIQMatrixBuffer ID 85 | * 86 | * - encoding: unused 87 | * - decoding: Set by libavcodec 88 | */ 89 | uint32_t iq_matrix_buf_id; 90 | 91 | /** 92 | * VABitPlaneBuffer ID (for VC-1 decoding) 93 | * 94 | * - encoding: unused 95 | * - decoding: Set by libavcodec 96 | */ 97 | uint32_t bitplane_buf_id; 98 | 99 | /** 100 | * Slice parameter/data buffer IDs 101 | * 102 | * - encoding: unused 103 | * - decoding: Set by libavcodec 104 | */ 105 | uint32_t *slice_buf_ids; 106 | 107 | /** 108 | * Number of effective slice buffer IDs to send to the HW 109 | * 110 | * - encoding: unused 111 | * - decoding: Set by libavcodec 112 | */ 113 | unsigned int n_slice_buf_ids; 114 | 115 | /** 116 | * Size of pre-allocated slice_buf_ids 117 | * 118 | * - encoding: unused 119 | * - decoding: Set by libavcodec 120 | */ 121 | unsigned int slice_buf_ids_alloc; 122 | 123 | /** 124 | * Pointer to VASliceParameterBuffers 125 | * 126 | * - encoding: unused 127 | * - decoding: Set by libavcodec 128 | */ 129 | void *slice_params; 130 | 131 | /** 132 | * Size of a VASliceParameterBuffer element 133 | * 134 | * - encoding: unused 135 | * - decoding: Set by libavcodec 136 | */ 137 | unsigned int slice_param_size; 138 | 139 | /** 140 | * Size of pre-allocated slice_params 141 | * 142 | * - encoding: unused 143 | * - decoding: Set by libavcodec 144 | */ 145 | unsigned int slice_params_alloc; 146 | 147 | /** 148 | * Number of slices currently filled in 149 | * 150 | * - encoding: unused 151 | * - decoding: Set by libavcodec 152 | */ 153 | unsigned int slice_count; 154 | 155 | /** 156 | * Pointer to slice data buffer base 157 | * - encoding: unused 158 | * - decoding: Set by libavcodec 159 | */ 160 | const uint8_t *slice_data; 161 | 162 | /** 163 | * Current size of slice data 164 | * 165 | * - encoding: unused 166 | * - decoding: Set by libavcodec 167 | */ 168 | uint32_t slice_data_size; 169 | }; 170 | 171 | /* @} */ 172 | 173 | #endif /* AVCODEC_VAAPI_H */ 174 | -------------------------------------------------------------------------------- /universal/include/libavcodec/vda.h: -------------------------------------------------------------------------------- 1 | /* 2 | * VDA HW acceleration 3 | * 4 | * copyright (c) 2011 Sebastien Zwickert 5 | * 6 | * This file is part of FFmpeg. 7 | * 8 | * FFmpeg is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2.1 of the License, or (at your option) any later version. 12 | * 13 | * FFmpeg is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public 19 | * License along with FFmpeg; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | */ 22 | 23 | #ifndef AVCODEC_VDA_H 24 | #define AVCODEC_VDA_H 25 | 26 | /** 27 | * @file 28 | * @ingroup lavc_codec_hwaccel_vda 29 | * Public libavcodec VDA header. 30 | */ 31 | 32 | #include 33 | 34 | // emmintrin.h is unable to compile with -std=c99 -Werror=missing-prototypes 35 | // http://openradar.appspot.com/8026390 36 | #undef __GNUC_STDC_INLINE__ 37 | 38 | #define Picture QuickdrawPicture 39 | #include 40 | #undef Picture 41 | 42 | #include "libavcodec/version.h" 43 | 44 | // extra flags not defined in VDADecoder.h 45 | enum { 46 | kVDADecodeInfo_Asynchronous = 1UL << 0, 47 | kVDADecodeInfo_FrameDropped = 1UL << 1 48 | }; 49 | 50 | /** 51 | * @defgroup lavc_codec_hwaccel_vda VDA 52 | * @ingroup lavc_codec_hwaccel 53 | * 54 | * @{ 55 | */ 56 | 57 | /** 58 | * This structure is used to provide the necessary configurations and data 59 | * to the VDA FFmpeg HWAccel implementation. 60 | * 61 | * The application must make it available as AVCodecContext.hwaccel_context. 62 | */ 63 | struct vda_context { 64 | /** 65 | * VDA decoder object. 66 | * 67 | * - encoding: unused 68 | * - decoding: Set/Unset by libavcodec. 69 | */ 70 | VDADecoder decoder; 71 | 72 | /** 73 | * The Core Video pixel buffer that contains the current image data. 74 | * 75 | * encoding: unused 76 | * decoding: Set by libavcodec. Unset by user. 77 | */ 78 | CVPixelBufferRef cv_buffer; 79 | 80 | /** 81 | * Use the hardware decoder in synchronous mode. 82 | * 83 | * encoding: unused 84 | * decoding: Set by user. 85 | */ 86 | int use_sync_decoding; 87 | 88 | /** 89 | * The frame width. 90 | * 91 | * - encoding: unused 92 | * - decoding: Set/Unset by user. 93 | */ 94 | int width; 95 | 96 | /** 97 | * The frame height. 98 | * 99 | * - encoding: unused 100 | * - decoding: Set/Unset by user. 101 | */ 102 | int height; 103 | 104 | /** 105 | * The frame format. 106 | * 107 | * - encoding: unused 108 | * - decoding: Set/Unset by user. 109 | */ 110 | int format; 111 | 112 | /** 113 | * The pixel format for output image buffers. 114 | * 115 | * - encoding: unused 116 | * - decoding: Set/Unset by user. 117 | */ 118 | OSType cv_pix_fmt_type; 119 | 120 | /** 121 | * The current bitstream buffer. 122 | * 123 | * - encoding: unused 124 | * - decoding: Set/Unset by libavcodec. 125 | */ 126 | uint8_t *priv_bitstream; 127 | 128 | /** 129 | * The current size of the bitstream. 130 | * 131 | * - encoding: unused 132 | * - decoding: Set/Unset by libavcodec. 133 | */ 134 | int priv_bitstream_size; 135 | 136 | /** 137 | * The reference size used for fast reallocation. 138 | * 139 | * - encoding: unused 140 | * - decoding: Set/Unset by libavcodec. 141 | */ 142 | int priv_allocated_size; 143 | 144 | /** 145 | * Use av_buffer to manage buffer. 146 | * When the flag is set, the CVPixelBuffers returned by the decoder will 147 | * be released automatically, so you have to retain them if necessary. 148 | * Not setting this flag may cause memory leak. 149 | * 150 | * encoding: unused 151 | * decoding: Set by user. 152 | */ 153 | int use_ref_buffer; 154 | }; 155 | 156 | /** Create the video decoder. */ 157 | int ff_vda_create_decoder(struct vda_context *vda_ctx, 158 | uint8_t *extradata, 159 | int extradata_size); 160 | 161 | /** Destroy the video decoder. */ 162 | int ff_vda_destroy_decoder(struct vda_context *vda_ctx); 163 | 164 | /** 165 | * @} 166 | */ 167 | 168 | #endif /* AVCODEC_VDA_H */ 169 | -------------------------------------------------------------------------------- /universal/include/libavutil/rational.h: -------------------------------------------------------------------------------- 1 | /* 2 | * rational numbers 3 | * Copyright (c) 2003 Michael Niedermayer 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | /** 23 | * @file 24 | * rational numbers 25 | * @author Michael Niedermayer 26 | */ 27 | 28 | #ifndef AVUTIL_RATIONAL_H 29 | #define AVUTIL_RATIONAL_H 30 | 31 | #include 32 | #include 33 | #include "attributes.h" 34 | 35 | /** 36 | * @addtogroup lavu_math 37 | * @{ 38 | */ 39 | 40 | /** 41 | * rational number numerator/denominator 42 | */ 43 | typedef struct AVRational{ 44 | int num; ///< numerator 45 | int den; ///< denominator 46 | } AVRational; 47 | 48 | /** 49 | * Create a rational. 50 | * Useful for compilers that do not support compound literals. 51 | * @note The return value is not reduced. 52 | */ 53 | static inline AVRational av_make_q(int num, int den) 54 | { 55 | AVRational r = { num, den }; 56 | return r; 57 | } 58 | 59 | /** 60 | * Compare two rationals. 61 | * @param a first rational 62 | * @param b second rational 63 | * @return 0 if a==b, 1 if a>b, -1 if a>63)|1; 70 | else if(b.den && a.den) return 0; 71 | else if(a.num && b.num) return (a.num>>31) - (b.num>>31); 72 | else return INT_MIN; 73 | } 74 | 75 | /** 76 | * Convert rational to double. 77 | * @param a rational to convert 78 | * @return (double) a 79 | */ 80 | static inline double av_q2d(AVRational a){ 81 | return a.num / (double) a.den; 82 | } 83 | 84 | /** 85 | * Reduce a fraction. 86 | * This is useful for framerate calculations. 87 | * @param dst_num destination numerator 88 | * @param dst_den destination denominator 89 | * @param num source numerator 90 | * @param den source denominator 91 | * @param max the maximum allowed for dst_num & dst_den 92 | * @return 1 if exact, 0 otherwise 93 | */ 94 | int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max); 95 | 96 | /** 97 | * Multiply two rationals. 98 | * @param b first rational 99 | * @param c second rational 100 | * @return b*c 101 | */ 102 | AVRational av_mul_q(AVRational b, AVRational c) av_const; 103 | 104 | /** 105 | * Divide one rational by another. 106 | * @param b first rational 107 | * @param c second rational 108 | * @return b/c 109 | */ 110 | AVRational av_div_q(AVRational b, AVRational c) av_const; 111 | 112 | /** 113 | * Add two rationals. 114 | * @param b first rational 115 | * @param c second rational 116 | * @return b+c 117 | */ 118 | AVRational av_add_q(AVRational b, AVRational c) av_const; 119 | 120 | /** 121 | * Subtract one rational from another. 122 | * @param b first rational 123 | * @param c second rational 124 | * @return b-c 125 | */ 126 | AVRational av_sub_q(AVRational b, AVRational c) av_const; 127 | 128 | /** 129 | * Invert a rational. 130 | * @param q value 131 | * @return 1 / q 132 | */ 133 | static av_always_inline AVRational av_inv_q(AVRational q) 134 | { 135 | AVRational r = { q.den, q.num }; 136 | return r; 137 | } 138 | 139 | /** 140 | * Convert a double precision floating point number to a rational. 141 | * inf is expressed as {1,0} or {-1,0} depending on the sign. 142 | * 143 | * @param d double to convert 144 | * @param max the maximum allowed numerator and denominator 145 | * @return (AVRational) d 146 | */ 147 | AVRational av_d2q(double d, int max) av_const; 148 | 149 | /** 150 | * @return 1 if q1 is nearer to q than q2, -1 if q2 is nearer 151 | * than q1, 0 if they have the same distance. 152 | */ 153 | int av_nearer_q(AVRational q, AVRational q1, AVRational q2); 154 | 155 | /** 156 | * Find the nearest value in q_list to q. 157 | * @param q_list an array of rationals terminated by {0, 0} 158 | * @return the index of the nearest value found in the array 159 | */ 160 | int av_find_nearest_q_idx(AVRational q, const AVRational* q_list); 161 | 162 | /** 163 | * @} 164 | */ 165 | 166 | #endif /* AVUTIL_RATIONAL_H */ 167 | -------------------------------------------------------------------------------- /universal/include/libavutil/attributes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * Macro definitions for various function/variable attributes 24 | */ 25 | 26 | #ifndef AVUTIL_ATTRIBUTES_H 27 | #define AVUTIL_ATTRIBUTES_H 28 | 29 | #ifdef __GNUC__ 30 | # define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > x || __GNUC__ == x && __GNUC_MINOR__ >= y) 31 | #else 32 | # define AV_GCC_VERSION_AT_LEAST(x,y) 0 33 | #endif 34 | 35 | #ifndef av_always_inline 36 | #if AV_GCC_VERSION_AT_LEAST(3,1) 37 | # define av_always_inline __attribute__((always_inline)) inline 38 | #elif defined(_MSC_VER) 39 | # define av_always_inline __forceinline 40 | #else 41 | # define av_always_inline inline 42 | #endif 43 | #endif 44 | 45 | #ifndef av_extern_inline 46 | #if defined(__ICL) && __ICL >= 1210 || defined(__GNUC_STDC_INLINE__) 47 | # define av_extern_inline extern inline 48 | #else 49 | # define av_extern_inline inline 50 | #endif 51 | #endif 52 | 53 | #if AV_GCC_VERSION_AT_LEAST(3,1) 54 | # define av_noinline __attribute__((noinline)) 55 | #elif defined(_MSC_VER) 56 | # define av_noinline __declspec(noinline) 57 | #else 58 | # define av_noinline 59 | #endif 60 | 61 | #if AV_GCC_VERSION_AT_LEAST(3,1) 62 | # define av_pure __attribute__((pure)) 63 | #else 64 | # define av_pure 65 | #endif 66 | 67 | #if AV_GCC_VERSION_AT_LEAST(2,6) 68 | # define av_const __attribute__((const)) 69 | #else 70 | # define av_const 71 | #endif 72 | 73 | #if AV_GCC_VERSION_AT_LEAST(4,3) 74 | # define av_cold __attribute__((cold)) 75 | #else 76 | # define av_cold 77 | #endif 78 | 79 | #if AV_GCC_VERSION_AT_LEAST(4,1) && !defined(__llvm__) 80 | # define av_flatten __attribute__((flatten)) 81 | #else 82 | # define av_flatten 83 | #endif 84 | 85 | #if AV_GCC_VERSION_AT_LEAST(3,1) 86 | # define attribute_deprecated __attribute__((deprecated)) 87 | #elif defined(_MSC_VER) 88 | # define attribute_deprecated __declspec(deprecated) 89 | #else 90 | # define attribute_deprecated 91 | #endif 92 | 93 | /** 94 | * Disable warnings about deprecated features 95 | * This is useful for sections of code kept for backward compatibility and 96 | * scheduled for removal. 97 | */ 98 | #ifndef AV_NOWARN_DEPRECATED 99 | #if AV_GCC_VERSION_AT_LEAST(4,6) 100 | # define AV_NOWARN_DEPRECATED(code) \ 101 | _Pragma("GCC diagnostic push") \ 102 | _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \ 103 | code \ 104 | _Pragma("GCC diagnostic pop") 105 | #elif defined(_MSC_VER) 106 | # define AV_NOWARN_DEPRECATED(code) \ 107 | __pragma(warning(push)) \ 108 | __pragma(warning(disable : 4996)) \ 109 | code; \ 110 | __pragma(warning(pop)) 111 | #else 112 | # define AV_NOWARN_DEPRECATED(code) code 113 | #endif 114 | #endif 115 | 116 | 117 | #if defined(__GNUC__) 118 | # define av_unused __attribute__((unused)) 119 | #else 120 | # define av_unused 121 | #endif 122 | 123 | /** 124 | * Mark a variable as used and prevent the compiler from optimizing it 125 | * away. This is useful for variables accessed only from inline 126 | * assembler without the compiler being aware. 127 | */ 128 | #if AV_GCC_VERSION_AT_LEAST(3,1) 129 | # define av_used __attribute__((used)) 130 | #else 131 | # define av_used 132 | #endif 133 | 134 | #if AV_GCC_VERSION_AT_LEAST(3,3) 135 | # define av_alias __attribute__((may_alias)) 136 | #else 137 | # define av_alias 138 | #endif 139 | 140 | #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(__clang__) 141 | # define av_uninit(x) x=x 142 | #else 143 | # define av_uninit(x) x 144 | #endif 145 | 146 | #ifdef __GNUC__ 147 | # define av_builtin_constant_p __builtin_constant_p 148 | # define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos))) 149 | #else 150 | # define av_builtin_constant_p(x) 0 151 | # define av_printf_format(fmtpos, attrpos) 152 | #endif 153 | 154 | #if AV_GCC_VERSION_AT_LEAST(2,5) 155 | # define av_noreturn __attribute__((noreturn)) 156 | #else 157 | # define av_noreturn 158 | #endif 159 | 160 | #endif /* AVUTIL_ATTRIBUTES_H */ 161 | -------------------------------------------------------------------------------- /universal/include/libavutil/audio_fifo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Audio FIFO 3 | * Copyright (c) 2012 Justin Ruggles 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | /** 23 | * @file 24 | * Audio FIFO Buffer 25 | */ 26 | 27 | #ifndef AVUTIL_AUDIO_FIFO_H 28 | #define AVUTIL_AUDIO_FIFO_H 29 | 30 | #include "avutil.h" 31 | #include "fifo.h" 32 | #include "samplefmt.h" 33 | 34 | /** 35 | * @addtogroup lavu_audio 36 | * @{ 37 | */ 38 | 39 | /** 40 | * Context for an Audio FIFO Buffer. 41 | * 42 | * - Operates at the sample level rather than the byte level. 43 | * - Supports multiple channels with either planar or packed sample format. 44 | * - Automatic reallocation when writing to a full buffer. 45 | */ 46 | typedef struct AVAudioFifo AVAudioFifo; 47 | 48 | /** 49 | * Free an AVAudioFifo. 50 | * 51 | * @param af AVAudioFifo to free 52 | */ 53 | void av_audio_fifo_free(AVAudioFifo *af); 54 | 55 | /** 56 | * Allocate an AVAudioFifo. 57 | * 58 | * @param sample_fmt sample format 59 | * @param channels number of channels 60 | * @param nb_samples initial allocation size, in samples 61 | * @return newly allocated AVAudioFifo, or NULL on error 62 | */ 63 | AVAudioFifo *av_audio_fifo_alloc(enum AVSampleFormat sample_fmt, int channels, 64 | int nb_samples); 65 | 66 | /** 67 | * Reallocate an AVAudioFifo. 68 | * 69 | * @param af AVAudioFifo to reallocate 70 | * @param nb_samples new allocation size, in samples 71 | * @return 0 if OK, or negative AVERROR code on failure 72 | */ 73 | int av_audio_fifo_realloc(AVAudioFifo *af, int nb_samples); 74 | 75 | /** 76 | * Write data to an AVAudioFifo. 77 | * 78 | * The AVAudioFifo will be reallocated automatically if the available space 79 | * is less than nb_samples. 80 | * 81 | * @see enum AVSampleFormat 82 | * The documentation for AVSampleFormat describes the data layout. 83 | * 84 | * @param af AVAudioFifo to write to 85 | * @param data audio data plane pointers 86 | * @param nb_samples number of samples to write 87 | * @return number of samples actually written, or negative AVERROR 88 | * code on failure. If successful, the number of samples 89 | * actually written will always be nb_samples. 90 | */ 91 | int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples); 92 | 93 | /** 94 | * Read data from an AVAudioFifo. 95 | * 96 | * @see enum AVSampleFormat 97 | * The documentation for AVSampleFormat describes the data layout. 98 | * 99 | * @param af AVAudioFifo to read from 100 | * @param data audio data plane pointers 101 | * @param nb_samples number of samples to read 102 | * @return number of samples actually read, or negative AVERROR code 103 | * on failure. The number of samples actually read will not 104 | * be greater than nb_samples, and will only be less than 105 | * nb_samples if av_audio_fifo_size is less than nb_samples. 106 | */ 107 | int av_audio_fifo_read(AVAudioFifo *af, void **data, int nb_samples); 108 | 109 | /** 110 | * Drain data from an AVAudioFifo. 111 | * 112 | * Removes the data without reading it. 113 | * 114 | * @param af AVAudioFifo to drain 115 | * @param nb_samples number of samples to drain 116 | * @return 0 if OK, or negative AVERROR code on failure 117 | */ 118 | int av_audio_fifo_drain(AVAudioFifo *af, int nb_samples); 119 | 120 | /** 121 | * Reset the AVAudioFifo buffer. 122 | * 123 | * This empties all data in the buffer. 124 | * 125 | * @param af AVAudioFifo to reset 126 | */ 127 | void av_audio_fifo_reset(AVAudioFifo *af); 128 | 129 | /** 130 | * Get the current number of samples in the AVAudioFifo available for reading. 131 | * 132 | * @param af the AVAudioFifo to query 133 | * @return number of samples available for reading 134 | */ 135 | int av_audio_fifo_size(AVAudioFifo *af); 136 | 137 | /** 138 | * Get the current number of samples in the AVAudioFifo available for writing. 139 | * 140 | * @param af the AVAudioFifo to query 141 | * @return number of samples available for writing 142 | */ 143 | int av_audio_fifo_space(AVAudioFifo *af); 144 | 145 | /** 146 | * @} 147 | */ 148 | 149 | #endif /* AVUTIL_AUDIO_FIFO_H */ 150 | -------------------------------------------------------------------------------- /universal/include/libavutil/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2003 Fabrice Bellard 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_VERSION_H 22 | #define AVUTIL_VERSION_H 23 | 24 | #include "macros.h" 25 | 26 | /** 27 | * @defgroup version_utils Library Version Macros 28 | * 29 | * Useful to check and match library version in order to maintain 30 | * backward compatibility. 31 | * 32 | * @{ 33 | */ 34 | 35 | #define AV_VERSION_INT(a, b, c) (a<<16 | b<<8 | c) 36 | #define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c 37 | #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) 38 | 39 | /** 40 | * @} 41 | */ 42 | 43 | /** 44 | * @file 45 | * @ingroup lavu 46 | * Libavutil version macros 47 | */ 48 | 49 | /** 50 | * @defgroup lavu_ver Version and Build diagnostics 51 | * 52 | * Macros and function useful to check at compiletime and at runtime 53 | * which version of libavutil is in use. 54 | * 55 | * @{ 56 | */ 57 | 58 | #define LIBAVUTIL_VERSION_MAJOR 52 59 | #define LIBAVUTIL_VERSION_MINOR 66 60 | #define LIBAVUTIL_VERSION_MICRO 100 61 | 62 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ 63 | LIBAVUTIL_VERSION_MINOR, \ 64 | LIBAVUTIL_VERSION_MICRO) 65 | #define LIBAVUTIL_VERSION AV_VERSION(LIBAVUTIL_VERSION_MAJOR, \ 66 | LIBAVUTIL_VERSION_MINOR, \ 67 | LIBAVUTIL_VERSION_MICRO) 68 | #define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT 69 | 70 | #define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION) 71 | 72 | /** 73 | * @} 74 | * 75 | * @defgroup depr_guards Deprecation guards 76 | * FF_API_* defines may be placed below to indicate public API that will be 77 | * dropped at a future version bump. The defines themselves are not part of 78 | * the public API and may change, break or disappear at any time. 79 | * 80 | * @{ 81 | */ 82 | 83 | #ifndef FF_API_GET_BITS_PER_SAMPLE_FMT 84 | #define FF_API_GET_BITS_PER_SAMPLE_FMT (LIBAVUTIL_VERSION_MAJOR < 54) 85 | #endif 86 | #ifndef FF_API_FIND_OPT 87 | #define FF_API_FIND_OPT (LIBAVUTIL_VERSION_MAJOR < 54) 88 | #endif 89 | #ifndef FF_API_OLD_AVOPTIONS 90 | #define FF_API_OLD_AVOPTIONS (LIBAVUTIL_VERSION_MAJOR < 54) 91 | #endif 92 | #ifndef FF_API_PIX_FMT 93 | #define FF_API_PIX_FMT (LIBAVUTIL_VERSION_MAJOR < 54) 94 | #endif 95 | #ifndef FF_API_CONTEXT_SIZE 96 | #define FF_API_CONTEXT_SIZE (LIBAVUTIL_VERSION_MAJOR < 54) 97 | #endif 98 | #ifndef FF_API_PIX_FMT_DESC 99 | #define FF_API_PIX_FMT_DESC (LIBAVUTIL_VERSION_MAJOR < 54) 100 | #endif 101 | #ifndef FF_API_AV_REVERSE 102 | #define FF_API_AV_REVERSE (LIBAVUTIL_VERSION_MAJOR < 54) 103 | #endif 104 | #ifndef FF_API_AUDIOCONVERT 105 | #define FF_API_AUDIOCONVERT (LIBAVUTIL_VERSION_MAJOR < 54) 106 | #endif 107 | #ifndef FF_API_CPU_FLAG_MMX2 108 | #define FF_API_CPU_FLAG_MMX2 (LIBAVUTIL_VERSION_MAJOR < 54) 109 | #endif 110 | #ifndef FF_API_SAMPLES_UTILS_RETURN_ZERO 111 | #define FF_API_SAMPLES_UTILS_RETURN_ZERO (LIBAVUTIL_VERSION_MAJOR < 54) 112 | #endif 113 | #ifndef FF_API_LLS_PRIVATE 114 | #define FF_API_LLS_PRIVATE (LIBAVUTIL_VERSION_MAJOR < 54) 115 | #endif 116 | #ifndef FF_API_LLS1 117 | #define FF_API_LLS1 (LIBAVUTIL_VERSION_MAJOR < 54) 118 | #endif 119 | #ifndef FF_API_AVFRAME_LAVC 120 | #define FF_API_AVFRAME_LAVC (LIBAVUTIL_VERSION_MAJOR < 54) 121 | #endif 122 | #ifndef FF_API_VDPAU 123 | #define FF_API_VDPAU (LIBAVUTIL_VERSION_MAJOR < 54) 124 | #endif 125 | #ifndef FF_API_GET_CHANNEL_LAYOUT_COMPAT 126 | #define FF_API_GET_CHANNEL_LAYOUT_COMPAT (LIBAVUTIL_VERSION_MAJOR < 54) 127 | #endif 128 | #ifndef FF_API_OLD_OPENCL 129 | #define FF_API_OLD_OPENCL (LIBAVUTIL_VERSION_MAJOR < 54) 130 | #endif 131 | #ifndef FF_API_XVMC 132 | #define FF_API_XVMC (LIBAVUTIL_VERSION_MAJOR < 54) 133 | #endif 134 | #ifndef FF_API_INTFLOAT 135 | #define FF_API_INTFLOAT (LIBAVUTIL_VERSION_MAJOR < 54) 136 | #endif 137 | #ifndef FF_API_OPT_TYPE_METADATA 138 | #define FF_API_OPT_TYPE_METADATA (LIBAVUTIL_VERSION_MAJOR < 54) 139 | #endif 140 | 141 | /** 142 | * @} 143 | */ 144 | 145 | #endif /* AVUTIL_VERSION_H */ 146 | 147 | -------------------------------------------------------------------------------- /universal/include/libavutil/cpu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000, 2001, 2002 Fabrice Bellard 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_CPU_H 22 | #define AVUTIL_CPU_H 23 | 24 | #include "attributes.h" 25 | 26 | #define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */ 27 | 28 | /* lower 16 bits - CPU features */ 29 | #define AV_CPU_FLAG_MMX 0x0001 ///< standard MMX 30 | #define AV_CPU_FLAG_MMXEXT 0x0002 ///< SSE integer functions or AMD MMX ext 31 | #define AV_CPU_FLAG_MMX2 0x0002 ///< SSE integer functions or AMD MMX ext 32 | #define AV_CPU_FLAG_3DNOW 0x0004 ///< AMD 3DNOW 33 | #define AV_CPU_FLAG_SSE 0x0008 ///< SSE functions 34 | #define AV_CPU_FLAG_SSE2 0x0010 ///< PIV SSE2 functions 35 | #define AV_CPU_FLAG_SSE2SLOW 0x40000000 ///< SSE2 supported, but usually not faster 36 | ///< than regular MMX/SSE (e.g. Core1) 37 | #define AV_CPU_FLAG_3DNOWEXT 0x0020 ///< AMD 3DNowExt 38 | #define AV_CPU_FLAG_SSE3 0x0040 ///< Prescott SSE3 functions 39 | #define AV_CPU_FLAG_SSE3SLOW 0x20000000 ///< SSE3 supported, but usually not faster 40 | ///< than regular MMX/SSE (e.g. Core1) 41 | #define AV_CPU_FLAG_SSSE3 0x0080 ///< Conroe SSSE3 functions 42 | #define AV_CPU_FLAG_ATOM 0x10000000 ///< Atom processor, some SSSE3 instructions are slower 43 | #define AV_CPU_FLAG_SSE4 0x0100 ///< Penryn SSE4.1 functions 44 | #define AV_CPU_FLAG_SSE42 0x0200 ///< Nehalem SSE4.2 functions 45 | #define AV_CPU_FLAG_AVX 0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used 46 | #define AV_CPU_FLAG_XOP 0x0400 ///< Bulldozer XOP functions 47 | #define AV_CPU_FLAG_FMA4 0x0800 ///< Bulldozer FMA4 functions 48 | // #if LIBAVUTIL_VERSION_MAJOR <52 49 | #define AV_CPU_FLAG_CMOV 0x1001000 ///< supports cmov instruction 50 | // #else 51 | // #define AV_CPU_FLAG_CMOV 0x1000 ///< supports cmov instruction 52 | // #endif 53 | #define AV_CPU_FLAG_AVX2 0x8000 ///< AVX2 functions: requires OS support even if YMM registers aren't used 54 | #define AV_CPU_FLAG_FMA3 0x10000 ///< Haswell FMA3 functions 55 | #define AV_CPU_FLAG_BMI1 0x20000 ///< Bit Manipulation Instruction Set 1 56 | #define AV_CPU_FLAG_BMI2 0x40000 ///< Bit Manipulation Instruction Set 2 57 | 58 | #define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard 59 | 60 | #define AV_CPU_FLAG_ARMV5TE (1 << 0) 61 | #define AV_CPU_FLAG_ARMV6 (1 << 1) 62 | #define AV_CPU_FLAG_ARMV6T2 (1 << 2) 63 | #define AV_CPU_FLAG_VFP (1 << 3) 64 | #define AV_CPU_FLAG_VFPV3 (1 << 4) 65 | #define AV_CPU_FLAG_NEON (1 << 5) 66 | 67 | /** 68 | * Return the flags which specify extensions supported by the CPU. 69 | * The returned value is affected by av_force_cpu_flags() if that was used 70 | * before. So av_get_cpu_flags() can easily be used in a application to 71 | * detect the enabled cpu flags. 72 | */ 73 | int av_get_cpu_flags(void); 74 | 75 | /** 76 | * Disables cpu detection and forces the specified flags. 77 | * -1 is a special case that disables forcing of specific flags. 78 | */ 79 | void av_force_cpu_flags(int flags); 80 | 81 | /** 82 | * Set a mask on flags returned by av_get_cpu_flags(). 83 | * This function is mainly useful for testing. 84 | * Please use av_force_cpu_flags() and av_get_cpu_flags() instead which are more flexible 85 | * 86 | * @warning this function is not thread safe. 87 | */ 88 | attribute_deprecated void av_set_cpu_flags_mask(int mask); 89 | 90 | /** 91 | * Parse CPU flags from a string. 92 | * 93 | * The returned flags contain the specified flags as well as related unspecified flags. 94 | * 95 | * This function exists only for compatibility with libav. 96 | * Please use av_parse_cpu_caps() when possible. 97 | * @return a combination of AV_CPU_* flags, negative on error. 98 | */ 99 | attribute_deprecated 100 | int av_parse_cpu_flags(const char *s); 101 | 102 | /** 103 | * Parse CPU caps from a string and update the given AV_CPU_* flags based on that. 104 | * 105 | * @return negative on error. 106 | */ 107 | int av_parse_cpu_caps(unsigned *flags, const char *s); 108 | 109 | /** 110 | * @return the number of logical CPU cores present. 111 | */ 112 | int av_cpu_count(void); 113 | 114 | #endif /* AVUTIL_CPU_H */ 115 | -------------------------------------------------------------------------------- /universal/include/libavutil/error.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | /** 20 | * @file 21 | * error code definitions 22 | */ 23 | 24 | #ifndef AVUTIL_ERROR_H 25 | #define AVUTIL_ERROR_H 26 | 27 | #include 28 | #include 29 | 30 | /** 31 | * @addtogroup lavu_error 32 | * 33 | * @{ 34 | */ 35 | 36 | 37 | /* error handling */ 38 | #if EDOM > 0 39 | #define AVERROR(e) (-(e)) ///< Returns a negative error code from a POSIX error code, to return from library functions. 40 | #define AVUNERROR(e) (-(e)) ///< Returns a POSIX error code from a library function error return value. 41 | #else 42 | /* Some platforms have E* and errno already negated. */ 43 | #define AVERROR(e) (e) 44 | #define AVUNERROR(e) (e) 45 | #endif 46 | 47 | #define FFERRTAG(a, b, c, d) (-(int)MKTAG(a, b, c, d)) 48 | 49 | #define AVERROR_BSF_NOT_FOUND FFERRTAG(0xF8,'B','S','F') ///< Bitstream filter not found 50 | #define AVERROR_BUG FFERRTAG( 'B','U','G','!') ///< Internal bug, also see AVERROR_BUG2 51 | #define AVERROR_BUFFER_TOO_SMALL FFERRTAG( 'B','U','F','S') ///< Buffer too small 52 | #define AVERROR_DECODER_NOT_FOUND FFERRTAG(0xF8,'D','E','C') ///< Decoder not found 53 | #define AVERROR_DEMUXER_NOT_FOUND FFERRTAG(0xF8,'D','E','M') ///< Demuxer not found 54 | #define AVERROR_ENCODER_NOT_FOUND FFERRTAG(0xF8,'E','N','C') ///< Encoder not found 55 | #define AVERROR_EOF FFERRTAG( 'E','O','F',' ') ///< End of file 56 | #define AVERROR_EXIT FFERRTAG( 'E','X','I','T') ///< Immediate exit was requested; the called function should not be restarted 57 | #define AVERROR_EXTERNAL FFERRTAG( 'E','X','T',' ') ///< Generic error in an external library 58 | #define AVERROR_FILTER_NOT_FOUND FFERRTAG(0xF8,'F','I','L') ///< Filter not found 59 | #define AVERROR_INVALIDDATA FFERRTAG( 'I','N','D','A') ///< Invalid data found when processing input 60 | #define AVERROR_MUXER_NOT_FOUND FFERRTAG(0xF8,'M','U','X') ///< Muxer not found 61 | #define AVERROR_OPTION_NOT_FOUND FFERRTAG(0xF8,'O','P','T') ///< Option not found 62 | #define AVERROR_PATCHWELCOME FFERRTAG( 'P','A','W','E') ///< Not yet implemented in FFmpeg, patches welcome 63 | #define AVERROR_PROTOCOL_NOT_FOUND FFERRTAG(0xF8,'P','R','O') ///< Protocol not found 64 | 65 | #define AVERROR_STREAM_NOT_FOUND FFERRTAG(0xF8,'S','T','R') ///< Stream not found 66 | /** 67 | * This is semantically identical to AVERROR_BUG 68 | * it has been introduced in Libav after our AVERROR_BUG and with a modified value. 69 | */ 70 | #define AVERROR_BUG2 FFERRTAG( 'B','U','G',' ') 71 | #define AVERROR_UNKNOWN FFERRTAG( 'U','N','K','N') ///< Unknown error, typically from an external library 72 | #define AVERROR_EXPERIMENTAL (-0x2bb2afa8) ///< Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it. 73 | 74 | #define AV_ERROR_MAX_STRING_SIZE 64 75 | 76 | /** 77 | * Put a description of the AVERROR code errnum in errbuf. 78 | * In case of failure the global variable errno is set to indicate the 79 | * error. Even in case of failure av_strerror() will print a generic 80 | * error message indicating the errnum provided to errbuf. 81 | * 82 | * @param errnum error code to describe 83 | * @param errbuf buffer to which description is written 84 | * @param errbuf_size the size in bytes of errbuf 85 | * @return 0 on success, a negative value if a description for errnum 86 | * cannot be found 87 | */ 88 | int av_strerror(int errnum, char *errbuf, size_t errbuf_size); 89 | 90 | /** 91 | * Fill the provided buffer with a string containing an error string 92 | * corresponding to the AVERROR code errnum. 93 | * 94 | * @param errbuf a buffer 95 | * @param errbuf_size size in bytes of errbuf 96 | * @param errnum error code to describe 97 | * @return the buffer in input, filled with the error description 98 | * @see av_strerror() 99 | */ 100 | static inline char *av_make_error_string(char *errbuf, size_t errbuf_size, int errnum) 101 | { 102 | av_strerror(errnum, errbuf, errbuf_size); 103 | return errbuf; 104 | } 105 | 106 | /** 107 | * Convenience macro, the return value should be used only directly in 108 | * function arguments but never stand-alone. 109 | */ 110 | #define av_err2str(errnum) \ 111 | av_make_error_string((char[AV_ERROR_MAX_STRING_SIZE]){0}, AV_ERROR_MAX_STRING_SIZE, errnum) 112 | 113 | /** 114 | * @} 115 | */ 116 | 117 | #endif /* AVUTIL_ERROR_H */ 118 | -------------------------------------------------------------------------------- /universal/include/libavutil/fifo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | /** 20 | * @file 21 | * a very simple circular buffer FIFO implementation 22 | */ 23 | 24 | #ifndef AVUTIL_FIFO_H 25 | #define AVUTIL_FIFO_H 26 | 27 | #include 28 | #include "avutil.h" 29 | #include "attributes.h" 30 | 31 | typedef struct AVFifoBuffer { 32 | uint8_t *buffer; 33 | uint8_t *rptr, *wptr, *end; 34 | uint32_t rndx, wndx; 35 | } AVFifoBuffer; 36 | 37 | /** 38 | * Initialize an AVFifoBuffer. 39 | * @param size of FIFO 40 | * @return AVFifoBuffer or NULL in case of memory allocation failure 41 | */ 42 | AVFifoBuffer *av_fifo_alloc(unsigned int size); 43 | 44 | /** 45 | * Free an AVFifoBuffer. 46 | * @param f AVFifoBuffer to free 47 | */ 48 | void av_fifo_free(AVFifoBuffer *f); 49 | 50 | /** 51 | * Reset the AVFifoBuffer to the state right after av_fifo_alloc, in particular it is emptied. 52 | * @param f AVFifoBuffer to reset 53 | */ 54 | void av_fifo_reset(AVFifoBuffer *f); 55 | 56 | /** 57 | * Return the amount of data in bytes in the AVFifoBuffer, that is the 58 | * amount of data you can read from it. 59 | * @param f AVFifoBuffer to read from 60 | * @return size 61 | */ 62 | int av_fifo_size(AVFifoBuffer *f); 63 | 64 | /** 65 | * Return the amount of space in bytes in the AVFifoBuffer, that is the 66 | * amount of data you can write into it. 67 | * @param f AVFifoBuffer to write into 68 | * @return size 69 | */ 70 | int av_fifo_space(AVFifoBuffer *f); 71 | 72 | /** 73 | * Feed data from an AVFifoBuffer to a user-supplied callback. 74 | * @param f AVFifoBuffer to read from 75 | * @param buf_size number of bytes to read 76 | * @param func generic read function 77 | * @param dest data destination 78 | */ 79 | int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int)); 80 | 81 | /** 82 | * Feed data from a user-supplied callback to an AVFifoBuffer. 83 | * @param f AVFifoBuffer to write to 84 | * @param src data source; non-const since it may be used as a 85 | * modifiable context by the function defined in func 86 | * @param size number of bytes to write 87 | * @param func generic write function; the first parameter is src, 88 | * the second is dest_buf, the third is dest_buf_size. 89 | * func must return the number of bytes written to dest_buf, or <= 0 to 90 | * indicate no more data available to write. 91 | * If func is NULL, src is interpreted as a simple byte array for source data. 92 | * @return the number of bytes written to the FIFO 93 | */ 94 | int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int)); 95 | 96 | /** 97 | * Resize an AVFifoBuffer. 98 | * In case of reallocation failure, the old FIFO is kept unchanged. 99 | * 100 | * @param f AVFifoBuffer to resize 101 | * @param size new AVFifoBuffer size in bytes 102 | * @return <0 for failure, >=0 otherwise 103 | */ 104 | int av_fifo_realloc2(AVFifoBuffer *f, unsigned int size); 105 | 106 | /** 107 | * Enlarge an AVFifoBuffer. 108 | * In case of reallocation failure, the old FIFO is kept unchanged. 109 | * The new fifo size may be larger than the requested size. 110 | * 111 | * @param f AVFifoBuffer to resize 112 | * @param additional_space the amount of space in bytes to allocate in addition to av_fifo_size() 113 | * @return <0 for failure, >=0 otherwise 114 | */ 115 | int av_fifo_grow(AVFifoBuffer *f, unsigned int additional_space); 116 | 117 | /** 118 | * Read and discard the specified amount of data from an AVFifoBuffer. 119 | * @param f AVFifoBuffer to read from 120 | * @param size amount of data to read in bytes 121 | */ 122 | void av_fifo_drain(AVFifoBuffer *f, int size); 123 | 124 | /** 125 | * Return a pointer to the data stored in a FIFO buffer at a certain offset. 126 | * The FIFO buffer is not modified. 127 | * 128 | * @param f AVFifoBuffer to peek at, f must be non-NULL 129 | * @param offs an offset in bytes, its absolute value must be less 130 | * than the used buffer size or the returned pointer will 131 | * point outside to the buffer data. 132 | * The used buffer size can be checked with av_fifo_size(). 133 | */ 134 | static inline uint8_t *av_fifo_peek2(const AVFifoBuffer *f, int offs) 135 | { 136 | uint8_t *ptr = f->rptr + offs; 137 | if (ptr >= f->end) 138 | ptr = f->buffer + (ptr - f->end); 139 | else if (ptr < f->buffer) 140 | ptr = f->end - (f->buffer - ptr); 141 | return ptr; 142 | } 143 | 144 | #endif /* AVUTIL_FIFO_H */ 145 | -------------------------------------------------------------------------------- /universal/include/libavcodec/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of FFmpeg. 4 | * 5 | * FFmpeg is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * FFmpeg is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with FFmpeg; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef AVCODEC_VERSION_H 21 | #define AVCODEC_VERSION_H 22 | 23 | /** 24 | * @file 25 | * @ingroup libavc 26 | * Libavcodec version macros. 27 | */ 28 | 29 | #include "libavutil/version.h" 30 | 31 | #define LIBAVCODEC_VERSION_MAJOR 55 32 | #define LIBAVCODEC_VERSION_MINOR 52 33 | #define LIBAVCODEC_VERSION_MICRO 102 34 | 35 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ 36 | LIBAVCODEC_VERSION_MINOR, \ 37 | LIBAVCODEC_VERSION_MICRO) 38 | #define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \ 39 | LIBAVCODEC_VERSION_MINOR, \ 40 | LIBAVCODEC_VERSION_MICRO) 41 | #define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT 42 | 43 | #define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) 44 | 45 | /** 46 | * FF_API_* defines may be placed below to indicate public API that will be 47 | * dropped at a future version bump. The defines themselves are not part of 48 | * the public API and may change, break or disappear at any time. 49 | */ 50 | 51 | #ifndef FF_API_REQUEST_CHANNELS 52 | #define FF_API_REQUEST_CHANNELS (LIBAVCODEC_VERSION_MAJOR < 56) 53 | #endif 54 | #ifndef FF_API_OLD_DECODE_AUDIO 55 | #define FF_API_OLD_DECODE_AUDIO (LIBAVCODEC_VERSION_MAJOR < 56) 56 | #endif 57 | #ifndef FF_API_OLD_ENCODE_AUDIO 58 | #define FF_API_OLD_ENCODE_AUDIO (LIBAVCODEC_VERSION_MAJOR < 56) 59 | #endif 60 | #ifndef FF_API_OLD_ENCODE_VIDEO 61 | #define FF_API_OLD_ENCODE_VIDEO (LIBAVCODEC_VERSION_MAJOR < 56) 62 | #endif 63 | #ifndef FF_API_CODEC_ID 64 | #define FF_API_CODEC_ID (LIBAVCODEC_VERSION_MAJOR < 56) 65 | #endif 66 | #ifndef FF_API_AUDIO_CONVERT 67 | #define FF_API_AUDIO_CONVERT (LIBAVCODEC_VERSION_MAJOR < 56) 68 | #endif 69 | #ifndef FF_API_AVCODEC_RESAMPLE 70 | #define FF_API_AVCODEC_RESAMPLE FF_API_AUDIO_CONVERT 71 | #endif 72 | #ifndef FF_API_DEINTERLACE 73 | #define FF_API_DEINTERLACE (LIBAVCODEC_VERSION_MAJOR < 56) 74 | #endif 75 | #ifndef FF_API_DESTRUCT_PACKET 76 | #define FF_API_DESTRUCT_PACKET (LIBAVCODEC_VERSION_MAJOR < 56) 77 | #endif 78 | #ifndef FF_API_GET_BUFFER 79 | #define FF_API_GET_BUFFER (LIBAVCODEC_VERSION_MAJOR < 56) 80 | #endif 81 | #ifndef FF_API_MISSING_SAMPLE 82 | #define FF_API_MISSING_SAMPLE (LIBAVCODEC_VERSION_MAJOR < 56) 83 | #endif 84 | #ifndef FF_API_LOWRES 85 | #define FF_API_LOWRES (LIBAVCODEC_VERSION_MAJOR < 56) 86 | #endif 87 | #ifndef FF_API_CAP_VDPAU 88 | #define FF_API_CAP_VDPAU (LIBAVCODEC_VERSION_MAJOR < 56) 89 | #endif 90 | #ifndef FF_API_BUFS_VDPAU 91 | #define FF_API_BUFS_VDPAU (LIBAVCODEC_VERSION_MAJOR < 56) 92 | #endif 93 | #ifndef FF_API_VOXWARE 94 | #define FF_API_VOXWARE (LIBAVCODEC_VERSION_MAJOR < 56) 95 | #endif 96 | #ifndef FF_API_SET_DIMENSIONS 97 | #define FF_API_SET_DIMENSIONS (LIBAVCODEC_VERSION_MAJOR < 56) 98 | #endif 99 | #ifndef FF_API_DEBUG_MV 100 | #define FF_API_DEBUG_MV (LIBAVCODEC_VERSION_MAJOR < 56) 101 | #endif 102 | #ifndef FF_API_AC_VLC 103 | #define FF_API_AC_VLC (LIBAVCODEC_VERSION_MAJOR < 56) 104 | #endif 105 | #ifndef FF_API_OLD_MSMPEG4 106 | #define FF_API_OLD_MSMPEG4 (LIBAVCODEC_VERSION_MAJOR < 56) 107 | #endif 108 | #ifndef FF_API_ASPECT_EXTENDED 109 | #define FF_API_ASPECT_EXTENDED (LIBAVCODEC_VERSION_MAJOR < 56) 110 | #endif 111 | #ifndef FF_API_THREAD_OPAQUE 112 | #define FF_API_THREAD_OPAQUE (LIBAVCODEC_VERSION_MAJOR < 56) 113 | #endif 114 | #ifndef FF_API_CODEC_PKT 115 | #define FF_API_CODEC_PKT (LIBAVCODEC_VERSION_MAJOR < 56) 116 | #endif 117 | #ifndef FF_API_ARCH_ALPHA 118 | #define FF_API_ARCH_ALPHA (LIBAVCODEC_VERSION_MAJOR < 56) 119 | #endif 120 | #ifndef FF_API_XVMC 121 | #define FF_API_XVMC (LIBAVCODEC_VERSION_MAJOR < 56) 122 | #endif 123 | #ifndef FF_API_ERROR_RATE 124 | #define FF_API_ERROR_RATE (LIBAVCODEC_VERSION_MAJOR < 56) 125 | #endif 126 | #ifndef FF_API_QSCALE_TYPE 127 | #define FF_API_QSCALE_TYPE (LIBAVCODEC_VERSION_MAJOR < 56) 128 | #endif 129 | #ifndef FF_API_MB_TYPE 130 | #define FF_API_MB_TYPE (LIBAVCODEC_VERSION_MAJOR < 56) 131 | #endif 132 | #ifndef FF_API_MAX_BFRAMES 133 | #define FF_API_MAX_BFRAMES (LIBAVCODEC_VERSION_MAJOR < 56) 134 | #endif 135 | #ifndef FF_API_FAST_MALLOC 136 | #define FF_API_FAST_MALLOC (LIBAVCODEC_VERSION_MAJOR < 56) 137 | #endif 138 | #ifndef FF_API_NEG_LINESIZES 139 | #define FF_API_NEG_LINESIZES (LIBAVCODEC_VERSION_MAJOR < 56) 140 | #endif 141 | #ifndef FF_API_EMU_EDGE 142 | #define FF_API_EMU_EDGE (LIBAVCODEC_VERSION_MAJOR < 56) 143 | #endif 144 | 145 | #endif /* AVCODEC_VERSION_H */ 146 | -------------------------------------------------------------------------------- /universal/include/libavutil/eval.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * simple arithmetic expression evaluator 24 | */ 25 | 26 | #ifndef AVUTIL_EVAL_H 27 | #define AVUTIL_EVAL_H 28 | 29 | #include "avutil.h" 30 | 31 | typedef struct AVExpr AVExpr; 32 | 33 | /** 34 | * Parse and evaluate an expression. 35 | * Note, this is significantly slower than av_expr_eval(). 36 | * 37 | * @param res a pointer to a double where is put the result value of 38 | * the expression, or NAN in case of error 39 | * @param s expression as a zero terminated string, for example "1+2^3+5*5+sin(2/3)" 40 | * @param const_names NULL terminated array of zero terminated strings of constant identifiers, for example {"PI", "E", 0} 41 | * @param const_values a zero terminated array of values for the identifiers from const_names 42 | * @param func1_names NULL terminated array of zero terminated strings of funcs1 identifiers 43 | * @param funcs1 NULL terminated array of function pointers for functions which take 1 argument 44 | * @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers 45 | * @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments 46 | * @param opaque a pointer which will be passed to all functions from funcs1 and funcs2 47 | * @param log_ctx parent logging context 48 | * @return >= 0 in case of success, a negative value corresponding to an 49 | * AVERROR code otherwise 50 | */ 51 | int av_expr_parse_and_eval(double *res, const char *s, 52 | const char * const *const_names, const double *const_values, 53 | const char * const *func1_names, double (* const *funcs1)(void *, double), 54 | const char * const *func2_names, double (* const *funcs2)(void *, double, double), 55 | void *opaque, int log_offset, void *log_ctx); 56 | 57 | /** 58 | * Parse an expression. 59 | * 60 | * @param expr a pointer where is put an AVExpr containing the parsed 61 | * value in case of successful parsing, or NULL otherwise. 62 | * The pointed to AVExpr must be freed with av_expr_free() by the user 63 | * when it is not needed anymore. 64 | * @param s expression as a zero terminated string, for example "1+2^3+5*5+sin(2/3)" 65 | * @param const_names NULL terminated array of zero terminated strings of constant identifiers, for example {"PI", "E", 0} 66 | * @param func1_names NULL terminated array of zero terminated strings of funcs1 identifiers 67 | * @param funcs1 NULL terminated array of function pointers for functions which take 1 argument 68 | * @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers 69 | * @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments 70 | * @param log_ctx parent logging context 71 | * @return >= 0 in case of success, a negative value corresponding to an 72 | * AVERROR code otherwise 73 | */ 74 | int av_expr_parse(AVExpr **expr, const char *s, 75 | const char * const *const_names, 76 | const char * const *func1_names, double (* const *funcs1)(void *, double), 77 | const char * const *func2_names, double (* const *funcs2)(void *, double, double), 78 | int log_offset, void *log_ctx); 79 | 80 | /** 81 | * Evaluate a previously parsed expression. 82 | * 83 | * @param const_values a zero terminated array of values for the identifiers from av_expr_parse() const_names 84 | * @param opaque a pointer which will be passed to all functions from funcs1 and funcs2 85 | * @return the value of the expression 86 | */ 87 | double av_expr_eval(AVExpr *e, const double *const_values, void *opaque); 88 | 89 | /** 90 | * Free a parsed expression previously created with av_expr_parse(). 91 | */ 92 | void av_expr_free(AVExpr *e); 93 | 94 | /** 95 | * Parse the string in numstr and return its value as a double. If 96 | * the string is empty, contains only whitespaces, or does not contain 97 | * an initial substring that has the expected syntax for a 98 | * floating-point number, no conversion is performed. In this case, 99 | * returns a value of zero and the value returned in tail is the value 100 | * of numstr. 101 | * 102 | * @param numstr a string representing a number, may contain one of 103 | * the International System number postfixes, for example 'K', 'M', 104 | * 'G'. If 'i' is appended after the postfix, powers of 2 are used 105 | * instead of powers of 10. The 'B' postfix multiplies the value for 106 | * 8, and can be appended after another postfix or used alone. This 107 | * allows using for example 'KB', 'MiB', 'G' and 'B' as postfix. 108 | * @param tail if non-NULL puts here the pointer to the char next 109 | * after the last parsed character 110 | */ 111 | double av_strtod(const char *numstr, char **tail); 112 | 113 | #endif /* AVUTIL_EVAL_H */ 114 | -------------------------------------------------------------------------------- /universal/include/libavutil/timecode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006 Smartjog S.A.S, Baptiste Coudurier 3 | * Copyright (c) 2011-2012 Smartjog S.A.S, Clément Bœsch 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | /** 23 | * @file 24 | * Timecode helpers header 25 | */ 26 | 27 | #ifndef AVUTIL_TIMECODE_H 28 | #define AVUTIL_TIMECODE_H 29 | 30 | #include 31 | #include "rational.h" 32 | 33 | #define AV_TIMECODE_STR_SIZE 16 34 | 35 | enum AVTimecodeFlag { 36 | AV_TIMECODE_FLAG_DROPFRAME = 1<<0, ///< timecode is drop frame 37 | AV_TIMECODE_FLAG_24HOURSMAX = 1<<1, ///< timecode wraps after 24 hours 38 | AV_TIMECODE_FLAG_ALLOWNEGATIVE = 1<<2, ///< negative time values are allowed 39 | }; 40 | 41 | typedef struct { 42 | int start; ///< timecode frame start (first base frame number) 43 | uint32_t flags; ///< flags such as drop frame, +24 hours support, ... 44 | AVRational rate; ///< frame rate in rational form 45 | unsigned fps; ///< frame per second; must be consistent with the rate field 46 | } AVTimecode; 47 | 48 | /** 49 | * Adjust frame number for NTSC drop frame time code. 50 | * 51 | * @param framenum frame number to adjust 52 | * @param fps frame per second, 30 or 60 53 | * @return adjusted frame number 54 | * @warning adjustment is only valid in NTSC 29.97 and 59.94 55 | */ 56 | int av_timecode_adjust_ntsc_framenum2(int framenum, int fps); 57 | 58 | /** 59 | * Convert frame number to SMPTE 12M binary representation. 60 | * 61 | * @param tc timecode data correctly initialized 62 | * @param framenum frame number 63 | * @return the SMPTE binary representation 64 | * 65 | * @note Frame number adjustment is automatically done in case of drop timecode, 66 | * you do NOT have to call av_timecode_adjust_ntsc_framenum2(). 67 | * @note The frame number is relative to tc->start. 68 | * @note Color frame (CF), binary group flags (BGF) and biphase mark polarity 69 | * correction (PC) bits are set to zero. 70 | */ 71 | uint32_t av_timecode_get_smpte_from_framenum(const AVTimecode *tc, int framenum); 72 | 73 | /** 74 | * Load timecode string in buf. 75 | * 76 | * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long 77 | * @param tc timecode data correctly initialized 78 | * @param framenum frame number 79 | * @return the buf parameter 80 | * 81 | * @note Timecode representation can be a negative timecode and have more than 82 | * 24 hours, but will only be honored if the flags are correctly set. 83 | * @note The frame number is relative to tc->start. 84 | */ 85 | char *av_timecode_make_string(const AVTimecode *tc, char *buf, int framenum); 86 | 87 | /** 88 | * Get the timecode string from the SMPTE timecode format. 89 | * 90 | * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long 91 | * @param tcsmpte the 32-bit SMPTE timecode 92 | * @param prevent_df prevent the use of a drop flag when it is known the DF bit 93 | * is arbitrary 94 | * @return the buf parameter 95 | */ 96 | char *av_timecode_make_smpte_tc_string(char *buf, uint32_t tcsmpte, int prevent_df); 97 | 98 | /** 99 | * Get the timecode string from the 25-bit timecode format (MPEG GOP format). 100 | * 101 | * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long 102 | * @param tc25bit the 25-bits timecode 103 | * @return the buf parameter 104 | */ 105 | char *av_timecode_make_mpeg_tc_string(char *buf, uint32_t tc25bit); 106 | 107 | /** 108 | * Init a timecode struct with the passed parameters. 109 | * 110 | * @param log_ctx a pointer to an arbitrary struct of which the first field 111 | * is a pointer to an AVClass struct (used for av_log) 112 | * @param tc pointer to an allocated AVTimecode 113 | * @param rate frame rate in rational form 114 | * @param flags miscellaneous flags such as drop frame, +24 hours, ... 115 | * (see AVTimecodeFlag) 116 | * @param frame_start the first frame number 117 | * @return 0 on success, AVERROR otherwise 118 | */ 119 | int av_timecode_init(AVTimecode *tc, AVRational rate, int flags, int frame_start, void *log_ctx); 120 | 121 | /** 122 | * Parse timecode representation (hh:mm:ss[:;.]ff). 123 | * 124 | * @param log_ctx a pointer to an arbitrary struct of which the first field is a 125 | * pointer to an AVClass struct (used for av_log). 126 | * @param tc pointer to an allocated AVTimecode 127 | * @param rate frame rate in rational form 128 | * @param str timecode string which will determine the frame start 129 | * @return 0 on success, AVERROR otherwise 130 | */ 131 | int av_timecode_init_from_string(AVTimecode *tc, AVRational rate, const char *str, void *log_ctx); 132 | 133 | /** 134 | * Check if the timecode feature is available for the given frame rate 135 | * 136 | * @return 0 if supported, <0 otherwise 137 | */ 138 | int av_timecode_check_frame_rate(AVRational rate); 139 | 140 | #endif /* AVUTIL_TIMECODE_H */ 141 | -------------------------------------------------------------------------------- /universal/include/libavutil/mathematics.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2005-2012 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_MATHEMATICS_H 22 | #define AVUTIL_MATHEMATICS_H 23 | 24 | #include 25 | #include 26 | #include "attributes.h" 27 | #include "rational.h" 28 | #include "intfloat.h" 29 | 30 | #ifndef M_E 31 | #define M_E 2.7182818284590452354 /* e */ 32 | #endif 33 | #ifndef M_LN2 34 | #define M_LN2 0.69314718055994530942 /* log_e 2 */ 35 | #endif 36 | #ifndef M_LN10 37 | #define M_LN10 2.30258509299404568402 /* log_e 10 */ 38 | #endif 39 | #ifndef M_LOG2_10 40 | #define M_LOG2_10 3.32192809488736234787 /* log_2 10 */ 41 | #endif 42 | #ifndef M_PHI 43 | #define M_PHI 1.61803398874989484820 /* phi / golden ratio */ 44 | #endif 45 | #ifndef M_PI 46 | #define M_PI 3.14159265358979323846 /* pi */ 47 | #endif 48 | #ifndef M_PI_2 49 | #define M_PI_2 1.57079632679489661923 /* pi/2 */ 50 | #endif 51 | #ifndef M_SQRT1_2 52 | #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ 53 | #endif 54 | #ifndef M_SQRT2 55 | #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ 56 | #endif 57 | #ifndef NAN 58 | #define NAN av_int2float(0x7fc00000) 59 | #endif 60 | #ifndef INFINITY 61 | #define INFINITY av_int2float(0x7f800000) 62 | #endif 63 | 64 | /** 65 | * @addtogroup lavu_math 66 | * @{ 67 | */ 68 | 69 | 70 | enum AVRounding { 71 | AV_ROUND_ZERO = 0, ///< Round toward zero. 72 | AV_ROUND_INF = 1, ///< Round away from zero. 73 | AV_ROUND_DOWN = 2, ///< Round toward -infinity. 74 | AV_ROUND_UP = 3, ///< Round toward +infinity. 75 | AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero. 76 | AV_ROUND_PASS_MINMAX = 8192, ///< Flag to pass INT64_MIN/MAX through instead of rescaling, this avoids special cases for AV_NOPTS_VALUE 77 | }; 78 | 79 | /** 80 | * Return the greatest common divisor of a and b. 81 | * If both a and b are 0 or either or both are <0 then behavior is 82 | * undefined. 83 | */ 84 | int64_t av_const av_gcd(int64_t a, int64_t b); 85 | 86 | /** 87 | * Rescale a 64-bit integer with rounding to nearest. 88 | * A simple a*b/c isn't possible as it can overflow. 89 | */ 90 | int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const; 91 | 92 | /** 93 | * Rescale a 64-bit integer with specified rounding. 94 | * A simple a*b/c isn't possible as it can overflow. 95 | * 96 | * @return rescaled value a, or if AV_ROUND_PASS_MINMAX is set and a is 97 | * INT64_MIN or INT64_MAX then a is passed through unchanged. 98 | */ 99 | int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding) av_const; 100 | 101 | /** 102 | * Rescale a 64-bit integer by 2 rational numbers. 103 | */ 104 | int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const; 105 | 106 | /** 107 | * Rescale a 64-bit integer by 2 rational numbers with specified rounding. 108 | * 109 | * @return rescaled value a, or if AV_ROUND_PASS_MINMAX is set and a is 110 | * INT64_MIN or INT64_MAX then a is passed through unchanged. 111 | */ 112 | int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq, 113 | enum AVRounding) av_const; 114 | 115 | /** 116 | * Compare 2 timestamps each in its own timebases. 117 | * The result of the function is undefined if one of the timestamps 118 | * is outside the int64_t range when represented in the others timebase. 119 | * @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 120 | */ 121 | int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b); 122 | 123 | /** 124 | * Compare 2 integers modulo mod. 125 | * That is we compare integers a and b for which only the least 126 | * significant log2(mod) bits are known. 127 | * 128 | * @param mod must be a power of 2 129 | * @return a negative value if a is smaller than b 130 | * a positive value if a is greater than b 131 | * 0 if a equals b 132 | */ 133 | int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod); 134 | 135 | /** 136 | * Rescale a timestamp while preserving known durations. 137 | * 138 | * @param in_ts Input timestamp 139 | * @param in_tb Input timebase 140 | * @param fs_tb Duration and *last timebase 141 | * @param duration duration till the next call 142 | * @param out_tb Output timebase 143 | */ 144 | int64_t av_rescale_delta(AVRational in_tb, int64_t in_ts, AVRational fs_tb, int duration, int64_t *last, AVRational out_tb); 145 | 146 | /** 147 | * Add a value to a timestamp. 148 | * 149 | * This function gurantees that when the same value is repeatly added that 150 | * no accumulation of rounding errors occurs. 151 | * 152 | * @param ts Input timestamp 153 | * @param ts_tb Input timestamp timebase 154 | * @param inc value to add to ts 155 | * @param inc_tb inc timebase 156 | */ 157 | int64_t av_add_stable(AVRational ts_tb, int64_t ts, AVRational inc_tb, int64_t inc); 158 | 159 | 160 | /** 161 | * @} 162 | */ 163 | 164 | #endif /* AVUTIL_MATHEMATICS_H */ 165 | -------------------------------------------------------------------------------- /universal/include/libavcodec/xvmc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2003 Ivan Kalvachev 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVCODEC_XVMC_H 22 | #define AVCODEC_XVMC_H 23 | 24 | /** 25 | * @file 26 | * @ingroup lavc_codec_hwaccel_xvmc 27 | * Public libavcodec XvMC header. 28 | */ 29 | 30 | #include 31 | 32 | #include "libavutil/attributes.h" 33 | #include "version.h" 34 | #include "avcodec.h" 35 | 36 | /** 37 | * @defgroup lavc_codec_hwaccel_xvmc XvMC 38 | * @ingroup lavc_codec_hwaccel 39 | * 40 | * @{ 41 | */ 42 | 43 | #define AV_XVMC_ID 0x1DC711C0 /**< special value to ensure that regular pixel routines haven't corrupted the struct 44 | the number is 1337 speak for the letters IDCT MCo (motion compensation) */ 45 | 46 | attribute_deprecated struct xvmc_pix_fmt { 47 | /** The field contains the special constant value AV_XVMC_ID. 48 | It is used as a test that the application correctly uses the API, 49 | and that there is no corruption caused by pixel routines. 50 | - application - set during initialization 51 | - libavcodec - unchanged 52 | */ 53 | int xvmc_id; 54 | 55 | /** Pointer to the block array allocated by XvMCCreateBlocks(). 56 | The array has to be freed by XvMCDestroyBlocks(). 57 | Each group of 64 values represents one data block of differential 58 | pixel information (in MoCo mode) or coefficients for IDCT. 59 | - application - set the pointer during initialization 60 | - libavcodec - fills coefficients/pixel data into the array 61 | */ 62 | short* data_blocks; 63 | 64 | /** Pointer to the macroblock description array allocated by 65 | XvMCCreateMacroBlocks() and freed by XvMCDestroyMacroBlocks(). 66 | - application - set the pointer during initialization 67 | - libavcodec - fills description data into the array 68 | */ 69 | XvMCMacroBlock* mv_blocks; 70 | 71 | /** Number of macroblock descriptions that can be stored in the mv_blocks 72 | array. 73 | - application - set during initialization 74 | - libavcodec - unchanged 75 | */ 76 | int allocated_mv_blocks; 77 | 78 | /** Number of blocks that can be stored at once in the data_blocks array. 79 | - application - set during initialization 80 | - libavcodec - unchanged 81 | */ 82 | int allocated_data_blocks; 83 | 84 | /** Indicate that the hardware would interpret data_blocks as IDCT 85 | coefficients and perform IDCT on them. 86 | - application - set during initialization 87 | - libavcodec - unchanged 88 | */ 89 | int idct; 90 | 91 | /** In MoCo mode it indicates that intra macroblocks are assumed to be in 92 | unsigned format; same as the XVMC_INTRA_UNSIGNED flag. 93 | - application - set during initialization 94 | - libavcodec - unchanged 95 | */ 96 | int unsigned_intra; 97 | 98 | /** Pointer to the surface allocated by XvMCCreateSurface(). 99 | It has to be freed by XvMCDestroySurface() on application exit. 100 | It identifies the frame and its state on the video hardware. 101 | - application - set during initialization 102 | - libavcodec - unchanged 103 | */ 104 | XvMCSurface* p_surface; 105 | 106 | /** Set by the decoder before calling ff_draw_horiz_band(), 107 | needed by the XvMCRenderSurface function. */ 108 | //@{ 109 | /** Pointer to the surface used as past reference 110 | - application - unchanged 111 | - libavcodec - set 112 | */ 113 | XvMCSurface* p_past_surface; 114 | 115 | /** Pointer to the surface used as future reference 116 | - application - unchanged 117 | - libavcodec - set 118 | */ 119 | XvMCSurface* p_future_surface; 120 | 121 | /** top/bottom field or frame 122 | - application - unchanged 123 | - libavcodec - set 124 | */ 125 | unsigned int picture_structure; 126 | 127 | /** XVMC_SECOND_FIELD - 1st or 2nd field in the sequence 128 | - application - unchanged 129 | - libavcodec - set 130 | */ 131 | unsigned int flags; 132 | //}@ 133 | 134 | /** Number of macroblock descriptions in the mv_blocks array 135 | that have already been passed to the hardware. 136 | - application - zeroes it on get_buffer(). 137 | A successful ff_draw_horiz_band() may increment it 138 | with filled_mb_block_num or zero both. 139 | - libavcodec - unchanged 140 | */ 141 | int start_mv_blocks_num; 142 | 143 | /** Number of new macroblock descriptions in the mv_blocks array (after 144 | start_mv_blocks_num) that are filled by libavcodec and have to be 145 | passed to the hardware. 146 | - application - zeroes it on get_buffer() or after successful 147 | ff_draw_horiz_band(). 148 | - libavcodec - increment with one of each stored MB 149 | */ 150 | int filled_mv_blocks_num; 151 | 152 | /** Number of the next free data block; one data block consists of 153 | 64 short values in the data_blocks array. 154 | All blocks before this one have already been claimed by placing their 155 | position into the corresponding block description structure field, 156 | that are part of the mv_blocks array. 157 | - application - zeroes it on get_buffer(). 158 | A successful ff_draw_horiz_band() may zero it together 159 | with start_mb_blocks_num. 160 | - libavcodec - each decoded macroblock increases it by the number 161 | of coded blocks it contains. 162 | */ 163 | int next_free_data_block_num; 164 | }; 165 | 166 | /** 167 | * @} 168 | */ 169 | 170 | #endif /* AVCODEC_XVMC_H */ 171 | -------------------------------------------------------------------------------- /universal/include/libavcodec/vdpau.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The Video Decode and Presentation API for UNIX (VDPAU) is used for 3 | * hardware-accelerated decoding of MPEG-1/2, H.264 and VC-1. 4 | * 5 | * Copyright (C) 2008 NVIDIA 6 | * 7 | * This file is part of FFmpeg. 8 | * 9 | * FFmpeg is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * FFmpeg is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public 20 | * License along with FFmpeg; if not, write to the Free Software 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 22 | */ 23 | 24 | #ifndef AVCODEC_VDPAU_H 25 | #define AVCODEC_VDPAU_H 26 | 27 | /** 28 | * @file 29 | * @ingroup lavc_codec_hwaccel_vdpau 30 | * Public libavcodec VDPAU header. 31 | */ 32 | 33 | 34 | /** 35 | * @defgroup lavc_codec_hwaccel_vdpau VDPAU Decoder and Renderer 36 | * @ingroup lavc_codec_hwaccel 37 | * 38 | * VDPAU hardware acceleration has two modules 39 | * - VDPAU decoding 40 | * - VDPAU presentation 41 | * 42 | * The VDPAU decoding module parses all headers using FFmpeg 43 | * parsing mechanisms and uses VDPAU for the actual decoding. 44 | * 45 | * As per the current implementation, the actual decoding 46 | * and rendering (API calls) are done as part of the VDPAU 47 | * presentation (vo_vdpau.c) module. 48 | * 49 | * @{ 50 | */ 51 | 52 | #include 53 | #include 54 | #include "libavutil/avconfig.h" 55 | #include "libavutil/attributes.h" 56 | 57 | #include "avcodec.h" 58 | #include "version.h" 59 | 60 | #if FF_API_BUFS_VDPAU 61 | union AVVDPAUPictureInfo { 62 | VdpPictureInfoH264 h264; 63 | VdpPictureInfoMPEG1Or2 mpeg; 64 | VdpPictureInfoVC1 vc1; 65 | VdpPictureInfoMPEG4Part2 mpeg4; 66 | }; 67 | #endif 68 | 69 | struct AVCodecContext; 70 | struct AVFrame; 71 | 72 | typedef int (*AVVDPAU_Render2)(struct AVCodecContext *, struct AVFrame *, 73 | const VdpPictureInfo *, uint32_t, 74 | const VdpBitstreamBuffer *); 75 | 76 | /** 77 | * This structure is used to share data between the libavcodec library and 78 | * the client video application. 79 | * The user shall allocate the structure via the av_alloc_vdpau_hwaccel 80 | * function and make it available as 81 | * AVCodecContext.hwaccel_context. Members can be set by the user once 82 | * during initialization or through each AVCodecContext.get_buffer() 83 | * function call. In any case, they must be valid prior to calling 84 | * decoding functions. 85 | * 86 | * The size of this structure is not a part of the public ABI and must not 87 | * be used outside of libavcodec. Use av_vdpau_alloc_context() to allocate an 88 | * AVVDPAUContext. 89 | */ 90 | typedef struct AVVDPAUContext { 91 | /** 92 | * VDPAU decoder handle 93 | * 94 | * Set by user. 95 | */ 96 | VdpDecoder decoder; 97 | 98 | /** 99 | * VDPAU decoder render callback 100 | * 101 | * Set by the user. 102 | */ 103 | VdpDecoderRender *render; 104 | 105 | #if FF_API_BUFS_VDPAU 106 | /** 107 | * VDPAU picture information 108 | * 109 | * Set by libavcodec. 110 | */ 111 | attribute_deprecated 112 | union AVVDPAUPictureInfo info; 113 | 114 | /** 115 | * Allocated size of the bitstream_buffers table. 116 | * 117 | * Set by libavcodec. 118 | */ 119 | attribute_deprecated 120 | int bitstream_buffers_allocated; 121 | 122 | /** 123 | * Useful bitstream buffers in the bitstream buffers table. 124 | * 125 | * Set by libavcodec. 126 | */ 127 | attribute_deprecated 128 | int bitstream_buffers_used; 129 | 130 | /** 131 | * Table of bitstream buffers. 132 | * The user is responsible for freeing this buffer using av_freep(). 133 | * 134 | * Set by libavcodec. 135 | */ 136 | attribute_deprecated 137 | VdpBitstreamBuffer *bitstream_buffers; 138 | #endif 139 | AVVDPAU_Render2 render2; 140 | } AVVDPAUContext; 141 | 142 | /** 143 | * @brief allocation function for AVVDPAUContext 144 | * 145 | * Allows extending the struct without breaking API/ABI 146 | */ 147 | AVVDPAUContext *av_alloc_vdpaucontext(void); 148 | 149 | AVVDPAU_Render2 av_vdpau_hwaccel_get_render2(const AVVDPAUContext *); 150 | void av_vdpau_hwaccel_set_render2(AVVDPAUContext *, AVVDPAU_Render2); 151 | 152 | /** 153 | * Allocate an AVVDPAUContext. 154 | * 155 | * @return Newly-allocated AVVDPAUContext or NULL on failure. 156 | */ 157 | AVVDPAUContext *av_vdpau_alloc_context(void); 158 | 159 | /** 160 | * Get a decoder profile that should be used for initializing a VDPAU decoder. 161 | * Should be called from the AVCodecContext.get_format() callback. 162 | * 163 | * @param avctx the codec context being used for decoding the stream 164 | * @param profile a pointer into which the result will be written on success. 165 | * The contents of profile are undefined if this function returns 166 | * an error. 167 | * 168 | * @return 0 on success (non-negative), a negative AVERROR on failure. 169 | */ 170 | int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile); 171 | 172 | #if FF_API_CAP_VDPAU 173 | /** @brief The videoSurface is used for rendering. */ 174 | #define FF_VDPAU_STATE_USED_FOR_RENDER 1 175 | 176 | /** 177 | * @brief The videoSurface is needed for reference/prediction. 178 | * The codec manipulates this. 179 | */ 180 | #define FF_VDPAU_STATE_USED_FOR_REFERENCE 2 181 | 182 | /** 183 | * @brief This structure is used as a callback between the FFmpeg 184 | * decoder (vd_) and presentation (vo_) module. 185 | * This is used for defining a video frame containing surface, 186 | * picture parameter, bitstream information etc which are passed 187 | * between the FFmpeg decoder and its clients. 188 | */ 189 | struct vdpau_render_state { 190 | VdpVideoSurface surface; ///< Used as rendered surface, never changed. 191 | 192 | int state; ///< Holds FF_VDPAU_STATE_* values. 193 | 194 | #if AV_HAVE_INCOMPATIBLE_LIBAV_ABI 195 | /** picture parameter information for all supported codecs */ 196 | union AVVDPAUPictureInfo info; 197 | #endif 198 | 199 | /** Describe size/location of the compressed video data. 200 | Set to 0 when freeing bitstream_buffers. */ 201 | int bitstream_buffers_allocated; 202 | int bitstream_buffers_used; 203 | /** The user is responsible for freeing this buffer using av_freep(). */ 204 | VdpBitstreamBuffer *bitstream_buffers; 205 | 206 | #if !AV_HAVE_INCOMPATIBLE_LIBAV_ABI 207 | /** picture parameter information for all supported codecs */ 208 | union AVVDPAUPictureInfo info; 209 | #endif 210 | }; 211 | #endif 212 | 213 | /* @}*/ 214 | 215 | #endif /* AVCODEC_VDPAU_H */ 216 | -------------------------------------------------------------------------------- /universal/include/libavutil/dict.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of FFmpeg. 4 | * 5 | * FFmpeg is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * FFmpeg is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with FFmpeg; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | /** 21 | * @file 22 | * Public dictionary API. 23 | * @deprecated 24 | * AVDictionary is provided for compatibility with libav. It is both in 25 | * implementation as well as API inefficient. It does not scale and is 26 | * extremely slow with large dictionaries. 27 | * It is recommended that new code uses our tree container from tree.c/h 28 | * where applicable, which uses AVL trees to achieve O(log n) performance. 29 | */ 30 | 31 | #ifndef AVUTIL_DICT_H 32 | #define AVUTIL_DICT_H 33 | 34 | /** 35 | * @addtogroup lavu_dict AVDictionary 36 | * @ingroup lavu_data 37 | * 38 | * @brief Simple key:value store 39 | * 40 | * @{ 41 | * Dictionaries are used for storing key:value pairs. To create 42 | * an AVDictionary, simply pass an address of a NULL pointer to 43 | * av_dict_set(). NULL can be used as an empty dictionary wherever 44 | * a pointer to an AVDictionary is required. 45 | * Use av_dict_get() to retrieve an entry or iterate over all 46 | * entries and finally av_dict_free() to free the dictionary 47 | * and all its contents. 48 | * 49 | @code 50 | AVDictionary *d = NULL; // "create" an empty dictionary 51 | AVDictionaryEntry *t = NULL; 52 | 53 | av_dict_set(&d, "foo", "bar", 0); // add an entry 54 | 55 | char *k = av_strdup("key"); // if your strings are already allocated, 56 | char *v = av_strdup("value"); // you can avoid copying them like this 57 | av_dict_set(&d, k, v, AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL); 58 | 59 | while (t = av_dict_get(d, "", t, AV_DICT_IGNORE_SUFFIX)) { 60 | <....> // iterate over all entries in d 61 | } 62 | av_dict_free(&d); 63 | @endcode 64 | * 65 | */ 66 | 67 | #define AV_DICT_MATCH_CASE 1 /**< Only get an entry with exact-case key match. Only relevant in av_dict_get(). */ 68 | #define AV_DICT_IGNORE_SUFFIX 2 /**< Return first entry in a dictionary whose first part corresponds to the search key, 69 | ignoring the suffix of the found key string. Only relevant in av_dict_get(). */ 70 | #define AV_DICT_DONT_STRDUP_KEY 4 /**< Take ownership of a key that's been 71 | allocated with av_malloc() or another memory allocation function. */ 72 | #define AV_DICT_DONT_STRDUP_VAL 8 /**< Take ownership of a value that's been 73 | allocated with av_malloc() or another memory allocation function. */ 74 | #define AV_DICT_DONT_OVERWRITE 16 ///< Don't overwrite existing entries. 75 | #define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no 76 | delimiter is added, the strings are simply concatenated. */ 77 | 78 | typedef struct AVDictionaryEntry { 79 | char *key; 80 | char *value; 81 | } AVDictionaryEntry; 82 | 83 | typedef struct AVDictionary AVDictionary; 84 | 85 | /** 86 | * Get a dictionary entry with matching key. 87 | * 88 | * The returned entry key or value must not be changed, or it will 89 | * cause undefined behavior. 90 | * 91 | * To iterate through all the dictionary entries, you can set the matching key 92 | * to the null string "" and set the AV_DICT_IGNORE_SUFFIX flag. 93 | * 94 | * @param prev Set to the previous matching element to find the next. 95 | * If set to NULL the first matching element is returned. 96 | * @param key matching key 97 | * @param flags a collection of AV_DICT_* flags controlling how the entry is retrieved 98 | * @return found entry or NULL in case no matching entry was found in the dictionary 99 | */ 100 | AVDictionaryEntry * 101 | av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags); 102 | 103 | /** 104 | * Get number of entries in dictionary. 105 | * 106 | * @param m dictionary 107 | * @return number of entries in dictionary 108 | */ 109 | int av_dict_count(const AVDictionary *m); 110 | 111 | /** 112 | * Set the given entry in *pm, overwriting an existing entry. 113 | * 114 | * @param pm pointer to a pointer to a dictionary struct. If *pm is NULL 115 | * a dictionary struct is allocated and put in *pm. 116 | * @param key entry key to add to *pm (will be av_strduped depending on flags) 117 | * @param value entry value to add to *pm (will be av_strduped depending on flags). 118 | * Passing a NULL value will cause an existing entry to be deleted. 119 | * @return >= 0 on success otherwise an error code <0 120 | */ 121 | int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags); 122 | 123 | /** 124 | * Parse the key/value pairs list and add the parsed entries to a dictionary. 125 | * 126 | * In case of failure, all the successfully set entries are stored in 127 | * *pm. You may need to manually free the created dictionary. 128 | * 129 | * @param key_val_sep a 0-terminated list of characters used to separate 130 | * key from value 131 | * @param pairs_sep a 0-terminated list of characters used to separate 132 | * two pairs from each other 133 | * @param flags flags to use when adding to dictionary. 134 | * AV_DICT_DONT_STRDUP_KEY and AV_DICT_DONT_STRDUP_VAL 135 | * are ignored since the key/value tokens will always 136 | * be duplicated. 137 | * @return 0 on success, negative AVERROR code on failure 138 | */ 139 | int av_dict_parse_string(AVDictionary **pm, const char *str, 140 | const char *key_val_sep, const char *pairs_sep, 141 | int flags); 142 | 143 | /** 144 | * Copy entries from one AVDictionary struct into another. 145 | * @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL, 146 | * this function will allocate a struct for you and put it in *dst 147 | * @param src pointer to source AVDictionary struct 148 | * @param flags flags to use when setting entries in *dst 149 | * @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag 150 | */ 151 | void av_dict_copy(AVDictionary **dst, AVDictionary *src, int flags); 152 | 153 | /** 154 | * Free all the memory allocated for an AVDictionary struct 155 | * and all keys and values. 156 | */ 157 | void av_dict_free(AVDictionary **m); 158 | 159 | /** 160 | * @} 161 | */ 162 | 163 | #endif /* AVUTIL_DICT_H */ 164 | -------------------------------------------------------------------------------- /universal/include/libavutil/parseutils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_PARSEUTILS_H 20 | #define AVUTIL_PARSEUTILS_H 21 | 22 | #include 23 | 24 | #include "rational.h" 25 | 26 | /** 27 | * @file 28 | * misc parsing utilities 29 | */ 30 | 31 | /** 32 | * Parse str and store the parsed ratio in q. 33 | * 34 | * Note that a ratio with infinite (1/0) or negative value is 35 | * considered valid, so you should check on the returned value if you 36 | * want to exclude those values. 37 | * 38 | * The undefined value can be expressed using the "0:0" string. 39 | * 40 | * @param[in,out] q pointer to the AVRational which will contain the ratio 41 | * @param[in] str the string to parse: it has to be a string in the format 42 | * num:den, a float number or an expression 43 | * @param[in] max the maximum allowed numerator and denominator 44 | * @param[in] log_offset log level offset which is applied to the log 45 | * level of log_ctx 46 | * @param[in] log_ctx parent logging context 47 | * @return >= 0 on success, a negative error code otherwise 48 | */ 49 | int av_parse_ratio(AVRational *q, const char *str, int max, 50 | int log_offset, void *log_ctx); 51 | 52 | #define av_parse_ratio_quiet(rate, str, max) \ 53 | av_parse_ratio(rate, str, max, AV_LOG_MAX_OFFSET, NULL) 54 | 55 | /** 56 | * Parse str and put in width_ptr and height_ptr the detected values. 57 | * 58 | * @param[in,out] width_ptr pointer to the variable which will contain the detected 59 | * width value 60 | * @param[in,out] height_ptr pointer to the variable which will contain the detected 61 | * height value 62 | * @param[in] str the string to parse: it has to be a string in the format 63 | * width x height or a valid video size abbreviation. 64 | * @return >= 0 on success, a negative error code otherwise 65 | */ 66 | int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str); 67 | 68 | /** 69 | * Parse str and store the detected values in *rate. 70 | * 71 | * @param[in,out] rate pointer to the AVRational which will contain the detected 72 | * frame rate 73 | * @param[in] str the string to parse: it has to be a string in the format 74 | * rate_num / rate_den, a float number or a valid video rate abbreviation 75 | * @return >= 0 on success, a negative error code otherwise 76 | */ 77 | int av_parse_video_rate(AVRational *rate, const char *str); 78 | 79 | /** 80 | * Put the RGBA values that correspond to color_string in rgba_color. 81 | * 82 | * @param color_string a string specifying a color. It can be the name of 83 | * a color (case insensitive match) or a [0x|#]RRGGBB[AA] sequence, 84 | * possibly followed by "@" and a string representing the alpha 85 | * component. 86 | * The alpha component may be a string composed by "0x" followed by an 87 | * hexadecimal number or a decimal number between 0.0 and 1.0, which 88 | * represents the opacity value (0x00/0.0 means completely transparent, 89 | * 0xff/1.0 completely opaque). 90 | * If the alpha component is not specified then 0xff is assumed. 91 | * The string "random" will result in a random color. 92 | * @param slen length of the initial part of color_string containing the 93 | * color. It can be set to -1 if color_string is a null terminated string 94 | * containing nothing else than the color. 95 | * @return >= 0 in case of success, a negative value in case of 96 | * failure (for example if color_string cannot be parsed). 97 | */ 98 | int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, 99 | void *log_ctx); 100 | 101 | /** 102 | * Get the name of a color from the internal table of hard-coded named 103 | * colors. 104 | * 105 | * This function is meant to enumerate the color names recognized by 106 | * av_parse_color(). 107 | * 108 | * @param color_idx index of the requested color, starting from 0 109 | * @param rgbp if not NULL, will point to a 3-elements array with the color value in RGB 110 | * @return the color name string or NULL if color_idx is not in the array 111 | */ 112 | const char *av_get_known_color_name(int color_idx, const uint8_t **rgb); 113 | 114 | /** 115 | * Parse timestr and return in *time a corresponding number of 116 | * microseconds. 117 | * 118 | * @param timeval puts here the number of microseconds corresponding 119 | * to the string in timestr. If the string represents a duration, it 120 | * is the number of microseconds contained in the time interval. If 121 | * the string is a date, is the number of microseconds since 1st of 122 | * January, 1970 up to the time of the parsed date. If timestr cannot 123 | * be successfully parsed, set *time to INT64_MIN. 124 | 125 | * @param timestr a string representing a date or a duration. 126 | * - If a date the syntax is: 127 | * @code 128 | * [{YYYY-MM-DD|YYYYMMDD}[T|t| ]]{{HH:MM:SS[.m...]]]}|{HHMMSS[.m...]]]}}[Z] 129 | * now 130 | * @endcode 131 | * If the value is "now" it takes the current time. 132 | * Time is local time unless Z is appended, in which case it is 133 | * interpreted as UTC. 134 | * If the year-month-day part is not specified it takes the current 135 | * year-month-day. 136 | * - If a duration the syntax is: 137 | * @code 138 | * [-][HH:]MM:SS[.m...] 139 | * [-]S+[.m...] 140 | * @endcode 141 | * @param duration flag which tells how to interpret timestr, if not 142 | * zero timestr is interpreted as a duration, otherwise as a date 143 | * @return >= 0 in case of success, a negative value corresponding to an 144 | * AVERROR code otherwise 145 | */ 146 | int av_parse_time(int64_t *timeval, const char *timestr, int duration); 147 | 148 | /** 149 | * Parse the input string p according to the format string fmt and 150 | * store its results in the structure dt. 151 | * This implementation supports only a subset of the formats supported 152 | * by the standard strptime(). 153 | * 154 | * In particular it actually supports the parameters: 155 | * - %H: the hour as a decimal number, using a 24-hour clock, in the 156 | * range '00' through '23' 157 | * - %J: hours as a decimal number, in the range '0' through INT_MAX 158 | * - %M: the minute as a decimal number, using a 24-hour clock, in the 159 | * range '00' through '59' 160 | * - %S: the second as a decimal number, using a 24-hour clock, in the 161 | * range '00' through '59' 162 | * - %Y: the year as a decimal number, using the Gregorian calendar 163 | * - %m: the month as a decimal number, in the range '1' through '12' 164 | * - %d: the day of the month as a decimal number, in the range '1' 165 | * through '31' 166 | * - %%: a literal '%' 167 | * 168 | * @return a pointer to the first character not processed in this 169 | * function call, or NULL in case the function fails to match all of 170 | * the fmt string and therefore an error occurred 171 | */ 172 | char *av_small_strptime(const char *p, const char *fmt, struct tm *dt); 173 | 174 | /** 175 | * Attempt to find a specific tag in a URL. 176 | * 177 | * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done. 178 | * Return 1 if found. 179 | */ 180 | int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info); 181 | 182 | /** 183 | * Convert the decomposed UTC time in tm to a time_t value. 184 | */ 185 | time_t av_timegm(struct tm *tm); 186 | 187 | #endif /* AVUTIL_PARSEUTILS_H */ 188 | -------------------------------------------------------------------------------- /universal/include/libavutil/bprint.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012 Nicolas George 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_BPRINT_H 22 | #define AVUTIL_BPRINT_H 23 | 24 | #include 25 | 26 | #include "attributes.h" 27 | #include "avstring.h" 28 | 29 | /** 30 | * Define a structure with extra padding to a fixed size 31 | * This helps ensuring binary compatibility with future versions. 32 | */ 33 | #define FF_PAD_STRUCTURE(size, ...) \ 34 | __VA_ARGS__ \ 35 | char reserved_padding[size - sizeof(struct { __VA_ARGS__ })]; 36 | 37 | /** 38 | * Buffer to print data progressively 39 | * 40 | * The string buffer grows as necessary and is always 0-terminated. 41 | * The content of the string is never accessed, and thus is 42 | * encoding-agnostic and can even hold binary data. 43 | * 44 | * Small buffers are kept in the structure itself, and thus require no 45 | * memory allocation at all (unless the contents of the buffer is needed 46 | * after the structure goes out of scope). This is almost as lightweight as 47 | * declaring a local "char buf[512]". 48 | * 49 | * The length of the string can go beyond the allocated size: the buffer is 50 | * then truncated, but the functions still keep account of the actual total 51 | * length. 52 | * 53 | * In other words, buf->len can be greater than buf->size and records the 54 | * total length of what would have been to the buffer if there had been 55 | * enough memory. 56 | * 57 | * Append operations do not need to be tested for failure: if a memory 58 | * allocation fails, data stop being appended to the buffer, but the length 59 | * is still updated. This situation can be tested with 60 | * av_bprint_is_complete(). 61 | * 62 | * The size_max field determines several possible behaviours: 63 | * 64 | * size_max = -1 (= UINT_MAX) or any large value will let the buffer be 65 | * reallocated as necessary, with an amortized linear cost. 66 | * 67 | * size_max = 0 prevents writing anything to the buffer: only the total 68 | * length is computed. The write operations can then possibly be repeated in 69 | * a buffer with exactly the necessary size 70 | * (using size_init = size_max = len + 1). 71 | * 72 | * size_max = 1 is automatically replaced by the exact size available in the 73 | * structure itself, thus ensuring no dynamic memory allocation. The 74 | * internal buffer is large enough to hold a reasonable paragraph of text, 75 | * such as the current paragraph. 76 | */ 77 | typedef struct AVBPrint { 78 | FF_PAD_STRUCTURE(1024, 79 | char *str; /**< string so far */ 80 | unsigned len; /**< length so far */ 81 | unsigned size; /**< allocated memory */ 82 | unsigned size_max; /**< maximum allocated memory */ 83 | char reserved_internal_buffer[1]; 84 | ) 85 | } AVBPrint; 86 | 87 | /** 88 | * Convenience macros for special values for av_bprint_init() size_max 89 | * parameter. 90 | */ 91 | #define AV_BPRINT_SIZE_UNLIMITED ((unsigned)-1) 92 | #define AV_BPRINT_SIZE_AUTOMATIC 1 93 | #define AV_BPRINT_SIZE_COUNT_ONLY 0 94 | 95 | /** 96 | * Init a print buffer. 97 | * 98 | * @param buf buffer to init 99 | * @param size_init initial size (including the final 0) 100 | * @param size_max maximum size; 101 | * 0 means do not write anything, just count the length; 102 | * 1 is replaced by the maximum value for automatic storage; 103 | * any large value means that the internal buffer will be 104 | * reallocated as needed up to that limit; -1 is converted to 105 | * UINT_MAX, the largest limit possible. 106 | * Check also AV_BPRINT_SIZE_* macros. 107 | */ 108 | void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max); 109 | 110 | /** 111 | * Init a print buffer using a pre-existing buffer. 112 | * 113 | * The buffer will not be reallocated. 114 | * 115 | * @param buf buffer structure to init 116 | * @param buffer byte buffer to use for the string data 117 | * @param size size of buffer 118 | */ 119 | void av_bprint_init_for_buffer(AVBPrint *buf, char *buffer, unsigned size); 120 | 121 | /** 122 | * Append a formatted string to a print buffer. 123 | */ 124 | void av_bprintf(AVBPrint *buf, const char *fmt, ...) av_printf_format(2, 3); 125 | 126 | /** 127 | * Append a formatted string to a print buffer. 128 | */ 129 | void av_vbprintf(AVBPrint *buf, const char *fmt, va_list vl_arg); 130 | 131 | /** 132 | * Append char c n times to a print buffer. 133 | */ 134 | void av_bprint_chars(AVBPrint *buf, char c, unsigned n); 135 | 136 | /** 137 | * Append data to a print buffer. 138 | * 139 | * param buf bprint buffer to use 140 | * param data pointer to data 141 | * param size size of data 142 | */ 143 | void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size); 144 | 145 | struct tm; 146 | /** 147 | * Append a formatted date and time to a print buffer. 148 | * 149 | * param buf bprint buffer to use 150 | * param fmt date and time format string, see strftime() 151 | * param tm broken-down time structure to translate 152 | * 153 | * @note due to poor design of the standard strftime function, it may 154 | * produce poor results if the format string expands to a very long text and 155 | * the bprint buffer is near the limit stated by the size_max option. 156 | */ 157 | void av_bprint_strftime(AVBPrint *buf, const char *fmt, const struct tm *tm); 158 | 159 | /** 160 | * Allocate bytes in the buffer for external use. 161 | * 162 | * @param[in] buf buffer structure 163 | * @param[in] size required size 164 | * @param[out] mem pointer to the memory area 165 | * @param[out] actual_size size of the memory area after allocation; 166 | * can be larger or smaller than size 167 | */ 168 | void av_bprint_get_buffer(AVBPrint *buf, unsigned size, 169 | unsigned char **mem, unsigned *actual_size); 170 | 171 | /** 172 | * Reset the string to "" but keep internal allocated data. 173 | */ 174 | void av_bprint_clear(AVBPrint *buf); 175 | 176 | /** 177 | * Test if the print buffer is complete (not truncated). 178 | * 179 | * It may have been truncated due to a memory allocation failure 180 | * or the size_max limit (compare size and size_max if necessary). 181 | */ 182 | static inline int av_bprint_is_complete(AVBPrint *buf) 183 | { 184 | return buf->len < buf->size; 185 | } 186 | 187 | /** 188 | * Finalize a print buffer. 189 | * 190 | * The print buffer can no longer be used afterwards, 191 | * but the len and size fields are still valid. 192 | * 193 | * @arg[out] ret_str if not NULL, used to return a permanent copy of the 194 | * buffer contents, or NULL if memory allocation fails; 195 | * if NULL, the buffer is discarded and freed 196 | * @return 0 for success or error code (probably AVERROR(ENOMEM)) 197 | */ 198 | int av_bprint_finalize(AVBPrint *buf, char **ret_str); 199 | 200 | /** 201 | * Escape the content in src and append it to dstbuf. 202 | * 203 | * @param dstbuf already inited destination bprint buffer 204 | * @param src string containing the text to escape 205 | * @param special_chars string containing the special characters which 206 | * need to be escaped, can be NULL 207 | * @param mode escape mode to employ, see AV_ESCAPE_MODE_* macros. 208 | * Any unknown value for mode will be considered equivalent to 209 | * AV_ESCAPE_MODE_BACKSLASH, but this behaviour can change without 210 | * notice. 211 | * @param flags flags which control how to escape, see AV_ESCAPE_FLAG_* macros 212 | */ 213 | void av_bprint_escape(AVBPrint *dstbuf, const char *src, const char *special_chars, 214 | enum AVEscapeMode mode, int flags); 215 | 216 | #endif /* AVUTIL_BPRINT_H */ 217 | -------------------------------------------------------------------------------- /universal/include/libavutil/imgutils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_IMGUTILS_H 20 | #define AVUTIL_IMGUTILS_H 21 | 22 | /** 23 | * @file 24 | * misc image utilities 25 | * 26 | * @addtogroup lavu_picture 27 | * @{ 28 | */ 29 | 30 | #include "avutil.h" 31 | #include "pixdesc.h" 32 | 33 | /** 34 | * Compute the max pixel step for each plane of an image with a 35 | * format described by pixdesc. 36 | * 37 | * The pixel step is the distance in bytes between the first byte of 38 | * the group of bytes which describe a pixel component and the first 39 | * byte of the successive group in the same plane for the same 40 | * component. 41 | * 42 | * @param max_pixsteps an array which is filled with the max pixel step 43 | * for each plane. Since a plane may contain different pixel 44 | * components, the computed max_pixsteps[plane] is relative to the 45 | * component in the plane with the max pixel step. 46 | * @param max_pixstep_comps an array which is filled with the component 47 | * for each plane which has the max pixel step. May be NULL. 48 | */ 49 | void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], 50 | const AVPixFmtDescriptor *pixdesc); 51 | 52 | /** 53 | * Compute the size of an image line with format pix_fmt and width 54 | * width for the plane plane. 55 | * 56 | * @return the computed size in bytes 57 | */ 58 | int av_image_get_linesize(enum AVPixelFormat pix_fmt, int width, int plane); 59 | 60 | /** 61 | * Fill plane linesizes for an image with pixel format pix_fmt and 62 | * width width. 63 | * 64 | * @param linesizes array to be filled with the linesize for each plane 65 | * @return >= 0 in case of success, a negative error code otherwise 66 | */ 67 | int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int width); 68 | 69 | /** 70 | * Fill plane data pointers for an image with pixel format pix_fmt and 71 | * height height. 72 | * 73 | * @param data pointers array to be filled with the pointer for each image plane 74 | * @param ptr the pointer to a buffer which will contain the image 75 | * @param linesizes the array containing the linesize for each 76 | * plane, should be filled by av_image_fill_linesizes() 77 | * @return the size in bytes required for the image buffer, a negative 78 | * error code in case of failure 79 | */ 80 | int av_image_fill_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, int height, 81 | uint8_t *ptr, const int linesizes[4]); 82 | 83 | /** 84 | * Allocate an image with size w and h and pixel format pix_fmt, and 85 | * fill pointers and linesizes accordingly. 86 | * The allocated image buffer has to be freed by using 87 | * av_freep(&pointers[0]). 88 | * 89 | * @param align the value to use for buffer size alignment 90 | * @return the size in bytes required for the image buffer, a negative 91 | * error code in case of failure 92 | */ 93 | int av_image_alloc(uint8_t *pointers[4], int linesizes[4], 94 | int w, int h, enum AVPixelFormat pix_fmt, int align); 95 | 96 | /** 97 | * Copy image plane from src to dst. 98 | * That is, copy "height" number of lines of "bytewidth" bytes each. 99 | * The first byte of each successive line is separated by *_linesize 100 | * bytes. 101 | * 102 | * bytewidth must be contained by both absolute values of dst_linesize 103 | * and src_linesize, otherwise the function behavior is undefined. 104 | * 105 | * @param dst_linesize linesize for the image plane in dst 106 | * @param src_linesize linesize for the image plane in src 107 | */ 108 | void av_image_copy_plane(uint8_t *dst, int dst_linesize, 109 | const uint8_t *src, int src_linesize, 110 | int bytewidth, int height); 111 | 112 | /** 113 | * Copy image in src_data to dst_data. 114 | * 115 | * @param dst_linesizes linesizes for the image in dst_data 116 | * @param src_linesizes linesizes for the image in src_data 117 | */ 118 | void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], 119 | const uint8_t *src_data[4], const int src_linesizes[4], 120 | enum AVPixelFormat pix_fmt, int width, int height); 121 | 122 | /** 123 | * Setup the data pointers and linesizes based on the specified image 124 | * parameters and the provided array. 125 | * 126 | * The fields of the given image are filled in by using the src 127 | * address which points to the image data buffer. Depending on the 128 | * specified pixel format, one or multiple image data pointers and 129 | * line sizes will be set. If a planar format is specified, several 130 | * pointers will be set pointing to the different picture planes and 131 | * the line sizes of the different planes will be stored in the 132 | * lines_sizes array. Call with src == NULL to get the required 133 | * size for the src buffer. 134 | * 135 | * To allocate the buffer and fill in the dst_data and dst_linesize in 136 | * one call, use av_image_alloc(). 137 | * 138 | * @param dst_data data pointers to be filled in 139 | * @param dst_linesizes linesizes for the image in dst_data to be filled in 140 | * @param src buffer which will contain or contains the actual image data, can be NULL 141 | * @param pix_fmt the pixel format of the image 142 | * @param width the width of the image in pixels 143 | * @param height the height of the image in pixels 144 | * @param align the value used in src for linesize alignment 145 | * @return the size in bytes required for src, a negative error code 146 | * in case of failure 147 | */ 148 | int av_image_fill_arrays(uint8_t *dst_data[4], int dst_linesize[4], 149 | const uint8_t *src, 150 | enum AVPixelFormat pix_fmt, int width, int height, int align); 151 | 152 | /** 153 | * Return the size in bytes of the amount of data required to store an 154 | * image with the given parameters. 155 | * 156 | * @param[in] align the assumed linesize alignment 157 | */ 158 | int av_image_get_buffer_size(enum AVPixelFormat pix_fmt, int width, int height, int align); 159 | 160 | /** 161 | * Copy image data from an image into a buffer. 162 | * 163 | * av_image_get_buffer_size() can be used to compute the required size 164 | * for the buffer to fill. 165 | * 166 | * @param dst a buffer into which picture data will be copied 167 | * @param dst_size the size in bytes of dst 168 | * @param src_data pointers containing the source image data 169 | * @param src_linesizes linesizes for the image in src_data 170 | * @param pix_fmt the pixel format of the source image 171 | * @param width the width of the source image in pixels 172 | * @param height the height of the source image in pixels 173 | * @param align the assumed linesize alignment for dst 174 | * @return the number of bytes written to dst, or a negative value 175 | * (error code) on error 176 | */ 177 | int av_image_copy_to_buffer(uint8_t *dst, int dst_size, 178 | const uint8_t * const src_data[4], const int src_linesize[4], 179 | enum AVPixelFormat pix_fmt, int width, int height, int align); 180 | 181 | /** 182 | * Check if the given dimension of an image is valid, meaning that all 183 | * bytes of the image can be addressed with a signed int. 184 | * 185 | * @param w the width of the picture 186 | * @param h the height of the picture 187 | * @param log_offset the offset to sum to the log level for logging with log_ctx 188 | * @param log_ctx the parent logging context, it may be NULL 189 | * @return >= 0 if valid, a negative error code otherwise 190 | */ 191 | int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx); 192 | 193 | int avpriv_set_systematic_pal2(uint32_t pal[256], enum AVPixelFormat pix_fmt); 194 | 195 | /** 196 | * @} 197 | */ 198 | 199 | 200 | #endif /* AVUTIL_IMGUTILS_H */ 201 | -------------------------------------------------------------------------------- /universal/include/libavutil/avutil.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_AVUTIL_H 22 | #define AVUTIL_AVUTIL_H 23 | 24 | /** 25 | * @file 26 | * external API header 27 | */ 28 | 29 | /** 30 | * @mainpage 31 | * 32 | * @section ffmpeg_intro Introduction 33 | * 34 | * This document describes the usage of the different libraries 35 | * provided by FFmpeg. 36 | * 37 | * @li @ref libavc "libavcodec" encoding/decoding library 38 | * @li @ref lavfi "libavfilter" graph-based frame editing library 39 | * @li @ref libavf "libavformat" I/O and muxing/demuxing library 40 | * @li @ref lavd "libavdevice" special devices muxing/demuxing library 41 | * @li @ref lavu "libavutil" common utility library 42 | * @li @ref lswr "libswresample" audio resampling, format conversion and mixing 43 | * @li @ref lpp "libpostproc" post processing library 44 | * @li @ref libsws "libswscale" color conversion and scaling library 45 | * 46 | * @section ffmpeg_versioning Versioning and compatibility 47 | * 48 | * Each of the FFmpeg libraries contains a version.h header, which defines a 49 | * major, minor and micro version number with the 50 | * LIBRARYNAME_VERSION_{MAJOR,MINOR,MICRO} macros. The major version 51 | * number is incremented with backward incompatible changes - e.g. removing 52 | * parts of the public API, reordering public struct members, etc. The minor 53 | * version number is incremented for backward compatible API changes or major 54 | * new features - e.g. adding a new public function or a new decoder. The micro 55 | * version number is incremented for smaller changes that a calling program 56 | * might still want to check for - e.g. changing behavior in a previously 57 | * unspecified situation. 58 | * 59 | * FFmpeg guarantees backward API and ABI compatibility for each library as long 60 | * as its major version number is unchanged. This means that no public symbols 61 | * will be removed or renamed. Types and names of the public struct members and 62 | * values of public macros and enums will remain the same (unless they were 63 | * explicitly declared as not part of the public API). Documented behavior will 64 | * not change. 65 | * 66 | * In other words, any correct program that works with a given FFmpeg snapshot 67 | * should work just as well without any changes with any later snapshot with the 68 | * same major versions. This applies to both rebuilding the program against new 69 | * FFmpeg versions or to replacing the dynamic FFmpeg libraries that a program 70 | * links against. 71 | * 72 | * However, new public symbols may be added and new members may be appended to 73 | * public structs whose size is not part of public ABI (most public structs in 74 | * FFmpeg). New macros and enum values may be added. Behavior in undocumented 75 | * situations may change slightly (and be documented). All those are accompanied 76 | * by an entry in doc/APIchanges and incrementing either the minor or micro 77 | * version number. 78 | */ 79 | 80 | /** 81 | * @defgroup lavu Common utility functions 82 | * 83 | * @brief 84 | * libavutil contains the code shared across all the other FFmpeg 85 | * libraries 86 | * 87 | * @note In order to use the functions provided by avutil you must include 88 | * the specific header. 89 | * 90 | * @{ 91 | * 92 | * @defgroup lavu_crypto Crypto and Hashing 93 | * 94 | * @{ 95 | * @} 96 | * 97 | * @defgroup lavu_math Maths 98 | * @{ 99 | * 100 | * @} 101 | * 102 | * @defgroup lavu_string String Manipulation 103 | * 104 | * @{ 105 | * 106 | * @} 107 | * 108 | * @defgroup lavu_mem Memory Management 109 | * 110 | * @{ 111 | * 112 | * @} 113 | * 114 | * @defgroup lavu_data Data Structures 115 | * @{ 116 | * 117 | * @} 118 | * 119 | * @defgroup lavu_audio Audio related 120 | * 121 | * @{ 122 | * 123 | * @} 124 | * 125 | * @defgroup lavu_error Error Codes 126 | * 127 | * @{ 128 | * 129 | * @} 130 | * 131 | * @defgroup lavu_log Logging Facility 132 | * 133 | * @{ 134 | * 135 | * @} 136 | * 137 | * @defgroup lavu_misc Other 138 | * 139 | * @{ 140 | * 141 | * @defgroup lavu_internal Internal 142 | * 143 | * Not exported functions, for internal usage only 144 | * 145 | * @{ 146 | * 147 | * @} 148 | * 149 | * @defgroup preproc_misc Preprocessor String Macros 150 | * 151 | * @{ 152 | * 153 | * @} 154 | */ 155 | 156 | 157 | /** 158 | * @addtogroup lavu_ver 159 | * @{ 160 | */ 161 | 162 | /** 163 | * Return the LIBAVUTIL_VERSION_INT constant. 164 | */ 165 | unsigned avutil_version(void); 166 | 167 | /** 168 | * Return the libavutil build-time configuration. 169 | */ 170 | const char *avutil_configuration(void); 171 | 172 | /** 173 | * Return the libavutil license. 174 | */ 175 | const char *avutil_license(void); 176 | 177 | /** 178 | * @} 179 | */ 180 | 181 | /** 182 | * @addtogroup lavu_media Media Type 183 | * @brief Media Type 184 | */ 185 | 186 | enum AVMediaType { 187 | AVMEDIA_TYPE_UNKNOWN = -1, ///< Usually treated as AVMEDIA_TYPE_DATA 188 | AVMEDIA_TYPE_VIDEO, 189 | AVMEDIA_TYPE_AUDIO, 190 | AVMEDIA_TYPE_DATA, ///< Opaque data information usually continuous 191 | AVMEDIA_TYPE_SUBTITLE, 192 | AVMEDIA_TYPE_ATTACHMENT, ///< Opaque data information usually sparse 193 | AVMEDIA_TYPE_NB 194 | }; 195 | 196 | /** 197 | * Return a string describing the media_type enum, NULL if media_type 198 | * is unknown. 199 | */ 200 | const char *av_get_media_type_string(enum AVMediaType media_type); 201 | 202 | /** 203 | * @defgroup lavu_const Constants 204 | * @{ 205 | * 206 | * @defgroup lavu_enc Encoding specific 207 | * 208 | * @note those definition should move to avcodec 209 | * @{ 210 | */ 211 | 212 | #define FF_LAMBDA_SHIFT 7 213 | #define FF_LAMBDA_SCALE (1< 3 | * Copyright (c) 2008 Peter Ross 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_CHANNEL_LAYOUT_H 23 | #define AVUTIL_CHANNEL_LAYOUT_H 24 | 25 | #include 26 | 27 | /** 28 | * @file 29 | * audio channel layout utility functions 30 | */ 31 | 32 | /** 33 | * @addtogroup lavu_audio 34 | * @{ 35 | */ 36 | 37 | /** 38 | * @defgroup channel_masks Audio channel masks 39 | * 40 | * A channel layout is a 64-bits integer with a bit set for every channel. 41 | * The number of bits set must be equal to the number of channels. 42 | * The value 0 means that the channel layout is not known. 43 | * @note this data structure is not powerful enough to handle channels 44 | * combinations that have the same channel multiple times, such as 45 | * dual-mono. 46 | * 47 | * @{ 48 | */ 49 | #define AV_CH_FRONT_LEFT 0x00000001 50 | #define AV_CH_FRONT_RIGHT 0x00000002 51 | #define AV_CH_FRONT_CENTER 0x00000004 52 | #define AV_CH_LOW_FREQUENCY 0x00000008 53 | #define AV_CH_BACK_LEFT 0x00000010 54 | #define AV_CH_BACK_RIGHT 0x00000020 55 | #define AV_CH_FRONT_LEFT_OF_CENTER 0x00000040 56 | #define AV_CH_FRONT_RIGHT_OF_CENTER 0x00000080 57 | #define AV_CH_BACK_CENTER 0x00000100 58 | #define AV_CH_SIDE_LEFT 0x00000200 59 | #define AV_CH_SIDE_RIGHT 0x00000400 60 | #define AV_CH_TOP_CENTER 0x00000800 61 | #define AV_CH_TOP_FRONT_LEFT 0x00001000 62 | #define AV_CH_TOP_FRONT_CENTER 0x00002000 63 | #define AV_CH_TOP_FRONT_RIGHT 0x00004000 64 | #define AV_CH_TOP_BACK_LEFT 0x00008000 65 | #define AV_CH_TOP_BACK_CENTER 0x00010000 66 | #define AV_CH_TOP_BACK_RIGHT 0x00020000 67 | #define AV_CH_STEREO_LEFT 0x20000000 ///< Stereo downmix. 68 | #define AV_CH_STEREO_RIGHT 0x40000000 ///< See AV_CH_STEREO_LEFT. 69 | #define AV_CH_WIDE_LEFT 0x0000000080000000ULL 70 | #define AV_CH_WIDE_RIGHT 0x0000000100000000ULL 71 | #define AV_CH_SURROUND_DIRECT_LEFT 0x0000000200000000ULL 72 | #define AV_CH_SURROUND_DIRECT_RIGHT 0x0000000400000000ULL 73 | #define AV_CH_LOW_FREQUENCY_2 0x0000000800000000ULL 74 | 75 | /** Channel mask value used for AVCodecContext.request_channel_layout 76 | to indicate that the user requests the channel order of the decoder output 77 | to be the native codec channel order. */ 78 | #define AV_CH_LAYOUT_NATIVE 0x8000000000000000ULL 79 | 80 | /** 81 | * @} 82 | * @defgroup channel_mask_c Audio channel convenience macros 83 | * @{ 84 | * */ 85 | #define AV_CH_LAYOUT_MONO (AV_CH_FRONT_CENTER) 86 | #define AV_CH_LAYOUT_STEREO (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT) 87 | #define AV_CH_LAYOUT_2POINT1 (AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY) 88 | #define AV_CH_LAYOUT_2_1 (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER) 89 | #define AV_CH_LAYOUT_SURROUND (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER) 90 | #define AV_CH_LAYOUT_3POINT1 (AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY) 91 | #define AV_CH_LAYOUT_4POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER) 92 | #define AV_CH_LAYOUT_4POINT1 (AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY) 93 | #define AV_CH_LAYOUT_2_2 (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT) 94 | #define AV_CH_LAYOUT_QUAD (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) 95 | #define AV_CH_LAYOUT_5POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT) 96 | #define AV_CH_LAYOUT_5POINT1 (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY) 97 | #define AV_CH_LAYOUT_5POINT0_BACK (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) 98 | #define AV_CH_LAYOUT_5POINT1_BACK (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY) 99 | #define AV_CH_LAYOUT_6POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_CENTER) 100 | #define AV_CH_LAYOUT_6POINT0_FRONT (AV_CH_LAYOUT_2_2|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) 101 | #define AV_CH_LAYOUT_HEXAGONAL (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_BACK_CENTER) 102 | #define AV_CH_LAYOUT_6POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER) 103 | #define AV_CH_LAYOUT_6POINT1_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_BACK_CENTER) 104 | #define AV_CH_LAYOUT_6POINT1_FRONT (AV_CH_LAYOUT_6POINT0_FRONT|AV_CH_LOW_FREQUENCY) 105 | #define AV_CH_LAYOUT_7POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) 106 | #define AV_CH_LAYOUT_7POINT0_FRONT (AV_CH_LAYOUT_5POINT0|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) 107 | #define AV_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) 108 | #define AV_CH_LAYOUT_7POINT1_WIDE (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) 109 | #define AV_CH_LAYOUT_7POINT1_WIDE_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) 110 | #define AV_CH_LAYOUT_OCTAGONAL (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT) 111 | #define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT) 112 | 113 | enum AVMatrixEncoding { 114 | AV_MATRIX_ENCODING_NONE, 115 | AV_MATRIX_ENCODING_DOLBY, 116 | AV_MATRIX_ENCODING_DPLII, 117 | AV_MATRIX_ENCODING_DPLIIX, 118 | AV_MATRIX_ENCODING_DPLIIZ, 119 | AV_MATRIX_ENCODING_DOLBYEX, 120 | AV_MATRIX_ENCODING_DOLBYHEADPHONE, 121 | AV_MATRIX_ENCODING_NB 122 | }; 123 | 124 | /** 125 | * @} 126 | */ 127 | 128 | /** 129 | * Return a channel layout id that matches name, or 0 if no match is found. 130 | * 131 | * name can be one or several of the following notations, 132 | * separated by '+' or '|': 133 | * - the name of an usual channel layout (mono, stereo, 4.0, quad, 5.0, 134 | * 5.0(side), 5.1, 5.1(side), 7.1, 7.1(wide), downmix); 135 | * - the name of a single channel (FL, FR, FC, LFE, BL, BR, FLC, FRC, BC, 136 | * SL, SR, TC, TFL, TFC, TFR, TBL, TBC, TBR, DL, DR); 137 | * - a number of channels, in decimal, optionally followed by 'c', yielding 138 | * the default channel layout for that number of channels (@see 139 | * av_get_default_channel_layout); 140 | * - a channel layout mask, in hexadecimal starting with "0x" (see the 141 | * AV_CH_* macros). 142 | * 143 | * @warning Starting from the next major bump the trailing character 144 | * 'c' to specify a number of channels will be required, while a 145 | * channel layout mask could also be specified as a decimal number 146 | * (if and only if not followed by "c"). 147 | * 148 | * Example: "stereo+FC" = "2c+FC" = "2c+1c" = "0x7" 149 | */ 150 | uint64_t av_get_channel_layout(const char *name); 151 | 152 | /** 153 | * Return a description of a channel layout. 154 | * If nb_channels is <= 0, it is guessed from the channel_layout. 155 | * 156 | * @param buf put here the string containing the channel layout 157 | * @param buf_size size in bytes of the buffer 158 | */ 159 | void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout); 160 | 161 | struct AVBPrint; 162 | /** 163 | * Append a description of a channel layout to a bprint buffer. 164 | */ 165 | void av_bprint_channel_layout(struct AVBPrint *bp, int nb_channels, uint64_t channel_layout); 166 | 167 | /** 168 | * Return the number of channels in the channel layout. 169 | */ 170 | int av_get_channel_layout_nb_channels(uint64_t channel_layout); 171 | 172 | /** 173 | * Return default channel layout for a given number of channels. 174 | */ 175 | int64_t av_get_default_channel_layout(int nb_channels); 176 | 177 | /** 178 | * Get the index of a channel in channel_layout. 179 | * 180 | * @param channel a channel layout describing exactly one channel which must be 181 | * present in channel_layout. 182 | * 183 | * @return index of channel in channel_layout on success, a negative AVERROR 184 | * on error. 185 | */ 186 | int av_get_channel_layout_channel_index(uint64_t channel_layout, 187 | uint64_t channel); 188 | 189 | /** 190 | * Get the channel with the given index in channel_layout. 191 | */ 192 | uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index); 193 | 194 | /** 195 | * Get the name of a given channel. 196 | * 197 | * @return channel name on success, NULL on error. 198 | */ 199 | const char *av_get_channel_name(uint64_t channel); 200 | 201 | /** 202 | * Get the description of a given channel. 203 | * 204 | * @param channel a channel layout with a single channel 205 | * @return channel description on success, NULL on error 206 | */ 207 | const char *av_get_channel_description(uint64_t channel); 208 | 209 | /** 210 | * Get the value and name of a standard channel layout. 211 | * 212 | * @param[in] index index in an internal list, starting at 0 213 | * @param[out] layout channel layout mask 214 | * @param[out] name name of the layout 215 | * @return 0 if the layout exists, 216 | * <0 if index is beyond the limits 217 | */ 218 | int av_get_standard_channel_layout(unsigned index, uint64_t *layout, 219 | const char **name); 220 | 221 | /** 222 | * @} 223 | */ 224 | 225 | #endif /* AVUTIL_CHANNEL_LAYOUT_H */ 226 | -------------------------------------------------------------------------------- /universal/include/libavutil/log.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_LOG_H 22 | #define AVUTIL_LOG_H 23 | 24 | #include 25 | #include "avutil.h" 26 | #include "attributes.h" 27 | 28 | typedef enum { 29 | AV_CLASS_CATEGORY_NA = 0, 30 | AV_CLASS_CATEGORY_INPUT, 31 | AV_CLASS_CATEGORY_OUTPUT, 32 | AV_CLASS_CATEGORY_MUXER, 33 | AV_CLASS_CATEGORY_DEMUXER, 34 | AV_CLASS_CATEGORY_ENCODER, 35 | AV_CLASS_CATEGORY_DECODER, 36 | AV_CLASS_CATEGORY_FILTER, 37 | AV_CLASS_CATEGORY_BITSTREAM_FILTER, 38 | AV_CLASS_CATEGORY_SWSCALER, 39 | AV_CLASS_CATEGORY_SWRESAMPLER, 40 | AV_CLASS_CATEGORY_NB, ///< not part of ABI/API 41 | }AVClassCategory; 42 | 43 | struct AVOptionRanges; 44 | 45 | /** 46 | * Describe the class of an AVClass context structure. That is an 47 | * arbitrary struct of which the first field is a pointer to an 48 | * AVClass struct (e.g. AVCodecContext, AVFormatContext etc.). 49 | */ 50 | typedef struct AVClass { 51 | /** 52 | * The name of the class; usually it is the same name as the 53 | * context structure type to which the AVClass is associated. 54 | */ 55 | const char* class_name; 56 | 57 | /** 58 | * A pointer to a function which returns the name of a context 59 | * instance ctx associated with the class. 60 | */ 61 | const char* (*item_name)(void* ctx); 62 | 63 | /** 64 | * a pointer to the first option specified in the class if any or NULL 65 | * 66 | * @see av_set_default_options() 67 | */ 68 | const struct AVOption *option; 69 | 70 | /** 71 | * LIBAVUTIL_VERSION with which this structure was created. 72 | * This is used to allow fields to be added without requiring major 73 | * version bumps everywhere. 74 | */ 75 | 76 | int version; 77 | 78 | /** 79 | * Offset in the structure where log_level_offset is stored. 80 | * 0 means there is no such variable 81 | */ 82 | int log_level_offset_offset; 83 | 84 | /** 85 | * Offset in the structure where a pointer to the parent context for 86 | * logging is stored. For example a decoder could pass its AVCodecContext 87 | * to eval as such a parent context, which an av_log() implementation 88 | * could then leverage to display the parent context. 89 | * The offset can be NULL. 90 | */ 91 | int parent_log_context_offset; 92 | 93 | /** 94 | * Return next AVOptions-enabled child or NULL 95 | */ 96 | void* (*child_next)(void *obj, void *prev); 97 | 98 | /** 99 | * Return an AVClass corresponding to the next potential 100 | * AVOptions-enabled child. 101 | * 102 | * The difference between child_next and this is that 103 | * child_next iterates over _already existing_ objects, while 104 | * child_class_next iterates over _all possible_ children. 105 | */ 106 | const struct AVClass* (*child_class_next)(const struct AVClass *prev); 107 | 108 | /** 109 | * Category used for visualization (like color) 110 | * This is only set if the category is equal for all objects using this class. 111 | * available since version (51 << 16 | 56 << 8 | 100) 112 | */ 113 | AVClassCategory category; 114 | 115 | /** 116 | * Callback to return the category. 117 | * available since version (51 << 16 | 59 << 8 | 100) 118 | */ 119 | AVClassCategory (*get_category)(void* ctx); 120 | 121 | /** 122 | * Callback to return the supported/allowed ranges. 123 | * available since version (52.12) 124 | */ 125 | int (*query_ranges)(struct AVOptionRanges **, void *obj, const char *key, int flags); 126 | } AVClass; 127 | 128 | /** 129 | * @addtogroup lavu_log 130 | * 131 | * @{ 132 | * 133 | * @defgroup lavu_log_constants Logging Constants 134 | * 135 | * @{ 136 | */ 137 | 138 | /** 139 | * Print no output. 140 | */ 141 | #define AV_LOG_QUIET -8 142 | 143 | /** 144 | * Something went really wrong and we will crash now. 145 | */ 146 | #define AV_LOG_PANIC 0 147 | 148 | /** 149 | * Something went wrong and recovery is not possible. 150 | * For example, no header was found for a format which depends 151 | * on headers or an illegal combination of parameters is used. 152 | */ 153 | #define AV_LOG_FATAL 8 154 | 155 | /** 156 | * Something went wrong and cannot losslessly be recovered. 157 | * However, not all future data is affected. 158 | */ 159 | #define AV_LOG_ERROR 16 160 | 161 | /** 162 | * Something somehow does not look correct. This may or may not 163 | * lead to problems. An example would be the use of '-vstrict -2'. 164 | */ 165 | #define AV_LOG_WARNING 24 166 | 167 | /** 168 | * Standard information. 169 | */ 170 | #define AV_LOG_INFO 32 171 | 172 | /** 173 | * Detailed information. 174 | */ 175 | #define AV_LOG_VERBOSE 40 176 | 177 | /** 178 | * Stuff which is only useful for libav* developers. 179 | */ 180 | #define AV_LOG_DEBUG 48 181 | 182 | #define AV_LOG_MAX_OFFSET (AV_LOG_DEBUG - AV_LOG_QUIET) 183 | 184 | /** 185 | * @} 186 | */ 187 | 188 | /** 189 | * Send the specified message to the log if the level is less than or equal 190 | * to the current av_log_level. By default, all logging messages are sent to 191 | * stderr. This behavior can be altered by setting a different logging callback 192 | * function. 193 | * @see av_log_set_callback 194 | * 195 | * @param avcl A pointer to an arbitrary struct of which the first field is a 196 | * pointer to an AVClass struct. 197 | * @param level The importance level of the message expressed using a @ref 198 | * lavu_log_constants "Logging Constant". 199 | * @param fmt The format string (printf-compatible) that specifies how 200 | * subsequent arguments are converted to output. 201 | */ 202 | void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4); 203 | 204 | 205 | /** 206 | * Send the specified message to the log if the level is less than or equal 207 | * to the current av_log_level. By default, all logging messages are sent to 208 | * stderr. This behavior can be altered by setting a different logging callback 209 | * function. 210 | * @see av_log_set_callback 211 | * 212 | * @param avcl A pointer to an arbitrary struct of which the first field is a 213 | * pointer to an AVClass struct. 214 | * @param level The importance level of the message expressed using a @ref 215 | * lavu_log_constants "Logging Constant". 216 | * @param fmt The format string (printf-compatible) that specifies how 217 | * subsequent arguments are converted to output. 218 | * @param vl The arguments referenced by the format string. 219 | */ 220 | void av_vlog(void *avcl, int level, const char *fmt, va_list vl); 221 | 222 | /** 223 | * Get the current log level 224 | * 225 | * @see lavu_log_constants 226 | * 227 | * @return Current log level 228 | */ 229 | int av_log_get_level(void); 230 | 231 | /** 232 | * Set the log level 233 | * 234 | * @see lavu_log_constants 235 | * 236 | * @param level Logging level 237 | */ 238 | void av_log_set_level(int level); 239 | 240 | /** 241 | * Set the logging callback 242 | * 243 | * @note The callback must be thread safe, even if the application does not use 244 | * threads itself as some codecs are multithreaded. 245 | * 246 | * @see av_log_default_callback 247 | * 248 | * @param callback A logging function with a compatible signature. 249 | */ 250 | void av_log_set_callback(void (*callback)(void*, int, const char*, va_list)); 251 | 252 | /** 253 | * Default logging callback 254 | * 255 | * It prints the message to stderr, optionally colorizing it. 256 | * 257 | * @param avcl A pointer to an arbitrary struct of which the first field is a 258 | * pointer to an AVClass struct. 259 | * @param level The importance level of the message expressed using a @ref 260 | * lavu_log_constants "Logging Constant". 261 | * @param fmt The format string (printf-compatible) that specifies how 262 | * subsequent arguments are converted to output. 263 | * @param vl The arguments referenced by the format string. 264 | */ 265 | void av_log_default_callback(void *avcl, int level, const char *fmt, 266 | va_list vl); 267 | 268 | /** 269 | * Return the context name 270 | * 271 | * @param ctx The AVClass context 272 | * 273 | * @return The AVClass class_name 274 | */ 275 | const char* av_default_item_name(void* ctx); 276 | AVClassCategory av_default_get_category(void *ptr); 277 | 278 | /** 279 | * Format a line of log the same way as the default callback. 280 | * @param line buffer to receive the formated line 281 | * @param line_size size of the buffer 282 | * @param print_prefix used to store whether the prefix must be printed; 283 | * must point to a persistent integer initially set to 1 284 | */ 285 | void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl, 286 | char *line, int line_size, int *print_prefix); 287 | 288 | /** 289 | * av_dlog macros 290 | * Useful to print debug messages that shouldn't get compiled in normally. 291 | */ 292 | 293 | #ifdef DEBUG 294 | # define av_dlog(pctx, ...) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__) 295 | #else 296 | # define av_dlog(pctx, ...) do { if (0) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0) 297 | #endif 298 | 299 | /** 300 | * Skip repeated messages, this requires the user app to use av_log() instead of 301 | * (f)printf as the 2 would otherwise interfere and lead to 302 | * "Last message repeated x times" messages below (f)printf messages with some 303 | * bad luck. 304 | * Also to receive the last, "last repeated" line if any, the user app must 305 | * call av_log(NULL, AV_LOG_QUIET, "%s", ""); at the end 306 | */ 307 | #define AV_LOG_SKIP_REPEATED 1 308 | void av_log_set_flags(int arg); 309 | 310 | /** 311 | * @} 312 | */ 313 | 314 | #endif /* AVUTIL_LOG_H */ 315 | --------------------------------------------------------------------------------