@mentra/bluetooth-sdk 0.1.0

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 (278) hide show
  1. package/README.md +278 -0
  2. package/android/build.gradle +167 -0
  3. package/android/lc3Lib/CMakeLists.txt +6 -0
  4. package/android/lc3Lib/build.gradle +109 -0
  5. package/android/lc3Lib/proguard-rules.pro +33 -0
  6. package/android/lc3Lib/src/main/AndroidManifest.xml +2 -0
  7. package/android/lc3Lib/src/main/cpp/CMakeLists.txt +8 -0
  8. package/android/lc3Lib/src/main/cpp/google_opus_stuff/CMakeLists.txt +30 -0
  9. package/android/lc3Lib/src/main/cpp/google_opus_stuff/jni/CMakeLists.txt +7 -0
  10. package/android/lc3Lib/src/main/cpp/google_opus_stuff/jni/ogg_opus_encoder.cc +96 -0
  11. package/android/lc3Lib/src/main/cpp/google_opus_stuff/jni/ogg_opus_encoder.h +53 -0
  12. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libogg/Makefile.am +6 -0
  13. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libogg/config_types.h +26 -0
  14. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libogg/config_types.h.in +26 -0
  15. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libogg/ogg.h +209 -0
  16. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libogg/os_types.h +158 -0
  17. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus.h +981 -0
  18. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus_custom.h +342 -0
  19. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus_defines.h +799 -0
  20. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus_multistream.h +660 -0
  21. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus_projection.h +568 -0
  22. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus_types.h +166 -0
  23. package/android/lc3Lib/src/main/cpp/google_opus_stuff/ogg_opus_encoder.cc +268 -0
  24. package/android/lc3Lib/src/main/cpp/google_opus_stuff/ogg_opus_encoder.h +115 -0
  25. package/android/lc3Lib/src/main/cpp/google_opus_stuff/opus_tools/opus_header.h +59 -0
  26. package/android/lc3Lib/src/main/cpp/liblc3/CMakeLists.txt +38 -0
  27. package/android/lc3Lib/src/main/cpp/liblc3/include/lc3.h +309 -0
  28. package/android/lc3Lib/src/main/cpp/liblc3/include/lc3_private.h +162 -0
  29. package/android/lc3Lib/src/main/cpp/liblc3/include/rnnoise.h +114 -0
  30. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/CMakeLists.txt +19 -0
  31. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/attdet.c +92 -0
  32. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/attdet.h +44 -0
  33. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/bits.c +375 -0
  34. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/bits.h +315 -0
  35. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/bwdet.c +129 -0
  36. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/bwdet.h +69 -0
  37. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/common.h +148 -0
  38. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/energy.c +70 -0
  39. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/energy.h +43 -0
  40. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/fastmath.h +158 -0
  41. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/lc3.c +702 -0
  42. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/ltpf.c +893 -0
  43. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/ltpf.h +111 -0
  44. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/ltpf_arm.h +506 -0
  45. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/ltpf_neon.h +281 -0
  46. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/makefile.mk +35 -0
  47. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/mdct.c +452 -0
  48. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/mdct.h +57 -0
  49. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/mdct_neon.h +296 -0
  50. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/meson.build +46 -0
  51. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/plc.c +61 -0
  52. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/plc.h +57 -0
  53. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/sns.c +880 -0
  54. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/sns.h +103 -0
  55. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/spec.c +904 -0
  56. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/spec.h +119 -0
  57. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/tables.c +3457 -0
  58. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/tables.h +94 -0
  59. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/tns.c +457 -0
  60. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/tns.h +99 -0
  61. package/android/lc3Lib/src/main/cpp/liblc3/liblc3.cpp +159 -0
  62. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/_kiss_fft_guts.h +182 -0
  63. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/arch.h +261 -0
  64. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/celt_lpc.c +279 -0
  65. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/celt_lpc.h +59 -0
  66. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/common.h +48 -0
  67. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/compile.sh +3 -0
  68. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/denoise.c +646 -0
  69. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/kiss_fft.c +601 -0
  70. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/kiss_fft.h +203 -0
  71. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/opus_types.h +159 -0
  72. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/pitch.c +526 -0
  73. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/pitch.h +149 -0
  74. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn.c +178 -0
  75. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn.h +69 -0
  76. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn_data.c +11051 -0
  77. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn_data.h +34 -0
  78. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn_reader.c +168 -0
  79. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn_train.py +66 -0
  80. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/tansig_table.h +45 -0
  81. package/android/lc3Lib/src/main/java/com/mentra/lc3Lib/Lc3Cpp.java +38 -0
  82. package/android/lc3Lib/third_party/CMakeLists.txt +23 -0
  83. package/android/lc3Lib/third_party/CMakeLists_libogg.txt +18 -0
  84. package/android/lc3Lib/third_party/CMakeLists_libopus.txt +18 -0
  85. package/android/lc3Lib/third_party/CMakeLists_opus-tools.txt +23 -0
  86. package/android/lc3Lib/third_party/opus_tools/src/AUTHORS +5 -0
  87. package/android/lc3Lib/third_party/opus_tools/src/CMakeLists.txt +4 -0
  88. package/android/lc3Lib/third_party/opus_tools/src/COPYING +371 -0
  89. package/android/lc3Lib/third_party/opus_tools/src/ChangeLog +3 -0
  90. package/android/lc3Lib/third_party/opus_tools/src/Makefile.am +42 -0
  91. package/android/lc3Lib/third_party/opus_tools/src/Makefile.unix +23 -0
  92. package/android/lc3Lib/third_party/opus_tools/src/NEWS +0 -0
  93. package/android/lc3Lib/third_party/opus_tools/src/README +0 -0
  94. package/android/lc3Lib/third_party/opus_tools/src/autogen.sh +115 -0
  95. package/android/lc3Lib/third_party/opus_tools/src/configure.ac +293 -0
  96. package/android/lc3Lib/third_party/opus_tools/src/src/arch.h +239 -0
  97. package/android/lc3Lib/third_party/opus_tools/src/src/audio-in.c +1046 -0
  98. package/android/lc3Lib/third_party/opus_tools/src/src/diag_range.c +245 -0
  99. package/android/lc3Lib/third_party/opus_tools/src/src/diag_range.h +28 -0
  100. package/android/lc3Lib/third_party/opus_tools/src/src/info_opus.c +320 -0
  101. package/android/lc3Lib/third_party/opus_tools/src/src/info_opus.h +51 -0
  102. package/android/lc3Lib/third_party/opus_tools/src/src/lpc.c +157 -0
  103. package/android/lc3Lib/third_party/opus_tools/src/src/lpc.h +27 -0
  104. package/android/lc3Lib/third_party/opus_tools/src/src/opus_header.c +286 -0
  105. package/android/lc3Lib/third_party/opus_tools/src/src/opus_header.h +59 -0
  106. package/android/lc3Lib/third_party/opus_tools/src/src/opusdec.c +884 -0
  107. package/android/lc3Lib/third_party/opus_tools/src/src/opusenc.c +1021 -0
  108. package/android/lc3Lib/third_party/opus_tools/src/src/opusenc.h +101 -0
  109. package/android/lc3Lib/third_party/opus_tools/src/src/opusinfo.c +639 -0
  110. package/android/lc3Lib/third_party/opus_tools/src/src/opusinfo.h +51 -0
  111. package/android/lc3Lib/third_party/opus_tools/src/src/os_support.h +167 -0
  112. package/android/lc3Lib/third_party/opus_tools/src/src/resample.c +1137 -0
  113. package/android/lc3Lib/third_party/opus_tools/src/src/speex_resampler.h +344 -0
  114. package/android/lc3Lib/third_party/opus_tools/src/src/stack_alloc.h +115 -0
  115. package/android/lc3Lib/third_party/opus_tools/src/src/wav_io.c +125 -0
  116. package/android/lc3Lib/third_party/opus_tools/src/src/wav_io.h +62 -0
  117. package/android/lc3Lib/third_party/opus_tools/src/src/wave_out.c +223 -0
  118. package/android/lc3Lib/third_party/opus_tools/src/src/wave_out.h +60 -0
  119. package/android/settings.gradle +1 -0
  120. package/android/src/main/AndroidManifest.xml +40 -0
  121. package/android/src/main/java/com/mentra/bluetoothsdk/BluetoothSdkModule.kt +528 -0
  122. package/android/src/main/java/com/mentra/bluetoothsdk/Bridge.kt +610 -0
  123. package/android/src/main/java/com/mentra/bluetoothsdk/DeviceManager.kt +1616 -0
  124. package/android/src/main/java/com/mentra/bluetoothsdk/DeviceStore.kt +314 -0
  125. package/android/src/main/java/com/mentra/bluetoothsdk/MentraBluetoothModels.kt +1710 -0
  126. package/android/src/main/java/com/mentra/bluetoothsdk/MentraBluetoothSdk.kt +554 -0
  127. package/android/src/main/java/com/mentra/bluetoothsdk/ObservableStore.kt +68 -0
  128. package/android/src/main/java/com/mentra/bluetoothsdk/controllers/ControllerManager.kt +158 -0
  129. package/android/src/main/java/com/mentra/bluetoothsdk/controllers/R1.kt +934 -0
  130. package/android/src/main/java/com/mentra/bluetoothsdk/services/Foreground.kt +175 -0
  131. package/android/src/main/java/com/mentra/bluetoothsdk/services/PhoneMic.kt +1109 -0
  132. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/G1.java +3974 -0
  133. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/G2.kt +3551 -0
  134. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/Mach1.java +1327 -0
  135. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraLive.java +6959 -0
  136. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraNex.kt +1655 -0
  137. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraosBle.java +53675 -0
  138. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/SGCManager.kt +202 -0
  139. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/Simulated.kt +224 -0
  140. package/android/src/main/java/com/mentra/bluetoothsdk/stt/STTTools.kt +340 -0
  141. package/android/src/main/java/com/mentra/bluetoothsdk/stt/SherpaOnnxTranscriber.kt +465 -0
  142. package/android/src/main/java/com/mentra/bluetoothsdk/stt/VadGateSpeechPolicy.kt +221 -0
  143. package/android/src/main/java/com/mentra/bluetoothsdk/utils/AES.java +106 -0
  144. package/android/src/main/java/com/mentra/bluetoothsdk/utils/AudioSessionMonitor.kt +189 -0
  145. package/android/src/main/java/com/mentra/bluetoothsdk/utils/BitmapJavaUtils.java +169 -0
  146. package/android/src/main/java/com/mentra/bluetoothsdk/utils/BlePhotoUploadService.java +179 -0
  147. package/android/src/main/java/com/mentra/bluetoothsdk/utils/Constants.kt +44 -0
  148. package/android/src/main/java/com/mentra/bluetoothsdk/utils/G1Text.kt +436 -0
  149. package/android/src/main/java/com/mentra/bluetoothsdk/utils/IncidentLogBleRelayNaming.java +29 -0
  150. package/android/src/main/java/com/mentra/bluetoothsdk/utils/IncidentLogBleUploadService.java +76 -0
  151. package/android/src/main/java/com/mentra/bluetoothsdk/utils/K900ProtocolUtils.java +791 -0
  152. package/android/src/main/java/com/mentra/bluetoothsdk/utils/MessageChunker.java +186 -0
  153. package/android/src/main/java/com/mentra/bluetoothsdk/utils/NexSGCUtils.kt +589 -0
  154. package/android/src/main/java/com/mentra/bluetoothsdk/utils/PhoneAudioMonitor.kt +303 -0
  155. package/android/src/main/java/com/mentra/bluetoothsdk/utils/SmartGlassesConnectionState.java +9 -0
  156. package/android/src/main/java/com/mentra/bluetoothsdk/utils/audio/ByteUtilAudioPlayer.java +655 -0
  157. package/android/src/main/java/com/mentra/bluetoothsdk/utils/audio/Lc3Player.java +441 -0
  158. package/android/src/main/java/com/mentra/bluetoothsdk/utils/audio/PCMAudioPlayer.java +431 -0
  159. package/android/src/main/res/values/strings.xml +4 -0
  160. package/app.plugin.js +1 -0
  161. package/build/BluetoothSdk.types.d.ts +498 -0
  162. package/build/BluetoothSdk.types.d.ts.map +1 -0
  163. package/build/BluetoothSdk.types.js +23 -0
  164. package/build/BluetoothSdk.types.js.map +1 -0
  165. package/build/BluetoothSdkModule.d.ts +71 -0
  166. package/build/BluetoothSdkModule.d.ts.map +1 -0
  167. package/build/BluetoothSdkModule.js +106 -0
  168. package/build/BluetoothSdkModule.js.map +1 -0
  169. package/build/index.d.ts +3 -0
  170. package/build/index.d.ts.map +1 -0
  171. package/build/index.js +5 -0
  172. package/build/index.js.map +1 -0
  173. package/expo-module.config.json +9 -0
  174. package/ios/BluetoothSdkModule.swift +665 -0
  175. package/ios/MentraBluetoothSDK.podspec +77 -0
  176. package/ios/Packages/CoreObjC/CoreObjC.xcodeproj/project.pbxproj +213 -0
  177. package/ios/Packages/CoreObjC/PcmConverter.h +22 -0
  178. package/ios/Packages/CoreObjC/PcmConverter.m +266 -0
  179. package/ios/Packages/CoreObjC/attdet.c +92 -0
  180. package/ios/Packages/CoreObjC/attdet.h +44 -0
  181. package/ios/Packages/CoreObjC/bits.c +375 -0
  182. package/ios/Packages/CoreObjC/bits.h +315 -0
  183. package/ios/Packages/CoreObjC/bwdet.c +129 -0
  184. package/ios/Packages/CoreObjC/bwdet.h +69 -0
  185. package/ios/Packages/CoreObjC/common.h +151 -0
  186. package/ios/Packages/CoreObjC/energy.c +70 -0
  187. package/ios/Packages/CoreObjC/energy.h +43 -0
  188. package/ios/Packages/CoreObjC/fastmath.h +158 -0
  189. package/ios/Packages/CoreObjC/lc3.c +704 -0
  190. package/ios/Packages/CoreObjC/lc3.h +313 -0
  191. package/ios/Packages/CoreObjC/lc3_cpp.h +283 -0
  192. package/ios/Packages/CoreObjC/lc3_private.h +163 -0
  193. package/ios/Packages/CoreObjC/ltpf.c +905 -0
  194. package/ios/Packages/CoreObjC/ltpf.h +111 -0
  195. package/ios/Packages/CoreObjC/ltpf_arm.h +506 -0
  196. package/ios/Packages/CoreObjC/ltpf_neon.h +281 -0
  197. package/ios/Packages/CoreObjC/makefile.mk +35 -0
  198. package/ios/Packages/CoreObjC/mdct.c +469 -0
  199. package/ios/Packages/CoreObjC/mdct.h +57 -0
  200. package/ios/Packages/CoreObjC/mdct_neon.h +296 -0
  201. package/ios/Packages/CoreObjC/meson.build +61 -0
  202. package/ios/Packages/CoreObjC/plc.c +61 -0
  203. package/ios/Packages/CoreObjC/plc.h +57 -0
  204. package/ios/Packages/CoreObjC/rnnoise.h +114 -0
  205. package/ios/Packages/CoreObjC/sns.c +880 -0
  206. package/ios/Packages/CoreObjC/sns.h +103 -0
  207. package/ios/Packages/CoreObjC/spec.c +907 -0
  208. package/ios/Packages/CoreObjC/spec.h +119 -0
  209. package/ios/Packages/CoreObjC/tables.c +3457 -0
  210. package/ios/Packages/CoreObjC/tables.h +94 -0
  211. package/ios/Packages/CoreObjC/tns.c +457 -0
  212. package/ios/Packages/CoreObjC/tns.h +99 -0
  213. package/ios/Packages/SherpaOnnx/Model/joiner.onnx +0 -0
  214. package/ios/Packages/SherpaOnnx/Model/tokens.txt +502 -0
  215. package/ios/Packages/SherpaOnnx/SherpaOnnx.swift +1659 -0
  216. package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/Headers/cargs.h +162 -0
  217. package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/Headers/sherpa-onnx/c-api/c-api.h +1852 -0
  218. package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/Headers/sherpa-onnx/c-api/cxx-api.h +674 -0
  219. package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/Info.plist +44 -0
  220. package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64/libsherpa-onnx.a +0 -0
  221. package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64/sherpa-onnx.a +0 -0
  222. package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64_x86_64-simulator/libsherpa-onnx.a +0 -0
  223. package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64_x86_64-simulator/sherpa-onnx.a +0 -0
  224. package/ios/Packages/VAD/Common/VAD/VADQuality.swift +41 -0
  225. package/ios/Packages/VAD/Common/VAD/VADState.swift +26 -0
  226. package/ios/Packages/VAD/Common/VAD/VADStrategy.swift +29 -0
  227. package/ios/Packages/VAD/Common/VAD/VADType.swift +14 -0
  228. package/ios/Packages/VAD/Data/Configuration.swift +68 -0
  229. package/ios/Packages/VAD/Data/FrameSize.swift +39 -0
  230. package/ios/Packages/VAD/Data/Record.swift +13 -0
  231. package/ios/Packages/VAD/Data/Result.swift +22 -0
  232. package/ios/Packages/VAD/Data/SampleRate.swift +48 -0
  233. package/ios/Packages/VAD/Silero/Model/silero_vad.onnx +0 -0
  234. package/ios/Packages/VAD/Silero/SileroVAD.swift +284 -0
  235. package/ios/Packages/VAD/Silero/SileroVADStrategy.swift +64 -0
  236. package/ios/Packages/libbz2/module.modulemap +5 -0
  237. package/ios/Packages/libbz2/shim.h +1 -0
  238. package/ios/Source/Bridge.swift +353 -0
  239. package/ios/Source/Bridging-Header.h +16 -0
  240. package/ios/Source/DeviceManager.swift +1478 -0
  241. package/ios/Source/DeviceStore.swift +295 -0
  242. package/ios/Source/MentraBluetoothSDK.swift +2439 -0
  243. package/ios/Source/ObservableStore.swift +88 -0
  244. package/ios/Source/PrivacyInfo.xcprivacy +23 -0
  245. package/ios/Source/controllers/ControllerManager.swift +187 -0
  246. package/ios/Source/controllers/R1.swift +827 -0
  247. package/ios/Source/services/PhoneMic.swift +662 -0
  248. package/ios/Source/sgcs/Frame.swift +651 -0
  249. package/ios/Source/sgcs/G1.swift +2505 -0
  250. package/ios/Source/sgcs/G2.swift +3730 -0
  251. package/ios/Source/sgcs/Mach1.swift +543 -0
  252. package/ios/Source/sgcs/MentraLive.swift +4708 -0
  253. package/ios/Source/sgcs/MentraNex.swift +2479 -0
  254. package/ios/Source/sgcs/SGCManager.swift +243 -0
  255. package/ios/Source/sgcs/Simulated.swift +270 -0
  256. package/ios/Source/sgcs/mentraos_ble.pb.swift +3811 -0
  257. package/ios/Source/stt/STTTools.swift +154 -0
  258. package/ios/Source/stt/SherpaOnnxTranscriber.swift +401 -0
  259. package/ios/Source/utils/AudioSessionMonitor.swift +283 -0
  260. package/ios/Source/utils/Constants.swift +74 -0
  261. package/ios/Source/utils/Enums.swift +95 -0
  262. package/ios/Source/utils/G1Text.swift +2067 -0
  263. package/ios/Source/utils/JSCExperiment.swift +241 -0
  264. package/ios/Source/utils/MemoryMonitor.swift +44 -0
  265. package/ios/Source/utils/MessageChunker.swift +164 -0
  266. package/ios/Source/utils/Models.swift +135 -0
  267. package/ios/Source/utils/PhoneAudioMonitor.swift +226 -0
  268. package/ios/Source/utils/TarBz2Extractor.swift +206 -0
  269. package/package.json +78 -0
  270. package/plugin/build/index.d.ts +6 -0
  271. package/plugin/build/index.js +12 -0
  272. package/plugin/build/withAndroid.d.ts +4 -0
  273. package/plugin/build/withAndroid.js +80 -0
  274. package/plugin/build/withIos.d.ts +4 -0
  275. package/plugin/build/withIos.js +64 -0
  276. package/src/BluetoothSdk.types.ts +581 -0
  277. package/src/BluetoothSdkModule.ts +259 -0
  278. package/src/index.ts +4 -0
@@ -0,0 +1,639 @@
1
+ /* Opusinfo
2
+ *
3
+ * A tool to describe opus file contents and metadata.
4
+ *
5
+ * This is a fork of ogginfo from the vorbis-tools package
6
+ * which has been cut down to only have opus support.
7
+ *
8
+ * Ogginfo is
9
+ * Copyright 2002-2005 Michael Smith <msmith@xiph.org>
10
+ * Licensed under the GNU GPL, distributed with this program.
11
+ */
12
+
13
+ #ifdef HAVE_CONFIG_H
14
+ #include <config.h>
15
+ #endif
16
+
17
+ #include <stdio.h>
18
+ #include <stdlib.h>
19
+ #include <errno.h>
20
+ #include <string.h>
21
+ #include <stdarg.h>
22
+ #include <getopt.h>
23
+ #include <math.h>
24
+
25
+ #include <ogg/ogg.h>
26
+
27
+ /*No NLS support for now*/
28
+ #define _(X) (X)
29
+
30
+ #include "opusinfo.h"
31
+ #include "opus_header.h"
32
+ #include "info_opus.h"
33
+
34
+ #define CHUNK 4500
35
+
36
+ static int printlots = 0;
37
+ static int printinfo = 1;
38
+ static int printwarn = 1;
39
+ static int verbose = 1;
40
+
41
+ static int flawed;
42
+
43
+ #define CONSTRAINT_PAGE_AFTER_EOS 1
44
+ #define CONSTRAINT_MUXING_VIOLATED 2
45
+
46
+ static stream_set *create_stream_set(void) {
47
+ stream_set *set = calloc(1, sizeof(stream_set));
48
+
49
+ set->streams = calloc(5, sizeof(stream_processor));
50
+ set->allocated = 5;
51
+ set->used = 0;
52
+
53
+ return set;
54
+ }
55
+
56
+ void oi_info(char *format, ...)
57
+ {
58
+ va_list ap;
59
+
60
+ if(!printinfo)
61
+ return;
62
+
63
+ va_start(ap, format);
64
+ vfprintf(stdout, format, ap);
65
+ va_end(ap);
66
+ }
67
+
68
+ void oi_warn(char *format, ...)
69
+ {
70
+ va_list ap;
71
+
72
+ flawed = 1;
73
+ if(!printwarn)
74
+ return;
75
+
76
+ va_start(ap, format);
77
+ vfprintf(stdout, format, ap);
78
+ va_end(ap);
79
+ }
80
+
81
+ void oi_error(char *format, ...)
82
+ {
83
+ va_list ap;
84
+
85
+ flawed = 1;
86
+
87
+ va_start(ap, format);
88
+ vfprintf(stdout, format, ap);
89
+ va_end(ap);
90
+ }
91
+
92
+ void check_xiph_comment(stream_processor *stream, int i, const char *comment,
93
+ int comment_length)
94
+ {
95
+ char *sep = strchr(comment, '=');
96
+ int j;
97
+ int broken = 0;
98
+ unsigned char *val;
99
+ int bytes;
100
+ int remaining;
101
+
102
+ if(sep == NULL) {
103
+ oi_warn(_("WARNING: Comment %d in stream %d has invalid "
104
+ "format, does not contain '=': \"%s\"\n"),
105
+ i, stream->num, comment);
106
+ return;
107
+ }
108
+
109
+ for(j=0; j < sep-comment; j++) {
110
+ if(comment[j] < 0x20 || comment[j] > 0x7D) {
111
+ oi_warn(_("WARNING: Invalid comment fieldname in "
112
+ "comment %d (stream %d): \"%s\"\n"),
113
+ i, stream->num, comment);
114
+ broken = 1;
115
+ break;
116
+ }
117
+ }
118
+
119
+ if(broken)
120
+ return;
121
+
122
+ val = (unsigned char *)comment;
123
+
124
+ j = sep-comment+1;
125
+ while(j < comment_length)
126
+ {
127
+ remaining = comment_length - j;
128
+ if((val[j] & 0x80) == 0)
129
+ bytes = 1;
130
+ else if((val[j] & 0x40) == 0x40) {
131
+ if((val[j] & 0x20) == 0)
132
+ bytes = 2;
133
+ else if((val[j] & 0x10) == 0)
134
+ bytes = 3;
135
+ else if((val[j] & 0x08) == 0)
136
+ bytes = 4;
137
+ else if((val[j] & 0x04) == 0)
138
+ bytes = 5;
139
+ else if((val[j] & 0x02) == 0)
140
+ bytes = 6;
141
+ else {
142
+ oi_warn(_("WARNING: Illegal UTF-8 sequence in "
143
+ "comment %d (stream %d): length marker wrong\n"),
144
+ i, stream->num);
145
+ broken = 1;
146
+ break;
147
+ }
148
+ }
149
+ else {
150
+ oi_warn(_("WARNING: Illegal UTF-8 sequence in comment "
151
+ "%d (stream %d): length marker wrong\n"), i, stream->num);
152
+ broken = 1;
153
+ break;
154
+ }
155
+
156
+ if(bytes > remaining) {
157
+ oi_warn(_("WARNING: Illegal UTF-8 sequence in comment "
158
+ "%d (stream %d): too few bytes\n"), i, stream->num);
159
+ broken = 1;
160
+ break;
161
+ }
162
+
163
+ switch(bytes) {
164
+ case 1:
165
+ /* No more checks needed */
166
+ break;
167
+ case 2:
168
+ if((val[j+1] & 0xC0) != 0x80)
169
+ broken = 1;
170
+ if((val[j] & 0xFE) == 0xC0)
171
+ broken = 1;
172
+ break;
173
+ case 3:
174
+ if(!((val[j] == 0xE0 && val[j+1] >= 0xA0 && val[j+1] <= 0xBF &&
175
+ (val[j+2] & 0xC0) == 0x80) ||
176
+ (val[j] >= 0xE1 && val[j] <= 0xEC &&
177
+ (val[j+1] & 0xC0) == 0x80 &&
178
+ (val[j+2] & 0xC0) == 0x80) ||
179
+ (val[j] == 0xED && val[j+1] >= 0x80 &&
180
+ val[j+1] <= 0x9F &&
181
+ (val[j+2] & 0xC0) == 0x80) ||
182
+ (val[j] >= 0xEE && val[j] <= 0xEF &&
183
+ (val[j+1] & 0xC0) == 0x80 &&
184
+ (val[j+2] & 0xC0) == 0x80)))
185
+ broken = 1;
186
+ if(val[j] == 0xE0 && (val[j+1] & 0xE0) == 0x80)
187
+ broken = 1;
188
+ break;
189
+ case 4:
190
+ if(!((val[j] == 0xF0 && val[j+1] >= 0x90 &&
191
+ val[j+1] <= 0xBF &&
192
+ (val[j+2] & 0xC0) == 0x80 &&
193
+ (val[j+3] & 0xC0) == 0x80) ||
194
+ (val[j] >= 0xF1 && val[j] <= 0xF3 &&
195
+ (val[j+1] & 0xC0) == 0x80 &&
196
+ (val[j+2] & 0xC0) == 0x80 &&
197
+ (val[j+3] & 0xC0) == 0x80) ||
198
+ (val[j] == 0xF4 && val[j+1] >= 0x80 &&
199
+ val[j+1] <= 0x8F &&
200
+ (val[j+2] & 0xC0) == 0x80 &&
201
+ (val[j+3] & 0xC0) == 0x80)))
202
+ broken = 1;
203
+ if(val[j] == 0xF0 && (val[j+1] & 0xF0) == 0x80)
204
+ broken = 1;
205
+ break;
206
+ /* 5 and 6 aren't actually allowed at this point */
207
+ case 5:
208
+ broken = 1;
209
+ break;
210
+ case 6:
211
+ broken = 1;
212
+ break;
213
+ }
214
+
215
+ if(broken) {
216
+ char *simple = malloc (comment_length + 1);
217
+ char *seq = malloc (comment_length * 3 + 1);
218
+ static char hex[] = {'0', '1', '2', '3', '4', '5', '6', '7',
219
+ '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
220
+ int k, c1 = 0, c2 = 0;
221
+ for (k = 0; k < comment_length; k++) {
222
+ seq[c1++] = hex[((unsigned char)comment[k]) >> 4];
223
+ seq[c1++] = hex[((unsigned char)comment[k]) & 0xf];
224
+ seq[c1++] = ' ';
225
+
226
+ if(comment[k] < 0x20 || comment[k] > 0x7D)
227
+ simple[c2++] = '?';
228
+ else
229
+ simple[c2++] = comment[k];
230
+ }
231
+ seq[c1] = 0;
232
+ simple[c2] = 0;
233
+ oi_warn(_("WARNING: Illegal UTF-8 sequence in comment "
234
+ "%d (stream %d): invalid sequence \"%s\": %s\n"), i,
235
+ stream->num, simple, seq);
236
+ broken = 1;
237
+ free (simple);
238
+ free (seq);
239
+ break;
240
+ }
241
+
242
+ j += bytes;
243
+ }
244
+
245
+ if(!broken) {
246
+ oi_info("\t%s\n", comment);
247
+ }
248
+ }
249
+
250
+ static void process_null(stream_processor *stream, ogg_page *page)
251
+ {
252
+ /* This is for invalid streams. */
253
+ (void)stream;
254
+ (void)page;
255
+ }
256
+
257
+ static void process_other(stream_processor *stream, ogg_page *page )
258
+ {
259
+ ogg_packet packet;
260
+
261
+ ogg_stream_pagein(&stream->os, page);
262
+
263
+ while(ogg_stream_packetout(&stream->os, &packet) > 0) {
264
+ /* Should we do anything here? Currently, we don't */
265
+ }
266
+ }
267
+
268
+
269
+ static void free_stream_set(stream_set *set)
270
+ {
271
+ int i;
272
+ for(i=0; i < set->used; i++) {
273
+ if(!set->streams[i].end) {
274
+ oi_warn(_("WARNING: EOS not set on stream %d (normal for live streams)\n"),
275
+ set->streams[i].num);
276
+ if(set->streams[i].process_end)
277
+ set->streams[i].process_end(&set->streams[i]);
278
+ }
279
+ ogg_stream_clear(&set->streams[i].os);
280
+ }
281
+
282
+ free(set->streams);
283
+ free(set);
284
+ }
285
+
286
+ static int streams_open(stream_set *set)
287
+ {
288
+ int i;
289
+ int res=0;
290
+ for(i=0; i < set->used; i++) {
291
+ if(!set->streams[i].end)
292
+ res++;
293
+ }
294
+
295
+ return res;
296
+ }
297
+
298
+ static void null_start(stream_processor *stream)
299
+ {
300
+ stream->process_end = NULL;
301
+ stream->type = "invalid";
302
+ stream->process_page = process_null;
303
+ }
304
+
305
+ static void other_start(stream_processor *stream, char *type)
306
+ {
307
+ if(type)
308
+ stream->type = type;
309
+ else
310
+ stream->type = "unknown";
311
+ stream->process_page = process_other;
312
+ stream->process_end = NULL;
313
+ }
314
+
315
+ static stream_processor *find_stream_processor(stream_set *set, ogg_page *page)
316
+ {
317
+ ogg_uint32_t serial = ogg_page_serialno(page);
318
+ int i;
319
+ int invalid = 0;
320
+ int constraint = 0;
321
+ stream_processor *stream;
322
+
323
+ for(i=0; i < set->used; i++) {
324
+ if(serial == set->streams[i].serial) {
325
+ /* We have a match! */
326
+ stream = &(set->streams[i]);
327
+
328
+ set->in_headers = 0;
329
+ /* if we have detected EOS, then this can't occur here. */
330
+ if(stream->end) {
331
+ stream->isillegal = 1;
332
+ stream->constraint_violated = CONSTRAINT_PAGE_AFTER_EOS;
333
+ return stream;
334
+ }
335
+
336
+ stream->isnew = 0;
337
+ stream->start = ogg_page_bos(page);
338
+ stream->end = ogg_page_eos(page);
339
+ stream->serial = serial;
340
+ return stream;
341
+ }
342
+ }
343
+
344
+ /* If there are streams open, and we've reached the end of the
345
+ * headers, then we can't be starting a new stream.
346
+ * XXX: might this sometimes catch ok streams if EOS flag is missing,
347
+ * but the stream is otherwise ok?
348
+ */
349
+ if(streams_open(set) && !set->in_headers) {
350
+ constraint = CONSTRAINT_MUXING_VIOLATED;
351
+ invalid = 1;
352
+ }
353
+
354
+ set->in_headers = 1;
355
+
356
+ if(set->allocated < set->used)
357
+ stream = &set->streams[set->used];
358
+ else {
359
+ set->allocated += 5;
360
+ set->streams = realloc(set->streams, sizeof(stream_processor)*
361
+ set->allocated);
362
+ stream = &set->streams[set->used];
363
+ }
364
+ set->used++;
365
+ stream->num = set->used; /* We count from 1 */
366
+
367
+ stream->isnew = 1;
368
+ stream->isillegal = invalid;
369
+ stream->constraint_violated = constraint;
370
+
371
+ {
372
+ int res;
373
+ int has_oi_supported=0;
374
+ ogg_packet packet;
375
+
376
+ /* We end up processing the header page twice, but that's ok. */
377
+ ogg_stream_init(&stream->os, serial);
378
+ ogg_stream_pagein(&stream->os, page);
379
+ res = ogg_stream_packetout(&stream->os, &packet);
380
+ if(res <= 0) {
381
+ oi_warn(_("WARNING: Invalid header page, no packet found\n"));
382
+ null_start(stream);
383
+ }
384
+ else if(packet.bytes >= 19 && memcmp(packet.packet, "OpusHead", 8)==0)
385
+ info_opus_start(stream);
386
+ else if(packet.bytes >= 7 && memcmp(packet.packet, "\x01vorbis", 7)==0) {
387
+ other_start(stream, "Vorbis");
388
+ has_oi_supported=1;
389
+ } else if(packet.bytes >= 7 && memcmp(packet.packet, "\x80theora", 7)==0) {
390
+ other_start(stream, "Theora");
391
+ has_oi_supported=1;
392
+ } else if(packet.bytes >= 8 && memcmp(packet.packet, "OggMIDI\0", 8)==0)
393
+ other_start(stream, "MIDI");
394
+ else if(packet.bytes >= 5 && memcmp(packet.packet, "\177FLAC", 5)==0)
395
+ other_start(stream, "FLAC");
396
+ else if(packet.bytes == 4 && memcmp(packet.packet, "fLaC", 4)==0)
397
+ other_start(stream, "FLAC (legacy)");
398
+ else if(packet.bytes >= 8 && memcmp(packet.packet, "Speex ", 8)==0)
399
+ other_start(stream, "speex");
400
+ else if(packet.bytes >= 8 && memcmp(packet.packet, "fishead\0", 8)==0)
401
+ other_start(stream, "skeleton");
402
+ else if(packet.bytes >= 5 && memcmp(packet.packet, "BBCD\0", 5)==0)
403
+ other_start(stream, "dirac");
404
+ else if(packet.bytes >= 8 && memcmp(packet.packet, "KW-DIRAC", 8)==0)
405
+ other_start(stream, "dirac (legacy)");
406
+ else if(packet.bytes >= 8 && memcmp(packet.packet, "\x80kate\0\0\0", 8)==0) {
407
+ other_start(stream, "Kate");
408
+ has_oi_supported=1;
409
+ } else
410
+ other_start(stream, NULL);
411
+
412
+ res = ogg_stream_packetout(&stream->os, &packet);
413
+ if(res > 0) {
414
+ oi_warn(_("WARNING: Invalid header page in stream %d, "
415
+ "contains multiple packets\n"), stream->num);
416
+ }
417
+ if(has_oi_supported)oi_info(_("Use ogginfo for more information on this file.\n"));
418
+
419
+ /* re-init, ready for processing */
420
+ ogg_stream_clear(&stream->os);
421
+ ogg_stream_init(&stream->os, serial);
422
+ }
423
+
424
+ stream->start = ogg_page_bos(page);
425
+ stream->end = ogg_page_eos(page);
426
+ stream->serial = serial;
427
+ stream->shownillegal = 0;
428
+ stream->seqno = ogg_page_pageno(page);
429
+
430
+ if(stream->serial == 0 || stream->serial == 0xFFFFFFFFUL) {
431
+ oi_info(_("Note: Stream %d has serial number %d, which is legal but may "
432
+ "cause problems with some tools.\n"), stream->num,
433
+ stream->serial);
434
+ }
435
+
436
+ return stream;
437
+ }
438
+
439
+ static int get_next_page(FILE *f, ogg_sync_state *ogsync, ogg_page *page,
440
+ ogg_int64_t *written)
441
+ {
442
+ int ret;
443
+ char *buffer;
444
+ int bytes;
445
+
446
+ while((ret = ogg_sync_pageseek(ogsync, page)) <= 0) {
447
+ if(ret < 0) {
448
+ /* unsynced, we jump over bytes to a possible capture - we don't need to read more just yet */
449
+ oi_warn(_("WARNING: Hole in data (%d bytes) found at approximate offset %" I64FORMAT " bytes. Corrupted Ogg.\n"), -ret, *written);
450
+ continue;
451
+ }
452
+
453
+ /* zero return, we didn't have enough data to find a whole page, read */
454
+ buffer = ogg_sync_buffer(ogsync, CHUNK);
455
+ bytes = fread(buffer, 1, CHUNK, f);
456
+ if(bytes <= 0) {
457
+ ogg_sync_wrote(ogsync, 0);
458
+ return 0;
459
+ }
460
+ ogg_sync_wrote(ogsync, bytes);
461
+ *written += bytes;
462
+ }
463
+
464
+ return 1;
465
+ }
466
+
467
+ static void process_file(char *filename) {
468
+ FILE *file = fopen(filename, "rb");
469
+ ogg_sync_state ogsync;
470
+ ogg_page page;
471
+ stream_set *processors = create_stream_set();
472
+ int gotpage = 0;
473
+ ogg_int64_t written = 0;
474
+
475
+ if(!file) {
476
+ oi_error(_("Error opening input file \"%s\": %s\n"), filename,
477
+ strerror(errno));
478
+ return;
479
+ }
480
+
481
+ printf(_("Processing file \"%s\"...\n\n"), filename);
482
+
483
+ ogg_sync_init(&ogsync);
484
+
485
+ while(get_next_page(file, &ogsync, &page, &written)) {
486
+ stream_processor *p = find_stream_processor(processors, &page);
487
+ gotpage = 1;
488
+
489
+ if(!p) {
490
+ oi_error(_("Could not find a processor for stream, bailing\n"));
491
+ return;
492
+ }
493
+
494
+ if(p->isillegal && !p->shownillegal) {
495
+ char *constraint;
496
+ switch(p->constraint_violated) {
497
+ case CONSTRAINT_PAGE_AFTER_EOS:
498
+ constraint = _("Page found for stream after EOS flag");
499
+ break;
500
+ case CONSTRAINT_MUXING_VIOLATED:
501
+ constraint = _("Ogg muxing constraints violated, new "
502
+ "stream before EOS of all previous streams");
503
+ break;
504
+ default:
505
+ constraint = _("Error unknown.");
506
+ }
507
+
508
+ oi_warn(_("WARNING: illegally placed page(s) for logical stream %d\n"
509
+ "This indicates a corrupt Ogg file: %s.\n"),
510
+ p->num, constraint);
511
+ p->shownillegal = 1;
512
+ /* If it's a new stream, we want to continue processing this page
513
+ * anyway to suppress additional spurious errors
514
+ */
515
+ if(!p->isnew)
516
+ continue;
517
+ }
518
+
519
+ if(p->isnew) {
520
+ oi_info(_("New logical stream (#%d, serial: %08x): type %s\n"),
521
+ p->num, p->serial, p->type);
522
+ if(!p->start)
523
+ oi_warn(_("WARNING: stream start flag not set on stream %d\n"),
524
+ p->num);
525
+ }
526
+ else if(p->start)
527
+ oi_warn(_("WARNING: stream start flag found in mid-stream "
528
+ "on stream %d\n"), p->num);
529
+
530
+ if(p->seqno++ != ogg_page_pageno(&page)) {
531
+ if(!p->lostseq)
532
+ oi_warn(_("WARNING: sequence number gap in stream %d. Got page "
533
+ "%ld when expecting page %ld. Indicates missing data.%s\n"
534
+ ), p->num, ogg_page_pageno(&page), p->seqno - 1, p->seqno-1==2?_(" (normal for live streams)"):"");
535
+ p->seqno = ogg_page_pageno(&page);
536
+ p->lostseq = 1;
537
+ }
538
+ else
539
+ p->lostseq = 0;
540
+
541
+ if(!p->isillegal) {
542
+ p->process_page(p, &page);
543
+
544
+ if(p->end) {
545
+ if(p->process_end)
546
+ p->process_end(p);
547
+ oi_info(_("Logical stream %d ended\n"), p->num);
548
+ p->isillegal = 1;
549
+ p->constraint_violated = CONSTRAINT_PAGE_AFTER_EOS;
550
+ }
551
+ }
552
+ }
553
+
554
+ if(!gotpage)
555
+ oi_error(_("ERROR: No Ogg data found in file \"%s\".\n"
556
+ "Input probably not Ogg.\n"), filename);
557
+
558
+ free_stream_set(processors);
559
+
560
+ ogg_sync_clear(&ogsync);
561
+
562
+ fclose(file);
563
+ }
564
+
565
+ static void version (void) {
566
+ printf (_("opusinfo from %s %s\n"), PACKAGE, VERSION);
567
+ }
568
+
569
+ static void usage(void) {
570
+ version ();
571
+ printf (_(" by the Xiph.Org Foundation (http://www.xiph.org/)\n\n"));
572
+ printf(_("(c) 2003-2005 Michael Smith <msmith@xiph.org>\n"
573
+ "(c) 2012 Gregory Maxwell <greg@xiph.org>\n\n"
574
+ "Opusinfo is a fork of ogginfo from the vorbis-tools package\n"
575
+ "which has been cut down to only support opus files.\n\n"
576
+ "Usage: opusinfo [flags] file1.opus [file2.opus ... fileN.opus]\n"
577
+ "Flags supported:\n"
578
+ "\t-h Show this help message.\n"
579
+ "\t-q Make less verbose. Once will remove detailed informative\n"
580
+ "\t messages, twice will remove warnings.\n"
581
+ "\t-v Make more verbose. This may enable more detailed checks\n"
582
+ "\t for some stream types.\n"));
583
+ printf (_("\t-V Output version information and exit.\n"));
584
+ }
585
+
586
+ int main(int argc, char **argv) {
587
+ int f, ret;
588
+
589
+ if(argc < 2) {
590
+ fprintf(stdout,
591
+ _("Usage: opusinfo [flags] file1.opus [file2.opus ... fileN.opus]\n"
592
+ "\n"
593
+ "opusinfo is a tool for printing information about Opus files\n"
594
+ "and for diagnosing problems with them.\n"
595
+ "Full help shown with \"opusinfo -h\".\n"));
596
+ exit(1);
597
+ }
598
+
599
+ while((ret = getopt(argc, argv, "hqvV")) >= 0) {
600
+ switch(ret) {
601
+ case 'h':
602
+ usage();
603
+ return 0;
604
+ case 'V':
605
+ version();
606
+ return 0;
607
+ case 'v':
608
+ verbose++;
609
+ break;
610
+ case 'q':
611
+ verbose--;
612
+ break;
613
+ }
614
+ }
615
+
616
+ if(verbose > 1)
617
+ printlots = 1;
618
+ if(verbose < 1)
619
+ printinfo = 0;
620
+ if(verbose < 0)
621
+ printwarn = 0;
622
+
623
+ if(optind >= argc) {
624
+ fprintf(stderr,
625
+ _("No input files specified. \"opusinfo -h\" for help\n"));
626
+ return 1;
627
+ }
628
+
629
+ ret = 0;
630
+
631
+ for(f=optind; f < argc; f++) {
632
+ flawed = 0;
633
+ process_file(argv[f]);
634
+ if(flawed != 0)
635
+ ret = flawed;
636
+ }
637
+
638
+ return ret;
639
+ }
@@ -0,0 +1,51 @@
1
+ /* Ogginfo
2
+ *
3
+ * A tool to describe ogg file contents and metadata.
4
+ *
5
+ * Copyright 2002-2005 Michael Smith <msmith@xiph.org>
6
+ * Licensed under the GNU GPL, distributed with this program.
7
+ */
8
+
9
+ /*No NLS support for now*/
10
+ #define _(X) (X)
11
+
12
+ #ifdef _WIN32
13
+ #define I64FORMAT "I64d"
14
+ #else
15
+ #define I64FORMAT "lld"
16
+ #endif
17
+
18
+ typedef struct _stream_processor {
19
+ void (*process_page)(struct _stream_processor *, ogg_page *);
20
+ void (*process_end)(struct _stream_processor *);
21
+ int isillegal;
22
+ int constraint_violated;
23
+ int shownillegal;
24
+ int isnew;
25
+ long seqno;
26
+ int lostseq;
27
+
28
+ int start;
29
+ int end;
30
+
31
+ int num;
32
+ char *type;
33
+
34
+ ogg_uint32_t serial; /* must be 32 bit unsigned */
35
+ ogg_stream_state os;
36
+ void *data;
37
+ } stream_processor;
38
+
39
+ typedef struct {
40
+ stream_processor *streams;
41
+ int allocated;
42
+ int used;
43
+
44
+ int in_headers;
45
+ } stream_set;
46
+
47
+
48
+ void oi_info(char *format, ...);
49
+ void oi_warn(char *format, ...);
50
+ void oi_error(char *format, ...);
51
+ void check_xiph_comment(stream_processor *stream, int i, const char *comment, int comment_length);