@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.
Files changed (223) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +124 -0
  3. package/android/CMakeCache.txt +372 -0
  4. package/android/CMakeLists.txt +44 -0
  5. package/android/Makefile +211 -0
  6. package/android/build.gradle +110 -0
  7. package/android/cmake_install.cmake +49 -0
  8. package/android/cpp-adapter.cpp +40 -0
  9. package/android/ffmpeg_16kb/include/config.h +749 -0
  10. package/android/ffmpeg_16kb/include/libavcodec/ac3_parser.h +36 -0
  11. package/android/ffmpeg_16kb/include/libavcodec/adts_parser.h +37 -0
  12. package/android/ffmpeg_16kb/include/libavcodec/arm/mathops.h +108 -0
  13. package/android/ffmpeg_16kb/include/libavcodec/avcodec.h +3192 -0
  14. package/android/ffmpeg_16kb/include/libavcodec/avdct.h +88 -0
  15. package/android/ffmpeg_16kb/include/libavcodec/avfft.h +118 -0
  16. package/android/ffmpeg_16kb/include/libavcodec/bsf.h +332 -0
  17. package/android/ffmpeg_16kb/include/libavcodec/codec.h +375 -0
  18. package/android/ffmpeg_16kb/include/libavcodec/codec_desc.h +128 -0
  19. package/android/ffmpeg_16kb/include/libavcodec/codec_id.h +661 -0
  20. package/android/ffmpeg_16kb/include/libavcodec/codec_par.h +247 -0
  21. package/android/ffmpeg_16kb/include/libavcodec/d3d11va.h +112 -0
  22. package/android/ffmpeg_16kb/include/libavcodec/defs.h +192 -0
  23. package/android/ffmpeg_16kb/include/libavcodec/dirac.h +131 -0
  24. package/android/ffmpeg_16kb/include/libavcodec/dv_profile.h +82 -0
  25. package/android/ffmpeg_16kb/include/libavcodec/dxva2.h +93 -0
  26. package/android/ffmpeg_16kb/include/libavcodec/jni.h +46 -0
  27. package/android/ffmpeg_16kb/include/libavcodec/mathops.h +255 -0
  28. package/android/ffmpeg_16kb/include/libavcodec/mediacodec.h +103 -0
  29. package/android/ffmpeg_16kb/include/libavcodec/packet.h +731 -0
  30. package/android/ffmpeg_16kb/include/libavcodec/qsv.h +109 -0
  31. package/android/ffmpeg_16kb/include/libavcodec/vdpau.h +157 -0
  32. package/android/ffmpeg_16kb/include/libavcodec/version.h +45 -0
  33. package/android/ffmpeg_16kb/include/libavcodec/version_major.h +52 -0
  34. package/android/ffmpeg_16kb/include/libavcodec/videotoolbox.h +150 -0
  35. package/android/ffmpeg_16kb/include/libavcodec/vorbis_parser.h +74 -0
  36. package/android/ffmpeg_16kb/include/libavcodec/x86/mathops.h +133 -0
  37. package/android/ffmpeg_16kb/include/libavcodec/xvmc.h +171 -0
  38. package/android/ffmpeg_16kb/include/libavdevice/avdevice.h +397 -0
  39. package/android/ffmpeg_16kb/include/libavdevice/version.h +45 -0
  40. package/android/ffmpeg_16kb/include/libavdevice/version_major.h +36 -0
  41. package/android/ffmpeg_16kb/include/libavfilter/avfilter.h +1491 -0
  42. package/android/ffmpeg_16kb/include/libavfilter/buffersink.h +173 -0
  43. package/android/ffmpeg_16kb/include/libavfilter/buffersrc.h +218 -0
  44. package/android/ffmpeg_16kb/include/libavfilter/version.h +48 -0
  45. package/android/ffmpeg_16kb/include/libavfilter/version_major.h +38 -0
  46. package/android/ffmpeg_16kb/include/libavformat/avformat.h +2826 -0
  47. package/android/ffmpeg_16kb/include/libavformat/avio.h +837 -0
  48. package/android/ffmpeg_16kb/include/libavformat/network.h +341 -0
  49. package/android/ffmpeg_16kb/include/libavformat/os_support.h +317 -0
  50. package/android/ffmpeg_16kb/include/libavformat/url.h +409 -0
  51. package/android/ffmpeg_16kb/include/libavformat/version.h +47 -0
  52. package/android/ffmpeg_16kb/include/libavformat/version_major.h +52 -0
  53. package/android/ffmpeg_16kb/include/libavutil/aarch64/timer.h +50 -0
  54. package/android/ffmpeg_16kb/include/libavutil/adler32.h +63 -0
  55. package/android/ffmpeg_16kb/include/libavutil/aes.h +69 -0
  56. package/android/ffmpeg_16kb/include/libavutil/aes_ctr.h +99 -0
  57. package/android/ffmpeg_16kb/include/libavutil/ambient_viewing_environment.h +72 -0
  58. package/android/ffmpeg_16kb/include/libavutil/arm/timer.h +46 -0
  59. package/android/ffmpeg_16kb/include/libavutil/attributes.h +173 -0
  60. package/android/ffmpeg_16kb/include/libavutil/attributes_internal.h +34 -0
  61. package/android/ffmpeg_16kb/include/libavutil/audio_fifo.h +186 -0
  62. package/android/ffmpeg_16kb/include/libavutil/avassert.h +75 -0
  63. package/android/ffmpeg_16kb/include/libavutil/avconfig.h +6 -0
  64. package/android/ffmpeg_16kb/include/libavutil/avstring.h +429 -0
  65. package/android/ffmpeg_16kb/include/libavutil/avutil.h +371 -0
  66. package/android/ffmpeg_16kb/include/libavutil/base64.h +72 -0
  67. package/android/ffmpeg_16kb/include/libavutil/blowfish.h +82 -0
  68. package/android/ffmpeg_16kb/include/libavutil/bprint.h +251 -0
  69. package/android/ffmpeg_16kb/include/libavutil/bswap.h +111 -0
  70. package/android/ffmpeg_16kb/include/libavutil/buffer.h +322 -0
  71. package/android/ffmpeg_16kb/include/libavutil/camellia.h +70 -0
  72. package/android/ffmpeg_16kb/include/libavutil/cast5.h +80 -0
  73. package/android/ffmpeg_16kb/include/libavutil/channel_layout.h +783 -0
  74. package/android/ffmpeg_16kb/include/libavutil/common.h +578 -0
  75. package/android/ffmpeg_16kb/include/libavutil/cpu.h +134 -0
  76. package/android/ffmpeg_16kb/include/libavutil/crc.h +102 -0
  77. package/android/ffmpeg_16kb/include/libavutil/csp.h +150 -0
  78. package/android/ffmpeg_16kb/include/libavutil/des.h +81 -0
  79. package/android/ffmpeg_16kb/include/libavutil/detection_bbox.h +108 -0
  80. package/android/ffmpeg_16kb/include/libavutil/dict.h +241 -0
  81. package/android/ffmpeg_16kb/include/libavutil/display.h +109 -0
  82. package/android/ffmpeg_16kb/include/libavutil/dovi_meta.h +236 -0
  83. package/android/ffmpeg_16kb/include/libavutil/downmix_info.h +115 -0
  84. package/android/ffmpeg_16kb/include/libavutil/encryption_info.h +205 -0
  85. package/android/ffmpeg_16kb/include/libavutil/error.h +128 -0
  86. package/android/ffmpeg_16kb/include/libavutil/eval.h +140 -0
  87. package/android/ffmpeg_16kb/include/libavutil/ffversion.h +5 -0
  88. package/android/ffmpeg_16kb/include/libavutil/fifo.h +448 -0
  89. package/android/ffmpeg_16kb/include/libavutil/file.h +115 -0
  90. package/android/ffmpeg_16kb/include/libavutil/film_grain_params.h +260 -0
  91. package/android/ffmpeg_16kb/include/libavutil/frame.h +964 -0
  92. package/android/ffmpeg_16kb/include/libavutil/getenv_utf8.h +86 -0
  93. package/android/ffmpeg_16kb/include/libavutil/hash.h +264 -0
  94. package/android/ffmpeg_16kb/include/libavutil/hdr_dynamic_metadata.h +343 -0
  95. package/android/ffmpeg_16kb/include/libavutil/hdr_dynamic_vivid_metadata.h +285 -0
  96. package/android/ffmpeg_16kb/include/libavutil/hmac.h +99 -0
  97. package/android/ffmpeg_16kb/include/libavutil/hwcontext.h +610 -0
  98. package/android/ffmpeg_16kb/include/libavutil/hwcontext_cuda.h +69 -0
  99. package/android/ffmpeg_16kb/include/libavutil/hwcontext_d3d11va.h +178 -0
  100. package/android/ffmpeg_16kb/include/libavutil/hwcontext_drm.h +169 -0
  101. package/android/ffmpeg_16kb/include/libavutil/hwcontext_dxva2.h +75 -0
  102. package/android/ffmpeg_16kb/include/libavutil/hwcontext_mediacodec.h +61 -0
  103. package/android/ffmpeg_16kb/include/libavutil/hwcontext_opencl.h +100 -0
  104. package/android/ffmpeg_16kb/include/libavutil/hwcontext_qsv.h +64 -0
  105. package/android/ffmpeg_16kb/include/libavutil/hwcontext_vaapi.h +117 -0
  106. package/android/ffmpeg_16kb/include/libavutil/hwcontext_vdpau.h +44 -0
  107. package/android/ffmpeg_16kb/include/libavutil/hwcontext_videotoolbox.h +96 -0
  108. package/android/ffmpeg_16kb/include/libavutil/hwcontext_vulkan.h +281 -0
  109. package/android/ffmpeg_16kb/include/libavutil/imgutils.h +331 -0
  110. package/android/ffmpeg_16kb/include/libavutil/internal.h +190 -0
  111. package/android/ffmpeg_16kb/include/libavutil/intfloat.h +77 -0
  112. package/android/ffmpeg_16kb/include/libavutil/intreadwrite.h +644 -0
  113. package/android/ffmpeg_16kb/include/libavutil/lfg.h +81 -0
  114. package/android/ffmpeg_16kb/include/libavutil/libm.h +471 -0
  115. package/android/ffmpeg_16kb/include/libavutil/log.h +387 -0
  116. package/android/ffmpeg_16kb/include/libavutil/lzo.h +66 -0
  117. package/android/ffmpeg_16kb/include/libavutil/macros.h +80 -0
  118. package/android/ffmpeg_16kb/include/libavutil/mastering_display_metadata.h +128 -0
  119. package/android/ffmpeg_16kb/include/libavutil/mathematics.h +245 -0
  120. package/android/ffmpeg_16kb/include/libavutil/md5.h +89 -0
  121. package/android/ffmpeg_16kb/include/libavutil/mem.h +609 -0
  122. package/android/ffmpeg_16kb/include/libavutil/motion_vector.h +57 -0
  123. package/android/ffmpeg_16kb/include/libavutil/murmur3.h +115 -0
  124. package/android/ffmpeg_16kb/include/libavutil/opt.h +891 -0
  125. package/android/ffmpeg_16kb/include/libavutil/parseutils.h +197 -0
  126. package/android/ffmpeg_16kb/include/libavutil/pixdesc.h +435 -0
  127. package/android/ffmpeg_16kb/include/libavutil/pixelutils.h +51 -0
  128. package/android/ffmpeg_16kb/include/libavutil/pixfmt.h +691 -0
  129. package/android/ffmpeg_16kb/include/libavutil/random_seed.h +43 -0
  130. package/android/ffmpeg_16kb/include/libavutil/rational.h +221 -0
  131. package/android/ffmpeg_16kb/include/libavutil/rc4.h +69 -0
  132. package/android/ffmpeg_16kb/include/libavutil/replaygain.h +50 -0
  133. package/android/ffmpeg_16kb/include/libavutil/reverse.h +28 -0
  134. package/android/ffmpeg_16kb/include/libavutil/ripemd.h +83 -0
  135. package/android/ffmpeg_16kb/include/libavutil/samplefmt.h +269 -0
  136. package/android/ffmpeg_16kb/include/libavutil/sha.h +90 -0
  137. package/android/ffmpeg_16kb/include/libavutil/sha512.h +92 -0
  138. package/android/ffmpeg_16kb/include/libavutil/spherical.h +227 -0
  139. package/android/ffmpeg_16kb/include/libavutil/stereo3d.h +229 -0
  140. package/android/ffmpeg_16kb/include/libavutil/tea.h +71 -0
  141. package/android/ffmpeg_16kb/include/libavutil/thread.h +204 -0
  142. package/android/ffmpeg_16kb/include/libavutil/threadmessage.h +115 -0
  143. package/android/ffmpeg_16kb/include/libavutil/time.h +56 -0
  144. package/android/ffmpeg_16kb/include/libavutil/timecode.h +199 -0
  145. package/android/ffmpeg_16kb/include/libavutil/timer.h +156 -0
  146. package/android/ffmpeg_16kb/include/libavutil/timestamp.h +78 -0
  147. package/android/ffmpeg_16kb/include/libavutil/tree.h +137 -0
  148. package/android/ffmpeg_16kb/include/libavutil/twofish.h +70 -0
  149. package/android/ffmpeg_16kb/include/libavutil/tx.h +176 -0
  150. package/android/ffmpeg_16kb/include/libavutil/uuid.h +146 -0
  151. package/android/ffmpeg_16kb/include/libavutil/version.h +122 -0
  152. package/android/ffmpeg_16kb/include/libavutil/video_enc_params.h +171 -0
  153. package/android/ffmpeg_16kb/include/libavutil/x86/asm.h +154 -0
  154. package/android/ffmpeg_16kb/include/libavutil/x86/emms.h +58 -0
  155. package/android/ffmpeg_16kb/include/libavutil/x86/timer.h +50 -0
  156. package/android/ffmpeg_16kb/include/libavutil/xtea.h +94 -0
  157. package/android/ffmpeg_16kb/include/libswresample/swresample.h +650 -0
  158. package/android/ffmpeg_16kb/include/libswresample/version.h +46 -0
  159. package/android/ffmpeg_16kb/include/libswresample/version_major.h +31 -0
  160. package/android/ffmpeg_16kb/include/libswscale/swscale.h +436 -0
  161. package/android/ffmpeg_16kb/include/libswscale/version.h +44 -0
  162. package/android/ffmpeg_16kb/include/libswscale/version_major.h +35 -0
  163. package/android/ffmpeg_16kb/lib/arm64-v8a/libavcodec.so +0 -0
  164. package/android/ffmpeg_16kb/lib/arm64-v8a/libavdevice.so +0 -0
  165. package/android/ffmpeg_16kb/lib/arm64-v8a/libavfilter.so +0 -0
  166. package/android/ffmpeg_16kb/lib/arm64-v8a/libavformat.so +0 -0
  167. package/android/ffmpeg_16kb/lib/arm64-v8a/libavutil.so +0 -0
  168. package/android/ffmpeg_16kb/lib/arm64-v8a/libswresample.so +0 -0
  169. package/android/ffmpeg_16kb/lib/arm64-v8a/libswscale.so +0 -0
  170. package/android/ffmpeg_16kb/lib/armeabi-v7a/libavcodec_neon.so +0 -0
  171. package/android/ffmpeg_16kb/lib/armeabi-v7a/libavdevice_neon.so +0 -0
  172. package/android/ffmpeg_16kb/lib/armeabi-v7a/libavfilter_neon.so +0 -0
  173. package/android/ffmpeg_16kb/lib/armeabi-v7a/libavformat_neon.so +0 -0
  174. package/android/ffmpeg_16kb/lib/armeabi-v7a/libavutil_neon.so +0 -0
  175. package/android/ffmpeg_16kb/lib/armeabi-v7a/libswresample_neon.so +0 -0
  176. package/android/ffmpeg_16kb/lib/armeabi-v7a/libswscale_neon.so +0 -0
  177. package/android/ffmpeg_16kb/lib/x86/libavcodec.so +0 -0
  178. package/android/ffmpeg_16kb/lib/x86/libavdevice.so +0 -0
  179. package/android/ffmpeg_16kb/lib/x86/libavfilter.so +0 -0
  180. package/android/ffmpeg_16kb/lib/x86/libavformat.so +0 -0
  181. package/android/ffmpeg_16kb/lib/x86/libavutil.so +0 -0
  182. package/android/ffmpeg_16kb/lib/x86/libswresample.so +0 -0
  183. package/android/ffmpeg_16kb/lib/x86/libswscale.so +0 -0
  184. package/android/ffmpeg_16kb/lib/x86_64/libavcodec.so +0 -0
  185. package/android/ffmpeg_16kb/lib/x86_64/libavdevice.so +0 -0
  186. package/android/ffmpeg_16kb/lib/x86_64/libavfilter.so +0 -0
  187. package/android/ffmpeg_16kb/lib/x86_64/libavformat.so +0 -0
  188. package/android/ffmpeg_16kb/lib/x86_64/libavutil.so +0 -0
  189. package/android/ffmpeg_16kb/lib/x86_64/libswresample.so +0 -0
  190. package/android/ffmpeg_16kb/lib/x86_64/libswscale.so +0 -0
  191. package/android/gradle.properties +5 -0
  192. package/android/src/main/AndroidManifest.xml +3 -0
  193. package/android/src/main/AndroidManifestNew.xml +2 -0
  194. package/android/src/main/java/com/audioanalyzer/AmplitudeData.java +20 -0
  195. package/android/src/main/java/com/audioanalyzer/AudioAnalyzerModule.java +52 -0
  196. package/android/src/main/java/com/audioanalyzer/AudioAnalyzerPackage.java +28 -0
  197. package/cpp/react-native-audio-analyzer.cpp +143 -0
  198. package/cpp/react-native-audio-analyzer.h +27 -0
  199. package/ios/AudioAnalyzer.h +19 -0
  200. package/ios/AudioAnalyzer.mm +43 -0
  201. package/lib/commonjs/helpers.js +34 -0
  202. package/lib/commonjs/helpers.js.map +1 -0
  203. package/lib/commonjs/helpers.test.js +49 -0
  204. package/lib/commonjs/helpers.test.js.map +1 -0
  205. package/lib/commonjs/index.js +35 -0
  206. package/lib/commonjs/index.js.map +1 -0
  207. package/lib/module/helpers.js +27 -0
  208. package/lib/module/helpers.js.map +1 -0
  209. package/lib/module/helpers.test.js +47 -0
  210. package/lib/module/helpers.test.js.map +1 -0
  211. package/lib/module/index.js +15 -0
  212. package/lib/module/index.js.map +1 -0
  213. package/lib/typescript/src/helpers.d.ts +3 -0
  214. package/lib/typescript/src/helpers.d.ts.map +1 -0
  215. package/lib/typescript/src/helpers.test.d.ts +2 -0
  216. package/lib/typescript/src/helpers.test.d.ts.map +1 -0
  217. package/lib/typescript/src/index.d.ts +7 -0
  218. package/lib/typescript/src/index.d.ts.map +1 -0
  219. package/package.json +163 -0
  220. package/react-native-audio-analyzer.podspec +44 -0
  221. package/src/helpers.test.ts +59 -0
  222. package/src/helpers.ts +34 -0
  223. package/src/index.tsx +30 -0
@@ -0,0 +1,176 @@
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_TX_H
20
+ #define AVUTIL_TX_H
21
+
22
+ #include <stdint.h>
23
+ #include <stddef.h>
24
+
25
+ typedef struct AVTXContext AVTXContext;
26
+
27
+ typedef struct AVComplexFloat {
28
+ float re, im;
29
+ } AVComplexFloat;
30
+
31
+ typedef struct AVComplexDouble {
32
+ double re, im;
33
+ } AVComplexDouble;
34
+
35
+ typedef struct AVComplexInt32 {
36
+ int32_t re, im;
37
+ } AVComplexInt32;
38
+
39
+ enum AVTXType {
40
+ /**
41
+ * Standard complex to complex FFT with sample data type of AVComplexFloat,
42
+ * AVComplexDouble or AVComplexInt32, for each respective variant.
43
+ *
44
+ * Output is not 1/len normalized. Scaling currently unsupported.
45
+ * The stride parameter must be set to the size of a single sample in bytes.
46
+ */
47
+ AV_TX_FLOAT_FFT = 0,
48
+ AV_TX_DOUBLE_FFT = 2,
49
+ AV_TX_INT32_FFT = 4,
50
+
51
+ /**
52
+ * Standard MDCT with a sample data type of float, double or int32_t,
53
+ * respecively. For the float and int32 variants, the scale type is
54
+ * 'float', while for the double variant, it's 'double'.
55
+ * If scale is NULL, 1.0 will be used as a default.
56
+ *
57
+ * Length is the frame size, not the window size (which is 2x frame).
58
+ * For forward transforms, the stride specifies the spacing between each
59
+ * sample in the output array in bytes. The input must be a flat array.
60
+ *
61
+ * For inverse transforms, the stride specifies the spacing between each
62
+ * sample in the input array in bytes. The output must be a flat array.
63
+ *
64
+ * NOTE: the inverse transform is half-length, meaning the output will not
65
+ * contain redundant data. This is what most codecs work with. To do a full
66
+ * inverse transform, set the AV_TX_FULL_IMDCT flag on init.
67
+ */
68
+ AV_TX_FLOAT_MDCT = 1,
69
+ AV_TX_DOUBLE_MDCT = 3,
70
+ AV_TX_INT32_MDCT = 5,
71
+
72
+ /**
73
+ * Real to complex and complex to real DFTs.
74
+ * For the float and int32 variants, the scale type is 'float', while for
75
+ * the double variant, it's a 'double'. If scale is NULL, 1.0 will be used
76
+ * as a default.
77
+ *
78
+ * For forward transforms (R2C), stride must be the spacing between two
79
+ * samples in bytes. For inverse transforms, the stride must be set
80
+ * to the spacing between two complex values in bytes.
81
+ *
82
+ * The forward transform performs a real-to-complex DFT of N samples to
83
+ * N/2+1 complex values.
84
+ *
85
+ * The inverse transform performs a complex-to-real DFT of N/2+1 complex
86
+ * values to N real samples. The output is not normalized, but can be
87
+ * made so by setting the scale value to 1.0/len.
88
+ * NOTE: the inverse transform always overwrites the input.
89
+ */
90
+ AV_TX_FLOAT_RDFT = 6,
91
+ AV_TX_DOUBLE_RDFT = 7,
92
+ AV_TX_INT32_RDFT = 8,
93
+
94
+ /**
95
+ * Real to real (DCT) transforms.
96
+ *
97
+ * The forward transform is a DCT-II.
98
+ * The inverse transform is a DCT-III.
99
+ *
100
+ * The input array is always overwritten. DCT-III requires that the
101
+ * input be padded with 2 extra samples. Stride must be set to the
102
+ * spacing between two samples in bytes.
103
+ */
104
+ AV_TX_FLOAT_DCT = 9,
105
+ AV_TX_DOUBLE_DCT = 10,
106
+ AV_TX_INT32_DCT = 11,
107
+
108
+ /* Not part of the API, do not use */
109
+ AV_TX_NB,
110
+ };
111
+
112
+ /**
113
+ * Function pointer to a function to perform the transform.
114
+ *
115
+ * @note Using a different context than the one allocated during av_tx_init()
116
+ * is not allowed.
117
+ *
118
+ * @param s the transform context
119
+ * @param out the output array
120
+ * @param in the input array
121
+ * @param stride the input or output stride in bytes
122
+ *
123
+ * The out and in arrays must be aligned to the maximum required by the CPU
124
+ * architecture unless the AV_TX_UNALIGNED flag was set in av_tx_init().
125
+ * The stride must follow the constraints the transform type has specified.
126
+ */
127
+ typedef void (*av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride);
128
+
129
+ /**
130
+ * Flags for av_tx_init()
131
+ */
132
+ enum AVTXFlags {
133
+ /**
134
+ * Allows for in-place transformations, where input == output.
135
+ * May be unsupported or slower for some transform types.
136
+ */
137
+ AV_TX_INPLACE = 1ULL << 0,
138
+
139
+ /**
140
+ * Relaxes alignment requirement for the in and out arrays of av_tx_fn().
141
+ * May be slower with certain transform types.
142
+ */
143
+ AV_TX_UNALIGNED = 1ULL << 1,
144
+
145
+ /**
146
+ * Performs a full inverse MDCT rather than leaving out samples that can be
147
+ * derived through symmetry. Requires an output array of 'len' floats,
148
+ * rather than the usual 'len/2' floats.
149
+ * Ignored for all transforms but inverse MDCTs.
150
+ */
151
+ AV_TX_FULL_IMDCT = 1ULL << 2,
152
+ };
153
+
154
+ /**
155
+ * Initialize a transform context with the given configuration
156
+ * (i)MDCTs with an odd length are currently not supported.
157
+ *
158
+ * @param ctx the context to allocate, will be NULL on error
159
+ * @param tx pointer to the transform function pointer to set
160
+ * @param type type the type of transform
161
+ * @param inv whether to do an inverse or a forward transform
162
+ * @param len the size of the transform in samples
163
+ * @param scale pointer to the value to scale the output if supported by type
164
+ * @param flags a bitmask of AVTXFlags or 0
165
+ *
166
+ * @return 0 on success, negative error code on failure
167
+ */
168
+ int av_tx_init(AVTXContext **ctx, av_tx_fn *tx, enum AVTXType type,
169
+ int inv, int len, const void *scale, uint64_t flags);
170
+
171
+ /**
172
+ * Frees a context and sets *ctx to NULL, does nothing when *ctx == NULL.
173
+ */
174
+ void av_tx_uninit(AVTXContext **ctx);
175
+
176
+ #endif /* AVUTIL_TX_H */
@@ -0,0 +1,146 @@
1
+ /*
2
+ * Copyright (c) 2022 Pierre-Anthony Lemieux <pal@palemieux.com>
3
+ * Zane van Iperen <zane@zanevaniperen.com>
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
+ * UUID parsing and serialization utilities.
25
+ * The library treats the UUID as an opaque sequence of 16 unsigned bytes,
26
+ * i.e. ignoring the internal layout of the UUID, which depends on the type
27
+ * of the UUID.
28
+ *
29
+ * @author Pierre-Anthony Lemieux <pal@palemieux.com>
30
+ * @author Zane van Iperen <zane@zanevaniperen.com>
31
+ */
32
+
33
+ #ifndef AVUTIL_UUID_H
34
+ #define AVUTIL_UUID_H
35
+
36
+ #include <stdint.h>
37
+ #include <string.h>
38
+
39
+ #define AV_PRI_UUID \
40
+ "%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-" \
41
+ "%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
42
+
43
+ #define AV_PRI_URN_UUID \
44
+ "urn:uuid:%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-" \
45
+ "%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
46
+
47
+ /* AV_UUID_ARG() is used together with AV_PRI_UUID() or AV_PRI_URN_UUID
48
+ * to print UUIDs, e.g.
49
+ * av_log(NULL, AV_LOG_DEBUG, "UUID: " AV_PRI_UUID, AV_UUID_ARG(uuid));
50
+ */
51
+ #define AV_UUID_ARG(x) \
52
+ (x)[ 0], (x)[ 1], (x)[ 2], (x)[ 3], \
53
+ (x)[ 4], (x)[ 5], (x)[ 6], (x)[ 7], \
54
+ (x)[ 8], (x)[ 9], (x)[10], (x)[11], \
55
+ (x)[12], (x)[13], (x)[14], (x)[15]
56
+
57
+ #define AV_UUID_LEN 16
58
+
59
+ /* Binary representation of a UUID */
60
+ typedef uint8_t AVUUID[AV_UUID_LEN];
61
+
62
+ /**
63
+ * Parses a string representation of a UUID formatted according to IETF RFC 4122
64
+ * into an AVUUID. The parsing is case-insensitive. The string must be 37
65
+ * characters long, including the terminating NUL character.
66
+ *
67
+ * Example string representation: "2fceebd0-7017-433d-bafb-d073a7116696"
68
+ *
69
+ * @param[in] in String representation of a UUID,
70
+ * e.g. 2fceebd0-7017-433d-bafb-d073a7116696
71
+ * @param[out] uu AVUUID
72
+ * @return A non-zero value in case of an error.
73
+ */
74
+ int av_uuid_parse(const char *in, AVUUID uu);
75
+
76
+ /**
77
+ * Parses a URN representation of a UUID, as specified at IETF RFC 4122,
78
+ * into an AVUUID. The parsing is case-insensitive. The string must be 46
79
+ * characters long, including the terminating NUL character.
80
+ *
81
+ * Example string representation: "urn:uuid:2fceebd0-7017-433d-bafb-d073a7116696"
82
+ *
83
+ * @param[in] in URN UUID
84
+ * @param[out] uu AVUUID
85
+ * @return A non-zero value in case of an error.
86
+ */
87
+ int av_uuid_urn_parse(const char *in, AVUUID uu);
88
+
89
+ /**
90
+ * Parses a string representation of a UUID formatted according to IETF RFC 4122
91
+ * into an AVUUID. The parsing is case-insensitive.
92
+ *
93
+ * @param[in] in_start Pointer to the first character of the string representation
94
+ * @param[in] in_end Pointer to the character after the last character of the
95
+ * string representation. That memory location is never
96
+ * accessed. It is an error if `in_end - in_start != 36`.
97
+ * @param[out] uu AVUUID
98
+ * @return A non-zero value in case of an error.
99
+ */
100
+ int av_uuid_parse_range(const char *in_start, const char *in_end, AVUUID uu);
101
+
102
+ /**
103
+ * Serializes a AVUUID into a string representation according to IETF RFC 4122.
104
+ * The string is lowercase and always 37 characters long, including the
105
+ * terminating NUL character.
106
+ *
107
+ * @param[in] uu AVUUID
108
+ * @param[out] out Pointer to an array of no less than 37 characters.
109
+ */
110
+ void av_uuid_unparse(const AVUUID uu, char *out);
111
+
112
+ /**
113
+ * Compares two UUIDs for equality.
114
+ *
115
+ * @param[in] uu1 AVUUID
116
+ * @param[in] uu2 AVUUID
117
+ * @return Nonzero if uu1 and uu2 are identical, 0 otherwise
118
+ */
119
+ static inline int av_uuid_equal(const AVUUID uu1, const AVUUID uu2)
120
+ {
121
+ return memcmp(uu1, uu2, AV_UUID_LEN) == 0;
122
+ }
123
+
124
+ /**
125
+ * Copies the bytes of src into dest.
126
+ *
127
+ * @param[out] dest AVUUID
128
+ * @param[in] src AVUUID
129
+ */
130
+ static inline void av_uuid_copy(AVUUID dest, const AVUUID src)
131
+ {
132
+ memcpy(dest, src, AV_UUID_LEN);
133
+ }
134
+
135
+ /**
136
+ * Sets a UUID to the nil UUID, i.e. a UUID with have all
137
+ * its 128 bits set to zero.
138
+ *
139
+ * @param[in,out] uu UUID to be set to the nil UUID
140
+ */
141
+ static inline void av_uuid_nil(AVUUID uu)
142
+ {
143
+ memset(uu, 0, AV_UUID_LEN);
144
+ }
145
+
146
+ #endif /* AVUTIL_UUID_H */
@@ -0,0 +1,122 @@
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
+ /**
22
+ * @file
23
+ * @ingroup lavu
24
+ * Libavutil version macros
25
+ */
26
+
27
+ #ifndef AVUTIL_VERSION_H
28
+ #define AVUTIL_VERSION_H
29
+
30
+ #include "macros.h"
31
+
32
+ /**
33
+ * @addtogroup version_utils
34
+ *
35
+ * Useful to check and match library version in order to maintain
36
+ * backward compatibility.
37
+ *
38
+ * The FFmpeg libraries follow a versioning sheme very similar to
39
+ * Semantic Versioning (http://semver.org/)
40
+ * The difference is that the component called PATCH is called MICRO in FFmpeg
41
+ * and its value is reset to 100 instead of 0 to keep it above or equal to 100.
42
+ * Also we do not increase MICRO for every bugfix or change in git master.
43
+ *
44
+ * Prior to FFmpeg 3.2 point releases did not change any lib version number to
45
+ * avoid aliassing different git master checkouts.
46
+ * Starting with FFmpeg 3.2, the released library versions will occupy
47
+ * a separate MAJOR.MINOR that is not used on the master development branch.
48
+ * That is if we branch a release of master 55.10.123 we will bump to 55.11.100
49
+ * for the release and master will continue at 55.12.100 after it. Each new
50
+ * point release will then bump the MICRO improving the usefulness of the lib
51
+ * versions.
52
+ *
53
+ * @{
54
+ */
55
+
56
+ #define AV_VERSION_INT(a, b, c) ((a)<<16 | (b)<<8 | (c))
57
+ #define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c
58
+ #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
59
+
60
+ /**
61
+ * Extract version components from the full ::AV_VERSION_INT int as returned
62
+ * by functions like ::avformat_version() and ::avcodec_version()
63
+ */
64
+ #define AV_VERSION_MAJOR(a) ((a) >> 16)
65
+ #define AV_VERSION_MINOR(a) (((a) & 0x00FF00) >> 8)
66
+ #define AV_VERSION_MICRO(a) ((a) & 0xFF)
67
+
68
+ /**
69
+ * @}
70
+ */
71
+
72
+ /**
73
+ * @defgroup lavu_ver Version and Build diagnostics
74
+ *
75
+ * Macros and function useful to check at compiletime and at runtime
76
+ * which version of libavutil is in use.
77
+ *
78
+ * @{
79
+ */
80
+
81
+ #define LIBAVUTIL_VERSION_MAJOR 58
82
+ #define LIBAVUTIL_VERSION_MINOR 2
83
+ #define LIBAVUTIL_VERSION_MICRO 100
84
+
85
+ #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
86
+ LIBAVUTIL_VERSION_MINOR, \
87
+ LIBAVUTIL_VERSION_MICRO)
88
+ #define LIBAVUTIL_VERSION AV_VERSION(LIBAVUTIL_VERSION_MAJOR, \
89
+ LIBAVUTIL_VERSION_MINOR, \
90
+ LIBAVUTIL_VERSION_MICRO)
91
+ #define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT
92
+
93
+ #define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION)
94
+
95
+ /**
96
+ * @defgroup lavu_depr_guards Deprecation Guards
97
+ * FF_API_* defines may be placed below to indicate public API that will be
98
+ * dropped at a future version bump. The defines themselves are not part of
99
+ * the public API and may change, break or disappear at any time.
100
+ *
101
+ * @note, when bumping the major version it is recommended to manually
102
+ * disable each FF_API_* in its own commit instead of disabling them all
103
+ * at once through the bump. This improves the git bisect-ability of the change.
104
+ *
105
+ * @{
106
+ */
107
+
108
+ #define FF_API_FIFO_PEEK2 (LIBAVUTIL_VERSION_MAJOR < 59)
109
+ #define FF_API_FIFO_OLD_API (LIBAVUTIL_VERSION_MAJOR < 59)
110
+ #define FF_API_XVMC (LIBAVUTIL_VERSION_MAJOR < 59)
111
+ #define FF_API_OLD_CHANNEL_LAYOUT (LIBAVUTIL_VERSION_MAJOR < 59)
112
+ #define FF_API_AV_FOPEN_UTF8 (LIBAVUTIL_VERSION_MAJOR < 59)
113
+ #define FF_API_PKT_DURATION (LIBAVUTIL_VERSION_MAJOR < 59)
114
+ #define FF_API_REORDERED_OPAQUE (LIBAVUTIL_VERSION_MAJOR < 59)
115
+ #define FF_API_FRAME_PICTURE_NUMBER (LIBAVUTIL_VERSION_MAJOR < 59)
116
+
117
+ /**
118
+ * @}
119
+ * @}
120
+ */
121
+
122
+ #endif /* AVUTIL_VERSION_H */
@@ -0,0 +1,171 @@
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_VIDEO_ENC_PARAMS_H
20
+ #define AVUTIL_VIDEO_ENC_PARAMS_H
21
+
22
+ #include <stddef.h>
23
+ #include <stdint.h>
24
+
25
+ #include "libavutil/avassert.h"
26
+ #include "libavutil/frame.h"
27
+
28
+ enum AVVideoEncParamsType {
29
+ AV_VIDEO_ENC_PARAMS_NONE = -1,
30
+ /**
31
+ * VP9 stores:
32
+ * - per-frame base (luma AC) quantizer index, exported as AVVideoEncParams.qp
33
+ * - deltas for luma DC, chroma AC and chroma DC, exported in the
34
+ * corresponding entries in AVVideoEncParams.delta_qp
35
+ * - per-segment delta, exported as for each block as AVVideoBlockParams.delta_qp
36
+ *
37
+ * To compute the resulting quantizer index for a block:
38
+ * - for luma AC, add the base qp and the per-block delta_qp, saturating to
39
+ * unsigned 8-bit.
40
+ * - for luma DC and chroma AC/DC, add the corresponding
41
+ * AVVideoBlockParams.delta_qp to the luma AC index, again saturating to
42
+ * unsigned 8-bit.
43
+ */
44
+ AV_VIDEO_ENC_PARAMS_VP9,
45
+
46
+ /**
47
+ * H.264 stores:
48
+ * - in PPS (per-picture):
49
+ * * initial QP_Y (luma) value, exported as AVVideoEncParams.qp
50
+ * * delta(s) for chroma QP values (same for both, or each separately),
51
+ * exported as in the corresponding entries in AVVideoEncParams.delta_qp
52
+ * - per-slice QP delta, not exported directly, added to the per-MB value
53
+ * - per-MB delta; not exported directly; the final per-MB quantizer
54
+ * parameter - QP_Y - minus the value in AVVideoEncParams.qp is exported
55
+ * as AVVideoBlockParams.qp_delta.
56
+ */
57
+ AV_VIDEO_ENC_PARAMS_H264,
58
+
59
+ /*
60
+ * MPEG-2-compatible quantizer.
61
+ *
62
+ * Summing the frame-level qp with the per-block delta_qp gives the
63
+ * resulting quantizer for the block.
64
+ */
65
+ AV_VIDEO_ENC_PARAMS_MPEG2,
66
+ };
67
+
68
+ /**
69
+ * Video encoding parameters for a given frame. This struct is allocated along
70
+ * with an optional array of per-block AVVideoBlockParams descriptors.
71
+ * Must be allocated with av_video_enc_params_alloc().
72
+ */
73
+ typedef struct AVVideoEncParams {
74
+ /**
75
+ * Number of blocks in the array.
76
+ *
77
+ * May be 0, in which case no per-block information is present. In this case
78
+ * the values of blocks_offset / block_size are unspecified and should not
79
+ * be accessed.
80
+ */
81
+ unsigned int nb_blocks;
82
+ /**
83
+ * Offset in bytes from the beginning of this structure at which the array
84
+ * of blocks starts.
85
+ */
86
+ size_t blocks_offset;
87
+ /*
88
+ * Size of each block in bytes. May not match sizeof(AVVideoBlockParams).
89
+ */
90
+ size_t block_size;
91
+
92
+ /**
93
+ * Type of the parameters (the codec they are used with).
94
+ */
95
+ enum AVVideoEncParamsType type;
96
+
97
+ /**
98
+ * Base quantisation parameter for the frame. The final quantiser for a
99
+ * given block in a given plane is obtained from this value, possibly
100
+ * combined with {@code delta_qp} and the per-block delta in a manner
101
+ * documented for each type.
102
+ */
103
+ int32_t qp;
104
+
105
+ /**
106
+ * Quantisation parameter offset from the base (per-frame) qp for a given
107
+ * plane (first index) and AC/DC coefficients (second index).
108
+ */
109
+ int32_t delta_qp[4][2];
110
+ } AVVideoEncParams;
111
+
112
+ /**
113
+ * Data structure for storing block-level encoding information.
114
+ * It is allocated as a part of AVVideoEncParams and should be retrieved with
115
+ * av_video_enc_params_block().
116
+ *
117
+ * sizeof(AVVideoBlockParams) is not a part of the ABI and new fields may be
118
+ * added to it.
119
+ */
120
+ typedef struct AVVideoBlockParams {
121
+ /**
122
+ * Distance in luma pixels from the top-left corner of the visible frame
123
+ * to the top-left corner of the block.
124
+ * Can be negative if top/right padding is present on the coded frame.
125
+ */
126
+ int src_x, src_y;
127
+ /**
128
+ * Width and height of the block in luma pixels.
129
+ */
130
+ int w, h;
131
+
132
+ /**
133
+ * Difference between this block's final quantization parameter and the
134
+ * corresponding per-frame value.
135
+ */
136
+ int32_t delta_qp;
137
+ } AVVideoBlockParams;
138
+
139
+ /*
140
+ * Get the block at the specified {@code idx}. Must be between 0 and nb_blocks.
141
+ */
142
+ static av_always_inline AVVideoBlockParams*
143
+ av_video_enc_params_block(AVVideoEncParams *par, unsigned int idx)
144
+ {
145
+ av_assert0(idx < par->nb_blocks);
146
+ return (AVVideoBlockParams *)((uint8_t *)par + par->blocks_offset +
147
+ idx * par->block_size);
148
+ }
149
+
150
+ /**
151
+ * Allocates memory for AVVideoEncParams of the given type, plus an array of
152
+ * {@code nb_blocks} AVVideoBlockParams and initializes the variables. Can be
153
+ * freed with a normal av_free() call.
154
+ *
155
+ * @param out_size if non-NULL, the size in bytes of the resulting data array is
156
+ * written here.
157
+ */
158
+ AVVideoEncParams *av_video_enc_params_alloc(enum AVVideoEncParamsType type,
159
+ unsigned int nb_blocks, size_t *out_size);
160
+
161
+ /**
162
+ * Allocates memory for AVEncodeInfoFrame plus an array of
163
+ * {@code nb_blocks} AVEncodeInfoBlock in the given AVFrame {@code frame}
164
+ * as AVFrameSideData of type AV_FRAME_DATA_VIDEO_ENC_PARAMS
165
+ * and initializes the variables.
166
+ */
167
+ AVVideoEncParams*
168
+ av_video_enc_params_create_side_data(AVFrame *frame, enum AVVideoEncParamsType type,
169
+ unsigned int nb_blocks);
170
+
171
+ #endif /* AVUTIL_VIDEO_ENC_PARAMS_H */