codemirror-lang-liquidsoap 0.3.5 → 0.3.7

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 (427) hide show
  1. package/dist/cli.js +8 -8
  2. package/dist/index.js +7 -7
  3. package/package.json +1 -1
  4. package/src/liquidsoap.grammar +10 -4
  5. package/src/parser.js +6 -6
  6. package/tests/liquidsoap/.codespellignore +1 -0
  7. package/tests/liquidsoap/.github/ISSUE_TEMPLATE/bug_report.yml +16 -0
  8. package/tests/liquidsoap/.github/docker/alpine.dockerfile +20 -0
  9. package/tests/liquidsoap/.github/docker/debian.dockerfile +55 -0
  10. package/tests/liquidsoap/.github/opam/{liquidsoap-core-windows.opam → liquidsoap-windows.opam} +8 -5
  11. package/tests/liquidsoap/.github/renovate.json +23 -0
  12. package/tests/liquidsoap/.github/scripts/add-local-opam-packages.sh +5 -3
  13. package/tests/liquidsoap/.github/scripts/build-apk.sh +10 -19
  14. package/tests/liquidsoap/.github/scripts/build-deb.sh +6 -15
  15. package/tests/liquidsoap/.github/scripts/build-details.sh +15 -4
  16. package/tests/liquidsoap/.github/scripts/build-posix.sh +11 -20
  17. package/tests/liquidsoap/.github/scripts/build-website.sh +1 -1
  18. package/tests/liquidsoap/.github/scripts/build-win32.sh +6 -2
  19. package/tests/liquidsoap/.github/scripts/push-docker.sh +13 -15
  20. package/tests/liquidsoap/.github/workflows/ci.yml +291 -185
  21. package/tests/liquidsoap/.ocamlformat +1 -1
  22. package/tests/liquidsoap/.pre-commit-config.yaml +2 -2
  23. package/tests/liquidsoap/CHANGES.md +112 -3
  24. package/tests/liquidsoap/README.md +10 -9
  25. package/tests/liquidsoap/ROADMAP.md +14 -8
  26. package/tests/liquidsoap/bin/liquidsoap-macos-instruments +7 -0
  27. package/tests/liquidsoap/doc/content/build.md +0 -1
  28. package/tests/liquidsoap/doc/content/faq.md +2 -4
  29. package/tests/liquidsoap/doc/content/icy_metadata.md +2 -2
  30. package/tests/liquidsoap/doc/content/install.md +13 -2
  31. package/tests/liquidsoap/doc/content/json.md +1 -1
  32. package/tests/liquidsoap/doc/content/language.md +4 -4
  33. package/tests/liquidsoap/doc/content/liq/beets-protocol.liq +1 -1
  34. package/tests/liquidsoap/doc/content/liq/crossfade.liq +1 -1
  35. package/tests/liquidsoap/doc/content/liq/harbor-simple.liq +1 -1
  36. package/tests/liquidsoap/doc/content/liq/radiopi.liq +10 -9
  37. package/tests/liquidsoap/doc/content/liq/request.dynamic.liq +1 -1
  38. package/tests/liquidsoap/doc/content/migrating.md +25 -3
  39. package/tests/liquidsoap/doc/content/playlist_parsers.md +46 -1
  40. package/tests/liquidsoap/doc/content/script_loading.md +3 -0
  41. package/tests/liquidsoap/doc/content/xml.md +160 -0
  42. package/tests/liquidsoap/doc/dune.inc +129 -0
  43. package/tests/liquidsoap/dune-project +29 -49
  44. package/tests/liquidsoap/liquidsoap +1 -1
  45. package/tests/liquidsoap/{liquidsoap-js.opam → opam/liquidsoap-js.opam} +3 -2
  46. package/tests/liquidsoap/{liquidsoap-lang.opam → opam/liquidsoap-lang.opam} +4 -3
  47. package/tests/liquidsoap/{liquidsoap-mode.opam → opam/liquidsoap-mode.opam} +3 -2
  48. package/tests/liquidsoap/{liquidsoap-core.opam → opam/liquidsoap.opam} +46 -17
  49. package/tests/liquidsoap/{prometheus-liquidsoap.opam → opam/prometheus-liquidsoap.opam} +2 -1
  50. package/tests/liquidsoap/{sdl-liquidsoap.opam → opam/sdl-liquidsoap.opam} +2 -1
  51. package/tests/liquidsoap/{tls-liquidsoap.opam → opam/tls-liquidsoap.opam} +2 -1
  52. package/tests/liquidsoap/src/bin/dune +1 -1
  53. package/tests/liquidsoap/src/config/xmlplaylist_option.disabled.ml +2 -0
  54. package/tests/liquidsoap/src/core/builtins/builtins_ffmpeg_decoder.ml +22 -22
  55. package/tests/liquidsoap/src/core/builtins/builtins_ffmpeg_encoder.ml +4 -4
  56. package/tests/liquidsoap/src/core/builtins/builtins_ffmpeg_filters.ml +37 -41
  57. package/tests/liquidsoap/src/core/builtins/builtins_files.ml +3 -1
  58. package/tests/liquidsoap/src/core/builtins/builtins_optionals.ml +0 -1
  59. package/tests/liquidsoap/src/core/builtins/builtins_process.ml +15 -7
  60. package/tests/liquidsoap/src/core/builtins/builtins_resolvers.ml +16 -0
  61. package/tests/liquidsoap/src/core/builtins/builtins_socket.ml +7 -5
  62. package/tests/liquidsoap/src/core/builtins/builtins_source.ml +3 -3
  63. package/tests/liquidsoap/src/core/builtins/builtins_srt.ml +84 -8
  64. package/tests/liquidsoap/src/core/builtins/builtins_string_extra.ml +13 -0
  65. package/tests/liquidsoap/src/core/builtins/builtins_sys.ml +6 -6
  66. package/tests/liquidsoap/src/core/builtins/builtins_thread.ml +2 -2
  67. package/tests/liquidsoap/src/core/builtins/builtins_time.ml +5 -3
  68. package/tests/liquidsoap/src/core/builtins/builtins_tls.ml +1 -1
  69. package/tests/liquidsoap/src/core/clock.ml +105 -38
  70. package/tests/liquidsoap/src/core/clock.mli +1 -0
  71. package/tests/liquidsoap/src/core/clock_base.ml +2 -2
  72. package/tests/liquidsoap/src/core/conversions/stereo.ml +6 -8
  73. package/tests/liquidsoap/src/core/converters/audio_converter.mli +5 -5
  74. package/tests/liquidsoap/src/core/converters/video_converter.ml +2 -2
  75. package/tests/liquidsoap/src/core/converters/video_converter.mli +3 -3
  76. package/tests/liquidsoap/src/core/decoder/decoder.ml +14 -17
  77. package/tests/liquidsoap/src/core/decoder/decoder.mli +11 -11
  78. package/tests/liquidsoap/src/core/decoder/decoder_utils.ml +12 -13
  79. package/tests/liquidsoap/src/core/decoder/decoder_utils.mli +2 -3
  80. package/tests/liquidsoap/src/core/decoder/external_decoder.ml +9 -13
  81. package/tests/liquidsoap/src/core/decoder/ffmpeg_decoder.ml +57 -53
  82. package/tests/liquidsoap/src/core/decoder/ffmpeg_raw_decoder.ml +28 -9
  83. package/tests/liquidsoap/src/core/decoder/flac_metadata_plug.ml +15 -2
  84. package/tests/liquidsoap/src/core/decoder/image_decoder.ml +33 -19
  85. package/tests/liquidsoap/src/core/decoder/liq_flac_decoder.ml +22 -23
  86. package/tests/liquidsoap/src/core/decoder/liq_ogg_decoder.ml +5 -5
  87. package/tests/liquidsoap/src/core/decoder/mad_decoder.ml +2 -2
  88. package/tests/liquidsoap/src/core/decoder/midi_decoder.ml +1 -2
  89. package/tests/liquidsoap/src/core/decoder/ogg_flac_duration.ml +3 -11
  90. package/tests/liquidsoap/src/core/decoder/ogg_metadata_plug.ml +15 -2
  91. package/tests/liquidsoap/src/core/decoder/raw_audio_decoder.ml +8 -7
  92. package/tests/liquidsoap/src/core/decoder/wav_aiff_decoder.ml +3 -3
  93. package/tests/liquidsoap/src/core/dune +2 -15
  94. package/tests/liquidsoap/src/core/encoder/encoder.ml +18 -23
  95. package/tests/liquidsoap/src/core/encoder/encoder.mli +12 -17
  96. package/tests/liquidsoap/src/core/encoder/encoders/ffmpeg_encoder.ml +13 -27
  97. package/tests/liquidsoap/src/core/encoder/encoders/ffmpeg_encoder_common.ml +1 -1
  98. package/tests/liquidsoap/src/core/encoder/encoders/flac_encoder.ml +3 -4
  99. package/tests/liquidsoap/src/core/encoder/encoders/ndi_encoder.ml +2 -1
  100. package/tests/liquidsoap/src/core/encoder/encoders/ogg_encoder.ml +1 -2
  101. package/tests/liquidsoap/src/core/encoder/lang/lang_external_encoder.ml +2 -2
  102. package/tests/liquidsoap/src/core/encoder/lang/lang_fdkaac.ml +1 -1
  103. package/tests/liquidsoap/src/core/encoder/lang/lang_ffmpeg.ml +46 -39
  104. package/tests/liquidsoap/src/core/encoder/lang/lang_flac.ml +1 -1
  105. package/tests/liquidsoap/src/core/encoder/lang/lang_shine.ml +2 -2
  106. package/tests/liquidsoap/src/core/encoder/lang/lang_vorbis.ml +1 -1
  107. package/tests/liquidsoap/src/core/encoder/lang/lang_wav.ml +1 -1
  108. package/tests/liquidsoap/src/core/file_watcher.inotify.ml +8 -13
  109. package/tests/liquidsoap/src/core/harbor/harbor.ml +22 -24
  110. package/tests/liquidsoap/src/core/io/ffmpeg_filter_io.ml +4 -3
  111. package/tests/liquidsoap/src/core/io/oss_io.ml +3 -4
  112. package/tests/liquidsoap/src/core/io/portaudio_io.ml +1 -1
  113. package/tests/liquidsoap/src/core/io/pulseaudio_io.ml +3 -4
  114. package/tests/liquidsoap/src/core/io/srt_io.ml +316 -120
  115. package/tests/liquidsoap/src/core/io/udp_io.ml +14 -12
  116. package/tests/liquidsoap/src/core/lang.mli +10 -12
  117. package/tests/liquidsoap/src/core/lang_source.ml +25 -39
  118. package/tests/liquidsoap/src/core/lang_string.ml +30 -0
  119. package/tests/liquidsoap/src/core/lang_string.mli +3 -0
  120. package/tests/liquidsoap/src/core/ogg_formats/ogg_flac_encoder.ml +6 -6
  121. package/tests/liquidsoap/src/core/ogg_formats/ogg_muxer.ml +17 -27
  122. package/tests/liquidsoap/src/core/ogg_formats/ogg_muxer.mli +44 -53
  123. package/tests/liquidsoap/src/core/ogg_formats/opus_encoder.ml +1 -1
  124. package/tests/liquidsoap/src/core/ogg_formats/vorbis_encoder.ml +1 -2
  125. package/tests/liquidsoap/src/core/operators/add.ml +2 -2
  126. package/tests/liquidsoap/src/core/operators/cross.ml +2 -2
  127. package/tests/liquidsoap/src/core/operators/delay.ml +23 -6
  128. package/tests/liquidsoap/src/core/operators/dtmf.ml +3 -2
  129. package/tests/liquidsoap/src/core/operators/dyn_op.ml +2 -2
  130. package/tests/liquidsoap/src/core/operators/fir_filter.ml +2 -1
  131. package/tests/liquidsoap/src/core/operators/iir_filter.ml +1 -1
  132. package/tests/liquidsoap/src/core/operators/insert_metadata.ml +1 -1
  133. package/tests/liquidsoap/src/core/operators/lilv_op.ml +1 -1
  134. package/tests/liquidsoap/src/core/operators/lufs.ml +136 -89
  135. package/tests/liquidsoap/src/core/operators/lufs_c.c +105 -0
  136. package/tests/liquidsoap/src/core/operators/map_metadata.ml +33 -9
  137. package/tests/liquidsoap/src/core/operators/max_duration.ml +3 -4
  138. package/tests/liquidsoap/src/core/operators/muxer.ml +2 -1
  139. package/tests/liquidsoap/src/core/operators/noblank.ml +6 -6
  140. package/tests/liquidsoap/src/core/operators/sequence.ml +5 -5
  141. package/tests/liquidsoap/src/core/operators/switch.ml +10 -11
  142. package/tests/liquidsoap/src/core/operators/time_warp.ml +14 -11
  143. package/tests/liquidsoap/src/core/operators/video_fade.ml +2 -3
  144. package/tests/liquidsoap/src/core/outputs/ao_out.ml +1 -1
  145. package/tests/liquidsoap/src/core/outputs/bjack_out.ml +1 -1
  146. package/tests/liquidsoap/src/core/outputs/graphics_out.ml +6 -2
  147. package/tests/liquidsoap/src/core/outputs/harbor_output.ml +12 -10
  148. package/tests/liquidsoap/src/core/outputs/hls_output.ml +19 -14
  149. package/tests/liquidsoap/src/core/outputs/icecast2.ml +85 -52
  150. package/tests/liquidsoap/src/core/outputs/ndi_out.ml +1 -1
  151. package/tests/liquidsoap/src/core/outputs/output.ml +8 -9
  152. package/tests/liquidsoap/src/core/outputs/output.mli +61 -61
  153. package/tests/liquidsoap/src/core/outputs/pipe_output.ml +8 -6
  154. package/tests/liquidsoap/src/core/outputs/sdl_out.ml +5 -2
  155. package/tests/liquidsoap/src/core/playlist_parser.ml +6 -7
  156. package/tests/liquidsoap/src/core/playlists/playlist_basic.ml +0 -180
  157. package/tests/liquidsoap/src/core/protocols/annotate.ml +3 -3
  158. package/tests/liquidsoap/src/core/request.ml +16 -17
  159. package/tests/liquidsoap/src/core/request.mli +27 -28
  160. package/tests/liquidsoap/src/core/shebang.ml +3 -2
  161. package/tests/liquidsoap/src/core/source.ml +104 -63
  162. package/tests/liquidsoap/src/core/source.mli +249 -247
  163. package/tests/liquidsoap/src/core/sources/generated.ml +2 -2
  164. package/tests/liquidsoap/src/core/sources/request_dynamic.ml +2 -2
  165. package/tests/liquidsoap/src/core/sources/synthesized.ml +2 -2
  166. package/tests/liquidsoap/src/core/stream/aFrame.mli +7 -9
  167. package/tests/liquidsoap/src/core/stream/content.mli +4 -13
  168. package/tests/liquidsoap/src/core/stream/content_base.ml +2 -19
  169. package/tests/liquidsoap/src/core/stream/content_video.ml +9 -10
  170. package/tests/liquidsoap/src/core/stream/ffmpeg_copy_content.ml +19 -15
  171. package/tests/liquidsoap/src/core/stream/ffmpeg_raw_content.ml +26 -9
  172. package/tests/liquidsoap/src/core/stream/frame.ml +4 -4
  173. package/tests/liquidsoap/src/core/stream/frame.mli +13 -15
  174. package/tests/liquidsoap/src/core/stream/frame_base.ml +1 -2
  175. package/tests/liquidsoap/src/core/stream/frame_settings.ml +14 -14
  176. package/tests/liquidsoap/src/core/stream/generator.mli +14 -17
  177. package/tests/liquidsoap/src/core/stream/mFrame.mli +2 -2
  178. package/tests/liquidsoap/src/core/tools/charset.ml +28 -18
  179. package/tests/liquidsoap/src/core/tools/charset_base.ml +5 -0
  180. package/tests/liquidsoap/src/core/tools/child_support.ml +2 -2
  181. package/tests/liquidsoap/src/core/tools/ffmpeg_avfilter_utils.ml +139 -0
  182. package/tests/liquidsoap/src/core/tools/ffmpeg_avfilter_utils.mli +22 -0
  183. package/tests/liquidsoap/src/core/tools/ffmpeg_utils.ml +2 -1
  184. package/tests/liquidsoap/src/core/tools/lifecycle.mli +4 -4
  185. package/tests/liquidsoap/src/core/tools/liq_http.ml +44 -19
  186. package/tests/liquidsoap/src/core/tools/liq_http.mli +1 -1
  187. package/tests/liquidsoap/src/core/tools/log.ml +3 -8
  188. package/tests/liquidsoap/src/core/tools/log.mli +1 -1
  189. package/tests/liquidsoap/src/core/tools/mutex_utils.ml +1 -1
  190. package/tests/liquidsoap/src/core/tools/pool.ml +2 -2
  191. package/tests/liquidsoap/src/core/tools/process_handler.mli +30 -27
  192. package/tests/liquidsoap/src/core/tools/producer_consumer.ml +10 -9
  193. package/tests/liquidsoap/src/{lang → core/tools}/queues.ml +58 -64
  194. package/tests/liquidsoap/src/{lang → core/tools}/queues.mli +10 -0
  195. package/tests/liquidsoap/src/core/tools/sdl_utils.ml +2 -0
  196. package/tests/liquidsoap/src/core/tools/server.mli +8 -8
  197. package/tests/liquidsoap/src/core/tools/sha1.ml +2 -1
  198. package/tests/liquidsoap/src/core/tools/start_stop.ml +2 -1
  199. package/tests/liquidsoap/src/core/tools/strings.mli +5 -4
  200. package/tests/liquidsoap/src/core/tools/tutils.ml +7 -7
  201. package/tests/liquidsoap/src/core/tools/tutils.mli +14 -18
  202. package/tests/liquidsoap/src/core/tools/unix_c.c +16 -5
  203. package/tests/liquidsoap/src/core/tools/utils.ml +83 -25
  204. package/tests/liquidsoap/src/core/tools/wav_aiff.ml +3 -3
  205. package/tests/liquidsoap/src/core/tools/wav_aiff.mli +7 -7
  206. package/tests/liquidsoap/src/core/types/format_type.ml +6 -6
  207. package/tests/liquidsoap/src/js/index.html +1 -154
  208. package/tests/liquidsoap/src/js/interactive_js.ml +7 -3
  209. package/tests/liquidsoap/src/js/stdlib_js.liq +6 -0
  210. package/tests/liquidsoap/src/lang/builtins_lang.ml +8 -0
  211. package/tests/liquidsoap/src/lang/builtins_null.ml +1 -1
  212. package/tests/liquidsoap/src/lang/builtins_string.ml +2 -11
  213. package/tests/liquidsoap/src/lang/builtins_xml.ml +204 -0
  214. package/tests/liquidsoap/src/lang/cache.ml +7 -2
  215. package/tests/liquidsoap/src/lang/dune +5 -2
  216. package/tests/liquidsoap/src/lang/flags.ml +2 -2
  217. package/tests/liquidsoap/src/lang/lang.mli +10 -12
  218. package/tests/liquidsoap/src/lang/lang_core.ml +24 -24
  219. package/tests/liquidsoap/src/lang/lang_eval.ml +1 -1
  220. package/tests/liquidsoap/src/lang/lang_string.ml +7 -13
  221. package/tests/liquidsoap/src/lang/lang_string.mli +0 -1
  222. package/tests/liquidsoap/src/lang/lexer.ml +3 -0
  223. package/tests/liquidsoap/src/lang/parser.mly +7 -4
  224. package/tests/liquidsoap/src/lang/parser_helper.ml +9 -77
  225. package/tests/liquidsoap/src/lang/parser_helper.mli +1 -1
  226. package/tests/liquidsoap/src/lang/pos.ml +4 -4
  227. package/tests/liquidsoap/src/lang/pos.mli +55 -0
  228. package/tests/liquidsoap/src/lang/preprocessor.ml +12 -5
  229. package/tests/liquidsoap/src/lang/repr.ml +6 -6
  230. package/tests/liquidsoap/src/lang/runtime.ml +55 -48
  231. package/tests/liquidsoap/src/lang/runtime.mli +8 -3
  232. package/tests/liquidsoap/src/lang/term/parsed_term.ml +33 -33
  233. package/tests/liquidsoap/src/lang/term/term_base.ml +14 -10
  234. package/tests/liquidsoap/src/lang/term/term_preprocessor.ml +28 -1
  235. package/tests/liquidsoap/src/lang/term/term_reducer.ml +244 -132
  236. package/tests/liquidsoap/src/lang/term/term_reducer.mli +10 -2
  237. package/tests/liquidsoap/src/lang/term/term_stdlib.ml +14 -13
  238. package/tests/liquidsoap/src/lang/term.mli +3 -1
  239. package/tests/liquidsoap/src/lang/typechecking.ml +16 -16
  240. package/tests/liquidsoap/src/lang/typechecking.mli +5 -1
  241. package/tests/liquidsoap/src/lang/types/type_base.ml +16 -17
  242. package/tests/liquidsoap/src/lang/typing.ml +13 -12
  243. package/tests/liquidsoap/src/lang/typing.mli +2 -1
  244. package/tests/liquidsoap/src/lang/value.ml +20 -14
  245. package/tests/liquidsoap/src/libs/audio.liq +53 -18
  246. package/tests/liquidsoap/src/libs/autocue.liq +8 -8
  247. package/tests/liquidsoap/src/libs/clock.liq +3 -3
  248. package/tests/liquidsoap/src/libs/dune +2 -2
  249. package/tests/liquidsoap/src/libs/extra/audio.liq +4 -4
  250. package/tests/liquidsoap/src/libs/extra/audioscrobbler.liq +487 -0
  251. package/tests/liquidsoap/src/libs/extra/deprecations.liq +11 -11
  252. package/tests/liquidsoap/src/libs/extra/externals.liq +9 -9
  253. package/tests/liquidsoap/src/libs/extra/fades.liq +2 -2
  254. package/tests/liquidsoap/src/libs/extra/file.liq +1 -1
  255. package/tests/liquidsoap/src/libs/extra/http.liq +4 -4
  256. package/tests/liquidsoap/src/libs/extra/interactive.liq +1 -1
  257. package/tests/liquidsoap/src/libs/extra/metadata.liq +3 -3
  258. package/tests/liquidsoap/src/libs/extra/native.liq +6 -6
  259. package/tests/liquidsoap/src/libs/extra/server.liq +2 -2
  260. package/tests/liquidsoap/src/libs/extra/source.liq +10 -10
  261. package/tests/liquidsoap/src/libs/extra/spinitron.liq +11 -11
  262. package/tests/liquidsoap/src/libs/extra/telnet.liq +51 -0
  263. package/tests/liquidsoap/src/libs/extra/video.liq +2 -2
  264. package/tests/liquidsoap/src/libs/fades.liq +70 -57
  265. package/tests/liquidsoap/src/libs/ffmpeg.liq +50 -33
  266. package/tests/liquidsoap/src/libs/file.liq +8 -8
  267. package/tests/liquidsoap/src/libs/hls.liq +5 -5
  268. package/tests/liquidsoap/src/libs/http.liq +64 -37
  269. package/tests/liquidsoap/src/libs/icecast.liq +1 -1
  270. package/tests/liquidsoap/src/libs/io.liq +6 -6
  271. package/tests/liquidsoap/src/libs/medialib.liq +46 -45
  272. package/tests/liquidsoap/src/libs/metadata.liq +4 -4
  273. package/tests/liquidsoap/src/libs/null.liq +3 -3
  274. package/tests/liquidsoap/src/libs/playlist.liq +547 -22
  275. package/tests/liquidsoap/src/libs/protocols.liq +14 -14
  276. package/tests/liquidsoap/src/libs/replaygain.liq +11 -11
  277. package/tests/liquidsoap/src/libs/request.liq +27 -29
  278. package/tests/liquidsoap/src/libs/runtime.liq +2 -0
  279. package/tests/liquidsoap/src/libs/source.liq +15 -15
  280. package/tests/liquidsoap/src/libs/sqlite.liq +1 -1
  281. package/tests/liquidsoap/src/libs/stdlib.liq +1 -1
  282. package/tests/liquidsoap/src/libs/string.liq +6 -6
  283. package/tests/liquidsoap/src/libs/switches.liq +3 -3
  284. package/tests/liquidsoap/src/libs/thread.liq +3 -9
  285. package/tests/liquidsoap/src/libs/tracks.liq +23 -9
  286. package/tests/liquidsoap/src/libs/video.liq +32 -32
  287. package/tests/liquidsoap/src/modules/dtools/README.md +58 -0
  288. package/tests/liquidsoap/src/modules/dtools/dtools.ml +19 -0
  289. package/tests/liquidsoap/src/modules/dtools/dtools.mli +284 -0
  290. package/tests/liquidsoap/src/modules/dtools/dtools_impl.ml +860 -0
  291. package/tests/liquidsoap/src/modules/dtools/dtools_syslog.impl.ml +45 -0
  292. package/tests/liquidsoap/src/modules/dtools/dtools_syslog.noop.ml +1 -0
  293. package/tests/liquidsoap/src/modules/dtools/dune +12 -0
  294. package/tests/liquidsoap/src/modules/duppy/.merlin +4 -0
  295. package/tests/liquidsoap/src/modules/duppy/README.md +47 -0
  296. package/tests/liquidsoap/src/modules/duppy/dune +7 -0
  297. package/tests/liquidsoap/src/modules/duppy/duppy.ml +1097 -0
  298. package/tests/liquidsoap/src/modules/duppy/duppy.mli +494 -0
  299. package/tests/liquidsoap/src/modules/duppy/duppy_stubs.c +176 -0
  300. package/tests/liquidsoap/src/modules/duppy/examples/dune +9 -0
  301. package/tests/liquidsoap/src/modules/duppy/examples/http.ml +560 -0
  302. package/tests/liquidsoap/src/modules/duppy/examples/index.html +1 -0
  303. package/tests/liquidsoap/src/modules/duppy/examples/telnet.ml +150 -0
  304. package/tests/liquidsoap/src/modules/xmlplaylist/dune +5 -0
  305. package/tests/liquidsoap/src/modules/xmlplaylist/xmlplaylist.ml +185 -0
  306. package/tests/liquidsoap/src/modules/xmlplaylist/xmlplaylist.mli +56 -0
  307. package/tests/liquidsoap/src/ndi/ndi.mli +2 -3
  308. package/tests/liquidsoap/src/runtime/build_config.ml +0 -1
  309. package/tests/liquidsoap/src/runtime/main.ml +4 -23
  310. package/tests/liquidsoap/src/stereotool/stereotool.mli +3 -3
  311. package/tests/liquidsoap/src/tooling/parsed_json.ml +6 -4
  312. package/tests/liquidsoap/tests/core/content_test.ml +2 -39
  313. package/tests/liquidsoap/tests/core/dune +13 -0
  314. package/tests/liquidsoap/tests/core/dune.inc +1 -1
  315. package/tests/liquidsoap/tests/core/gen_dune.ml +4 -1
  316. package/tests/liquidsoap/tests/core/json_test.ml +10 -0
  317. package/tests/liquidsoap/tests/core/more_types.ml +32 -28
  318. package/tests/liquidsoap/tests/core/output_encoded_test.ml +2 -0
  319. package/tests/liquidsoap/tests/core/string_test.ml +4 -0
  320. package/tests/liquidsoap/tests/core/types.ml +1 -1
  321. package/tests/liquidsoap/tests/harbor/http.liq +1 -1
  322. package/tests/liquidsoap/tests/harbor/http2.liq +1 -1
  323. package/tests/liquidsoap/tests/language/cue_test.liq +3993 -0
  324. package/tests/liquidsoap/tests/language/dune.inc +24 -0
  325. package/tests/liquidsoap/tests/language/error.liq +1 -1
  326. package/tests/liquidsoap/tests/language/json.liq +11 -11
  327. package/tests/liquidsoap/tests/language/list.liq +1 -1
  328. package/tests/liquidsoap/tests/language/metadata.liq +1 -1
  329. package/tests/liquidsoap/tests/language/null.liq +9 -9
  330. package/tests/liquidsoap/tests/language/record.liq +23 -23
  331. package/tests/liquidsoap/tests/language/replaygain.liq +8 -8
  332. package/tests/liquidsoap/tests/language/sqlite.liq +1 -1
  333. package/tests/liquidsoap/tests/language/string.liq +1 -1
  334. package/tests/liquidsoap/tests/language/type_errors.liq +2 -2
  335. package/tests/liquidsoap/tests/language/typing.liq +2 -2
  336. package/tests/liquidsoap/tests/language/various.liq +1 -0
  337. package/tests/liquidsoap/tests/language/xml_test.liq +132 -0
  338. package/tests/liquidsoap/tests/media/dune +74 -0
  339. package/tests/liquidsoap/tests/media/dune.inc +63 -0
  340. package/tests/liquidsoap/tests/media/ffmpeg_add_text.liq +42 -56
  341. package/tests/liquidsoap/tests/media/ffmpeg_copy_concat.liq +5 -2
  342. package/tests/liquidsoap/tests/media/ffmpeg_distributed_hls.liq +2 -4
  343. package/tests/liquidsoap/tests/media/ffmpeg_filter_changing_rate.liq +1 -1
  344. package/tests/liquidsoap/tests/media/ffmpeg_inline_encode_decode_audio.liq +1 -5
  345. package/tests/liquidsoap/tests/media/ffmpeg_inline_encode_decode_video.liq +1 -3
  346. package/tests/liquidsoap/tests/media/ffmpeg_raw_and_encode_decoder.liq +1 -3
  347. package/tests/liquidsoap/tests/media/ffmpeg_raw_hls.liq +2 -4
  348. package/tests/liquidsoap/tests/media/ffmpeg_raw_implicit_conversion.liq +63 -0
  349. package/tests/liquidsoap/tests/media/gen_dune.ml +1 -0
  350. package/tests/liquidsoap/tests/media/image_decoder_duration.liq +15 -0
  351. package/tests/liquidsoap/tests/media/lufs_integrated.liq +17 -0
  352. package/tests/liquidsoap/tests/regression/AC5109.liq +2 -2
  353. package/tests/liquidsoap/tests/regression/GH1129.liq +3 -3
  354. package/tests/liquidsoap/tests/regression/GH1279.liq +2 -2
  355. package/tests/liquidsoap/tests/regression/GH1327.liq +3 -3
  356. package/tests/liquidsoap/tests/regression/GH2585.liq +0 -2
  357. package/tests/liquidsoap/tests/regression/GH2756-2.liq +3 -3
  358. package/tests/liquidsoap/tests/regression/GH2756.liq +2 -2
  359. package/tests/liquidsoap/tests/regression/GH3134.liq +2 -2
  360. package/tests/liquidsoap/tests/regression/GH3303.liq +2 -2
  361. package/tests/liquidsoap/tests/regression/GH4163.liq +14 -3
  362. package/tests/liquidsoap/tests/regression/GH4281-2.liq +29 -0
  363. package/tests/liquidsoap/tests/regression/GH4281.liq +29 -0
  364. package/tests/liquidsoap/tests/regression/GH4395.liq +27 -0
  365. package/tests/liquidsoap/tests/regression/LS354-1.liq +1 -1
  366. package/tests/liquidsoap/tests/regression/LS354-2.liq +1 -1
  367. package/tests/liquidsoap/tests/regression/append-merge.liq +3 -1
  368. package/tests/liquidsoap/tests/regression/dune.inc +64 -0
  369. package/tests/liquidsoap/tests/regression/fallible_ogg.liq +9 -0
  370. package/tests/liquidsoap/tests/regression/init-error.liq +2 -0
  371. package/tests/liquidsoap/tests/regression/seek_track_map.liq +1 -1
  372. package/tests/liquidsoap/tests/regression/source_dynamic.liq +2 -2
  373. package/tests/liquidsoap/tests/run_test.ml +53 -60
  374. package/tests/liquidsoap/tests/streams/cross-override-end.liq +9 -2
  375. package/tests/liquidsoap/tests/streams/cross-override-start.liq +9 -2
  376. package/tests/liquidsoap/tests/streams/cross-override.liq +9 -2
  377. package/tests/liquidsoap/tests/streams/cross-persist-end-override.liq +9 -2
  378. package/tests/liquidsoap/tests/streams/cross-persist-override.liq +9 -2
  379. package/tests/liquidsoap/tests/streams/cross-persist-start-override.liq +9 -2
  380. package/tests/liquidsoap/tests/streams/cross.liq +8 -2
  381. package/tests/liquidsoap/tests/streams/crossfade-plot.liq +11 -8
  382. package/tests/liquidsoap/tests/streams/crossfade-plot.new.txt +148 -248
  383. package/tests/liquidsoap/tests/streams/crossfade-plot.old.txt +50 -150
  384. package/tests/liquidsoap/tests/streams/crossfade.liq +8 -2
  385. package/tests/liquidsoap/tests/streams/ctype2.liq +1 -1
  386. package/tests/liquidsoap/tests/streams/dune.inc +31 -0
  387. package/tests/liquidsoap/tests/streams/fades-overrides.liq +9 -2
  388. package/tests/liquidsoap/tests/streams/fades-persistent-override.liq +9 -2
  389. package/tests/liquidsoap/tests/streams/harbor_metadata_3.liq +1 -1
  390. package/tests/liquidsoap/tests/streams/hls_id3v2.liq +11 -7
  391. package/tests/liquidsoap/tests/streams/icecast_last_meta.liq +47 -0
  392. package/tests/liquidsoap/tests/streams/icecast_ssl.liq +3 -0
  393. package/tests/liquidsoap/tests/streams/icecast_ssl_tls.liq +3 -3
  394. package/tests/liquidsoap/tests/streams/icecast_tls.liq +1 -0
  395. package/tests/liquidsoap/tests/streams/icecast_tls_ssl.liq +5 -0
  396. package/tests/liquidsoap/tests/streams/no-cue-cut.liq +2 -2
  397. package/tests/liquidsoap/tests/streams/random.liq +2 -2
  398. package/tests/liquidsoap/tests/streams/replaygain.liq +10 -10
  399. package/tests/liquidsoap/tests/streams/rotate.liq +6 -1
  400. package/tests/liquidsoap/tests/streams/say.liq +2 -2
  401. package/tests/liquidsoap/tests/streams/srt_listen_callback.liq +1 -0
  402. package/tests/liquidsoap/tests/streams/srt_multiple_outputs.liq +1 -0
  403. package/tests/liquidsoap/tests/streams/srt_passphrase.liq +1 -0
  404. package/tests/liquidsoap/tests/streams/srt_raw_pcm.liq +1 -0
  405. package/tests/liquidsoap/tests/test.liq +4 -5
  406. package/tests/liquidsoap/.github/docker/Dockerfile.production +0 -37
  407. package/tests/liquidsoap/.github/docker/Dockerfile.production-alpine +0 -18
  408. package/tests/liquidsoap/.github/opam/packages/metadata/metadata.0.3.0/opam +0 -33
  409. package/tests/liquidsoap/.github/scripts/build-docker-alpine.sh +0 -31
  410. package/tests/liquidsoap/.github/scripts/build-docker.sh +0 -35
  411. package/tests/liquidsoap/liquidsoap-libs-extra.opam +0 -32
  412. package/tests/liquidsoap/liquidsoap-libs.opam +0 -31
  413. package/tests/liquidsoap/liquidsoap.opam +0 -63
  414. package/tests/liquidsoap/src/core/builtins/builtins_lastfm.ml +0 -110
  415. package/tests/liquidsoap/src/core/tools/liqfm.ml +0 -244
  416. package/tests/liquidsoap/src/libs/extra/lastfm.liq +0 -185
  417. /package/tests/liquidsoap/.github/docker/{Dockerfile.website → website.dockerfile} +0 -0
  418. /package/tests/liquidsoap/.github/opam/packages/ffmpeg-av-windows/{ffmpeg-av-windows.1.2.0 → ffmpeg-av-windows.1.2.5}/opam +0 -0
  419. /package/tests/liquidsoap/.github/opam/packages/ffmpeg-avcodec-windows/{ffmpeg-avcodec-windows.1.2.0 → ffmpeg-avcodec-windows.1.2.5}/opam +0 -0
  420. /package/tests/liquidsoap/.github/opam/packages/ffmpeg-avdevice-windows/{ffmpeg-avdevice-windows.1.2.0 → ffmpeg-avdevice-windows.1.2.5}/opam +0 -0
  421. /package/tests/liquidsoap/.github/opam/packages/ffmpeg-avfilter-windows/{ffmpeg-avfilter-windows.1.2.0 → ffmpeg-avfilter-windows.1.2.5}/opam +0 -0
  422. /package/tests/liquidsoap/.github/opam/packages/ffmpeg-avutil-windows/{ffmpeg-avutil-windows.1.2.0 → ffmpeg-avutil-windows.1.2.5}/opam +0 -0
  423. /package/tests/liquidsoap/.github/opam/packages/ffmpeg-swresample-windows/{ffmpeg-swresample-windows.1.2.0 → ffmpeg-swresample-windows.1.2.5}/opam +0 -0
  424. /package/tests/liquidsoap/.github/opam/packages/ffmpeg-swscale-windows/{ffmpeg-swscale-windows.1.2.0 → ffmpeg-swscale-windows.1.2.5}/opam +0 -0
  425. /package/tests/liquidsoap/.github/opam/packages/ffmpeg-windows/{ffmpeg-windows.1.2.0 → ffmpeg-windows.1.2.5}/opam +0 -0
  426. /package/tests/liquidsoap/{liquidsoap-mode.opam.template → opam/liquidsoap-mode.opam.template} +0 -0
  427. /package/tests/liquidsoap/{liquidsoap.opam.template → opam/liquidsoap.opam.template} +0 -0
@@ -148,3 +148,142 @@ module Fps = struct
148
148
  input `Flush;
149
149
  try flush cb output with Avutil.Error `Eof -> ())
150
150
  end
151
+
152
+ module AFormat = struct
153
+ type filter = {
154
+ input : [ `Audio ] Avfilter.input;
155
+ output : [ `Audio ] Avfilter.output;
156
+ time_base : Avutil.rational;
157
+ }
158
+
159
+ type t = [ `Filter of filter | `Pass_through of Avutil.rational ]
160
+
161
+ type config = {
162
+ sample_format : Avutil.Sample_format.t;
163
+ channel_layout : Avutil.Channel_layout.t;
164
+ sample_rate : int;
165
+ }
166
+
167
+ let channel_layout_arg channel_layout =
168
+ match Avutil.Channel_layout.get_mask channel_layout with
169
+ | Some id -> `Int64 id
170
+ | None ->
171
+ let channel_layout =
172
+ Avutil.Channel_layout.get_default
173
+ (Avutil.Channel_layout.get_nb_channels channel_layout)
174
+ in
175
+ `Int64 (Option.get (Avutil.Channel_layout.get_mask channel_layout))
176
+
177
+ let time_base = function
178
+ | `Filter { time_base } -> time_base
179
+ | `Pass_through time_base -> time_base
180
+
181
+ let init ~src ~dst ~src_time_base () =
182
+ let config = Avfilter.init () in
183
+ let _abuffer =
184
+ let args =
185
+ [
186
+ `Pair
187
+ ( "sample_fmt",
188
+ `String
189
+ (Option.get (Avutil.Sample_format.get_name src.sample_format))
190
+ );
191
+ `Pair ("channel_layout", channel_layout_arg src.channel_layout);
192
+ `Pair ("sample_rate", `Int src.sample_rate);
193
+ `Pair ("time_base", `Rational src_time_base);
194
+ ]
195
+ in
196
+ Avfilter.attach ~name:"abuffer" ~args Avfilter.abuffer config
197
+ in
198
+ let aformat =
199
+ match
200
+ List.find_opt
201
+ (fun { Avfilter.name } -> name = "aformat")
202
+ Avfilter.filters
203
+ with
204
+ | Some aformat -> aformat
205
+ | None -> failwith "Could not find aformat ffmpeg filter!"
206
+ in
207
+ let aformat =
208
+ let args =
209
+ [
210
+ `Pair
211
+ ( "sample_fmts",
212
+ `String
213
+ (Option.get (Avutil.Sample_format.get_name dst.sample_format))
214
+ );
215
+ `Pair ("channel_layouts", channel_layout_arg dst.channel_layout);
216
+ `Pair ("sample_rates", `Int dst.sample_rate);
217
+ ]
218
+ in
219
+ Avfilter.attach ~name:"aformat" ~args aformat config
220
+ in
221
+ let _abuffersink =
222
+ Avfilter.attach ~name:"abuffersink" Avfilter.abuffersink config
223
+ in
224
+ Avfilter.link
225
+ (List.hd Avfilter.(_abuffer.io.outputs.audio))
226
+ (List.hd Avfilter.(aformat.io.inputs.audio));
227
+ Avfilter.link
228
+ (List.hd Avfilter.(aformat.io.outputs.audio))
229
+ (List.hd Avfilter.(_abuffersink.io.inputs.audio));
230
+ let graph = Avfilter.launch config in
231
+ let _, input = List.hd Avfilter.(graph.inputs.audio) in
232
+ let _, output = List.hd Avfilter.(graph.outputs.audio) in
233
+ let time_base = Avfilter.(time_base output.context) in
234
+ { input; output; time_base }
235
+
236
+ let init ?dst_sample_format ?dst_channel_layout ?dst_sample_rate
237
+ ~src_sample_format ~src_channel_layout ~src_sample_rate ~src_time_base ()
238
+ =
239
+ let dst_sample_format =
240
+ Option.value ~default:src_sample_format dst_sample_format
241
+ in
242
+ let dst_channel_layout =
243
+ Option.value ~default:src_channel_layout dst_channel_layout
244
+ in
245
+ let dst_sample_rate =
246
+ Option.value ~default:src_sample_rate dst_sample_rate
247
+ in
248
+ if
249
+ src_sample_format == dst_sample_format
250
+ && Avutil.Channel_layout.compare src_channel_layout dst_channel_layout
251
+ && src_sample_rate == dst_sample_rate
252
+ then `Pass_through src_time_base
253
+ else (
254
+ let src =
255
+ {
256
+ sample_format = src_sample_format;
257
+ channel_layout = src_channel_layout;
258
+ sample_rate = src_sample_rate;
259
+ }
260
+ in
261
+ let dst =
262
+ {
263
+ sample_format = dst_sample_format;
264
+ channel_layout = dst_channel_layout;
265
+ sample_rate = dst_sample_rate;
266
+ }
267
+ in
268
+ `Filter (init ~src ~dst ~src_time_base ()))
269
+
270
+ let rec flush cb output =
271
+ try
272
+ cb (output.Avfilter.handler ());
273
+ flush cb output
274
+ with Avutil.Error `Eagain -> ()
275
+
276
+ let convert converter frame cb =
277
+ match converter with
278
+ | `Pass_through _ -> cb frame
279
+ | `Filter { input; output } ->
280
+ input (`Frame frame);
281
+ flush cb output
282
+
283
+ let eof converter cb =
284
+ match converter with
285
+ | `Pass_through _ -> ()
286
+ | `Filter { input; output } -> (
287
+ input `Flush;
288
+ try flush cb output with Avutil.Error `Eof -> ())
289
+ end
@@ -42,3 +42,25 @@ module Fps : sig
42
42
 
43
43
  val eof : t -> ([ `Video ] Avutil.frame -> unit) -> unit
44
44
  end
45
+
46
+ module AFormat : sig
47
+ type t
48
+
49
+ val time_base : t -> Avutil.rational
50
+
51
+ val init :
52
+ ?dst_sample_format:Avutil.Sample_format.t ->
53
+ ?dst_channel_layout:Avutil.Channel_layout.t ->
54
+ ?dst_sample_rate:int ->
55
+ src_sample_format:Avutil.Sample_format.t ->
56
+ src_channel_layout:Avutil.Channel_layout.t ->
57
+ src_sample_rate:int ->
58
+ src_time_base:Avutil.rational ->
59
+ unit ->
60
+ t
61
+
62
+ val convert :
63
+ t -> [ `Audio ] Avutil.frame -> ([ `Audio ] Avutil.frame -> unit) -> unit
64
+
65
+ val eof : t -> ([ `Audio ] Avutil.frame -> unit) -> unit
66
+ end
@@ -175,7 +175,8 @@ let mk_hardware_context ~hwaccel ~hwaccel_pixel_format ~hwaccel_device ~opts
175
175
  log#important
176
176
  "Codec %s has internal hardware capabilities that should work \
177
177
  without specific settings but hwaccel_device %S\n\
178
- \ is selected." codec_name
178
+ \ is selected."
179
+ codec_name
179
180
  (Option.get hwaccel_device)
180
181
  | { Avcodec.methods; _ }
181
182
  when List.mem `Internal methods && hwaccel_pixel_format <> None ->
@@ -20,11 +20,11 @@
20
20
 
21
21
  *****************************************************************************)
22
22
 
23
- (** Module to expose and hook up actions that need to happen
24
- over the lifecycle of the application. *)
23
+ (** Module to expose and hook up actions that need to happen over the lifecycle
24
+ of the application. *)
25
25
 
26
- (** Initial load. Used for registering stuff that needs
27
- all OCaml modules to have been registered. *)
26
+ (** Initial load. Used for registering stuff that needs all OCaml modules to
27
+ have been registered. *)
28
28
  val on_load : name:string -> (unit -> unit) -> unit
29
29
 
30
30
  val load : unit -> unit
@@ -33,6 +33,7 @@ and transport =
33
33
  socket
34
34
  ; server : server >
35
35
 
36
+ let socket_log = Log.make ["socket"]
36
37
  let connect = Cry.unix_connect
37
38
 
38
39
  let rec accept ?timeout sock =
@@ -57,17 +58,40 @@ let rec accept ?timeout sock =
57
58
  | Unix.Unix_error (Unix.EWOULDBLOCK, _, _) when has_timeout ->
58
59
  check_timeout ()
59
60
 
60
- let rec unix_socket fd =
61
+ let rec unix_socket ~pos fd =
61
62
  let s = Cry.unix_socket fd in
62
- object
63
- method typ = s#typ
64
- method file_descr = fd
65
- method transport = unix_transport ()
66
- method wait_for = s#wait_for
67
- method write = s#write
68
- method read = s#read
69
- method close = s#close
70
- end
63
+ let closed = ref false in
64
+ let finalise () =
65
+ if not !closed then (
66
+ let pos =
67
+ match pos with
68
+ | [] -> "unknown"
69
+ | _ ->
70
+ String.concat ", " (List.map (fun pos -> Pos.to_string pos) pos)
71
+ in
72
+ socket_log#critical
73
+ "File descriptor closed during garbage collection, you must have a \
74
+ file descriptor leak in your application! File descriptor opened at \
75
+ position: %s"
76
+ pos;
77
+ try s#close with _ -> ())
78
+ in
79
+ let s =
80
+ object
81
+ method typ = s#typ
82
+ method file_descr = fd
83
+ method transport = unix_transport ()
84
+ method wait_for = s#wait_for
85
+ method write = s#write
86
+ method read = s#read
87
+
88
+ method close =
89
+ s#close;
90
+ closed := true
91
+ end
92
+ in
93
+ Gc.finalise_last finalise s;
94
+ s
71
95
 
72
96
  and unix_transport () =
73
97
  object (self)
@@ -77,7 +101,7 @@ and unix_transport () =
77
101
 
78
102
  method connect ?bind_address ?timeout ?prefer host port =
79
103
  let fd = Cry.unix_connect ?bind_address ?timeout ?prefer host port in
80
- unix_socket fd
104
+ unix_socket ~pos:[] fd
81
105
 
82
106
  method server =
83
107
  object
@@ -85,7 +109,7 @@ and unix_transport () =
85
109
 
86
110
  method accept ?timeout fd =
87
111
  let fd, addr = accept ?timeout fd in
88
- (unix_socket fd, addr)
112
+ (unix_socket ~pos:[] fd, addr)
89
113
  end
90
114
  end
91
115
 
@@ -114,8 +138,9 @@ let parse_url url =
114
138
  in
115
139
  let sub =
116
140
  try Re.Pcre.exec ~rex:basic_rex url
117
- with Not_found -> (* raise Invalid_url *)
118
- failwith "Invalid URL."
141
+ with Not_found ->
142
+ (* raise Invalid_url *)
143
+ failwith "Invalid URL."
119
144
  in
120
145
  let protocol = Re.Pcre.get_substring sub 1 in
121
146
  let host = Re.Pcre.get_substring sub 2 in
@@ -148,11 +173,11 @@ let read_crlf ?(log = fun _ -> ()) ?(max = 4096) ?(count = 2) ~timeout
148
173
  let stop = ref false in
149
174
  let c = Bytes.create 1 in
150
175
  (* We need to parse char by char because
151
- * we want to make sure we stop at the exact
152
- * end of [\r]?\n in order to pass a socket
153
- * which is placed at the exact char after it.
154
- * The maximal length is a security but it may
155
- * be lifted.. *)
176
+ we want to make sure we stop at the exact
177
+ end of [\r]?\n in order to pass a socket
178
+ which is placed at the exact char after it.
179
+ The maximal length is a security but it may
180
+ be lifted.. *)
156
181
  while !count_n < count && !n < max && not !stop do
157
182
  (* This is quite ridiculous but we have
158
183
  * no way to know how much data is available
@@ -53,7 +53,7 @@ val set_socket_default :
53
53
  (** Unix transport and socket. *)
54
54
  val unix_transport : transport
55
55
 
56
- val unix_socket : Unix.file_descr -> socket
56
+ val unix_socket : pos:Pos.t list -> Unix.file_descr -> socket
57
57
 
58
58
  (** User-agent for liquidsoap *)
59
59
  val user_agent : string
@@ -44,7 +44,7 @@ type t =
44
44
  ; important : 'a. ('a, unit, string, unit) format4 -> 'a
45
45
  ; info : 'a. ('a, unit, string, unit) format4 -> 'a
46
46
  ; debug : 'a. ('a, unit, string, unit) format4 -> 'a
47
- ; level : int option
47
+ ; level : int
48
48
  ; set_level : int -> unit >
49
49
 
50
50
  let make path : t =
@@ -92,13 +92,8 @@ let make path : t =
92
92
  method debug : 'a. ('a, unit, string, unit) format4 -> 'a =
93
93
  log#g ~colorize:(colorize [`cyan]) 5
94
94
 
95
- method level =
96
- try Some (Dtools.Conf.as_int (Dtools.Log.conf_level#ut#path log#path))#get
97
- with _ -> None
98
-
99
- (** Set the level, from 1 to 5. *)
100
- method set_level lvl =
101
- (Dtools.Conf.as_int (Dtools.Log.conf_level#ut#path log#path))#set lvl
95
+ method level = log#level
96
+ method set_level lvl = log#set_level lvl
102
97
  end
103
98
 
104
99
  let () =
@@ -6,7 +6,7 @@ type t =
6
6
  ; important : 'a. ('a, unit, string, unit) format4 -> 'a
7
7
  ; info : 'a. ('a, unit, string, unit) format4 -> 'a
8
8
  ; debug : 'a. ('a, unit, string, unit) format4 -> 'a
9
- ; level : int option
9
+ ; level : int
10
10
  ; set_level : int -> unit >
11
11
 
12
12
  val make : Dtools.Conf.path -> t
@@ -30,4 +30,4 @@ let mutexify m f x =
30
30
  | v ->
31
31
  Mutex.unlock m;
32
32
  v
33
- [@@inline always]
33
+ [@@inline always]
@@ -20,8 +20,8 @@
20
20
 
21
21
  *****************************************************************************)
22
22
 
23
- (** Manage an unbounded pool of objects identified by integers.
24
- * This is used for Requests. *)
23
+ (** Manage an unbounded pool of objects identified by integers. This is used for
24
+ Requests. *)
25
25
 
26
26
  module type T = sig
27
27
  (** Type of objects stored in the pool. *)
@@ -20,24 +20,27 @@
20
20
 
21
21
  *****************************************************************************)
22
22
 
23
- (** Asynchronous process handler. This module wraps around [Unix.open_process_full]
24
- * and [Unix.select] to manipulate external processes. Its API can be used in two
25
- * different ways:
26
- * - Provide callbacks for reading and writing to the process' standard outputs.
27
- * These callbacks are executed when [Unix.select] returns their respective
28
- * file descriptors as available for writing/reading. Thus, read and write
29
- * inside these callbacks should not be blocking although [Unix.select]
30
- * documentation stipulates that "large" writes may still be blocking.
31
- * - Use direct, blocking, read/write on the process' standard output.
32
- * in this case, reading and writing may be blocking, following the
33
- * usual [Unix.write] and [Unix.read] semantics.
34
- * The API abstracts the file descriptors and provides writing/reading
35
- * callbacks instead. Please note that there is no way to detect when the
36
- * process has exited unless reaching a zero-length read in its standard
37
- * output or error. Also, the default [on_stdout] and [on_stderr] callbacks
38
- * do not read from these. Therefore it is important to read all data coming
39
- * from at least one of these two outputs in order to make sure that the module
40
- * properly detects when the process has exited. *)
23
+ (** Asynchronous process handler. This module wraps around
24
+ [Unix.open_process_full] and [Unix.select] to manipulate external processes.
25
+
26
+ Its API can be used in two different ways:
27
+ - Provide callbacks for reading and writing to the process' standard
28
+ outputs. These callbacks are executed when [Unix.select] returns their
29
+ respective file descriptors as available for writing/reading. Thus, read
30
+ and write inside these callbacks should not be blocking although
31
+ [Unix.select] documentation stipulates that "large" writes may still be
32
+ blocking.
33
+ - Use direct, blocking, read/write on the process' standard output. in this
34
+ case, reading and writing may be blocking, following the usual
35
+ [Unix.write] and [Unix.read] semantics.
36
+
37
+ The API abstracts the file descriptors and provides writing/reading
38
+ callbacks instead. Please note that there is no way to detect when the
39
+ process has exited unless reaching a zero-length read in its standard output
40
+ or error. Also, the default [on_stdout] and [on_stderr] callbacks do not
41
+ read from these. Therefore it is important to read all data coming from at
42
+ least one of these two outputs in order to make sure that the module
43
+ properly detects when the process has exited. *)
41
44
 
42
45
  (** A process. *)
43
46
  type t
@@ -46,8 +49,8 @@ type t
46
49
  type continuation =
47
50
  [ `Continue
48
51
  | `Stop
49
- (** triggers an asynchronous process stop, closing the process' stdin
50
- and waiting for termination *)
52
+ (** triggers an asynchronous process stop, closing the process' stdin and
53
+ waiting for termination *)
51
54
  | `Kill (** kill the process immediately *)
52
55
  | `Delay of float (** wait for a given amount of seconds *)
53
56
  | `Reschedule of Tutils.priority
@@ -68,9 +71,9 @@ type status = [ `Exception of exn | `Status of Unix.process_status ]
68
71
  exception Finished
69
72
 
70
73
  (** Create a process handler. Decisions returned by the callbacks are applied
71
- synchronously, i.e. when returning [`Stop], the process' stdin is closed
72
- immediately after the callback has returned. The process is restarted when
73
- the function [on_stop] returns [true]. *)
74
+ synchronously, i.e. when returning [`Stop], the process' stdin is closed
75
+ immediately after the callback has returned. The process is restarted when
76
+ the function [on_stop] returns [true]. *)
74
77
  val run :
75
78
  ?priority:Tutils.priority ->
76
79
  ?env:string array ->
@@ -88,7 +91,7 @@ val run :
88
91
  val set_priority : t -> Tutils.priority -> unit
89
92
 
90
93
  (** Asynchronous stop. The process' stdin will be closed some time in the
91
- future. *)
94
+ future. *)
92
95
  val stop : t -> unit
93
96
 
94
97
  (** Asynchronous kill. The process will be killed some time in the future. *)
@@ -101,13 +104,13 @@ val stopped : t -> bool
101
104
  val really_write : ?offset:int -> ?length:int -> bytes -> push -> unit
102
105
 
103
106
  (** Synchronous (blocking) write on the process' stdin. Raises [Finished] if the
104
- process has been stopped/killed. *)
107
+ process has been stopped/killed. *)
105
108
  val on_stdin : t -> (push -> 'a) -> 'a
106
109
 
107
110
  (** Synchronous (blocking) read on the process' stdout. Raises [Finished] if the
108
- process has been stopped/killed. *)
111
+ process has been stopped/killed. *)
109
112
  val on_stdout : t -> (pull -> 'a) -> 'a
110
113
 
111
114
  (** Synchronous (blocking) read on the process' stdout. Raises [Finished] if the
112
- process has been stopped/killed. *)
115
+ process has been stopped/killed. *)
113
116
  val on_stderr : t -> (pull -> 'a) -> 'a
@@ -24,12 +24,12 @@ type write_payload = [ `Frame of Frame.t | `Flush ]
24
24
  type write_frame = write_payload -> unit
25
25
 
26
26
  (* This here is tricky:
27
- * - We want to use the output API to have a method for
28
- * generating data when calling a clock tick.
29
- * - We want to opt-out of the generic child_process
30
- * clock animation framework.
31
- * Thus, we manually mark this operator as ready only
32
- * before we're about to pull from it. *)
27
+ - We want to use the output API to have a method for
28
+ generating data when calling a clock tick.
29
+ - We want to opt-out of the generic child_process
30
+ clock animation framework.
31
+ Thus, we manually mark this operator as ready only
32
+ before we're about to pull from it. *)
33
33
  class consumer ?(always_enabled = false) ~write_frame ~name ~source () =
34
34
  let s = Lang.to_source source in
35
35
  let infallible = not s#fallible in
@@ -44,6 +44,7 @@ class consumer ?(always_enabled = false) ~write_frame ~name ~source () =
44
44
  val mutable producer_buffer = Generator.create Frame.Fields.empty
45
45
  method set_producer_buffer b = producer_buffer <- b
46
46
  method set_output_enabled v = output_enabled <- v
47
+ method self_sync = s#self_sync
47
48
  method! reset = ()
48
49
  method start = ()
49
50
  method stop = write_frame producer_buffer `Flush
@@ -51,9 +52,9 @@ class consumer ?(always_enabled = false) ~write_frame ~name ~source () =
51
52
  method private send_frame frame = write_frame producer_buffer (`Frame frame)
52
53
  end
53
54
 
54
- (** The source which produces data by reading the buffer.
55
- We do NOT want to use [operator] here b/c the [consumers]
56
- may have different content-kind when this is used in the muxers. *)
55
+ (** The source which produces data by reading the buffer. We do NOT want to use
56
+ [operator] here b/c the [consumers] may have different content-kind when
57
+ this is used in the muxers. *)
57
58
  class producer ?stack ~check_self_sync ~consumers ~name () =
58
59
  let infallible = List.for_all (fun s -> not s#fallible) consumers in
59
60
  let self_sync = Clock_base.self_sync consumers in
@@ -21,59 +21,56 @@
21
21
  *****************************************************************************)
22
22
 
23
23
  module Queue = struct
24
- include Saturn_lockfree.Queue
24
+ type 'a t = { m : Mutex.t; mutable l : 'a List.t }
25
25
 
26
- let flush_elements q =
27
- let rec flush_elements_f elements =
28
- try flush_elements_f (pop q :: elements) with Empty -> List.rev elements
29
- in
30
- flush_elements_f []
26
+ let create () = { m = Mutex.create (); l = [] }
27
+ let apply q fn = Mutex_utils.mutexify q.m fn q [@@inline always]
28
+ let is_empty q = apply q (function { l = [] } -> true | _ -> false)
29
+ let push q v = apply q (fun q -> q.l <- q.l @ [v])
30
+ let append q v = apply q (fun q -> q.l <- v :: q.l)
31
+
32
+ let pop_opt q =
33
+ apply q (function
34
+ | { l = el :: rest } ->
35
+ q.l <- rest;
36
+ Some el
37
+ | _ -> None)
31
38
 
32
- let pop q = try pop q with Empty -> raise Not_found
39
+ let peek_opt q = apply q (function { l = el :: _ } -> Some el | _ -> None)
40
+
41
+ let flush_elements q =
42
+ apply q (fun q ->
43
+ let l = q.l in
44
+ q.l <- [];
45
+ l)
46
+
47
+ let pop q =
48
+ apply q (function
49
+ | { l = el :: rest } ->
50
+ q.l <- rest;
51
+ el
52
+ | _ -> raise Not_found)
53
+
54
+ let peek q = apply q (function { l = el :: _ } -> el | _ -> raise Not_found)
33
55
  let flush_iter q fn = List.iter fn (flush_elements q)
34
56
 
35
57
  let flush_fold q fn ret =
36
58
  let flush_fold_f ret el = fn el ret in
37
59
  List.fold_left flush_fold_f ret (flush_elements q)
38
60
 
39
- let elements q =
40
- let rec elements_f l cursor =
41
- match next cursor with
42
- | Some (el, cursor) -> elements_f (el :: l) cursor
43
- | None -> List.rev l
44
- in
45
- elements_f [] (snapshot q)
46
-
47
- let exists q fn =
48
- let rec exists_f l cursor =
49
- match next cursor with
50
- | Some (el, _) when fn el -> true
51
- | Some (el, cursor) -> exists_f (el :: l) cursor
52
- | None -> false
53
- in
54
- exists_f [] (snapshot q)
55
-
56
- let length q =
57
- let rec length_f pos cursor =
58
- match next cursor with
59
- | Some (_, cursor) -> length_f (pos + 1) cursor
60
- | None -> pos
61
- in
62
- length_f 0 (snapshot q)
63
-
61
+ let elements q = apply q (fun { l } -> l)
62
+ let exists q fn = List.exists fn (elements q)
63
+ let length q = List.length (elements q)
64
64
  let iter q fn = List.iter fn (elements q)
65
65
  let fold q fn v = List.fold_left (fun v e -> fn e v) v (elements q)
66
-
67
- let filter q fn =
68
- let filter_f el = if fn el then push q el in
69
- List.iter filter_f (flush_elements q)
66
+ let filter q fn = apply q (fun q -> q.l <- List.filter fn q.l)
67
+ let filter_out q fn = filter q (fun el -> not (fn el))
70
68
  end
71
69
 
72
70
  module WeakQueue = struct
73
71
  include Queue
74
72
 
75
- type 'a q = 'a t
76
- type 'a t = 'a Weak.t q
73
+ type nonrec 'a t = 'a Weak.t t
77
74
 
78
75
  let push q v =
79
76
  let w = Weak.create 1 in
@@ -86,20 +83,10 @@ module WeakQueue = struct
86
83
  match Weak.get x i with Some v -> fn v | None -> ()
87
84
  done)
88
85
 
89
- let batch_size = 1024
90
-
91
- let push_batches q elements =
92
- let len = List.length elements in
93
- let n_batches = int_of_float (ceil (float len /. float batch_size)) in
94
- for i = 0 to n_batches - 1 do
95
- let entry = Weak.create batch_size in
96
- let offset = i * batch_size in
97
- let max_pos = min (len - offset) batch_size in
98
- for pos = 0 to max_pos - 1 do
99
- Weak.set entry pos (Some (List.nth elements (pos + offset)))
100
- done;
101
- Queue.push q entry
102
- done
86
+ let flush_elements q =
87
+ let elements = ref [] in
88
+ flush_iter q (fun el -> elements := el :: !elements);
89
+ List.rev !elements
103
90
 
104
91
  let elements q =
105
92
  let rec elements_f rem =
@@ -120,7 +107,13 @@ module WeakQueue = struct
120
107
  | None -> rem
121
108
  in
122
109
  let rem = elements_f [] in
123
- push_batches q rem;
110
+ let len = List.length rem in
111
+ if len > 0 then (
112
+ let entry = Weak.create len in
113
+ for i = 0 to len - 1 do
114
+ Weak.set entry i (Some (List.nth rem i))
115
+ done;
116
+ Queue.push q entry);
124
117
  rem
125
118
 
126
119
  let exists q fn = List.exists fn (elements q)
@@ -129,16 +122,17 @@ module WeakQueue = struct
129
122
  let fold q fn v = List.fold_left (fun v e -> fn e v) v (elements q)
130
123
 
131
124
  let filter q fn =
132
- let rec filter_f cursor =
133
- match next cursor with
134
- | Some (el, cursor) ->
135
- for i = 0 to Weak.length el - 1 do
136
- match Weak.get el i with
137
- | Some p when fn p -> ()
138
- | _ -> Weak.set el i None
139
- done;
140
- filter_f cursor
141
- | None -> ()
125
+ let filter_f q =
126
+ List.iter
127
+ (fun el ->
128
+ for i = 0 to Weak.length el - 1 do
129
+ match Weak.get el i with
130
+ | Some p when fn p -> ()
131
+ | _ -> Weak.set el i None
132
+ done)
133
+ q.l
142
134
  in
143
- filter_f (snapshot q)
135
+ apply q filter_f
136
+
137
+ let filter_out q fn = filter q (fun el -> not (fn el))
144
138
  end