@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,229 @@
1
+ /*
2
+ * Copyright (c) 2013 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_stereo3d
24
+ * Stereoscopic video
25
+ */
26
+
27
+ #ifndef AVUTIL_STEREO3D_H
28
+ #define AVUTIL_STEREO3D_H
29
+
30
+ #include <stdint.h>
31
+
32
+ #include "frame.h"
33
+
34
+ /**
35
+ * @defgroup lavu_video_stereo3d Stereo3D types and functions
36
+ * @ingroup lavu_video
37
+ *
38
+ * A stereoscopic video file consists in multiple views embedded in a single
39
+ * frame, usually describing two views of a scene. This file describes all
40
+ * possible codec-independent view arrangements.
41
+ *
42
+ * @{
43
+ */
44
+
45
+ /**
46
+ * List of possible 3D Types
47
+ */
48
+ enum AVStereo3DType {
49
+ /**
50
+ * Video is not stereoscopic (and metadata has to be there).
51
+ */
52
+ AV_STEREO3D_2D,
53
+
54
+ /**
55
+ * Views are next to each other.
56
+ *
57
+ * @code{.unparsed}
58
+ * LLLLRRRR
59
+ * LLLLRRRR
60
+ * LLLLRRRR
61
+ * ...
62
+ * @endcode
63
+ */
64
+ AV_STEREO3D_SIDEBYSIDE,
65
+
66
+ /**
67
+ * Views are on top of each other.
68
+ *
69
+ * @code{.unparsed}
70
+ * LLLLLLLL
71
+ * LLLLLLLL
72
+ * RRRRRRRR
73
+ * RRRRRRRR
74
+ * @endcode
75
+ */
76
+ AV_STEREO3D_TOPBOTTOM,
77
+
78
+ /**
79
+ * Views are alternated temporally.
80
+ *
81
+ * @code{.unparsed}
82
+ * frame0 frame1 frame2 ...
83
+ * LLLLLLLL RRRRRRRR LLLLLLLL
84
+ * LLLLLLLL RRRRRRRR LLLLLLLL
85
+ * LLLLLLLL RRRRRRRR LLLLLLLL
86
+ * ... ... ...
87
+ * @endcode
88
+ */
89
+ AV_STEREO3D_FRAMESEQUENCE,
90
+
91
+ /**
92
+ * Views are packed in a checkerboard-like structure per pixel.
93
+ *
94
+ * @code{.unparsed}
95
+ * LRLRLRLR
96
+ * RLRLRLRL
97
+ * LRLRLRLR
98
+ * ...
99
+ * @endcode
100
+ */
101
+ AV_STEREO3D_CHECKERBOARD,
102
+
103
+ /**
104
+ * Views are next to each other, but when upscaling
105
+ * apply a checkerboard pattern.
106
+ *
107
+ * @code{.unparsed}
108
+ * LLLLRRRR L L L L R R R R
109
+ * LLLLRRRR => L L L L R R R R
110
+ * LLLLRRRR L L L L R R R R
111
+ * LLLLRRRR L L L L R R R R
112
+ * @endcode
113
+ */
114
+ AV_STEREO3D_SIDEBYSIDE_QUINCUNX,
115
+
116
+ /**
117
+ * Views are packed per line, as if interlaced.
118
+ *
119
+ * @code{.unparsed}
120
+ * LLLLLLLL
121
+ * RRRRRRRR
122
+ * LLLLLLLL
123
+ * ...
124
+ * @endcode
125
+ */
126
+ AV_STEREO3D_LINES,
127
+
128
+ /**
129
+ * Views are packed per column.
130
+ *
131
+ * @code{.unparsed}
132
+ * LRLRLRLR
133
+ * LRLRLRLR
134
+ * LRLRLRLR
135
+ * ...
136
+ * @endcode
137
+ */
138
+ AV_STEREO3D_COLUMNS,
139
+ };
140
+
141
+ /**
142
+ * List of possible view types.
143
+ */
144
+ enum AVStereo3DView {
145
+ /**
146
+ * Frame contains two packed views.
147
+ */
148
+ AV_STEREO3D_VIEW_PACKED,
149
+
150
+ /**
151
+ * Frame contains only the left view.
152
+ */
153
+ AV_STEREO3D_VIEW_LEFT,
154
+
155
+ /**
156
+ * Frame contains only the right view.
157
+ */
158
+ AV_STEREO3D_VIEW_RIGHT,
159
+ };
160
+
161
+ /**
162
+ * Inverted views, Right/Bottom represents the left view.
163
+ */
164
+ #define AV_STEREO3D_FLAG_INVERT (1 << 0)
165
+
166
+ /**
167
+ * Stereo 3D type: this structure describes how two videos are packed
168
+ * within a single video surface, with additional information as needed.
169
+ *
170
+ * @note The struct must be allocated with av_stereo3d_alloc() and
171
+ * its size is not a part of the public ABI.
172
+ */
173
+ typedef struct AVStereo3D {
174
+ /**
175
+ * How views are packed within the video.
176
+ */
177
+ enum AVStereo3DType type;
178
+
179
+ /**
180
+ * Additional information about the frame packing.
181
+ */
182
+ int flags;
183
+
184
+ /**
185
+ * Determines which views are packed.
186
+ */
187
+ enum AVStereo3DView view;
188
+ } AVStereo3D;
189
+
190
+ /**
191
+ * Allocate an AVStereo3D structure and set its fields to default values.
192
+ * The resulting struct can be freed using av_freep().
193
+ *
194
+ * @return An AVStereo3D filled with default values or NULL on failure.
195
+ */
196
+ AVStereo3D *av_stereo3d_alloc(void);
197
+
198
+ /**
199
+ * Allocate a complete AVFrameSideData and add it to the frame.
200
+ *
201
+ * @param frame The frame which side data is added to.
202
+ *
203
+ * @return The AVStereo3D structure to be filled by caller.
204
+ */
205
+ AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame);
206
+
207
+ /**
208
+ * Provide a human-readable name of a given stereo3d type.
209
+ *
210
+ * @param type The input stereo3d type value.
211
+ *
212
+ * @return The name of the stereo3d value, or "unknown".
213
+ */
214
+ const char *av_stereo3d_type_name(unsigned int type);
215
+
216
+ /**
217
+ * Get the AVStereo3DType form a human-readable name.
218
+ *
219
+ * @param name The input string.
220
+ *
221
+ * @return The AVStereo3DType value, or -1 if not found.
222
+ */
223
+ int av_stereo3d_from_name(const char *name);
224
+
225
+ /**
226
+ * @}
227
+ */
228
+
229
+ #endif /* AVUTIL_STEREO3D_H */
@@ -0,0 +1,71 @@
1
+ /*
2
+ * A 32-bit implementation of the TEA algorithm
3
+ * Copyright (c) 2015 Vesselin Bontchev
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_TEA_H
23
+ #define AVUTIL_TEA_H
24
+
25
+ #include <stdint.h>
26
+
27
+ /**
28
+ * @file
29
+ * @brief Public header for libavutil TEA algorithm
30
+ * @defgroup lavu_tea TEA
31
+ * @ingroup lavu_crypto
32
+ * @{
33
+ */
34
+
35
+ extern const int av_tea_size;
36
+
37
+ struct AVTEA;
38
+
39
+ /**
40
+ * Allocate an AVTEA context
41
+ * To free the struct: av_free(ptr)
42
+ */
43
+ struct AVTEA *av_tea_alloc(void);
44
+
45
+ /**
46
+ * Initialize an AVTEA context.
47
+ *
48
+ * @param ctx an AVTEA context
49
+ * @param key a key of 16 bytes used for encryption/decryption
50
+ * @param rounds the number of rounds in TEA (64 is the "standard")
51
+ */
52
+ void av_tea_init(struct AVTEA *ctx, const uint8_t key[16], int rounds);
53
+
54
+ /**
55
+ * Encrypt or decrypt a buffer using a previously initialized context.
56
+ *
57
+ * @param ctx an AVTEA context
58
+ * @param dst destination array, can be equal to src
59
+ * @param src source array, can be equal to dst
60
+ * @param count number of 8 byte blocks
61
+ * @param iv initialization vector for CBC mode, if NULL then ECB will be used
62
+ * @param decrypt 0 for encryption, 1 for decryption
63
+ */
64
+ void av_tea_crypt(struct AVTEA *ctx, uint8_t *dst, const uint8_t *src,
65
+ int count, uint8_t *iv, int decrypt);
66
+
67
+ /**
68
+ * @}
69
+ */
70
+
71
+ #endif /* AVUTIL_TEA_H */
@@ -0,0 +1,204 @@
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
+ // This header should only be used to simplify code where
20
+ // threading is optional, not as a generic threading abstraction.
21
+
22
+ #ifndef AVUTIL_THREAD_H
23
+ #define AVUTIL_THREAD_H
24
+
25
+ #include "config.h"
26
+
27
+ #if HAVE_PRCTL
28
+ #include <sys/prctl.h>
29
+ #endif
30
+
31
+ #include "error.h"
32
+
33
+ #if HAVE_PTHREADS || HAVE_W32THREADS || HAVE_OS2THREADS
34
+
35
+ #if HAVE_PTHREADS
36
+ #include <pthread.h>
37
+
38
+ #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1
39
+
40
+ #include <stdlib.h>
41
+
42
+ #include "log.h"
43
+ #include "macros.h"
44
+
45
+ #define ASSERT_PTHREAD_ABORT(func, ret) do { \
46
+ char errbuf[AV_ERROR_MAX_STRING_SIZE] = ""; \
47
+ av_log(NULL, AV_LOG_FATAL, AV_STRINGIFY(func) \
48
+ " failed with error: %s\n", \
49
+ av_make_error_string(errbuf, AV_ERROR_MAX_STRING_SIZE, \
50
+ AVERROR(ret))); \
51
+ abort(); \
52
+ } while (0)
53
+
54
+ #define ASSERT_PTHREAD_NORET(func, ...) do { \
55
+ int ret = func(__VA_ARGS__); \
56
+ if (ret) \
57
+ ASSERT_PTHREAD_ABORT(func, ret); \
58
+ } while (0)
59
+
60
+ #define ASSERT_PTHREAD(func, ...) do { \
61
+ ASSERT_PTHREAD_NORET(func, __VA_ARGS__); \
62
+ return 0; \
63
+ } while (0)
64
+
65
+ static inline int strict_pthread_join(pthread_t thread, void **value_ptr)
66
+ {
67
+ ASSERT_PTHREAD(pthread_join, thread, value_ptr);
68
+ }
69
+
70
+ static inline int strict_pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
71
+ {
72
+ if (attr) {
73
+ ASSERT_PTHREAD_NORET(pthread_mutex_init, mutex, attr);
74
+ } else {
75
+ pthread_mutexattr_t local_attr;
76
+ ASSERT_PTHREAD_NORET(pthread_mutexattr_init, &local_attr);
77
+ ASSERT_PTHREAD_NORET(pthread_mutexattr_settype, &local_attr, PTHREAD_MUTEX_ERRORCHECK);
78
+ ASSERT_PTHREAD_NORET(pthread_mutex_init, mutex, &local_attr);
79
+ ASSERT_PTHREAD_NORET(pthread_mutexattr_destroy, &local_attr);
80
+ }
81
+ return 0;
82
+ }
83
+
84
+ static inline int strict_pthread_mutex_destroy(pthread_mutex_t *mutex)
85
+ {
86
+ ASSERT_PTHREAD(pthread_mutex_destroy, mutex);
87
+ }
88
+
89
+ static inline int strict_pthread_mutex_lock(pthread_mutex_t *mutex)
90
+ {
91
+ ASSERT_PTHREAD(pthread_mutex_lock, mutex);
92
+ }
93
+
94
+ static inline int strict_pthread_mutex_unlock(pthread_mutex_t *mutex)
95
+ {
96
+ ASSERT_PTHREAD(pthread_mutex_unlock, mutex);
97
+ }
98
+
99
+ static inline int strict_pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
100
+ {
101
+ ASSERT_PTHREAD(pthread_cond_init, cond, attr);
102
+ }
103
+
104
+ static inline int strict_pthread_cond_destroy(pthread_cond_t *cond)
105
+ {
106
+ ASSERT_PTHREAD(pthread_cond_destroy, cond);
107
+ }
108
+
109
+ static inline int strict_pthread_cond_signal(pthread_cond_t *cond)
110
+ {
111
+ ASSERT_PTHREAD(pthread_cond_signal, cond);
112
+ }
113
+
114
+ static inline int strict_pthread_cond_broadcast(pthread_cond_t *cond)
115
+ {
116
+ ASSERT_PTHREAD(pthread_cond_broadcast, cond);
117
+ }
118
+
119
+ static inline int strict_pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
120
+ {
121
+ ASSERT_PTHREAD(pthread_cond_wait, cond, mutex);
122
+ }
123
+
124
+ static inline int strict_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
125
+ const struct timespec *abstime)
126
+ {
127
+ int ret = pthread_cond_timedwait(cond, mutex, abstime);
128
+ if (ret && ret != ETIMEDOUT)
129
+ ASSERT_PTHREAD_ABORT(pthread_cond_timedwait, ret);
130
+ return ret;
131
+ }
132
+
133
+ static inline int strict_pthread_once(pthread_once_t *once_control, void (*init_routine)(void))
134
+ {
135
+ ASSERT_PTHREAD(pthread_once, once_control, init_routine);
136
+ }
137
+
138
+ #define pthread_join strict_pthread_join
139
+ #define pthread_mutex_init strict_pthread_mutex_init
140
+ #define pthread_mutex_destroy strict_pthread_mutex_destroy
141
+ #define pthread_mutex_lock strict_pthread_mutex_lock
142
+ #define pthread_mutex_unlock strict_pthread_mutex_unlock
143
+ #define pthread_cond_init strict_pthread_cond_init
144
+ #define pthread_cond_destroy strict_pthread_cond_destroy
145
+ #define pthread_cond_signal strict_pthread_cond_signal
146
+ #define pthread_cond_broadcast strict_pthread_cond_broadcast
147
+ #define pthread_cond_wait strict_pthread_cond_wait
148
+ #define pthread_cond_timedwait strict_pthread_cond_timedwait
149
+ #define pthread_once strict_pthread_once
150
+ #endif
151
+
152
+ #elif HAVE_OS2THREADS
153
+ #include "compat/os2threads.h"
154
+ #else
155
+ #include "compat/w32pthreads.h"
156
+ #endif
157
+
158
+ #define AVMutex pthread_mutex_t
159
+ #define AV_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
160
+
161
+ #define ff_mutex_init pthread_mutex_init
162
+ #define ff_mutex_lock pthread_mutex_lock
163
+ #define ff_mutex_unlock pthread_mutex_unlock
164
+ #define ff_mutex_destroy pthread_mutex_destroy
165
+
166
+ #define AVOnce pthread_once_t
167
+ #define AV_ONCE_INIT PTHREAD_ONCE_INIT
168
+
169
+ #define ff_thread_once(control, routine) pthread_once(control, routine)
170
+
171
+ #else
172
+
173
+ #define AVMutex char
174
+ #define AV_MUTEX_INITIALIZER 0
175
+
176
+ static inline int ff_mutex_init(AVMutex *mutex, const void *attr){ return 0; }
177
+ static inline int ff_mutex_lock(AVMutex *mutex){ return 0; }
178
+ static inline int ff_mutex_unlock(AVMutex *mutex){ return 0; }
179
+ static inline int ff_mutex_destroy(AVMutex *mutex){ return 0; }
180
+
181
+ #define AVOnce char
182
+ #define AV_ONCE_INIT 0
183
+
184
+ static inline int ff_thread_once(char *control, void (*routine)(void))
185
+ {
186
+ if (!*control) {
187
+ routine();
188
+ *control = 1;
189
+ }
190
+ return 0;
191
+ }
192
+
193
+ #endif
194
+
195
+ static inline int ff_thread_setname(const char *name)
196
+ {
197
+ #if HAVE_PRCTL
198
+ return AVERROR(prctl(PR_SET_NAME, name));
199
+ #endif
200
+
201
+ return AVERROR(ENOSYS);
202
+ }
203
+
204
+ #endif /* AVUTIL_THREAD_H */
@@ -0,0 +1,115 @@
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 License
6
+ * 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
12
+ * GNU Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public License
15
+ * along with FFmpeg; if not, write to the Free Software Foundation, Inc.,
16
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+ #ifndef AVUTIL_THREADMESSAGE_H
20
+ #define AVUTIL_THREADMESSAGE_H
21
+
22
+ typedef struct AVThreadMessageQueue AVThreadMessageQueue;
23
+
24
+ typedef enum AVThreadMessageFlags {
25
+
26
+ /**
27
+ * Perform non-blocking operation.
28
+ * If this flag is set, send and recv operations are non-blocking and
29
+ * return AVERROR(EAGAIN) immediately if they can not proceed.
30
+ */
31
+ AV_THREAD_MESSAGE_NONBLOCK = 1,
32
+
33
+ } AVThreadMessageFlags;
34
+
35
+ /**
36
+ * Allocate a new message queue.
37
+ *
38
+ * @param mq pointer to the message queue
39
+ * @param nelem maximum number of elements in the queue
40
+ * @param elsize size of each element in the queue
41
+ * @return >=0 for success; <0 for error, in particular AVERROR(ENOSYS) if
42
+ * lavu was built without thread support
43
+ */
44
+ int av_thread_message_queue_alloc(AVThreadMessageQueue **mq,
45
+ unsigned nelem,
46
+ unsigned elsize);
47
+
48
+ /**
49
+ * Free a message queue.
50
+ *
51
+ * The message queue must no longer be in use by another thread.
52
+ */
53
+ void av_thread_message_queue_free(AVThreadMessageQueue **mq);
54
+
55
+ /**
56
+ * Send a message on the queue.
57
+ */
58
+ int av_thread_message_queue_send(AVThreadMessageQueue *mq,
59
+ void *msg,
60
+ unsigned flags);
61
+
62
+ /**
63
+ * Receive a message from the queue.
64
+ */
65
+ int av_thread_message_queue_recv(AVThreadMessageQueue *mq,
66
+ void *msg,
67
+ unsigned flags);
68
+
69
+ /**
70
+ * Set the sending error code.
71
+ *
72
+ * If the error code is set to non-zero, av_thread_message_queue_send() will
73
+ * return it immediately. Conventional values, such as AVERROR_EOF or
74
+ * AVERROR(EAGAIN), can be used to cause the sending thread to stop or
75
+ * suspend its operation.
76
+ */
77
+ void av_thread_message_queue_set_err_send(AVThreadMessageQueue *mq,
78
+ int err);
79
+
80
+ /**
81
+ * Set the receiving error code.
82
+ *
83
+ * If the error code is set to non-zero, av_thread_message_queue_recv() will
84
+ * return it immediately when there are no longer available messages.
85
+ * Conventional values, such as AVERROR_EOF or AVERROR(EAGAIN), can be used
86
+ * to cause the receiving thread to stop or suspend its operation.
87
+ */
88
+ void av_thread_message_queue_set_err_recv(AVThreadMessageQueue *mq,
89
+ int err);
90
+
91
+ /**
92
+ * Set the optional free message callback function which will be called if an
93
+ * operation is removing messages from the queue.
94
+ */
95
+ void av_thread_message_queue_set_free_func(AVThreadMessageQueue *mq,
96
+ void (*free_func)(void *msg));
97
+
98
+ /**
99
+ * Return the current number of messages in the queue.
100
+ *
101
+ * @return the current number of messages or AVERROR(ENOSYS) if lavu was built
102
+ * without thread support
103
+ */
104
+ int av_thread_message_queue_nb_elems(AVThreadMessageQueue *mq);
105
+
106
+ /**
107
+ * Flush the message queue
108
+ *
109
+ * This function is mostly equivalent to reading and free-ing every message
110
+ * except that it will be done in a single operation (no lock/unlock between
111
+ * reads).
112
+ */
113
+ void av_thread_message_flush(AVThreadMessageQueue *mq);
114
+
115
+ #endif /* AVUTIL_THREADMESSAGE_H */
@@ -0,0 +1,56 @@
1
+ /*
2
+ * Copyright (c) 2000-2003 Fabrice Bellard
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+ #ifndef AVUTIL_TIME_H
22
+ #define AVUTIL_TIME_H
23
+
24
+ #include <stdint.h>
25
+
26
+ /**
27
+ * Get the current time in microseconds.
28
+ */
29
+ int64_t av_gettime(void);
30
+
31
+ /**
32
+ * Get the current time in microseconds since some unspecified starting point.
33
+ * On platforms that support it, the time comes from a monotonic clock
34
+ * This property makes this time source ideal for measuring relative time.
35
+ * The returned values may not be monotonic on platforms where a monotonic
36
+ * clock is not available.
37
+ */
38
+ int64_t av_gettime_relative(void);
39
+
40
+ /**
41
+ * Indicates with a boolean result if the av_gettime_relative() time source
42
+ * is monotonic.
43
+ */
44
+ int av_gettime_relative_is_monotonic(void);
45
+
46
+ /**
47
+ * Sleep for a period of time. Although the duration is expressed in
48
+ * microseconds, the actual delay may be rounded to the precision of the
49
+ * system timer.
50
+ *
51
+ * @param usec Number of microseconds to sleep.
52
+ * @return zero on success or (negative) error code.
53
+ */
54
+ int av_usleep(unsigned usec);
55
+
56
+ #endif /* AVUTIL_TIME_H */