@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,109 @@
1
+ /*
2
+ * Copyright (c) 2014 Vittorio Giovara <vittorio.giovara@gmail.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
+ /**
22
+ * @file
23
+ * @ingroup lavu_video_display
24
+ * Display matrix
25
+ */
26
+
27
+ #ifndef AVUTIL_DISPLAY_H
28
+ #define AVUTIL_DISPLAY_H
29
+
30
+ #include <stdint.h>
31
+
32
+ /**
33
+ * @defgroup lavu_video_display Display transformation matrix functions
34
+ * @ingroup lavu_video
35
+ *
36
+ * The display transformation matrix specifies an affine transformation that
37
+ * should be applied to video frames for correct presentation. It is compatible
38
+ * with the matrices stored in the ISO/IEC 14496-12 container format.
39
+ *
40
+ * The data is a 3x3 matrix represented as a 9-element array:
41
+ *
42
+ * @code{.unparsed}
43
+ * | a b u |
44
+ * (a, b, u, c, d, v, x, y, w) -> | c d v |
45
+ * | x y w |
46
+ * @endcode
47
+ *
48
+ * All numbers are stored in native endianness, as 16.16 fixed-point values,
49
+ * except for u, v and w, which are stored as 2.30 fixed-point values.
50
+ *
51
+ * The transformation maps a point (p, q) in the source (pre-transformation)
52
+ * frame to the point (p', q') in the destination (post-transformation) frame as
53
+ * follows:
54
+ *
55
+ * @code{.unparsed}
56
+ * | a b u |
57
+ * (p, q, 1) . | c d v | = z * (p', q', 1)
58
+ * | x y w |
59
+ * @endcode
60
+ *
61
+ * The transformation can also be more explicitly written in components as
62
+ * follows:
63
+ *
64
+ * @code{.unparsed}
65
+ * p' = (a * p + c * q + x) / z;
66
+ * q' = (b * p + d * q + y) / z;
67
+ * z = u * p + v * q + w
68
+ * @endcode
69
+ *
70
+ * @{
71
+ */
72
+
73
+ /**
74
+ * Extract the rotation component of the transformation matrix.
75
+ *
76
+ * @param matrix the transformation matrix
77
+ * @return the angle (in degrees) by which the transformation rotates the frame
78
+ * counterclockwise. The angle will be in range [-180.0, 180.0],
79
+ * or NaN if the matrix is singular.
80
+ *
81
+ * @note floating point numbers are inherently inexact, so callers are
82
+ * recommended to round the return value to nearest integer before use.
83
+ */
84
+ double av_display_rotation_get(const int32_t matrix[9]);
85
+
86
+ /**
87
+ * Initialize a transformation matrix describing a pure clockwise
88
+ * rotation by the specified angle (in degrees).
89
+ *
90
+ * @param[out] matrix a transformation matrix (will be fully overwritten
91
+ * by this function)
92
+ * @param angle rotation angle in degrees.
93
+ */
94
+ void av_display_rotation_set(int32_t matrix[9], double angle);
95
+
96
+ /**
97
+ * Flip the input matrix horizontally and/or vertically.
98
+ *
99
+ * @param[in,out] matrix a transformation matrix
100
+ * @param hflip whether the matrix should be flipped horizontally
101
+ * @param vflip whether the matrix should be flipped vertically
102
+ */
103
+ void av_display_matrix_flip(int32_t matrix[9], int hflip, int vflip);
104
+
105
+ /**
106
+ * @}
107
+ */
108
+
109
+ #endif /* AVUTIL_DISPLAY_H */
@@ -0,0 +1,236 @@
1
+ /*
2
+ * Copyright (c) 2020 Vacing Fang <vacingfang@tencent.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
+ /**
22
+ * @file
23
+ * DOVI configuration
24
+ */
25
+
26
+
27
+ #ifndef AVUTIL_DOVI_META_H
28
+ #define AVUTIL_DOVI_META_H
29
+
30
+ #include <stdint.h>
31
+ #include <stddef.h>
32
+ #include "rational.h"
33
+
34
+ /*
35
+ * DOVI configuration
36
+ * ref: dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2.1.2
37
+ dolby-vision-bitstreams-in-mpeg-2-transport-stream-multiplex-v1.2
38
+ * @code
39
+ * uint8_t dv_version_major, the major version number that the stream complies with
40
+ * uint8_t dv_version_minor, the minor version number that the stream complies with
41
+ * uint8_t dv_profile, the Dolby Vision profile
42
+ * uint8_t dv_level, the Dolby Vision level
43
+ * uint8_t rpu_present_flag
44
+ * uint8_t el_present_flag
45
+ * uint8_t bl_present_flag
46
+ * uint8_t dv_bl_signal_compatibility_id
47
+ * @endcode
48
+ *
49
+ * @note The struct must be allocated with av_dovi_alloc() and
50
+ * its size is not a part of the public ABI.
51
+ */
52
+ typedef struct AVDOVIDecoderConfigurationRecord {
53
+ uint8_t dv_version_major;
54
+ uint8_t dv_version_minor;
55
+ uint8_t dv_profile;
56
+ uint8_t dv_level;
57
+ uint8_t rpu_present_flag;
58
+ uint8_t el_present_flag;
59
+ uint8_t bl_present_flag;
60
+ uint8_t dv_bl_signal_compatibility_id;
61
+ } AVDOVIDecoderConfigurationRecord;
62
+
63
+ /**
64
+ * Allocate a AVDOVIDecoderConfigurationRecord structure and initialize its
65
+ * fields to default values.
66
+ *
67
+ * @return the newly allocated struct or NULL on failure
68
+ */
69
+ AVDOVIDecoderConfigurationRecord *av_dovi_alloc(size_t *size);
70
+
71
+ /**
72
+ * Dolby Vision RPU data header.
73
+ *
74
+ * @note sizeof(AVDOVIRpuDataHeader) is not part of the public ABI.
75
+ */
76
+ typedef struct AVDOVIRpuDataHeader {
77
+ uint8_t rpu_type;
78
+ uint16_t rpu_format;
79
+ uint8_t vdr_rpu_profile;
80
+ uint8_t vdr_rpu_level;
81
+ uint8_t chroma_resampling_explicit_filter_flag;
82
+ uint8_t coef_data_type; /* informative, lavc always converts to fixed */
83
+ uint8_t coef_log2_denom;
84
+ uint8_t vdr_rpu_normalized_idc;
85
+ uint8_t bl_video_full_range_flag;
86
+ uint8_t bl_bit_depth; /* [8, 16] */
87
+ uint8_t el_bit_depth; /* [8, 16] */
88
+ uint8_t vdr_bit_depth; /* [8, 16] */
89
+ uint8_t spatial_resampling_filter_flag;
90
+ uint8_t el_spatial_resampling_filter_flag;
91
+ uint8_t disable_residual_flag;
92
+ } AVDOVIRpuDataHeader;
93
+
94
+ enum AVDOVIMappingMethod {
95
+ AV_DOVI_MAPPING_POLYNOMIAL = 0,
96
+ AV_DOVI_MAPPING_MMR = 1,
97
+ };
98
+
99
+ /**
100
+ * Coefficients of a piece-wise function. The pieces of the function span the
101
+ * value ranges between two adjacent pivot values.
102
+ */
103
+ #define AV_DOVI_MAX_PIECES 8
104
+ typedef struct AVDOVIReshapingCurve {
105
+ uint8_t num_pivots; /* [2, 9] */
106
+ uint16_t pivots[AV_DOVI_MAX_PIECES + 1]; /* sorted ascending */
107
+ enum AVDOVIMappingMethod mapping_idc[AV_DOVI_MAX_PIECES];
108
+ /* AV_DOVI_MAPPING_POLYNOMIAL */
109
+ uint8_t poly_order[AV_DOVI_MAX_PIECES]; /* [1, 2] */
110
+ int64_t poly_coef[AV_DOVI_MAX_PIECES][3]; /* x^0, x^1, x^2 */
111
+ /* AV_DOVI_MAPPING_MMR */
112
+ uint8_t mmr_order[AV_DOVI_MAX_PIECES]; /* [1, 3] */
113
+ int64_t mmr_constant[AV_DOVI_MAX_PIECES];
114
+ int64_t mmr_coef[AV_DOVI_MAX_PIECES][3/* order - 1 */][7];
115
+ } AVDOVIReshapingCurve;
116
+
117
+ enum AVDOVINLQMethod {
118
+ AV_DOVI_NLQ_NONE = -1,
119
+ AV_DOVI_NLQ_LINEAR_DZ = 0,
120
+ };
121
+
122
+ /**
123
+ * Coefficients of the non-linear inverse quantization. For the interpretation
124
+ * of these, see ETSI GS CCM 001.
125
+ */
126
+ typedef struct AVDOVINLQParams {
127
+ uint16_t nlq_offset;
128
+ uint64_t vdr_in_max;
129
+ /* AV_DOVI_NLQ_LINEAR_DZ */
130
+ uint64_t linear_deadzone_slope;
131
+ uint64_t linear_deadzone_threshold;
132
+ } AVDOVINLQParams;
133
+
134
+ /**
135
+ * Dolby Vision RPU data mapping parameters.
136
+ *
137
+ * @note sizeof(AVDOVIDataMapping) is not part of the public ABI.
138
+ */
139
+ typedef struct AVDOVIDataMapping {
140
+ uint8_t vdr_rpu_id;
141
+ uint8_t mapping_color_space;
142
+ uint8_t mapping_chroma_format_idc;
143
+ AVDOVIReshapingCurve curves[3]; /* per component */
144
+
145
+ /* Non-linear inverse quantization */
146
+ enum AVDOVINLQMethod nlq_method_idc;
147
+ uint32_t num_x_partitions;
148
+ uint32_t num_y_partitions;
149
+ AVDOVINLQParams nlq[3]; /* per component */
150
+ } AVDOVIDataMapping;
151
+
152
+ /**
153
+ * Dolby Vision RPU colorspace metadata parameters.
154
+ *
155
+ * @note sizeof(AVDOVIColorMetadata) is not part of the public ABI.
156
+ */
157
+ typedef struct AVDOVIColorMetadata {
158
+ uint8_t dm_metadata_id;
159
+ uint8_t scene_refresh_flag;
160
+
161
+ /**
162
+ * Coefficients of the custom Dolby Vision IPT-PQ matrices. These are to be
163
+ * used instead of the matrices indicated by the frame's colorspace tags.
164
+ * The output of rgb_to_lms_matrix is to be fed into a BT.2020 LMS->RGB
165
+ * matrix based on a Hunt-Pointer-Estevez transform, but without any
166
+ * crosstalk. (See the definition of the ICtCp colorspace for more
167
+ * information.)
168
+ */
169
+ AVRational ycc_to_rgb_matrix[9]; /* before PQ linearization */
170
+ AVRational ycc_to_rgb_offset[3]; /* input offset of neutral value */
171
+ AVRational rgb_to_lms_matrix[9]; /* after PQ linearization */
172
+
173
+ /**
174
+ * Extra signal metadata (see Dolby patents for more info).
175
+ */
176
+ uint16_t signal_eotf;
177
+ uint16_t signal_eotf_param0;
178
+ uint16_t signal_eotf_param1;
179
+ uint32_t signal_eotf_param2;
180
+ uint8_t signal_bit_depth;
181
+ uint8_t signal_color_space;
182
+ uint8_t signal_chroma_format;
183
+ uint8_t signal_full_range_flag; /* [0, 3] */
184
+ uint16_t source_min_pq;
185
+ uint16_t source_max_pq;
186
+ uint16_t source_diagonal;
187
+ } AVDOVIColorMetadata;
188
+
189
+ /**
190
+ * Combined struct representing a combination of header, mapping and color
191
+ * metadata, for attaching to frames as side data.
192
+ *
193
+ * @note The struct must be allocated with av_dovi_metadata_alloc() and
194
+ * its size is not a part of the public ABI.
195
+ */
196
+
197
+ typedef struct AVDOVIMetadata {
198
+ /**
199
+ * Offset in bytes from the beginning of this structure at which the
200
+ * respective structs start.
201
+ */
202
+ size_t header_offset; /* AVDOVIRpuDataHeader */
203
+ size_t mapping_offset; /* AVDOVIDataMapping */
204
+ size_t color_offset; /* AVDOVIColorMetadata */
205
+ } AVDOVIMetadata;
206
+
207
+ static av_always_inline AVDOVIRpuDataHeader *
208
+ av_dovi_get_header(const AVDOVIMetadata *data)
209
+ {
210
+ return (AVDOVIRpuDataHeader *)((uint8_t *) data + data->header_offset);
211
+ }
212
+
213
+ static av_always_inline AVDOVIDataMapping *
214
+ av_dovi_get_mapping(const AVDOVIMetadata *data)
215
+ {
216
+ return (AVDOVIDataMapping *)((uint8_t *) data + data->mapping_offset);
217
+ }
218
+
219
+ static av_always_inline AVDOVIColorMetadata *
220
+ av_dovi_get_color(const AVDOVIMetadata *data)
221
+ {
222
+ return (AVDOVIColorMetadata *)((uint8_t *) data + data->color_offset);
223
+ }
224
+
225
+ /**
226
+ * Allocate an AVDOVIMetadata structure and initialize its
227
+ * fields to default values.
228
+ *
229
+ * @param size If this parameter is non-NULL, the size in bytes of the
230
+ * allocated struct will be written here on success
231
+ *
232
+ * @return the newly allocated struct or NULL on failure
233
+ */
234
+ AVDOVIMetadata *av_dovi_metadata_alloc(size_t *size);
235
+
236
+ #endif /* AVUTIL_DOVI_META_H */
@@ -0,0 +1,115 @@
1
+ /*
2
+ * Copyright (c) 2014 Tim Walker <tdskywalker@gmail.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_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
+ * If the side data is absent, it is created and added to the frame.
99
+ *
100
+ * @param frame the frame for which the side data is to be obtained or created
101
+ *
102
+ * @return the AVDownmixInfo structure to be edited by the caller, or NULL if
103
+ * the structure cannot be allocated.
104
+ */
105
+ AVDownmixInfo *av_downmix_info_update_side_data(AVFrame *frame);
106
+
107
+ /**
108
+ * @}
109
+ */
110
+
111
+ /**
112
+ * @}
113
+ */
114
+
115
+ #endif /* AVUTIL_DOWNMIX_INFO_H */
@@ -0,0 +1,205 @@
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_ENCRYPTION_INFO_H
20
+ #define AVUTIL_ENCRYPTION_INFO_H
21
+
22
+ #include <stddef.h>
23
+ #include <stdint.h>
24
+
25
+ typedef struct AVSubsampleEncryptionInfo {
26
+ /** The number of bytes that are clear. */
27
+ unsigned int bytes_of_clear_data;
28
+
29
+ /**
30
+ * The number of bytes that are protected. If using pattern encryption,
31
+ * the pattern applies to only the protected bytes; if not using pattern
32
+ * encryption, all these bytes are encrypted.
33
+ */
34
+ unsigned int bytes_of_protected_data;
35
+ } AVSubsampleEncryptionInfo;
36
+
37
+ /**
38
+ * This describes encryption info for a packet. This contains frame-specific
39
+ * info for how to decrypt the packet before passing it to the decoder.
40
+ *
41
+ * The size of this struct is not part of the public ABI.
42
+ */
43
+ typedef struct AVEncryptionInfo {
44
+ /** The fourcc encryption scheme, in big-endian byte order. */
45
+ uint32_t scheme;
46
+
47
+ /**
48
+ * Only used for pattern encryption. This is the number of 16-byte blocks
49
+ * that are encrypted.
50
+ */
51
+ uint32_t crypt_byte_block;
52
+
53
+ /**
54
+ * Only used for pattern encryption. This is the number of 16-byte blocks
55
+ * that are clear.
56
+ */
57
+ uint32_t skip_byte_block;
58
+
59
+ /**
60
+ * The ID of the key used to encrypt the packet. This should always be
61
+ * 16 bytes long, but may be changed in the future.
62
+ */
63
+ uint8_t *key_id;
64
+ uint32_t key_id_size;
65
+
66
+ /**
67
+ * The initialization vector. This may have been zero-filled to be the
68
+ * correct block size. This should always be 16 bytes long, but may be
69
+ * changed in the future.
70
+ */
71
+ uint8_t *iv;
72
+ uint32_t iv_size;
73
+
74
+ /**
75
+ * An array of subsample encryption info specifying how parts of the sample
76
+ * are encrypted. If there are no subsamples, then the whole sample is
77
+ * encrypted.
78
+ */
79
+ AVSubsampleEncryptionInfo *subsamples;
80
+ uint32_t subsample_count;
81
+ } AVEncryptionInfo;
82
+
83
+ /**
84
+ * This describes info used to initialize an encryption key system.
85
+ *
86
+ * The size of this struct is not part of the public ABI.
87
+ */
88
+ typedef struct AVEncryptionInitInfo {
89
+ /**
90
+ * A unique identifier for the key system this is for, can be NULL if it
91
+ * is not known. This should always be 16 bytes, but may change in the
92
+ * future.
93
+ */
94
+ uint8_t* system_id;
95
+ uint32_t system_id_size;
96
+
97
+ /**
98
+ * An array of key IDs this initialization data is for. All IDs are the
99
+ * same length. Can be NULL if there are no known key IDs.
100
+ */
101
+ uint8_t** key_ids;
102
+ /** The number of key IDs. */
103
+ uint32_t num_key_ids;
104
+ /**
105
+ * The number of bytes in each key ID. This should always be 16, but may
106
+ * change in the future.
107
+ */
108
+ uint32_t key_id_size;
109
+
110
+ /**
111
+ * Key-system specific initialization data. This data is copied directly
112
+ * from the file and the format depends on the specific key system. This
113
+ * can be NULL if there is no initialization data; in that case, there
114
+ * will be at least one key ID.
115
+ */
116
+ uint8_t* data;
117
+ uint32_t data_size;
118
+
119
+ /**
120
+ * An optional pointer to the next initialization info in the list.
121
+ */
122
+ struct AVEncryptionInitInfo *next;
123
+ } AVEncryptionInitInfo;
124
+
125
+ /**
126
+ * Allocates an AVEncryptionInfo structure and sub-pointers to hold the given
127
+ * number of subsamples. This will allocate pointers for the key ID, IV,
128
+ * and subsample entries, set the size members, and zero-initialize the rest.
129
+ *
130
+ * @param subsample_count The number of subsamples.
131
+ * @param key_id_size The number of bytes in the key ID, should be 16.
132
+ * @param iv_size The number of bytes in the IV, should be 16.
133
+ *
134
+ * @return The new AVEncryptionInfo structure, or NULL on error.
135
+ */
136
+ AVEncryptionInfo *av_encryption_info_alloc(uint32_t subsample_count, uint32_t key_id_size, uint32_t iv_size);
137
+
138
+ /**
139
+ * Allocates an AVEncryptionInfo structure with a copy of the given data.
140
+ * @return The new AVEncryptionInfo structure, or NULL on error.
141
+ */
142
+ AVEncryptionInfo *av_encryption_info_clone(const AVEncryptionInfo *info);
143
+
144
+ /**
145
+ * Frees the given encryption info object. This MUST NOT be used to free the
146
+ * side-data data pointer, that should use normal side-data methods.
147
+ */
148
+ void av_encryption_info_free(AVEncryptionInfo *info);
149
+
150
+ /**
151
+ * Creates a copy of the AVEncryptionInfo that is contained in the given side
152
+ * data. The resulting object should be passed to av_encryption_info_free()
153
+ * when done.
154
+ *
155
+ * @return The new AVEncryptionInfo structure, or NULL on error.
156
+ */
157
+ AVEncryptionInfo *av_encryption_info_get_side_data(const uint8_t *side_data, size_t side_data_size);
158
+
159
+ /**
160
+ * Allocates and initializes side data that holds a copy of the given encryption
161
+ * info. The resulting pointer should be either freed using av_free or given
162
+ * to av_packet_add_side_data().
163
+ *
164
+ * @return The new side-data pointer, or NULL.
165
+ */
166
+ uint8_t *av_encryption_info_add_side_data(
167
+ const AVEncryptionInfo *info, size_t *side_data_size);
168
+
169
+
170
+ /**
171
+ * Allocates an AVEncryptionInitInfo structure and sub-pointers to hold the
172
+ * given sizes. This will allocate pointers and set all the fields.
173
+ *
174
+ * @return The new AVEncryptionInitInfo structure, or NULL on error.
175
+ */
176
+ AVEncryptionInitInfo *av_encryption_init_info_alloc(
177
+ uint32_t system_id_size, uint32_t num_key_ids, uint32_t key_id_size, uint32_t data_size);
178
+
179
+ /**
180
+ * Frees the given encryption init info object. This MUST NOT be used to free
181
+ * the side-data data pointer, that should use normal side-data methods.
182
+ */
183
+ void av_encryption_init_info_free(AVEncryptionInitInfo* info);
184
+
185
+ /**
186
+ * Creates a copy of the AVEncryptionInitInfo that is contained in the given
187
+ * side data. The resulting object should be passed to
188
+ * av_encryption_init_info_free() when done.
189
+ *
190
+ * @return The new AVEncryptionInitInfo structure, or NULL on error.
191
+ */
192
+ AVEncryptionInitInfo *av_encryption_init_info_get_side_data(
193
+ const uint8_t* side_data, size_t side_data_size);
194
+
195
+ /**
196
+ * Allocates and initializes side data that holds a copy of the given encryption
197
+ * init info. The resulting pointer should be either freed using av_free or
198
+ * given to av_packet_add_side_data().
199
+ *
200
+ * @return The new side-data pointer, or NULL.
201
+ */
202
+ uint8_t *av_encryption_init_info_add_side_data(
203
+ const AVEncryptionInitInfo *info, size_t *side_data_size);
204
+
205
+ #endif /* AVUTIL_ENCRYPTION_INFO_H */