codemirror-lang-liquidsoap 0.2.9 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (418) hide show
  1. package/dist/cli.js +2 -2
  2. package/dist/index.js +2 -2
  3. package/package.json +4 -3
  4. package/src/cli.ts +0 -0
  5. package/src/liquidsoap.grammar +1 -1
  6. package/src/parser.js +1 -1
  7. package/tests/liquidsoap/.github/alpine/APKBUILD-minimal.in +1 -1
  8. package/tests/liquidsoap/.github/alpine/APKBUILD.in +1 -1
  9. package/tests/liquidsoap/.github/alpine/liquidsoap.pre-install +0 -0
  10. package/tests/liquidsoap/.github/debian/rules +1 -1
  11. package/tests/liquidsoap/.github/debian/rules-minimal +1 -1
  12. package/tests/liquidsoap/.github/opam/liquidsoap-core-windows.opam +4 -3
  13. package/tests/liquidsoap/.github/opam/packages/ffmpeg-av-windows/ffmpeg-av-windows.1.2.0/opam +38 -0
  14. package/tests/liquidsoap/.github/opam/packages/ffmpeg-avcodec-windows/ffmpeg-avcodec-windows.1.2.0/opam +37 -0
  15. package/tests/liquidsoap/.github/opam/packages/ffmpeg-avdevice-windows/ffmpeg-avdevice-windows.1.2.0/opam +37 -0
  16. package/tests/liquidsoap/.github/opam/packages/ffmpeg-avfilter-windows/ffmpeg-avfilter-windows.1.2.0/opam +37 -0
  17. package/tests/liquidsoap/.github/opam/packages/ffmpeg-avutil-windows/ffmpeg-avutil-windows.1.2.0/opam +37 -0
  18. package/tests/liquidsoap/.github/opam/packages/ffmpeg-swresample-windows/ffmpeg-swresample-windows.1.2.0/opam +38 -0
  19. package/tests/liquidsoap/.github/opam/packages/ffmpeg-swscale-windows/ffmpeg-swscale-windows.1.2.0/opam +37 -0
  20. package/tests/liquidsoap/.github/opam/packages/ffmpeg-windows/ffmpeg-windows.1.2.0/opam +35 -0
  21. package/tests/liquidsoap/.github/scripts/add-local-opam-packages.sh +0 -0
  22. package/tests/liquidsoap/.github/scripts/build-apk.sh +0 -0
  23. package/tests/liquidsoap/.github/scripts/build-deb.sh +0 -0
  24. package/tests/liquidsoap/.github/scripts/build-details.sh +1 -1
  25. package/tests/liquidsoap/.github/scripts/build-doc.sh +0 -0
  26. package/tests/liquidsoap/.github/scripts/build-docker-alpine.sh +0 -0
  27. package/tests/liquidsoap/.github/scripts/build-docker.sh +0 -0
  28. package/tests/liquidsoap/.github/scripts/build-posix.sh +16 -13
  29. package/tests/liquidsoap/.github/scripts/build-website.sh +0 -0
  30. package/tests/liquidsoap/.github/scripts/build-win32.sh +0 -0
  31. package/tests/liquidsoap/.github/scripts/checkout-deps.sh +0 -0
  32. package/tests/liquidsoap/.github/scripts/export-metrics.sh +0 -0
  33. package/tests/liquidsoap/.github/scripts/push-docker.sh +0 -0
  34. package/tests/liquidsoap/.github/scripts/stats-posix.sh +0 -0
  35. package/tests/liquidsoap/.github/scripts/test-posix.sh +0 -0
  36. package/tests/liquidsoap/.github/workflows/ci.yml +10 -1
  37. package/tests/liquidsoap/.pre-commit-config.yaml +1 -1
  38. package/tests/liquidsoap/CHANGES.md +101 -1
  39. package/tests/liquidsoap/README.md +1 -1
  40. package/tests/liquidsoap/ROADMAP.md +28 -26
  41. package/tests/liquidsoap/doc/content/cookbook.md +46 -3
  42. package/tests/liquidsoap/doc/content/database.md +126 -0
  43. package/tests/liquidsoap/doc/content/documentation.md +1 -0
  44. package/tests/liquidsoap/doc/content/encoding_formats.md +6 -7
  45. package/tests/liquidsoap/doc/content/ffmpeg_encoder.md +20 -0
  46. package/tests/liquidsoap/doc/content/hls_output.md +27 -2
  47. package/tests/liquidsoap/doc/content/index.md +1 -1
  48. package/tests/liquidsoap/doc/content/liq/basic-radio.liq +14 -6
  49. package/tests/liquidsoap/doc/content/liq/check +0 -0
  50. package/tests/liquidsoap/doc/content/liq/liquidsoap +0 -0
  51. package/tests/liquidsoap/doc/content/liq/medialib.sqlite.liq +4 -0
  52. package/tests/liquidsoap/doc/content/liq/on2-if2.liq +5 -2
  53. package/tests/liquidsoap/doc/content/liq/on2-initial.liq +10 -5
  54. package/tests/liquidsoap/doc/content/liq/on2-replaygain.liq +13 -4
  55. package/tests/liquidsoap/doc/content/liq/on2-volume.liq +4 -2
  56. package/tests/liquidsoap/doc/content/liq/playlists.liq +2 -1
  57. package/tests/liquidsoap/doc/content/liq/radiopi.liq +2 -6
  58. package/tests/liquidsoap/doc/content/liq/source-cue.liq +26 -0
  59. package/tests/liquidsoap/doc/content/liq/space_overhead.liq +0 -0
  60. package/tests/liquidsoap/doc/content/liq/split-cue.liq +7 -8
  61. package/tests/liquidsoap/doc/content/liq/sqlite.liq +120 -0
  62. package/tests/liquidsoap/doc/content/liq/video-in-video.liq +2 -0
  63. package/tests/liquidsoap/doc/content/migrating.md +12 -0
  64. package/tests/liquidsoap/doc/content/on2_part2.md +1 -1
  65. package/tests/liquidsoap/doc/content/playlist_parsers.md +2 -10
  66. package/tests/liquidsoap/doc/content/seek.md +1 -20
  67. package/tests/liquidsoap/doc/dune.inc +655 -0
  68. package/tests/liquidsoap/dune-project +8 -5
  69. package/tests/liquidsoap/liquidsoap +0 -0
  70. package/tests/liquidsoap/liquidsoap-core.opam +6 -4
  71. package/tests/liquidsoap/src/core/builtins/builtins_ffmpeg_bitstream_filters.ml +100 -128
  72. package/tests/liquidsoap/src/core/builtins/builtins_ffmpeg_decoder.ml +10 -11
  73. package/tests/liquidsoap/src/core/builtins/builtins_ffmpeg_encoder.ml +14 -15
  74. package/tests/liquidsoap/src/core/builtins/builtins_ffmpeg_filters.ml +33 -3
  75. package/tests/liquidsoap/src/core/builtins/builtins_files.ml +64 -12
  76. package/tests/liquidsoap/src/core/builtins/builtins_optionals.ml +0 -1
  77. package/tests/liquidsoap/src/core/builtins/builtins_prometheus.ml +4 -4
  78. package/tests/liquidsoap/src/core/builtins/builtins_request.ml +16 -1
  79. package/tests/liquidsoap/src/core/builtins/builtins_resolvers.ml +1 -1
  80. package/tests/liquidsoap/src/core/builtins/builtins_settings.ml +12 -2
  81. package/tests/liquidsoap/src/core/builtins/builtins_socket.ml +17 -4
  82. package/tests/liquidsoap/src/core/builtins/builtins_source.ml +17 -7
  83. package/tests/liquidsoap/src/core/builtins/builtins_sqlite.ml +362 -0
  84. package/tests/liquidsoap/src/core/builtins/builtins_ssl.ml +18 -9
  85. package/tests/liquidsoap/src/core/builtins/builtins_tls.ml +38 -27
  86. package/tests/liquidsoap/src/core/clock.ml +1 -1
  87. package/tests/liquidsoap/src/core/clock.mli +1 -1
  88. package/tests/liquidsoap/src/core/conversions/conversion.ml +4 -38
  89. package/tests/liquidsoap/src/core/conversions/mean.ml +12 -14
  90. package/tests/liquidsoap/src/core/conversions/stereo.ml +4 -4
  91. package/tests/liquidsoap/src/core/conversions/swap.ml +8 -23
  92. package/tests/liquidsoap/src/core/decoder/aac_decoder.ml +3 -3
  93. package/tests/liquidsoap/src/core/decoder/decoder.ml +134 -129
  94. package/tests/liquidsoap/src/core/decoder/decoder.mli +11 -4
  95. package/tests/liquidsoap/src/core/decoder/decoder_utils.ml +8 -9
  96. package/tests/liquidsoap/src/core/decoder/decoder_utils.mli +2 -2
  97. package/tests/liquidsoap/src/core/decoder/external_decoder.ml +7 -5
  98. package/tests/liquidsoap/src/core/decoder/ffmpeg_copy_decoder.ml +1 -1
  99. package/tests/liquidsoap/src/core/decoder/ffmpeg_decoder.ml +138 -60
  100. package/tests/liquidsoap/src/core/decoder/ffmpeg_decoder_common.ml +10 -0
  101. package/tests/liquidsoap/src/core/decoder/ffmpeg_internal_decoder.ml +1 -2
  102. package/tests/liquidsoap/src/core/decoder/ffmpeg_raw_decoder.ml +1 -1
  103. package/tests/liquidsoap/src/core/decoder/flac_metadata_plug.ml +3 -3
  104. package/tests/liquidsoap/src/core/decoder/gstreamer_decoder.ml +1 -2
  105. package/tests/liquidsoap/src/core/decoder/id3_plug.ml +3 -3
  106. package/tests/liquidsoap/src/core/decoder/image/sdlimage_decoder.ml +3 -3
  107. package/tests/liquidsoap/src/core/decoder/image_decoder.ml +25 -23
  108. package/tests/liquidsoap/src/core/decoder/image_plug.ml +3 -3
  109. package/tests/liquidsoap/src/core/decoder/liq_flac_decoder.ml +10 -11
  110. package/tests/liquidsoap/src/core/decoder/liq_ogg_decoder.ml +5 -5
  111. package/tests/liquidsoap/src/core/decoder/mad_decoder.ml +6 -7
  112. package/tests/liquidsoap/src/core/decoder/midi_decoder.ml +10 -10
  113. package/tests/liquidsoap/src/core/decoder/ogg_metadata_plug.ml +3 -3
  114. package/tests/liquidsoap/src/core/decoder/srt_decoder.ml +23 -15
  115. package/tests/liquidsoap/src/core/decoder/taglib_plug.ml +3 -3
  116. package/tests/liquidsoap/src/core/decoder/text/video_text_sdl.ml +12 -7
  117. package/tests/liquidsoap/src/core/decoder/video_plug.ml +3 -3
  118. package/tests/liquidsoap/src/core/dune +19 -22
  119. package/tests/liquidsoap/src/core/encoder/encoder.ml +1 -1
  120. package/tests/liquidsoap/src/core/encoder/encoder.mli +1 -1
  121. package/tests/liquidsoap/src/core/encoder/encoder_formats.ml +6 -0
  122. package/tests/liquidsoap/src/core/encoder/encoder_utils.ml +66 -0
  123. package/tests/liquidsoap/src/core/encoder/encoders/avi_encoder.ml +38 -39
  124. package/tests/liquidsoap/src/core/encoder/encoders/fdkaac_encoder.ml +1 -1
  125. package/tests/liquidsoap/src/core/encoder/encoders/ffmpeg_copy_encoder.ml +26 -24
  126. package/tests/liquidsoap/src/core/encoder/encoders/ffmpeg_encoder.ml +24 -6
  127. package/tests/liquidsoap/src/core/encoder/encoders/ffmpeg_encoder_common.ml +52 -45
  128. package/tests/liquidsoap/src/core/encoder/encoders/ffmpeg_internal_encoder.ml +55 -34
  129. package/tests/liquidsoap/src/core/encoder/encoders/gstreamer_encoder.ml +27 -22
  130. package/tests/liquidsoap/src/core/encoder/encoders/lame_encoder.ml +5 -4
  131. package/tests/liquidsoap/src/core/encoder/encoders/ogg_encoder.ml +14 -7
  132. package/tests/liquidsoap/src/core/encoder/encoders/shine_encoder.ml +4 -5
  133. package/tests/liquidsoap/src/core/encoder/formats/ffmpeg_format.ml +9 -0
  134. package/tests/liquidsoap/src/core/encoder/lang/lang_ffmpeg.ml +13 -10
  135. package/tests/liquidsoap/src/core/encoder/lang_encoder.ml +1 -1
  136. package/tests/liquidsoap/src/core/harbor/harbor.ml +7 -2
  137. package/tests/liquidsoap/src/core/harbor/harbor_base.ml +7 -3
  138. package/tests/liquidsoap/src/core/io/alsa_io.ml +8 -5
  139. package/tests/liquidsoap/src/core/io/ffmpeg_filter_io.ml +9 -14
  140. package/tests/liquidsoap/src/core/io/ffmpeg_io.ml +23 -24
  141. package/tests/liquidsoap/src/core/io/gstreamer_io.ml +24 -20
  142. package/tests/liquidsoap/src/core/io/oss_io.ml +7 -5
  143. package/tests/liquidsoap/src/core/io/portaudio_io.ml +7 -5
  144. package/tests/liquidsoap/src/core/io/pulseaudio_io.ml +8 -7
  145. package/tests/liquidsoap/src/core/io/srt_io.ml +115 -114
  146. package/tests/liquidsoap/src/core/io/udp_io.ml +6 -3
  147. package/tests/liquidsoap/src/core/lang.mli +3 -0
  148. package/tests/liquidsoap/src/core/lang_source.ml +23 -9
  149. package/tests/liquidsoap/src/core/ogg_formats/opus_encoder.ml +1 -1
  150. package/tests/liquidsoap/src/core/operators/accelerate.ml +10 -23
  151. package/tests/liquidsoap/src/core/operators/add.ml +131 -122
  152. package/tests/liquidsoap/src/core/operators/amplify.ml +36 -27
  153. package/tests/liquidsoap/src/core/operators/available.ml +20 -8
  154. package/tests/liquidsoap/src/core/operators/biquad_filter.ml +8 -8
  155. package/tests/liquidsoap/src/core/operators/chord.ml +7 -9
  156. package/tests/liquidsoap/src/core/operators/clip.ml +7 -7
  157. package/tests/liquidsoap/src/core/operators/comb.ml +7 -8
  158. package/tests/liquidsoap/src/core/operators/compand.ml +9 -9
  159. package/tests/liquidsoap/src/core/operators/compress.ml +15 -10
  160. package/tests/liquidsoap/src/core/operators/compress_exp.ml +8 -9
  161. package/tests/liquidsoap/src/core/operators/cross.ml +180 -247
  162. package/tests/liquidsoap/src/core/operators/defer.ml +8 -18
  163. package/tests/liquidsoap/src/core/operators/delay.ml +10 -18
  164. package/tests/liquidsoap/src/core/operators/delay_line.ml +9 -8
  165. package/tests/liquidsoap/src/core/operators/dtmf.ml +18 -16
  166. package/tests/liquidsoap/src/core/operators/dyn_op.ml +66 -63
  167. package/tests/liquidsoap/src/core/operators/echo.ml +8 -7
  168. package/tests/liquidsoap/src/core/operators/filter.ml +8 -8
  169. package/tests/liquidsoap/src/core/operators/filter_rc.ml +11 -10
  170. package/tests/liquidsoap/src/core/operators/fir_filter.ml +8 -7
  171. package/tests/liquidsoap/src/core/operators/flanger.ml +9 -8
  172. package/tests/liquidsoap/src/core/operators/frei0r_op.ml +113 -91
  173. package/tests/liquidsoap/src/core/operators/gate.ml +9 -8
  174. package/tests/liquidsoap/src/core/operators/iir_filter.ml +7 -7
  175. package/tests/liquidsoap/src/core/operators/insert_metadata.ml +29 -54
  176. package/tests/liquidsoap/src/core/operators/ladspa_op.ml +38 -36
  177. package/tests/liquidsoap/src/core/operators/lilv_op.ml +44 -44
  178. package/tests/liquidsoap/src/core/operators/lufs.ml +8 -8
  179. package/tests/liquidsoap/src/core/operators/map_metadata.ml +23 -20
  180. package/tests/liquidsoap/src/core/operators/map_op.ml +6 -7
  181. package/tests/liquidsoap/src/core/operators/max_duration.ml +21 -20
  182. package/tests/liquidsoap/src/core/operators/midi_routing.ml +13 -9
  183. package/tests/liquidsoap/src/core/operators/ms_stereo.ml +13 -15
  184. package/tests/liquidsoap/src/core/operators/muxer.ml +30 -101
  185. package/tests/liquidsoap/src/core/operators/noblank.ml +26 -48
  186. package/tests/liquidsoap/src/core/operators/normalize.ml +13 -9
  187. package/tests/liquidsoap/src/core/operators/on_end.ml +25 -12
  188. package/tests/liquidsoap/src/core/operators/on_frame.ml +9 -9
  189. package/tests/liquidsoap/src/core/operators/on_metadata.ml +9 -10
  190. package/tests/liquidsoap/src/core/operators/on_offset.ml +20 -13
  191. package/tests/liquidsoap/src/core/operators/on_track.ml +7 -10
  192. package/tests/liquidsoap/src/core/operators/pan.ml +7 -8
  193. package/tests/liquidsoap/src/core/operators/pipe.ml +14 -17
  194. package/tests/liquidsoap/src/core/operators/pitch.ml +7 -5
  195. package/tests/liquidsoap/src/core/operators/replaygain_op.ml +6 -6
  196. package/tests/liquidsoap/src/core/operators/resample.ml +7 -6
  197. package/tests/liquidsoap/src/core/operators/rms_smooth.ml +8 -8
  198. package/tests/liquidsoap/src/core/operators/sequence.ml +48 -58
  199. package/tests/liquidsoap/src/core/operators/soundtouch_op.ml +12 -12
  200. package/tests/liquidsoap/src/core/operators/st_bpm.ml +8 -7
  201. package/tests/liquidsoap/src/core/operators/stereotool_op.ml +5 -7
  202. package/tests/liquidsoap/src/core/operators/still_frame.ml +13 -10
  203. package/tests/liquidsoap/src/core/operators/switch.ml +128 -168
  204. package/tests/liquidsoap/src/core/operators/time_warp.ml +44 -103
  205. package/tests/liquidsoap/src/core/operators/track/merge_metadata.ml +31 -48
  206. package/tests/liquidsoap/src/core/operators/track_map.ml +6 -32
  207. package/tests/liquidsoap/src/core/operators/video_effects.ml +48 -13
  208. package/tests/liquidsoap/src/core/operators/video_fade.ml +69 -57
  209. package/tests/liquidsoap/src/core/operators/window_op.ml +8 -8
  210. package/tests/liquidsoap/src/core/outputs/graphics_out.ml +11 -8
  211. package/tests/liquidsoap/src/core/outputs/harbor_output.ml +3 -3
  212. package/tests/liquidsoap/src/core/outputs/hls_output.ml +203 -116
  213. package/tests/liquidsoap/src/core/outputs/icecast2.ml +31 -5
  214. package/tests/liquidsoap/src/core/outputs/output.ml +27 -31
  215. package/tests/liquidsoap/src/core/outputs/output.mli +4 -5
  216. package/tests/liquidsoap/src/core/outputs/pipe_output.ml +19 -8
  217. package/tests/liquidsoap/src/core/outputs/sdl_out.ml +12 -9
  218. package/tests/liquidsoap/src/core/playlist_parser.ml +2 -6
  219. package/tests/liquidsoap/src/core/request.ml +84 -36
  220. package/tests/liquidsoap/src/core/request.mli +11 -8
  221. package/tests/liquidsoap/src/core/source.ml +343 -181
  222. package/tests/liquidsoap/src/core/source.mli +147 -33
  223. package/tests/liquidsoap/src/core/sources/alsa_in.ml +4 -6
  224. package/tests/liquidsoap/src/core/sources/audio_gen.ml +23 -22
  225. package/tests/liquidsoap/src/core/sources/bjack_in.ml +7 -5
  226. package/tests/liquidsoap/src/core/sources/blank.ml +55 -36
  227. package/tests/liquidsoap/src/core/sources/debug_sources.ml +2 -2
  228. package/tests/liquidsoap/src/core/sources/external_input_video.ml +2 -3
  229. package/tests/liquidsoap/src/core/sources/generated.ml +25 -47
  230. package/tests/liquidsoap/src/core/sources/harbor_input.ml +7 -9
  231. package/tests/liquidsoap/src/core/sources/latest_metadata.ml +1 -2
  232. package/tests/liquidsoap/src/core/sources/noise.ml +38 -27
  233. package/tests/liquidsoap/src/core/sources/request_dynamic.ml +181 -198
  234. package/tests/liquidsoap/src/core/sources/synthesized.ml +36 -23
  235. package/tests/liquidsoap/src/core/sources/video_board.ml +8 -10
  236. package/tests/liquidsoap/src/core/sources/video_testsrc.ml +9 -11
  237. package/tests/liquidsoap/src/core/sources/video_text.ml +8 -11
  238. package/tests/liquidsoap/src/core/stream/aFrame.ml +0 -32
  239. package/tests/liquidsoap/src/core/stream/aFrame.mli +2 -46
  240. package/tests/liquidsoap/src/core/stream/content.ml +96 -11
  241. package/tests/liquidsoap/src/core/stream/content.mli +32 -22
  242. package/tests/liquidsoap/src/core/stream/content_audio.ml +8 -4
  243. package/tests/liquidsoap/src/core/stream/content_base.ml +24 -35
  244. package/tests/liquidsoap/src/core/stream/content_midi.ml +0 -1
  245. package/tests/liquidsoap/src/core/stream/content_pcm_base.ml +0 -1
  246. package/tests/liquidsoap/src/core/stream/content_timed.ml +15 -1
  247. package/tests/liquidsoap/src/core/stream/content_video.ml +91 -30
  248. package/tests/liquidsoap/src/core/stream/ffmpeg_content_base.ml +0 -49
  249. package/tests/liquidsoap/src/core/stream/ffmpeg_copy_content.ml +2 -1
  250. package/tests/liquidsoap/src/core/stream/ffmpeg_raw_content.ml +2 -1
  251. package/tests/liquidsoap/src/core/stream/frame.ml +67 -118
  252. package/tests/liquidsoap/src/core/stream/frame.mli +49 -43
  253. package/tests/liquidsoap/src/core/stream/frame_base.ml +20 -32
  254. package/tests/liquidsoap/src/core/stream/frame_settings.ml +13 -36
  255. package/tests/liquidsoap/src/core/stream/generator.ml +47 -140
  256. package/tests/liquidsoap/src/core/stream/generator.mli +6 -13
  257. package/tests/liquidsoap/src/core/stream/mFrame.ml +0 -12
  258. package/tests/liquidsoap/src/core/stream/mFrame.mli +0 -19
  259. package/tests/liquidsoap/src/core/stream/metadata_base.ml +75 -0
  260. package/tests/liquidsoap/src/core/stream/vFrame.ml +0 -16
  261. package/tests/liquidsoap/src/core/stream/vFrame.mli +1 -35
  262. package/tests/liquidsoap/src/core/synth/dssi_op.ml +19 -20
  263. package/tests/liquidsoap/src/core/synth/keyboard.ml +6 -10
  264. package/tests/liquidsoap/src/core/synth/keyboard_sdl.ml +5 -11
  265. package/tests/liquidsoap/src/core/synth/synth_op.ml +11 -10
  266. package/tests/liquidsoap/src/core/tools/http.ml +40 -6
  267. package/tests/liquidsoap/src/core/tools/http.mli +21 -3
  268. package/tests/liquidsoap/src/core/tools/liq_posix_time.ml +3 -1
  269. package/tests/liquidsoap/src/core/tools/producer_consumer.ml +7 -18
  270. package/tests/liquidsoap/src/core/tools/server.ml +1 -1
  271. package/tests/liquidsoap/src/core/tools/server_builtins.ml +1 -1
  272. package/tests/liquidsoap/src/core/tools/start_stop.ml +2 -6
  273. package/tests/liquidsoap/src/core/tools/tutils.ml +1 -1
  274. package/tests/liquidsoap/src/core/track.ml +1 -2
  275. package/tests/liquidsoap/src/core/visualization/midimeter.ml +7 -5
  276. package/tests/liquidsoap/src/core/visualization/video_volume.ml +55 -68
  277. package/tests/liquidsoap/src/core/visualization/vis_volume.ml +1 -1
  278. package/tests/liquidsoap/src/js/index.html +4 -4
  279. package/tests/liquidsoap/src/{core/builtins/builtins_magic.ml → lang/active_value.ml} +16 -12
  280. package/tests/liquidsoap/src/lang/active_value.mli +33 -0
  281. package/tests/liquidsoap/src/lang/builtins_math.ml +7 -6
  282. package/tests/liquidsoap/src/lang/dune +1 -0
  283. package/tests/liquidsoap/src/lang/environment.ml +3 -1
  284. package/tests/liquidsoap/src/lang/evaluation.ml +13 -2
  285. package/tests/liquidsoap/src/lang/lang.mli +3 -0
  286. package/tests/liquidsoap/src/lang/lang_core.ml +13 -6
  287. package/tests/liquidsoap/src/lang/lexer.ml +2 -0
  288. package/tests/liquidsoap/src/lang/methods.ml +1 -0
  289. package/tests/liquidsoap/src/lang/methods.mli +1 -0
  290. package/tests/liquidsoap/src/lang/modules.ml +1 -0
  291. package/tests/liquidsoap/src/lang/parser_helper.ml +10 -1
  292. package/tests/liquidsoap/src/lang/parser_helper.mli +8 -1
  293. package/tests/liquidsoap/src/lang/term/parsed_term.ml +2 -0
  294. package/tests/liquidsoap/src/lang/term/runtime_term.ml +6 -1
  295. package/tests/liquidsoap/src/lang/term/term_base.ml +128 -74
  296. package/tests/liquidsoap/src/lang/term/term_reducer.ml +69 -3
  297. package/tests/liquidsoap/src/lang/term.ml +0 -47
  298. package/tests/liquidsoap/src/lang/type.ml +17 -1
  299. package/tests/liquidsoap/src/lang/type.mli +1 -0
  300. package/tests/liquidsoap/src/lang/types/type_base.ml +1 -1
  301. package/tests/liquidsoap/src/lang/utils.ml +1 -0
  302. package/tests/liquidsoap/src/lang/value.ml +16 -2
  303. package/tests/liquidsoap/src/libs/error.liq +16 -0
  304. package/tests/liquidsoap/src/libs/extra/deprecations.liq +18 -0
  305. package/tests/liquidsoap/src/libs/extra/metadata.liq +101 -0
  306. package/tests/liquidsoap/src/libs/extra/openai.liq +152 -0
  307. package/tests/liquidsoap/src/libs/extra/server.liq +39 -25
  308. package/tests/liquidsoap/src/libs/extra/source.liq +188 -0
  309. package/tests/liquidsoap/src/libs/fades.liq +92 -46
  310. package/tests/liquidsoap/src/libs/file.liq +71 -5
  311. package/tests/liquidsoap/src/libs/medialib.liq +384 -2
  312. package/tests/liquidsoap/src/libs/metadata.liq +1 -9
  313. package/tests/liquidsoap/src/libs/playlist.liq +224 -141
  314. package/tests/liquidsoap/src/libs/request.liq +112 -84
  315. package/tests/liquidsoap/src/libs/server.liq +12 -0
  316. package/tests/liquidsoap/src/libs/source.liq +24 -3
  317. package/tests/liquidsoap/src/libs/sqlite.liq +164 -0
  318. package/tests/liquidsoap/src/libs/stdlib.liq +4 -0
  319. package/tests/liquidsoap/src/libs/string.liq +35 -1
  320. package/tests/liquidsoap/src/libs/utils.liq +8 -0
  321. package/tests/liquidsoap/src/libs/video.liq +2 -1
  322. package/tests/liquidsoap/src/runtime/build_config.ml +1 -1
  323. package/tests/liquidsoap/src/runtime/main.ml +1 -1
  324. package/tests/liquidsoap/src/tooling/parsed_json.ml +4 -0
  325. package/tests/liquidsoap/tests/core/content_test.ml +32 -20
  326. package/tests/liquidsoap/tests/core/decoder_test.ml +4 -4
  327. package/tests/liquidsoap/tests/core/ffmpeg_quality.ml +2 -0
  328. package/tests/liquidsoap/tests/core/frame_test.ml +0 -35
  329. package/tests/liquidsoap/tests/core/generator_test.ml +4 -4
  330. package/tests/liquidsoap/tests/core/more_types.ml +2 -0
  331. package/tests/liquidsoap/tests/core/output_encoded_test.ml +7 -5
  332. package/tests/liquidsoap/tests/core/output_test.ml +6 -11
  333. package/tests/liquidsoap/tests/core/stream_decoder_test.ml +3 -4
  334. package/tests/liquidsoap/tests/failures/ctype.liq +0 -0
  335. package/tests/liquidsoap/tests/failures/error.liq +0 -0
  336. package/tests/liquidsoap/tests/failures/record-invalid-member1.liq +0 -0
  337. package/tests/liquidsoap/tests/failures/record-invalid-member2.liq +0 -0
  338. package/tests/liquidsoap/tests/failures/ref.liq +0 -0
  339. package/tests/liquidsoap/tests/fixme/GH1170.liq +0 -0
  340. package/tests/liquidsoap/tests/fixme/cross2.liq +0 -0
  341. package/tests/liquidsoap/tests/fixme/cross3.liq +0 -0
  342. package/tests/liquidsoap/tests/fixme/sequence-1.liq +0 -0
  343. package/tests/liquidsoap/tests/language/bool.liq +1 -12
  344. package/tests/liquidsoap/tests/language/dune.inc +12 -0
  345. package/tests/liquidsoap/tests/language/file.liq +7 -2
  346. package/tests/liquidsoap/tests/language/functions.liq +2 -13
  347. package/tests/liquidsoap/tests/language/interactive.liq +5 -16
  348. package/tests/liquidsoap/tests/language/list.liq +73 -78
  349. package/tests/liquidsoap/tests/language/loop.liq +6 -18
  350. package/tests/liquidsoap/tests/language/mem_usage.liq +0 -1
  351. package/tests/liquidsoap/tests/language/metadata.liq +9 -13
  352. package/tests/liquidsoap/tests/language/null.liq +8 -12
  353. package/tests/liquidsoap/tests/language/number.liq +10 -0
  354. package/tests/liquidsoap/tests/language/pp.liq +8 -20
  355. package/tests/liquidsoap/tests/language/predicate.liq +6 -18
  356. package/tests/liquidsoap/tests/language/ref.liq +3 -15
  357. package/tests/liquidsoap/tests/language/regexp.liq +14 -25
  358. package/tests/liquidsoap/tests/language/sqlite.liq +96 -0
  359. package/tests/liquidsoap/tests/language/stdlib.liq +7 -20
  360. package/tests/liquidsoap/tests/language/string.liq +7 -0
  361. package/tests/liquidsoap/tests/media/dune.inc +39 -0
  362. package/tests/liquidsoap/tests/media/encoder_audio_only.liq.in +1 -1
  363. package/tests/liquidsoap/tests/media/encoder_audio_video.liq.in +1 -1
  364. package/tests/liquidsoap/tests/media/encoder_multitrack.liq.in +1 -1
  365. package/tests/liquidsoap/tests/media/encoder_video_only.liq.in +1 -1
  366. package/tests/liquidsoap/tests/media/ffmpeg_bitstream_filter.liq +94 -0
  367. package/tests/liquidsoap/tests/media/ffmpeg_complex_filter.liq +1 -1
  368. package/tests/liquidsoap/tests/media/ffmpeg_filter.liq +3 -9
  369. package/tests/liquidsoap/tests/media/ffmpeg_raw_hls.liq +15 -12
  370. package/tests/liquidsoap/tests/media/ffmpeg_transparency_filter.liq +3 -9
  371. package/tests/liquidsoap/tests/media/gen_dune.ml +1 -0
  372. package/tests/liquidsoap/tests/media/mk_encoder_test.sh +0 -0
  373. package/tests/liquidsoap/tests/media/mk_stream_test.sh +0 -0
  374. package/tests/liquidsoap/tests/media/multitrack.liq +21 -1
  375. package/tests/liquidsoap/tests/media/stream_audio.liq.in +0 -0
  376. package/tests/liquidsoap/tests/media/stream_video.liq.in +0 -0
  377. package/tests/liquidsoap/tests/performance/erathostenes.liq +0 -0
  378. package/tests/liquidsoap/tests/performance/memory.liq +0 -0
  379. package/tests/liquidsoap/tests/performance/small-record.liq +0 -0
  380. package/tests/liquidsoap/tests/regression/GH1327.liq +8 -0
  381. package/tests/liquidsoap/tests/regression/GH3316.liq +2 -0
  382. package/tests/liquidsoap/tests/regression/GH3645.liq +16 -0
  383. package/tests/liquidsoap/tests/regression/GH3675.liq +37 -0
  384. package/tests/liquidsoap/tests/regression/LS354-2.liq +11 -3
  385. package/tests/liquidsoap/tests/regression/dune.inc +45 -14
  386. package/tests/liquidsoap/tests/regression/track_sensitive.liq +17 -0
  387. package/tests/liquidsoap/tests/regression/unified-pcm-types.aac +0 -0
  388. package/tests/liquidsoap/tests/regression/unified-pcm-types.liq +3 -0
  389. package/tests/liquidsoap/tests/run_test.ml +7 -3
  390. package/tests/liquidsoap/tests/streams/195.liq +4 -1
  391. package/tests/liquidsoap/tests/streams/cross-override.liq +12 -4
  392. package/tests/liquidsoap/tests/streams/cross-persist-override.liq +12 -4
  393. package/tests/liquidsoap/tests/streams/cross.liq +1 -1
  394. package/tests/liquidsoap/tests/streams/crossfade.liq +11 -24
  395. package/tests/liquidsoap/tests/streams/cue-cut.liq +16 -0
  396. package/tests/liquidsoap/tests/streams/dtmf.liq +3 -0
  397. package/tests/liquidsoap/tests/streams/dtmf_pcm_s16.liq +4 -0
  398. package/tests/liquidsoap/tests/streams/dune.inc +145 -0
  399. package/tests/liquidsoap/tests/streams/fades-persistent-override.liq +7 -2
  400. package/tests/liquidsoap/tests/streams/hls_discontinuity.liq +68 -0
  401. package/tests/liquidsoap/tests/streams/hls_id3v2.liq +76 -4
  402. package/tests/liquidsoap/tests/streams/hls_large_frame.liq +31 -0
  403. package/tests/liquidsoap/tests/streams/merge_metadata.liq +2 -4
  404. package/tests/liquidsoap/tests/streams/no-cue-cut.liq +22 -0
  405. package/tests/liquidsoap/tests/streams/random.liq +4 -4
  406. package/tests/liquidsoap/tests/streams/rotate.liq +44 -21
  407. package/tests/liquidsoap/tests/streams/sharing.liq +5 -0
  408. package/tests/liquidsoap/tests/streams/source-cue.liq +134 -0
  409. package/tests/liquidsoap/tests/streams/srt_raw_pcm.liq +5 -0
  410. package/tests/liquidsoap/tests/test.liq +1 -2
  411. package/tests/run.sh +0 -0
  412. package/tests/liquidsoap/.github/opam/packages/duppy/duppy.0.9.3/opam +0 -37
  413. package/tests/liquidsoap/.github/opam/packages/ssl/ssl.0.7.0/opam +0 -40
  414. package/tests/liquidsoap/src/core/liqmagic.disabled.ml +0 -2
  415. package/tests/liquidsoap/src/core/liqmagic.enabled.ml +0 -3
  416. package/tests/liquidsoap/src/core/liqmagic.mli +0 -4
  417. package/tests/liquidsoap/src/core/operators/cuepoint.ml +0 -216
  418. package/tests/liquidsoap/tests/regression/GH3121.liq +0 -16
@@ -39,7 +39,7 @@ class virtual base source =
39
39
  method stype = source#stype
40
40
  method remaining = source#remaining
41
41
  method seek_source = source#seek_source
42
- method private _is_ready = source#is_ready
42
+ method private can_generate_frame = source#is_ready
43
43
  method self_sync = source#self_sync
44
44
  method abort_track = source#abort_track
45
45
  end
@@ -49,7 +49,7 @@ class virtual base_nosource =
49
49
  inherit source ~name:"lilv" ()
50
50
  method seek_source = (self :> Source.source)
51
51
  method stype = `Infallible
52
- method private _is_ready ?frame:_ _ = true
52
+ method private can_generate_frame = true
53
53
  val mutable must_fail = false
54
54
  method abort_track = must_fail <- true
55
55
  method remaining = -1
@@ -80,15 +80,14 @@ class lilv_mono (source : source) plugin input output params =
80
80
  Array.iter Plugin.Instance.activate i;
81
81
  inst <- Some i
82
82
 
83
- method private get_frame buf =
84
- let offset = AFrame.position buf in
85
- source#get buf;
86
- let b = AFrame.pcm buf in
83
+ method private generate_frame =
84
+ let b =
85
+ Content.Audio.get_data (source#get_mutable_content Frame.Fields.audio)
86
+ in
87
+ let len = source#frame_audio_position in
87
88
  let chans = Array.length b in
88
- let position = AFrame.position buf in
89
- let len = position - offset in
90
89
  let inst = Option.get inst in
91
- let ba = Audio.to_ba b offset len in
90
+ let ba = Audio.to_ba b 0 len in
92
91
  for c = 0 to chans - 1 do
93
92
  Plugin.Instance.connect_port_float inst.(c) input ba.(c);
94
93
  Plugin.Instance.connect_port_float inst.(c) output ba.(c);
@@ -98,8 +97,9 @@ class lilv_mono (source : source) plugin input output params =
98
97
  (constant_data len (v ())))
99
98
  params;
100
99
  Plugin.Instance.run inst.(c) len;
101
- Audio.copy_from_ba ba b offset len
102
- done
100
+ Audio.copy_from_ba ba b 0 len
101
+ done;
102
+ source#set_frame_data Frame.Fields.audio Content.Audio.lift_data b
103
103
  end
104
104
 
105
105
  class lilv (source : source) plugin inputs outputs params =
@@ -111,12 +111,11 @@ class lilv (source : source) plugin inputs outputs params =
111
111
 
112
112
  initializer Plugin.Instance.activate inst
113
113
 
114
- method private get_frame buf =
115
- let offset = AFrame.position buf in
116
- source#get buf;
117
- let b = AFrame.pcm buf in
118
- let position = AFrame.position buf in
119
- let len = position - offset in
114
+ method private generate_frame =
115
+ let b =
116
+ Content.Audio.get_data (source#get_mutable_content Frame.Fields.audio)
117
+ in
118
+ let len = source#frame_audio_position in
120
119
  List.iter
121
120
  (fun (p, v) ->
122
121
  let data =
@@ -125,7 +124,7 @@ class lilv (source : source) plugin inputs outputs params =
125
124
  Bigarray.Array1.fill data (v ());
126
125
  Plugin.Instance.connect_port_float inst p data)
127
126
  params;
128
- let ba = Audio.to_ba b offset len in
127
+ let ba = Audio.to_ba b 0 len in
129
128
  if Array.length inputs = Array.length outputs then (
130
129
  let chans = Array.length b in
131
130
  (* The simple case: number of channels does not get changed. *)
@@ -134,25 +133,25 @@ class lilv (source : source) plugin inputs outputs params =
134
133
  Plugin.Instance.connect_port_float inst outputs.(c) ba.(c)
135
134
  done;
136
135
  Plugin.Instance.run inst len;
137
- Audio.copy_from_ba ba b offset len)
136
+ Audio.copy_from_ba ba b 0 len)
138
137
  else (
139
138
  (* We have to change channels. *)
140
- let d = AFrame.pcm buf in
141
- let dba = Audio.to_ba d offset len in
139
+ let dba = Audio.to_ba b 0 len in
142
140
  for c = 0 to Array.length b - 1 do
143
141
  Plugin.Instance.connect_port_float inst inputs.(c) ba.(c)
144
142
  done;
145
- let output_chans = Array.length d in
143
+ let output_chans = Array.length b in
146
144
  for c = 0 to output_chans - 1 do
147
145
  Plugin.Instance.connect_port_float inst outputs.(c) dba.(c)
148
146
  done;
149
147
  Plugin.Instance.run inst len;
150
- Audio.copy_from_ba dba d offset len)
148
+ Audio.copy_from_ba dba b 0 len);
149
+ source#set_frame_data Frame.Fields.audio Content.Audio.lift_data b
151
150
  end
152
151
 
153
152
  (** An LV2 plugin without audio input. *)
154
153
  class lilv_nosource plugin outputs params =
155
- object
154
+ object (self)
156
155
  inherit base_nosource
157
156
  method self_sync = (`Static, false)
158
157
 
@@ -161,27 +160,28 @@ class lilv_nosource plugin outputs params =
161
160
 
162
161
  initializer Plugin.Instance.activate inst
163
162
 
164
- method private get_frame buf =
163
+ method private generate_frame =
165
164
  if must_fail then (
166
- AFrame.add_break buf (AFrame.position buf);
167
- must_fail <- false)
165
+ must_fail <- false;
166
+ self#end_of_track)
168
167
  else (
169
- let offset = AFrame.position buf in
170
- let b = AFrame.pcm buf in
168
+ let length = Lazy.force Frame.size in
169
+ let buf = Frame.create ~length self#content_type in
170
+ let b = Content.Audio.get_data (Frame.get buf Frame.Fields.audio) in
171
171
  let chans = Array.length b in
172
- let position = AFrame.size () in
173
- let len = position - offset in
174
- let ba = Audio.to_ba b offset len in
172
+ let alen = Frame.audio_of_main length in
173
+ let ba = Audio.to_ba b 0 alen in
175
174
  List.iter
176
175
  (fun (p, v) ->
177
- Plugin.Instance.connect_port_float inst p (constant_data len (v ())))
176
+ Plugin.Instance.connect_port_float inst p
177
+ (constant_data alen (v ())))
178
178
  params;
179
179
  for c = 0 to chans - 1 do
180
180
  Plugin.Instance.connect_port_float inst outputs.(c) ba.(c)
181
181
  done;
182
- Plugin.Instance.run inst len;
183
- Audio.copy_from_ba ba b offset len;
184
- AFrame.add_break buf position)
182
+ Plugin.Instance.run inst alen;
183
+ Audio.copy_from_ba ba b 0 alen;
184
+ Frame.set_data buf Frame.Fields.audio Content.Audio.lift_data b)
185
185
  end
186
186
 
187
187
  (** An LV2 plugin without audio output (e.g. to observe the stream). The input
@@ -195,21 +195,21 @@ class lilv_noout source plugin inputs params =
195
195
 
196
196
  initializer Plugin.Instance.activate inst
197
197
 
198
- method private get_frame buf =
199
- let offset = AFrame.position buf in
200
- let b = AFrame.pcm buf in
198
+ method private generate_frame =
199
+ let buf = source#get_frame in
200
+ let b = Content.Audio.get_data (Frame.get buf Frame.Fields.audio) in
201
201
  let chans = Array.length b in
202
- let position = AFrame.size () in
203
- let len = position - offset in
204
- let ba = Audio.to_ba b offset len in
202
+ let alen = source#frame_audio_position in
203
+ let ba = Audio.to_ba b 0 alen in
205
204
  List.iter
206
205
  (fun (p, v) ->
207
- Plugin.Instance.connect_port_float inst p (constant_data len (v ())))
206
+ Plugin.Instance.connect_port_float inst p (constant_data alen (v ())))
208
207
  params;
209
208
  for c = 0 to chans - 1 do
210
209
  Plugin.Instance.connect_port_float inst inputs.(c) ba.(c)
211
210
  done;
212
- Plugin.Instance.run inst len
211
+ Plugin.Instance.run inst alen;
212
+ buf
213
213
  end
214
214
 
215
215
  (* List the indexes of control ports. *)
@@ -107,7 +107,7 @@ class lufs window source =
107
107
  object (self)
108
108
  inherit operator [source] ~name:"lufs" as super
109
109
  method stype = source#stype
110
- method private _is_ready = source#is_ready
110
+ method private can_generate_frame = source#is_ready
111
111
  method remaining = source#remaining
112
112
  method seek_source = source#seek_source
113
113
  method abort_track = source#abort_track
@@ -156,14 +156,13 @@ class lufs window source =
156
156
  (** Momentary LUFS. *)
157
157
  method momentary = loudness (List.mean (List.prefix 4 ms_blocks))
158
158
 
159
- method private get_frame buf =
159
+ method private generate_frame =
160
160
  let channels = self#channels in
161
161
  let len_100ms = Frame.audio_of_seconds 0.1 in
162
- let offset = AFrame.position buf in
163
- source#get buf;
164
- let position = AFrame.position buf in
165
- let buf = AFrame.pcm buf in
166
- for i = offset to position - 1 do
162
+ let frame = source#get_frame in
163
+ let position = AFrame.position frame in
164
+ let buf = AFrame.pcm frame in
165
+ for i = 0 to position - 1 do
167
166
  let x = Array.init channels (fun c -> buf.(c).(i)) in
168
167
  (* Prefilter. *)
169
168
  let x = stage1 x in
@@ -181,7 +180,8 @@ class lufs window source =
181
180
  ms_len <- 0)
182
181
  done;
183
182
  (* Keep only a limited (by the window) number of blocks. *)
184
- ms_blocks <- List.prefix (int_of_float (window () /. 0.1)) ms_blocks
183
+ ms_blocks <- List.prefix (int_of_float (window () /. 0.1)) ms_blocks;
184
+ frame
185
185
  end
186
186
 
187
187
  let _ =
@@ -27,7 +27,7 @@ class map_metadata source rewrite_f insert_missing update strip =
27
27
  inherit operator ~name:"metadata.map" [source]
28
28
  initializer Typing.(self#frame_type <: Lang.unit_t)
29
29
  method stype = source#stype
30
- method private _is_ready = source#is_ready
30
+ method private can_generate_frame = source#is_ready
31
31
  method remaining = source#remaining
32
32
  method abort_track = source#abort_track
33
33
  method seek_source = source#seek_source
@@ -45,26 +45,29 @@ class map_metadata source rewrite_f insert_missing update strip =
45
45
  let m = if not update then Frame.Metadata.empty else m in
46
46
  List.fold_left replace_val m (Lang.to_list m')
47
47
 
48
- val mutable in_track = false
49
-
50
- method private get_frame buf =
51
- let p = Frame.position buf in
52
- source#get buf;
53
- if insert_missing && (not in_track) && Frame.position buf > p then (
54
- in_track <- true;
55
- match Frame.get_metadata buf p with
56
- | None ->
57
- self#log#important "Inserting missing metadata.";
58
- Frame.set_metadata buf p Frame.Metadata.empty
59
- | Some _ -> ());
60
- if Frame.is_partial buf then in_track <- false;
61
- List.iter
62
- (fun (t, m) ->
63
- if t >= p then (
64
- let m = self#rewrite m in
65
- if strip && Frame.Metadata.is_empty m then Frame.free_metadata buf t
66
- else Frame.set_metadata buf t m))
48
+ method private process buf =
49
+ List.fold_left
50
+ (fun buf (t, m) ->
51
+ let m = self#rewrite m in
52
+ if strip && Frame.Metadata.is_empty m then Frame.free_metadata buf t
53
+ else Frame.add_metadata buf t m)
54
+ buf
67
55
  (Frame.get_all_metadata buf)
56
+
57
+ method private generate_frame =
58
+ match self#split_frame source#get_frame with
59
+ | frame, None -> self#process frame
60
+ | frame, Some new_track ->
61
+ let frame = self#process frame in
62
+ let new_track = self#process new_track in
63
+ Frame.append frame
64
+ (match (insert_missing, Frame.get_metadata new_track 0) with
65
+ | false, _ -> new_track
66
+ | true, None ->
67
+ self#log#important "Inserting missing metadata.";
68
+ Frame.add_metadata new_track 0
69
+ (self#rewrite Frame.Metadata.empty)
70
+ | true, Some _ -> new_track)
68
71
  end
69
72
 
70
73
  let register =
@@ -29,18 +29,17 @@ class map ~field source f =
29
29
  method remaining = source#remaining
30
30
  method seek_source = source#seek_source
31
31
  method self_sync = source#self_sync
32
- method private _is_ready = source#is_ready
32
+ method private can_generate_frame = source#is_ready
33
33
  method abort_track = source#abort_track
34
34
 
35
- method private get_frame buf =
36
- let offset = AFrame.position buf in
37
- source#get buf;
38
- let b = Content.Audio.get_data (Frame.get buf field) in
39
- for i = offset to AFrame.position buf - 1 do
35
+ method private generate_frame =
36
+ let b = Content.Audio.get_data (source#get_mutable_content field) in
37
+ for i = 0 to source#frame_audio_position - 1 do
40
38
  for c = 0 to Array.length b - 1 do
41
39
  b.(c).(i) <- f b.(c).(i)
42
40
  done
43
- done
41
+ done;
42
+ source#set_frame_data field Content.Audio.lift_data b
44
43
  end
45
44
 
46
45
  let to_fun_float f x = Lang.to_float (Lang.apply f [("", Lang.float x)])
@@ -38,7 +38,7 @@ class max_duration ~override_meta ~duration source =
38
38
 
39
39
  method! private sleep = s#leave (self :> Source.operator)
40
40
  method stype = `Fallible
41
- method private _is_ready ?frame () = remaining > 0 && s#is_ready ?frame ()
41
+ method private can_generate_frame = remaining > 0 && s#is_ready
42
42
  method abort_track = s#abort_track
43
43
 
44
44
  method remaining =
@@ -50,31 +50,32 @@ class max_duration ~override_meta ~duration source =
50
50
  method! seek len = source#seek_source#seek (min remaining len)
51
51
  method seek_source = source#seek_source
52
52
 
53
- method private check_for_override ~offset buf =
53
+ method private check_for_override buf =
54
54
  List.iter
55
- (fun (p, m) ->
56
- if p >= offset then
57
- Frame.Metadata.iter
58
- (fun lbl v ->
59
- if lbl = override_meta then (
60
- try
61
- let v = float_of_string v in
62
- remaining <- Frame.main_of_seconds v;
63
- self#log#info "Overriding remaining value: %.02f." v
64
- with _ ->
65
- self#log#important "Invalid remaining override value: %s." v))
66
- m)
55
+ (fun (_, m) ->
56
+ Frame.Metadata.iter
57
+ (fun lbl v ->
58
+ if lbl = override_meta then (
59
+ try
60
+ let v = float_of_string v in
61
+ remaining <- Frame.main_of_seconds v;
62
+ self#log#info "Overriding remaining value: %.02f." v
63
+ with _ ->
64
+ self#log#important "Invalid remaining override value: %s." v))
65
+ m)
67
66
  (Frame.get_all_metadata buf)
68
67
 
69
- method private get_frame buf =
70
- let offset = Frame.position buf in
71
- s#get buf;
72
- self#check_for_override ~offset buf;
73
- remaining <- remaining - Frame.position buf + offset;
68
+ method private generate_frame =
69
+ let buf = s#get_frame in
70
+ self#check_for_override buf;
71
+ let pos = Frame.position buf in
72
+ let len = min remaining pos in
73
+ remaining <- remaining - len;
74
74
  if remaining <= 0 then (
75
75
  s#leave (self :> Source.source);
76
76
  s <- Debug_sources.empty ();
77
- s#get_ready [(self :> Source.source)])
77
+ s#get_ready [(self :> Source.source)]);
78
+ if len < pos then Frame.slice buf len else buf
78
79
  end
79
80
 
80
81
  let _ =
@@ -30,7 +30,7 @@ class virtual base ~name (source : source) =
30
30
  method remaining = source#remaining
31
31
  method seek_source = source#seek_source
32
32
  method self_sync = source#self_sync
33
- method private _is_ready = source#is_ready
33
+ method private can_generate_frame = source#is_ready
34
34
  method abort_track = source#abort_track
35
35
  end
36
36
 
@@ -38,23 +38,27 @@ class merge (source : source) out =
38
38
  object
39
39
  inherit base source ~name:"midi.merge_all"
40
40
 
41
- method private get_frame buf =
42
- source#get buf;
43
- let m = MFrame.midi buf in
41
+ method private generate_frame =
42
+ let m =
43
+ Content.Midi.get_data (source#get_mutable_content Frame.Fields.midi)
44
+ in
44
45
  for c = 0 to Array.length m - 1 do
45
46
  MIDI.merge m.(out) m.(c);
46
47
  if c <> out then MIDI.clear_all m.(c)
47
- done
48
+ done;
49
+ source#set_frame_data Frame.Fields.midi Content.Midi.lift_data m
48
50
  end
49
51
 
50
52
  class remove (source : source) t =
51
53
  object
52
54
  inherit base source ~name:"midi.remove"
53
55
 
54
- method private get_frame buf =
55
- source#get buf;
56
- let m = MFrame.midi buf in
57
- List.iter (fun c -> if c < Array.length m then MIDI.clear_all m.(c)) t
56
+ method private generate_frame =
57
+ let m =
58
+ Content.Midi.get_data (source#get_mutable_content Frame.Fields.midi)
59
+ in
60
+ List.iter (fun c -> if c < Array.length m then MIDI.clear_all m.(c)) t;
61
+ source#set_frame_data Frame.Fields.midi Content.Midi.lift_data m
58
62
  end
59
63
 
60
64
  let _ =
@@ -28,17 +28,15 @@ class msstereo ~field (source : source) mode width =
28
28
  object
29
29
  inherit operator ~name:"stereo.ms.encode" [source]
30
30
  method stype = source#stype
31
- method private _is_ready = source#is_ready
31
+ method private can_generate_frame = source#is_ready
32
32
  method remaining = source#remaining
33
33
  method seek_source = source#seek_source
34
34
  method self_sync = source#self_sync
35
35
  method abort_track = source#abort_track
36
36
 
37
- method private get_frame buf =
38
- let offset = AFrame.position buf in
39
- source#get buf;
40
- let buffer = Content.Audio.get_data (Frame.get buf field) in
41
- for i = offset to AFrame.position buf - 1 do
37
+ method private generate_frame =
38
+ let buffer = Content.Audio.get_data (source#get_mutable_content field) in
39
+ for i = 0 to source#frame_audio_position - 1 do
42
40
  match mode with
43
41
  | Encode ->
44
42
  let left = buffer.(0).(i) and right = buffer.(1).(i) in
@@ -54,7 +52,8 @@ class msstereo ~field (source : source) mode width =
54
52
  (* left *)
55
53
  buffer.(1).(i) <- mid -. (side *. width)
56
54
  (* right *)
57
- done
55
+ done;
56
+ source#set_frame_data field Content.Audio.lift_data buffer
58
57
  end
59
58
 
60
59
  let stereo_ms = Lang.add_module ~base:Stereo.stereo "ms"
@@ -90,17 +89,15 @@ class spatializer ~field ~width (source : source) =
90
89
  object
91
90
  inherit operator ~name:"stereo.width" [source]
92
91
  method stype = source#stype
93
- method private _is_ready = source#is_ready
92
+ method private can_generate_frame = source#is_ready
94
93
  method remaining = source#remaining
95
94
  method seek_source = source#seek_source
96
95
  method self_sync = source#self_sync
97
96
  method abort_track = source#abort_track
98
97
 
99
- method private get_frame buf =
100
- let offset = AFrame.position buf in
101
- source#get buf;
102
- let position = AFrame.position buf in
103
- let buf = Content.Audio.get_data (Frame.get buf field) in
98
+ method private generate_frame =
99
+ let position = source#frame_audio_position in
100
+ let buf = Content.Audio.get_data (source#get_mutable_content field) in
104
101
  let width = width () in
105
102
  let width = (width +. 1.) /. 2. in
106
103
  let a =
@@ -108,14 +105,15 @@ class spatializer ~field ~width (source : source) =
108
105
  let w' = 1. -. width in
109
106
  w /. sqrt ((w *. w) +. (w' *. w'))
110
107
  in
111
- for i = offset to position - 1 do
108
+ for i = 0 to position - 1 do
112
109
  let left = buf.(0).(i) in
113
110
  let right = buf.(1).(i) in
114
111
  let mid = (left +. right) /. 2. in
115
112
  let side = (left -. right) /. 2. in
116
113
  buf.(0).(i) <- ((1. -. a) *. mid) -. (a *. side);
117
114
  buf.(1).(i) <- ((1. -. a) *. mid) +. (a *. side)
118
- done
115
+ done;
116
+ source#set_frame_data field Content.Audio.lift_data buf
119
117
  end
120
118
 
121
119
  let _ =
@@ -40,10 +40,6 @@ class muxer tracks =
40
40
  else `Fallible
41
41
  in
42
42
  let self_sync_type = Utils.self_sync_type sources in
43
- let track_frames = ref [] in
44
- let clear_track_frames () =
45
- List.iter (fun (_, frame) -> Frame.clear frame) !track_frames
46
- in
47
43
  object (self)
48
44
  (* Pass duplicated list to operator to make sure caching is properly enabled. *)
49
45
  inherit
@@ -57,25 +53,17 @@ class muxer tracks =
57
53
  (Lazy.force self_sync_type, List.exists (fun s -> snd s#self_sync) sources)
58
54
 
59
55
  method abort_track = List.iter (fun s -> s#abort_track) sources
60
-
61
- method private sources_ready =
62
- List.for_all (fun s -> s#is_ready ?frame:None ()) sources
63
-
64
- method private _is_ready ?frame:_ () =
65
- Generator.length self#buffer > 0 || self#sources_ready
56
+ method private sources_ready = List.for_all (fun s -> s#is_ready) sources
57
+ method private can_generate_frame = self#sources_ready
66
58
 
67
59
  method! seek len =
68
- let gen_len = min (Generator.length self#buffer) len in
69
- Generator.truncate self#buffer gen_len;
70
- if gen_len = len then len
71
- else (
72
- let s = self#seek_source in
73
- if s == (self :> Source.source) then (
74
- self#log#info
75
- "Operator is muxing from multiple sources and cannot seek without \
76
- risking losing content synchronization!";
77
- gen_len)
78
- else gen_len + s#seek (len - gen_len))
60
+ let s = self#seek_source in
61
+ if s == (self :> Source.source) then (
62
+ self#log#info
63
+ "Operator is muxing from multiple sources and cannot seek without \
64
+ risking losing content synchronization!";
65
+ len)
66
+ else s#seek len
79
67
 
80
68
  method seek_source =
81
69
  match
@@ -89,86 +77,27 @@ class muxer tracks =
89
77
  | _ -> (self :> Source.source)
90
78
 
91
79
  method remaining =
92
- match
93
- ( Generator.remaining self#buffer,
94
- List.fold_left
95
- (fun r s -> if r = -1 then s#remaining else min r s#remaining)
96
- (-1)
97
- (List.filter (fun (s : Source.source) -> s#is_ready ()) sources) )
98
- with
99
- | -1, r -> r
100
- | r, _ -> r
101
-
102
- method private track_frame source =
103
- try List.assq source !track_frames
104
- with Not_found ->
105
- let f = Frame.create source#content_type in
106
- track_frames := (source, f) :: !track_frames;
107
- f
108
-
109
- method private feed_track ~tmp ~filled ~start ~stop
110
- { source_field; target_field; processor } =
111
- let c = Content.sub (Frame.get tmp source_field) start (stop - start) in
112
- match source_field with
113
- | f when f = Frame.Fields.metadata ->
114
- List.iter
115
- (fun (pos, m) -> Generator.add_metadata ~pos self#buffer m)
116
- (Content.Metadata.get_data c)
117
- | f when f = Frame.Fields.track_marks ->
118
- if Frame.is_partial tmp then
119
- Generator.add_track_mark ~pos:(stop - filled) self#buffer
120
- | _ -> Generator.put self#buffer target_field (processor c)
121
-
122
- method private feed_fields ~filled { fields; source } =
123
- let tmp = self#track_frame source in
124
- let start = Frame.position tmp in
125
- if Frame.is_partial tmp && source#is_ready ~frame:tmp () then (
126
- source#get tmp;
127
- let stop = Frame.position tmp in
128
- List.iter (self#feed_track ~tmp ~filled ~start ~stop) fields)
129
-
130
- (* In the current streaming model, we might still need to force
131
- a source#get to get the next break/metadata at the beginning of
132
- a track.
133
-
134
- TODO: get rid of this! *)
135
- method private feed ~force buf =
136
- let filled = Frame.position buf in
137
- if
138
- self#sources_ready
139
- && (force
140
- || Generator.remaining self#buffer = -1
141
- && filled + Generator.length self#buffer < Lazy.force Frame.size)
142
- then (
143
- List.iter (self#feed_fields ~filled) tracks;
144
- self#feed ~force:false buf)
145
-
146
- (* There are two situations here:
147
- - If we are tracking track marks from a source,
148
- we do need to stop at each track mark and let
149
- consumers of the muxed source call us back.
150
- - If we are not tracking track marks, we actually
151
- need to recurse when one of the source has one.
152
-
153
- Therefore, the implementation:
154
- - Keeps a global buffer of generated data.
155
- - Keeps a temporary track for each pulled sources
156
- - Implements the recursion above
157
- - Clears all temporary buffer at the end of each
158
- streaming cycle.
159
-
160
- This means that we do not buffer beyond the current
161
- frame and, also, that if one source becomes unavailable
162
- while streaming, we end all tracks when this source drops
163
- off. *)
164
- method get_frame buf =
165
- self#feed ~force:true buf;
166
- Generator.fill self#buffer buf
167
-
168
- initializer
169
- self#on_after_output (fun () ->
170
- clear_track_frames ();
171
- Generator.clear self#buffer)
80
+ List.fold_left
81
+ (fun r s -> if r = -1 then s#remaining else min r s#remaining)
82
+ (-1)
83
+ (List.filter (fun (s : Source.source) -> s#is_ready) sources)
84
+
85
+ method generate_frame =
86
+ let length = Lazy.force Frame.size in
87
+ let pos, frame =
88
+ List.fold_left
89
+ (fun (pos, frame) { fields; source } ->
90
+ let buf = source#get_frame in
91
+ ( min pos (Frame.position buf),
92
+ List.fold_left
93
+ (fun frame { source_field; target_field; processor } ->
94
+ let c = processor (Frame.get buf source_field) in
95
+ Frame.set frame target_field c)
96
+ frame fields ))
97
+ (length, Frame.create ~length Frame.Fields.empty)
98
+ tracks
99
+ in
100
+ Frame.slice frame pos
172
101
  end
173
102
 
174
103
  let muxer_operator p =