@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,731 @@
1
+ /*
2
+ * AVPacket public API
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+ #ifndef AVCODEC_PACKET_H
22
+ #define AVCODEC_PACKET_H
23
+
24
+ #include <stddef.h>
25
+ #include <stdint.h>
26
+
27
+ #include "libavutil/attributes.h"
28
+ #include "libavutil/buffer.h"
29
+ #include "libavutil/dict.h"
30
+ #include "libavutil/rational.h"
31
+ #include "libavutil/version.h"
32
+
33
+ #include "libavcodec/version_major.h"
34
+
35
+ /**
36
+ * @defgroup lavc_packet AVPacket
37
+ *
38
+ * Types and functions for working with AVPacket.
39
+ * @{
40
+ */
41
+ enum AVPacketSideDataType {
42
+ /**
43
+ * An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE
44
+ * bytes worth of palette. This side data signals that a new palette is
45
+ * present.
46
+ */
47
+ AV_PKT_DATA_PALETTE,
48
+
49
+ /**
50
+ * The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format
51
+ * that the extradata buffer was changed and the receiving side should
52
+ * act upon it appropriately. The new extradata is embedded in the side
53
+ * data buffer and should be immediately used for processing the current
54
+ * frame or packet.
55
+ */
56
+ AV_PKT_DATA_NEW_EXTRADATA,
57
+
58
+ /**
59
+ * An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
60
+ * @code
61
+ * u32le param_flags
62
+ * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT)
63
+ * s32le channel_count
64
+ * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT)
65
+ * u64le channel_layout
66
+ * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE)
67
+ * s32le sample_rate
68
+ * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS)
69
+ * s32le width
70
+ * s32le height
71
+ * @endcode
72
+ */
73
+ AV_PKT_DATA_PARAM_CHANGE,
74
+
75
+ /**
76
+ * An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of
77
+ * structures with info about macroblocks relevant to splitting the
78
+ * packet into smaller packets on macroblock edges (e.g. as for RFC 2190).
79
+ * That is, it does not necessarily contain info about all macroblocks,
80
+ * as long as the distance between macroblocks in the info is smaller
81
+ * than the target payload size.
82
+ * Each MB info structure is 12 bytes, and is laid out as follows:
83
+ * @code
84
+ * u32le bit offset from the start of the packet
85
+ * u8 current quantizer at the start of the macroblock
86
+ * u8 GOB number
87
+ * u16le macroblock address within the GOB
88
+ * u8 horizontal MV predictor
89
+ * u8 vertical MV predictor
90
+ * u8 horizontal MV predictor for block number 3
91
+ * u8 vertical MV predictor for block number 3
92
+ * @endcode
93
+ */
94
+ AV_PKT_DATA_H263_MB_INFO,
95
+
96
+ /**
97
+ * This side data should be associated with an audio stream and contains
98
+ * ReplayGain information in form of the AVReplayGain struct.
99
+ */
100
+ AV_PKT_DATA_REPLAYGAIN,
101
+
102
+ /**
103
+ * This side data contains a 3x3 transformation matrix describing an affine
104
+ * transformation that needs to be applied to the decoded video frames for
105
+ * correct presentation.
106
+ *
107
+ * See libavutil/display.h for a detailed description of the data.
108
+ */
109
+ AV_PKT_DATA_DISPLAYMATRIX,
110
+
111
+ /**
112
+ * This side data should be associated with a video stream and contains
113
+ * Stereoscopic 3D information in form of the AVStereo3D struct.
114
+ */
115
+ AV_PKT_DATA_STEREO3D,
116
+
117
+ /**
118
+ * This side data should be associated with an audio stream and corresponds
119
+ * to enum AVAudioServiceType.
120
+ */
121
+ AV_PKT_DATA_AUDIO_SERVICE_TYPE,
122
+
123
+ /**
124
+ * This side data contains quality related information from the encoder.
125
+ * @code
126
+ * u32le quality factor of the compressed frame. Allowed range is between 1 (good) and FF_LAMBDA_MAX (bad).
127
+ * u8 picture type
128
+ * u8 error count
129
+ * u16 reserved
130
+ * u64le[error count] sum of squared differences between encoder in and output
131
+ * @endcode
132
+ */
133
+ AV_PKT_DATA_QUALITY_STATS,
134
+
135
+ /**
136
+ * This side data contains an integer value representing the stream index
137
+ * of a "fallback" track. A fallback track indicates an alternate
138
+ * track to use when the current track can not be decoded for some reason.
139
+ * e.g. no decoder available for codec.
140
+ */
141
+ AV_PKT_DATA_FALLBACK_TRACK,
142
+
143
+ /**
144
+ * This side data corresponds to the AVCPBProperties struct.
145
+ */
146
+ AV_PKT_DATA_CPB_PROPERTIES,
147
+
148
+ /**
149
+ * Recommmends skipping the specified number of samples
150
+ * @code
151
+ * u32le number of samples to skip from start of this packet
152
+ * u32le number of samples to skip from end of this packet
153
+ * u8 reason for start skip
154
+ * u8 reason for end skip (0=padding silence, 1=convergence)
155
+ * @endcode
156
+ */
157
+ AV_PKT_DATA_SKIP_SAMPLES,
158
+
159
+ /**
160
+ * An AV_PKT_DATA_JP_DUALMONO side data packet indicates that
161
+ * the packet may contain "dual mono" audio specific to Japanese DTV
162
+ * and if it is true, recommends only the selected channel to be used.
163
+ * @code
164
+ * u8 selected channels (0=main/left, 1=sub/right, 2=both)
165
+ * @endcode
166
+ */
167
+ AV_PKT_DATA_JP_DUALMONO,
168
+
169
+ /**
170
+ * A list of zero terminated key/value strings. There is no end marker for
171
+ * the list, so it is required to rely on the side data size to stop.
172
+ */
173
+ AV_PKT_DATA_STRINGS_METADATA,
174
+
175
+ /**
176
+ * Subtitle event position
177
+ * @code
178
+ * u32le x1
179
+ * u32le y1
180
+ * u32le x2
181
+ * u32le y2
182
+ * @endcode
183
+ */
184
+ AV_PKT_DATA_SUBTITLE_POSITION,
185
+
186
+ /**
187
+ * Data found in BlockAdditional element of matroska container. There is
188
+ * no end marker for the data, so it is required to rely on the side data
189
+ * size to recognize the end. 8 byte id (as found in BlockAddId) followed
190
+ * by data.
191
+ */
192
+ AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
193
+
194
+ /**
195
+ * The optional first identifier line of a WebVTT cue.
196
+ */
197
+ AV_PKT_DATA_WEBVTT_IDENTIFIER,
198
+
199
+ /**
200
+ * The optional settings (rendering instructions) that immediately
201
+ * follow the timestamp specifier of a WebVTT cue.
202
+ */
203
+ AV_PKT_DATA_WEBVTT_SETTINGS,
204
+
205
+ /**
206
+ * A list of zero terminated key/value strings. There is no end marker for
207
+ * the list, so it is required to rely on the side data size to stop. This
208
+ * side data includes updated metadata which appeared in the stream.
209
+ */
210
+ AV_PKT_DATA_METADATA_UPDATE,
211
+
212
+ /**
213
+ * MPEGTS stream ID as uint8_t, this is required to pass the stream ID
214
+ * information from the demuxer to the corresponding muxer.
215
+ */
216
+ AV_PKT_DATA_MPEGTS_STREAM_ID,
217
+
218
+ /**
219
+ * Mastering display metadata (based on SMPTE-2086:2014). This metadata
220
+ * should be associated with a video stream and contains data in the form
221
+ * of the AVMasteringDisplayMetadata struct.
222
+ */
223
+ AV_PKT_DATA_MASTERING_DISPLAY_METADATA,
224
+
225
+ /**
226
+ * This side data should be associated with a video stream and corresponds
227
+ * to the AVSphericalMapping structure.
228
+ */
229
+ AV_PKT_DATA_SPHERICAL,
230
+
231
+ /**
232
+ * Content light level (based on CTA-861.3). This metadata should be
233
+ * associated with a video stream and contains data in the form of the
234
+ * AVContentLightMetadata struct.
235
+ */
236
+ AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
237
+
238
+ /**
239
+ * ATSC A53 Part 4 Closed Captions. This metadata should be associated with
240
+ * a video stream. A53 CC bitstream is stored as uint8_t in AVPacketSideData.data.
241
+ * The number of bytes of CC data is AVPacketSideData.size.
242
+ */
243
+ AV_PKT_DATA_A53_CC,
244
+
245
+ /**
246
+ * This side data is encryption initialization data.
247
+ * The format is not part of ABI, use av_encryption_init_info_* methods to
248
+ * access.
249
+ */
250
+ AV_PKT_DATA_ENCRYPTION_INIT_INFO,
251
+
252
+ /**
253
+ * This side data contains encryption info for how to decrypt the packet.
254
+ * The format is not part of ABI, use av_encryption_info_* methods to access.
255
+ */
256
+ AV_PKT_DATA_ENCRYPTION_INFO,
257
+
258
+ /**
259
+ * Active Format Description data consisting of a single byte as specified
260
+ * in ETSI TS 101 154 using AVActiveFormatDescription enum.
261
+ */
262
+ AV_PKT_DATA_AFD,
263
+
264
+ /**
265
+ * Producer Reference Time data corresponding to the AVProducerReferenceTime struct,
266
+ * usually exported by some encoders (on demand through the prft flag set in the
267
+ * AVCodecContext export_side_data field).
268
+ */
269
+ AV_PKT_DATA_PRFT,
270
+
271
+ /**
272
+ * ICC profile data consisting of an opaque octet buffer following the
273
+ * format described by ISO 15076-1.
274
+ */
275
+ AV_PKT_DATA_ICC_PROFILE,
276
+
277
+ /**
278
+ * DOVI configuration
279
+ * ref:
280
+ * dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2.1.2, section 2.2
281
+ * dolby-vision-bitstreams-in-mpeg-2-transport-stream-multiplex-v1.2, section 3.3
282
+ * Tags are stored in struct AVDOVIDecoderConfigurationRecord.
283
+ */
284
+ AV_PKT_DATA_DOVI_CONF,
285
+
286
+ /**
287
+ * Timecode which conforms to SMPTE ST 12-1:2014. The data is an array of 4 uint32_t
288
+ * where the first uint32_t describes how many (1-3) of the other timecodes are used.
289
+ * The timecode format is described in the documentation of av_timecode_get_smpte_from_framenum()
290
+ * function in libavutil/timecode.h.
291
+ */
292
+ AV_PKT_DATA_S12M_TIMECODE,
293
+
294
+ /**
295
+ * HDR10+ dynamic metadata associated with a video frame. The metadata is in
296
+ * the form of the AVDynamicHDRPlus struct and contains
297
+ * information for color volume transform - application 4 of
298
+ * SMPTE 2094-40:2016 standard.
299
+ */
300
+ AV_PKT_DATA_DYNAMIC_HDR10_PLUS,
301
+
302
+ /**
303
+ * The number of side data types.
304
+ * This is not part of the public API/ABI in the sense that it may
305
+ * change when new side data types are added.
306
+ * This must stay the last enum value.
307
+ * If its value becomes huge, some code using it
308
+ * needs to be updated as it assumes it to be smaller than other limits.
309
+ */
310
+ AV_PKT_DATA_NB
311
+ };
312
+
313
+ #define AV_PKT_DATA_QUALITY_FACTOR AV_PKT_DATA_QUALITY_STATS //DEPRECATED
314
+
315
+ typedef struct AVPacketSideData {
316
+ uint8_t *data;
317
+ size_t size;
318
+ enum AVPacketSideDataType type;
319
+ } AVPacketSideData;
320
+
321
+ /**
322
+ * This structure stores compressed data. It is typically exported by demuxers
323
+ * and then passed as input to decoders, or received as output from encoders and
324
+ * then passed to muxers.
325
+ *
326
+ * For video, it should typically contain one compressed frame. For audio it may
327
+ * contain several compressed frames. Encoders are allowed to output empty
328
+ * packets, with no compressed data, containing only side data
329
+ * (e.g. to update some stream parameters at the end of encoding).
330
+ *
331
+ * The semantics of data ownership depends on the buf field.
332
+ * If it is set, the packet data is dynamically allocated and is
333
+ * valid indefinitely until a call to av_packet_unref() reduces the
334
+ * reference count to 0.
335
+ *
336
+ * If the buf field is not set av_packet_ref() would make a copy instead
337
+ * of increasing the reference count.
338
+ *
339
+ * The side data is always allocated with av_malloc(), copied by
340
+ * av_packet_ref() and freed by av_packet_unref().
341
+ *
342
+ * sizeof(AVPacket) being a part of the public ABI is deprecated. once
343
+ * av_init_packet() is removed, new packets will only be able to be allocated
344
+ * with av_packet_alloc(), and new fields may be added to the end of the struct
345
+ * with a minor bump.
346
+ *
347
+ * @see av_packet_alloc
348
+ * @see av_packet_ref
349
+ * @see av_packet_unref
350
+ */
351
+ typedef struct AVPacket {
352
+ /**
353
+ * A reference to the reference-counted buffer where the packet data is
354
+ * stored.
355
+ * May be NULL, then the packet data is not reference-counted.
356
+ */
357
+ AVBufferRef *buf;
358
+ /**
359
+ * Presentation timestamp in AVStream->time_base units; the time at which
360
+ * the decompressed packet will be presented to the user.
361
+ * Can be AV_NOPTS_VALUE if it is not stored in the file.
362
+ * pts MUST be larger or equal to dts as presentation cannot happen before
363
+ * decompression, unless one wants to view hex dumps. Some formats misuse
364
+ * the terms dts and pts/cts to mean something different. Such timestamps
365
+ * must be converted to true pts/dts before they are stored in AVPacket.
366
+ */
367
+ int64_t pts;
368
+ /**
369
+ * Decompression timestamp in AVStream->time_base units; the time at which
370
+ * the packet is decompressed.
371
+ * Can be AV_NOPTS_VALUE if it is not stored in the file.
372
+ */
373
+ int64_t dts;
374
+ uint8_t *data;
375
+ int size;
376
+ int stream_index;
377
+ /**
378
+ * A combination of AV_PKT_FLAG values
379
+ */
380
+ int flags;
381
+ /**
382
+ * Additional packet data that can be provided by the container.
383
+ * Packet can contain several types of side information.
384
+ */
385
+ AVPacketSideData *side_data;
386
+ int side_data_elems;
387
+
388
+ /**
389
+ * Duration of this packet in AVStream->time_base units, 0 if unknown.
390
+ * Equals next_pts - this_pts in presentation order.
391
+ */
392
+ int64_t duration;
393
+
394
+ int64_t pos; ///< byte position in stream, -1 if unknown
395
+
396
+ /**
397
+ * for some private data of the user
398
+ */
399
+ void *opaque;
400
+
401
+ /**
402
+ * AVBufferRef for free use by the API user. FFmpeg will never check the
403
+ * contents of the buffer ref. FFmpeg calls av_buffer_unref() on it when
404
+ * the packet is unreferenced. av_packet_copy_props() calls create a new
405
+ * reference with av_buffer_ref() for the target packet's opaque_ref field.
406
+ *
407
+ * This is unrelated to the opaque field, although it serves a similar
408
+ * purpose.
409
+ */
410
+ AVBufferRef *opaque_ref;
411
+
412
+ /**
413
+ * Time base of the packet's timestamps.
414
+ * In the future, this field may be set on packets output by encoders or
415
+ * demuxers, but its value will be by default ignored on input to decoders
416
+ * or muxers.
417
+ */
418
+ AVRational time_base;
419
+ } AVPacket;
420
+
421
+ #if FF_API_INIT_PACKET
422
+ attribute_deprecated
423
+ typedef struct AVPacketList {
424
+ AVPacket pkt;
425
+ struct AVPacketList *next;
426
+ } AVPacketList;
427
+ #endif
428
+
429
+ #define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe
430
+ #define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted
431
+ /**
432
+ * Flag is used to discard packets which are required to maintain valid
433
+ * decoder state but are not required for output and should be dropped
434
+ * after decoding.
435
+ **/
436
+ #define AV_PKT_FLAG_DISCARD 0x0004
437
+ /**
438
+ * The packet comes from a trusted source.
439
+ *
440
+ * Otherwise-unsafe constructs such as arbitrary pointers to data
441
+ * outside the packet may be followed.
442
+ */
443
+ #define AV_PKT_FLAG_TRUSTED 0x0008
444
+ /**
445
+ * Flag is used to indicate packets that contain frames that can
446
+ * be discarded by the decoder. I.e. Non-reference frames.
447
+ */
448
+ #define AV_PKT_FLAG_DISPOSABLE 0x0010
449
+
450
+ enum AVSideDataParamChangeFlags {
451
+ #if FF_API_OLD_CHANNEL_LAYOUT
452
+ /**
453
+ * @deprecated those are not used by any decoder
454
+ */
455
+ AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001,
456
+ AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002,
457
+ #endif
458
+ AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE = 0x0004,
459
+ AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS = 0x0008,
460
+ };
461
+
462
+ /**
463
+ * Allocate an AVPacket and set its fields to default values. The resulting
464
+ * struct must be freed using av_packet_free().
465
+ *
466
+ * @return An AVPacket filled with default values or NULL on failure.
467
+ *
468
+ * @note this only allocates the AVPacket itself, not the data buffers. Those
469
+ * must be allocated through other means such as av_new_packet.
470
+ *
471
+ * @see av_new_packet
472
+ */
473
+ AVPacket *av_packet_alloc(void);
474
+
475
+ /**
476
+ * Create a new packet that references the same data as src.
477
+ *
478
+ * This is a shortcut for av_packet_alloc()+av_packet_ref().
479
+ *
480
+ * @return newly created AVPacket on success, NULL on error.
481
+ *
482
+ * @see av_packet_alloc
483
+ * @see av_packet_ref
484
+ */
485
+ AVPacket *av_packet_clone(const AVPacket *src);
486
+
487
+ /**
488
+ * Free the packet, if the packet is reference counted, it will be
489
+ * unreferenced first.
490
+ *
491
+ * @param pkt packet to be freed. The pointer will be set to NULL.
492
+ * @note passing NULL is a no-op.
493
+ */
494
+ void av_packet_free(AVPacket **pkt);
495
+
496
+ #if FF_API_INIT_PACKET
497
+ /**
498
+ * Initialize optional fields of a packet with default values.
499
+ *
500
+ * Note, this does not touch the data and size members, which have to be
501
+ * initialized separately.
502
+ *
503
+ * @param pkt packet
504
+ *
505
+ * @see av_packet_alloc
506
+ * @see av_packet_unref
507
+ *
508
+ * @deprecated This function is deprecated. Once it's removed,
509
+ sizeof(AVPacket) will not be a part of the ABI anymore.
510
+ */
511
+ attribute_deprecated
512
+ void av_init_packet(AVPacket *pkt);
513
+ #endif
514
+
515
+ /**
516
+ * Allocate the payload of a packet and initialize its fields with
517
+ * default values.
518
+ *
519
+ * @param pkt packet
520
+ * @param size wanted payload size
521
+ * @return 0 if OK, AVERROR_xxx otherwise
522
+ */
523
+ int av_new_packet(AVPacket *pkt, int size);
524
+
525
+ /**
526
+ * Reduce packet size, correctly zeroing padding
527
+ *
528
+ * @param pkt packet
529
+ * @param size new size
530
+ */
531
+ void av_shrink_packet(AVPacket *pkt, int size);
532
+
533
+ /**
534
+ * Increase packet size, correctly zeroing padding
535
+ *
536
+ * @param pkt packet
537
+ * @param grow_by number of bytes by which to increase the size of the packet
538
+ */
539
+ int av_grow_packet(AVPacket *pkt, int grow_by);
540
+
541
+ /**
542
+ * Initialize a reference-counted packet from av_malloc()ed data.
543
+ *
544
+ * @param pkt packet to be initialized. This function will set the data, size,
545
+ * and buf fields, all others are left untouched.
546
+ * @param data Data allocated by av_malloc() to be used as packet data. If this
547
+ * function returns successfully, the data is owned by the underlying AVBuffer.
548
+ * The caller may not access the data through other means.
549
+ * @param size size of data in bytes, without the padding. I.e. the full buffer
550
+ * size is assumed to be size + AV_INPUT_BUFFER_PADDING_SIZE.
551
+ *
552
+ * @return 0 on success, a negative AVERROR on error
553
+ */
554
+ int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size);
555
+
556
+ /**
557
+ * Allocate new information of a packet.
558
+ *
559
+ * @param pkt packet
560
+ * @param type side information type
561
+ * @param size side information size
562
+ * @return pointer to fresh allocated data or NULL otherwise
563
+ */
564
+ uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
565
+ size_t size);
566
+
567
+ /**
568
+ * Wrap an existing array as a packet side data.
569
+ *
570
+ * @param pkt packet
571
+ * @param type side information type
572
+ * @param data the side data array. It must be allocated with the av_malloc()
573
+ * family of functions. The ownership of the data is transferred to
574
+ * pkt.
575
+ * @param size side information size
576
+ * @return a non-negative number on success, a negative AVERROR code on
577
+ * failure. On failure, the packet is unchanged and the data remains
578
+ * owned by the caller.
579
+ */
580
+ int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
581
+ uint8_t *data, size_t size);
582
+
583
+ /**
584
+ * Shrink the already allocated side data buffer
585
+ *
586
+ * @param pkt packet
587
+ * @param type side information type
588
+ * @param size new side information size
589
+ * @return 0 on success, < 0 on failure
590
+ */
591
+ int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
592
+ size_t size);
593
+
594
+ /**
595
+ * Get side information from packet.
596
+ *
597
+ * @param pkt packet
598
+ * @param type desired side information type
599
+ * @param size If supplied, *size will be set to the size of the side data
600
+ * or to zero if the desired side data is not present.
601
+ * @return pointer to data if present or NULL otherwise
602
+ */
603
+ uint8_t* av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type,
604
+ size_t *size);
605
+
606
+ const char *av_packet_side_data_name(enum AVPacketSideDataType type);
607
+
608
+ /**
609
+ * Pack a dictionary for use in side_data.
610
+ *
611
+ * @param dict The dictionary to pack.
612
+ * @param size pointer to store the size of the returned data
613
+ * @return pointer to data if successful, NULL otherwise
614
+ */
615
+ uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size);
616
+ /**
617
+ * Unpack a dictionary from side_data.
618
+ *
619
+ * @param data data from side_data
620
+ * @param size size of the data
621
+ * @param dict the metadata storage dictionary
622
+ * @return 0 on success, < 0 on failure
623
+ */
624
+ int av_packet_unpack_dictionary(const uint8_t *data, size_t size,
625
+ AVDictionary **dict);
626
+
627
+ /**
628
+ * Convenience function to free all the side data stored.
629
+ * All the other fields stay untouched.
630
+ *
631
+ * @param pkt packet
632
+ */
633
+ void av_packet_free_side_data(AVPacket *pkt);
634
+
635
+ /**
636
+ * Setup a new reference to the data described by a given packet
637
+ *
638
+ * If src is reference-counted, setup dst as a new reference to the
639
+ * buffer in src. Otherwise allocate a new buffer in dst and copy the
640
+ * data from src into it.
641
+ *
642
+ * All the other fields are copied from src.
643
+ *
644
+ * @see av_packet_unref
645
+ *
646
+ * @param dst Destination packet. Will be completely overwritten.
647
+ * @param src Source packet
648
+ *
649
+ * @return 0 on success, a negative AVERROR on error. On error, dst
650
+ * will be blank (as if returned by av_packet_alloc()).
651
+ */
652
+ int av_packet_ref(AVPacket *dst, const AVPacket *src);
653
+
654
+ /**
655
+ * Wipe the packet.
656
+ *
657
+ * Unreference the buffer referenced by the packet and reset the
658
+ * remaining packet fields to their default values.
659
+ *
660
+ * @param pkt The packet to be unreferenced.
661
+ */
662
+ void av_packet_unref(AVPacket *pkt);
663
+
664
+ /**
665
+ * Move every field in src to dst and reset src.
666
+ *
667
+ * @see av_packet_unref
668
+ *
669
+ * @param src Source packet, will be reset
670
+ * @param dst Destination packet
671
+ */
672
+ void av_packet_move_ref(AVPacket *dst, AVPacket *src);
673
+
674
+ /**
675
+ * Copy only "properties" fields from src to dst.
676
+ *
677
+ * Properties for the purpose of this function are all the fields
678
+ * beside those related to the packet data (buf, data, size)
679
+ *
680
+ * @param dst Destination packet
681
+ * @param src Source packet
682
+ *
683
+ * @return 0 on success AVERROR on failure.
684
+ */
685
+ int av_packet_copy_props(AVPacket *dst, const AVPacket *src);
686
+
687
+ /**
688
+ * Ensure the data described by a given packet is reference counted.
689
+ *
690
+ * @note This function does not ensure that the reference will be writable.
691
+ * Use av_packet_make_writable instead for that purpose.
692
+ *
693
+ * @see av_packet_ref
694
+ * @see av_packet_make_writable
695
+ *
696
+ * @param pkt packet whose data should be made reference counted.
697
+ *
698
+ * @return 0 on success, a negative AVERROR on error. On failure, the
699
+ * packet is unchanged.
700
+ */
701
+ int av_packet_make_refcounted(AVPacket *pkt);
702
+
703
+ /**
704
+ * Create a writable reference for the data described by a given packet,
705
+ * avoiding data copy if possible.
706
+ *
707
+ * @param pkt Packet whose data should be made writable.
708
+ *
709
+ * @return 0 on success, a negative AVERROR on failure. On failure, the
710
+ * packet is unchanged.
711
+ */
712
+ int av_packet_make_writable(AVPacket *pkt);
713
+
714
+ /**
715
+ * Convert valid timing fields (timestamps / durations) in a packet from one
716
+ * timebase to another. Timestamps with unknown values (AV_NOPTS_VALUE) will be
717
+ * ignored.
718
+ *
719
+ * @param pkt packet on which the conversion will be performed
720
+ * @param tb_src source timebase, in which the timing fields in pkt are
721
+ * expressed
722
+ * @param tb_dst destination timebase, to which the timing fields will be
723
+ * converted
724
+ */
725
+ void av_packet_rescale_ts(AVPacket *pkt, AVRational tb_src, AVRational tb_dst);
726
+
727
+ /**
728
+ * @}
729
+ */
730
+
731
+ #endif // AVCODEC_PACKET_H