codemirror-lang-liquidsoap 0.3.5 → 0.3.6

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 +6 -6
  2. package/dist/index.js +5 -5
  3. package/package.json +1 -1
  4. package/src/liquidsoap.grammar +2 -0
  5. package/src/parser.js +4 -4
  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
@@ -28,14 +28,14 @@ module Tutils = struct
28
28
  (* Thread with preemptive kill/wait mechanism, see mli for details. *)
29
29
 
30
30
  (** Preemptive stoppable thread.
31
- *
32
- * The thread function receives a [should_stop,has_stop] pair on startup.
33
- * It should regularly poll the [should_stop] and stop when asked to.
34
- * Before stopping it should call [has_stopped].
35
- *
36
- * The function returns a [kill,wait] pair. The first function should be
37
- * called to request that the thread stops, and the second to wait
38
- * that it has effectively stopped. *)
31
+
32
+ The thread function receives a [should_stop,has_stop] pair on startup. It
33
+ should regularly poll the [should_stop] and stop when asked to. Before
34
+ stopping it should call [has_stopped].
35
+
36
+ The function returns a [kill,wait] pair. The first function should be
37
+ called to request that the thread stops, and the second to wait that it
38
+ has effectively stopped. *)
39
39
  let stoppable_thread f name =
40
40
  let cond = Condition.create () in
41
41
  let lock = Mutex.create () in
@@ -54,17 +54,19 @@ module Tutils = struct
54
54
  end
55
55
 
56
56
  class output ~on_start ~on_stop ~register_telnet ~infallible ~autostart
57
- ~hostname ~port ~encoder_factory source =
57
+ ~hostname ~port ~encoder_factory source_val =
58
+ let source = Lang.to_source source_val in
58
59
  object (self)
59
60
  inherit
60
61
  [Strings.t] Output.encoded
61
62
  ~output_kind:"udp" ~on_start ~on_stop ~register_telnet ~infallible
62
63
  ~autostart ~export_cover_metadata:false
63
64
  ~name:(Printf.sprintf "udp://%s:%d" hostname port)
64
- source
65
+ source_val
65
66
 
66
67
  val mutable socket_send = None
67
68
  val mutable encoder = None
69
+ method self_sync = source#self_sync
68
70
 
69
71
  method private start =
70
72
  let socket =
@@ -182,8 +184,8 @@ class input ~hostname ~port ~get_stream_decoder ~bufferize =
182
184
  Generator.add_track_mark self#buffer;
183
185
 
184
186
  (* Closing the socket is slightly overkill but
185
- * we need to recreate the decoder anyway, which
186
- * might loose some data too. *)
187
+ we need to recreate the decoder anyway, which
188
+ might loose some data too. *)
187
189
  Unix.close socket;
188
190
  begin
189
191
  match e with
@@ -54,7 +54,7 @@ val iter_sources :
54
54
  (** {2 Computation} *)
55
55
 
56
56
  (** Multiapply a value to arguments. The argument [t] is the type of the result
57
- of the application. *)
57
+ of the application. *)
58
58
  val apply : ?pos:Liquidsoap_lang.Pos.t list -> value -> env -> value
59
59
 
60
60
  (** {3 Helpers for registering protocols} *)
@@ -178,7 +178,7 @@ val to_valued_ref :
178
178
  val to_http_transport : value -> Liq_http.transport
179
179
 
180
180
  (** [assoc x n l] returns the [n]-th [y] such that [(x,y)] is in the list [l].
181
- * This is useful for retrieving arguments of a function. *)
181
+ This is useful for retrieving arguments of a function. *)
182
182
  val assoc : 'a -> int -> ('a * 'b) list -> 'b
183
183
 
184
184
  val int_t : t
@@ -219,11 +219,10 @@ val internal_tracks_t : unit -> t
219
219
  applied. *)
220
220
  val pcm_audio_t : unit -> t
221
221
 
222
- (** [fun_t args r] is the type of a function taking [args] as parameters
223
- * and returning values of type [r].
224
- * The elements of [r] are of the form [(b,l,t)] where [b] indicates if
225
- * the argument is optional, [l] is the label of the argument ([""] means no
226
- * label) and [t] is the type of the argument. *)
222
+ (** [fun_t args r] is the type of a function taking [args] as parameters and
223
+ returning values of type [r]. The elements of [r] are of the form [(b,l,t)]
224
+ where [b] indicates if the argument is optional, [l] is the label of the
225
+ argument ([""] means no label) and [t] is the type of the argument. *)
227
226
  val fun_t : (bool * string * t) list -> t -> t
228
227
 
229
228
  val univ_t : ?constraints:Liquidsoap_lang.Type.constr list -> unit -> t
@@ -261,17 +260,16 @@ val reference : (unit -> value) -> (value -> unit) -> value
261
260
  val http_transport : Liq_http.transport -> value
262
261
  val base_http_transport : Liq_http.transport -> value
263
262
 
264
- (** Build a function from an OCaml function. Items in the prototype indicate
265
- the label and optional values. Second string value is used when renaming
263
+ (** Build a function from an OCaml function. Items in the prototype indicate the
264
+ label and optional values. Second string value is used when renaming
266
265
  argument name, e.g. `fun (foo=_, ...) -> ` *)
267
266
  val val_fun : (string * string * value option) list -> (env -> value) -> value
268
267
 
269
268
  (** Build a function from a term. *)
270
269
  val term_fun : (string * string * value option) list -> Term.t -> value
271
270
 
272
- (** Build a constant function.
273
- * It is slightly less opaque and allows the printing of the closure
274
- * when the constant is ground. *)
271
+ (** Build a constant function. It is slightly less opaque and allows the
272
+ printing of the closure when the constant is ground. *)
275
273
  val val_cst_fun : (string * value option) list -> value -> value
276
274
 
277
275
  (** Extract position from the environment. Used inside function execution. *)
@@ -44,9 +44,12 @@ module ClockValue = struct
44
44
  let methods =
45
45
  [
46
46
  ( "id",
47
- Lang.fun_t [] Lang.string_t,
47
+ Lang.ref_t Lang.string_t,
48
48
  "The clock's id",
49
- fun c -> Lang.val_fun [] (fun _ -> Lang.string (Clock.id c)) );
49
+ fun c ->
50
+ let get () = Lang.string (Clock.id c) in
51
+ let set v = Clock.set_id c (Lang.to_string v) in
52
+ Lang.reference get set );
50
53
  ( "sync",
51
54
  Lang.fun_t [] Lang.string_t,
52
55
  "The clock's current sync mode. One of: `\"stopped\"`, `\"stopping\"`, \
@@ -297,35 +300,15 @@ let source_methods =
297
300
  "Is the source currently controlling its own real-time loop.",
298
301
  fun s -> val_fun [] (fun _ -> bool (snd s#self_sync <> None)) );
299
302
  ( "log",
300
- ( [],
301
- record_t
302
- [
303
- ( "level",
304
- method_t
305
- (fun_t [] (nullable_t int_t))
306
- [
307
- ( "set",
308
- ([], fun_t [(false, "", int_t)] unit_t),
309
- "Set the source's log level" );
310
- ] );
311
- ] ),
303
+ ([], record_t [("level", ref_t int_t)]),
312
304
  "Get or set the source's log level, from `1` to `5`.",
313
305
  fun s ->
314
306
  record
315
307
  [
316
308
  ( "level",
317
- meth
318
- (val_fun [] (fun _ ->
319
- match s#log#level with Some lvl -> int lvl | None -> null))
320
- [
321
- ( "set",
322
- val_fun
323
- [("", "", None)]
324
- (fun p ->
325
- let lvl = min 5 (max 1 (to_int (List.assoc "" p))) in
326
- s#log#set_level lvl;
327
- unit) );
328
- ] );
309
+ reference
310
+ (fun () -> int s#log#level)
311
+ (fun v -> s#log#set_level (to_int v)) );
329
312
  ] );
330
313
  ( "is_up",
331
314
  ([], fun_t [] bool_t),
@@ -432,7 +415,8 @@ let add_value_flag v flag =
432
415
  | Value.Float _ | Value.String _ | Value.Bool _ | Value.Null _ -> ()
433
416
  | v -> Value.add_flag v flag
434
417
 
435
- (** Ensure that the frame contents of all the sources occurring in the value agree with [t]. *)
418
+ (** Ensure that the frame contents of all the sources occurring in the value
419
+ agree with [t]. *)
436
420
  let check_content v t =
437
421
  let check t t' = Typing.(t <: t') in
438
422
  let rec check_value v t =
@@ -539,18 +523,20 @@ let check_content v t =
539
523
  in
540
524
  check_value v t
541
525
 
542
- (** An operator is a builtin function that builds a source.
543
- * It is registered using the wrapper [add_operator].
544
- * Creating the associated function type (and function) requires some work:
545
- * - Specify which content_kind the source will carry:
546
- * a given fixed number of channels, any fixed, a variable number?
547
- * - The content_kind can also be linked to a type variable,
548
- * e.g. the parameter of a format type.
549
- * From this high-level description a type is created. Often it will
550
- * carry a type constraint.
551
- * Once the type has been inferred, the function might be executed,
552
- * and at this point the type might still not be known completely
553
- * so we have to force its value within the acceptable range. *)
526
+ (** An operator is a builtin function that builds a source. It is registered
527
+ using the wrapper [add_operator]. Creating the associated function type (and
528
+ function) requires some work:
529
+ - Specify which content_kind the source will carry: a given fixed number of
530
+ channels, any fixed, a variable number?
531
+ - The content_kind can also be linked to a type variable, e.g. the parameter
532
+ of a format type.
533
+
534
+ From this high-level description a type is created. Often it will carry a
535
+ type constraint.
536
+
537
+ Once the type has been inferred, the function might be executed, and at this
538
+ point the type might still not be known completely so we have to force its
539
+ value within the acceptable range. *)
554
540
 
555
541
  let _meth = meth
556
542
 
@@ -1 +1,31 @@
1
1
  include Liquidsoap_lang.Lang_string
2
+
3
+ type base_id = { category : string; name : string; mutable counter : int }
4
+
5
+ module IdMap = Weak.Make (struct
6
+ type t = base_id
7
+
8
+ let equal id id' = id.category = id'.category && id.name = id'.name
9
+ let hash { category; name } = Hashtbl.hash (category ^ name)
10
+ end)
11
+
12
+ (** Generate a unique unifier based on name and category. *)
13
+ let generate_id =
14
+ let m = Mutex.create () in
15
+ let h = IdMap.create 10 in
16
+ fun ~category name ->
17
+ Mutex_utils.mutexify m
18
+ (fun () ->
19
+ let base_id = IdMap.merge h { category; name; counter = 0 } in
20
+ let id =
21
+ Bytes.(
22
+ unsafe_to_string
23
+ (of_string
24
+ (match base_id.counter with
25
+ | 0 -> name
26
+ | n -> name ^ "." ^ string_of_int n)))
27
+ in
28
+ base_id.counter <- base_id.counter + 1;
29
+ Gc.finalise_last (fun () -> ignore (Sys.opaque_identity base_id)) id;
30
+ id)
31
+ ()
@@ -0,0 +1,3 @@
1
+ include module type of Liquidsoap_lang.Lang_string
2
+
3
+ val generate_id : category:string -> string -> string
@@ -51,7 +51,7 @@ let create_encoder ~flac ~comments () =
51
51
  | None ->
52
52
  let x =
53
53
  Flac_ogg.Encoder.create ~comments ~serialno:(Ogg.Stream.serialno os)
54
- p write_cb
54
+ ~write:write_cb p
55
55
  in
56
56
  enc := Some x;
57
57
  x
@@ -80,8 +80,8 @@ let create_encoder ~flac ~comments () =
80
80
  (data.Ogg_muxer.data, data.Ogg_muxer.offset, data.Ogg_muxer.length)
81
81
  in
82
82
  let b = Array.map (fun x -> Array.sub x ofs len) b in
83
- let { Flac_ogg.Encoder.encoder; callbacks } = get_enc os in
84
- Flac.Encoder.process encoder callbacks b;
83
+ let { Flac_ogg.Encoder.encoder } = get_enc os in
84
+ Flac.Encoder.process encoder b;
85
85
  List.iter write_page (flush_pages ())
86
86
  in
87
87
  let end_of_page p =
@@ -90,12 +90,12 @@ let create_encoder ~flac ~comments () =
90
90
  else Ogg_muxer.Time (Int64.to_float granulepos /. float samplerate)
91
91
  in
92
92
  let end_of_stream os =
93
- let { Flac_ogg.Encoder.encoder; callbacks } = get_enc os in
93
+ let { Flac_ogg.Encoder.encoder } = get_enc os in
94
94
  (* Assert that at least some data was encoded.. *)
95
95
  if not !started then (
96
96
  let b = empty_data () in
97
- Flac.Encoder.process encoder callbacks b);
98
- Flac.Encoder.finish encoder callbacks;
97
+ Flac.Encoder.process encoder b);
98
+ Flac.Encoder.finish encoder;
99
99
  set_stream_eos os;
100
100
  flush_pages ()
101
101
  in
@@ -58,11 +58,9 @@ type 'a stream = {
58
58
 
59
59
  type track = Audio_track of audio stream | Video_track of video stream
60
60
 
61
- (** You may register new tracks on state Eos or Bos.
62
- * You can't register new track on state Streaming.
63
- * You may finalize at any state, provided at least
64
- * single track is registered. However, this is not
65
- * recommended. *)
61
+ (** You may register new tracks on state Eos or Bos. You can't register new
62
+ track on state Streaming. You may finalize at any state, provided at least
63
+ single track is registered. However, this is not recommended. *)
66
64
  type state = Eos | Streaming | Bos
67
65
 
68
66
  type t = {
@@ -107,8 +105,8 @@ let set_remaining_of_ogg_track x v =
107
105
  | Audio_track x -> x.remaining <- v
108
106
  | Video_track x -> x.remaining <- v
109
107
 
110
- (** As per specifications, we need a random injective sequence of
111
- * nativeint. This might not be assumed here, but chances are very low.. *)
108
+ (** As per specifications, we need a random injective sequence of nativeint.
109
+ This might not be assumed here, but chances are very low.. *)
112
110
  let random_state = Random.State.make_self_init ()
113
111
 
114
112
  let get_serial () =
@@ -219,9 +217,7 @@ let register_track ?fill encoder track_encoder =
219
217
 
220
218
  (** Start streams, set state to Streaming. *)
221
219
  let streams_start encoder =
222
- if Hashtbl.length encoder.tracks = 0 then
223
- log#info "%s: Starting stream with no ogg track.." encoder.id;
224
- log#info "%s: Starting all streams" encoder.id;
220
+ log#info "%s: Starting %d track(s)" encoder.id (Hashtbl.length encoder.tracks);
225
221
 
226
222
  (* Add skeleton information first. *)
227
223
  begin
@@ -287,18 +283,14 @@ let remaining_pages encoder =
287
283
  let f _ t x = if remaining_of_ogg_track t <> None then x + 1 else x in
288
284
  Hashtbl.fold f encoder.tracks 0
289
285
 
290
- (** Fill output data with available pages.
291
- * The algorithm works as follow:
292
- * + The encoder has a global position
293
- * + Each time a page ends at a position
294
- * that is ahead of the encoder position,
295
- * the page is kept as remaining.
296
- * + When there is one remaining page per
297
- * track, we take the least of them and
298
- * add it. The encoder position is then
299
- * bumped.
300
- * + As soon as the encoder's position is ahead
301
- * of a page, then this page can be written *)
286
+ (** Fill output data with available pages. The algorithm works as follow:
287
+ + The encoder has a global position
288
+ + Each time a page ends at a position that is ahead of the encoder position,
289
+ the page is kept as remaining.
290
+ + When there is one remaining page per track, we take the least of them and
291
+ add it. The encoder position is then bumped.
292
+ + As soon as the encoder's position is ahead of a page, then this page can
293
+ be written *)
302
294
  let add_available src encoder =
303
295
  let rec fill src dst =
304
296
  (* First we check if there is a remaining
@@ -345,8 +337,7 @@ let add_available src encoder =
345
337
 
346
338
  let queue_add src p = Queue.add p src.available
347
339
 
348
- (** Encode data. Implicitly calls [streams_start]
349
- * if not called before. *)
340
+ (** Encode data. Implicitly calls [streams_start] if not called before. *)
350
341
  let encode encoder id data =
351
342
  if encoder.state = Bos then streams_start encoder;
352
343
  if encoder.state = Eos then (
@@ -366,9 +357,8 @@ let encode encoder id data =
366
357
  add_available t encoder
367
358
  | _ -> raise Invalid_data)
368
359
 
369
- (** Finish a track.
370
- * Not all data will necessarily be outputted here. It is possible
371
- * that muxing needs also another track to end.. *)
360
+ (** Finish a track. Not all data will necessarily be outputted here. It is
361
+ possible that muxing needs also another track to end.. *)
372
362
  let end_of_track encoder id =
373
363
  let track = Hashtbl.find encoder.tracks id in
374
364
  if encoder.state = Bos then (
@@ -43,16 +43,13 @@ type 'a data = { data : 'a; offset : int; length : int }
43
43
  (** A track data is a data unit of either audio or video. *)
44
44
  type track_data = Audio_data of audio data | Video_data of video data
45
45
 
46
- (** A track encoder takes the track data,
47
- * the ogg logical stream, and fills the stream.
48
- * If the encoding process outputs ogg pages, then
49
- * the encoder should use the last argument to add its pages
50
- * to the stream. *)
46
+ (** A track encoder takes the track data, the ogg logical stream, and fills the
47
+ stream. If the encoding process outputs ogg pages, then the encoder should
48
+ use the last argument to add its pages to the stream. *)
51
49
  type 'a track_encoder =
52
50
  'a data -> Ogg.Stream.stream -> (Ogg.Page.t -> unit) -> unit
53
51
 
54
- (** Returns the first page of the stream,
55
- * to be placed at the very beginning. *)
52
+ (** Returns the first page of the stream, to be placed at the very beginning. *)
56
53
  type header_encoder = Ogg.Stream.stream -> Ogg.Page.t
57
54
 
58
55
  (** Return the end time of a page, in milliseconds. *)
@@ -61,10 +58,8 @@ type position = Unknown | Time of float
61
58
  (** Type for a function returning a page's ending time. *)
62
59
  type page_end_time = Ogg.Page.t -> position
63
60
 
64
- (** Returns an optional fisbone packet, which
65
- * will contain the data for this stream to
66
- * put in the ogg skeleton, if enabled in
67
- * the encoder. *)
61
+ (** Returns an optional fisbone packet, which will contain the data for this
62
+ stream to put in the ogg skeleton, if enabled in the encoder. *)
68
63
  type fisbone_packet = Ogg.Stream.stream -> Ogg.Stream.packet option
69
64
 
70
65
  (** Returns the remaining header data, before data encoding starts. *)
@@ -91,38 +86,41 @@ type stream_encoder = {
91
86
  (** Main type for the ogg encoder *)
92
87
  type t
93
88
 
94
- (** You may register new tracks on state Eos or Bos.
95
- * You can't register new track on state Streaming. *)
89
+ (** You may register new tracks on state Eos or Bos. You can't register new
90
+ track on state Streaming. *)
96
91
  type state = Eos | Streaming | Bos
97
92
 
98
93
  (** {2 API} *)
99
94
 
100
95
  (** Usage:
101
- *
102
- * Encoding:
103
- *
104
- * - [create ~skeleton name] : create a new encoder
105
- * - [register_track encoder stream_encoder] : register a new track
106
- * - ibid
107
- * - (...)
108
- * - [streams_start encoder] : start the tracks (optional)
109
- * - [encode encoder track_serial track_data] : encode data for one track
110
- * - ibid
111
- * - (...)
112
- * - (encode data for other tracks)
113
- * - [end_of_track encoder track_serial] : ends a track. (track end do not need to be simultaneous)
114
- * - (...)
115
- * - [end_of_stream encoder]: ends all tracks as well as the encoder. Set Eos state on the encoder.
116
- * - [register_track encoder stream_encoder] : register a new track, starts a new sequentialized stream
117
- * - And so on..
118
- *
119
- * You get encoded data by calling [get_data], [peek_data].
120
- *
121
- * See: http://xiph.org/ogg/doc/oggstream.html for more details on the
122
- * specifications of an ogg stream. This API reflects exactly what is recommended to do. *)
123
-
124
- (** Create a new encoder.
125
- * Add an ogg skeleton if [skeleton] is [true]. *)
96
+
97
+ Encoding:
98
+
99
+ - [create ~skeleton name] : create a new encoder
100
+ - [register_track encoder stream_encoder] : register a new track
101
+ - ibid
102
+ - (...)
103
+ - [streams_start encoder] : start the tracks (optional)
104
+ - [encode encoder track_serial track_data] : encode data for one track
105
+ - ibid
106
+ - (...)
107
+ - (encode data for other tracks)
108
+ - [end_of_track encoder track_serial] : ends a track. (track end do not need
109
+ to be simultaneous)
110
+ - (...)
111
+ - [end_of_stream encoder]: ends all tracks as well as the encoder. Set Eos
112
+ state on the encoder.
113
+ - [register_track encoder stream_encoder] : register a new track, starts a
114
+ new sequentialized stream
115
+ - And so on..
116
+
117
+ You get encoded data by calling [get_data], [peek_data].
118
+
119
+ See: http://xiph.org/ogg/doc/oggstream.html for more details on the
120
+ specifications of an ogg stream. This API reflects exactly what is
121
+ recommended to do. *)
122
+
123
+ (** Create a new encoder. Add an ogg skeleton if [skeleton] is [true]. *)
126
124
  val create : skeleton:bool -> string -> t
127
125
 
128
126
  (** Get the state of an encoder. *)
@@ -137,30 +135,23 @@ val get_header : t -> Strings.t
137
135
  (** Peek encoded data without removing it. *)
138
136
  val peek_data : t -> Strings.t
139
137
 
140
- (** Register a new track to the stream.
141
- * The state needs to be [Bos] or [Eos].
142
- *
143
- * [fill] parameter is used to try to control ogg
144
- * logical page's size. See [Ogg.get_page] for more
145
- * details.
146
- *
147
- * Returns the serial number of the registered ogg
148
- * stream. *)
138
+ (** Register a new track to the stream. The state needs to be [Bos] or [Eos]. *
139
+ [fill] parameter is used to try to control ogg logical page's size. See
140
+ [Ogg.get_page] for more details. * Returns the serial number of the
141
+ registered ogg stream. *)
149
142
  val register_track : ?fill:int -> t -> stream_encoder -> nativeint
150
143
 
151
144
  (** Start streams, set state to [Streaming]. *)
152
145
  val streams_start : t -> unit
153
146
 
154
- (** Encode data. Implicitly calls [streams_start]
155
- * if not called before. Fails if state is not [Streaming] *)
147
+ (** Encode data. Implicitly calls [streams_start] if not called before. Fails if
148
+ state is not [Streaming] *)
156
149
  val encode : t -> nativeint -> track_data -> unit
157
150
 
158
- (** Finish a track. Raises [Not_found] if
159
- * no such track exists. *)
151
+ (** Finish a track. Raises [Not_found] if no such track exists. *)
160
152
  val end_of_track : t -> nativeint -> unit
161
153
 
162
- (** Ends all tracks, flush remaining encoded data.
163
- * Set state to [Eos]. *)
154
+ (** Ends all tracks, flush remaining encoded data. Set state to [Eos]. *)
164
155
  val end_of_stream : t -> unit
165
156
 
166
157
  (** {2 Utils} *)
@@ -63,7 +63,7 @@ let create_encoder ~opus ~comments () =
63
63
  Opus.Encoder.apply_control (`Set_dtx opus.Opus_format.dtx) x;
64
64
  Opus.Encoder.apply_control
65
65
  (`Set_phase_inversion_disabled
66
- (not opus.Opus_format.phase_inversion)) x;
66
+ (not opus.Opus_format.phase_inversion)) x;
67
67
  enc := Some x;
68
68
  x
69
69
  in
@@ -70,8 +70,7 @@ let create_gen enc freq m =
70
70
  end_of_stream;
71
71
  }
72
72
 
73
- (** Rates are given in bits per seconds,
74
- * i.e. 128000 instead of 128.. *)
73
+ (** Rates are given in bits per seconds, i.e. 128000 instead of 128.. *)
75
74
  let create_abr ~channels ~samplerate ~min_rate ~max_rate ~average_rate ~metadata
76
75
  () =
77
76
  let min_rate, max_rate, average_rate =
@@ -110,8 +110,8 @@ class virtual base ~name tracks =
110
110
  Frame.add_all_metadata buf metadata
111
111
  end
112
112
 
113
- (** Add/mix several sources together.
114
- * If [renorm], renormalize the PCM channels. *)
113
+ (** Add/mix several sources together. If [renorm], renormalize the PCM channels.
114
+ *)
115
115
  class audio_add ~renorm ~power ~field tracks =
116
116
  object (self)
117
117
  inherit base ~name:"audio.add" tracks
@@ -48,8 +48,8 @@ class consumer ~clock buffer =
48
48
  method remaining = Generator.length buffer
49
49
  end
50
50
 
51
- (** [rms_width] is in samples.
52
- * [cross_length] is in ticks (like #remaining estimations) and must be at least one frame. *)
51
+ (** [rms_width] is in samples. [cross_length] is in ticks (like #remaining
52
+ estimations) and must be at least one frame. *)
53
53
  class cross val_source ~end_duration_getter ~override_end_duration
54
54
  ~override_duration ~start_duration_getter ~override_start_duration
55
55
  ~override_max_start_duration ~persist_override ~rms_width ~assume_autocue
@@ -21,30 +21,47 @@
21
21
  *****************************************************************************)
22
22
 
23
23
  (** Avoids some source to play a new track before some delay elapses after the
24
- * end of the previous track played. *)
24
+ end of the previous track played. *)
25
25
 
26
26
  open Source
27
27
 
28
28
  class delay ~initial (source : source) delay =
29
+ let initial_last_track, time, delay_ok =
30
+ let module Time = (val Clock.time_implementation () : Liq_time.T) in
31
+ let initial_last_track =
32
+ if initial then Time.time () else Time.of_float 0.
33
+ in
34
+ let time = Time.time in
35
+ let delay_ok last_track =
36
+ Time.(of_float (delay ()) |<=| (time () |-| last_track))
37
+ in
38
+ (initial_last_track, time, delay_ok)
39
+ in
29
40
  object (self)
30
41
  inherit operator ~name:"delay" [source]
31
- val mutable last_track = if initial then Unix.time () else 0.
42
+ val mutable last_track = initial_last_track
43
+ val mutable first_track = true
32
44
  method fallible = true
33
45
  method remaining = source#remaining
34
46
 
35
47
  method abort_track =
36
- last_track <- Unix.time ();
48
+ last_track <- time ();
37
49
  source#abort_track
38
50
 
39
51
  method seek_source = source#seek_source
40
52
  method self_sync = source#self_sync
41
- method private delay_ok = Unix.time () -. last_track >= delay ()
53
+ method private delay_ok = delay_ok last_track
42
54
  method private can_generate_frame = self#delay_ok && source#is_ready
43
55
 
44
56
  method private generate_frame =
45
- match self#split_frame source#get_frame with
57
+ let frame = source#get_frame in
58
+ match self#split_frame frame with
59
+ | buf, Some _ when first_track && Frame.position buf = 0 ->
60
+ first_track <- false;
61
+ frame
46
62
  | buf, Some _ ->
47
- last_track <- Unix.time ();
63
+ first_track <- false;
64
+ last_track <- time ();
48
65
  buf
49
66
  | buf, None -> buf
50
67
  end
@@ -77,7 +77,8 @@ module Band = struct
77
77
  b.band_v' <- b.band_v;
78
78
  b.band_v <- v
79
79
 
80
- (** Update the value of the band. This function should be called every size samples. *)
80
+ (** Update the value of the band. This function should be called every size
81
+ samples. *)
81
82
  let update ?(debug = false) ~alpha b =
82
83
  (* Square of the value for the DFT band. *)
83
84
  let x =
@@ -195,7 +196,7 @@ class dtmf ~duration ~bands ~threshold ~smoothing ~debug callback
195
196
  ((* Find relevant bands. *)
196
197
  let found = Bands.detect bands threshold in
197
198
  (* Update the state *)
198
- match found with
199
+ match found with
199
200
  | [f1; f2] -> (
200
201
  let f = (f1, f2) in
201
202
  let dt = size /. samplerate in
@@ -110,11 +110,11 @@ class dyn ~init ~track_sensitive ~infallible ~self_sync ~merge next_fn =
110
110
  method self_sync =
111
111
  match self_sync with
112
112
  | Some v -> (`Static, self#source_sync v)
113
- | None -> (
113
+ | None ->
114
114
  ( `Dynamic,
115
115
  match self#current_source with
116
116
  | Some s -> snd s#self_sync
117
- | None -> None ))
117
+ | None -> None )
118
118
  end
119
119
 
120
120
  let _ =
@@ -91,7 +91,8 @@ class fir (source : source) freq beta numcoeffs =
91
91
  !t.(s + i) <- !d.(s + (2 * i));
92
92
 
93
93
  (* even *)
94
- !t.(s + h + i) <- !d.(s + (2 * i) + 1) (* odd *)
94
+ !t.(s + h + i) <- !d.(s + (2 * i) + 1)
95
+ (* odd *)
95
96
  done;
96
97
  fft d t s h;
97
98
  fft d t (s + h) h;