@drutech/react-native-audio-analyzer 1.1.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +124 -0
- package/android/CMakeCache.txt +372 -0
- package/android/CMakeLists.txt +44 -0
- package/android/Makefile +211 -0
- package/android/build.gradle +110 -0
- package/android/cmake_install.cmake +49 -0
- package/android/cpp-adapter.cpp +40 -0
- package/android/ffmpeg_16kb/include/config.h +749 -0
- package/android/ffmpeg_16kb/include/libavcodec/ac3_parser.h +36 -0
- package/android/ffmpeg_16kb/include/libavcodec/adts_parser.h +37 -0
- package/android/ffmpeg_16kb/include/libavcodec/arm/mathops.h +108 -0
- package/android/ffmpeg_16kb/include/libavcodec/avcodec.h +3192 -0
- package/android/ffmpeg_16kb/include/libavcodec/avdct.h +88 -0
- package/android/ffmpeg_16kb/include/libavcodec/avfft.h +118 -0
- package/android/ffmpeg_16kb/include/libavcodec/bsf.h +332 -0
- package/android/ffmpeg_16kb/include/libavcodec/codec.h +375 -0
- package/android/ffmpeg_16kb/include/libavcodec/codec_desc.h +128 -0
- package/android/ffmpeg_16kb/include/libavcodec/codec_id.h +661 -0
- package/android/ffmpeg_16kb/include/libavcodec/codec_par.h +247 -0
- package/android/ffmpeg_16kb/include/libavcodec/d3d11va.h +112 -0
- package/android/ffmpeg_16kb/include/libavcodec/defs.h +192 -0
- package/android/ffmpeg_16kb/include/libavcodec/dirac.h +131 -0
- package/android/ffmpeg_16kb/include/libavcodec/dv_profile.h +82 -0
- package/android/ffmpeg_16kb/include/libavcodec/dxva2.h +93 -0
- package/android/ffmpeg_16kb/include/libavcodec/jni.h +46 -0
- package/android/ffmpeg_16kb/include/libavcodec/mathops.h +255 -0
- package/android/ffmpeg_16kb/include/libavcodec/mediacodec.h +103 -0
- package/android/ffmpeg_16kb/include/libavcodec/packet.h +731 -0
- package/android/ffmpeg_16kb/include/libavcodec/qsv.h +109 -0
- package/android/ffmpeg_16kb/include/libavcodec/vdpau.h +157 -0
- package/android/ffmpeg_16kb/include/libavcodec/version.h +45 -0
- package/android/ffmpeg_16kb/include/libavcodec/version_major.h +52 -0
- package/android/ffmpeg_16kb/include/libavcodec/videotoolbox.h +150 -0
- package/android/ffmpeg_16kb/include/libavcodec/vorbis_parser.h +74 -0
- package/android/ffmpeg_16kb/include/libavcodec/x86/mathops.h +133 -0
- package/android/ffmpeg_16kb/include/libavcodec/xvmc.h +171 -0
- package/android/ffmpeg_16kb/include/libavdevice/avdevice.h +397 -0
- package/android/ffmpeg_16kb/include/libavdevice/version.h +45 -0
- package/android/ffmpeg_16kb/include/libavdevice/version_major.h +36 -0
- package/android/ffmpeg_16kb/include/libavfilter/avfilter.h +1491 -0
- package/android/ffmpeg_16kb/include/libavfilter/buffersink.h +173 -0
- package/android/ffmpeg_16kb/include/libavfilter/buffersrc.h +218 -0
- package/android/ffmpeg_16kb/include/libavfilter/version.h +48 -0
- package/android/ffmpeg_16kb/include/libavfilter/version_major.h +38 -0
- package/android/ffmpeg_16kb/include/libavformat/avformat.h +2826 -0
- package/android/ffmpeg_16kb/include/libavformat/avio.h +837 -0
- package/android/ffmpeg_16kb/include/libavformat/network.h +341 -0
- package/android/ffmpeg_16kb/include/libavformat/os_support.h +317 -0
- package/android/ffmpeg_16kb/include/libavformat/url.h +409 -0
- package/android/ffmpeg_16kb/include/libavformat/version.h +47 -0
- package/android/ffmpeg_16kb/include/libavformat/version_major.h +52 -0
- package/android/ffmpeg_16kb/include/libavutil/aarch64/timer.h +50 -0
- package/android/ffmpeg_16kb/include/libavutil/adler32.h +63 -0
- package/android/ffmpeg_16kb/include/libavutil/aes.h +69 -0
- package/android/ffmpeg_16kb/include/libavutil/aes_ctr.h +99 -0
- package/android/ffmpeg_16kb/include/libavutil/ambient_viewing_environment.h +72 -0
- package/android/ffmpeg_16kb/include/libavutil/arm/timer.h +46 -0
- package/android/ffmpeg_16kb/include/libavutil/attributes.h +173 -0
- package/android/ffmpeg_16kb/include/libavutil/attributes_internal.h +34 -0
- package/android/ffmpeg_16kb/include/libavutil/audio_fifo.h +186 -0
- package/android/ffmpeg_16kb/include/libavutil/avassert.h +75 -0
- package/android/ffmpeg_16kb/include/libavutil/avconfig.h +6 -0
- package/android/ffmpeg_16kb/include/libavutil/avstring.h +429 -0
- package/android/ffmpeg_16kb/include/libavutil/avutil.h +371 -0
- package/android/ffmpeg_16kb/include/libavutil/base64.h +72 -0
- package/android/ffmpeg_16kb/include/libavutil/blowfish.h +82 -0
- package/android/ffmpeg_16kb/include/libavutil/bprint.h +251 -0
- package/android/ffmpeg_16kb/include/libavutil/bswap.h +111 -0
- package/android/ffmpeg_16kb/include/libavutil/buffer.h +322 -0
- package/android/ffmpeg_16kb/include/libavutil/camellia.h +70 -0
- package/android/ffmpeg_16kb/include/libavutil/cast5.h +80 -0
- package/android/ffmpeg_16kb/include/libavutil/channel_layout.h +783 -0
- package/android/ffmpeg_16kb/include/libavutil/common.h +578 -0
- package/android/ffmpeg_16kb/include/libavutil/cpu.h +134 -0
- package/android/ffmpeg_16kb/include/libavutil/crc.h +102 -0
- package/android/ffmpeg_16kb/include/libavutil/csp.h +150 -0
- package/android/ffmpeg_16kb/include/libavutil/des.h +81 -0
- package/android/ffmpeg_16kb/include/libavutil/detection_bbox.h +108 -0
- package/android/ffmpeg_16kb/include/libavutil/dict.h +241 -0
- package/android/ffmpeg_16kb/include/libavutil/display.h +109 -0
- package/android/ffmpeg_16kb/include/libavutil/dovi_meta.h +236 -0
- package/android/ffmpeg_16kb/include/libavutil/downmix_info.h +115 -0
- package/android/ffmpeg_16kb/include/libavutil/encryption_info.h +205 -0
- package/android/ffmpeg_16kb/include/libavutil/error.h +128 -0
- package/android/ffmpeg_16kb/include/libavutil/eval.h +140 -0
- package/android/ffmpeg_16kb/include/libavutil/ffversion.h +5 -0
- package/android/ffmpeg_16kb/include/libavutil/fifo.h +448 -0
- package/android/ffmpeg_16kb/include/libavutil/file.h +115 -0
- package/android/ffmpeg_16kb/include/libavutil/film_grain_params.h +260 -0
- package/android/ffmpeg_16kb/include/libavutil/frame.h +964 -0
- package/android/ffmpeg_16kb/include/libavutil/getenv_utf8.h +86 -0
- package/android/ffmpeg_16kb/include/libavutil/hash.h +264 -0
- package/android/ffmpeg_16kb/include/libavutil/hdr_dynamic_metadata.h +343 -0
- package/android/ffmpeg_16kb/include/libavutil/hdr_dynamic_vivid_metadata.h +285 -0
- package/android/ffmpeg_16kb/include/libavutil/hmac.h +99 -0
- package/android/ffmpeg_16kb/include/libavutil/hwcontext.h +610 -0
- package/android/ffmpeg_16kb/include/libavutil/hwcontext_cuda.h +69 -0
- package/android/ffmpeg_16kb/include/libavutil/hwcontext_d3d11va.h +178 -0
- package/android/ffmpeg_16kb/include/libavutil/hwcontext_drm.h +169 -0
- package/android/ffmpeg_16kb/include/libavutil/hwcontext_dxva2.h +75 -0
- package/android/ffmpeg_16kb/include/libavutil/hwcontext_mediacodec.h +61 -0
- package/android/ffmpeg_16kb/include/libavutil/hwcontext_opencl.h +100 -0
- package/android/ffmpeg_16kb/include/libavutil/hwcontext_qsv.h +64 -0
- package/android/ffmpeg_16kb/include/libavutil/hwcontext_vaapi.h +117 -0
- package/android/ffmpeg_16kb/include/libavutil/hwcontext_vdpau.h +44 -0
- package/android/ffmpeg_16kb/include/libavutil/hwcontext_videotoolbox.h +96 -0
- package/android/ffmpeg_16kb/include/libavutil/hwcontext_vulkan.h +281 -0
- package/android/ffmpeg_16kb/include/libavutil/imgutils.h +331 -0
- package/android/ffmpeg_16kb/include/libavutil/internal.h +190 -0
- package/android/ffmpeg_16kb/include/libavutil/intfloat.h +77 -0
- package/android/ffmpeg_16kb/include/libavutil/intreadwrite.h +644 -0
- package/android/ffmpeg_16kb/include/libavutil/lfg.h +81 -0
- package/android/ffmpeg_16kb/include/libavutil/libm.h +471 -0
- package/android/ffmpeg_16kb/include/libavutil/log.h +387 -0
- package/android/ffmpeg_16kb/include/libavutil/lzo.h +66 -0
- package/android/ffmpeg_16kb/include/libavutil/macros.h +80 -0
- package/android/ffmpeg_16kb/include/libavutil/mastering_display_metadata.h +128 -0
- package/android/ffmpeg_16kb/include/libavutil/mathematics.h +245 -0
- package/android/ffmpeg_16kb/include/libavutil/md5.h +89 -0
- package/android/ffmpeg_16kb/include/libavutil/mem.h +609 -0
- package/android/ffmpeg_16kb/include/libavutil/motion_vector.h +57 -0
- package/android/ffmpeg_16kb/include/libavutil/murmur3.h +115 -0
- package/android/ffmpeg_16kb/include/libavutil/opt.h +891 -0
- package/android/ffmpeg_16kb/include/libavutil/parseutils.h +197 -0
- package/android/ffmpeg_16kb/include/libavutil/pixdesc.h +435 -0
- package/android/ffmpeg_16kb/include/libavutil/pixelutils.h +51 -0
- package/android/ffmpeg_16kb/include/libavutil/pixfmt.h +691 -0
- package/android/ffmpeg_16kb/include/libavutil/random_seed.h +43 -0
- package/android/ffmpeg_16kb/include/libavutil/rational.h +221 -0
- package/android/ffmpeg_16kb/include/libavutil/rc4.h +69 -0
- package/android/ffmpeg_16kb/include/libavutil/replaygain.h +50 -0
- package/android/ffmpeg_16kb/include/libavutil/reverse.h +28 -0
- package/android/ffmpeg_16kb/include/libavutil/ripemd.h +83 -0
- package/android/ffmpeg_16kb/include/libavutil/samplefmt.h +269 -0
- package/android/ffmpeg_16kb/include/libavutil/sha.h +90 -0
- package/android/ffmpeg_16kb/include/libavutil/sha512.h +92 -0
- package/android/ffmpeg_16kb/include/libavutil/spherical.h +227 -0
- package/android/ffmpeg_16kb/include/libavutil/stereo3d.h +229 -0
- package/android/ffmpeg_16kb/include/libavutil/tea.h +71 -0
- package/android/ffmpeg_16kb/include/libavutil/thread.h +204 -0
- package/android/ffmpeg_16kb/include/libavutil/threadmessage.h +115 -0
- package/android/ffmpeg_16kb/include/libavutil/time.h +56 -0
- package/android/ffmpeg_16kb/include/libavutil/timecode.h +199 -0
- package/android/ffmpeg_16kb/include/libavutil/timer.h +156 -0
- package/android/ffmpeg_16kb/include/libavutil/timestamp.h +78 -0
- package/android/ffmpeg_16kb/include/libavutil/tree.h +137 -0
- package/android/ffmpeg_16kb/include/libavutil/twofish.h +70 -0
- package/android/ffmpeg_16kb/include/libavutil/tx.h +176 -0
- package/android/ffmpeg_16kb/include/libavutil/uuid.h +146 -0
- package/android/ffmpeg_16kb/include/libavutil/version.h +122 -0
- package/android/ffmpeg_16kb/include/libavutil/video_enc_params.h +171 -0
- package/android/ffmpeg_16kb/include/libavutil/x86/asm.h +154 -0
- package/android/ffmpeg_16kb/include/libavutil/x86/emms.h +58 -0
- package/android/ffmpeg_16kb/include/libavutil/x86/timer.h +50 -0
- package/android/ffmpeg_16kb/include/libavutil/xtea.h +94 -0
- package/android/ffmpeg_16kb/include/libswresample/swresample.h +650 -0
- package/android/ffmpeg_16kb/include/libswresample/version.h +46 -0
- package/android/ffmpeg_16kb/include/libswresample/version_major.h +31 -0
- package/android/ffmpeg_16kb/include/libswscale/swscale.h +436 -0
- package/android/ffmpeg_16kb/include/libswscale/version.h +44 -0
- package/android/ffmpeg_16kb/include/libswscale/version_major.h +35 -0
- package/android/ffmpeg_16kb/lib/arm64-v8a/libavcodec.so +0 -0
- package/android/ffmpeg_16kb/lib/arm64-v8a/libavdevice.so +0 -0
- package/android/ffmpeg_16kb/lib/arm64-v8a/libavfilter.so +0 -0
- package/android/ffmpeg_16kb/lib/arm64-v8a/libavformat.so +0 -0
- package/android/ffmpeg_16kb/lib/arm64-v8a/libavutil.so +0 -0
- package/android/ffmpeg_16kb/lib/arm64-v8a/libswresample.so +0 -0
- package/android/ffmpeg_16kb/lib/arm64-v8a/libswscale.so +0 -0
- package/android/ffmpeg_16kb/lib/armeabi-v7a/libavcodec_neon.so +0 -0
- package/android/ffmpeg_16kb/lib/armeabi-v7a/libavdevice_neon.so +0 -0
- package/android/ffmpeg_16kb/lib/armeabi-v7a/libavfilter_neon.so +0 -0
- package/android/ffmpeg_16kb/lib/armeabi-v7a/libavformat_neon.so +0 -0
- package/android/ffmpeg_16kb/lib/armeabi-v7a/libavutil_neon.so +0 -0
- package/android/ffmpeg_16kb/lib/armeabi-v7a/libswresample_neon.so +0 -0
- package/android/ffmpeg_16kb/lib/armeabi-v7a/libswscale_neon.so +0 -0
- package/android/ffmpeg_16kb/lib/x86/libavcodec.so +0 -0
- package/android/ffmpeg_16kb/lib/x86/libavdevice.so +0 -0
- package/android/ffmpeg_16kb/lib/x86/libavfilter.so +0 -0
- package/android/ffmpeg_16kb/lib/x86/libavformat.so +0 -0
- package/android/ffmpeg_16kb/lib/x86/libavutil.so +0 -0
- package/android/ffmpeg_16kb/lib/x86/libswresample.so +0 -0
- package/android/ffmpeg_16kb/lib/x86/libswscale.so +0 -0
- package/android/ffmpeg_16kb/lib/x86_64/libavcodec.so +0 -0
- package/android/ffmpeg_16kb/lib/x86_64/libavdevice.so +0 -0
- package/android/ffmpeg_16kb/lib/x86_64/libavfilter.so +0 -0
- package/android/ffmpeg_16kb/lib/x86_64/libavformat.so +0 -0
- package/android/ffmpeg_16kb/lib/x86_64/libavutil.so +0 -0
- package/android/ffmpeg_16kb/lib/x86_64/libswresample.so +0 -0
- package/android/ffmpeg_16kb/lib/x86_64/libswscale.so +0 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/audioanalyzer/AmplitudeData.java +20 -0
- package/android/src/main/java/com/audioanalyzer/AudioAnalyzerModule.java +52 -0
- package/android/src/main/java/com/audioanalyzer/AudioAnalyzerPackage.java +28 -0
- package/cpp/react-native-audio-analyzer.cpp +143 -0
- package/cpp/react-native-audio-analyzer.h +27 -0
- package/ios/AudioAnalyzer.h +19 -0
- package/ios/AudioAnalyzer.mm +43 -0
- package/lib/commonjs/helpers.js +34 -0
- package/lib/commonjs/helpers.js.map +1 -0
- package/lib/commonjs/helpers.test.js +49 -0
- package/lib/commonjs/helpers.test.js.map +1 -0
- package/lib/commonjs/index.js +35 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/helpers.js +27 -0
- package/lib/module/helpers.js.map +1 -0
- package/lib/module/helpers.test.js +47 -0
- package/lib/module/helpers.test.js.map +1 -0
- package/lib/module/index.js +15 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/src/helpers.d.ts +3 -0
- package/lib/typescript/src/helpers.d.ts.map +1 -0
- package/lib/typescript/src/helpers.test.d.ts +2 -0
- package/lib/typescript/src/helpers.test.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +7 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +163 -0
- package/react-native-audio-analyzer.podspec +44 -0
- package/src/helpers.test.ts +59 -0
- package/src/helpers.ts +34 -0
- package/src/index.tsx +30 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
|
|
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
|
+
* @ingroup lavu_crc32
|
|
24
|
+
* Public header for CRC hash function implementation.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
#ifndef AVUTIL_CRC_H
|
|
28
|
+
#define AVUTIL_CRC_H
|
|
29
|
+
|
|
30
|
+
#include <stdint.h>
|
|
31
|
+
#include <stddef.h>
|
|
32
|
+
#include "attributes.h"
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @defgroup lavu_crc32 CRC
|
|
36
|
+
* @ingroup lavu_hash
|
|
37
|
+
* CRC (Cyclic Redundancy Check) hash function implementation.
|
|
38
|
+
*
|
|
39
|
+
* This module supports numerous CRC polynomials, in addition to the most
|
|
40
|
+
* widely used CRC-32-IEEE. See @ref AVCRCId for a list of available
|
|
41
|
+
* polynomials.
|
|
42
|
+
*
|
|
43
|
+
* @{
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
typedef uint32_t AVCRC;
|
|
47
|
+
|
|
48
|
+
typedef enum {
|
|
49
|
+
AV_CRC_8_ATM,
|
|
50
|
+
AV_CRC_16_ANSI,
|
|
51
|
+
AV_CRC_16_CCITT,
|
|
52
|
+
AV_CRC_32_IEEE,
|
|
53
|
+
AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */
|
|
54
|
+
AV_CRC_16_ANSI_LE, /*< reversed bitorder version of AV_CRC_16_ANSI */
|
|
55
|
+
AV_CRC_24_IEEE,
|
|
56
|
+
AV_CRC_8_EBU,
|
|
57
|
+
AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */
|
|
58
|
+
}AVCRCId;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Initialize a CRC table.
|
|
62
|
+
* @param ctx must be an array of size sizeof(AVCRC)*257 or sizeof(AVCRC)*1024
|
|
63
|
+
* @param le If 1, the lowest bit represents the coefficient for the highest
|
|
64
|
+
* exponent of the corresponding polynomial (both for poly and
|
|
65
|
+
* actual CRC).
|
|
66
|
+
* If 0, you must swap the CRC parameter and the result of av_crc
|
|
67
|
+
* if you need the standard representation (can be simplified in
|
|
68
|
+
* most cases to e.g. bswap16):
|
|
69
|
+
* av_bswap32(crc << (32-bits))
|
|
70
|
+
* @param bits number of bits for the CRC
|
|
71
|
+
* @param poly generator polynomial without the x**bits coefficient, in the
|
|
72
|
+
* representation as specified by le
|
|
73
|
+
* @param ctx_size size of ctx in bytes
|
|
74
|
+
* @return <0 on failure
|
|
75
|
+
*/
|
|
76
|
+
int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size);
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Get an initialized standard CRC table.
|
|
80
|
+
* @param crc_id ID of a standard CRC
|
|
81
|
+
* @return a pointer to the CRC table or NULL on failure
|
|
82
|
+
*/
|
|
83
|
+
const AVCRC *av_crc_get_table(AVCRCId crc_id);
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Calculate the CRC of a block.
|
|
87
|
+
* @param ctx initialized AVCRC array (see av_crc_init())
|
|
88
|
+
* @param crc CRC of previous blocks if any or initial value for CRC
|
|
89
|
+
* @param buffer buffer whose CRC to calculate
|
|
90
|
+
* @param length length of the buffer
|
|
91
|
+
* @return CRC updated with the data from the given block
|
|
92
|
+
*
|
|
93
|
+
* @see av_crc_init() "le" parameter
|
|
94
|
+
*/
|
|
95
|
+
uint32_t av_crc(const AVCRC *ctx, uint32_t crc,
|
|
96
|
+
const uint8_t *buffer, size_t length) av_pure;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @}
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
#endif /* AVUTIL_CRC_H */
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2015 Kevin Wheatley <kevin.j.wheatley@gmail.com>
|
|
3
|
+
* Copyright (c) 2016 Ronald S. Bultje <rsbultje@gmail.com>
|
|
4
|
+
* Copyright (c) 2023 Leo Izen <leo.izen@gmail.com>
|
|
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 AVUTIL_CSP_H
|
|
24
|
+
#define AVUTIL_CSP_H
|
|
25
|
+
|
|
26
|
+
#include "pixfmt.h"
|
|
27
|
+
#include "rational.h"
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @file
|
|
31
|
+
* Colorspace value utility functions for libavutil.
|
|
32
|
+
* @ingroup lavu_math_csp
|
|
33
|
+
* @author Ronald S. Bultje <rsbultje@gmail.com>
|
|
34
|
+
* @author Leo Izen <leo.izen@gmail.com>
|
|
35
|
+
* @author Kevin Wheatley <kevin.j.wheatley@gmail.com>
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @defgroup lavu_math_csp Colorspace Utility
|
|
40
|
+
* @ingroup lavu_math
|
|
41
|
+
* @{
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Struct containing luma coefficients to be used for RGB to YUV/YCoCg, or similar
|
|
46
|
+
* calculations.
|
|
47
|
+
*/
|
|
48
|
+
typedef struct AVLumaCoefficients {
|
|
49
|
+
AVRational cr, cg, cb;
|
|
50
|
+
} AVLumaCoefficients;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Struct containing chromaticity x and y values for the standard CIE 1931
|
|
54
|
+
* chromaticity definition.
|
|
55
|
+
*/
|
|
56
|
+
typedef struct AVCIExy {
|
|
57
|
+
AVRational x, y;
|
|
58
|
+
} AVCIExy;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Struct defining the red, green, and blue primary locations in terms of CIE
|
|
62
|
+
* 1931 chromaticity x and y.
|
|
63
|
+
*/
|
|
64
|
+
typedef struct AVPrimaryCoefficients {
|
|
65
|
+
AVCIExy r, g, b;
|
|
66
|
+
} AVPrimaryCoefficients;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Struct defining white point location in terms of CIE 1931 chromaticity x
|
|
70
|
+
* and y.
|
|
71
|
+
*/
|
|
72
|
+
typedef AVCIExy AVWhitepointCoefficients;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Struct that contains both white point location and primaries location, providing
|
|
76
|
+
* the complete description of a color gamut.
|
|
77
|
+
*/
|
|
78
|
+
typedef struct AVColorPrimariesDesc {
|
|
79
|
+
AVWhitepointCoefficients wp;
|
|
80
|
+
AVPrimaryCoefficients prim;
|
|
81
|
+
} AVColorPrimariesDesc;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Function pointer representing a double -> double transfer function that performs
|
|
85
|
+
* an EOTF transfer inversion. This function outputs linear light.
|
|
86
|
+
*/
|
|
87
|
+
typedef double (*av_csp_trc_function)(double);
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Retrieves the Luma coefficients necessary to construct a conversion matrix
|
|
91
|
+
* from an enum constant describing the colorspace.
|
|
92
|
+
* @param csp An enum constant indicating YUV or similar colorspace.
|
|
93
|
+
* @return The Luma coefficients associated with that colorspace, or NULL
|
|
94
|
+
* if the constant is unknown to libavutil.
|
|
95
|
+
*/
|
|
96
|
+
const AVLumaCoefficients *av_csp_luma_coeffs_from_avcsp(enum AVColorSpace csp);
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Retrieves a complete gamut description from an enum constant describing the
|
|
100
|
+
* color primaries.
|
|
101
|
+
* @param prm An enum constant indicating primaries
|
|
102
|
+
* @return A description of the colorspace gamut associated with that enum
|
|
103
|
+
* constant, or NULL if the constant is unknown to libavutil.
|
|
104
|
+
*/
|
|
105
|
+
const AVColorPrimariesDesc *av_csp_primaries_desc_from_id(enum AVColorPrimaries prm);
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Detects which enum AVColorPrimaries constant corresponds to the given complete
|
|
109
|
+
* gamut description.
|
|
110
|
+
* @see enum AVColorPrimaries
|
|
111
|
+
* @param prm A description of the colorspace gamut
|
|
112
|
+
* @return The enum constant associated with this gamut, or
|
|
113
|
+
* AVCOL_PRI_UNSPECIFIED if no clear match can be idenitified.
|
|
114
|
+
*/
|
|
115
|
+
enum AVColorPrimaries av_csp_primaries_id_from_desc(const AVColorPrimariesDesc *prm);
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Determine a suitable 'gamma' value to match the supplied
|
|
119
|
+
* AVColorTransferCharacteristic.
|
|
120
|
+
*
|
|
121
|
+
* See Apple Technical Note TN2257 (https://developer.apple.com/library/mac/technotes/tn2257/_index.html)
|
|
122
|
+
*
|
|
123
|
+
* This function returns the gamma exponent for the OETF. For example, sRGB is approximated
|
|
124
|
+
* by gamma 2.2, not by gamma 0.45455.
|
|
125
|
+
*
|
|
126
|
+
* @return Will return an approximation to the simple gamma function matching
|
|
127
|
+
* the supplied Transfer Characteristic, Will return 0.0 for any
|
|
128
|
+
* we cannot reasonably match against.
|
|
129
|
+
*/
|
|
130
|
+
double av_csp_approximate_trc_gamma(enum AVColorTransferCharacteristic trc);
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Determine the function needed to apply the given
|
|
134
|
+
* AVColorTransferCharacteristic to linear input.
|
|
135
|
+
*
|
|
136
|
+
* The function returned should expect a nominal domain and range of [0.0-1.0]
|
|
137
|
+
* values outside of this range maybe valid depending on the chosen
|
|
138
|
+
* characteristic function.
|
|
139
|
+
*
|
|
140
|
+
* @return Will return pointer to the function matching the
|
|
141
|
+
* supplied Transfer Characteristic. If unspecified will
|
|
142
|
+
* return NULL:
|
|
143
|
+
*/
|
|
144
|
+
av_csp_trc_function av_csp_trc_func_from_id(enum AVColorTransferCharacteristic trc);
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* @}
|
|
148
|
+
*/
|
|
149
|
+
|
|
150
|
+
#endif /* AVUTIL_CSP_H */
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* DES encryption/decryption
|
|
3
|
+
* Copyright (c) 2007 Reimar Doeffinger
|
|
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_DES_H
|
|
23
|
+
#define AVUTIL_DES_H
|
|
24
|
+
|
|
25
|
+
#include <stdint.h>
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @defgroup lavu_des DES
|
|
29
|
+
* @ingroup lavu_crypto
|
|
30
|
+
* @{
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
typedef struct AVDES {
|
|
34
|
+
uint64_t round_keys[3][16];
|
|
35
|
+
int triple_des;
|
|
36
|
+
} AVDES;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Allocate an AVDES context.
|
|
40
|
+
*/
|
|
41
|
+
AVDES *av_des_alloc(void);
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @brief Initializes an AVDES context.
|
|
45
|
+
*
|
|
46
|
+
* @param d pointer to a AVDES structure to initialize
|
|
47
|
+
* @param key pointer to the key to use
|
|
48
|
+
* @param key_bits must be 64 or 192
|
|
49
|
+
* @param decrypt 0 for encryption/CBC-MAC, 1 for decryption
|
|
50
|
+
* @return zero on success, negative value otherwise
|
|
51
|
+
*/
|
|
52
|
+
int av_des_init(struct AVDES *d, const uint8_t *key, int key_bits, int decrypt);
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @brief Encrypts / decrypts using the DES algorithm.
|
|
56
|
+
*
|
|
57
|
+
* @param d pointer to the AVDES structure
|
|
58
|
+
* @param dst destination array, can be equal to src, must be 8-byte aligned
|
|
59
|
+
* @param src source array, can be equal to dst, must be 8-byte aligned, may be NULL
|
|
60
|
+
* @param count number of 8 byte blocks
|
|
61
|
+
* @param iv initialization vector for CBC mode, if NULL then ECB will be used,
|
|
62
|
+
* must be 8-byte aligned
|
|
63
|
+
* @param decrypt 0 for encryption, 1 for decryption
|
|
64
|
+
*/
|
|
65
|
+
void av_des_crypt(struct AVDES *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt);
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* @brief Calculates CBC-MAC using the DES algorithm.
|
|
69
|
+
*
|
|
70
|
+
* @param d pointer to the AVDES structure
|
|
71
|
+
* @param dst destination array, can be equal to src, must be 8-byte aligned
|
|
72
|
+
* @param src source array, can be equal to dst, must be 8-byte aligned, may be NULL
|
|
73
|
+
* @param count number of 8 byte blocks
|
|
74
|
+
*/
|
|
75
|
+
void av_des_mac(struct AVDES *d, uint8_t *dst, const uint8_t *src, int count);
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* @}
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
#endif /* AVUTIL_DES_H */
|
|
@@ -0,0 +1,108 @@
|
|
|
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_DETECTION_BBOX_H
|
|
20
|
+
#define AVUTIL_DETECTION_BBOX_H
|
|
21
|
+
|
|
22
|
+
#include "rational.h"
|
|
23
|
+
#include "avassert.h"
|
|
24
|
+
#include "frame.h"
|
|
25
|
+
|
|
26
|
+
typedef struct AVDetectionBBox {
|
|
27
|
+
/**
|
|
28
|
+
* Distance in pixels from the left/top edge of the frame,
|
|
29
|
+
* together with width and height, defining the bounding box.
|
|
30
|
+
*/
|
|
31
|
+
int x;
|
|
32
|
+
int y;
|
|
33
|
+
int w;
|
|
34
|
+
int h;
|
|
35
|
+
|
|
36
|
+
#define AV_DETECTION_BBOX_LABEL_NAME_MAX_SIZE 64
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Detect result with confidence
|
|
40
|
+
*/
|
|
41
|
+
char detect_label[AV_DETECTION_BBOX_LABEL_NAME_MAX_SIZE];
|
|
42
|
+
AVRational detect_confidence;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* At most 4 classifications based on the detected bounding box.
|
|
46
|
+
* For example, we can get max 4 different attributes with 4 different
|
|
47
|
+
* DNN models on one bounding box.
|
|
48
|
+
* classify_count is zero if no classification.
|
|
49
|
+
*/
|
|
50
|
+
#define AV_NUM_DETECTION_BBOX_CLASSIFY 4
|
|
51
|
+
uint32_t classify_count;
|
|
52
|
+
char classify_labels[AV_NUM_DETECTION_BBOX_CLASSIFY][AV_DETECTION_BBOX_LABEL_NAME_MAX_SIZE];
|
|
53
|
+
AVRational classify_confidences[AV_NUM_DETECTION_BBOX_CLASSIFY];
|
|
54
|
+
} AVDetectionBBox;
|
|
55
|
+
|
|
56
|
+
typedef struct AVDetectionBBoxHeader {
|
|
57
|
+
/**
|
|
58
|
+
* Information about how the bounding box is generated.
|
|
59
|
+
* for example, the DNN model name.
|
|
60
|
+
*/
|
|
61
|
+
char source[256];
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Number of bounding boxes in the array.
|
|
65
|
+
*/
|
|
66
|
+
uint32_t nb_bboxes;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Offset in bytes from the beginning of this structure at which
|
|
70
|
+
* the array of bounding boxes starts.
|
|
71
|
+
*/
|
|
72
|
+
size_t bboxes_offset;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Size of each bounding box in bytes.
|
|
76
|
+
*/
|
|
77
|
+
size_t bbox_size;
|
|
78
|
+
} AVDetectionBBoxHeader;
|
|
79
|
+
|
|
80
|
+
/*
|
|
81
|
+
* Get the bounding box at the specified {@code idx}. Must be between 0 and nb_bboxes.
|
|
82
|
+
*/
|
|
83
|
+
static av_always_inline AVDetectionBBox *
|
|
84
|
+
av_get_detection_bbox(const AVDetectionBBoxHeader *header, unsigned int idx)
|
|
85
|
+
{
|
|
86
|
+
av_assert0(idx < header->nb_bboxes);
|
|
87
|
+
return (AVDetectionBBox *)((uint8_t *)header + header->bboxes_offset +
|
|
88
|
+
idx * header->bbox_size);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Allocates memory for AVDetectionBBoxHeader, plus an array of {@code nb_bboxes}
|
|
93
|
+
* AVDetectionBBox, and initializes the variables.
|
|
94
|
+
* Can be freed with a normal av_free() call.
|
|
95
|
+
*
|
|
96
|
+
* @param nb_bboxes number of AVDetectionBBox structures to allocate
|
|
97
|
+
* @param out_size if non-NULL, the size in bytes of the resulting data array is
|
|
98
|
+
* written here.
|
|
99
|
+
*/
|
|
100
|
+
AVDetectionBBoxHeader *av_detection_bbox_alloc(uint32_t nb_bboxes, size_t *out_size);
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Allocates memory for AVDetectionBBoxHeader, plus an array of {@code nb_bboxes}
|
|
104
|
+
* AVDetectionBBox, in the given AVFrame {@code frame} as AVFrameSideData of type
|
|
105
|
+
* AV_FRAME_DATA_DETECTION_BBOXES and initializes the variables.
|
|
106
|
+
*/
|
|
107
|
+
AVDetectionBBoxHeader *av_detection_bbox_create_side_data(AVFrame *frame, uint32_t nb_bboxes);
|
|
108
|
+
#endif
|
|
@@ -0,0 +1,241 @@
|
|
|
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
|
+
* Public dictionary API.
|
|
22
|
+
* @deprecated
|
|
23
|
+
* AVDictionary is provided for compatibility with libav. It is both in
|
|
24
|
+
* implementation as well as API inefficient. It does not scale and is
|
|
25
|
+
* extremely slow with large dictionaries.
|
|
26
|
+
* It is recommended that new code uses our tree container from tree.c/h
|
|
27
|
+
* where applicable, which uses AVL trees to achieve O(log n) performance.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
#ifndef AVUTIL_DICT_H
|
|
31
|
+
#define AVUTIL_DICT_H
|
|
32
|
+
|
|
33
|
+
#include <stdint.h>
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @addtogroup lavu_dict AVDictionary
|
|
37
|
+
* @ingroup lavu_data
|
|
38
|
+
*
|
|
39
|
+
* @brief Simple key:value store
|
|
40
|
+
*
|
|
41
|
+
* @{
|
|
42
|
+
* Dictionaries are used for storing key-value pairs.
|
|
43
|
+
*
|
|
44
|
+
* - To **create an AVDictionary**, simply pass an address of a NULL
|
|
45
|
+
* pointer to av_dict_set(). NULL can be used as an empty dictionary
|
|
46
|
+
* wherever a pointer to an AVDictionary is required.
|
|
47
|
+
* - To **insert an entry**, use av_dict_set().
|
|
48
|
+
* - Use av_dict_get() to **retrieve an entry**.
|
|
49
|
+
* - To **iterate over all entries**, use av_dict_iterate().
|
|
50
|
+
* - In order to **free the dictionary and all its contents**, use av_dict_free().
|
|
51
|
+
*
|
|
52
|
+
@code
|
|
53
|
+
AVDictionary *d = NULL; // "create" an empty dictionary
|
|
54
|
+
AVDictionaryEntry *t = NULL;
|
|
55
|
+
|
|
56
|
+
av_dict_set(&d, "foo", "bar", 0); // add an entry
|
|
57
|
+
|
|
58
|
+
char *k = av_strdup("key"); // if your strings are already allocated,
|
|
59
|
+
char *v = av_strdup("value"); // you can avoid copying them like this
|
|
60
|
+
av_dict_set(&d, k, v, AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL);
|
|
61
|
+
|
|
62
|
+
while ((t = av_dict_iterate(d, t))) {
|
|
63
|
+
<....> // iterate over all entries in d
|
|
64
|
+
}
|
|
65
|
+
av_dict_free(&d);
|
|
66
|
+
@endcode
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @name AVDictionary Flags
|
|
71
|
+
* Flags that influence behavior of the matching of keys or insertion to the dictionary.
|
|
72
|
+
* @{
|
|
73
|
+
*/
|
|
74
|
+
#define AV_DICT_MATCH_CASE 1 /**< Only get an entry with exact-case key match. Only relevant in av_dict_get(). */
|
|
75
|
+
#define AV_DICT_IGNORE_SUFFIX 2 /**< Return first entry in a dictionary whose first part corresponds to the search key,
|
|
76
|
+
ignoring the suffix of the found key string. Only relevant in av_dict_get(). */
|
|
77
|
+
#define AV_DICT_DONT_STRDUP_KEY 4 /**< Take ownership of a key that's been
|
|
78
|
+
allocated with av_malloc() or another memory allocation function. */
|
|
79
|
+
#define AV_DICT_DONT_STRDUP_VAL 8 /**< Take ownership of a value that's been
|
|
80
|
+
allocated with av_malloc() or another memory allocation function. */
|
|
81
|
+
#define AV_DICT_DONT_OVERWRITE 16 /**< Don't overwrite existing entries. */
|
|
82
|
+
#define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no
|
|
83
|
+
delimiter is added, the strings are simply concatenated. */
|
|
84
|
+
#define AV_DICT_MULTIKEY 64 /**< Allow to store several equal keys in the dictionary */
|
|
85
|
+
/**
|
|
86
|
+
* @}
|
|
87
|
+
*/
|
|
88
|
+
|
|
89
|
+
typedef struct AVDictionaryEntry {
|
|
90
|
+
char *key;
|
|
91
|
+
char *value;
|
|
92
|
+
} AVDictionaryEntry;
|
|
93
|
+
|
|
94
|
+
typedef struct AVDictionary AVDictionary;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Get a dictionary entry with matching key.
|
|
98
|
+
*
|
|
99
|
+
* The returned entry key or value must not be changed, or it will
|
|
100
|
+
* cause undefined behavior.
|
|
101
|
+
*
|
|
102
|
+
* @param prev Set to the previous matching element to find the next.
|
|
103
|
+
* If set to NULL the first matching element is returned.
|
|
104
|
+
* @param key Matching key
|
|
105
|
+
* @param flags A collection of AV_DICT_* flags controlling how the
|
|
106
|
+
* entry is retrieved
|
|
107
|
+
*
|
|
108
|
+
* @return Found entry or NULL in case no matching entry was found in the dictionary
|
|
109
|
+
*/
|
|
110
|
+
AVDictionaryEntry *av_dict_get(const AVDictionary *m, const char *key,
|
|
111
|
+
const AVDictionaryEntry *prev, int flags);
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Iterate over a dictionary
|
|
115
|
+
*
|
|
116
|
+
* Iterates through all entries in the dictionary.
|
|
117
|
+
*
|
|
118
|
+
* @warning The returned AVDictionaryEntry key/value must not be changed.
|
|
119
|
+
*
|
|
120
|
+
* @warning As av_dict_set() invalidates all previous entries returned
|
|
121
|
+
* by this function, it must not be called while iterating over the dict.
|
|
122
|
+
*
|
|
123
|
+
* Typical usage:
|
|
124
|
+
* @code
|
|
125
|
+
* const AVDictionaryEntry *e = NULL;
|
|
126
|
+
* while ((e = av_dict_iterate(m, e))) {
|
|
127
|
+
* // ...
|
|
128
|
+
* }
|
|
129
|
+
* @endcode
|
|
130
|
+
*
|
|
131
|
+
* @param m The dictionary to iterate over
|
|
132
|
+
* @param prev Pointer to the previous AVDictionaryEntry, NULL initially
|
|
133
|
+
*
|
|
134
|
+
* @retval AVDictionaryEntry* The next element in the dictionary
|
|
135
|
+
* @retval NULL No more elements in the dictionary
|
|
136
|
+
*/
|
|
137
|
+
const AVDictionaryEntry *av_dict_iterate(const AVDictionary *m,
|
|
138
|
+
const AVDictionaryEntry *prev);
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Get number of entries in dictionary.
|
|
142
|
+
*
|
|
143
|
+
* @param m dictionary
|
|
144
|
+
* @return number of entries in dictionary
|
|
145
|
+
*/
|
|
146
|
+
int av_dict_count(const AVDictionary *m);
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Set the given entry in *pm, overwriting an existing entry.
|
|
150
|
+
*
|
|
151
|
+
* Note: If AV_DICT_DONT_STRDUP_KEY or AV_DICT_DONT_STRDUP_VAL is set,
|
|
152
|
+
* these arguments will be freed on error.
|
|
153
|
+
*
|
|
154
|
+
* @warning Adding a new entry to a dictionary invalidates all existing entries
|
|
155
|
+
* previously returned with av_dict_get() or av_dict_iterate().
|
|
156
|
+
*
|
|
157
|
+
* @param pm Pointer to a pointer to a dictionary struct. If *pm is NULL
|
|
158
|
+
* a dictionary struct is allocated and put in *pm.
|
|
159
|
+
* @param key Entry key to add to *pm (will either be av_strduped or added as a new key depending on flags)
|
|
160
|
+
* @param value Entry value to add to *pm (will be av_strduped or added as a new key depending on flags).
|
|
161
|
+
* Passing a NULL value will cause an existing entry to be deleted.
|
|
162
|
+
*
|
|
163
|
+
* @return >= 0 on success otherwise an error code <0
|
|
164
|
+
*/
|
|
165
|
+
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags);
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Convenience wrapper for av_dict_set() that converts the value to a string
|
|
169
|
+
* and stores it.
|
|
170
|
+
*
|
|
171
|
+
* Note: If ::AV_DICT_DONT_STRDUP_KEY is set, key will be freed on error.
|
|
172
|
+
*/
|
|
173
|
+
int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags);
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Parse the key/value pairs list and add the parsed entries to a dictionary.
|
|
177
|
+
*
|
|
178
|
+
* In case of failure, all the successfully set entries are stored in
|
|
179
|
+
* *pm. You may need to manually free the created dictionary.
|
|
180
|
+
*
|
|
181
|
+
* @param key_val_sep A 0-terminated list of characters used to separate
|
|
182
|
+
* key from value
|
|
183
|
+
* @param pairs_sep A 0-terminated list of characters used to separate
|
|
184
|
+
* two pairs from each other
|
|
185
|
+
* @param flags Flags to use when adding to the dictionary.
|
|
186
|
+
* ::AV_DICT_DONT_STRDUP_KEY and ::AV_DICT_DONT_STRDUP_VAL
|
|
187
|
+
* are ignored since the key/value tokens will always
|
|
188
|
+
* be duplicated.
|
|
189
|
+
*
|
|
190
|
+
* @return 0 on success, negative AVERROR code on failure
|
|
191
|
+
*/
|
|
192
|
+
int av_dict_parse_string(AVDictionary **pm, const char *str,
|
|
193
|
+
const char *key_val_sep, const char *pairs_sep,
|
|
194
|
+
int flags);
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Copy entries from one AVDictionary struct into another.
|
|
198
|
+
*
|
|
199
|
+
* @note Metadata is read using the ::AV_DICT_IGNORE_SUFFIX flag
|
|
200
|
+
*
|
|
201
|
+
* @param dst Pointer to a pointer to a AVDictionary struct to copy into. If *dst is NULL,
|
|
202
|
+
* this function will allocate a struct for you and put it in *dst
|
|
203
|
+
* @param src Pointer to the source AVDictionary struct to copy items from.
|
|
204
|
+
* @param flags Flags to use when setting entries in *dst
|
|
205
|
+
*
|
|
206
|
+
* @return 0 on success, negative AVERROR code on failure. If dst was allocated
|
|
207
|
+
* by this function, callers should free the associated memory.
|
|
208
|
+
*/
|
|
209
|
+
int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags);
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Free all the memory allocated for an AVDictionary struct
|
|
213
|
+
* and all keys and values.
|
|
214
|
+
*/
|
|
215
|
+
void av_dict_free(AVDictionary **m);
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Get dictionary entries as a string.
|
|
219
|
+
*
|
|
220
|
+
* Create a string containing dictionary's entries.
|
|
221
|
+
* Such string may be passed back to av_dict_parse_string().
|
|
222
|
+
* @note String is escaped with backslashes ('\').
|
|
223
|
+
*
|
|
224
|
+
* @warning Separators cannot be neither '\\' nor '\0'. They also cannot be the same.
|
|
225
|
+
*
|
|
226
|
+
* @param[in] m The dictionary
|
|
227
|
+
* @param[out] buffer Pointer to buffer that will be allocated with string containg entries.
|
|
228
|
+
* Buffer must be freed by the caller when is no longer needed.
|
|
229
|
+
* @param[in] key_val_sep Character used to separate key from value
|
|
230
|
+
* @param[in] pairs_sep Character used to separate two pairs from each other
|
|
231
|
+
*
|
|
232
|
+
* @return >= 0 on success, negative on error
|
|
233
|
+
*/
|
|
234
|
+
int av_dict_get_string(const AVDictionary *m, char **buffer,
|
|
235
|
+
const char key_val_sep, const char pairs_sep);
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* @}
|
|
239
|
+
*/
|
|
240
|
+
|
|
241
|
+
#endif /* AVUTIL_DICT_H */
|