@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,82 @@
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 AVCODEC_DV_PROFILE_H
20
+ #define AVCODEC_DV_PROFILE_H
21
+
22
+ #include <stdint.h>
23
+
24
+ #include "libavutil/pixfmt.h"
25
+ #include "libavutil/rational.h"
26
+
27
+ /* minimum number of bytes to read from a DV stream in order to
28
+ * determine the profile */
29
+ #define DV_PROFILE_BYTES (6 * 80) /* 6 DIF blocks */
30
+
31
+
32
+ /*
33
+ * AVDVProfile is used to express the differences between various
34
+ * DV flavors. For now it's primarily used for differentiating
35
+ * 525/60 and 625/50, but the plans are to use it for various
36
+ * DV specs as well (e.g. SMPTE314M vs. IEC 61834).
37
+ */
38
+ typedef struct AVDVProfile {
39
+ int dsf; /* value of the dsf in the DV header */
40
+ int video_stype; /* stype for VAUX source pack */
41
+ int frame_size; /* total size of one frame in bytes */
42
+ int difseg_size; /* number of DIF segments per DIF channel */
43
+ int n_difchan; /* number of DIF channels per frame */
44
+ AVRational time_base; /* 1/framerate */
45
+ int ltc_divisor; /* FPS from the LTS standpoint */
46
+ int height; /* picture height in pixels */
47
+ int width; /* picture width in pixels */
48
+ AVRational sar[2]; /* sample aspect ratios for 4:3 and 16:9 */
49
+ enum AVPixelFormat pix_fmt; /* picture pixel format */
50
+ int bpm; /* blocks per macroblock */
51
+ const uint8_t *block_sizes; /* AC block sizes, in bits */
52
+ int audio_stride; /* size of audio_shuffle table */
53
+ int audio_min_samples[3]; /* min amount of audio samples */
54
+ /* for 48kHz, 44.1kHz and 32kHz */
55
+ int audio_samples_dist[5]; /* how many samples are supposed to be */
56
+ /* in each frame in a 5 frames window */
57
+ const uint8_t (*audio_shuffle)[9]; /* PCM shuffling table */
58
+ } AVDVProfile;
59
+
60
+ /**
61
+ * Get a DV profile for the provided compressed frame.
62
+ *
63
+ * @param sys the profile used for the previous frame, may be NULL
64
+ * @param frame the compressed data buffer
65
+ * @param buf_size size of the buffer in bytes
66
+ * @return the DV profile for the supplied data or NULL on failure
67
+ */
68
+ const AVDVProfile *av_dv_frame_profile(const AVDVProfile *sys,
69
+ const uint8_t *frame, unsigned buf_size);
70
+
71
+ /**
72
+ * Get a DV profile for the provided stream parameters.
73
+ */
74
+ const AVDVProfile *av_dv_codec_profile(int width, int height, enum AVPixelFormat pix_fmt);
75
+
76
+ /**
77
+ * Get a DV profile for the provided stream parameters.
78
+ * The frame rate is used as a best-effort parameter.
79
+ */
80
+ const AVDVProfile *av_dv_codec_profile2(int width, int height, enum AVPixelFormat pix_fmt, AVRational frame_rate);
81
+
82
+ #endif /* AVCODEC_DV_PROFILE_H */
@@ -0,0 +1,93 @@
1
+ /*
2
+ * DXVA2 HW acceleration
3
+ *
4
+ * copyright (c) 2009 Laurent Aimar
5
+ *
6
+ * This file is part of FFmpeg.
7
+ *
8
+ * FFmpeg is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * FFmpeg is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with FFmpeg; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
+ */
22
+
23
+ #ifndef AVCODEC_DXVA2_H
24
+ #define AVCODEC_DXVA2_H
25
+
26
+ /**
27
+ * @file
28
+ * @ingroup lavc_codec_hwaccel_dxva2
29
+ * Public libavcodec DXVA2 header.
30
+ */
31
+
32
+ #if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0602
33
+ #undef _WIN32_WINNT
34
+ #define _WIN32_WINNT 0x0602
35
+ #endif
36
+
37
+ #include <stdint.h>
38
+ #include <d3d9.h>
39
+ #include <dxva2api.h>
40
+
41
+ /**
42
+ * @defgroup lavc_codec_hwaccel_dxva2 DXVA2
43
+ * @ingroup lavc_codec_hwaccel
44
+ *
45
+ * @{
46
+ */
47
+
48
+ #define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for DXVA2 and old UVD/UVD+ ATI video cards
49
+ #define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO 2 ///< Work around for DXVA2 and old Intel GPUs with ClearVideo interface
50
+
51
+ /**
52
+ * This structure is used to provides the necessary configurations and data
53
+ * to the DXVA2 FFmpeg HWAccel implementation.
54
+ *
55
+ * The application must make it available as AVCodecContext.hwaccel_context.
56
+ */
57
+ struct dxva_context {
58
+ /**
59
+ * DXVA2 decoder object
60
+ */
61
+ IDirectXVideoDecoder *decoder;
62
+
63
+ /**
64
+ * DXVA2 configuration used to create the decoder
65
+ */
66
+ const DXVA2_ConfigPictureDecode *cfg;
67
+
68
+ /**
69
+ * The number of surface in the surface array
70
+ */
71
+ unsigned surface_count;
72
+
73
+ /**
74
+ * The array of Direct3D surfaces used to create the decoder
75
+ */
76
+ LPDIRECT3DSURFACE9 *surface;
77
+
78
+ /**
79
+ * A bit field configuring the workarounds needed for using the decoder
80
+ */
81
+ uint64_t workaround;
82
+
83
+ /**
84
+ * Private to the FFmpeg AVHWAccel implementation
85
+ */
86
+ unsigned report_id;
87
+ };
88
+
89
+ /**
90
+ * @}
91
+ */
92
+
93
+ #endif /* AVCODEC_DXVA2_H */
@@ -0,0 +1,46 @@
1
+ /*
2
+ * JNI public API functions
3
+ *
4
+ * Copyright (c) 2015-2016 Matthieu Bouron <matthieu.bouron stupeflix.com>
5
+ *
6
+ * This file is part of FFmpeg.
7
+ *
8
+ * FFmpeg is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * FFmpeg is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with FFmpeg; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
+ */
22
+
23
+ #ifndef AVCODEC_JNI_H
24
+ #define AVCODEC_JNI_H
25
+
26
+ /*
27
+ * Manually set a Java virtual machine which will be used to retrieve the JNI
28
+ * environment. Once a Java VM is set it cannot be changed afterwards, meaning
29
+ * you can call multiple times av_jni_set_java_vm with the same Java VM pointer
30
+ * however it will error out if you try to set a different Java VM.
31
+ *
32
+ * @param vm Java virtual machine
33
+ * @param log_ctx context used for logging, can be NULL
34
+ * @return 0 on success, < 0 otherwise
35
+ */
36
+ int av_jni_set_java_vm(void *vm, void *log_ctx);
37
+
38
+ /*
39
+ * Get the Java virtual machine which has been set with av_jni_set_java_vm.
40
+ *
41
+ * @param vm Java virtual machine
42
+ * @return a pointer to the Java virtual machine
43
+ */
44
+ void *av_jni_get_java_vm(void *log_ctx);
45
+
46
+ #endif /* AVCODEC_JNI_H */
@@ -0,0 +1,255 @@
1
+ /*
2
+ * simple math operations
3
+ * Copyright (c) 2001, 2002 Fabrice Bellard
4
+ * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> et al
5
+ *
6
+ * This file is part of FFmpeg.
7
+ *
8
+ * FFmpeg is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * FFmpeg is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with FFmpeg; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
+ */
22
+ #ifndef AVCODEC_MATHOPS_H
23
+ #define AVCODEC_MATHOPS_H
24
+
25
+ #include <stdint.h>
26
+
27
+ #include "libavutil/attributes_internal.h"
28
+ #include "libavutil/common.h"
29
+ #include "config.h"
30
+
31
+ #define MAX_NEG_CROP 1024
32
+
33
+ extern const uint32_t ff_inverse[257];
34
+ extern const uint8_t ff_log2_run[41];
35
+ extern const uint8_t ff_sqrt_tab[256];
36
+ extern const uint8_t attribute_visibility_hidden ff_crop_tab[256 + 2 * MAX_NEG_CROP];
37
+ extern const uint8_t ff_zigzag_direct[64];
38
+ extern const uint8_t ff_zigzag_scan[16+1];
39
+
40
+ #if ARCH_ARM
41
+ # include "arm/mathops.h"
42
+ #elif ARCH_AVR32
43
+ # include "avr32/mathops.h"
44
+ #elif ARCH_MIPS
45
+ # include "mips/mathops.h"
46
+ #elif ARCH_PPC
47
+ # include "ppc/mathops.h"
48
+ #elif ARCH_X86
49
+ # include "x86/mathops.h"
50
+ #endif
51
+
52
+ /* generic implementation */
53
+
54
+ #ifndef MUL64
55
+ # define MUL64(a,b) ((int64_t)(a) * (int64_t)(b))
56
+ #endif
57
+
58
+ #ifndef MULL
59
+ # define MULL(a,b,s) (MUL64(a, b) >> (s))
60
+ #endif
61
+
62
+ #ifndef MULH
63
+ static av_always_inline int MULH(int a, int b){
64
+ return MUL64(a, b) >> 32;
65
+ }
66
+ #endif
67
+
68
+ #ifndef UMULH
69
+ static av_always_inline unsigned UMULH(unsigned a, unsigned b){
70
+ return ((uint64_t)(a) * (uint64_t)(b))>>32;
71
+ }
72
+ #endif
73
+
74
+ #ifndef MAC64
75
+ # define MAC64(d, a, b) ((d) += MUL64(a, b))
76
+ #endif
77
+
78
+ #ifndef MLS64
79
+ # define MLS64(d, a, b) ((d) -= MUL64(a, b))
80
+ #endif
81
+
82
+ /* signed 16x16 -> 32 multiply add accumulate */
83
+ #ifndef MAC16
84
+ # define MAC16(rt, ra, rb) rt += (ra) * (rb)
85
+ #endif
86
+
87
+ /* signed 16x16 -> 32 multiply */
88
+ #ifndef MUL16
89
+ # define MUL16(ra, rb) ((ra) * (rb))
90
+ #endif
91
+
92
+ #ifndef MLS16
93
+ # define MLS16(rt, ra, rb) ((rt) -= (ra) * (rb))
94
+ #endif
95
+
96
+ /* median of 3 */
97
+ #ifndef mid_pred
98
+ #define mid_pred mid_pred
99
+ static inline av_const int mid_pred(int a, int b, int c)
100
+ {
101
+ if(a>b){
102
+ if(c>b){
103
+ if(c>a) b=a;
104
+ else b=c;
105
+ }
106
+ }else{
107
+ if(b>c){
108
+ if(c>a) b=c;
109
+ else b=a;
110
+ }
111
+ }
112
+ return b;
113
+ }
114
+ #endif
115
+
116
+ #ifndef median4
117
+ #define median4 median4
118
+ static inline av_const int median4(int a, int b, int c, int d)
119
+ {
120
+ if (a < b) {
121
+ if (c < d) return (FFMIN(b, d) + FFMAX(a, c)) / 2;
122
+ else return (FFMIN(b, c) + FFMAX(a, d)) / 2;
123
+ } else {
124
+ if (c < d) return (FFMIN(a, d) + FFMAX(b, c)) / 2;
125
+ else return (FFMIN(a, c) + FFMAX(b, d)) / 2;
126
+ }
127
+ }
128
+ #endif
129
+
130
+ #define FF_SIGNBIT(x) ((x) >> CHAR_BIT * sizeof(x) - 1)
131
+
132
+ #ifndef sign_extend
133
+ static inline av_const int sign_extend(int val, unsigned bits)
134
+ {
135
+ unsigned shift = 8 * sizeof(int) - bits;
136
+ union { unsigned u; int s; } v = { (unsigned) val << shift };
137
+ return v.s >> shift;
138
+ }
139
+ #endif
140
+
141
+ #ifndef sign_extend64
142
+ static inline av_const int64_t sign_extend64(int64_t val, unsigned bits)
143
+ {
144
+ unsigned shift = 8 * sizeof(int64_t) - bits;
145
+ union { uint64_t u; int64_t s; } v = { (uint64_t) val << shift };
146
+ return v.s >> shift;
147
+ }
148
+ #endif
149
+
150
+ #ifndef zero_extend
151
+ static inline av_const unsigned zero_extend(unsigned val, unsigned bits)
152
+ {
153
+ return (val << ((8 * sizeof(int)) - bits)) >> ((8 * sizeof(int)) - bits);
154
+ }
155
+ #endif
156
+
157
+ #ifndef COPY3_IF_LT
158
+ #define COPY3_IF_LT(x, y, a, b, c, d)\
159
+ if ((y) < (x)) {\
160
+ (x) = (y);\
161
+ (a) = (b);\
162
+ (c) = (d);\
163
+ }
164
+ #endif
165
+
166
+ #ifndef MASK_ABS
167
+ #define MASK_ABS(mask, level) do { \
168
+ mask = level >> 31; \
169
+ level = (level ^ mask) - mask; \
170
+ } while (0)
171
+ #endif
172
+
173
+ #ifndef NEG_SSR32
174
+ # define NEG_SSR32(a,s) ((( int32_t)(a))>>(32-(s)))
175
+ #endif
176
+
177
+ #ifndef NEG_USR32
178
+ # define NEG_USR32(a,s) (((uint32_t)(a))>>(32-(s)))
179
+ #endif
180
+
181
+ #if HAVE_BIGENDIAN
182
+ # ifndef PACK_2U8
183
+ # define PACK_2U8(a,b) (((a) << 8) | (b))
184
+ # endif
185
+ # ifndef PACK_4U8
186
+ # define PACK_4U8(a,b,c,d) (((a) << 24) | ((b) << 16) | ((c) << 8) | (d))
187
+ # endif
188
+ # ifndef PACK_2U16
189
+ # define PACK_2U16(a,b) (((a) << 16) | (b))
190
+ # endif
191
+ #else
192
+ # ifndef PACK_2U8
193
+ # define PACK_2U8(a,b) (((b) << 8) | (a))
194
+ # endif
195
+ # ifndef PACK_4U2
196
+ # define PACK_4U8(a,b,c,d) (((d) << 24) | ((c) << 16) | ((b) << 8) | (a))
197
+ # endif
198
+ # ifndef PACK_2U16
199
+ # define PACK_2U16(a,b) (((b) << 16) | (a))
200
+ # endif
201
+ #endif
202
+
203
+ #ifndef PACK_2S8
204
+ # define PACK_2S8(a,b) PACK_2U8((a)&255, (b)&255)
205
+ #endif
206
+ #ifndef PACK_4S8
207
+ # define PACK_4S8(a,b,c,d) PACK_4U8((a)&255, (b)&255, (c)&255, (d)&255)
208
+ #endif
209
+ #ifndef PACK_2S16
210
+ # define PACK_2S16(a,b) PACK_2U16((a)&0xffff, (b)&0xffff)
211
+ #endif
212
+
213
+ #ifndef FASTDIV
214
+ # define FASTDIV(a,b) ((uint32_t)((((uint64_t)a) * ff_inverse[b]) >> 32))
215
+ #endif /* FASTDIV */
216
+
217
+ #ifndef ff_sqrt
218
+ #define ff_sqrt ff_sqrt
219
+ static inline av_const unsigned int ff_sqrt(unsigned int a)
220
+ {
221
+ unsigned int b;
222
+
223
+ if (a < 255) return (ff_sqrt_tab[a + 1] - 1) >> 4;
224
+ else if (a < (1 << 12)) b = ff_sqrt_tab[a >> 4] >> 2;
225
+ #if !CONFIG_SMALL
226
+ else if (a < (1 << 14)) b = ff_sqrt_tab[a >> 6] >> 1;
227
+ else if (a < (1 << 16)) b = ff_sqrt_tab[a >> 8] ;
228
+ #endif
229
+ else {
230
+ int s = av_log2_16bit(a >> 16) >> 1;
231
+ unsigned int c = a >> (s + 2);
232
+ b = ff_sqrt_tab[c >> (s + 8)];
233
+ b = FASTDIV(c,b) + (b << s);
234
+ }
235
+
236
+ return b - (a < b * b);
237
+ }
238
+ #endif
239
+
240
+ static inline av_const float ff_sqrf(float a)
241
+ {
242
+ return a*a;
243
+ }
244
+
245
+ static inline int8_t ff_u8_to_s8(uint8_t a)
246
+ {
247
+ union {
248
+ uint8_t u8;
249
+ int8_t s8;
250
+ } b;
251
+ b.u8 = a;
252
+ return b.s8;
253
+ }
254
+
255
+ #endif /* AVCODEC_MATHOPS_H */
@@ -0,0 +1,103 @@
1
+ /*
2
+ * Android MediaCodec public API
3
+ *
4
+ * Copyright (c) 2016 Matthieu Bouron <matthieu.bouron stupeflix.com>
5
+ *
6
+ * This file is part of FFmpeg.
7
+ *
8
+ * FFmpeg is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * FFmpeg is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with FFmpeg; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
+ */
22
+
23
+ #ifndef AVCODEC_MEDIACODEC_H
24
+ #define AVCODEC_MEDIACODEC_H
25
+
26
+ #include "libavcodec/avcodec.h"
27
+
28
+ /**
29
+ * This structure holds a reference to a android/view/Surface object that will
30
+ * be used as output by the decoder.
31
+ *
32
+ */
33
+ typedef struct AVMediaCodecContext {
34
+
35
+ /**
36
+ * android/view/Surface object reference.
37
+ */
38
+ void *surface;
39
+
40
+ } AVMediaCodecContext;
41
+
42
+ /**
43
+ * Allocate and initialize a MediaCodec context.
44
+ *
45
+ * When decoding with MediaCodec is finished, the caller must free the
46
+ * MediaCodec context with av_mediacodec_default_free.
47
+ *
48
+ * @return a pointer to a newly allocated AVMediaCodecContext on success, NULL otherwise
49
+ */
50
+ AVMediaCodecContext *av_mediacodec_alloc_context(void);
51
+
52
+ /**
53
+ * Convenience function that sets up the MediaCodec context.
54
+ *
55
+ * @param avctx codec context
56
+ * @param ctx MediaCodec context to initialize
57
+ * @param surface reference to an android/view/Surface
58
+ * @return 0 on success, < 0 otherwise
59
+ */
60
+ int av_mediacodec_default_init(AVCodecContext *avctx, AVMediaCodecContext *ctx, void *surface);
61
+
62
+ /**
63
+ * This function must be called to free the MediaCodec context initialized with
64
+ * av_mediacodec_default_init().
65
+ *
66
+ * @param avctx codec context
67
+ */
68
+ void av_mediacodec_default_free(AVCodecContext *avctx);
69
+
70
+ /**
71
+ * Opaque structure representing a MediaCodec buffer to render.
72
+ */
73
+ typedef struct MediaCodecBuffer AVMediaCodecBuffer;
74
+
75
+ /**
76
+ * Release a MediaCodec buffer and render it to the surface that is associated
77
+ * with the decoder. This function should only be called once on a given
78
+ * buffer, once released the underlying buffer returns to the codec, thus
79
+ * subsequent calls to this function will have no effect.
80
+ *
81
+ * @param buffer the buffer to render
82
+ * @param render 1 to release and render the buffer to the surface or 0 to
83
+ * discard the buffer
84
+ * @return 0 on success, < 0 otherwise
85
+ */
86
+ int av_mediacodec_release_buffer(AVMediaCodecBuffer *buffer, int render);
87
+
88
+ /**
89
+ * Release a MediaCodec buffer and render it at the given time to the surface
90
+ * that is associated with the decoder. The timestamp must be within one second
91
+ * of the current `java/lang/System#nanoTime()` (which is implemented using
92
+ * `CLOCK_MONOTONIC` on Android). See the Android MediaCodec documentation
93
+ * of [`android/media/MediaCodec#releaseOutputBuffer(int,long)`][0] for more details.
94
+ *
95
+ * @param buffer the buffer to render
96
+ * @param time timestamp in nanoseconds of when to render the buffer
97
+ * @return 0 on success, < 0 otherwise
98
+ *
99
+ * [0]: https://developer.android.com/reference/android/media/MediaCodec#releaseOutputBuffer(int,%20long)
100
+ */
101
+ int av_mediacodec_render_buffer_at_time(AVMediaCodecBuffer *buffer, int64_t time);
102
+
103
+ #endif /* AVCODEC_MEDIACODEC_H */