@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,117 @@
1
+ /*
2
+ * This file is part of FFmpeg.
3
+ *
4
+ * FFmpeg is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License, or (at your option) any later version.
8
+ *
9
+ * FFmpeg is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ * Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public
15
+ * License along with FFmpeg; if not, write to the Free Software
16
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+ #ifndef AVUTIL_HWCONTEXT_VAAPI_H
20
+ #define AVUTIL_HWCONTEXT_VAAPI_H
21
+
22
+ #include <va/va.h>
23
+
24
+ /**
25
+ * @file
26
+ * API-specific header for AV_HWDEVICE_TYPE_VAAPI.
27
+ *
28
+ * Dynamic frame pools are supported, but note that any pool used as a render
29
+ * target is required to be of fixed size in order to be be usable as an
30
+ * argument to vaCreateContext().
31
+ *
32
+ * For user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs
33
+ * with the data pointer set to a VASurfaceID.
34
+ */
35
+
36
+ enum {
37
+ /**
38
+ * The quirks field has been set by the user and should not be detected
39
+ * automatically by av_hwdevice_ctx_init().
40
+ */
41
+ AV_VAAPI_DRIVER_QUIRK_USER_SET = (1 << 0),
42
+ /**
43
+ * The driver does not destroy parameter buffers when they are used by
44
+ * vaRenderPicture(). Additional code will be required to destroy them
45
+ * separately afterwards.
46
+ */
47
+ AV_VAAPI_DRIVER_QUIRK_RENDER_PARAM_BUFFERS = (1 << 1),
48
+
49
+ /**
50
+ * The driver does not support the VASurfaceAttribMemoryType attribute,
51
+ * so the surface allocation code will not try to use it.
52
+ */
53
+ AV_VAAPI_DRIVER_QUIRK_ATTRIB_MEMTYPE = (1 << 2),
54
+
55
+ /**
56
+ * The driver does not support surface attributes at all.
57
+ * The surface allocation code will never pass them to surface allocation,
58
+ * and the results of the vaQuerySurfaceAttributes() call will be faked.
59
+ */
60
+ AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES = (1 << 3),
61
+ };
62
+
63
+ /**
64
+ * VAAPI connection details.
65
+ *
66
+ * Allocated as AVHWDeviceContext.hwctx
67
+ */
68
+ typedef struct AVVAAPIDeviceContext {
69
+ /**
70
+ * The VADisplay handle, to be filled by the user.
71
+ */
72
+ VADisplay display;
73
+ /**
74
+ * Driver quirks to apply - this is filled by av_hwdevice_ctx_init(),
75
+ * with reference to a table of known drivers, unless the
76
+ * AV_VAAPI_DRIVER_QUIRK_USER_SET bit is already present. The user
77
+ * may need to refer to this field when performing any later
78
+ * operations using VAAPI with the same VADisplay.
79
+ */
80
+ unsigned int driver_quirks;
81
+ } AVVAAPIDeviceContext;
82
+
83
+ /**
84
+ * VAAPI-specific data associated with a frame pool.
85
+ *
86
+ * Allocated as AVHWFramesContext.hwctx.
87
+ */
88
+ typedef struct AVVAAPIFramesContext {
89
+ /**
90
+ * Set by the user to apply surface attributes to all surfaces in
91
+ * the frame pool. If null, default settings are used.
92
+ */
93
+ VASurfaceAttrib *attributes;
94
+ int nb_attributes;
95
+ /**
96
+ * The surfaces IDs of all surfaces in the pool after creation.
97
+ * Only valid if AVHWFramesContext.initial_pool_size was positive.
98
+ * These are intended to be used as the render_targets arguments to
99
+ * vaCreateContext().
100
+ */
101
+ VASurfaceID *surface_ids;
102
+ int nb_surfaces;
103
+ } AVVAAPIFramesContext;
104
+
105
+ /**
106
+ * VAAPI hardware pipeline configuration details.
107
+ *
108
+ * Allocated with av_hwdevice_hwconfig_alloc().
109
+ */
110
+ typedef struct AVVAAPIHWConfig {
111
+ /**
112
+ * ID of a VAAPI pipeline configuration.
113
+ */
114
+ VAConfigID config_id;
115
+ } AVVAAPIHWConfig;
116
+
117
+ #endif /* AVUTIL_HWCONTEXT_VAAPI_H */
@@ -0,0 +1,44 @@
1
+ /*
2
+ * This file is part of FFmpeg.
3
+ *
4
+ * FFmpeg is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License, or (at your option) any later version.
8
+ *
9
+ * FFmpeg is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ * Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public
15
+ * License along with FFmpeg; if not, write to the Free Software
16
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+ #ifndef AVUTIL_HWCONTEXT_VDPAU_H
20
+ #define AVUTIL_HWCONTEXT_VDPAU_H
21
+
22
+ #include <vdpau/vdpau.h>
23
+
24
+ /**
25
+ * @file
26
+ * An API-specific header for AV_HWDEVICE_TYPE_VDPAU.
27
+ *
28
+ * This API supports dynamic frame pools. AVHWFramesContext.pool must return
29
+ * AVBufferRefs whose data pointer is a VdpVideoSurface.
30
+ */
31
+
32
+ /**
33
+ * This struct is allocated as AVHWDeviceContext.hwctx
34
+ */
35
+ typedef struct AVVDPAUDeviceContext {
36
+ VdpDevice device;
37
+ VdpGetProcAddress *get_proc_address;
38
+ } AVVDPAUDeviceContext;
39
+
40
+ /**
41
+ * AVHWFramesContext.hwctx is currently not used
42
+ */
43
+
44
+ #endif /* AVUTIL_HWCONTEXT_VDPAU_H */
@@ -0,0 +1,96 @@
1
+ /*
2
+ * This file is part of FFmpeg.
3
+ *
4
+ * FFmpeg is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License, or (at your option) any later version.
8
+ *
9
+ * FFmpeg is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ * Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public
15
+ * License along with FFmpeg; if not, write to the Free Software
16
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+ #ifndef AVUTIL_HWCONTEXT_VIDEOTOOLBOX_H
20
+ #define AVUTIL_HWCONTEXT_VIDEOTOOLBOX_H
21
+
22
+ #include <stdint.h>
23
+
24
+ #include <VideoToolbox/VideoToolbox.h>
25
+
26
+ #include "frame.h"
27
+ #include "pixfmt.h"
28
+
29
+ /**
30
+ * @file
31
+ * An API-specific header for AV_HWDEVICE_TYPE_VIDEOTOOLBOX.
32
+ *
33
+ * This API supports frame allocation using a native CVPixelBufferPool
34
+ * instead of an AVBufferPool.
35
+ *
36
+ * If the API user sets a custom pool, AVHWFramesContext.pool must return
37
+ * AVBufferRefs whose data pointer is a CVImageBufferRef or CVPixelBufferRef.
38
+ * Note that the underlying CVPixelBuffer could be retained by OS frameworks
39
+ * depending on application usage, so it is preferable to let CoreVideo manage
40
+ * the pool using the default implementation.
41
+ *
42
+ * Currently AVHWDeviceContext.hwctx and AVHWFramesContext.hwctx are always
43
+ * NULL.
44
+ */
45
+
46
+ /**
47
+ * Convert a VideoToolbox (actually CoreVideo) format to AVPixelFormat.
48
+ * Returns AV_PIX_FMT_NONE if no known equivalent was found.
49
+ */
50
+ enum AVPixelFormat av_map_videotoolbox_format_to_pixfmt(uint32_t cv_fmt);
51
+
52
+ /**
53
+ * Convert an AVPixelFormat to a VideoToolbox (actually CoreVideo) format.
54
+ * Returns 0 if no known equivalent was found.
55
+ */
56
+ uint32_t av_map_videotoolbox_format_from_pixfmt(enum AVPixelFormat pix_fmt);
57
+
58
+ /**
59
+ * Same as av_map_videotoolbox_format_from_pixfmt function, but can map and
60
+ * return full range pixel formats via a flag.
61
+ */
62
+ uint32_t av_map_videotoolbox_format_from_pixfmt2(enum AVPixelFormat pix_fmt, bool full_range);
63
+
64
+ /**
65
+ * Convert an AVChromaLocation to a VideoToolbox/CoreVideo chroma location string.
66
+ * Returns 0 if no known equivalent was found.
67
+ */
68
+ CFStringRef av_map_videotoolbox_chroma_loc_from_av(enum AVChromaLocation loc);
69
+
70
+ /**
71
+ * Convert an AVColorSpace to a VideoToolbox/CoreVideo color matrix string.
72
+ * Returns 0 if no known equivalent was found.
73
+ */
74
+ CFStringRef av_map_videotoolbox_color_matrix_from_av(enum AVColorSpace space);
75
+
76
+ /**
77
+ * Convert an AVColorPrimaries to a VideoToolbox/CoreVideo color primaries string.
78
+ * Returns 0 if no known equivalent was found.
79
+ */
80
+ CFStringRef av_map_videotoolbox_color_primaries_from_av(enum AVColorPrimaries pri);
81
+
82
+ /**
83
+ * Convert an AVColorTransferCharacteristic to a VideoToolbox/CoreVideo color transfer
84
+ * function string.
85
+ * Returns 0 if no known equivalent was found.
86
+ */
87
+ CFStringRef av_map_videotoolbox_color_trc_from_av(enum AVColorTransferCharacteristic trc);
88
+
89
+ /**
90
+ * Update a CVPixelBufferRef's metadata to based on an AVFrame.
91
+ * Returns 0 if no known equivalent was found.
92
+ */
93
+ int av_vt_pixbuf_set_attachments(void *log_ctx,
94
+ CVPixelBufferRef pixbuf, const struct AVFrame *src);
95
+
96
+ #endif /* AVUTIL_HWCONTEXT_VIDEOTOOLBOX_H */
@@ -0,0 +1,281 @@
1
+ /*
2
+ * This file is part of FFmpeg.
3
+ *
4
+ * FFmpeg is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License, or (at your option) any later version.
8
+ *
9
+ * FFmpeg is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ * Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public
15
+ * License along with FFmpeg; if not, write to the Free Software
16
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+ #ifndef AVUTIL_HWCONTEXT_VULKAN_H
20
+ #define AVUTIL_HWCONTEXT_VULKAN_H
21
+
22
+ #if defined(_WIN32) && !defined(VK_USE_PLATFORM_WIN32_KHR)
23
+ #define VK_USE_PLATFORM_WIN32_KHR
24
+ #endif
25
+ #include <vulkan/vulkan.h>
26
+
27
+ #include "pixfmt.h"
28
+ #include "frame.h"
29
+
30
+ /**
31
+ * @file
32
+ * API-specific header for AV_HWDEVICE_TYPE_VULKAN.
33
+ *
34
+ * For user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs
35
+ * with the data pointer set to an AVVkFrame.
36
+ */
37
+
38
+ /**
39
+ * Main Vulkan context, allocated as AVHWDeviceContext.hwctx.
40
+ * All of these can be set before init to change what the context uses
41
+ */
42
+ typedef struct AVVulkanDeviceContext {
43
+ /**
44
+ * Custom memory allocator, else NULL
45
+ */
46
+ const VkAllocationCallbacks *alloc;
47
+
48
+ /**
49
+ * Pointer to the instance-provided vkGetInstanceProcAddr loading function.
50
+ * If NULL, will pick either libvulkan or libvolk, depending on libavutil's
51
+ * compilation settings, and set this field.
52
+ */
53
+ PFN_vkGetInstanceProcAddr get_proc_addr;
54
+
55
+ /**
56
+ * Vulkan instance. Must be at least version 1.2.
57
+ */
58
+ VkInstance inst;
59
+
60
+ /**
61
+ * Physical device
62
+ */
63
+ VkPhysicalDevice phys_dev;
64
+
65
+ /**
66
+ * Active device
67
+ */
68
+ VkDevice act_dev;
69
+
70
+ /**
71
+ * This structure should be set to the set of features that present and enabled
72
+ * during device creation. When a device is created by FFmpeg, it will default to
73
+ * enabling all that are present of the shaderImageGatherExtended,
74
+ * fragmentStoresAndAtomics, shaderInt64 and vertexPipelineStoresAndAtomics features.
75
+ */
76
+ VkPhysicalDeviceFeatures2 device_features;
77
+
78
+ /**
79
+ * Enabled instance extensions.
80
+ * If supplying your own device context, set this to an array of strings, with
81
+ * each entry containing the specified Vulkan extension string to enable.
82
+ * Duplicates are possible and accepted.
83
+ * If no extensions are enabled, set these fields to NULL, and 0 respectively.
84
+ */
85
+ const char * const *enabled_inst_extensions;
86
+ int nb_enabled_inst_extensions;
87
+
88
+ /**
89
+ * Enabled device extensions. By default, VK_KHR_external_memory_fd,
90
+ * VK_EXT_external_memory_dma_buf, VK_EXT_image_drm_format_modifier,
91
+ * VK_KHR_external_semaphore_fd and VK_EXT_external_memory_host are enabled if found.
92
+ * If supplying your own device context, these fields takes the same format as
93
+ * the above fields, with the same conditions that duplicates are possible
94
+ * and accepted, and that NULL and 0 respectively means no extensions are enabled.
95
+ */
96
+ const char * const *enabled_dev_extensions;
97
+ int nb_enabled_dev_extensions;
98
+
99
+ /**
100
+ * Queue family index for graphics operations, and the number of queues
101
+ * enabled for it. If unavaiable, will be set to -1. Not required.
102
+ * av_hwdevice_create() will attempt to find a dedicated queue for each
103
+ * queue family, or pick the one with the least unrelated flags set.
104
+ * Queue indices here may overlap if a queue has to share capabilities.
105
+ */
106
+ int queue_family_index;
107
+ int nb_graphics_queues;
108
+
109
+ /**
110
+ * Queue family index for transfer operations and the number of queues
111
+ * enabled. Required.
112
+ */
113
+ int queue_family_tx_index;
114
+ int nb_tx_queues;
115
+
116
+ /**
117
+ * Queue family index for compute operations and the number of queues
118
+ * enabled. Required.
119
+ */
120
+ int queue_family_comp_index;
121
+ int nb_comp_queues;
122
+
123
+ /**
124
+ * Queue family index for video encode ops, and the amount of queues enabled.
125
+ * If the device doesn't support such, queue_family_encode_index will be -1.
126
+ * Not required.
127
+ */
128
+ int queue_family_encode_index;
129
+ int nb_encode_queues;
130
+
131
+ /**
132
+ * Queue family index for video decode ops, and the amount of queues enabled.
133
+ * If the device doesn't support such, queue_family_decode_index will be -1.
134
+ * Not required.
135
+ */
136
+ int queue_family_decode_index;
137
+ int nb_decode_queues;
138
+ } AVVulkanDeviceContext;
139
+
140
+ /**
141
+ * Defines the behaviour of frame allocation.
142
+ */
143
+ typedef enum AVVkFrameFlags {
144
+ /* Unless this flag is set, autodetected flags will be OR'd based on the
145
+ * device and tiling during av_hwframe_ctx_init(). */
146
+ AV_VK_FRAME_FLAG_NONE = (1ULL << 0),
147
+
148
+ /* Image planes will be allocated in a single VkDeviceMemory, rather
149
+ * than as per-plane VkDeviceMemory allocations. Required for exporting
150
+ * to VAAPI on Intel devices. */
151
+ AV_VK_FRAME_FLAG_CONTIGUOUS_MEMORY = (1ULL << 1),
152
+ } AVVkFrameFlags;
153
+
154
+ /**
155
+ * Allocated as AVHWFramesContext.hwctx, used to set pool-specific options
156
+ */
157
+ typedef struct AVVulkanFramesContext {
158
+ /**
159
+ * Controls the tiling of allocated frames. If left as optimal tiling,
160
+ * then during av_hwframe_ctx_init() will decide based on whether the device
161
+ * supports DRM modifiers, or if the linear_images flag is set, otherwise
162
+ * will allocate optimally-tiled images.
163
+ */
164
+ VkImageTiling tiling;
165
+
166
+ /**
167
+ * Defines extra usage of output frames. If left as 0, the following bits
168
+ * are set: TRANSFER_SRC, TRANSFER_DST. SAMPLED and STORAGE.
169
+ */
170
+ VkImageUsageFlagBits usage;
171
+
172
+ /**
173
+ * Extension data for image creation.
174
+ * If VkImageDrmFormatModifierListCreateInfoEXT is present in the chain,
175
+ * and the device supports DRM modifiers, then images will be allocated
176
+ * with the specific requested DRM modifiers.
177
+ * Additional structures may be added at av_hwframe_ctx_init() time,
178
+ * which will be freed automatically on uninit(), so users need only free
179
+ * any structures they've allocated themselves.
180
+ */
181
+ void *create_pnext;
182
+
183
+ /**
184
+ * Extension data for memory allocation. Must have as many entries as
185
+ * the number of planes of the sw_format.
186
+ * This will be chained to VkExportMemoryAllocateInfo, which is used
187
+ * to make all pool images exportable to other APIs if the necessary
188
+ * extensions are present in enabled_dev_extensions.
189
+ */
190
+ void *alloc_pnext[AV_NUM_DATA_POINTERS];
191
+
192
+ /**
193
+ * A combination of AVVkFrameFlags. Unless AV_VK_FRAME_FLAG_NONE is set,
194
+ * autodetected flags will be OR'd based on the device and tiling during
195
+ * av_hwframe_ctx_init().
196
+ */
197
+ AVVkFrameFlags flags;
198
+ } AVVulkanFramesContext;
199
+
200
+ /*
201
+ * Frame structure, the VkFormat of the image will always match
202
+ * the pool's sw_format.
203
+ * All frames, imported or allocated, will be created with the
204
+ * VK_IMAGE_CREATE_ALIAS_BIT flag set, so the memory may be aliased if needed.
205
+ *
206
+ * If all queue family indices in the device context are the same,
207
+ * images will be created with the EXCLUSIVE sharing mode. Otherwise, all images
208
+ * will be created using the CONCURRENT sharing mode.
209
+ *
210
+ * @note the size of this structure is not part of the ABI, to allocate
211
+ * you must use @av_vk_frame_alloc().
212
+ */
213
+ typedef struct AVVkFrame {
214
+ /**
215
+ * Vulkan images to which the memory is bound to.
216
+ */
217
+ VkImage img[AV_NUM_DATA_POINTERS];
218
+
219
+ /**
220
+ * The same tiling must be used for all images in the frame.
221
+ */
222
+ VkImageTiling tiling;
223
+
224
+ /**
225
+ * Memory backing the images. Could be less than the amount of planes,
226
+ * in which case the offset value will indicate the binding offset of
227
+ * each plane in the memory.
228
+ */
229
+ VkDeviceMemory mem[AV_NUM_DATA_POINTERS];
230
+ size_t size[AV_NUM_DATA_POINTERS];
231
+
232
+ /**
233
+ * OR'd flags for all memory allocated
234
+ */
235
+ VkMemoryPropertyFlagBits flags;
236
+
237
+ /**
238
+ * Updated after every barrier
239
+ */
240
+ VkAccessFlagBits access[AV_NUM_DATA_POINTERS];
241
+ VkImageLayout layout[AV_NUM_DATA_POINTERS];
242
+
243
+ /**
244
+ * Synchronization timeline semaphores, one for each sw_format plane.
245
+ * Must not be freed manually. Must be waited on at every submission using
246
+ * the value in sem_value, and must be signalled at every submission,
247
+ * using an incremented value.
248
+ */
249
+ VkSemaphore sem[AV_NUM_DATA_POINTERS];
250
+
251
+ /**
252
+ * Up to date semaphore value at which each image becomes accessible.
253
+ * Clients must wait on this value when submitting a command queue,
254
+ * and increment it when signalling.
255
+ */
256
+ uint64_t sem_value[AV_NUM_DATA_POINTERS];
257
+
258
+ /**
259
+ * Internal data.
260
+ */
261
+ struct AVVkFrameInternal *internal;
262
+
263
+ /**
264
+ * Describes the binding offset of each plane to the VkDeviceMemory.
265
+ */
266
+ ptrdiff_t offset[AV_NUM_DATA_POINTERS];
267
+ } AVVkFrame;
268
+
269
+ /**
270
+ * Allocates a single AVVkFrame and initializes everything as 0.
271
+ * @note Must be freed via av_free()
272
+ */
273
+ AVVkFrame *av_vk_frame_alloc(void);
274
+
275
+ /**
276
+ * Returns the format of each image up to the number of planes for a given sw_format.
277
+ * Returns NULL on unsupported formats.
278
+ */
279
+ const VkFormat *av_vkfmt_from_pixfmt(enum AVPixelFormat p);
280
+
281
+ #endif /* AVUTIL_HWCONTEXT_VULKAN_H */