@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,199 @@
1
+ /*
2
+ * Copyright (c) 2006 Smartjog S.A.S, Baptiste Coudurier <baptiste.coudurier@gmail.com>
3
+ * Copyright (c) 2011-2012 Smartjog S.A.S, Clément Bœsch <clement.boesch@smartjog.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
+ * Timecode helpers header
25
+ */
26
+
27
+ #ifndef AVUTIL_TIMECODE_H
28
+ #define AVUTIL_TIMECODE_H
29
+
30
+ #include <stdint.h>
31
+ #include "rational.h"
32
+
33
+ #define AV_TIMECODE_STR_SIZE 23
34
+
35
+ enum AVTimecodeFlag {
36
+ AV_TIMECODE_FLAG_DROPFRAME = 1<<0, ///< timecode is drop frame
37
+ AV_TIMECODE_FLAG_24HOURSMAX = 1<<1, ///< timecode wraps after 24 hours
38
+ AV_TIMECODE_FLAG_ALLOWNEGATIVE = 1<<2, ///< negative time values are allowed
39
+ };
40
+
41
+ typedef struct {
42
+ int start; ///< timecode frame start (first base frame number)
43
+ uint32_t flags; ///< flags such as drop frame, +24 hours support, ...
44
+ AVRational rate; ///< frame rate in rational form
45
+ unsigned fps; ///< frame per second; must be consistent with the rate field
46
+ } AVTimecode;
47
+
48
+ /**
49
+ * Adjust frame number for NTSC drop frame time code.
50
+ *
51
+ * @param framenum frame number to adjust
52
+ * @param fps frame per second, multiples of 30
53
+ * @return adjusted frame number
54
+ * @warning adjustment is only valid for multiples of NTSC 29.97
55
+ */
56
+ int av_timecode_adjust_ntsc_framenum2(int framenum, int fps);
57
+
58
+ /**
59
+ * Convert frame number to SMPTE 12M binary representation.
60
+ *
61
+ * @param tc timecode data correctly initialized
62
+ * @param framenum frame number
63
+ * @return the SMPTE binary representation
64
+ *
65
+ * See SMPTE ST 314M-2005 Sec 4.4.2.2.1 "Time code pack (TC)"
66
+ * the format description as follows:
67
+ * bits 0-5: hours, in BCD(6bits)
68
+ * bits 6: BGF1
69
+ * bits 7: BGF2 (NTSC) or FIELD (PAL)
70
+ * bits 8-14: minutes, in BCD(7bits)
71
+ * bits 15: BGF0 (NTSC) or BGF2 (PAL)
72
+ * bits 16-22: seconds, in BCD(7bits)
73
+ * bits 23: FIELD (NTSC) or BGF0 (PAL)
74
+ * bits 24-29: frames, in BCD(6bits)
75
+ * bits 30: drop frame flag (0: non drop, 1: drop)
76
+ * bits 31: color frame flag (0: unsync mode, 1: sync mode)
77
+ * @note BCD numbers (6 or 7 bits): 4 or 5 lower bits for units, 2 higher bits for tens.
78
+ * @note Frame number adjustment is automatically done in case of drop timecode,
79
+ * you do NOT have to call av_timecode_adjust_ntsc_framenum2().
80
+ * @note The frame number is relative to tc->start.
81
+ * @note Color frame (CF) and binary group flags (BGF) bits are set to zero.
82
+ */
83
+ uint32_t av_timecode_get_smpte_from_framenum(const AVTimecode *tc, int framenum);
84
+
85
+ /**
86
+ * Convert sei info to SMPTE 12M binary representation.
87
+ *
88
+ * @param rate frame rate in rational form
89
+ * @param drop drop flag
90
+ * @param hh hour
91
+ * @param mm minute
92
+ * @param ss second
93
+ * @param ff frame number
94
+ * @return the SMPTE binary representation
95
+ */
96
+ uint32_t av_timecode_get_smpte(AVRational rate, int drop, int hh, int mm, int ss, int ff);
97
+
98
+ /**
99
+ * Load timecode string in buf.
100
+ *
101
+ * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long
102
+ * @param tc timecode data correctly initialized
103
+ * @param framenum frame number
104
+ * @return the buf parameter
105
+ *
106
+ * @note Timecode representation can be a negative timecode and have more than
107
+ * 24 hours, but will only be honored if the flags are correctly set.
108
+ * @note The frame number is relative to tc->start.
109
+ */
110
+ char *av_timecode_make_string(const AVTimecode *tc, char *buf, int framenum);
111
+
112
+ /**
113
+ * Get the timecode string from the SMPTE timecode format.
114
+ *
115
+ * In contrast to av_timecode_make_smpte_tc_string this function supports 50/60
116
+ * fps timecodes by using the field bit.
117
+ *
118
+ * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long
119
+ * @param rate frame rate of the timecode
120
+ * @param tcsmpte the 32-bit SMPTE timecode
121
+ * @param prevent_df prevent the use of a drop flag when it is known the DF bit
122
+ * is arbitrary
123
+ * @param skip_field prevent the use of a field flag when it is known the field
124
+ * bit is arbitrary (e.g. because it is used as PC flag)
125
+ * @return the buf parameter
126
+ */
127
+ char *av_timecode_make_smpte_tc_string2(char *buf, AVRational rate, uint32_t tcsmpte, int prevent_df, int skip_field);
128
+
129
+ /**
130
+ * Get the timecode string from the SMPTE timecode format.
131
+ *
132
+ * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long
133
+ * @param tcsmpte the 32-bit SMPTE timecode
134
+ * @param prevent_df prevent the use of a drop flag when it is known the DF bit
135
+ * is arbitrary
136
+ * @return the buf parameter
137
+ */
138
+ char *av_timecode_make_smpte_tc_string(char *buf, uint32_t tcsmpte, int prevent_df);
139
+
140
+ /**
141
+ * Get the timecode string from the 25-bit timecode format (MPEG GOP format).
142
+ *
143
+ * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long
144
+ * @param tc25bit the 25-bits timecode
145
+ * @return the buf parameter
146
+ */
147
+ char *av_timecode_make_mpeg_tc_string(char *buf, uint32_t tc25bit);
148
+
149
+ /**
150
+ * Init a timecode struct with the passed parameters.
151
+ *
152
+ * @param log_ctx a pointer to an arbitrary struct of which the first field
153
+ * is a pointer to an AVClass struct (used for av_log)
154
+ * @param tc pointer to an allocated AVTimecode
155
+ * @param rate frame rate in rational form
156
+ * @param flags miscellaneous flags such as drop frame, +24 hours, ...
157
+ * (see AVTimecodeFlag)
158
+ * @param frame_start the first frame number
159
+ * @return 0 on success, AVERROR otherwise
160
+ */
161
+ int av_timecode_init(AVTimecode *tc, AVRational rate, int flags, int frame_start, void *log_ctx);
162
+
163
+ /**
164
+ * Init a timecode struct from the passed timecode components.
165
+ *
166
+ * @param log_ctx a pointer to an arbitrary struct of which the first field
167
+ * is a pointer to an AVClass struct (used for av_log)
168
+ * @param tc pointer to an allocated AVTimecode
169
+ * @param rate frame rate in rational form
170
+ * @param flags miscellaneous flags such as drop frame, +24 hours, ...
171
+ * (see AVTimecodeFlag)
172
+ * @param hh hours
173
+ * @param mm minutes
174
+ * @param ss seconds
175
+ * @param ff frames
176
+ * @return 0 on success, AVERROR otherwise
177
+ */
178
+ int av_timecode_init_from_components(AVTimecode *tc, AVRational rate, int flags, int hh, int mm, int ss, int ff, void *log_ctx);
179
+
180
+ /**
181
+ * Parse timecode representation (hh:mm:ss[:;.]ff).
182
+ *
183
+ * @param log_ctx a pointer to an arbitrary struct of which the first field is a
184
+ * pointer to an AVClass struct (used for av_log).
185
+ * @param tc pointer to an allocated AVTimecode
186
+ * @param rate frame rate in rational form
187
+ * @param str timecode string which will determine the frame start
188
+ * @return 0 on success, AVERROR otherwise
189
+ */
190
+ int av_timecode_init_from_string(AVTimecode *tc, AVRational rate, const char *str, void *log_ctx);
191
+
192
+ /**
193
+ * Check if the timecode feature is available for the given frame rate
194
+ *
195
+ * @return 0 if supported, <0 otherwise
196
+ */
197
+ int av_timecode_check_frame_rate(AVRational rate);
198
+
199
+ #endif /* AVUTIL_TIMECODE_H */
@@ -0,0 +1,156 @@
1
+ /*
2
+ * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+ /**
22
+ * @file
23
+ * high precision timer, useful to profile code
24
+ */
25
+
26
+ #ifndef AVUTIL_TIMER_H
27
+ #define AVUTIL_TIMER_H
28
+
29
+ #include "config.h"
30
+
31
+ #if CONFIG_LINUX_PERF
32
+ # ifndef _GNU_SOURCE
33
+ # define _GNU_SOURCE
34
+ # endif
35
+ # include <unistd.h> // read(3)
36
+ # include <sys/ioctl.h>
37
+ # include <asm/unistd.h>
38
+ # include <linux/perf_event.h>
39
+ #endif
40
+
41
+ #include <stdlib.h>
42
+ #include <stdint.h>
43
+ #include <inttypes.h>
44
+
45
+ #if CONFIG_MACOS_KPERF
46
+ #include "macos_kperf.h"
47
+ #elif HAVE_MACH_ABSOLUTE_TIME
48
+ #include <mach/mach_time.h>
49
+ #endif
50
+
51
+ #include "common.h"
52
+ #include "log.h"
53
+
54
+ #if ARCH_AARCH64
55
+ # include "aarch64/timer.h"
56
+ #elif ARCH_ARM
57
+ # include "arm/timer.h"
58
+ #elif ARCH_PPC
59
+ # include "ppc/timer.h"
60
+ #elif ARCH_RISCV
61
+ # include "riscv/timer.h"
62
+ #elif ARCH_X86
63
+ # include "x86/timer.h"
64
+ #endif
65
+
66
+ #if !defined(AV_READ_TIME)
67
+ # if HAVE_GETHRTIME
68
+ # define AV_READ_TIME gethrtime
69
+ # elif HAVE_MACH_ABSOLUTE_TIME
70
+ # define AV_READ_TIME mach_absolute_time
71
+ # endif
72
+ #endif
73
+
74
+ #ifndef FF_TIMER_UNITS
75
+ # define FF_TIMER_UNITS "UNITS"
76
+ #endif
77
+
78
+ #define TIMER_REPORT(id, tdiff) \
79
+ { \
80
+ static uint64_t tsum = 0; \
81
+ static int tcount = 0; \
82
+ static int tskip_count = 0; \
83
+ static int thistogram[32] = {0}; \
84
+ thistogram[av_log2(tdiff)]++; \
85
+ if (tcount < 2 || \
86
+ (tdiff) < 8 * tsum / tcount || \
87
+ (tdiff) < 2000) { \
88
+ tsum += (tdiff); \
89
+ tcount++; \
90
+ } else \
91
+ tskip_count++; \
92
+ if (((tcount + tskip_count) & (tcount + tskip_count - 1)) == 0) { \
93
+ int i; \
94
+ av_log(NULL, AV_LOG_ERROR, \
95
+ "%7" PRIu64 " " FF_TIMER_UNITS " in %s,%8d runs,%7d skips",\
96
+ tsum * 10 / tcount, id, tcount, tskip_count); \
97
+ for (i = 0; i < 32; i++) \
98
+ av_log(NULL, AV_LOG_VERBOSE, " %2d", av_log2(2*thistogram[i]));\
99
+ av_log(NULL, AV_LOG_ERROR, "\n"); \
100
+ } \
101
+ }
102
+
103
+ #if CONFIG_LINUX_PERF
104
+
105
+ #define START_TIMER \
106
+ static int linux_perf_fd; \
107
+ uint64_t tperf; \
108
+ if (!linux_perf_fd) { \
109
+ struct perf_event_attr attr = { \
110
+ .type = PERF_TYPE_HARDWARE, \
111
+ .size = sizeof(struct perf_event_attr), \
112
+ .config = PERF_COUNT_HW_CPU_CYCLES, \
113
+ .disabled = 1, \
114
+ .exclude_kernel = 1, \
115
+ .exclude_hv = 1, \
116
+ }; \
117
+ linux_perf_fd = syscall(__NR_perf_event_open, &attr, \
118
+ 0, -1, -1, 0); \
119
+ } \
120
+ if (linux_perf_fd == -1) { \
121
+ av_log(NULL, AV_LOG_ERROR, "perf_event_open failed: %s\n", \
122
+ av_err2str(AVERROR(errno))); \
123
+ } else { \
124
+ ioctl(linux_perf_fd, PERF_EVENT_IOC_RESET, 0); \
125
+ ioctl(linux_perf_fd, PERF_EVENT_IOC_ENABLE, 0); \
126
+ }
127
+
128
+ #define STOP_TIMER(id) \
129
+ ioctl(linux_perf_fd, PERF_EVENT_IOC_DISABLE, 0); \
130
+ read(linux_perf_fd, &tperf, sizeof(tperf)); \
131
+ TIMER_REPORT(id, tperf)
132
+
133
+ #elif CONFIG_MACOS_KPERF
134
+
135
+ #define START_TIMER \
136
+ uint64_t tperf; \
137
+ ff_kperf_init(); \
138
+ tperf = ff_kperf_cycles();
139
+
140
+ #define STOP_TIMER(id) \
141
+ TIMER_REPORT(id, ff_kperf_cycles() - tperf);
142
+
143
+ #elif defined(AV_READ_TIME)
144
+ #define START_TIMER \
145
+ uint64_t tend; \
146
+ uint64_t tstart = AV_READ_TIME(); \
147
+
148
+ #define STOP_TIMER(id) \
149
+ tend = AV_READ_TIME(); \
150
+ TIMER_REPORT(id, tend - tstart)
151
+ #else
152
+ #define START_TIMER
153
+ #define STOP_TIMER(id) { }
154
+ #endif
155
+
156
+ #endif /* AVUTIL_TIMER_H */
@@ -0,0 +1,78 @@
1
+ /*
2
+ * This file is part of FFmpeg.
3
+ *
4
+ * FFmpeg is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License, or (at your option) any later version.
8
+ *
9
+ * FFmpeg is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ * Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public
15
+ * License along with FFmpeg; if not, write to the Free Software
16
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+ /**
20
+ * @file
21
+ * timestamp utils, mostly useful for debugging/logging purposes
22
+ */
23
+
24
+ #ifndef AVUTIL_TIMESTAMP_H
25
+ #define AVUTIL_TIMESTAMP_H
26
+
27
+ #include "common.h"
28
+
29
+ #if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) && !defined(PRId64)
30
+ #error missing -D__STDC_FORMAT_MACROS / #define __STDC_FORMAT_MACROS
31
+ #endif
32
+
33
+ #define AV_TS_MAX_STRING_SIZE 32
34
+
35
+ /**
36
+ * Fill the provided buffer with a string containing a timestamp
37
+ * representation.
38
+ *
39
+ * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE
40
+ * @param ts the timestamp to represent
41
+ * @return the buffer in input
42
+ */
43
+ static inline char *av_ts_make_string(char *buf, int64_t ts)
44
+ {
45
+ if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS");
46
+ else snprintf(buf, AV_TS_MAX_STRING_SIZE, "%" PRId64, ts);
47
+ return buf;
48
+ }
49
+
50
+ /**
51
+ * Convenience macro, the return value should be used only directly in
52
+ * function arguments but never stand-alone.
53
+ */
54
+ #define av_ts2str(ts) av_ts_make_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts)
55
+
56
+ /**
57
+ * Fill the provided buffer with a string containing a timestamp time
58
+ * representation.
59
+ *
60
+ * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE
61
+ * @param ts the timestamp to represent
62
+ * @param tb the timebase of the timestamp
63
+ * @return the buffer in input
64
+ */
65
+ static inline char *av_ts_make_time_string(char *buf, int64_t ts, AVRational *tb)
66
+ {
67
+ if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS");
68
+ else snprintf(buf, AV_TS_MAX_STRING_SIZE, "%.6g", av_q2d(*tb) * ts);
69
+ return buf;
70
+ }
71
+
72
+ /**
73
+ * Convenience macro, the return value should be used only directly in
74
+ * function arguments but never stand-alone.
75
+ */
76
+ #define av_ts2timestr(ts, tb) av_ts_make_time_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts, tb)
77
+
78
+ #endif /* AVUTIL_TIMESTAMP_H */
@@ -0,0 +1,137 @@
1
+ /*
2
+ * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+ /**
22
+ * @file
23
+ * A tree container.
24
+ * @author Michael Niedermayer <michaelni@gmx.at>
25
+ */
26
+
27
+ #ifndef AVUTIL_TREE_H
28
+ #define AVUTIL_TREE_H
29
+
30
+ #include "attributes.h"
31
+
32
+ /**
33
+ * @addtogroup lavu_tree AVTree
34
+ * @ingroup lavu_data
35
+ *
36
+ * Low-complexity tree container
37
+ *
38
+ * Insertion, removal, finding equal, largest which is smaller than and
39
+ * smallest which is larger than, all have O(log n) worst-case complexity.
40
+ * @{
41
+ */
42
+
43
+
44
+ struct AVTreeNode;
45
+ extern const int av_tree_node_size;
46
+
47
+ /**
48
+ * Allocate an AVTreeNode.
49
+ */
50
+ struct AVTreeNode *av_tree_node_alloc(void);
51
+
52
+ /**
53
+ * Find an element.
54
+ * @param root a pointer to the root node of the tree
55
+ * @param next If next is not NULL, then next[0] will contain the previous
56
+ * element and next[1] the next element. If either does not exist,
57
+ * then the corresponding entry in next is unchanged.
58
+ * @param cmp compare function used to compare elements in the tree,
59
+ * API identical to that of Standard C's qsort
60
+ * It is guaranteed that the first and only the first argument to cmp()
61
+ * will be the key parameter to av_tree_find(), thus it could if the
62
+ * user wants, be a different type (like an opaque context).
63
+ * @return An element with cmp(key, elem) == 0 or NULL if no such element
64
+ * exists in the tree.
65
+ */
66
+ void *av_tree_find(const struct AVTreeNode *root, void *key,
67
+ int (*cmp)(const void *key, const void *b), void *next[2]);
68
+
69
+ /**
70
+ * Insert or remove an element.
71
+ *
72
+ * If *next is NULL, then the supplied element will be removed if it exists.
73
+ * If *next is non-NULL, then the supplied element will be inserted, unless
74
+ * it already exists in the tree.
75
+ *
76
+ * @param rootp A pointer to a pointer to the root node of the tree; note that
77
+ * the root node can change during insertions, this is required
78
+ * to keep the tree balanced.
79
+ * @param key pointer to the element key to insert in the tree
80
+ * @param next Used to allocate and free AVTreeNodes. For insertion the user
81
+ * must set it to an allocated and zeroed object of at least
82
+ * av_tree_node_size bytes size. av_tree_insert() will set it to
83
+ * NULL if it has been consumed.
84
+ * For deleting elements *next is set to NULL by the user and
85
+ * av_tree_insert() will set it to the AVTreeNode which was
86
+ * used for the removed element.
87
+ * This allows the use of flat arrays, which have
88
+ * lower overhead compared to many malloced elements.
89
+ * You might want to define a function like:
90
+ * @code
91
+ * void *tree_insert(struct AVTreeNode **rootp, void *key,
92
+ * int (*cmp)(void *key, const void *b),
93
+ * AVTreeNode **next)
94
+ * {
95
+ * if (!*next)
96
+ * *next = av_mallocz(av_tree_node_size);
97
+ * return av_tree_insert(rootp, key, cmp, next);
98
+ * }
99
+ * void *tree_remove(struct AVTreeNode **rootp, void *key,
100
+ * int (*cmp)(void *key, const void *b, AVTreeNode **next))
101
+ * {
102
+ * av_freep(next);
103
+ * return av_tree_insert(rootp, key, cmp, next);
104
+ * }
105
+ * @endcode
106
+ * @param cmp compare function used to compare elements in the tree, API identical
107
+ * to that of Standard C's qsort
108
+ * @return If no insertion happened, the found element; if an insertion or
109
+ * removal happened, then either key or NULL will be returned.
110
+ * Which one it is depends on the tree state and the implementation. You
111
+ * should make no assumptions that it's one or the other in the code.
112
+ */
113
+ void *av_tree_insert(struct AVTreeNode **rootp, void *key,
114
+ int (*cmp)(const void *key, const void *b),
115
+ struct AVTreeNode **next);
116
+
117
+ void av_tree_destroy(struct AVTreeNode *t);
118
+
119
+ /**
120
+ * Apply enu(opaque, &elem) to all the elements in the tree in a given range.
121
+ *
122
+ * @param cmp a comparison function that returns < 0 for an element below the
123
+ * range, > 0 for an element above the range and == 0 for an
124
+ * element inside the range
125
+ *
126
+ * @note The cmp function should use the same ordering used to construct the
127
+ * tree.
128
+ */
129
+ void av_tree_enumerate(struct AVTreeNode *t, void *opaque,
130
+ int (*cmp)(void *opaque, void *elem),
131
+ int (*enu)(void *opaque, void *elem));
132
+
133
+ /**
134
+ * @}
135
+ */
136
+
137
+ #endif /* AVUTIL_TREE_H */
@@ -0,0 +1,70 @@
1
+ /*
2
+ * An implementation of the TwoFish algorithm
3
+ * Copyright (c) 2015 Supraja Meedinti
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_TWOFISH_H
23
+ #define AVUTIL_TWOFISH_H
24
+
25
+ #include <stdint.h>
26
+
27
+
28
+ /**
29
+ * @file
30
+ * @brief Public header for libavutil TWOFISH algorithm
31
+ * @defgroup lavu_twofish TWOFISH
32
+ * @ingroup lavu_crypto
33
+ * @{
34
+ */
35
+
36
+ extern const int av_twofish_size;
37
+
38
+ struct AVTWOFISH;
39
+
40
+ /**
41
+ * Allocate an AVTWOFISH context
42
+ * To free the struct: av_free(ptr)
43
+ */
44
+ struct AVTWOFISH *av_twofish_alloc(void);
45
+
46
+ /**
47
+ * Initialize an AVTWOFISH context.
48
+ *
49
+ * @param ctx an AVTWOFISH context
50
+ * @param key a key of size ranging from 1 to 32 bytes used for encryption/decryption
51
+ * @param key_bits number of keybits: 128, 192, 256 If less than the required, padded with zeroes to nearest valid value; return value is 0 if key_bits is 128/192/256, -1 if less than 0, 1 otherwise
52
+ */
53
+ int av_twofish_init(struct AVTWOFISH *ctx, const uint8_t *key, int key_bits);
54
+
55
+ /**
56
+ * Encrypt or decrypt a buffer using a previously initialized context
57
+ *
58
+ * @param ctx an AVTWOFISH context
59
+ * @param dst destination array, can be equal to src
60
+ * @param src source array, can be equal to dst
61
+ * @param count number of 16 byte blocks
62
+ * @param iv initialization vector for CBC mode, NULL for ECB mode
63
+ * @param decrypt 0 for encryption, 1 for decryption
64
+ */
65
+ void av_twofish_crypt(struct AVTWOFISH *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t* iv, int decrypt);
66
+
67
+ /**
68
+ * @}
69
+ */
70
+ #endif /* AVUTIL_TWOFISH_H */